blob: b8221090153bb4cd0964bf3dd1d5cec550a85b08 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
const std = @import("std");
const wayland = @import("wayland");
const wl = wayland.wl;
const log = std.log.scoped(.main);
pub const std_options = std.Options{
.log_scope_levels = &.{
.{ .scope = .registry, .level = .info },
}
};
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();
var display: wl.Display = try .open_default(allocator);
defer display.deinit(allocator);
try display.init(allocator, &.{
wl.Output.handler,
wl.Compositor.handler,
wl.Shm.handler,
});
try display.roundtrip(allocator);
try display.roundtrip(allocator);
const ctx: wayland.Context = .{
.allocator = allocator,
.display = &display,
};
try display.roundtrip(allocator);
for (wl.Output.instances.items) |output| {
log.debug("{}", .{output});
}
for (wl.Compositor.instances.items) |compositor| {
log.debug("{}", .{compositor});
}
for (wl.Shm.instances.items) |shm| {
log.debug("{}", .{shm});
}
const pool = try wl.Shm.instances.items[0].create_pool(&ctx, 1024);
defer pool.deinit(&ctx);
try display.roundtrip(allocator);
}
|