aboutsummaryrefslogtreecommitdiff
path: root/src/xdg/wm-base.zig
blob: 6a9df4790b665744dafa9ded587311803187709b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const std = @import("std");
const wayland = @import("../root.zig");
const wl = wayland.wl;

const Self = @This();

pub const Request = union(enum) {
    destroy: void,
    create_positioner: struct { wayland.Object.Ref },
    create_xdg_surface: struct { wayland.Object.Ref, wayland.Object.Ref },
    pong: struct { u32 },
};

pub const Events = wayland.EventSet(Self, .{ ping });

handle: wayland.Object.Ref,
init: wayland.Object.interface.Init(Self) = .{},


pub var globals: wayland.Object.interface.Global(Self) = .init;
pub const handler: wl.Registry.GlobalHandler = .{
    .interface = "xdg_wm_base",
    .version = 6,
    .handler = globals.register,
};

fn ping(
    self: *Self,
    ctx: wayland.Context,
    payload: u32,
) !void {
    try ctx.display.request(self, .{ .pong = .{ payload } });
}

pub fn format(
    self: *const Self,
    comptime fmt: []const u8,
    options: std.fmt.FormatOptions,
    writer: anytype,
) !void {
    _ = self;
    _ = fmt;
    _ = options;
    try writer.print("xdg.wm-base", .{});
}