stevee

My wayland statusbar
git clone git://gtms.dev/stevee
Log | Files | Refs | README | LICENSE

snapshot_expected.zig (190302B)


      1 // Generated by zig-wayland
      2 
      3 const std = @import("std");
      4 const assert = std.debug.assert;
      5 const posix = std.posix;
      6 
      7 pub const client = struct {
      8     pub const wl = struct {
      9         pub const Object = common.Object;
     10         pub const Message = common.Message;
     11         pub const Interface = common.Interface;
     12         pub const list = common.list;
     13         pub const Array = common.Array;
     14         pub const Fixed = common.Fixed;
     15         pub const Argument = common.Argument;
     16 
     17         pub const Proxy = opaque {
     18             extern fn wl_proxy_create(factory: *Proxy, interface: *const Interface) ?*Proxy;
     19             pub fn create(factory: *Proxy, interface: *const Interface) error{OutOfMemory}!*Proxy {
     20                 return wl_proxy_create(factory, interface) orelse error.OutOfMemory;
     21             }
     22 
     23             extern fn wl_proxy_destroy(proxy: *Proxy) void;
     24             pub const destroy = wl_proxy_destroy;
     25 
     26             extern fn wl_proxy_marshal_array(proxy: *Proxy, opcode: u32, args: ?[*]Argument) void;
     27             pub const marshal = wl_proxy_marshal_array;
     28 
     29             extern fn wl_proxy_marshal_array_constructor(
     30                 proxy: *Proxy,
     31                 opcode: u32,
     32                 args: [*]Argument,
     33                 interface: *const Interface,
     34             ) ?*Proxy;
     35             pub fn marshalConstructor(
     36                 proxy: *Proxy,
     37                 opcode: u32,
     38                 args: [*]Argument,
     39                 interface: *const Interface,
     40             ) error{OutOfMemory}!*Proxy {
     41                 return wl_proxy_marshal_array_constructor(proxy, opcode, args, interface) orelse
     42                     error.OutOfMemory;
     43             }
     44 
     45             extern fn wl_proxy_marshal_array_constructor_versioned(
     46                 proxy: *Proxy,
     47                 opcode: u32,
     48                 args: [*]Argument,
     49                 interface: *const Interface,
     50                 version: u32,
     51             ) ?*Proxy;
     52             pub fn marshalConstructorVersioned(
     53                 proxy: *Proxy,
     54                 opcode: u32,
     55                 args: [*]Argument,
     56                 interface: *const Interface,
     57                 version: u32,
     58             ) error{OutOfMemory}!*Proxy {
     59                 return wl_proxy_marshal_array_constructor_versioned(proxy, opcode, args, interface, version) orelse
     60                     error.OutOfMemory;
     61             }
     62 
     63             const DispatcherFn = fn (
     64                 implementation: ?*const anyopaque,
     65                 proxy: *Proxy,
     66                 opcode: u32,
     67                 message: *const Message,
     68                 args: [*]Argument,
     69             ) callconv(.C) c_int;
     70             extern fn wl_proxy_add_dispatcher(
     71                 proxy: *Proxy,
     72                 dispatcher: *const DispatcherFn,
     73                 implementation: ?*const anyopaque,
     74                 data: ?*anyopaque,
     75             ) c_int;
     76             pub fn addDispatcher(
     77                 proxy: *Proxy,
     78                 dispatcher: *const DispatcherFn,
     79                 implementation: ?*const anyopaque,
     80                 data: ?*anyopaque,
     81             ) void {
     82                 const ret = wl_proxy_add_dispatcher(proxy, dispatcher, implementation, data);
     83                 // Since there is no way to remove listeners, adding a listener to
     84                 // the same proxy twice is always a bug, so assert instead of returning
     85                 // an error.
     86                 assert(ret != -1); // If this fails, a listener was already added
     87             }
     88 
     89             extern fn wl_proxy_get_user_data(proxy: *Proxy) ?*anyopaque;
     90             pub const getUserData = wl_proxy_get_user_data;
     91 
     92             extern fn wl_proxy_get_version(proxy: *Proxy) u32;
     93             pub const getVersion = wl_proxy_get_version;
     94 
     95             extern fn wl_proxy_get_id(proxy: *Proxy) u32;
     96             pub const getId = wl_proxy_get_id;
     97 
     98             extern fn wl_proxy_set_queue(proxy: *Proxy, queue: *EventQueue) void;
     99             pub const setQueue = wl_proxy_set_queue;
    100         };
    101 
    102         pub const EventQueue = opaque {
    103             extern fn wl_event_queue_destroy(queue: *EventQueue) void;
    104             pub const destroy = wl_event_queue_destroy;
    105         };
    106 
    107         pub const EglWindow = opaque {
    108             extern fn wl_egl_window_create(surface: *client.wl.Surface, width: c_int, height: c_int) ?*EglWindow;
    109             pub fn create(surface: *client.wl.Surface, width: c_int, height: c_int) !*EglWindow {
    110                 // Why do people use int when they require a positive number?
    111                 assert(width > 0 and height > 0);
    112                 return wl_egl_window_create(surface, width, height) orelse error.OutOfMemory;
    113             }
    114 
    115             extern fn wl_egl_window_destroy(egl_window: *EglWindow) void;
    116             pub const destroy = wl_egl_window_destroy;
    117 
    118             extern fn wl_egl_window_resize(egl_window: *EglWindow, width: c_int, height: c_int, dx: c_int, dy: c_int) void;
    119             pub const resize = wl_egl_window_resize;
    120 
    121             extern fn wl_egl_window_get_attached_size(egl_window: *EglWindow, width: *c_int, height: *c_int) void;
    122             pub const getAttachedSize = wl_egl_window_get_attached_size;
    123         };
    124 
    125         pub const CursorTheme = opaque {
    126             extern fn wl_cursor_theme_load(name: ?[*:0]const u8, size: c_int, shm: *client.wl.Shm) ?*CursorTheme;
    127             pub fn load(name: ?[*:0]const u8, size: i32, shm: *client.wl.Shm) error{LoadThemeFailed}!*CursorTheme {
    128                 return wl_cursor_theme_load(name, @intCast(size), shm) orelse error.LoadThemeFailed;
    129             }
    130 
    131             extern fn wl_cursor_theme_destroy(wl_cursor_theme: *CursorTheme) void;
    132             pub const destroy = wl_cursor_theme_destroy;
    133 
    134             extern fn wl_cursor_theme_get_cursor(theme: *CursorTheme, name: [*:0]const u8) ?*Cursor;
    135             pub const getCursor = wl_cursor_theme_get_cursor;
    136         };
    137 
    138         pub const Cursor = extern struct {
    139             image_count: c_uint,
    140             images: [*]*CursorImage,
    141             name: [*:0]u8,
    142 
    143             extern fn wl_cursor_frame(cursor: *Cursor, time: u32) c_int;
    144             pub const frame = wl_cursor_frame;
    145 
    146             extern fn wl_cursor_frame_and_duration(cursor: *Cursor, time: u32, duration: *u32) c_int;
    147             pub const frameAndDuration = wl_cursor_frame_and_duration;
    148         };
    149 
    150         pub const CursorImage = extern struct {
    151             width: u32,
    152             height: u32,
    153             hotspot_x: u32,
    154             hotspot_y: u32,
    155             delay: u32,
    156 
    157             extern fn wl_cursor_image_get_buffer(image: *CursorImage) ?*client.wl.Buffer;
    158             pub fn getBuffer(image: *CursorImage) error{OutOfMemory}!*client.wl.Buffer {
    159                 return wl_cursor_image_get_buffer(image) orelse error.OutOfMemory;
    160             }
    161         };
    162         pub const Display = opaque {
    163             pub const generated_version = 1;
    164             pub const interface = &common.wl.display.interface;
    165             pub const Error = common.wl.display.Error;
    166             pub fn getId(_display: *Display) u32 {
    167                 return @as(*client.wl.Proxy, @ptrCast(_display)).getId();
    168             }
    169             pub fn getVersion(_display: *Display) u32 {
    170                 return @as(*client.wl.Proxy, @ptrCast(_display)).getVersion();
    171             }
    172             pub fn getUserData(_display: *Display) ?*anyopaque {
    173                 return @as(*client.wl.Proxy, @ptrCast(_display)).getUserData();
    174             }
    175             pub fn setQueue(_display: *Display, _queue: *client.wl.EventQueue) void {
    176                 const _proxy: *client.wl.Proxy = @ptrCast(_display);
    177                 _proxy.setQueue(_queue);
    178             }
    179             pub const Event = union(enum) {
    180                 @"error": struct {
    181                     object_id: ?*common.Object,
    182                     code: u32,
    183                     message: [*:0]const u8,
    184                 },
    185                 delete_id: struct {
    186                     id: u32,
    187                 },
    188             };
    189             pub inline fn setListener(
    190                 _display: *Display,
    191                 comptime T: type,
    192                 _listener: *const fn (display: *Display, event: Event, data: T) void,
    193                 _data: T,
    194             ) void {
    195                 const _proxy: *client.wl.Proxy = @ptrCast(_display);
    196                 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
    197                 _proxy.addDispatcher(common.Dispatcher(Display, T).dispatcher, _listener, _mut_data);
    198             }
    199             pub fn sync(_display: *Display) !*client.wl.Callback {
    200                 const _proxy: *client.wl.Proxy = @ptrCast(_display);
    201                 var _args = [_]common.Argument{
    202                     .{ .o = null },
    203                 };
    204                 return @ptrCast(try _proxy.marshalConstructor(0, &_args, client.wl.Callback.interface));
    205             }
    206             pub fn getRegistry(_display: *Display) !*client.wl.Registry {
    207                 const _proxy: *client.wl.Proxy = @ptrCast(_display);
    208                 var _args = [_]common.Argument{
    209                     .{ .o = null },
    210                 };
    211                 return @ptrCast(try _proxy.marshalConstructor(1, &_args, client.wl.Registry.interface));
    212             }
    213             extern fn wl_display_connect(name: ?[*:0]const u8) ?*Display;
    214             pub inline fn connect(name: ?[*:0]const u8) error{ConnectFailed}!*Display {
    215                 return wl_display_connect(name) orelse return error.ConnectFailed;
    216             }
    217 
    218             extern fn wl_display_connect_to_fd(fd: c_int) ?*Display;
    219             pub inline fn connectToFd(fd: c_int) error{ConnectFailed}!*Display {
    220                 return wl_display_connect_to_fd(fd) orelse return error.ConnectFailed;
    221             }
    222 
    223             extern fn wl_display_disconnect(display: *Display) void;
    224             pub const disconnect = wl_display_disconnect;
    225 
    226             extern fn wl_display_get_fd(display: *Display) c_int;
    227             pub const getFd = wl_display_get_fd;
    228 
    229             extern fn wl_display_dispatch(display: *Display) c_int;
    230             pub inline fn dispatch(display: *Display) posix.E {
    231                 return posix.errno(wl_display_dispatch(display));
    232             }
    233 
    234             extern fn wl_display_dispatch_queue(display: *Display, queue: *client.wl.EventQueue) c_int;
    235             pub inline fn dispatchQueue(display: *Display, queue: *client.wl.EventQueue) posix.E {
    236                 return posix.errno(wl_display_dispatch_queue(display, queue));
    237             }
    238 
    239             extern fn wl_display_dispatch_pending(display: *Display) c_int;
    240             pub inline fn dispatchPending(display: *Display) posix.E {
    241                 return posix.errno(wl_display_dispatch_pending(display));
    242             }
    243 
    244             extern fn wl_display_dispatch_queue_pending(display: *Display, queue: *client.wl.EventQueue) c_int;
    245             pub inline fn dispatchQueuePending(display: *Display, queue: *client.wl.EventQueue) posix.E {
    246                 return posix.errno(wl_display_dispatch_queue_pending(display, queue));
    247             }
    248 
    249             extern fn wl_display_roundtrip(display: *Display) c_int;
    250             pub inline fn roundtrip(display: *Display) posix.E {
    251                 return posix.errno(wl_display_roundtrip(display));
    252             }
    253 
    254             extern fn wl_display_roundtrip_queue(display: *Display, queue: *client.wl.EventQueue) c_int;
    255             pub inline fn roundtripQueue(display: *Display, queue: *client.wl.EventQueue) posix.E {
    256                 return posix.errno(wl_display_roundtrip_queue(display, queue));
    257             }
    258 
    259             extern fn wl_display_flush(display: *Display) c_int;
    260             pub inline fn flush(display: *Display) posix.E {
    261                 return posix.errno(wl_display_flush(display));
    262             }
    263 
    264             extern fn wl_display_create_queue(display: *Display) ?*client.wl.EventQueue;
    265             pub inline fn createQueue(display: *Display) error{OutOfMemory}!*client.wl.EventQueue {
    266                 return wl_display_create_queue(display) orelse error.OutOfMemory;
    267             }
    268 
    269             extern fn wl_display_get_error(display: *Display) c_int;
    270             pub const getError = wl_display_get_error;
    271 
    272             extern fn wl_display_prepare_read_queue(display: *Display, queue: *client.wl.EventQueue) c_int;
    273             /// Succeeds if the queue is empty and returns true.
    274             /// Fails and returns false if the queue was not empty.
    275             pub inline fn prepareReadQueue(display: *Display, queue: *client.wl.EventQueue) bool {
    276                 switch (wl_display_prepare_read_queue(display, queue)) {
    277                     0 => return true,
    278                     -1 => return false,
    279                     else => unreachable,
    280                 }
    281             }
    282 
    283             extern fn wl_display_prepare_read(display: *Display) c_int;
    284             /// Succeeds if the queue is empty and returns true.
    285             /// Fails and returns false if the queue was not empty.
    286             pub inline fn prepareRead(display: *Display) bool {
    287                 switch (wl_display_prepare_read(display)) {
    288                     0 => return true,
    289                     -1 => return false,
    290                     else => unreachable,
    291                 }
    292             }
    293 
    294             extern fn wl_display_cancel_read(display: *Display) void;
    295             pub const cancelRead = wl_display_cancel_read;
    296 
    297             extern fn wl_display_read_events(display: *Display) c_int;
    298             pub inline fn readEvents(display: *Display) posix.E {
    299                 return posix.errno(wl_display_read_events(display));
    300             }
    301         };
    302         pub const Registry = opaque {
    303             pub const generated_version = 1;
    304             pub const interface = &common.wl.registry.interface;
    305             pub fn getId(_registry: *Registry) u32 {
    306                 return @as(*client.wl.Proxy, @ptrCast(_registry)).getId();
    307             }
    308             pub fn getVersion(_registry: *Registry) u32 {
    309                 return @as(*client.wl.Proxy, @ptrCast(_registry)).getVersion();
    310             }
    311             pub fn getUserData(_registry: *Registry) ?*anyopaque {
    312                 return @as(*client.wl.Proxy, @ptrCast(_registry)).getUserData();
    313             }
    314             pub fn setQueue(_registry: *Registry, _queue: *client.wl.EventQueue) void {
    315                 const _proxy: *client.wl.Proxy = @ptrCast(_registry);
    316                 _proxy.setQueue(_queue);
    317             }
    318             pub const Event = union(enum) {
    319                 global: struct {
    320                     name: u32,
    321                     interface: [*:0]const u8,
    322                     version: u32,
    323                 },
    324                 global_remove: struct {
    325                     name: u32,
    326                 },
    327             };
    328             pub inline fn setListener(
    329                 _registry: *Registry,
    330                 comptime T: type,
    331                 _listener: *const fn (registry: *Registry, event: Event, data: T) void,
    332                 _data: T,
    333             ) void {
    334                 const _proxy: *client.wl.Proxy = @ptrCast(_registry);
    335                 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
    336                 _proxy.addDispatcher(common.Dispatcher(Registry, T).dispatcher, _listener, _mut_data);
    337             }
    338             pub fn bind(_registry: *Registry, _name: u32, comptime T: type, _version: u32) !*T {
    339                 const version_to_construct = @min(T.generated_version, _version);
    340                 const _proxy: *client.wl.Proxy = @ptrCast(_registry);
    341                 var _args = [_]common.Argument{
    342                     .{ .u = _name },                .{ .s = T.interface.name },
    343                     .{ .u = version_to_construct }, .{ .o = null },
    344                 };
    345                 return @ptrCast(try _proxy.marshalConstructorVersioned(0, &_args, T.interface, version_to_construct));
    346             }
    347             pub fn destroy(_registry: *Registry) void {
    348                 const _proxy: *client.wl.Proxy = @ptrCast(_registry);
    349                 _proxy.destroy();
    350             }
    351         };
    352         pub const Callback = opaque {
    353             pub const generated_version = 1;
    354             pub const interface = &common.wl.callback.interface;
    355             pub fn getId(_callback: *Callback) u32 {
    356                 return @as(*client.wl.Proxy, @ptrCast(_callback)).getId();
    357             }
    358             pub fn getVersion(_callback: *Callback) u32 {
    359                 return @as(*client.wl.Proxy, @ptrCast(_callback)).getVersion();
    360             }
    361             pub fn getUserData(_callback: *Callback) ?*anyopaque {
    362                 return @as(*client.wl.Proxy, @ptrCast(_callback)).getUserData();
    363             }
    364             pub fn setQueue(_callback: *Callback, _queue: *client.wl.EventQueue) void {
    365                 const _proxy: *client.wl.Proxy = @ptrCast(_callback);
    366                 _proxy.setQueue(_queue);
    367             }
    368             pub const Event = union(enum) {
    369                 done: struct {
    370                     callback_data: u32,
    371                 },
    372             };
    373             pub inline fn setListener(
    374                 _callback: *Callback,
    375                 comptime T: type,
    376                 _listener: *const fn (callback: *Callback, event: Event, data: T) void,
    377                 _data: T,
    378             ) void {
    379                 const _proxy: *client.wl.Proxy = @ptrCast(_callback);
    380                 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
    381                 _proxy.addDispatcher(common.Dispatcher(Callback, T).dispatcher, _listener, _mut_data);
    382             }
    383             pub fn destroy(_callback: *Callback) void {
    384                 const _proxy: *client.wl.Proxy = @ptrCast(_callback);
    385                 _proxy.destroy();
    386             }
    387         };
    388         pub const Buffer = opaque {
    389             pub const generated_version = 1;
    390             pub const interface = &common.wl.buffer.interface;
    391             pub fn getId(_buffer: *Buffer) u32 {
    392                 return @as(*client.wl.Proxy, @ptrCast(_buffer)).getId();
    393             }
    394             pub fn getVersion(_buffer: *Buffer) u32 {
    395                 return @as(*client.wl.Proxy, @ptrCast(_buffer)).getVersion();
    396             }
    397             pub fn getUserData(_buffer: *Buffer) ?*anyopaque {
    398                 return @as(*client.wl.Proxy, @ptrCast(_buffer)).getUserData();
    399             }
    400             pub fn setQueue(_buffer: *Buffer, _queue: *client.wl.EventQueue) void {
    401                 const _proxy: *client.wl.Proxy = @ptrCast(_buffer);
    402                 _proxy.setQueue(_queue);
    403             }
    404             pub const Event = union(enum) {
    405                 release: void,
    406             };
    407             pub inline fn setListener(
    408                 _buffer: *Buffer,
    409                 comptime T: type,
    410                 _listener: *const fn (buffer: *Buffer, event: Event, data: T) void,
    411                 _data: T,
    412             ) void {
    413                 const _proxy: *client.wl.Proxy = @ptrCast(_buffer);
    414                 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
    415                 _proxy.addDispatcher(common.Dispatcher(Buffer, T).dispatcher, _listener, _mut_data);
    416             }
    417             pub fn destroy(_buffer: *Buffer) void {
    418                 const _proxy: *client.wl.Proxy = @ptrCast(_buffer);
    419                 _proxy.marshal(0, null);
    420                 _proxy.destroy();
    421             }
    422         };
    423         pub const Compositor = opaque {
    424             pub const generated_version = 1;
    425             pub const interface = &common.wl.compositor.interface;
    426             pub fn getId(_compositor: *Compositor) u32 {
    427                 return @as(*client.wl.Proxy, @ptrCast(_compositor)).getId();
    428             }
    429             pub fn getVersion(_compositor: *Compositor) u32 {
    430                 return @as(*client.wl.Proxy, @ptrCast(_compositor)).getVersion();
    431             }
    432             pub fn getUserData(_compositor: *Compositor) ?*anyopaque {
    433                 return @as(*client.wl.Proxy, @ptrCast(_compositor)).getUserData();
    434             }
    435             pub fn setQueue(_compositor: *Compositor, _queue: *client.wl.EventQueue) void {
    436                 const _proxy: *client.wl.Proxy = @ptrCast(_compositor);
    437                 _proxy.setQueue(_queue);
    438             }
    439             pub fn createSurface(_compositor: *Compositor) !*client.wl.Surface {
    440                 const _proxy: *client.wl.Proxy = @ptrCast(_compositor);
    441                 var _args = [_]common.Argument{
    442                     .{ .o = null },
    443                 };
    444                 return @ptrCast(try _proxy.marshalConstructor(0, &_args, client.wl.Surface.interface));
    445             }
    446             pub fn createRegion(_compositor: *Compositor) !*client.wl.Region {
    447                 const _proxy: *client.wl.Proxy = @ptrCast(_compositor);
    448                 var _args = [_]common.Argument{
    449                     .{ .o = null },
    450                 };
    451                 return @ptrCast(try _proxy.marshalConstructor(1, &_args, client.wl.Region.interface));
    452             }
    453             pub fn destroy(_compositor: *Compositor) void {
    454                 const _proxy: *client.wl.Proxy = @ptrCast(_compositor);
    455                 _proxy.destroy();
    456             }
    457         };
    458         pub const Surface = opaque {
    459             pub const generated_version = 1;
    460             pub const interface = &common.wl.surface.interface;
    461             pub const Error = common.wl.surface.Error;
    462             pub fn getId(_surface: *Surface) u32 {
    463                 return @as(*client.wl.Proxy, @ptrCast(_surface)).getId();
    464             }
    465             pub fn getVersion(_surface: *Surface) u32 {
    466                 return @as(*client.wl.Proxy, @ptrCast(_surface)).getVersion();
    467             }
    468             pub fn getUserData(_surface: *Surface) ?*anyopaque {
    469                 return @as(*client.wl.Proxy, @ptrCast(_surface)).getUserData();
    470             }
    471             pub fn setQueue(_surface: *Surface, _queue: *client.wl.EventQueue) void {
    472                 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
    473                 _proxy.setQueue(_queue);
    474             }
    475             pub const Event = union(enum) {
    476                 enter: struct {
    477                     output: ?*client.wl.Output,
    478                 },
    479                 leave: struct {
    480                     output: ?*client.wl.Output,
    481                 },
    482             };
    483             pub inline fn setListener(
    484                 _surface: *Surface,
    485                 comptime T: type,
    486                 _listener: *const fn (surface: *Surface, event: Event, data: T) void,
    487                 _data: T,
    488             ) void {
    489                 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
    490                 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
    491                 _proxy.addDispatcher(common.Dispatcher(Surface, T).dispatcher, _listener, _mut_data);
    492             }
    493             pub fn destroy(_surface: *Surface) void {
    494                 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
    495                 _proxy.marshal(0, null);
    496                 _proxy.destroy();
    497             }
    498             pub fn attach(_surface: *Surface, _buffer: ?*client.wl.Buffer, _x: i32, _y: i32) void {
    499                 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
    500                 var _args = [_]common.Argument{
    501                     .{ .o = @ptrCast(_buffer) },
    502                     .{ .i = _x },
    503                     .{ .i = _y },
    504                 };
    505                 _proxy.marshal(1, &_args);
    506             }
    507             pub fn damage(_surface: *Surface, _x: i32, _y: i32, _width: i32, _height: i32) void {
    508                 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
    509                 var _args = [_]common.Argument{
    510                     .{ .i = _x },
    511                     .{ .i = _y },
    512                     .{ .i = _width },
    513                     .{ .i = _height },
    514                 };
    515                 _proxy.marshal(2, &_args);
    516             }
    517             pub fn frame(_surface: *Surface) !*client.wl.Callback {
    518                 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
    519                 var _args = [_]common.Argument{
    520                     .{ .o = null },
    521                 };
    522                 return @ptrCast(try _proxy.marshalConstructor(3, &_args, client.wl.Callback.interface));
    523             }
    524             pub fn setOpaqueRegion(_surface: *Surface, _region: ?*client.wl.Region) void {
    525                 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
    526                 var _args = [_]common.Argument{
    527                     .{ .o = @ptrCast(_region) },
    528                 };
    529                 _proxy.marshal(4, &_args);
    530             }
    531             pub fn setInputRegion(_surface: *Surface, _region: ?*client.wl.Region) void {
    532                 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
    533                 var _args = [_]common.Argument{
    534                     .{ .o = @ptrCast(_region) },
    535                 };
    536                 _proxy.marshal(5, &_args);
    537             }
    538             pub fn commit(_surface: *Surface) void {
    539                 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
    540                 _proxy.marshal(6, null);
    541             }
    542         };
    543         pub const Region = opaque {
    544             pub const generated_version = 1;
    545             pub const interface = &common.wl.region.interface;
    546             pub fn getId(_region: *Region) u32 {
    547                 return @as(*client.wl.Proxy, @ptrCast(_region)).getId();
    548             }
    549             pub fn getVersion(_region: *Region) u32 {
    550                 return @as(*client.wl.Proxy, @ptrCast(_region)).getVersion();
    551             }
    552             pub fn getUserData(_region: *Region) ?*anyopaque {
    553                 return @as(*client.wl.Proxy, @ptrCast(_region)).getUserData();
    554             }
    555             pub fn setQueue(_region: *Region, _queue: *client.wl.EventQueue) void {
    556                 const _proxy: *client.wl.Proxy = @ptrCast(_region);
    557                 _proxy.setQueue(_queue);
    558             }
    559             pub fn destroy(_region: *Region) void {
    560                 const _proxy: *client.wl.Proxy = @ptrCast(_region);
    561                 _proxy.marshal(0, null);
    562                 _proxy.destroy();
    563             }
    564             pub fn add(_region: *Region, _x: i32, _y: i32, _width: i32, _height: i32) void {
    565                 const _proxy: *client.wl.Proxy = @ptrCast(_region);
    566                 var _args = [_]common.Argument{
    567                     .{ .i = _x },
    568                     .{ .i = _y },
    569                     .{ .i = _width },
    570                     .{ .i = _height },
    571                 };
    572                 _proxy.marshal(1, &_args);
    573             }
    574             pub fn subtract(_region: *Region, _x: i32, _y: i32, _width: i32, _height: i32) void {
    575                 const _proxy: *client.wl.Proxy = @ptrCast(_region);
    576                 var _args = [_]common.Argument{
    577                     .{ .i = _x },
    578                     .{ .i = _y },
    579                     .{ .i = _width },
    580                     .{ .i = _height },
    581                 };
    582                 _proxy.marshal(2, &_args);
    583             }
    584         };
    585         pub const Shm = opaque {
    586             pub const generated_version = 1;
    587             pub const interface = &common.wl.shm.interface;
    588             pub const Error = common.wl.shm.Error;
    589             pub const Format = common.wl.shm.Format;
    590             pub fn getId(_shm: *Shm) u32 {
    591                 return @as(*client.wl.Proxy, @ptrCast(_shm)).getId();
    592             }
    593             pub fn getVersion(_shm: *Shm) u32 {
    594                 return @as(*client.wl.Proxy, @ptrCast(_shm)).getVersion();
    595             }
    596             pub fn getUserData(_shm: *Shm) ?*anyopaque {
    597                 return @as(*client.wl.Proxy, @ptrCast(_shm)).getUserData();
    598             }
    599             pub fn setQueue(_shm: *Shm, _queue: *client.wl.EventQueue) void {
    600                 const _proxy: *client.wl.Proxy = @ptrCast(_shm);
    601                 _proxy.setQueue(_queue);
    602             }
    603             pub const Event = union(enum) {
    604                 format: struct {
    605                     format: Format,
    606                 },
    607             };
    608             pub inline fn setListener(
    609                 _shm: *Shm,
    610                 comptime T: type,
    611                 _listener: *const fn (shm: *Shm, event: Event, data: T) void,
    612                 _data: T,
    613             ) void {
    614                 const _proxy: *client.wl.Proxy = @ptrCast(_shm);
    615                 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
    616                 _proxy.addDispatcher(common.Dispatcher(Shm, T).dispatcher, _listener, _mut_data);
    617             }
    618             pub fn createPool(_shm: *Shm, _fd: i32, _size: i32) !*client.wl.ShmPool {
    619                 const _proxy: *client.wl.Proxy = @ptrCast(_shm);
    620                 var _args = [_]common.Argument{
    621                     .{ .o = null },
    622                     .{ .h = _fd },
    623                     .{ .i = _size },
    624                 };
    625                 return @ptrCast(try _proxy.marshalConstructor(0, &_args, client.wl.ShmPool.interface));
    626             }
    627             pub fn destroy(_shm: *Shm) void {
    628                 const _proxy: *client.wl.Proxy = @ptrCast(_shm);
    629                 _proxy.destroy();
    630             }
    631         };
    632         pub const ShmPool = opaque {
    633             pub const generated_version = 1;
    634             pub const interface = &common.wl.shm_pool.interface;
    635             pub fn getId(_shm_pool: *ShmPool) u32 {
    636                 return @as(*client.wl.Proxy, @ptrCast(_shm_pool)).getId();
    637             }
    638             pub fn getVersion(_shm_pool: *ShmPool) u32 {
    639                 return @as(*client.wl.Proxy, @ptrCast(_shm_pool)).getVersion();
    640             }
    641             pub fn getUserData(_shm_pool: *ShmPool) ?*anyopaque {
    642                 return @as(*client.wl.Proxy, @ptrCast(_shm_pool)).getUserData();
    643             }
    644             pub fn setQueue(_shm_pool: *ShmPool, _queue: *client.wl.EventQueue) void {
    645                 const _proxy: *client.wl.Proxy = @ptrCast(_shm_pool);
    646                 _proxy.setQueue(_queue);
    647             }
    648             pub fn createBuffer(_shm_pool: *ShmPool, _offset: i32, _width: i32, _height: i32, _stride: i32, _format: common.wl.shm.Format) !*client.wl.Buffer {
    649                 const _proxy: *client.wl.Proxy = @ptrCast(_shm_pool);
    650                 var _args = [_]common.Argument{
    651                     .{ .o = null }, .{ .i = _offset }, .{ .i = _width }, .{ .i = _height }, .{ .i = _stride }, .{ .u = switch (@typeInfo(common.wl.shm.Format)) {
    652                         .@"enum" => @as(u32, @intCast(@intFromEnum(_format))),
    653                         .@"struct" => @bitCast(_format),
    654                         else => unreachable,
    655                     } },
    656                 };
    657                 return @ptrCast(try _proxy.marshalConstructor(0, &_args, client.wl.Buffer.interface));
    658             }
    659             pub fn destroy(_shm_pool: *ShmPool) void {
    660                 const _proxy: *client.wl.Proxy = @ptrCast(_shm_pool);
    661                 _proxy.marshal(1, null);
    662                 _proxy.destroy();
    663             }
    664             pub fn resize(_shm_pool: *ShmPool, _size: i32) void {
    665                 const _proxy: *client.wl.Proxy = @ptrCast(_shm_pool);
    666                 var _args = [_]common.Argument{
    667                     .{ .i = _size },
    668                 };
    669                 _proxy.marshal(2, &_args);
    670             }
    671         };
    672         pub const Seat = opaque {
    673             pub const generated_version = 2;
    674             pub const interface = &common.wl.seat.interface;
    675             pub const Capability = common.wl.seat.Capability;
    676             pub const Error = common.wl.seat.Error;
    677             pub fn getId(_seat: *Seat) u32 {
    678                 return @as(*client.wl.Proxy, @ptrCast(_seat)).getId();
    679             }
    680             pub fn getVersion(_seat: *Seat) u32 {
    681                 return @as(*client.wl.Proxy, @ptrCast(_seat)).getVersion();
    682             }
    683             pub fn getUserData(_seat: *Seat) ?*anyopaque {
    684                 return @as(*client.wl.Proxy, @ptrCast(_seat)).getUserData();
    685             }
    686             pub fn setQueue(_seat: *Seat, _queue: *client.wl.EventQueue) void {
    687                 const _proxy: *client.wl.Proxy = @ptrCast(_seat);
    688                 _proxy.setQueue(_queue);
    689             }
    690             pub const Event = union(enum) {
    691                 capabilities: struct {
    692                     capabilities: Capability,
    693                 },
    694                 name: struct {
    695                     name: [*:0]const u8,
    696                 },
    697             };
    698             pub inline fn setListener(
    699                 _seat: *Seat,
    700                 comptime T: type,
    701                 _listener: *const fn (seat: *Seat, event: Event, data: T) void,
    702                 _data: T,
    703             ) void {
    704                 const _proxy: *client.wl.Proxy = @ptrCast(_seat);
    705                 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
    706                 _proxy.addDispatcher(common.Dispatcher(Seat, T).dispatcher, _listener, _mut_data);
    707             }
    708             pub fn getPointer(_seat: *Seat) !*client.wl.Pointer {
    709                 const _proxy: *client.wl.Proxy = @ptrCast(_seat);
    710                 var _args = [_]common.Argument{
    711                     .{ .o = null },
    712                 };
    713                 return @ptrCast(try _proxy.marshalConstructor(0, &_args, client.wl.Pointer.interface));
    714             }
    715             pub fn getKeyboard(_seat: *Seat) !*client.wl.Keyboard {
    716                 const _proxy: *client.wl.Proxy = @ptrCast(_seat);
    717                 var _args = [_]common.Argument{
    718                     .{ .o = null },
    719                 };
    720                 return @ptrCast(try _proxy.marshalConstructor(1, &_args, client.wl.Keyboard.interface));
    721             }
    722             pub fn getTouch(_seat: *Seat) !*client.wl.Touch {
    723                 const _proxy: *client.wl.Proxy = @ptrCast(_seat);
    724                 var _args = [_]common.Argument{
    725                     .{ .o = null },
    726                 };
    727                 return @ptrCast(try _proxy.marshalConstructor(2, &_args, client.wl.Touch.interface));
    728             }
    729             pub fn destroy(_seat: *Seat) void {
    730                 const _proxy: *client.wl.Proxy = @ptrCast(_seat);
    731                 _proxy.destroy();
    732             }
    733         };
    734         pub const Pointer = opaque {
    735             pub const generated_version = 2;
    736             pub const interface = &common.wl.pointer.interface;
    737             pub const Error = common.wl.pointer.Error;
    738             pub const ButtonState = common.wl.pointer.ButtonState;
    739             pub const Axis = common.wl.pointer.Axis;
    740             pub const AxisSource = common.wl.pointer.AxisSource;
    741             pub const AxisRelativeDirection = common.wl.pointer.AxisRelativeDirection;
    742             pub fn getId(_pointer: *Pointer) u32 {
    743                 return @as(*client.wl.Proxy, @ptrCast(_pointer)).getId();
    744             }
    745             pub fn getVersion(_pointer: *Pointer) u32 {
    746                 return @as(*client.wl.Proxy, @ptrCast(_pointer)).getVersion();
    747             }
    748             pub fn getUserData(_pointer: *Pointer) ?*anyopaque {
    749                 return @as(*client.wl.Proxy, @ptrCast(_pointer)).getUserData();
    750             }
    751             pub fn setQueue(_pointer: *Pointer, _queue: *client.wl.EventQueue) void {
    752                 const _proxy: *client.wl.Proxy = @ptrCast(_pointer);
    753                 _proxy.setQueue(_queue);
    754             }
    755             pub const Event = union(enum) {
    756                 enter: struct {
    757                     serial: u32,
    758                     surface: ?*client.wl.Surface,
    759                     surface_x: common.Fixed,
    760                     surface_y: common.Fixed,
    761                 },
    762                 leave: struct {
    763                     serial: u32,
    764                     surface: ?*client.wl.Surface,
    765                 },
    766                 motion: struct {
    767                     time: u32,
    768                     surface_x: common.Fixed,
    769                     surface_y: common.Fixed,
    770                 },
    771                 button: struct {
    772                     serial: u32,
    773                     time: u32,
    774                     button: u32,
    775                     state: ButtonState,
    776                 },
    777                 axis: struct {
    778                     time: u32,
    779                     axis: Axis,
    780                     value: common.Fixed,
    781                 },
    782             };
    783             pub inline fn setListener(
    784                 _pointer: *Pointer,
    785                 comptime T: type,
    786                 _listener: *const fn (pointer: *Pointer, event: Event, data: T) void,
    787                 _data: T,
    788             ) void {
    789                 const _proxy: *client.wl.Proxy = @ptrCast(_pointer);
    790                 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
    791                 _proxy.addDispatcher(common.Dispatcher(Pointer, T).dispatcher, _listener, _mut_data);
    792             }
    793             pub fn setCursor(_pointer: *Pointer, _serial: u32, _surface: ?*client.wl.Surface, _hotspot_x: i32, _hotspot_y: i32) void {
    794                 const _proxy: *client.wl.Proxy = @ptrCast(_pointer);
    795                 var _args = [_]common.Argument{
    796                     .{ .u = _serial },
    797                     .{ .o = @ptrCast(_surface) },
    798                     .{ .i = _hotspot_x },
    799                     .{ .i = _hotspot_y },
    800                 };
    801                 _proxy.marshal(0, &_args);
    802             }
    803             pub fn destroy(_pointer: *Pointer) void {
    804                 const _proxy: *client.wl.Proxy = @ptrCast(_pointer);
    805                 _proxy.destroy();
    806             }
    807         };
    808         pub const Keyboard = opaque {
    809             pub const generated_version = 2;
    810             pub const interface = &common.wl.keyboard.interface;
    811             pub const KeymapFormat = common.wl.keyboard.KeymapFormat;
    812             pub const KeyState = common.wl.keyboard.KeyState;
    813             pub fn getId(_keyboard: *Keyboard) u32 {
    814                 return @as(*client.wl.Proxy, @ptrCast(_keyboard)).getId();
    815             }
    816             pub fn getVersion(_keyboard: *Keyboard) u32 {
    817                 return @as(*client.wl.Proxy, @ptrCast(_keyboard)).getVersion();
    818             }
    819             pub fn getUserData(_keyboard: *Keyboard) ?*anyopaque {
    820                 return @as(*client.wl.Proxy, @ptrCast(_keyboard)).getUserData();
    821             }
    822             pub fn setQueue(_keyboard: *Keyboard, _queue: *client.wl.EventQueue) void {
    823                 const _proxy: *client.wl.Proxy = @ptrCast(_keyboard);
    824                 _proxy.setQueue(_queue);
    825             }
    826             pub const Event = union(enum) {
    827                 keymap: struct {
    828                     format: KeymapFormat,
    829                     fd: i32,
    830                     size: u32,
    831                 },
    832                 enter: struct {
    833                     serial: u32,
    834                     surface: ?*client.wl.Surface,
    835                     keys: *common.Array,
    836                 },
    837                 leave: struct {
    838                     serial: u32,
    839                     surface: ?*client.wl.Surface,
    840                 },
    841                 key: struct {
    842                     serial: u32,
    843                     time: u32,
    844                     key: u32,
    845                     state: KeyState,
    846                 },
    847                 modifiers: struct {
    848                     serial: u32,
    849                     mods_depressed: u32,
    850                     mods_latched: u32,
    851                     mods_locked: u32,
    852                     group: u32,
    853                 },
    854             };
    855             pub inline fn setListener(
    856                 _keyboard: *Keyboard,
    857                 comptime T: type,
    858                 _listener: *const fn (keyboard: *Keyboard, event: Event, data: T) void,
    859                 _data: T,
    860             ) void {
    861                 const _proxy: *client.wl.Proxy = @ptrCast(_keyboard);
    862                 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
    863                 _proxy.addDispatcher(common.Dispatcher(Keyboard, T).dispatcher, _listener, _mut_data);
    864             }
    865             pub fn destroy(_keyboard: *Keyboard) void {
    866                 const _proxy: *client.wl.Proxy = @ptrCast(_keyboard);
    867                 _proxy.destroy();
    868             }
    869         };
    870         pub const Touch = opaque {
    871             pub const generated_version = 2;
    872             pub const interface = &common.wl.touch.interface;
    873             pub fn getId(_touch: *Touch) u32 {
    874                 return @as(*client.wl.Proxy, @ptrCast(_touch)).getId();
    875             }
    876             pub fn getVersion(_touch: *Touch) u32 {
    877                 return @as(*client.wl.Proxy, @ptrCast(_touch)).getVersion();
    878             }
    879             pub fn getUserData(_touch: *Touch) ?*anyopaque {
    880                 return @as(*client.wl.Proxy, @ptrCast(_touch)).getUserData();
    881             }
    882             pub fn setQueue(_touch: *Touch, _queue: *client.wl.EventQueue) void {
    883                 const _proxy: *client.wl.Proxy = @ptrCast(_touch);
    884                 _proxy.setQueue(_queue);
    885             }
    886             pub const Event = union(enum) {
    887                 down: struct {
    888                     serial: u32,
    889                     time: u32,
    890                     surface: ?*client.wl.Surface,
    891                     id: i32,
    892                     x: common.Fixed,
    893                     y: common.Fixed,
    894                 },
    895                 up: struct {
    896                     serial: u32,
    897                     time: u32,
    898                     id: i32,
    899                 },
    900                 motion: struct {
    901                     time: u32,
    902                     id: i32,
    903                     x: common.Fixed,
    904                     y: common.Fixed,
    905                 },
    906                 frame: void,
    907                 cancel: void,
    908             };
    909             pub inline fn setListener(
    910                 _touch: *Touch,
    911                 comptime T: type,
    912                 _listener: *const fn (touch: *Touch, event: Event, data: T) void,
    913                 _data: T,
    914             ) void {
    915                 const _proxy: *client.wl.Proxy = @ptrCast(_touch);
    916                 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
    917                 _proxy.addDispatcher(common.Dispatcher(Touch, T).dispatcher, _listener, _mut_data);
    918             }
    919             pub fn destroy(_touch: *Touch) void {
    920                 const _proxy: *client.wl.Proxy = @ptrCast(_touch);
    921                 _proxy.destroy();
    922             }
    923         };
    924         pub const Output = opaque {
    925             pub const generated_version = 1;
    926             pub const interface = &common.wl.output.interface;
    927             pub const Subpixel = common.wl.output.Subpixel;
    928             pub const Transform = common.wl.output.Transform;
    929             pub const Mode = common.wl.output.Mode;
    930             pub fn getId(_output: *Output) u32 {
    931                 return @as(*client.wl.Proxy, @ptrCast(_output)).getId();
    932             }
    933             pub fn getVersion(_output: *Output) u32 {
    934                 return @as(*client.wl.Proxy, @ptrCast(_output)).getVersion();
    935             }
    936             pub fn getUserData(_output: *Output) ?*anyopaque {
    937                 return @as(*client.wl.Proxy, @ptrCast(_output)).getUserData();
    938             }
    939             pub fn setQueue(_output: *Output, _queue: *client.wl.EventQueue) void {
    940                 const _proxy: *client.wl.Proxy = @ptrCast(_output);
    941                 _proxy.setQueue(_queue);
    942             }
    943             pub const Event = union(enum) {
    944                 geometry: struct {
    945                     x: i32,
    946                     y: i32,
    947                     physical_width: i32,
    948                     physical_height: i32,
    949                     subpixel: Subpixel,
    950                     make: [*:0]const u8,
    951                     model: [*:0]const u8,
    952                     transform: Transform,
    953                 },
    954                 mode: struct {
    955                     flags: Mode,
    956                     width: i32,
    957                     height: i32,
    958                     refresh: i32,
    959                 },
    960             };
    961             pub inline fn setListener(
    962                 _output: *Output,
    963                 comptime T: type,
    964                 _listener: *const fn (output: *Output, event: Event, data: T) void,
    965                 _data: T,
    966             ) void {
    967                 const _proxy: *client.wl.Proxy = @ptrCast(_output);
    968                 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
    969                 _proxy.addDispatcher(common.Dispatcher(Output, T).dispatcher, _listener, _mut_data);
    970             }
    971             pub fn destroy(_output: *Output) void {
    972                 const _proxy: *client.wl.Proxy = @ptrCast(_output);
    973                 _proxy.destroy();
    974             }
    975         };
    976     };
    977 };
    978 
    979 pub const server = struct {
    980     pub const wl = struct {
    981         pub const Object = common.Object;
    982         pub const Message = common.Message;
    983         pub const Interface = common.Interface;
    984         pub const list = common.list;
    985         pub const Array = common.Array;
    986         pub const Fixed = common.Fixed;
    987         pub const Argument = common.Argument;
    988 
    989         /// This is wayland-server's wl_display. It has been renamed as zig-wayland has
    990         /// decided to hide wl_resources with opaque pointers in the same way that
    991         /// wayland-client does with wl_proxys. This of course creates a name conflict.
    992         pub const Server = opaque {
    993             extern fn wl_display_create() ?*Server;
    994             pub fn create() !*Server {
    995                 return wl_display_create() orelse error.ServerCreateFailed;
    996             }
    997 
    998             extern fn wl_display_destroy(server: *Server) void;
    999             pub const destroy = wl_display_destroy;
   1000 
   1001             extern fn wl_display_get_event_loop(server: *Server) *EventLoop;
   1002             pub const getEventLoop = wl_display_get_event_loop;
   1003 
   1004             extern fn wl_display_add_socket(server: *Server, name: [*:0]const u8) c_int;
   1005             pub fn addSocket(_server: *Server, name: [*:0]const u8) !void {
   1006                 if (wl_display_add_socket(_server, name) == -1)
   1007                     return error.AddSocketFailed;
   1008             }
   1009 
   1010             // wayland-client will connect to wayland-0 even if WAYLAND_DISPLAY is
   1011             // unset due to an unfortunate piece of code that was not removed before
   1012             // the library was stabilized. Because of this, it is a good idea to never
   1013             // call the socket wayland-0. So, instead of binding to wayland-server's
   1014             // wl_display_add_socket_auto we implement a version which skips wayland-0.
   1015             pub fn addSocketAuto(_server: *Server, buf: *[11]u8) ![:0]const u8 {
   1016                 // Don't use wayland-0
   1017                 var i: u32 = 1;
   1018                 while (i <= 32) : (i += 1) {
   1019                     const name = std.fmt.bufPrintZ(buf, "wayland-{}", .{i}) catch unreachable;
   1020                     _server.addSocket(name.ptr) catch continue;
   1021                     return name;
   1022                 }
   1023                 return error.AddSocketFailed;
   1024             }
   1025 
   1026             extern fn wl_display_add_socket_fd(_server: *Server, sock_fd: c_int) c_int;
   1027             pub fn addSocketFd(_server: *Server, sock_fd: c_int) !void {
   1028                 if (wl_display_add_socket_fd(_server, sock_fd) == -1)
   1029                     return error.AddSocketFailed;
   1030             }
   1031 
   1032             extern fn wl_display_terminate(_server: *Server) void;
   1033             pub const terminate = wl_display_terminate;
   1034 
   1035             extern fn wl_display_run(_server: *Server) void;
   1036             pub const run = wl_display_run;
   1037 
   1038             extern fn wl_display_flush_clients(_server: *Server) void;
   1039             pub const flushClients = wl_display_flush_clients;
   1040 
   1041             extern fn wl_display_destroy_clients(_server: *Server) void;
   1042             pub const destroyClients = wl_display_destroy_clients;
   1043 
   1044             extern fn wl_display_get_serial(_server: *Server) u32;
   1045             pub const getSerial = wl_display_get_serial;
   1046 
   1047             extern fn wl_display_next_serial(_server: *Server) u32;
   1048             pub const nextSerial = wl_display_next_serial;
   1049 
   1050             extern fn wl_display_add_destroy_listener(_server: *Server, listener: *Listener(*Server)) void;
   1051             pub const addDestroyListener = wl_display_add_destroy_listener;
   1052 
   1053             extern fn wl_display_add_client_created_listener(_server: *Server, listener: *Listener(*Client)) void;
   1054             pub const addClientCreatedListener = wl_display_add_client_created_listener;
   1055 
   1056             // Doesn't really make sense with our Listener API as we would need to
   1057             // pass a pointer to the wrapper function
   1058             //extern fn wl_display_get_destroy_listener(_server: *Server, notify: @TypeOf(Listener(*Server).notify)) ?*Listener(*Server);
   1059 
   1060             extern fn wl_display_set_global_filter(
   1061                 _server: *Server,
   1062                 filter: *const fn (_client: *const Client, global: *const Global, data: ?*anyopaque) callconv(.C) bool,
   1063                 data: ?*anyopaque,
   1064             ) void;
   1065             pub inline fn setGlobalFilter(
   1066                 _server: *Server,
   1067                 comptime T: type,
   1068                 comptime filter: fn (_client: *const Client, global: *const Global, data: T) bool,
   1069                 data: T,
   1070             ) void {
   1071                 wl_display_set_global_filter(
   1072                     _server,
   1073                     struct {
   1074                         fn _wrapper(_client: *const Client, _global: *const Global, _data: ?*anyopaque) callconv(.C) bool {
   1075                             return filter(_client, _global, @ptrCast(@alignCast(_data)));
   1076                         }
   1077                     }._wrapper,
   1078                     data,
   1079                 );
   1080             }
   1081 
   1082             extern fn wl_display_get_client_list(_server: *Server) *list.Head(Client, null);
   1083             pub const getClientList = wl_display_get_client_list;
   1084 
   1085             extern fn wl_display_init_shm(_server: *Server) c_int;
   1086             pub fn initShm(_server: *Server) !void {
   1087                 if (wl_display_init_shm(_server) == -1) return error.OutOfMemory;
   1088             }
   1089 
   1090             extern fn wl_display_add_shm_format(_server: *Server, format: u32) ?*u32;
   1091             pub fn addShmFormat(_server: *Server, format: u32) !*u32 {
   1092                 return wl_display_add_shm_format(_server, format) orelse error.OutOfMemory;
   1093             }
   1094 
   1095             extern fn wl_display_add_protocol_logger(
   1096                 _server: *Server,
   1097                 func: *const fn (data: ?*anyopaque, direction: ProtocolLogger.Type, message: *const ProtocolLogger.LogMessage) callconv(.C) void,
   1098                 data: ?*anyopaque,
   1099             ) void;
   1100             pub inline fn addProtocolLogger(
   1101                 _server: *Server,
   1102                 comptime T: type,
   1103                 comptime func: fn (data: T, direction: ProtocolLogger.Type, message: *const ProtocolLogger.LogMessage) void,
   1104                 data: T,
   1105             ) void {
   1106                 wl_display_add_protocol_logger(
   1107                     _server,
   1108                     struct {
   1109                         fn _wrapper(_data: ?*anyopaque, _direction: ProtocolLogger.Type, _message: *const ProtocolLogger.LogMessage) callconv(.C) void {
   1110                             func(@ptrCast(@alignCast(_data)), _direction, _message);
   1111                         }
   1112                     }._wrapper,
   1113                     data,
   1114                 );
   1115             }
   1116         };
   1117 
   1118         pub const Client = opaque {
   1119             extern fn wl_client_create(_server: *Server, fd: c_int) ?*Client;
   1120             pub const create = wl_client_create;
   1121 
   1122             extern fn wl_client_destroy(_client: *Client) void;
   1123             pub const destroy = wl_client_destroy;
   1124 
   1125             extern fn wl_client_flush(_client: *Client) void;
   1126             pub const flush = wl_client_flush;
   1127 
   1128             extern fn wl_client_get_link(_client: *Client) *list.Link;
   1129             pub const getLink = wl_client_get_link;
   1130 
   1131             extern fn wl_client_from_link(link: *list.Link) *Client;
   1132             pub const fromLink = wl_client_from_link;
   1133 
   1134             const Credentials = struct {
   1135                 pid: posix.pid_t,
   1136                 gid: posix.gid_t,
   1137                 uid: posix.uid_t,
   1138             };
   1139             extern fn wl_client_get_credentials(_client: *Client, pid: *posix.pid_t, uid: *posix.uid_t, gid: *posix.gid_t) void;
   1140             pub fn getCredentials(_client: *Client) Credentials {
   1141                 var credentials: Credentials = undefined;
   1142                 wl_client_get_credentials(_client, &credentials.pid, &credentials.uid, &credentials.gid);
   1143                 return credentials;
   1144             }
   1145 
   1146             extern fn wl_client_add_destroy_listener(_client: *Client, listener: *Listener(*Client)) void;
   1147             pub const addDestroyListener = wl_client_add_destroy_listener;
   1148 
   1149             // Doesn't really make sense with our Listener API as we would need to
   1150             // pass a pointer to the wrapper function
   1151             //extern fn wl_client_get_destroy_listener(_client: *Client, notify: @TypeOf(Listener(*Client).notify)) ?*Listener(*Client);
   1152 
   1153             extern fn wl_client_get_object(_client: *Client, id: u32) ?*Resource;
   1154             pub const getObject = wl_client_get_object;
   1155 
   1156             extern fn wl_client_post_no_memory(_client: *Client) void;
   1157             pub const postNoMemory = wl_client_post_no_memory;
   1158 
   1159             extern fn wl_client_post_implementation_error(_client: *Client, msg: [*:0]const u8, ...) void;
   1160             pub const postImplementationError = wl_client_post_implementation_error;
   1161 
   1162             extern fn wl_client_add_resource_created_listener(_client: *Client, listener: *Listener(*Resource)) void;
   1163             pub const addResourceCreatedListener = wl_client_add_resource_created_listener;
   1164 
   1165             const IteratorResult = enum(c_int) { stop, cont };
   1166             extern fn wl_client_for_each_resource(
   1167                 _client: *Client,
   1168                 iterator: *const fn (resource: *Resource, data: ?*anyopaque) callconv(.C) IteratorResult,
   1169                 data: ?*anyopaque,
   1170             ) void;
   1171             pub inline fn forEachResource(
   1172                 _client: *Client,
   1173                 comptime T: type,
   1174                 comptime iterator: fn (resource: *Resource, data: T) IteratorResult,
   1175                 data: T,
   1176             ) void {
   1177                 wl_client_for_each_resource(
   1178                     _client,
   1179                     struct {
   1180                         fn _wrapper(_resource: *Resource, _data: ?*anyopaque) callconv(.C) IteratorResult {
   1181                             return iterator(_resource, @ptrCast(@alignCast(_data)));
   1182                         }
   1183                     }._wrapper,
   1184                     data,
   1185                 );
   1186             }
   1187 
   1188             extern fn wl_client_get_fd(_client: *Client) c_int;
   1189             pub const getFd = wl_client_get_fd;
   1190 
   1191             extern fn wl_client_get_display(_client: *Client) *Server;
   1192             pub const getDisplay = wl_client_get_display;
   1193         };
   1194 
   1195         pub const Global = opaque {
   1196             extern fn wl_global_create(
   1197                 _server: *Server,
   1198                 interface: *const Interface,
   1199                 version: c_int,
   1200                 data: ?*anyopaque,
   1201                 bind: *const fn (_client: *Client, data: ?*anyopaque, version: u32, id: u32) callconv(.C) void,
   1202             ) ?*Global;
   1203             pub inline fn create(
   1204                 _server: *Server,
   1205                 comptime T: type,
   1206                 version: u32,
   1207                 comptime DataT: type,
   1208                 data: DataT,
   1209                 comptime bind: fn (_client: *Client, data: DataT, version: u32, id: u32) void,
   1210             ) error{GlobalCreateFailed}!*Global {
   1211                 return wl_global_create(
   1212                     _server,
   1213                     T.interface,
   1214                     @as(c_int, @intCast(version)),
   1215                     data,
   1216                     struct {
   1217                         fn _wrapper(_client: *Client, _data: ?*anyopaque, _version: u32, _id: u32) callconv(.C) void {
   1218                             bind(_client, @ptrCast(@alignCast(_data)), _version, _id);
   1219                         }
   1220                     }._wrapper,
   1221                 ) orelse error.GlobalCreateFailed;
   1222             }
   1223 
   1224             extern fn wl_global_remove(global: *Global) void;
   1225             pub const remove = wl_global_remove;
   1226 
   1227             extern fn wl_global_destroy(global: *Global) void;
   1228             pub const destroy = wl_global_destroy;
   1229 
   1230             extern fn wl_global_get_interface(global: *const Global) *const Interface;
   1231             pub const getInterface = wl_global_get_interface;
   1232 
   1233             extern fn wl_global_get_name(global: *const Global, _client: *const Client) u32;
   1234             pub const getName = wl_global_get_name;
   1235 
   1236             extern fn wl_global_get_user_data(global: *const Global) ?*anyopaque;
   1237             pub const getUserData = wl_global_get_user_data;
   1238         };
   1239 
   1240         pub const Resource = opaque {
   1241             extern fn wl_resource_create(_client: *Client, interface: *const Interface, version: c_int, id: u32) ?*Resource;
   1242             pub inline fn create(_client: *Client, comptime T: type, version: u32, id: u32) error{ResourceCreateFailed}!*Resource {
   1243                 // This is only a c_int because of legacy libwayland reasons. Negative versions are invalid.
   1244                 // Version is a u32 on the wire and for wl_global, wl_proxy, etc.
   1245                 return wl_resource_create(_client, T.interface, @as(c_int, @intCast(version)), id) orelse error.ResourceCreateFailed;
   1246             }
   1247 
   1248             extern fn wl_resource_destroy(resource: *Resource) void;
   1249             pub const destroy = wl_resource_destroy;
   1250 
   1251             extern fn wl_resource_post_event_array(resource: *Resource, opcode: u32, args: ?[*]Argument) void;
   1252             pub const postEvent = wl_resource_post_event_array;
   1253 
   1254             extern fn wl_resource_queue_event_array(resource: *Resource, opcode: u32, args: ?[*]Argument) void;
   1255             pub const queueEvent = wl_resource_queue_event_array;
   1256 
   1257             extern fn wl_resource_post_error(resource: *Resource, code: u32, message: [*:0]const u8, ...) void;
   1258             pub const postError = wl_resource_post_error;
   1259 
   1260             extern fn wl_resource_post_no_memory(resource: *Resource) void;
   1261             pub const postNoMemory = wl_resource_post_no_memory;
   1262 
   1263             const DispatcherFn = fn (
   1264                 implementation: ?*const anyopaque,
   1265                 resource: *Resource,
   1266                 opcode: u32,
   1267                 message: *const Message,
   1268                 args: [*]Argument,
   1269             ) callconv(.C) c_int;
   1270             pub const DestroyFn = fn (resource: *Resource) callconv(.C) void;
   1271             extern fn wl_resource_set_dispatcher(
   1272                 resource: *Resource,
   1273                 dispatcher: ?*const DispatcherFn,
   1274                 implementation: ?*const anyopaque,
   1275                 data: ?*anyopaque,
   1276                 destroy_fn: ?*const DestroyFn,
   1277             ) void;
   1278             pub fn setDispatcher(
   1279                 resource: *Resource,
   1280                 dispatcher: ?*const DispatcherFn,
   1281                 implementation: ?*const anyopaque,
   1282                 data: ?*anyopaque,
   1283                 destroy_fn: ?*const DestroyFn,
   1284             ) void {
   1285                 wl_resource_set_dispatcher(resource, dispatcher, implementation, data, destroy_fn);
   1286             }
   1287 
   1288             extern fn wl_resource_get_user_data(resource: *Resource) ?*anyopaque;
   1289             pub const getUserData = wl_resource_get_user_data;
   1290 
   1291             extern fn wl_resource_get_id(resource: *Resource) u32;
   1292             pub const getId = wl_resource_get_id;
   1293 
   1294             extern fn wl_resource_get_link(resource: *Resource) *list.Link;
   1295             pub const getLink = wl_resource_get_link;
   1296 
   1297             extern fn wl_resource_from_link(link: *list.Link) *Resource;
   1298             pub const fromLink = wl_resource_from_link;
   1299 
   1300             extern fn wl_resource_find_for_client(list: *list.Head(Resource, null), _client: *Client) ?*Resource;
   1301             pub const findForClient = wl_resource_find_for_client;
   1302 
   1303             extern fn wl_resource_get_client(resource: *Resource) *Client;
   1304             pub const getClient = wl_resource_get_client;
   1305 
   1306             extern fn wl_resource_get_version(resource: *Resource) c_int;
   1307             pub fn getVersion(resource: *Resource) u32 {
   1308                 // The fact that wl_resource.version is a int in libwayland is
   1309                 // a mistake. Negative versions are impossible and u32 is used
   1310                 // everywhere else in libwayland
   1311                 return @as(u32, @intCast(wl_resource_get_version(resource)));
   1312             }
   1313 
   1314             // TOOD: unsure if this should be bound
   1315             extern fn wl_resource_set_destructor(resource: *Resource, destroy: DestroyFn) void;
   1316 
   1317             extern fn wl_resource_get_class(resource: *Resource) [*:0]const u8;
   1318             pub const getClass = wl_resource_get_class;
   1319 
   1320             extern fn wl_resource_add_destroy_listener(resource: *Resource, listener: *Listener(*Resource)) void;
   1321             pub const addDestroyListener = wl_resource_add_destroy_listener;
   1322 
   1323             // Doesn't really make sense with our Listener API as we would need to
   1324             // pass a pointer to the wrapper function
   1325             //extern fn wl_resource_get_destroy_listener(resource: *Resource, notify: @TypeOf(Listener(*Resource).notify)) ?*Listener(*Resource);
   1326         };
   1327 
   1328         pub const ProtocolLogger = opaque {
   1329             pub const Type = enum(c_int) {
   1330                 request,
   1331                 event,
   1332             };
   1333 
   1334             pub const LogMessage = extern struct {
   1335                 resource: *Resource,
   1336                 message_opcode: c_int,
   1337                 message: *Message,
   1338                 arguments_count: c_int,
   1339                 arguments: ?[*]Argument,
   1340             };
   1341 
   1342             extern fn wl_protocol_logger_destroy(logger: *ProtocolLogger) void;
   1343             pub const destroy = wl_protocol_logger_destroy;
   1344         };
   1345 
   1346         pub fn Listener(comptime T: type) type {
   1347             return extern struct {
   1348                 const Self = @This();
   1349 
   1350                 pub const NotifyFn = if (T == void)
   1351                     fn (listener: *Self) void
   1352                 else
   1353                     fn (listener: *Self, data: T) void;
   1354 
   1355                 link: list.Link,
   1356                 notify: *const fn (listener: *Self, data: ?*anyopaque) callconv(.C) void,
   1357 
   1358                 pub fn init(comptime notify: NotifyFn) Self {
   1359                     var self: Self = undefined;
   1360                     self.setNotify(notify);
   1361                     return self;
   1362                 }
   1363 
   1364                 pub fn setNotify(self: *Self, comptime notify: NotifyFn) void {
   1365                     self.notify = if (T == void)
   1366                         struct {
   1367                             fn wrapper(listener: *Self, _: ?*anyopaque) callconv(.C) void {
   1368                                 @call(.always_inline, notify, .{listener});
   1369                             }
   1370                         }.wrapper
   1371                     else
   1372                         struct {
   1373                             fn wrapper(listener: *Self, data: ?*anyopaque) callconv(.C) void {
   1374                                 @call(.always_inline, notify, .{ listener, @as(T, @ptrFromInt(@intFromPtr(data))) });
   1375                             }
   1376                         }.wrapper;
   1377                 }
   1378             };
   1379         }
   1380 
   1381         pub fn Signal(comptime T: type) type {
   1382             return extern struct {
   1383                 const Self = @This();
   1384 
   1385                 listener_list: list.Head(Listener(T), .link),
   1386 
   1387                 pub fn init(signal: *Self) void {
   1388                     signal.listener_list.init();
   1389                 }
   1390 
   1391                 pub fn add(signal: *Self, listener: *Listener(T)) void {
   1392                     signal.listener_list.append(listener);
   1393                 }
   1394 
   1395                 pub fn get(signal: *Self, notify: @TypeOf(Listener(T).notify)) ?*Listener(T) {
   1396                     var it = signal.listener_list.iterator(.forward);
   1397                     return while (it.next()) |listener| {
   1398                         if (listener.notify == notify) break listener;
   1399                     } else null;
   1400                 }
   1401 
   1402                 pub const emit = if (T == void)
   1403                     struct {
   1404                         pub inline fn emit(signal: *Self) void {
   1405                             emitInner(signal, null);
   1406                         }
   1407                     }.emit
   1408                 else
   1409                     struct {
   1410                         pub inline fn emit(signal: *Self, data: T) void {
   1411                             emitInner(signal, data);
   1412                         }
   1413                     }.emit;
   1414 
   1415                 /// This is similar to wlroots' wlr_signal_emit_safe. It handles
   1416                 /// removal of any element in the list during iteration and stops at
   1417                 /// whatever the last element was when iteration started.
   1418                 fn emitInner(signal: *Self, data: ?*anyopaque) void {
   1419                     var cursor: Listener(T) = undefined;
   1420                     signal.listener_list.prepend(&cursor);
   1421 
   1422                     var end: Listener(T) = undefined;
   1423                     signal.listener_list.append(&end);
   1424 
   1425                     while (cursor.link.next != &end.link) {
   1426                         const pos = cursor.link.next.?;
   1427                         const listener: *Listener(T) = @fieldParentPtr("link", pos);
   1428 
   1429                         cursor.link.remove();
   1430                         pos.insert(&cursor.link);
   1431 
   1432                         listener.notify(listener, data);
   1433                     }
   1434 
   1435                     cursor.link.remove();
   1436                     end.link.remove();
   1437                 }
   1438             };
   1439         }
   1440 
   1441         pub const EventLoop = opaque {
   1442             extern fn wl_event_loop_create() ?*EventLoop;
   1443             pub fn create() !*EventLoop {
   1444                 return wl_event_loop_create() orelse error.EventLoopCreateFailed;
   1445             }
   1446 
   1447             extern fn wl_event_loop_destroy(loop: *EventLoop) void;
   1448             pub const destroy = wl_event_loop_destroy;
   1449 
   1450             extern fn wl_event_loop_add_fd(
   1451                 loop: *EventLoop,
   1452                 fd: c_int,
   1453                 mask: u32,
   1454                 func: *const fn (fd: c_int, mask: u32, data: ?*anyopaque) callconv(.C) c_int,
   1455                 data: ?*anyopaque,
   1456             ) ?*EventSource;
   1457             pub inline fn addFd(
   1458                 loop: *EventLoop,
   1459                 comptime T: type,
   1460                 fd: c_int,
   1461                 mask: u32,
   1462                 comptime func: fn (fd: c_int, mask: u32, data: T) c_int,
   1463                 data: T,
   1464             ) error{AddFdFailed}!*EventSource {
   1465                 return wl_event_loop_add_fd(
   1466                     loop,
   1467                     fd,
   1468                     mask,
   1469                     struct {
   1470                         fn _wrapper(_fd: c_int, _mask: u32, _data: ?*anyopaque) callconv(.C) c_int {
   1471                             return func(_fd, _mask, @ptrCast(@alignCast(_data)));
   1472                         }
   1473                     }._wrapper,
   1474                     data,
   1475                 ) orelse error.AddFdFailed;
   1476             }
   1477 
   1478             extern fn wl_event_loop_add_timer(
   1479                 loop: *EventLoop,
   1480                 func: *const fn (data: ?*anyopaque) callconv(.C) c_int,
   1481                 data: ?*anyopaque,
   1482             ) ?*EventSource;
   1483             pub inline fn addTimer(
   1484                 loop: *EventLoop,
   1485                 comptime T: type,
   1486                 comptime func: fn (data: T) c_int,
   1487                 data: T,
   1488             ) error{AddTimerFailed}!*EventSource {
   1489                 return wl_event_loop_add_timer(
   1490                     loop,
   1491                     struct {
   1492                         fn _wrapper(_data: ?*anyopaque) callconv(.C) c_int {
   1493                             return func(@ptrCast(@alignCast(_data)));
   1494                         }
   1495                     }._wrapper,
   1496                     data,
   1497                 ) orelse error.AddTimerFailed;
   1498             }
   1499 
   1500             extern fn wl_event_loop_add_signal(
   1501                 loop: *EventLoop,
   1502                 signal_number: c_int,
   1503                 func: *const fn (c_int, ?*anyopaque) callconv(.C) c_int,
   1504                 data: ?*anyopaque,
   1505             ) ?*EventSource;
   1506             pub inline fn addSignal(
   1507                 loop: *EventLoop,
   1508                 comptime T: type,
   1509                 signal_number: c_int,
   1510                 comptime func: fn (signal_number: c_int, data: T) c_int,
   1511                 data: T,
   1512             ) error{AddSignalFailed}!*EventSource {
   1513                 return wl_event_loop_add_signal(
   1514                     loop,
   1515                     signal_number,
   1516                     struct {
   1517                         fn _wrapper(_signal_number: c_int, _data: ?*anyopaque) callconv(.C) c_int {
   1518                             return func(_signal_number, @ptrCast(@alignCast(_data)));
   1519                         }
   1520                     }._wrapper,
   1521                     data,
   1522                 ) orelse error.AddSignalFailed;
   1523             }
   1524 
   1525             extern fn wl_event_loop_add_idle(
   1526                 loop: *EventLoop,
   1527                 func: *const fn (data: ?*anyopaque) callconv(.C) void,
   1528                 data: ?*anyopaque,
   1529             ) ?*EventSource;
   1530             pub inline fn addIdle(
   1531                 loop: *EventLoop,
   1532                 comptime T: type,
   1533                 comptime func: fn (data: T) void,
   1534                 data: T,
   1535             ) error{OutOfMemory}!*EventSource {
   1536                 return wl_event_loop_add_idle(
   1537                     loop,
   1538                     struct {
   1539                         fn _wrapper(_data: ?*anyopaque) callconv(.C) void {
   1540                             return func(@ptrCast(@alignCast(_data)));
   1541                         }
   1542                     }._wrapper,
   1543                     data,
   1544                 ) orelse error.OutOfMemory;
   1545             }
   1546 
   1547             extern fn wl_event_loop_dispatch(loop: *EventLoop, timeout: c_int) c_int;
   1548             pub fn dispatch(loop: *EventLoop, timeout: c_int) !void {
   1549                 const rc = wl_event_loop_dispatch(loop, timeout);
   1550                 switch (posix.errno(rc)) {
   1551                     .SUCCESS => return,
   1552                     // TODO
   1553                     else => |err| return posix.unexpectedErrno(err),
   1554                 }
   1555             }
   1556 
   1557             extern fn wl_event_loop_dispatch_idle(loop: *EventLoop) void;
   1558             pub const dispatchIdle = wl_event_loop_dispatch_idle;
   1559 
   1560             extern fn wl_event_loop_get_fd(loop: *EventLoop) c_int;
   1561             pub const getFd = wl_event_loop_get_fd;
   1562 
   1563             extern fn wl_event_loop_add_destroy_listener(loop: *EventLoop, listener: *Listener(*EventLoop)) void;
   1564             pub const addDestroyListener = wl_event_loop_add_destroy_listener;
   1565 
   1566             //extern fn wl_event_loop_get_destroy_listener(loop: *EventLoop, notify: @TypeOf(Listener(*EventLoop).notify)) ?*Listener;
   1567             //pub const getDestroyListener = wl_event_loop_get_destroy_listener;
   1568         };
   1569 
   1570         pub const EventSource = opaque {
   1571             extern fn wl_event_source_remove(source: *EventSource) c_int;
   1572             pub fn remove(source: *EventSource) void {
   1573                 if (wl_event_source_remove(source) != 0) unreachable;
   1574             }
   1575 
   1576             extern fn wl_event_source_check(source: *EventSource) void;
   1577             pub const check = wl_event_source_check;
   1578 
   1579             extern fn wl_event_source_fd_update(source: *EventSource, mask: u32) c_int;
   1580             pub fn fdUpdate(source: *EventSource, mask: u32) !void {
   1581                 const rc = wl_event_source_fd_update(source, mask);
   1582                 switch (posix.errno(rc)) {
   1583                     .SUCCESS => return,
   1584                     // TODO
   1585                     else => |err| return posix.unexpectedErrno(err),
   1586                 }
   1587             }
   1588 
   1589             extern fn wl_event_source_timer_update(source: *EventSource, ms_delay: c_int) c_int;
   1590             pub fn timerUpdate(source: *EventSource, ms_delay: c_int) !void {
   1591                 const rc = wl_event_source_timer_update(source, ms_delay);
   1592                 switch (posix.errno(rc)) {
   1593                     .SUCCESS => return,
   1594                     // TODO
   1595                     else => |err| return posix.unexpectedErrno(err),
   1596                 }
   1597             }
   1598         };
   1599 
   1600         pub const shm = struct {
   1601             pub const Buffer = opaque {
   1602                 extern fn wl_shm_buffer_get(resource: *Resource) ?*shm.Buffer;
   1603                 pub const get = wl_shm_buffer_get;
   1604 
   1605                 extern fn wl_shm_buffer_begin_access(buffer: *shm.Buffer) void;
   1606                 pub const beginAccess = wl_shm_buffer_begin_access;
   1607 
   1608                 extern fn wl_shm_buffer_end_access(buffer: *shm.Buffer) void;
   1609                 pub const endAccess = wl_shm_buffer_end_access;
   1610 
   1611                 extern fn wl_shm_buffer_get_data(buffer: *shm.Buffer) ?*anyopaque;
   1612                 pub const getData = wl_shm_buffer_get_data;
   1613 
   1614                 extern fn wl_shm_buffer_get_format(buffer: *shm.Buffer) u32;
   1615                 pub const getFormat = wl_shm_buffer_get_format;
   1616 
   1617                 extern fn wl_shm_buffer_get_height(buffer: *shm.Buffer) i32;
   1618                 pub const getHeight = wl_shm_buffer_get_height;
   1619 
   1620                 extern fn wl_shm_buffer_get_width(buffer: *shm.Buffer) i32;
   1621                 pub const getWidth = wl_shm_buffer_get_width;
   1622 
   1623                 extern fn wl_shm_buffer_get_stride(buffer: *shm.Buffer) i32;
   1624                 pub const getStride = wl_shm_buffer_get_stride;
   1625 
   1626                 extern fn wl_shm_buffer_ref_pool(buffer: *shm.Buffer) *Pool;
   1627                 pub const refPool = wl_shm_buffer_ref_pool;
   1628             };
   1629 
   1630             pub const Pool = opaque {
   1631                 extern fn wl_shm_pool_unref(pool: *Pool) void;
   1632                 pub const unref = wl_shm_pool_unref;
   1633             };
   1634         };
   1635         pub const Display = opaque {
   1636             pub const generated_version = 1;
   1637             pub const interface = &common.wl.display.interface;
   1638             pub const Error = common.wl.display.Error;
   1639             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Display {
   1640                 return @ptrCast(try server.wl.Resource.create(_client, Display, _version, _id));
   1641             }
   1642             pub fn destroy(_display: *Display) void {
   1643                 return @as(*server.wl.Resource, @ptrCast(_display)).destroy();
   1644             }
   1645             pub fn fromLink(_link: *server.wl.list.Link) *Display {
   1646                 return @ptrCast(server.wl.Resource.fromLink(_link));
   1647             }
   1648             pub fn getLink(_display: *Display) *server.wl.list.Link {
   1649                 return @as(*server.wl.Resource, @ptrCast(_display)).getLink();
   1650             }
   1651             pub fn getClient(_display: *Display) *server.wl.Client {
   1652                 return @as(*server.wl.Resource, @ptrCast(_display)).getClient();
   1653             }
   1654             pub fn getId(_display: *Display) u32 {
   1655                 return @as(*server.wl.Resource, @ptrCast(_display)).getId();
   1656             }
   1657             pub fn getVersion(_display: *Display) u32 {
   1658                 return @as(*server.wl.Resource, @ptrCast(_display)).getVersion();
   1659             }
   1660             pub fn postNoMemory(_display: *Display) void {
   1661                 return @as(*server.wl.Resource, @ptrCast(_display)).postNoMemory();
   1662             }
   1663             pub fn getUserData(_display: *Display) ?*anyopaque {
   1664                 return @as(*server.wl.Resource, @ptrCast(_display)).getUserData();
   1665             }
   1666             pub fn postError(_display: *Display, _err: Error, _message: [*:0]const u8) void {
   1667                 return @as(*server.wl.Resource, @ptrCast(_display)).postError(@intCast(@intFromEnum(_err)), _message);
   1668             }
   1669             pub const Request = union(enum) {
   1670                 sync: struct {
   1671                     callback: u32,
   1672                 },
   1673                 get_registry: struct {
   1674                     registry: u32,
   1675                 },
   1676             };
   1677             pub inline fn setHandler(
   1678                 _display: *Display,
   1679                 comptime T: type,
   1680                 handle_request: *const fn (_display: *Display, request: Request, data: T) void,
   1681                 comptime handle_destroy: ?fn (_display: *Display, data: T) void,
   1682                 _data: T,
   1683             ) void {
   1684                 const _resource: *server.wl.Resource = @ptrCast(_display);
   1685                 _resource.setDispatcher(
   1686                     common.Dispatcher(Display, T).dispatcher,
   1687                     handle_request,
   1688                     @ptrFromInt(@intFromPtr(_data)),
   1689                     if (handle_destroy) |_handler| struct {
   1690                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   1691                             @call(.always_inline, _handler, .{
   1692                                 @as(*Display, @ptrCast(__resource)),
   1693                                 @as(T, @ptrCast(@alignCast(__resource.getUserData()))),
   1694                             });
   1695                         }
   1696                     }._wrapper else null,
   1697                 );
   1698             }
   1699             pub fn sendError(_display: *Display, _object_id: *common.Object, _code: u32, _message: [*:0]const u8) void {
   1700                 const _resource: *server.wl.Resource = @ptrCast(_display);
   1701                 var _args = [_]common.Argument{
   1702                     .{ .o = @ptrCast(_object_id) },
   1703                     .{ .u = _code },
   1704                     .{ .s = _message },
   1705                 };
   1706                 _resource.postEvent(0, &_args);
   1707             }
   1708             pub fn sendDeleteId(_display: *Display, _id: u32) void {
   1709                 const _resource: *server.wl.Resource = @ptrCast(_display);
   1710                 var _args = [_]common.Argument{
   1711                     .{ .u = _id },
   1712                 };
   1713                 _resource.postEvent(1, &_args);
   1714             }
   1715         };
   1716         pub const Registry = opaque {
   1717             pub const generated_version = 1;
   1718             pub const interface = &common.wl.registry.interface;
   1719             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Registry {
   1720                 return @ptrCast(try server.wl.Resource.create(_client, Registry, _version, _id));
   1721             }
   1722             pub fn destroy(_registry: *Registry) void {
   1723                 return @as(*server.wl.Resource, @ptrCast(_registry)).destroy();
   1724             }
   1725             pub fn fromLink(_link: *server.wl.list.Link) *Registry {
   1726                 return @ptrCast(server.wl.Resource.fromLink(_link));
   1727             }
   1728             pub fn getLink(_registry: *Registry) *server.wl.list.Link {
   1729                 return @as(*server.wl.Resource, @ptrCast(_registry)).getLink();
   1730             }
   1731             pub fn getClient(_registry: *Registry) *server.wl.Client {
   1732                 return @as(*server.wl.Resource, @ptrCast(_registry)).getClient();
   1733             }
   1734             pub fn getId(_registry: *Registry) u32 {
   1735                 return @as(*server.wl.Resource, @ptrCast(_registry)).getId();
   1736             }
   1737             pub fn getVersion(_registry: *Registry) u32 {
   1738                 return @as(*server.wl.Resource, @ptrCast(_registry)).getVersion();
   1739             }
   1740             pub fn postNoMemory(_registry: *Registry) void {
   1741                 return @as(*server.wl.Resource, @ptrCast(_registry)).postNoMemory();
   1742             }
   1743             pub fn getUserData(_registry: *Registry) ?*anyopaque {
   1744                 return @as(*server.wl.Resource, @ptrCast(_registry)).getUserData();
   1745             }
   1746             pub const Request = union(enum) {
   1747                 bind: struct {
   1748                     name: u32,
   1749                     interface_name: [*:0]const u8,
   1750                     version: u32,
   1751                     id: u32,
   1752                 },
   1753             };
   1754             pub inline fn setHandler(
   1755                 _registry: *Registry,
   1756                 comptime T: type,
   1757                 handle_request: *const fn (_registry: *Registry, request: Request, data: T) void,
   1758                 comptime handle_destroy: ?fn (_registry: *Registry, data: T) void,
   1759                 _data: T,
   1760             ) void {
   1761                 const _resource: *server.wl.Resource = @ptrCast(_registry);
   1762                 _resource.setDispatcher(
   1763                     common.Dispatcher(Registry, T).dispatcher,
   1764                     handle_request,
   1765                     @ptrFromInt(@intFromPtr(_data)),
   1766                     if (handle_destroy) |_handler| struct {
   1767                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   1768                             @call(.always_inline, _handler, .{
   1769                                 @as(*Registry, @ptrCast(__resource)),
   1770                                 @as(T, @ptrCast(@alignCast(__resource.getUserData()))),
   1771                             });
   1772                         }
   1773                     }._wrapper else null,
   1774                 );
   1775             }
   1776             pub fn sendGlobal(_registry: *Registry, _name: u32, _interface: [*:0]const u8, _version: u32) void {
   1777                 const _resource: *server.wl.Resource = @ptrCast(_registry);
   1778                 var _args = [_]common.Argument{
   1779                     .{ .u = _name },
   1780                     .{ .s = _interface },
   1781                     .{ .u = _version },
   1782                 };
   1783                 _resource.postEvent(0, &_args);
   1784             }
   1785             pub fn sendGlobalRemove(_registry: *Registry, _name: u32) void {
   1786                 const _resource: *server.wl.Resource = @ptrCast(_registry);
   1787                 var _args = [_]common.Argument{
   1788                     .{ .u = _name },
   1789                 };
   1790                 _resource.postEvent(1, &_args);
   1791             }
   1792         };
   1793         pub const Callback = opaque {
   1794             pub const generated_version = 1;
   1795             pub const interface = &common.wl.callback.interface;
   1796             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Callback {
   1797                 return @ptrCast(try server.wl.Resource.create(_client, Callback, _version, _id));
   1798             }
   1799             pub fn destroy(_callback: *Callback) void {
   1800                 return @as(*server.wl.Resource, @ptrCast(_callback)).destroy();
   1801             }
   1802             pub fn fromLink(_link: *server.wl.list.Link) *Callback {
   1803                 return @ptrCast(server.wl.Resource.fromLink(_link));
   1804             }
   1805             pub fn getLink(_callback: *Callback) *server.wl.list.Link {
   1806                 return @as(*server.wl.Resource, @ptrCast(_callback)).getLink();
   1807             }
   1808             pub fn getClient(_callback: *Callback) *server.wl.Client {
   1809                 return @as(*server.wl.Resource, @ptrCast(_callback)).getClient();
   1810             }
   1811             pub fn getId(_callback: *Callback) u32 {
   1812                 return @as(*server.wl.Resource, @ptrCast(_callback)).getId();
   1813             }
   1814             pub fn getVersion(_callback: *Callback) u32 {
   1815                 return @as(*server.wl.Resource, @ptrCast(_callback)).getVersion();
   1816             }
   1817             pub fn postNoMemory(_callback: *Callback) void {
   1818                 return @as(*server.wl.Resource, @ptrCast(_callback)).postNoMemory();
   1819             }
   1820             pub fn getUserData(_callback: *Callback) ?*anyopaque {
   1821                 return @as(*server.wl.Resource, @ptrCast(_callback)).getUserData();
   1822             }
   1823             pub inline fn setHandler(
   1824                 _callback: *Callback,
   1825                 comptime T: type,
   1826                 comptime handle_destroy: ?fn (_callback: *Callback, data: T) void,
   1827                 _data: T,
   1828             ) void {
   1829                 const _resource: *server.wl.Resource = @ptrCast(_callback);
   1830                 _resource.setDispatcher(
   1831                     null,
   1832                     null,
   1833                     @ptrFromInt(@intFromPtr(_data)),
   1834                     if (handle_destroy) |_handler| struct {
   1835                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   1836                             @call(.always_inline, _handler, .{
   1837                                 @as(*Callback, @ptrCast(__resource)),
   1838                                 @as(?*anyopaque, @ptrFromInt(@intFromPtr(__resource.getUserData()))),
   1839                             });
   1840                         }
   1841                     }._wrapper else null,
   1842                 );
   1843             }
   1844             pub fn destroySendDone(_callback: *Callback, _callback_data: u32) void {
   1845                 const _resource: *server.wl.Resource = @ptrCast(_callback);
   1846                 var _args = [_]common.Argument{
   1847                     .{ .u = _callback_data },
   1848                 };
   1849                 _resource.postEvent(0, &_args);
   1850                 _resource.destroy();
   1851             }
   1852         };
   1853         pub const Buffer = opaque {
   1854             pub const generated_version = 1;
   1855             pub const interface = &common.wl.buffer.interface;
   1856             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Buffer {
   1857                 return @ptrCast(try server.wl.Resource.create(_client, Buffer, _version, _id));
   1858             }
   1859             pub fn destroy(_buffer: *Buffer) void {
   1860                 return @as(*server.wl.Resource, @ptrCast(_buffer)).destroy();
   1861             }
   1862             pub fn fromLink(_link: *server.wl.list.Link) *Buffer {
   1863                 return @ptrCast(server.wl.Resource.fromLink(_link));
   1864             }
   1865             pub fn getLink(_buffer: *Buffer) *server.wl.list.Link {
   1866                 return @as(*server.wl.Resource, @ptrCast(_buffer)).getLink();
   1867             }
   1868             pub fn getClient(_buffer: *Buffer) *server.wl.Client {
   1869                 return @as(*server.wl.Resource, @ptrCast(_buffer)).getClient();
   1870             }
   1871             pub fn getId(_buffer: *Buffer) u32 {
   1872                 return @as(*server.wl.Resource, @ptrCast(_buffer)).getId();
   1873             }
   1874             pub fn getVersion(_buffer: *Buffer) u32 {
   1875                 return @as(*server.wl.Resource, @ptrCast(_buffer)).getVersion();
   1876             }
   1877             pub fn postNoMemory(_buffer: *Buffer) void {
   1878                 return @as(*server.wl.Resource, @ptrCast(_buffer)).postNoMemory();
   1879             }
   1880             pub fn getUserData(_buffer: *Buffer) ?*anyopaque {
   1881                 return @as(*server.wl.Resource, @ptrCast(_buffer)).getUserData();
   1882             }
   1883             pub const Request = union(enum) {
   1884                 destroy: void,
   1885             };
   1886             pub inline fn setHandler(
   1887                 _buffer: *Buffer,
   1888                 comptime T: type,
   1889                 handle_request: *const fn (_buffer: *Buffer, request: Request, data: T) void,
   1890                 comptime handle_destroy: ?fn (_buffer: *Buffer, data: T) void,
   1891                 _data: T,
   1892             ) void {
   1893                 const _resource: *server.wl.Resource = @ptrCast(_buffer);
   1894                 _resource.setDispatcher(
   1895                     common.Dispatcher(Buffer, T).dispatcher,
   1896                     handle_request,
   1897                     @ptrFromInt(@intFromPtr(_data)),
   1898                     if (handle_destroy) |_handler| struct {
   1899                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   1900                             @call(.always_inline, _handler, .{
   1901                                 @as(*Buffer, @ptrCast(__resource)),
   1902                                 @as(T, @ptrCast(@alignCast(__resource.getUserData()))),
   1903                             });
   1904                         }
   1905                     }._wrapper else null,
   1906                 );
   1907             }
   1908             pub fn sendRelease(_buffer: *Buffer) void {
   1909                 const _resource: *server.wl.Resource = @ptrCast(_buffer);
   1910                 _resource.postEvent(0, null);
   1911             }
   1912         };
   1913         pub const Compositor = opaque {
   1914             pub const generated_version = 1;
   1915             pub const interface = &common.wl.compositor.interface;
   1916             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Compositor {
   1917                 return @ptrCast(try server.wl.Resource.create(_client, Compositor, _version, _id));
   1918             }
   1919             pub fn destroy(_compositor: *Compositor) void {
   1920                 return @as(*server.wl.Resource, @ptrCast(_compositor)).destroy();
   1921             }
   1922             pub fn fromLink(_link: *server.wl.list.Link) *Compositor {
   1923                 return @ptrCast(server.wl.Resource.fromLink(_link));
   1924             }
   1925             pub fn getLink(_compositor: *Compositor) *server.wl.list.Link {
   1926                 return @as(*server.wl.Resource, @ptrCast(_compositor)).getLink();
   1927             }
   1928             pub fn getClient(_compositor: *Compositor) *server.wl.Client {
   1929                 return @as(*server.wl.Resource, @ptrCast(_compositor)).getClient();
   1930             }
   1931             pub fn getId(_compositor: *Compositor) u32 {
   1932                 return @as(*server.wl.Resource, @ptrCast(_compositor)).getId();
   1933             }
   1934             pub fn getVersion(_compositor: *Compositor) u32 {
   1935                 return @as(*server.wl.Resource, @ptrCast(_compositor)).getVersion();
   1936             }
   1937             pub fn postNoMemory(_compositor: *Compositor) void {
   1938                 return @as(*server.wl.Resource, @ptrCast(_compositor)).postNoMemory();
   1939             }
   1940             pub fn getUserData(_compositor: *Compositor) ?*anyopaque {
   1941                 return @as(*server.wl.Resource, @ptrCast(_compositor)).getUserData();
   1942             }
   1943             pub const Request = union(enum) {
   1944                 create_surface: struct {
   1945                     id: u32,
   1946                 },
   1947                 create_region: struct {
   1948                     id: u32,
   1949                 },
   1950             };
   1951             pub inline fn setHandler(
   1952                 _compositor: *Compositor,
   1953                 comptime T: type,
   1954                 handle_request: *const fn (_compositor: *Compositor, request: Request, data: T) void,
   1955                 comptime handle_destroy: ?fn (_compositor: *Compositor, data: T) void,
   1956                 _data: T,
   1957             ) void {
   1958                 const _resource: *server.wl.Resource = @ptrCast(_compositor);
   1959                 _resource.setDispatcher(
   1960                     common.Dispatcher(Compositor, T).dispatcher,
   1961                     handle_request,
   1962                     @ptrFromInt(@intFromPtr(_data)),
   1963                     if (handle_destroy) |_handler| struct {
   1964                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   1965                             @call(.always_inline, _handler, .{
   1966                                 @as(*Compositor, @ptrCast(__resource)),
   1967                                 @as(T, @ptrCast(@alignCast(__resource.getUserData()))),
   1968                             });
   1969                         }
   1970                     }._wrapper else null,
   1971                 );
   1972             }
   1973         };
   1974         pub const Surface = opaque {
   1975             pub const generated_version = 1;
   1976             pub const interface = &common.wl.surface.interface;
   1977             pub const Error = common.wl.surface.Error;
   1978             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Surface {
   1979                 return @ptrCast(try server.wl.Resource.create(_client, Surface, _version, _id));
   1980             }
   1981             pub fn destroy(_surface: *Surface) void {
   1982                 return @as(*server.wl.Resource, @ptrCast(_surface)).destroy();
   1983             }
   1984             pub fn fromLink(_link: *server.wl.list.Link) *Surface {
   1985                 return @ptrCast(server.wl.Resource.fromLink(_link));
   1986             }
   1987             pub fn getLink(_surface: *Surface) *server.wl.list.Link {
   1988                 return @as(*server.wl.Resource, @ptrCast(_surface)).getLink();
   1989             }
   1990             pub fn getClient(_surface: *Surface) *server.wl.Client {
   1991                 return @as(*server.wl.Resource, @ptrCast(_surface)).getClient();
   1992             }
   1993             pub fn getId(_surface: *Surface) u32 {
   1994                 return @as(*server.wl.Resource, @ptrCast(_surface)).getId();
   1995             }
   1996             pub fn getVersion(_surface: *Surface) u32 {
   1997                 return @as(*server.wl.Resource, @ptrCast(_surface)).getVersion();
   1998             }
   1999             pub fn postNoMemory(_surface: *Surface) void {
   2000                 return @as(*server.wl.Resource, @ptrCast(_surface)).postNoMemory();
   2001             }
   2002             pub fn getUserData(_surface: *Surface) ?*anyopaque {
   2003                 return @as(*server.wl.Resource, @ptrCast(_surface)).getUserData();
   2004             }
   2005             pub fn postError(_surface: *Surface, _err: Error, _message: [*:0]const u8) void {
   2006                 return @as(*server.wl.Resource, @ptrCast(_surface)).postError(@intCast(@intFromEnum(_err)), _message);
   2007             }
   2008             pub const Request = union(enum) {
   2009                 destroy: void,
   2010                 attach: struct {
   2011                     buffer: ?*server.wl.Buffer,
   2012                     x: i32,
   2013                     y: i32,
   2014                 },
   2015                 damage: struct {
   2016                     x: i32,
   2017                     y: i32,
   2018                     width: i32,
   2019                     height: i32,
   2020                 },
   2021                 frame: struct {
   2022                     callback: u32,
   2023                 },
   2024                 set_opaque_region: struct {
   2025                     region: ?*server.wl.Region,
   2026                 },
   2027                 set_input_region: struct {
   2028                     region: ?*server.wl.Region,
   2029                 },
   2030                 commit: void,
   2031             };
   2032             pub inline fn setHandler(
   2033                 _surface: *Surface,
   2034                 comptime T: type,
   2035                 handle_request: *const fn (_surface: *Surface, request: Request, data: T) void,
   2036                 comptime handle_destroy: ?fn (_surface: *Surface, data: T) void,
   2037                 _data: T,
   2038             ) void {
   2039                 const _resource: *server.wl.Resource = @ptrCast(_surface);
   2040                 _resource.setDispatcher(
   2041                     common.Dispatcher(Surface, T).dispatcher,
   2042                     handle_request,
   2043                     @ptrFromInt(@intFromPtr(_data)),
   2044                     if (handle_destroy) |_handler| struct {
   2045                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   2046                             @call(.always_inline, _handler, .{
   2047                                 @as(*Surface, @ptrCast(__resource)),
   2048                                 @as(T, @ptrCast(@alignCast(__resource.getUserData()))),
   2049                             });
   2050                         }
   2051                     }._wrapper else null,
   2052                 );
   2053             }
   2054             pub fn sendEnter(_surface: *Surface, _output: *server.wl.Output) void {
   2055                 const _resource: *server.wl.Resource = @ptrCast(_surface);
   2056                 var _args = [_]common.Argument{
   2057                     .{ .o = @ptrCast(_output) },
   2058                 };
   2059                 _resource.postEvent(0, &_args);
   2060             }
   2061             pub fn sendLeave(_surface: *Surface, _output: *server.wl.Output) void {
   2062                 const _resource: *server.wl.Resource = @ptrCast(_surface);
   2063                 var _args = [_]common.Argument{
   2064                     .{ .o = @ptrCast(_output) },
   2065                 };
   2066                 _resource.postEvent(1, &_args);
   2067             }
   2068         };
   2069         pub const Region = opaque {
   2070             pub const generated_version = 1;
   2071             pub const interface = &common.wl.region.interface;
   2072             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Region {
   2073                 return @ptrCast(try server.wl.Resource.create(_client, Region, _version, _id));
   2074             }
   2075             pub fn destroy(_region: *Region) void {
   2076                 return @as(*server.wl.Resource, @ptrCast(_region)).destroy();
   2077             }
   2078             pub fn fromLink(_link: *server.wl.list.Link) *Region {
   2079                 return @ptrCast(server.wl.Resource.fromLink(_link));
   2080             }
   2081             pub fn getLink(_region: *Region) *server.wl.list.Link {
   2082                 return @as(*server.wl.Resource, @ptrCast(_region)).getLink();
   2083             }
   2084             pub fn getClient(_region: *Region) *server.wl.Client {
   2085                 return @as(*server.wl.Resource, @ptrCast(_region)).getClient();
   2086             }
   2087             pub fn getId(_region: *Region) u32 {
   2088                 return @as(*server.wl.Resource, @ptrCast(_region)).getId();
   2089             }
   2090             pub fn getVersion(_region: *Region) u32 {
   2091                 return @as(*server.wl.Resource, @ptrCast(_region)).getVersion();
   2092             }
   2093             pub fn postNoMemory(_region: *Region) void {
   2094                 return @as(*server.wl.Resource, @ptrCast(_region)).postNoMemory();
   2095             }
   2096             pub fn getUserData(_region: *Region) ?*anyopaque {
   2097                 return @as(*server.wl.Resource, @ptrCast(_region)).getUserData();
   2098             }
   2099             pub const Request = union(enum) {
   2100                 destroy: void,
   2101                 add: struct {
   2102                     x: i32,
   2103                     y: i32,
   2104                     width: i32,
   2105                     height: i32,
   2106                 },
   2107                 subtract: struct {
   2108                     x: i32,
   2109                     y: i32,
   2110                     width: i32,
   2111                     height: i32,
   2112                 },
   2113             };
   2114             pub inline fn setHandler(
   2115                 _region: *Region,
   2116                 comptime T: type,
   2117                 handle_request: *const fn (_region: *Region, request: Request, data: T) void,
   2118                 comptime handle_destroy: ?fn (_region: *Region, data: T) void,
   2119                 _data: T,
   2120             ) void {
   2121                 const _resource: *server.wl.Resource = @ptrCast(_region);
   2122                 _resource.setDispatcher(
   2123                     common.Dispatcher(Region, T).dispatcher,
   2124                     handle_request,
   2125                     @ptrFromInt(@intFromPtr(_data)),
   2126                     if (handle_destroy) |_handler| struct {
   2127                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   2128                             @call(.always_inline, _handler, .{
   2129                                 @as(*Region, @ptrCast(__resource)),
   2130                                 @as(T, @ptrCast(@alignCast(__resource.getUserData()))),
   2131                             });
   2132                         }
   2133                     }._wrapper else null,
   2134                 );
   2135             }
   2136         };
   2137         pub const Shm = opaque {
   2138             pub const generated_version = 1;
   2139             pub const interface = &common.wl.shm.interface;
   2140             pub const Error = common.wl.shm.Error;
   2141             pub const Format = common.wl.shm.Format;
   2142             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Shm {
   2143                 return @ptrCast(try server.wl.Resource.create(_client, Shm, _version, _id));
   2144             }
   2145             pub fn destroy(_shm: *Shm) void {
   2146                 return @as(*server.wl.Resource, @ptrCast(_shm)).destroy();
   2147             }
   2148             pub fn fromLink(_link: *server.wl.list.Link) *Shm {
   2149                 return @ptrCast(server.wl.Resource.fromLink(_link));
   2150             }
   2151             pub fn getLink(_shm: *Shm) *server.wl.list.Link {
   2152                 return @as(*server.wl.Resource, @ptrCast(_shm)).getLink();
   2153             }
   2154             pub fn getClient(_shm: *Shm) *server.wl.Client {
   2155                 return @as(*server.wl.Resource, @ptrCast(_shm)).getClient();
   2156             }
   2157             pub fn getId(_shm: *Shm) u32 {
   2158                 return @as(*server.wl.Resource, @ptrCast(_shm)).getId();
   2159             }
   2160             pub fn getVersion(_shm: *Shm) u32 {
   2161                 return @as(*server.wl.Resource, @ptrCast(_shm)).getVersion();
   2162             }
   2163             pub fn postNoMemory(_shm: *Shm) void {
   2164                 return @as(*server.wl.Resource, @ptrCast(_shm)).postNoMemory();
   2165             }
   2166             pub fn getUserData(_shm: *Shm) ?*anyopaque {
   2167                 return @as(*server.wl.Resource, @ptrCast(_shm)).getUserData();
   2168             }
   2169             pub fn postError(_shm: *Shm, _err: Error, _message: [*:0]const u8) void {
   2170                 return @as(*server.wl.Resource, @ptrCast(_shm)).postError(@intCast(@intFromEnum(_err)), _message);
   2171             }
   2172             pub const Request = union(enum) {
   2173                 create_pool: struct {
   2174                     id: u32,
   2175                     fd: i32,
   2176                     size: i32,
   2177                 },
   2178             };
   2179             pub inline fn setHandler(
   2180                 _shm: *Shm,
   2181                 comptime T: type,
   2182                 handle_request: *const fn (_shm: *Shm, request: Request, data: T) void,
   2183                 comptime handle_destroy: ?fn (_shm: *Shm, data: T) void,
   2184                 _data: T,
   2185             ) void {
   2186                 const _resource: *server.wl.Resource = @ptrCast(_shm);
   2187                 _resource.setDispatcher(
   2188                     common.Dispatcher(Shm, T).dispatcher,
   2189                     handle_request,
   2190                     @ptrFromInt(@intFromPtr(_data)),
   2191                     if (handle_destroy) |_handler| struct {
   2192                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   2193                             @call(.always_inline, _handler, .{
   2194                                 @as(*Shm, @ptrCast(__resource)),
   2195                                 @as(T, @ptrCast(@alignCast(__resource.getUserData()))),
   2196                             });
   2197                         }
   2198                     }._wrapper else null,
   2199                 );
   2200             }
   2201             pub fn sendFormat(_shm: *Shm, _format: Format) void {
   2202                 const _resource: *server.wl.Resource = @ptrCast(_shm);
   2203                 var _args = [_]common.Argument{
   2204                     .{ .u = switch (@typeInfo(Format)) {
   2205                         .@"enum" => @as(u32, @intCast(@intFromEnum(_format))),
   2206                         .@"struct" => @bitCast(_format),
   2207                         else => unreachable,
   2208                     } },
   2209                 };
   2210                 _resource.postEvent(0, &_args);
   2211             }
   2212         };
   2213         pub const ShmPool = opaque {
   2214             pub const generated_version = 1;
   2215             pub const interface = &common.wl.shm_pool.interface;
   2216             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*ShmPool {
   2217                 return @ptrCast(try server.wl.Resource.create(_client, ShmPool, _version, _id));
   2218             }
   2219             pub fn destroy(_shm_pool: *ShmPool) void {
   2220                 return @as(*server.wl.Resource, @ptrCast(_shm_pool)).destroy();
   2221             }
   2222             pub fn fromLink(_link: *server.wl.list.Link) *ShmPool {
   2223                 return @ptrCast(server.wl.Resource.fromLink(_link));
   2224             }
   2225             pub fn getLink(_shm_pool: *ShmPool) *server.wl.list.Link {
   2226                 return @as(*server.wl.Resource, @ptrCast(_shm_pool)).getLink();
   2227             }
   2228             pub fn getClient(_shm_pool: *ShmPool) *server.wl.Client {
   2229                 return @as(*server.wl.Resource, @ptrCast(_shm_pool)).getClient();
   2230             }
   2231             pub fn getId(_shm_pool: *ShmPool) u32 {
   2232                 return @as(*server.wl.Resource, @ptrCast(_shm_pool)).getId();
   2233             }
   2234             pub fn getVersion(_shm_pool: *ShmPool) u32 {
   2235                 return @as(*server.wl.Resource, @ptrCast(_shm_pool)).getVersion();
   2236             }
   2237             pub fn postNoMemory(_shm_pool: *ShmPool) void {
   2238                 return @as(*server.wl.Resource, @ptrCast(_shm_pool)).postNoMemory();
   2239             }
   2240             pub fn getUserData(_shm_pool: *ShmPool) ?*anyopaque {
   2241                 return @as(*server.wl.Resource, @ptrCast(_shm_pool)).getUserData();
   2242             }
   2243             pub const Request = union(enum) {
   2244                 create_buffer: struct {
   2245                     id: u32,
   2246                     offset: i32,
   2247                     width: i32,
   2248                     height: i32,
   2249                     stride: i32,
   2250                     format: common.wl.shm.Format,
   2251                 },
   2252                 destroy: void,
   2253                 resize: struct {
   2254                     size: i32,
   2255                 },
   2256             };
   2257             pub inline fn setHandler(
   2258                 _shm_pool: *ShmPool,
   2259                 comptime T: type,
   2260                 handle_request: *const fn (_shm_pool: *ShmPool, request: Request, data: T) void,
   2261                 comptime handle_destroy: ?fn (_shm_pool: *ShmPool, data: T) void,
   2262                 _data: T,
   2263             ) void {
   2264                 const _resource: *server.wl.Resource = @ptrCast(_shm_pool);
   2265                 _resource.setDispatcher(
   2266                     common.Dispatcher(ShmPool, T).dispatcher,
   2267                     handle_request,
   2268                     @ptrFromInt(@intFromPtr(_data)),
   2269                     if (handle_destroy) |_handler| struct {
   2270                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   2271                             @call(.always_inline, _handler, .{
   2272                                 @as(*ShmPool, @ptrCast(__resource)),
   2273                                 @as(T, @ptrCast(@alignCast(__resource.getUserData()))),
   2274                             });
   2275                         }
   2276                     }._wrapper else null,
   2277                 );
   2278             }
   2279         };
   2280         pub const Seat = opaque {
   2281             pub const generated_version = 2;
   2282             pub const interface = &common.wl.seat.interface;
   2283             pub const Capability = common.wl.seat.Capability;
   2284             pub const Error = common.wl.seat.Error;
   2285             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Seat {
   2286                 return @ptrCast(try server.wl.Resource.create(_client, Seat, _version, _id));
   2287             }
   2288             pub fn destroy(_seat: *Seat) void {
   2289                 return @as(*server.wl.Resource, @ptrCast(_seat)).destroy();
   2290             }
   2291             pub fn fromLink(_link: *server.wl.list.Link) *Seat {
   2292                 return @ptrCast(server.wl.Resource.fromLink(_link));
   2293             }
   2294             pub fn getLink(_seat: *Seat) *server.wl.list.Link {
   2295                 return @as(*server.wl.Resource, @ptrCast(_seat)).getLink();
   2296             }
   2297             pub fn getClient(_seat: *Seat) *server.wl.Client {
   2298                 return @as(*server.wl.Resource, @ptrCast(_seat)).getClient();
   2299             }
   2300             pub fn getId(_seat: *Seat) u32 {
   2301                 return @as(*server.wl.Resource, @ptrCast(_seat)).getId();
   2302             }
   2303             pub fn getVersion(_seat: *Seat) u32 {
   2304                 return @as(*server.wl.Resource, @ptrCast(_seat)).getVersion();
   2305             }
   2306             pub fn postNoMemory(_seat: *Seat) void {
   2307                 return @as(*server.wl.Resource, @ptrCast(_seat)).postNoMemory();
   2308             }
   2309             pub fn getUserData(_seat: *Seat) ?*anyopaque {
   2310                 return @as(*server.wl.Resource, @ptrCast(_seat)).getUserData();
   2311             }
   2312             pub fn postError(_seat: *Seat, _err: Error, _message: [*:0]const u8) void {
   2313                 return @as(*server.wl.Resource, @ptrCast(_seat)).postError(@intCast(@intFromEnum(_err)), _message);
   2314             }
   2315             pub const Request = union(enum) {
   2316                 get_pointer: struct {
   2317                     id: u32,
   2318                 },
   2319                 get_keyboard: struct {
   2320                     id: u32,
   2321                 },
   2322                 get_touch: struct {
   2323                     id: u32,
   2324                 },
   2325             };
   2326             pub inline fn setHandler(
   2327                 _seat: *Seat,
   2328                 comptime T: type,
   2329                 handle_request: *const fn (_seat: *Seat, request: Request, data: T) void,
   2330                 comptime handle_destroy: ?fn (_seat: *Seat, data: T) void,
   2331                 _data: T,
   2332             ) void {
   2333                 const _resource: *server.wl.Resource = @ptrCast(_seat);
   2334                 _resource.setDispatcher(
   2335                     common.Dispatcher(Seat, T).dispatcher,
   2336                     handle_request,
   2337                     @ptrFromInt(@intFromPtr(_data)),
   2338                     if (handle_destroy) |_handler| struct {
   2339                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   2340                             @call(.always_inline, _handler, .{
   2341                                 @as(*Seat, @ptrCast(__resource)),
   2342                                 @as(T, @ptrCast(@alignCast(__resource.getUserData()))),
   2343                             });
   2344                         }
   2345                     }._wrapper else null,
   2346                 );
   2347             }
   2348             pub fn sendCapabilities(_seat: *Seat, _capabilities: Capability) void {
   2349                 const _resource: *server.wl.Resource = @ptrCast(_seat);
   2350                 var _args = [_]common.Argument{
   2351                     .{ .u = switch (@typeInfo(Capability)) {
   2352                         .@"enum" => @as(u32, @intCast(@intFromEnum(_capabilities))),
   2353                         .@"struct" => @bitCast(_capabilities),
   2354                         else => unreachable,
   2355                     } },
   2356                 };
   2357                 _resource.postEvent(0, &_args);
   2358             }
   2359             pub fn sendName(_seat: *Seat, _name: [*:0]const u8) void {
   2360                 const _resource: *server.wl.Resource = @ptrCast(_seat);
   2361                 var _args = [_]common.Argument{
   2362                     .{ .s = _name },
   2363                 };
   2364                 _resource.postEvent(1, &_args);
   2365             }
   2366         };
   2367         pub const Pointer = opaque {
   2368             pub const generated_version = 2;
   2369             pub const interface = &common.wl.pointer.interface;
   2370             pub const Error = common.wl.pointer.Error;
   2371             pub const ButtonState = common.wl.pointer.ButtonState;
   2372             pub const Axis = common.wl.pointer.Axis;
   2373             pub const AxisSource = common.wl.pointer.AxisSource;
   2374             pub const AxisRelativeDirection = common.wl.pointer.AxisRelativeDirection;
   2375             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Pointer {
   2376                 return @ptrCast(try server.wl.Resource.create(_client, Pointer, _version, _id));
   2377             }
   2378             pub fn destroy(_pointer: *Pointer) void {
   2379                 return @as(*server.wl.Resource, @ptrCast(_pointer)).destroy();
   2380             }
   2381             pub fn fromLink(_link: *server.wl.list.Link) *Pointer {
   2382                 return @ptrCast(server.wl.Resource.fromLink(_link));
   2383             }
   2384             pub fn getLink(_pointer: *Pointer) *server.wl.list.Link {
   2385                 return @as(*server.wl.Resource, @ptrCast(_pointer)).getLink();
   2386             }
   2387             pub fn getClient(_pointer: *Pointer) *server.wl.Client {
   2388                 return @as(*server.wl.Resource, @ptrCast(_pointer)).getClient();
   2389             }
   2390             pub fn getId(_pointer: *Pointer) u32 {
   2391                 return @as(*server.wl.Resource, @ptrCast(_pointer)).getId();
   2392             }
   2393             pub fn getVersion(_pointer: *Pointer) u32 {
   2394                 return @as(*server.wl.Resource, @ptrCast(_pointer)).getVersion();
   2395             }
   2396             pub fn postNoMemory(_pointer: *Pointer) void {
   2397                 return @as(*server.wl.Resource, @ptrCast(_pointer)).postNoMemory();
   2398             }
   2399             pub fn getUserData(_pointer: *Pointer) ?*anyopaque {
   2400                 return @as(*server.wl.Resource, @ptrCast(_pointer)).getUserData();
   2401             }
   2402             pub fn postError(_pointer: *Pointer, _err: Error, _message: [*:0]const u8) void {
   2403                 return @as(*server.wl.Resource, @ptrCast(_pointer)).postError(@intCast(@intFromEnum(_err)), _message);
   2404             }
   2405             pub const Request = union(enum) {
   2406                 set_cursor: struct {
   2407                     serial: u32,
   2408                     surface: ?*server.wl.Surface,
   2409                     hotspot_x: i32,
   2410                     hotspot_y: i32,
   2411                 },
   2412             };
   2413             pub inline fn setHandler(
   2414                 _pointer: *Pointer,
   2415                 comptime T: type,
   2416                 handle_request: *const fn (_pointer: *Pointer, request: Request, data: T) void,
   2417                 comptime handle_destroy: ?fn (_pointer: *Pointer, data: T) void,
   2418                 _data: T,
   2419             ) void {
   2420                 const _resource: *server.wl.Resource = @ptrCast(_pointer);
   2421                 _resource.setDispatcher(
   2422                     common.Dispatcher(Pointer, T).dispatcher,
   2423                     handle_request,
   2424                     @ptrFromInt(@intFromPtr(_data)),
   2425                     if (handle_destroy) |_handler| struct {
   2426                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   2427                             @call(.always_inline, _handler, .{
   2428                                 @as(*Pointer, @ptrCast(__resource)),
   2429                                 @as(T, @ptrCast(@alignCast(__resource.getUserData()))),
   2430                             });
   2431                         }
   2432                     }._wrapper else null,
   2433                 );
   2434             }
   2435             pub fn sendEnter(_pointer: *Pointer, _serial: u32, _surface: *server.wl.Surface, _surface_x: common.Fixed, _surface_y: common.Fixed) void {
   2436                 const _resource: *server.wl.Resource = @ptrCast(_pointer);
   2437                 var _args = [_]common.Argument{
   2438                     .{ .u = _serial },
   2439                     .{ .o = @ptrCast(_surface) },
   2440                     .{ .f = _surface_x },
   2441                     .{ .f = _surface_y },
   2442                 };
   2443                 _resource.postEvent(0, &_args);
   2444             }
   2445             pub fn sendLeave(_pointer: *Pointer, _serial: u32, _surface: *server.wl.Surface) void {
   2446                 const _resource: *server.wl.Resource = @ptrCast(_pointer);
   2447                 var _args = [_]common.Argument{
   2448                     .{ .u = _serial },
   2449                     .{ .o = @ptrCast(_surface) },
   2450                 };
   2451                 _resource.postEvent(1, &_args);
   2452             }
   2453             pub fn sendMotion(_pointer: *Pointer, _time: u32, _surface_x: common.Fixed, _surface_y: common.Fixed) void {
   2454                 const _resource: *server.wl.Resource = @ptrCast(_pointer);
   2455                 var _args = [_]common.Argument{
   2456                     .{ .u = _time },
   2457                     .{ .f = _surface_x },
   2458                     .{ .f = _surface_y },
   2459                 };
   2460                 _resource.postEvent(2, &_args);
   2461             }
   2462             pub fn sendButton(_pointer: *Pointer, _serial: u32, _time: u32, _button: u32, _state: ButtonState) void {
   2463                 const _resource: *server.wl.Resource = @ptrCast(_pointer);
   2464                 var _args = [_]common.Argument{
   2465                     .{ .u = _serial }, .{ .u = _time }, .{ .u = _button }, .{ .u = switch (@typeInfo(ButtonState)) {
   2466                         .@"enum" => @as(u32, @intCast(@intFromEnum(_state))),
   2467                         .@"struct" => @bitCast(_state),
   2468                         else => unreachable,
   2469                     } },
   2470                 };
   2471                 _resource.postEvent(3, &_args);
   2472             }
   2473             pub fn sendAxis(_pointer: *Pointer, _time: u32, _axis: Axis, _value: common.Fixed) void {
   2474                 const _resource: *server.wl.Resource = @ptrCast(_pointer);
   2475                 var _args = [_]common.Argument{
   2476                     .{ .u = _time },
   2477                     .{ .u = switch (@typeInfo(Axis)) {
   2478                         .@"enum" => @as(u32, @intCast(@intFromEnum(_axis))),
   2479                         .@"struct" => @bitCast(_axis),
   2480                         else => unreachable,
   2481                     } },
   2482                     .{ .f = _value },
   2483                 };
   2484                 _resource.postEvent(4, &_args);
   2485             }
   2486         };
   2487         pub const Keyboard = opaque {
   2488             pub const generated_version = 2;
   2489             pub const interface = &common.wl.keyboard.interface;
   2490             pub const KeymapFormat = common.wl.keyboard.KeymapFormat;
   2491             pub const KeyState = common.wl.keyboard.KeyState;
   2492             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Keyboard {
   2493                 return @ptrCast(try server.wl.Resource.create(_client, Keyboard, _version, _id));
   2494             }
   2495             pub fn destroy(_keyboard: *Keyboard) void {
   2496                 return @as(*server.wl.Resource, @ptrCast(_keyboard)).destroy();
   2497             }
   2498             pub fn fromLink(_link: *server.wl.list.Link) *Keyboard {
   2499                 return @ptrCast(server.wl.Resource.fromLink(_link));
   2500             }
   2501             pub fn getLink(_keyboard: *Keyboard) *server.wl.list.Link {
   2502                 return @as(*server.wl.Resource, @ptrCast(_keyboard)).getLink();
   2503             }
   2504             pub fn getClient(_keyboard: *Keyboard) *server.wl.Client {
   2505                 return @as(*server.wl.Resource, @ptrCast(_keyboard)).getClient();
   2506             }
   2507             pub fn getId(_keyboard: *Keyboard) u32 {
   2508                 return @as(*server.wl.Resource, @ptrCast(_keyboard)).getId();
   2509             }
   2510             pub fn getVersion(_keyboard: *Keyboard) u32 {
   2511                 return @as(*server.wl.Resource, @ptrCast(_keyboard)).getVersion();
   2512             }
   2513             pub fn postNoMemory(_keyboard: *Keyboard) void {
   2514                 return @as(*server.wl.Resource, @ptrCast(_keyboard)).postNoMemory();
   2515             }
   2516             pub fn getUserData(_keyboard: *Keyboard) ?*anyopaque {
   2517                 return @as(*server.wl.Resource, @ptrCast(_keyboard)).getUserData();
   2518             }
   2519             pub inline fn setHandler(
   2520                 _keyboard: *Keyboard,
   2521                 comptime T: type,
   2522                 comptime handle_destroy: ?fn (_keyboard: *Keyboard, data: T) void,
   2523                 _data: T,
   2524             ) void {
   2525                 const _resource: *server.wl.Resource = @ptrCast(_keyboard);
   2526                 _resource.setDispatcher(
   2527                     null,
   2528                     null,
   2529                     @ptrFromInt(@intFromPtr(_data)),
   2530                     if (handle_destroy) |_handler| struct {
   2531                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   2532                             @call(.always_inline, _handler, .{
   2533                                 @as(*Keyboard, @ptrCast(__resource)),
   2534                                 @as(?*anyopaque, @ptrFromInt(@intFromPtr(__resource.getUserData()))),
   2535                             });
   2536                         }
   2537                     }._wrapper else null,
   2538                 );
   2539             }
   2540             pub fn sendKeymap(_keyboard: *Keyboard, _format: KeymapFormat, _fd: i32, _size: u32) void {
   2541                 const _resource: *server.wl.Resource = @ptrCast(_keyboard);
   2542                 var _args = [_]common.Argument{
   2543                     .{ .u = switch (@typeInfo(KeymapFormat)) {
   2544                         .@"enum" => @as(u32, @intCast(@intFromEnum(_format))),
   2545                         .@"struct" => @bitCast(_format),
   2546                         else => unreachable,
   2547                     } },
   2548                     .{ .h = _fd },
   2549                     .{ .u = _size },
   2550                 };
   2551                 _resource.postEvent(0, &_args);
   2552             }
   2553             pub fn sendEnter(_keyboard: *Keyboard, _serial: u32, _surface: *server.wl.Surface, _keys: *common.Array) void {
   2554                 const _resource: *server.wl.Resource = @ptrCast(_keyboard);
   2555                 var _args = [_]common.Argument{
   2556                     .{ .u = _serial },
   2557                     .{ .o = @ptrCast(_surface) },
   2558                     .{ .a = _keys },
   2559                 };
   2560                 _resource.postEvent(1, &_args);
   2561             }
   2562             pub fn sendLeave(_keyboard: *Keyboard, _serial: u32, _surface: *server.wl.Surface) void {
   2563                 const _resource: *server.wl.Resource = @ptrCast(_keyboard);
   2564                 var _args = [_]common.Argument{
   2565                     .{ .u = _serial },
   2566                     .{ .o = @ptrCast(_surface) },
   2567                 };
   2568                 _resource.postEvent(2, &_args);
   2569             }
   2570             pub fn sendKey(_keyboard: *Keyboard, _serial: u32, _time: u32, _key: u32, _state: KeyState) void {
   2571                 const _resource: *server.wl.Resource = @ptrCast(_keyboard);
   2572                 var _args = [_]common.Argument{
   2573                     .{ .u = _serial }, .{ .u = _time }, .{ .u = _key }, .{ .u = switch (@typeInfo(KeyState)) {
   2574                         .@"enum" => @as(u32, @intCast(@intFromEnum(_state))),
   2575                         .@"struct" => @bitCast(_state),
   2576                         else => unreachable,
   2577                     } },
   2578                 };
   2579                 _resource.postEvent(3, &_args);
   2580             }
   2581             pub fn sendModifiers(_keyboard: *Keyboard, _serial: u32, _mods_depressed: u32, _mods_latched: u32, _mods_locked: u32, _group: u32) void {
   2582                 const _resource: *server.wl.Resource = @ptrCast(_keyboard);
   2583                 var _args = [_]common.Argument{
   2584                     .{ .u = _serial },
   2585                     .{ .u = _mods_depressed },
   2586                     .{ .u = _mods_latched },
   2587                     .{ .u = _mods_locked },
   2588                     .{ .u = _group },
   2589                 };
   2590                 _resource.postEvent(4, &_args);
   2591             }
   2592         };
   2593         pub const Touch = opaque {
   2594             pub const generated_version = 2;
   2595             pub const interface = &common.wl.touch.interface;
   2596             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Touch {
   2597                 return @ptrCast(try server.wl.Resource.create(_client, Touch, _version, _id));
   2598             }
   2599             pub fn destroy(_touch: *Touch) void {
   2600                 return @as(*server.wl.Resource, @ptrCast(_touch)).destroy();
   2601             }
   2602             pub fn fromLink(_link: *server.wl.list.Link) *Touch {
   2603                 return @ptrCast(server.wl.Resource.fromLink(_link));
   2604             }
   2605             pub fn getLink(_touch: *Touch) *server.wl.list.Link {
   2606                 return @as(*server.wl.Resource, @ptrCast(_touch)).getLink();
   2607             }
   2608             pub fn getClient(_touch: *Touch) *server.wl.Client {
   2609                 return @as(*server.wl.Resource, @ptrCast(_touch)).getClient();
   2610             }
   2611             pub fn getId(_touch: *Touch) u32 {
   2612                 return @as(*server.wl.Resource, @ptrCast(_touch)).getId();
   2613             }
   2614             pub fn getVersion(_touch: *Touch) u32 {
   2615                 return @as(*server.wl.Resource, @ptrCast(_touch)).getVersion();
   2616             }
   2617             pub fn postNoMemory(_touch: *Touch) void {
   2618                 return @as(*server.wl.Resource, @ptrCast(_touch)).postNoMemory();
   2619             }
   2620             pub fn getUserData(_touch: *Touch) ?*anyopaque {
   2621                 return @as(*server.wl.Resource, @ptrCast(_touch)).getUserData();
   2622             }
   2623             pub inline fn setHandler(
   2624                 _touch: *Touch,
   2625                 comptime T: type,
   2626                 comptime handle_destroy: ?fn (_touch: *Touch, data: T) void,
   2627                 _data: T,
   2628             ) void {
   2629                 const _resource: *server.wl.Resource = @ptrCast(_touch);
   2630                 _resource.setDispatcher(
   2631                     null,
   2632                     null,
   2633                     @ptrFromInt(@intFromPtr(_data)),
   2634                     if (handle_destroy) |_handler| struct {
   2635                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   2636                             @call(.always_inline, _handler, .{
   2637                                 @as(*Touch, @ptrCast(__resource)),
   2638                                 @as(?*anyopaque, @ptrFromInt(@intFromPtr(__resource.getUserData()))),
   2639                             });
   2640                         }
   2641                     }._wrapper else null,
   2642                 );
   2643             }
   2644             pub fn sendDown(_touch: *Touch, _serial: u32, _time: u32, _surface: *server.wl.Surface, _id: i32, _x: common.Fixed, _y: common.Fixed) void {
   2645                 const _resource: *server.wl.Resource = @ptrCast(_touch);
   2646                 var _args = [_]common.Argument{
   2647                     .{ .u = _serial },
   2648                     .{ .u = _time },
   2649                     .{ .o = @ptrCast(_surface) },
   2650                     .{ .i = _id },
   2651                     .{ .f = _x },
   2652                     .{ .f = _y },
   2653                 };
   2654                 _resource.postEvent(0, &_args);
   2655             }
   2656             pub fn sendUp(_touch: *Touch, _serial: u32, _time: u32, _id: i32) void {
   2657                 const _resource: *server.wl.Resource = @ptrCast(_touch);
   2658                 var _args = [_]common.Argument{
   2659                     .{ .u = _serial },
   2660                     .{ .u = _time },
   2661                     .{ .i = _id },
   2662                 };
   2663                 _resource.postEvent(1, &_args);
   2664             }
   2665             pub fn sendMotion(_touch: *Touch, _time: u32, _id: i32, _x: common.Fixed, _y: common.Fixed) void {
   2666                 const _resource: *server.wl.Resource = @ptrCast(_touch);
   2667                 var _args = [_]common.Argument{
   2668                     .{ .u = _time },
   2669                     .{ .i = _id },
   2670                     .{ .f = _x },
   2671                     .{ .f = _y },
   2672                 };
   2673                 _resource.postEvent(2, &_args);
   2674             }
   2675             pub fn sendFrame(_touch: *Touch) void {
   2676                 const _resource: *server.wl.Resource = @ptrCast(_touch);
   2677                 _resource.postEvent(3, null);
   2678             }
   2679             pub fn sendCancel(_touch: *Touch) void {
   2680                 const _resource: *server.wl.Resource = @ptrCast(_touch);
   2681                 _resource.postEvent(4, null);
   2682             }
   2683         };
   2684         pub const Output = opaque {
   2685             pub const generated_version = 1;
   2686             pub const interface = &common.wl.output.interface;
   2687             pub const Subpixel = common.wl.output.Subpixel;
   2688             pub const Transform = common.wl.output.Transform;
   2689             pub const Mode = common.wl.output.Mode;
   2690             pub fn create(_client: *server.wl.Client, _version: u32, _id: u32) !*Output {
   2691                 return @ptrCast(try server.wl.Resource.create(_client, Output, _version, _id));
   2692             }
   2693             pub fn destroy(_output: *Output) void {
   2694                 return @as(*server.wl.Resource, @ptrCast(_output)).destroy();
   2695             }
   2696             pub fn fromLink(_link: *server.wl.list.Link) *Output {
   2697                 return @ptrCast(server.wl.Resource.fromLink(_link));
   2698             }
   2699             pub fn getLink(_output: *Output) *server.wl.list.Link {
   2700                 return @as(*server.wl.Resource, @ptrCast(_output)).getLink();
   2701             }
   2702             pub fn getClient(_output: *Output) *server.wl.Client {
   2703                 return @as(*server.wl.Resource, @ptrCast(_output)).getClient();
   2704             }
   2705             pub fn getId(_output: *Output) u32 {
   2706                 return @as(*server.wl.Resource, @ptrCast(_output)).getId();
   2707             }
   2708             pub fn getVersion(_output: *Output) u32 {
   2709                 return @as(*server.wl.Resource, @ptrCast(_output)).getVersion();
   2710             }
   2711             pub fn postNoMemory(_output: *Output) void {
   2712                 return @as(*server.wl.Resource, @ptrCast(_output)).postNoMemory();
   2713             }
   2714             pub fn getUserData(_output: *Output) ?*anyopaque {
   2715                 return @as(*server.wl.Resource, @ptrCast(_output)).getUserData();
   2716             }
   2717             pub inline fn setHandler(
   2718                 _output: *Output,
   2719                 comptime T: type,
   2720                 comptime handle_destroy: ?fn (_output: *Output, data: T) void,
   2721                 _data: T,
   2722             ) void {
   2723                 const _resource: *server.wl.Resource = @ptrCast(_output);
   2724                 _resource.setDispatcher(
   2725                     null,
   2726                     null,
   2727                     @ptrFromInt(@intFromPtr(_data)),
   2728                     if (handle_destroy) |_handler| struct {
   2729                         fn _wrapper(__resource: *server.wl.Resource) callconv(.C) void {
   2730                             @call(.always_inline, _handler, .{
   2731                                 @as(*Output, @ptrCast(__resource)),
   2732                                 @as(?*anyopaque, @ptrFromInt(@intFromPtr(__resource.getUserData()))),
   2733                             });
   2734                         }
   2735                     }._wrapper else null,
   2736                 );
   2737             }
   2738             pub fn sendGeometry(_output: *Output, _x: i32, _y: i32, _physical_width: i32, _physical_height: i32, _subpixel: Subpixel, _make: [*:0]const u8, _model: [*:0]const u8, _transform: Transform) void {
   2739                 const _resource: *server.wl.Resource = @ptrCast(_output);
   2740                 var _args = [_]common.Argument{
   2741                     .{ .i = _x },    .{ .i = _y },     .{ .i = _physical_width }, .{ .i = _physical_height },
   2742                     .{ .i = switch (@typeInfo(Subpixel)) {
   2743                         .@"enum" => @as(i32, @intCast(@intFromEnum(_subpixel))),
   2744                         .@"struct" => @bitCast(_subpixel),
   2745                         else => unreachable,
   2746                     } },
   2747                     .{ .s = _make }, .{ .s = _model },
   2748                     .{ .i = switch (@typeInfo(Transform)) {
   2749                         .@"enum" => @as(i32, @intCast(@intFromEnum(_transform))),
   2750                         .@"struct" => @bitCast(_transform),
   2751                         else => unreachable,
   2752                     } },
   2753                 };
   2754                 _resource.postEvent(0, &_args);
   2755             }
   2756             pub fn sendMode(_output: *Output, _flags: Mode, _width: i32, _height: i32, _refresh: i32) void {
   2757                 const _resource: *server.wl.Resource = @ptrCast(_output);
   2758                 var _args = [_]common.Argument{
   2759                     .{ .u = switch (@typeInfo(Mode)) {
   2760                         .@"enum" => @as(u32, @intCast(@intFromEnum(_flags))),
   2761                         .@"struct" => @bitCast(_flags),
   2762                         else => unreachable,
   2763                     } },
   2764                     .{ .i = _width }, .{ .i = _height },
   2765                     .{ .i = _refresh },
   2766                 };
   2767                 _resource.postEvent(1, &_args);
   2768             }
   2769         };
   2770     };
   2771 };
   2772 
   2773 const common = struct {
   2774     const Object = opaque {};
   2775 
   2776     const Message = extern struct {
   2777         name: [*:0]const u8,
   2778         signature: [*:0]const u8,
   2779         types: ?[*]const ?*const Interface,
   2780     };
   2781 
   2782     const Interface = extern struct {
   2783         name: [*:0]const u8,
   2784         version: c_int,
   2785         method_count: c_int,
   2786         methods: ?[*]const Message,
   2787         event_count: c_int,
   2788         events: ?[*]const Message,
   2789     };
   2790 
   2791     const list = struct {
   2792         pub const Link = extern struct {
   2793             prev: ?*Link,
   2794             next: ?*Link,
   2795 
   2796             pub fn init(link: *Link) void {
   2797                 link.* = .{ .prev = link, .next = link };
   2798             }
   2799 
   2800             pub fn insert(link: *Link, other: *Link) void {
   2801                 other.prev = link;
   2802                 other.next = link.next;
   2803                 link.next = other;
   2804                 other.next.?.prev = other;
   2805             }
   2806 
   2807             pub fn remove(link: *Link) void {
   2808                 link.prev.?.next = link.next;
   2809                 link.next.?.prev = link.prev;
   2810                 link.* = .{ .prev = null, .next = null };
   2811             }
   2812 
   2813             pub fn replaceWith(link: *Link, other: *Link) void {
   2814                 other.next = link.next;
   2815                 other.next.?.prev = other;
   2816                 other.prev = link.prev;
   2817                 other.prev.?.next = other;
   2818 
   2819                 link.* = .{ .prev = null, .next = null };
   2820             }
   2821 
   2822             pub fn swapWith(link: *Link, other: *Link) void {
   2823                 const old_other_prev = other.prev.?;
   2824                 other.remove();
   2825 
   2826                 link.replaceWith(other);
   2827 
   2828                 if (old_other_prev == link) {
   2829                     other.insert(link);
   2830                 } else {
   2831                     old_other_prev.insert(link);
   2832                 }
   2833             }
   2834 
   2835             /// private helper that doesn't handle empty lists and assumes that
   2836             /// other is the link of a Head.
   2837             fn insertList(link: *Link, other: *Link) void {
   2838                 other.next.?.prev = link;
   2839                 other.prev.?.next = link.next;
   2840                 link.next.?.prev = other.prev;
   2841                 link.next = other.next;
   2842 
   2843                 other.init();
   2844             }
   2845         };
   2846 
   2847         pub const Direction = enum {
   2848             forward,
   2849             reverse,
   2850         };
   2851 
   2852         /// This has the same ABI as wl.list.Link/wl_list. If link_field is null, then
   2853         /// T.getLink()/T.fromLink() will be used. This allows for compatiability
   2854         /// with wl.Client and wl.Resource
   2855         pub fn Head(comptime T: type, comptime link_field: ?@Type(.enum_literal)) type {
   2856             return extern struct {
   2857                 const Self = @This();
   2858 
   2859                 link: Link,
   2860 
   2861                 pub fn init(head: *Self) void {
   2862                     head.link.init();
   2863                 }
   2864 
   2865                 pub fn prepend(head: *Self, elem: *T) void {
   2866                     head.link.insert(linkFromElem(elem));
   2867                 }
   2868 
   2869                 pub fn append(head: *Self, elem: *T) void {
   2870                     head.link.prev.?.insert(linkFromElem(elem));
   2871                 }
   2872 
   2873                 pub fn prependList(head: *Self, other: *Self) void {
   2874                     if (other.empty()) return;
   2875                     head.link.insertList(&other.link);
   2876                 }
   2877 
   2878                 pub fn appendList(head: *Self, other: *Self) void {
   2879                     if (other.empty()) return;
   2880                     head.link.prev.?.insertList(&other.link);
   2881                 }
   2882 
   2883                 pub fn first(head: *Self) ?*T {
   2884                     if (head.empty()) {
   2885                         return null;
   2886                     } else {
   2887                         return elemFromLink(head.link.next.?);
   2888                     }
   2889                 }
   2890 
   2891                 pub fn last(head: *Self) ?*T {
   2892                     if (head.empty()) {
   2893                         return null;
   2894                     } else {
   2895                         return elemFromLink(head.link.prev.?);
   2896                     }
   2897                 }
   2898 
   2899                 pub fn length(head: *const Self) usize {
   2900                     var count: usize = 0;
   2901                     var current = head.link.next.?;
   2902                     while (current != &head.link) : (current = current.next.?) {
   2903                         count += 1;
   2904                     }
   2905                     return count;
   2906                 }
   2907 
   2908                 pub fn empty(head: *const Self) bool {
   2909                     return head.link.next == &head.link;
   2910                 }
   2911 
   2912                 /// Removal of elements during iteration is illegal
   2913                 pub fn Iterator(comptime direction: Direction) type {
   2914                     return struct {
   2915                         head: *Link,
   2916                         current: *Link,
   2917 
   2918                         pub fn next(it: *@This()) ?*T {
   2919                             it.current = switch (direction) {
   2920                                 .forward => it.current.next.?,
   2921                                 .reverse => it.current.prev.?,
   2922                             };
   2923                             if (it.current == it.head) return null;
   2924                             return elemFromLink(it.current);
   2925                         }
   2926                     };
   2927                 }
   2928 
   2929                 /// Removal of elements during iteration is illegal
   2930                 pub fn iterator(head: *Self, comptime direction: Direction) Iterator(direction) {
   2931                     return .{ .head = &head.link, .current = &head.link };
   2932                 }
   2933 
   2934                 /// Removal of the current element during iteration is permitted.
   2935                 /// Removal of other elements is illegal.
   2936                 pub fn SafeIterator(comptime direction: Direction) type {
   2937                     return struct {
   2938                         head: *Link,
   2939                         current: *Link,
   2940                         future: *Link,
   2941 
   2942                         pub fn next(it: *@This()) ?*T {
   2943                             it.current = it.future;
   2944                             it.future = switch (direction) {
   2945                                 .forward => it.future.next.?,
   2946                                 .reverse => it.future.prev.?,
   2947                             };
   2948                             if (it.current == it.head) return null;
   2949                             return elemFromLink(it.current);
   2950                         }
   2951                     };
   2952                 }
   2953 
   2954                 /// Removal of the current element during iteration is permitted.
   2955                 /// Removal of other elements is illegal.
   2956                 pub fn safeIterator(head: *Self, comptime direction: Direction) SafeIterator(direction) {
   2957                     return .{
   2958                         .head = &head.link,
   2959                         .current = &head.link,
   2960                         .future = switch (direction) {
   2961                             .forward => head.link.next.?,
   2962                             .reverse => head.link.prev.?,
   2963                         },
   2964                     };
   2965                 }
   2966 
   2967                 fn linkFromElem(elem: *T) *Link {
   2968                     if (link_field) |f| {
   2969                         return &@field(elem, @tagName(f));
   2970                     } else {
   2971                         return elem.getLink();
   2972                     }
   2973                 }
   2974 
   2975                 fn elemFromLink(link: *Link) *T {
   2976                     if (link_field) |f| {
   2977                         return @fieldParentPtr(@tagName(f), link);
   2978                     } else {
   2979                         return T.fromLink(link);
   2980                     }
   2981                 }
   2982             };
   2983         }
   2984     };
   2985 
   2986     const Array = extern struct {
   2987         size: usize,
   2988         alloc: usize,
   2989         data: ?*anyopaque,
   2990 
   2991         /// Does not clone memory
   2992         pub fn fromArrayList(comptime T: type, array_list: std.ArrayList(T)) Array {
   2993             return Array{
   2994                 .size = array_list.items.len * @sizeOf(T),
   2995                 .alloc = array_list.capacity * @sizeOf(T),
   2996                 .data = array_list.items.ptr,
   2997             };
   2998         }
   2999 
   3000         pub fn slice(array: Array, comptime T: type) []align(4) T {
   3001             const data = array.data orelse return &[0]T{};
   3002             // The wire protocol/libwayland only guarantee 32-bit word alignment.
   3003             const ptr: [*]align(4) T = @ptrCast(@alignCast(data));
   3004             return ptr[0..@divExact(array.size, @sizeOf(T))];
   3005         }
   3006     };
   3007 
   3008     /// A 24.8 signed fixed-point number.
   3009     const Fixed = enum(i32) {
   3010         _,
   3011 
   3012         pub fn toInt(f: Fixed) i24 {
   3013             return @truncate(@intFromEnum(f) >> 8);
   3014         }
   3015 
   3016         pub fn fromInt(i: i24) Fixed {
   3017             return @enumFromInt(@as(i32, i) << 8);
   3018         }
   3019 
   3020         pub fn toDouble(f: Fixed) f64 {
   3021             return @as(f64, @floatFromInt(@intFromEnum(f))) / 256;
   3022         }
   3023 
   3024         pub fn fromDouble(d: f64) Fixed {
   3025             return @enumFromInt(@as(i32, @intFromFloat(d * 256)));
   3026         }
   3027     };
   3028 
   3029     const Argument = extern union {
   3030         i: i32,
   3031         u: u32,
   3032         f: Fixed,
   3033         s: ?[*:0]const u8,
   3034         o: ?*Object,
   3035         n: u32,
   3036         a: ?*Array,
   3037         h: i32,
   3038     };
   3039 
   3040     fn Dispatcher(comptime Obj: type, comptime Data: type) type {
   3041         const client_side = @hasDecl(Obj, "Event");
   3042         const Payload = if (client_side) Obj.Event else Obj.Request;
   3043         return struct {
   3044             fn dispatcher(
   3045                 implementation: ?*const anyopaque,
   3046                 object: if (client_side) *client.wl.Proxy else *server.wl.Resource,
   3047                 opcode: u32,
   3048                 _: *const Message,
   3049                 args: [*]Argument,
   3050             ) callconv(.C) c_int {
   3051                 inline for (@typeInfo(Payload).@"union".fields, 0..) |payload_field, payload_num| {
   3052                     if (payload_num == opcode) {
   3053                         var payload_data: payload_field.type = undefined;
   3054                         if (payload_field.type != void) {
   3055                             inline for (@typeInfo(payload_field.type).@"struct".fields, 0..) |f, i| {
   3056                                 switch (@typeInfo(f.type)) {
   3057                                     // signed/unsigned ints, fds, new_ids, bitfield enums
   3058                                     .int, .@"struct" => @field(payload_data, f.name) = @as(f.type, @bitCast(args[i].u)),
   3059                                     // objects, strings, arrays
   3060                                     .pointer, .optional => @field(payload_data, f.name) = @as(f.type, @ptrFromInt(@intFromPtr(args[i].o))),
   3061                                     // non-bitfield enums
   3062                                     .@"enum" => @field(payload_data, f.name) = @as(f.type, @enumFromInt(args[i].i)),
   3063                                     else => unreachable,
   3064                                 }
   3065                             }
   3066                         }
   3067 
   3068                         const HandlerFn = fn (*Obj, Payload, Data) void;
   3069                         @as(*const HandlerFn, @ptrCast(@alignCast(implementation)))(
   3070                             @as(*Obj, @ptrCast(object)),
   3071                             @unionInit(Payload, payload_field.name, payload_data),
   3072                             @as(Data, @ptrFromInt(@intFromPtr(object.getUserData()))),
   3073                         );
   3074 
   3075                         return 0;
   3076                     }
   3077                 }
   3078                 unreachable;
   3079             }
   3080         };
   3081     }
   3082     const wl = struct {
   3083         const display = struct {
   3084             const interface: common.Interface = .{
   3085                 .name = "wl_display",
   3086                 .version = 1,
   3087                 .method_count = 2,
   3088                 .methods = &.{
   3089                     .{
   3090                         .name = "sync",
   3091                         .signature = "n",
   3092                         .types = &.{
   3093                             &common.wl.callback.interface,
   3094                         },
   3095                     },
   3096                     .{
   3097                         .name = "get_registry",
   3098                         .signature = "n",
   3099                         .types = &.{
   3100                             &common.wl.registry.interface,
   3101                         },
   3102                     },
   3103                 },
   3104                 .event_count = 2,
   3105                 .events = &.{
   3106                     .{
   3107                         .name = "error",
   3108                         .signature = "ous",
   3109                         .types = &.{
   3110                             null,
   3111                             null,
   3112                             null,
   3113                         },
   3114                     },
   3115                     .{
   3116                         .name = "delete_id",
   3117                         .signature = "u",
   3118                         .types = &.{
   3119                             null,
   3120                         },
   3121                     },
   3122                 },
   3123             };
   3124             const Error = enum(c_int) {
   3125                 invalid_object = 0,
   3126                 invalid_method = 1,
   3127                 no_memory = 2,
   3128                 implementation = 3,
   3129                 _,
   3130             };
   3131         };
   3132         const registry = struct {
   3133             const interface: common.Interface = .{
   3134                 .name = "wl_registry",
   3135                 .version = 1,
   3136                 .method_count = 1,
   3137                 .methods = &.{
   3138                     .{
   3139                         .name = "bind",
   3140                         .signature = "usun",
   3141                         .types = &.{
   3142                             null,
   3143                             null,
   3144                             null,
   3145                             null,
   3146                         },
   3147                     },
   3148                 },
   3149                 .event_count = 2,
   3150                 .events = &.{
   3151                     .{
   3152                         .name = "global",
   3153                         .signature = "usu",
   3154                         .types = &.{
   3155                             null,
   3156                             null,
   3157                             null,
   3158                         },
   3159                     },
   3160                     .{
   3161                         .name = "global_remove",
   3162                         .signature = "u",
   3163                         .types = &.{
   3164                             null,
   3165                         },
   3166                     },
   3167                 },
   3168             };
   3169         };
   3170         const callback = struct {
   3171             const interface: common.Interface = .{
   3172                 .name = "wl_callback",
   3173                 .version = 1,
   3174                 .method_count = 0,
   3175                 .methods = null,
   3176                 .event_count = 1,
   3177                 .events = &.{
   3178                     .{
   3179                         .name = "done",
   3180                         .signature = "u",
   3181                         .types = &.{
   3182                             null,
   3183                         },
   3184                     },
   3185                 },
   3186             };
   3187         };
   3188         const buffer = struct {
   3189             const interface: common.Interface = .{
   3190                 .name = "wl_buffer",
   3191                 .version = 1,
   3192                 .method_count = 1,
   3193                 .methods = &.{
   3194                     .{
   3195                         .name = "destroy",
   3196                         .signature = "",
   3197                         .types = null,
   3198                     },
   3199                 },
   3200                 .event_count = 1,
   3201                 .events = &.{
   3202                     .{
   3203                         .name = "release",
   3204                         .signature = "",
   3205                         .types = null,
   3206                     },
   3207                 },
   3208             };
   3209         };
   3210         const compositor = struct {
   3211             const interface: common.Interface = .{
   3212                 .name = "wl_compositor",
   3213                 .version = 6,
   3214                 .method_count = 2,
   3215                 .methods = &.{
   3216                     .{
   3217                         .name = "create_surface",
   3218                         .signature = "n",
   3219                         .types = &.{
   3220                             &common.wl.surface.interface,
   3221                         },
   3222                     },
   3223                     .{
   3224                         .name = "create_region",
   3225                         .signature = "n",
   3226                         .types = &.{
   3227                             &common.wl.region.interface,
   3228                         },
   3229                     },
   3230                 },
   3231                 .event_count = 0,
   3232                 .events = null,
   3233             };
   3234         };
   3235         const surface = struct {
   3236             const interface: common.Interface = .{
   3237                 .name = "wl_surface",
   3238                 .version = 6,
   3239                 .method_count = 11,
   3240                 .methods = &.{
   3241                     .{
   3242                         .name = "destroy",
   3243                         .signature = "",
   3244                         .types = null,
   3245                     },
   3246                     .{
   3247                         .name = "attach",
   3248                         .signature = "?oii",
   3249                         .types = &.{
   3250                             &common.wl.buffer.interface,
   3251                             null,
   3252                             null,
   3253                         },
   3254                     },
   3255                     .{
   3256                         .name = "damage",
   3257                         .signature = "iiii",
   3258                         .types = &.{
   3259                             null,
   3260                             null,
   3261                             null,
   3262                             null,
   3263                         },
   3264                     },
   3265                     .{
   3266                         .name = "frame",
   3267                         .signature = "n",
   3268                         .types = &.{
   3269                             &common.wl.callback.interface,
   3270                         },
   3271                     },
   3272                     .{
   3273                         .name = "set_opaque_region",
   3274                         .signature = "?o",
   3275                         .types = &.{
   3276                             &common.wl.region.interface,
   3277                         },
   3278                     },
   3279                     .{
   3280                         .name = "set_input_region",
   3281                         .signature = "?o",
   3282                         .types = &.{
   3283                             &common.wl.region.interface,
   3284                         },
   3285                     },
   3286                     .{
   3287                         .name = "commit",
   3288                         .signature = "",
   3289                         .types = null,
   3290                     },
   3291                     .{
   3292                         .name = "set_buffer_transform",
   3293                         .signature = "2i",
   3294                         .types = &.{
   3295                             null,
   3296                         },
   3297                     },
   3298                     .{
   3299                         .name = "set_buffer_scale",
   3300                         .signature = "3i",
   3301                         .types = &.{
   3302                             null,
   3303                         },
   3304                     },
   3305                     .{
   3306                         .name = "damage_buffer",
   3307                         .signature = "4iiii",
   3308                         .types = &.{
   3309                             null,
   3310                             null,
   3311                             null,
   3312                             null,
   3313                         },
   3314                     },
   3315                     .{
   3316                         .name = "offset",
   3317                         .signature = "5ii",
   3318                         .types = &.{
   3319                             null,
   3320                             null,
   3321                         },
   3322                     },
   3323                 },
   3324                 .event_count = 4,
   3325                 .events = &.{
   3326                     .{
   3327                         .name = "enter",
   3328                         .signature = "o",
   3329                         .types = &.{
   3330                             &common.wl.output.interface,
   3331                         },
   3332                     },
   3333                     .{
   3334                         .name = "leave",
   3335                         .signature = "o",
   3336                         .types = &.{
   3337                             &common.wl.output.interface,
   3338                         },
   3339                     },
   3340                     .{
   3341                         .name = "preferred_buffer_scale",
   3342                         .signature = "6i",
   3343                         .types = &.{
   3344                             null,
   3345                         },
   3346                     },
   3347                     .{
   3348                         .name = "preferred_buffer_transform",
   3349                         .signature = "6u",
   3350                         .types = &.{
   3351                             null,
   3352                         },
   3353                     },
   3354                 },
   3355             };
   3356             const Error = enum(c_int) {
   3357                 invalid_scale = 0,
   3358                 invalid_transform = 1,
   3359                 invalid_size = 2,
   3360                 invalid_offset = 3,
   3361                 defunct_role_object = 4,
   3362                 _,
   3363             };
   3364         };
   3365         const region = struct {
   3366             const interface: common.Interface = .{
   3367                 .name = "wl_region",
   3368                 .version = 1,
   3369                 .method_count = 3,
   3370                 .methods = &.{
   3371                     .{
   3372                         .name = "destroy",
   3373                         .signature = "",
   3374                         .types = null,
   3375                     },
   3376                     .{
   3377                         .name = "add",
   3378                         .signature = "iiii",
   3379                         .types = &.{
   3380                             null,
   3381                             null,
   3382                             null,
   3383                             null,
   3384                         },
   3385                     },
   3386                     .{
   3387                         .name = "subtract",
   3388                         .signature = "iiii",
   3389                         .types = &.{
   3390                             null,
   3391                             null,
   3392                             null,
   3393                             null,
   3394                         },
   3395                     },
   3396                 },
   3397                 .event_count = 0,
   3398                 .events = null,
   3399             };
   3400         };
   3401         const shm = struct {
   3402             const interface: common.Interface = .{
   3403                 .name = "wl_shm",
   3404                 .version = 2,
   3405                 .method_count = 2,
   3406                 .methods = &.{
   3407                     .{
   3408                         .name = "create_pool",
   3409                         .signature = "nhi",
   3410                         .types = &.{
   3411                             &common.wl.shm_pool.interface,
   3412                             null,
   3413                             null,
   3414                         },
   3415                     },
   3416                     .{
   3417                         .name = "release",
   3418                         .signature = "2",
   3419                         .types = null,
   3420                     },
   3421                 },
   3422                 .event_count = 1,
   3423                 .events = &.{
   3424                     .{
   3425                         .name = "format",
   3426                         .signature = "u",
   3427                         .types = &.{
   3428                             null,
   3429                         },
   3430                     },
   3431                 },
   3432             };
   3433             const Error = enum(c_int) {
   3434                 invalid_format = 0,
   3435                 invalid_stride = 1,
   3436                 invalid_fd = 2,
   3437                 _,
   3438             };
   3439             const Format = enum(c_int) {
   3440                 argb8888 = 0,
   3441                 xrgb8888 = 1,
   3442                 c8 = 0x20203843,
   3443                 rgb332 = 0x38424752,
   3444                 bgr233 = 0x38524742,
   3445                 xrgb4444 = 0x32315258,
   3446                 xbgr4444 = 0x32314258,
   3447                 rgbx4444 = 0x32315852,
   3448                 bgrx4444 = 0x32315842,
   3449                 argb4444 = 0x32315241,
   3450                 abgr4444 = 0x32314241,
   3451                 rgba4444 = 0x32314152,
   3452                 bgra4444 = 0x32314142,
   3453                 xrgb1555 = 0x35315258,
   3454                 xbgr1555 = 0x35314258,
   3455                 rgbx5551 = 0x35315852,
   3456                 bgrx5551 = 0x35315842,
   3457                 argb1555 = 0x35315241,
   3458                 abgr1555 = 0x35314241,
   3459                 rgba5551 = 0x35314152,
   3460                 bgra5551 = 0x35314142,
   3461                 rgb565 = 0x36314752,
   3462                 bgr565 = 0x36314742,
   3463                 rgb888 = 0x34324752,
   3464                 bgr888 = 0x34324742,
   3465                 xbgr8888 = 0x34324258,
   3466                 rgbx8888 = 0x34325852,
   3467                 bgrx8888 = 0x34325842,
   3468                 abgr8888 = 0x34324241,
   3469                 rgba8888 = 0x34324152,
   3470                 bgra8888 = 0x34324142,
   3471                 xrgb2101010 = 0x30335258,
   3472                 xbgr2101010 = 0x30334258,
   3473                 rgbx1010102 = 0x30335852,
   3474                 bgrx1010102 = 0x30335842,
   3475                 argb2101010 = 0x30335241,
   3476                 abgr2101010 = 0x30334241,
   3477                 rgba1010102 = 0x30334152,
   3478                 bgra1010102 = 0x30334142,
   3479                 yuyv = 0x56595559,
   3480                 yvyu = 0x55595659,
   3481                 uyvy = 0x59565955,
   3482                 vyuy = 0x59555956,
   3483                 ayuv = 0x56555941,
   3484                 nv12 = 0x3231564e,
   3485                 nv21 = 0x3132564e,
   3486                 nv16 = 0x3631564e,
   3487                 nv61 = 0x3136564e,
   3488                 yuv410 = 0x39565559,
   3489                 yvu410 = 0x39555659,
   3490                 yuv411 = 0x31315559,
   3491                 yvu411 = 0x31315659,
   3492                 yuv420 = 0x32315559,
   3493                 yvu420 = 0x32315659,
   3494                 yuv422 = 0x36315559,
   3495                 yvu422 = 0x36315659,
   3496                 yuv444 = 0x34325559,
   3497                 yvu444 = 0x34325659,
   3498                 r8 = 0x20203852,
   3499                 r16 = 0x20363152,
   3500                 rg88 = 0x38384752,
   3501                 gr88 = 0x38385247,
   3502                 rg1616 = 0x32334752,
   3503                 gr1616 = 0x32335247,
   3504                 xrgb16161616f = 0x48345258,
   3505                 xbgr16161616f = 0x48344258,
   3506                 argb16161616f = 0x48345241,
   3507                 abgr16161616f = 0x48344241,
   3508                 xyuv8888 = 0x56555958,
   3509                 vuy888 = 0x34325556,
   3510                 vuy101010 = 0x30335556,
   3511                 y210 = 0x30313259,
   3512                 y212 = 0x32313259,
   3513                 y216 = 0x36313259,
   3514                 y410 = 0x30313459,
   3515                 y412 = 0x32313459,
   3516                 y416 = 0x36313459,
   3517                 xvyu2101010 = 0x30335658,
   3518                 xvyu12_16161616 = 0x36335658,
   3519                 xvyu16161616 = 0x38345658,
   3520                 y0l0 = 0x304c3059,
   3521                 x0l0 = 0x304c3058,
   3522                 y0l2 = 0x324c3059,
   3523                 x0l2 = 0x324c3058,
   3524                 yuv420_8bit = 0x38305559,
   3525                 yuv420_10bit = 0x30315559,
   3526                 xrgb8888_a8 = 0x38415258,
   3527                 xbgr8888_a8 = 0x38414258,
   3528                 rgbx8888_a8 = 0x38415852,
   3529                 bgrx8888_a8 = 0x38415842,
   3530                 rgb888_a8 = 0x38413852,
   3531                 bgr888_a8 = 0x38413842,
   3532                 rgb565_a8 = 0x38413552,
   3533                 bgr565_a8 = 0x38413542,
   3534                 nv24 = 0x3432564e,
   3535                 nv42 = 0x3234564e,
   3536                 p210 = 0x30313250,
   3537                 p010 = 0x30313050,
   3538                 p012 = 0x32313050,
   3539                 p016 = 0x36313050,
   3540                 axbxgxrx106106106106 = 0x30314241,
   3541                 nv15 = 0x3531564e,
   3542                 q410 = 0x30313451,
   3543                 q401 = 0x31303451,
   3544                 xrgb16161616 = 0x38345258,
   3545                 xbgr16161616 = 0x38344258,
   3546                 argb16161616 = 0x38345241,
   3547                 abgr16161616 = 0x38344241,
   3548                 c1 = 0x20203143,
   3549                 c2 = 0x20203243,
   3550                 c4 = 0x20203443,
   3551                 d1 = 0x20203144,
   3552                 d2 = 0x20203244,
   3553                 d4 = 0x20203444,
   3554                 d8 = 0x20203844,
   3555                 r1 = 0x20203152,
   3556                 r2 = 0x20203252,
   3557                 r4 = 0x20203452,
   3558                 r10 = 0x20303152,
   3559                 r12 = 0x20323152,
   3560                 avuy8888 = 0x59555641,
   3561                 xvuy8888 = 0x59555658,
   3562                 p030 = 0x30333050,
   3563                 _,
   3564             };
   3565         };
   3566         const shm_pool = struct {
   3567             const interface: common.Interface = .{
   3568                 .name = "wl_shm_pool",
   3569                 .version = 2,
   3570                 .method_count = 3,
   3571                 .methods = &.{
   3572                     .{
   3573                         .name = "create_buffer",
   3574                         .signature = "niiiiu",
   3575                         .types = &.{
   3576                             &common.wl.buffer.interface,
   3577                             null,
   3578                             null,
   3579                             null,
   3580                             null,
   3581                             null,
   3582                         },
   3583                     },
   3584                     .{
   3585                         .name = "destroy",
   3586                         .signature = "",
   3587                         .types = null,
   3588                     },
   3589                     .{
   3590                         .name = "resize",
   3591                         .signature = "i",
   3592                         .types = &.{
   3593                             null,
   3594                         },
   3595                     },
   3596                 },
   3597                 .event_count = 0,
   3598                 .events = null,
   3599             };
   3600         };
   3601         const data_device_manager = struct {
   3602             const interface: common.Interface = .{
   3603                 .name = "wl_data_device_manager",
   3604                 .version = 3,
   3605                 .method_count = 2,
   3606                 .methods = &.{
   3607                     .{
   3608                         .name = "create_data_source",
   3609                         .signature = "n",
   3610                         .types = &.{
   3611                             &common.wl.data_source.interface,
   3612                         },
   3613                     },
   3614                     .{
   3615                         .name = "get_data_device",
   3616                         .signature = "no",
   3617                         .types = &.{
   3618                             &common.wl.data_device.interface,
   3619                             &common.wl.seat.interface,
   3620                         },
   3621                     },
   3622                 },
   3623                 .event_count = 0,
   3624                 .events = null,
   3625             };
   3626         };
   3627         const data_source = struct {
   3628             const interface: common.Interface = .{
   3629                 .name = "wl_data_source",
   3630                 .version = 3,
   3631                 .method_count = 3,
   3632                 .methods = &.{
   3633                     .{
   3634                         .name = "offer",
   3635                         .signature = "s",
   3636                         .types = &.{
   3637                             null,
   3638                         },
   3639                     },
   3640                     .{
   3641                         .name = "destroy",
   3642                         .signature = "",
   3643                         .types = null,
   3644                     },
   3645                     .{
   3646                         .name = "set_actions",
   3647                         .signature = "3u",
   3648                         .types = &.{
   3649                             null,
   3650                         },
   3651                     },
   3652                 },
   3653                 .event_count = 6,
   3654                 .events = &.{
   3655                     .{
   3656                         .name = "target",
   3657                         .signature = "?s",
   3658                         .types = &.{
   3659                             null,
   3660                         },
   3661                     },
   3662                     .{
   3663                         .name = "send",
   3664                         .signature = "sh",
   3665                         .types = &.{
   3666                             null,
   3667                             null,
   3668                         },
   3669                     },
   3670                     .{
   3671                         .name = "cancelled",
   3672                         .signature = "",
   3673                         .types = null,
   3674                     },
   3675                     .{
   3676                         .name = "dnd_drop_performed",
   3677                         .signature = "3",
   3678                         .types = null,
   3679                     },
   3680                     .{
   3681                         .name = "dnd_finished",
   3682                         .signature = "3",
   3683                         .types = null,
   3684                     },
   3685                     .{
   3686                         .name = "action",
   3687                         .signature = "3u",
   3688                         .types = &.{
   3689                             null,
   3690                         },
   3691                     },
   3692                 },
   3693             };
   3694         };
   3695         const data_device = struct {
   3696             const interface: common.Interface = .{
   3697                 .name = "wl_data_device",
   3698                 .version = 3,
   3699                 .method_count = 3,
   3700                 .methods = &.{
   3701                     .{
   3702                         .name = "start_drag",
   3703                         .signature = "?oo?ou",
   3704                         .types = &.{
   3705                             &common.wl.data_source.interface,
   3706                             &common.wl.surface.interface,
   3707                             &common.wl.surface.interface,
   3708                             null,
   3709                         },
   3710                     },
   3711                     .{
   3712                         .name = "set_selection",
   3713                         .signature = "?ou",
   3714                         .types = &.{
   3715                             &common.wl.data_source.interface,
   3716                             null,
   3717                         },
   3718                     },
   3719                     .{
   3720                         .name = "release",
   3721                         .signature = "2",
   3722                         .types = null,
   3723                     },
   3724                 },
   3725                 .event_count = 6,
   3726                 .events = &.{
   3727                     .{
   3728                         .name = "data_offer",
   3729                         .signature = "n",
   3730                         .types = &.{
   3731                             &common.wl.data_offer.interface,
   3732                         },
   3733                     },
   3734                     .{
   3735                         .name = "enter",
   3736                         .signature = "uoff?o",
   3737                         .types = &.{
   3738                             null,
   3739                             &common.wl.surface.interface,
   3740                             null,
   3741                             null,
   3742                             &common.wl.data_offer.interface,
   3743                         },
   3744                     },
   3745                     .{
   3746                         .name = "leave",
   3747                         .signature = "",
   3748                         .types = null,
   3749                     },
   3750                     .{
   3751                         .name = "motion",
   3752                         .signature = "uff",
   3753                         .types = &.{
   3754                             null,
   3755                             null,
   3756                             null,
   3757                         },
   3758                     },
   3759                     .{
   3760                         .name = "drop",
   3761                         .signature = "",
   3762                         .types = null,
   3763                     },
   3764                     .{
   3765                         .name = "selection",
   3766                         .signature = "?o",
   3767                         .types = &.{
   3768                             &common.wl.data_offer.interface,
   3769                         },
   3770                     },
   3771                 },
   3772             };
   3773         };
   3774         const data_offer = struct {
   3775             const interface: common.Interface = .{
   3776                 .name = "wl_data_offer",
   3777                 .version = 3,
   3778                 .method_count = 5,
   3779                 .methods = &.{
   3780                     .{
   3781                         .name = "accept",
   3782                         .signature = "u?s",
   3783                         .types = &.{
   3784                             null,
   3785                             null,
   3786                         },
   3787                     },
   3788                     .{
   3789                         .name = "receive",
   3790                         .signature = "sh",
   3791                         .types = &.{
   3792                             null,
   3793                             null,
   3794                         },
   3795                     },
   3796                     .{
   3797                         .name = "destroy",
   3798                         .signature = "",
   3799                         .types = null,
   3800                     },
   3801                     .{
   3802                         .name = "finish",
   3803                         .signature = "3",
   3804                         .types = null,
   3805                     },
   3806                     .{
   3807                         .name = "set_actions",
   3808                         .signature = "3uu",
   3809                         .types = &.{
   3810                             null,
   3811                             null,
   3812                         },
   3813                     },
   3814                 },
   3815                 .event_count = 3,
   3816                 .events = &.{
   3817                     .{
   3818                         .name = "offer",
   3819                         .signature = "s",
   3820                         .types = &.{
   3821                             null,
   3822                         },
   3823                     },
   3824                     .{
   3825                         .name = "source_actions",
   3826                         .signature = "3u",
   3827                         .types = &.{
   3828                             null,
   3829                         },
   3830                     },
   3831                     .{
   3832                         .name = "action",
   3833                         .signature = "3u",
   3834                         .types = &.{
   3835                             null,
   3836                         },
   3837                     },
   3838                 },
   3839             };
   3840         };
   3841         const shell = struct {
   3842             const interface: common.Interface = .{
   3843                 .name = "wl_shell",
   3844                 .version = 1,
   3845                 .method_count = 1,
   3846                 .methods = &.{
   3847                     .{
   3848                         .name = "get_shell_surface",
   3849                         .signature = "no",
   3850                         .types = &.{
   3851                             &common.wl.shell_surface.interface,
   3852                             &common.wl.surface.interface,
   3853                         },
   3854                     },
   3855                 },
   3856                 .event_count = 0,
   3857                 .events = null,
   3858             };
   3859         };
   3860         const shell_surface = struct {
   3861             const interface: common.Interface = .{
   3862                 .name = "wl_shell_surface",
   3863                 .version = 1,
   3864                 .method_count = 10,
   3865                 .methods = &.{
   3866                     .{
   3867                         .name = "pong",
   3868                         .signature = "u",
   3869                         .types = &.{
   3870                             null,
   3871                         },
   3872                     },
   3873                     .{
   3874                         .name = "move",
   3875                         .signature = "ou",
   3876                         .types = &.{
   3877                             &common.wl.seat.interface,
   3878                             null,
   3879                         },
   3880                     },
   3881                     .{
   3882                         .name = "resize",
   3883                         .signature = "ouu",
   3884                         .types = &.{
   3885                             &common.wl.seat.interface,
   3886                             null,
   3887                             null,
   3888                         },
   3889                     },
   3890                     .{
   3891                         .name = "set_toplevel",
   3892                         .signature = "",
   3893                         .types = null,
   3894                     },
   3895                     .{
   3896                         .name = "set_transient",
   3897                         .signature = "oiiu",
   3898                         .types = &.{
   3899                             &common.wl.surface.interface,
   3900                             null,
   3901                             null,
   3902                             null,
   3903                         },
   3904                     },
   3905                     .{
   3906                         .name = "set_fullscreen",
   3907                         .signature = "uu?o",
   3908                         .types = &.{
   3909                             null,
   3910                             null,
   3911                             &common.wl.output.interface,
   3912                         },
   3913                     },
   3914                     .{
   3915                         .name = "set_popup",
   3916                         .signature = "ouoiiu",
   3917                         .types = &.{
   3918                             &common.wl.seat.interface,
   3919                             null,
   3920                             &common.wl.surface.interface,
   3921                             null,
   3922                             null,
   3923                             null,
   3924                         },
   3925                     },
   3926                     .{
   3927                         .name = "set_maximized",
   3928                         .signature = "?o",
   3929                         .types = &.{
   3930                             &common.wl.output.interface,
   3931                         },
   3932                     },
   3933                     .{
   3934                         .name = "set_title",
   3935                         .signature = "s",
   3936                         .types = &.{
   3937                             null,
   3938                         },
   3939                     },
   3940                     .{
   3941                         .name = "set_class",
   3942                         .signature = "s",
   3943                         .types = &.{
   3944                             null,
   3945                         },
   3946                     },
   3947                 },
   3948                 .event_count = 3,
   3949                 .events = &.{
   3950                     .{
   3951                         .name = "ping",
   3952                         .signature = "u",
   3953                         .types = &.{
   3954                             null,
   3955                         },
   3956                     },
   3957                     .{
   3958                         .name = "configure",
   3959                         .signature = "uii",
   3960                         .types = &.{
   3961                             null,
   3962                             null,
   3963                             null,
   3964                         },
   3965                     },
   3966                     .{
   3967                         .name = "popup_done",
   3968                         .signature = "",
   3969                         .types = null,
   3970                     },
   3971                 },
   3972             };
   3973         };
   3974         const seat = struct {
   3975             const interface: common.Interface = .{
   3976                 .name = "wl_seat",
   3977                 .version = 9,
   3978                 .method_count = 4,
   3979                 .methods = &.{
   3980                     .{
   3981                         .name = "get_pointer",
   3982                         .signature = "n",
   3983                         .types = &.{
   3984                             &common.wl.pointer.interface,
   3985                         },
   3986                     },
   3987                     .{
   3988                         .name = "get_keyboard",
   3989                         .signature = "n",
   3990                         .types = &.{
   3991                             &common.wl.keyboard.interface,
   3992                         },
   3993                     },
   3994                     .{
   3995                         .name = "get_touch",
   3996                         .signature = "n",
   3997                         .types = &.{
   3998                             &common.wl.touch.interface,
   3999                         },
   4000                     },
   4001                     .{
   4002                         .name = "release",
   4003                         .signature = "5",
   4004                         .types = null,
   4005                     },
   4006                 },
   4007                 .event_count = 2,
   4008                 .events = &.{
   4009                     .{
   4010                         .name = "capabilities",
   4011                         .signature = "u",
   4012                         .types = &.{
   4013                             null,
   4014                         },
   4015                     },
   4016                     .{
   4017                         .name = "name",
   4018                         .signature = "2s",
   4019                         .types = &.{
   4020                             null,
   4021                         },
   4022                     },
   4023                 },
   4024             };
   4025             const Capability = packed struct(u32) {
   4026                 pointer: bool = false,
   4027                 keyboard: bool = false,
   4028                 touch: bool = false,
   4029                 _padding3: bool = false,
   4030                 _padding4: bool = false,
   4031                 _padding5: bool = false,
   4032                 _padding6: bool = false,
   4033                 _padding7: bool = false,
   4034                 _padding8: bool = false,
   4035                 _padding9: bool = false,
   4036                 _padding10: bool = false,
   4037                 _padding11: bool = false,
   4038                 _padding12: bool = false,
   4039                 _padding13: bool = false,
   4040                 _padding14: bool = false,
   4041                 _padding15: bool = false,
   4042                 _padding16: bool = false,
   4043                 _padding17: bool = false,
   4044                 _padding18: bool = false,
   4045                 _padding19: bool = false,
   4046                 _padding20: bool = false,
   4047                 _padding21: bool = false,
   4048                 _padding22: bool = false,
   4049                 _padding23: bool = false,
   4050                 _padding24: bool = false,
   4051                 _padding25: bool = false,
   4052                 _padding26: bool = false,
   4053                 _padding27: bool = false,
   4054                 _padding28: bool = false,
   4055                 _padding29: bool = false,
   4056                 _padding30: bool = false,
   4057                 _padding31: bool = false,
   4058                 pub const Enum = enum(c_int) {
   4059                     pointer = 1,
   4060                     keyboard = 2,
   4061                     touch = 4,
   4062                     _,
   4063                 };
   4064             };
   4065             const Error = enum(c_int) {
   4066                 missing_capability = 0,
   4067                 _,
   4068             };
   4069         };
   4070         const pointer = struct {
   4071             const interface: common.Interface = .{
   4072                 .name = "wl_pointer",
   4073                 .version = 9,
   4074                 .method_count = 2,
   4075                 .methods = &.{
   4076                     .{
   4077                         .name = "set_cursor",
   4078                         .signature = "u?oii",
   4079                         .types = &.{
   4080                             null,
   4081                             &common.wl.surface.interface,
   4082                             null,
   4083                             null,
   4084                         },
   4085                     },
   4086                     .{
   4087                         .name = "release",
   4088                         .signature = "3",
   4089                         .types = null,
   4090                     },
   4091                 },
   4092                 .event_count = 11,
   4093                 .events = &.{
   4094                     .{
   4095                         .name = "enter",
   4096                         .signature = "uoff",
   4097                         .types = &.{
   4098                             null,
   4099                             &common.wl.surface.interface,
   4100                             null,
   4101                             null,
   4102                         },
   4103                     },
   4104                     .{
   4105                         .name = "leave",
   4106                         .signature = "uo",
   4107                         .types = &.{
   4108                             null,
   4109                             &common.wl.surface.interface,
   4110                         },
   4111                     },
   4112                     .{
   4113                         .name = "motion",
   4114                         .signature = "uff",
   4115                         .types = &.{
   4116                             null,
   4117                             null,
   4118                             null,
   4119                         },
   4120                     },
   4121                     .{
   4122                         .name = "button",
   4123                         .signature = "uuuu",
   4124                         .types = &.{
   4125                             null,
   4126                             null,
   4127                             null,
   4128                             null,
   4129                         },
   4130                     },
   4131                     .{
   4132                         .name = "axis",
   4133                         .signature = "uuf",
   4134                         .types = &.{
   4135                             null,
   4136                             null,
   4137                             null,
   4138                         },
   4139                     },
   4140                     .{
   4141                         .name = "frame",
   4142                         .signature = "5",
   4143                         .types = null,
   4144                     },
   4145                     .{
   4146                         .name = "axis_source",
   4147                         .signature = "5u",
   4148                         .types = &.{
   4149                             null,
   4150                         },
   4151                     },
   4152                     .{
   4153                         .name = "axis_stop",
   4154                         .signature = "5uu",
   4155                         .types = &.{
   4156                             null,
   4157                             null,
   4158                         },
   4159                     },
   4160                     .{
   4161                         .name = "axis_discrete",
   4162                         .signature = "5ui",
   4163                         .types = &.{
   4164                             null,
   4165                             null,
   4166                         },
   4167                     },
   4168                     .{
   4169                         .name = "axis_value120",
   4170                         .signature = "8ui",
   4171                         .types = &.{
   4172                             null,
   4173                             null,
   4174                         },
   4175                     },
   4176                     .{
   4177                         .name = "axis_relative_direction",
   4178                         .signature = "9uu",
   4179                         .types = &.{
   4180                             null,
   4181                             null,
   4182                         },
   4183                     },
   4184                 },
   4185             };
   4186             const Error = enum(c_int) {
   4187                 role = 0,
   4188                 _,
   4189             };
   4190             const ButtonState = enum(c_int) {
   4191                 released = 0,
   4192                 pressed = 1,
   4193                 _,
   4194             };
   4195             const Axis = enum(c_int) {
   4196                 vertical_scroll = 0,
   4197                 horizontal_scroll = 1,
   4198                 _,
   4199             };
   4200             const AxisSource = enum(c_int) {
   4201                 wheel = 0,
   4202                 finger = 1,
   4203                 continuous = 2,
   4204                 _,
   4205             };
   4206             const AxisRelativeDirection = enum(c_int) {
   4207                 identical = 0,
   4208                 inverted = 1,
   4209                 _,
   4210             };
   4211         };
   4212         const keyboard = struct {
   4213             const interface: common.Interface = .{
   4214                 .name = "wl_keyboard",
   4215                 .version = 9,
   4216                 .method_count = 1,
   4217                 .methods = &.{
   4218                     .{
   4219                         .name = "release",
   4220                         .signature = "3",
   4221                         .types = null,
   4222                     },
   4223                 },
   4224                 .event_count = 6,
   4225                 .events = &.{
   4226                     .{
   4227                         .name = "keymap",
   4228                         .signature = "uhu",
   4229                         .types = &.{
   4230                             null,
   4231                             null,
   4232                             null,
   4233                         },
   4234                     },
   4235                     .{
   4236                         .name = "enter",
   4237                         .signature = "uoa",
   4238                         .types = &.{
   4239                             null,
   4240                             &common.wl.surface.interface,
   4241                             null,
   4242                         },
   4243                     },
   4244                     .{
   4245                         .name = "leave",
   4246                         .signature = "uo",
   4247                         .types = &.{
   4248                             null,
   4249                             &common.wl.surface.interface,
   4250                         },
   4251                     },
   4252                     .{
   4253                         .name = "key",
   4254                         .signature = "uuuu",
   4255                         .types = &.{
   4256                             null,
   4257                             null,
   4258                             null,
   4259                             null,
   4260                         },
   4261                     },
   4262                     .{
   4263                         .name = "modifiers",
   4264                         .signature = "uuuuu",
   4265                         .types = &.{
   4266                             null,
   4267                             null,
   4268                             null,
   4269                             null,
   4270                             null,
   4271                         },
   4272                     },
   4273                     .{
   4274                         .name = "repeat_info",
   4275                         .signature = "4ii",
   4276                         .types = &.{
   4277                             null,
   4278                             null,
   4279                         },
   4280                     },
   4281                 },
   4282             };
   4283             const KeymapFormat = enum(c_int) {
   4284                 no_keymap = 0,
   4285                 xkb_v1 = 1,
   4286                 _,
   4287             };
   4288             const KeyState = enum(c_int) {
   4289                 released = 0,
   4290                 pressed = 1,
   4291                 _,
   4292             };
   4293         };
   4294         const touch = struct {
   4295             const interface: common.Interface = .{
   4296                 .name = "wl_touch",
   4297                 .version = 9,
   4298                 .method_count = 1,
   4299                 .methods = &.{
   4300                     .{
   4301                         .name = "release",
   4302                         .signature = "3",
   4303                         .types = null,
   4304                     },
   4305                 },
   4306                 .event_count = 7,
   4307                 .events = &.{
   4308                     .{
   4309                         .name = "down",
   4310                         .signature = "uuoiff",
   4311                         .types = &.{
   4312                             null,
   4313                             null,
   4314                             &common.wl.surface.interface,
   4315                             null,
   4316                             null,
   4317                             null,
   4318                         },
   4319                     },
   4320                     .{
   4321                         .name = "up",
   4322                         .signature = "uui",
   4323                         .types = &.{
   4324                             null,
   4325                             null,
   4326                             null,
   4327                         },
   4328                     },
   4329                     .{
   4330                         .name = "motion",
   4331                         .signature = "uiff",
   4332                         .types = &.{
   4333                             null,
   4334                             null,
   4335                             null,
   4336                             null,
   4337                         },
   4338                     },
   4339                     .{
   4340                         .name = "frame",
   4341                         .signature = "",
   4342                         .types = null,
   4343                     },
   4344                     .{
   4345                         .name = "cancel",
   4346                         .signature = "",
   4347                         .types = null,
   4348                     },
   4349                     .{
   4350                         .name = "shape",
   4351                         .signature = "6iff",
   4352                         .types = &.{
   4353                             null,
   4354                             null,
   4355                             null,
   4356                         },
   4357                     },
   4358                     .{
   4359                         .name = "orientation",
   4360                         .signature = "6if",
   4361                         .types = &.{
   4362                             null,
   4363                             null,
   4364                         },
   4365                     },
   4366                 },
   4367             };
   4368         };
   4369         const output = struct {
   4370             const interface: common.Interface = .{
   4371                 .name = "wl_output",
   4372                 .version = 4,
   4373                 .method_count = 1,
   4374                 .methods = &.{
   4375                     .{
   4376                         .name = "release",
   4377                         .signature = "3",
   4378                         .types = null,
   4379                     },
   4380                 },
   4381                 .event_count = 6,
   4382                 .events = &.{
   4383                     .{
   4384                         .name = "geometry",
   4385                         .signature = "iiiiissi",
   4386                         .types = &.{
   4387                             null,
   4388                             null,
   4389                             null,
   4390                             null,
   4391                             null,
   4392                             null,
   4393                             null,
   4394                             null,
   4395                         },
   4396                     },
   4397                     .{
   4398                         .name = "mode",
   4399                         .signature = "uiii",
   4400                         .types = &.{
   4401                             null,
   4402                             null,
   4403                             null,
   4404                             null,
   4405                         },
   4406                     },
   4407                     .{
   4408                         .name = "done",
   4409                         .signature = "2",
   4410                         .types = null,
   4411                     },
   4412                     .{
   4413                         .name = "scale",
   4414                         .signature = "2i",
   4415                         .types = &.{
   4416                             null,
   4417                         },
   4418                     },
   4419                     .{
   4420                         .name = "name",
   4421                         .signature = "4s",
   4422                         .types = &.{
   4423                             null,
   4424                         },
   4425                     },
   4426                     .{
   4427                         .name = "description",
   4428                         .signature = "4s",
   4429                         .types = &.{
   4430                             null,
   4431                         },
   4432                     },
   4433                 },
   4434             };
   4435             const Subpixel = enum(c_int) {
   4436                 unknown = 0,
   4437                 none = 1,
   4438                 horizontal_rgb = 2,
   4439                 horizontal_bgr = 3,
   4440                 vertical_rgb = 4,
   4441                 vertical_bgr = 5,
   4442                 _,
   4443             };
   4444             const Transform = enum(c_int) {
   4445                 normal = 0,
   4446                 @"90" = 1,
   4447                 @"180" = 2,
   4448                 @"270" = 3,
   4449                 flipped = 4,
   4450                 flipped_90 = 5,
   4451                 flipped_180 = 6,
   4452                 flipped_270 = 7,
   4453                 _,
   4454             };
   4455             const Mode = packed struct(u32) {
   4456                 current: bool = false,
   4457                 preferred: bool = false,
   4458                 _padding2: bool = false,
   4459                 _padding3: bool = false,
   4460                 _padding4: bool = false,
   4461                 _padding5: bool = false,
   4462                 _padding6: bool = false,
   4463                 _padding7: bool = false,
   4464                 _padding8: bool = false,
   4465                 _padding9: bool = false,
   4466                 _padding10: bool = false,
   4467                 _padding11: bool = false,
   4468                 _padding12: bool = false,
   4469                 _padding13: bool = false,
   4470                 _padding14: bool = false,
   4471                 _padding15: bool = false,
   4472                 _padding16: bool = false,
   4473                 _padding17: bool = false,
   4474                 _padding18: bool = false,
   4475                 _padding19: bool = false,
   4476                 _padding20: bool = false,
   4477                 _padding21: bool = false,
   4478                 _padding22: bool = false,
   4479                 _padding23: bool = false,
   4480                 _padding24: bool = false,
   4481                 _padding25: bool = false,
   4482                 _padding26: bool = false,
   4483                 _padding27: bool = false,
   4484                 _padding28: bool = false,
   4485                 _padding29: bool = false,
   4486                 _padding30: bool = false,
   4487                 _padding31: bool = false,
   4488                 pub const Enum = enum(c_int) {
   4489                     current = 0x1,
   4490                     preferred = 0x2,
   4491                     _,
   4492                 };
   4493             };
   4494         };
   4495         const subcompositor = struct {
   4496             const interface: common.Interface = .{
   4497                 .name = "wl_subcompositor",
   4498                 .version = 1,
   4499                 .method_count = 2,
   4500                 .methods = &.{
   4501                     .{
   4502                         .name = "destroy",
   4503                         .signature = "",
   4504                         .types = null,
   4505                     },
   4506                     .{
   4507                         .name = "get_subsurface",
   4508                         .signature = "noo",
   4509                         .types = &.{
   4510                             &common.wl.subsurface.interface,
   4511                             &common.wl.surface.interface,
   4512                             &common.wl.surface.interface,
   4513                         },
   4514                     },
   4515                 },
   4516                 .event_count = 0,
   4517                 .events = null,
   4518             };
   4519         };
   4520         const subsurface = struct {
   4521             const interface: common.Interface = .{
   4522                 .name = "wl_subsurface",
   4523                 .version = 1,
   4524                 .method_count = 6,
   4525                 .methods = &.{
   4526                     .{
   4527                         .name = "destroy",
   4528                         .signature = "",
   4529                         .types = null,
   4530                     },
   4531                     .{
   4532                         .name = "set_position",
   4533                         .signature = "ii",
   4534                         .types = &.{
   4535                             null,
   4536                             null,
   4537                         },
   4538                     },
   4539                     .{
   4540                         .name = "place_above",
   4541                         .signature = "o",
   4542                         .types = &.{
   4543                             &common.wl.surface.interface,
   4544                         },
   4545                     },
   4546                     .{
   4547                         .name = "place_below",
   4548                         .signature = "o",
   4549                         .types = &.{
   4550                             &common.wl.surface.interface,
   4551                         },
   4552                     },
   4553                     .{
   4554                         .name = "set_sync",
   4555                         .signature = "",
   4556                         .types = null,
   4557                     },
   4558                     .{
   4559                         .name = "set_desync",
   4560                         .signature = "",
   4561                         .types = null,
   4562                     },
   4563                 },
   4564                 .event_count = 0,
   4565                 .events = null,
   4566             };
   4567         };
   4568     };
   4569 };