Name
wayland_client.zig
generated by zig-wayland via a build.zig file.
Description
This file gets generated using the zig-wayland Scanner
at build time and
placed in the zig-cache/o
directory.
27 const scanner = Scanner.create(b, .{});
28 const wayland = b.createModule(.{ .source_file = scanner.result });
29
30 scanner.generate("wl_compositor", 1);
31
32 exe.addModule("wayland", wayland);
33 exe.linkLibC();
34 exe.linkSystemLibrary("wayland-client");
Contents
1 // Generated by zig-wayland
2
3 // Copyright © 2008-2011 Kristian Høgsberg
4 // Copyright © 2010-2011 Intel Corporation
5 // Copyright © 2012-2013 Collabora, Ltd.
6 //
7 // Permission is hereby granted, free of charge, to any person
8 // obtaining a copy of this software and associated documentation files
9 // (the "Software"), to deal in the Software without restriction,
10 // including without limitation the rights to use, copy, modify, merge,
11 // publish, distribute, sublicense, and/or sell copies of the Software,
12 // and to permit persons to whom the Software is furnished to do so,
13 // subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice (including the
16 // next paragraph) shall be included in all copies or substantial
17 // portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
23 // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 // SOFTWARE.
27 //
28
29 const std = @import("std");
30 const os = std.os;
31 const client = @import("wayland.zig").client;
32 const common = @import("common.zig");
33 pub const Display = opaque {
34 pub const generated_version = 1;
35 pub const getInterface = common.wl.display.getInterface;
36 pub const Error = common.wl.display.Error;
37 pub fn setQueue(_display: *Display, _queue: *client.wl.EventQueue) void {
38 const _proxy: *client.wl.Proxy = @ptrCast(_display);
39 _proxy.setQueue(_queue);
40 }
41 pub const Event = union(enum) {
42 @"error": struct {
43 object_id: ?*common.Object,
44 code: u32,
45 message: [*:0]const u8,
46 },
47 delete_id: struct {
48 id: u32,
49 },
50 };
51 pub inline fn setListener(
52 _display: *Display,
53 comptime T: type,
54 _listener: *const fn ( void,
55 _data: T,
56 ) void {
57 const _proxy: *client.wl.Proxy = @ptrCast(_display);
58 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
59 _proxy.addDispatcher(common.Dispatcher(Display, T).dispatcher, _listener, _mut_data);
60 }
61 pub fn sync(_display: *Display) !*client.wl.Callback {
62 const _proxy: *client.wl.Proxy = @ptrCast(_display);
63 var _args = [_]common.Argument{
64 .{ .o = null },
65 };
66 return @ptrCast(try _proxy.marshalConstructor(0, &_args, client.wl.Callback.getInterface()));
67 }
68 pub fn getRegistry(_display: *Display) !*client.wl.Registry {
69 const _proxy: *client.wl.Proxy = @ptrCast(_display);
70 var _args = [_]common.Argument{
71 .{ .o = null },
72 };
73 return @ptrCast(try _proxy.marshalConstructor(1, &_args, client.wl.Registry.getInterface()));
74 }
75 extern fn wl_display_connect(name: ?[*:0]const u8) ?*Display;
76 pub inline fn connect(name: ?[*:0]const u8) error{ConnectFailed}!*Display {
77 return wl_display_connect(name) orelse return error.ConnectFailed;
78 }
79
80 extern fn wl_display_connect_to_fd(fd: c_int) ?*Display;
81 pub inline fn connectToFd(fd: c_int) error{ConnectFailed}!*Display {
82 return wl_display_connect_to_fd(fd) orelse return error.ConnectFailed;
83 }
84
85 extern fn wl_display_disconnect(display: *Display) void;
86 pub const disconnect = wl_display_disconnect;
87
88 extern fn wl_display_get_fd(display: *Display) c_int;
89 pub const getFd = wl_display_get_fd;
90
91 extern fn wl_display_dispatch(display: *Display) c_int;
92 pub inline fn dispatch(display: *Display) os.E {
93 return os.errno(wl_display_dispatch(display));
94 }
95
96 extern fn wl_display_dispatch_queue(display: *Display, queue: *client.wl.EventQueue) c_int;
97 pub inline fn dispatchQueue(display: *Display, queue: *client.wl.EventQueue) os.E {
98 return os.errno(wl_display_dispatch_queue(display, queue));
99 }
100
101 extern fn wl_display_dispatch_pending(display: *Display) c_int;
102 pub inline fn dispatchPending(display: *Display) os.E {
103 return os.errno(wl_display_dispatch_pending(display));
104 }
105
106 extern fn wl_display_dispatch_queue_pending(display: *Display, queue: *client.wl.EventQueue) c_int;
107 pub inline fn dispatchQueuePending(display: *Display, queue: *client.wl.EventQueue) os.E {
108 return os.errno(wl_display_dispatch_queue_pending(display, queue));
109 }
110
111 extern fn wl_display_roundtrip(display: *Display) c_int;
112 pub inline fn roundtrip(display: *Display) os.E {
113 return os.errno(wl_display_roundtrip(display));
114 }
115
116 extern fn wl_display_roundtrip_queue(display: *Display, queue: *client.wl.EventQueue) c_int;
117 pub inline fn roundtripQueue(display: *Display, queue: *client.wl.EventQueue) os.E {
118 return os.errno(wl_display_roundtrip_queue(display, queue));
119 }
120
121 extern fn wl_display_flush(display: *Display) c_int;
122 pub inline fn flush(display: *Display) os.E {
123 return os.errno(wl_display_flush(display));
124 }
125
126 extern fn wl_display_create_queue(display: *Display) ?*client.wl.EventQueue;
127 pub inline fn createQueue(display: *Display) error{OutOfMemory}!*client.wl.EventQueue {
128 return wl_display_create_queue(display) orelse error.OutOfMemory;
129 }
130
131 extern fn wl_display_get_error(display: *Display) c_int;
132 pub const getError = wl_display_get_error;
133
134 extern fn wl_display_prepare_read_queue(display: *Display, queue: *client.wl.EventQueue) c_int;
135 /// Succeeds if the queue is empty and returns true.
136 /// Fails and returns false if the queue was not empty.
137 pub inline fn prepareReadQueue(display: *Display, queue: *client.wl.EventQueue) bool {
138 switch (wl_display_prepare_read_queue(display, queue)) {
139 0 => return true,
140 -1 => return false,
141 else => unreachable,
142 }
143 }
144
145 extern fn wl_display_prepare_read(display: *Display) c_int;
146 /// Succeeds if the queue is empty and returns true.
147 /// Fails and returns false if the queue was not empty.
148 pub inline fn prepareRead(display: *Display) bool {
149 switch (wl_display_prepare_read(display)) {
150 0 => return true,
151 -1 => return false,
152 else => unreachable,
153 }
154 }
155
156 extern fn wl_display_cancel_read(display: *Display) void;
157 pub const cancelRead = wl_display_cancel_read;
158
159 extern fn wl_display_read_events(display: *Display) c_int;
160 pub inline fn readEvents(display: *Display) os.E {
161 return os.errno(wl_display_read_events(display));
162 }
163 };
164 pub const Registry = opaque {
165 pub const generated_version = 1;
166 pub const getInterface = common.wl.registry.getInterface;
167 pub fn setQueue(_registry: *Registry, _queue: *client.wl.EventQueue) void {
168 const _proxy: *client.wl.Proxy = @ptrCast(_registry);
169 _proxy.setQueue(_queue);
170 }
171 pub const Event = union(enum) {
172 global: struct {
173 name: u32,
174 interface: [*:0]const u8,
175 version: u32,
176 },
177 global_remove: struct {
178 name: u32,
179 },
180 };
181 pub inline fn setListener(
182 _registry: *Registry,
183 comptime T: type,
184 _listener: *const fn ( void,
185 _data: T,
186 ) void {
187 const _proxy: *client.wl.Proxy = @ptrCast(_registry);
188 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
189 _proxy.addDispatcher(common.Dispatcher(Registry, T).dispatcher, _listener, _mut_data);
190 }
191 pub fn bind(_registry: *Registry, _name: u32, comptime T: type, _version: u32) !*T {
192 const version_to_construct = @min(T.generated_version, _version);
193 const _proxy: *client.wl.Proxy = @ptrCast(_registry);
194 var _args = [_]common.Argument{
195 .{ .u = _name }, .{ .s = T.getInterface().name },
196 .{ .u = version_to_construct }, .{ .o = null },
197 };
198 return @ptrCast(try _proxy.marshalConstructorVersioned(0, &_args, T.getInterface(), version_to_construct));
199 }
200 pub fn destroy(_registry: *Registry) void {
201 const _proxy: *client.wl.Proxy = @ptrCast(_registry);
202 _proxy.destroy();
203 }
204 };
205 pub const Callback = opaque {
206 pub const generated_version = 1;
207 pub const getInterface = common.wl.callback.getInterface;
208 pub fn setQueue(_callback: *Callback, _queue: *client.wl.EventQueue) void {
209 const _proxy: *client.wl.Proxy = @ptrCast(_callback);
210 _proxy.setQueue(_queue);
211 }
212 pub const Event = union(enum) {
213 done: struct {
214 callback_data: u32,
215 },
216 };
217 pub inline fn setListener(
218 _callback: *Callback,
219 comptime T: type,
220 _listener: *const fn ( void,
221 _data: T,
222 ) void {
223 const _proxy: *client.wl.Proxy = @ptrCast(_callback);
224 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
225 _proxy.addDispatcher(common.Dispatcher(Callback, T).dispatcher, _listener, _mut_data);
226 }
227 pub fn destroy(_callback: *Callback) void {
228 const _proxy: *client.wl.Proxy = @ptrCast(_callback);
229 _proxy.destroy();
230 }
231 };
232 pub const Buffer = opaque {
233 pub const generated_version = 1;
234 pub const getInterface = common.wl.buffer.getInterface;
235 pub fn setQueue(_buffer: *Buffer, _queue: *client.wl.EventQueue) void {
236 const _proxy: *client.wl.Proxy = @ptrCast(_buffer);
237 _proxy.setQueue(_queue);
238 }
239 pub const Event = union(enum) {
240 release: void,
241 };
242 pub inline fn setListener(
243 _buffer: *Buffer,
244 comptime T: type,
245 _listener: *const fn ( void,
246 _data: T,
247 ) void {
248 const _proxy: *client.wl.Proxy = @ptrCast(_buffer);
249 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
250 _proxy.addDispatcher(common.Dispatcher(Buffer, T).dispatcher, _listener, _mut_data);
251 }
252 pub fn destroy(_buffer: *Buffer) void {
253 const _proxy: *client.wl.Proxy = @ptrCast(_buffer);
254 _proxy.marshal(0, null);
255 _proxy.destroy();
256 }
257 };
258 pub const Compositor = opaque {
259 pub const generated_version = 1;
260 pub const getInterface = common.wl.compositor.getInterface;
261 pub fn setQueue(_compositor: *Compositor, _queue: *client.wl.EventQueue) void {
262 const _proxy: *client.wl.Proxy = @ptrCast(_compositor);
263 _proxy.setQueue(_queue);
264 }
265 pub fn createSurface(_compositor: *Compositor) !*client.wl.Surface {
266 const _proxy: *client.wl.Proxy = @ptrCast(_compositor);
267 var _args = [_]common.Argument{
268 .{ .o = null },
269 };
270 return @ptrCast(try _proxy.marshalConstructor(0, &_args, client.wl.Surface.getInterface()));
271 }
272 pub fn createRegion(_compositor: *Compositor) !*client.wl.Region {
273 const _proxy: *client.wl.Proxy = @ptrCast(_compositor);
274 var _args = [_]common.Argument{
275 .{ .o = null },
276 };
277 return @ptrCast(try _proxy.marshalConstructor(1, &_args, client.wl.Region.getInterface()));
278 }
279 pub fn destroy(_compositor: *Compositor) void {
280 const _proxy: *client.wl.Proxy = @ptrCast(_compositor);
281 _proxy.destroy();
282 }
283 };
284 pub const Surface = opaque {
285 pub const generated_version = 1;
286 pub const getInterface = common.wl.surface.getInterface;
287 pub const Error = common.wl.surface.Error;
288 pub fn setQueue(_surface: *Surface, _queue: *client.wl.EventQueue) void {
289 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
290 _proxy.setQueue(_queue);
291 }
292 pub const Event = union(enum) {
293 enter: struct {
294 output: ?*client.wl.Output,
295 },
296 leave: struct {
297 output: ?*client.wl.Output,
298 },
299 };
300 pub inline fn setListener(
301 _surface: *Surface,
302 comptime T: type,
303 _listener: *const fn ( void,
304 _data: T,
305 ) void {
306 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
307 const _mut_data: ?*anyopaque = @ptrFromInt(@intFromPtr(_data));
308 _proxy.addDispatcher(common.Dispatcher(Surface, T).dispatcher, _listener, _mut_data);
309 }
310 pub fn destroy(_surface: *Surface) void {
311 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
312 _proxy.marshal(0, null);
313 _proxy.destroy();
314 }
315 pub fn attach(_surface: *Surface, _buffer: ?*client.wl.Buffer, _x: i32, _y: i32) void {
316 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
317 var _args = [_]common.Argument{
318 .{ .o = @ptrCast(_buffer) },
319 .{ .i = _x },
320 .{ .i = _y },
321 };
322 _proxy.marshal(1, &_args);
323 }
324 pub fn damage(_surface: *Surface, _x: i32, _y: i32, _width: i32, _height: i32) void {
325 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
326 var _args = [_]common.Argument{
327 .{ .i = _x },
328 .{ .i = _y },
329 .{ .i = _width },
330 .{ .i = _height },
331 };
332 _proxy.marshal(2, &_args);
333 }
334 pub fn frame(_surface: *Surface) !*client.wl.Callback {
335 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
336 var _args = [_]common.Argument{
337 .{ .o = null },
338 };
339 return @ptrCast(try _proxy.marshalConstructor(3, &_args, client.wl.Callback.getInterface()));
340 }
341 pub fn setOpaqueRegion(_surface: *Surface, _region: ?*client.wl.Region) void {
342 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
343 var _args = [_]common.Argument{
344 .{ .o = @ptrCast(_region) },
345 };
346 _proxy.marshal(4, &_args);
347 }
348 pub fn setInputRegion(_surface: *Surface, _region: ?*client.wl.Region) void {
349 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
350 var _args = [_]common.Argument{
351 .{ .o = @ptrCast(_region) },
352 };
353 _proxy.marshal(5, &_args);
354 }
355 pub fn commit(_surface: *Surface) void {
356 const _proxy: *client.wl.Proxy = @ptrCast(_surface);
357 _proxy.marshal(6, null);
358 }
359 };
360 pub const Region = opaque {
361 pub const generated_version = 1;
362 pub const getInterface = common.wl.region.getInterface;
363 pub fn setQueue(_region: *Region, _queue: *client.wl.EventQueue) void {
364 const _proxy: *client.wl.Proxy = @ptrCast(_region);
365 _proxy.setQueue(_queue);
366 }
367 pub fn destroy(_region: *Region) void {
368 const _proxy: *client.wl.Proxy = @ptrCast(_region);
369 _proxy.marshal(0, null);
370 _proxy.destroy();
371 }
372 pub fn add(_region: *Region, _x: i32, _y: i32, _width: i32, _height: i32) void {
373 const _proxy: *client.wl.Proxy = @ptrCast(_region);
374 var _args = [_]common.Argument{
375 .{ .i = _x },
376 .{ .i = _y },
377 .{ .i = _width },
378 .{ .i = _height },
379 };
380 _proxy.marshal(1, &_args);
381 }
382 pub fn subtract(_region: *Region, _x: i32, _y: i32, _width: i32, _height: i32) void {
383 const _proxy: *client.wl.Proxy = @ptrCast(_region);
384 var _args = [_]common.Argument{
385 .{ .i = _x },
386 .{ .i = _y },
387 .{ .i = _width },
388 .{ .i = _height },
389 };
390 _proxy.marshal(2, &_args);
391 }
392 };
References
This page is referenced by the following documents: