diff options
Diffstat (limited to 'zig-x11/main.zig')
| -rw-r--r-- | zig-x11/main.zig | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/zig-x11/main.zig b/zig-x11/main.zig new file mode 100644 index 0000000..daa4cd5 --- /dev/null +++ b/zig-x11/main.zig @@ -0,0 +1,32 @@ +const std = @import("std"); +const xlib = @cImport({ + @cInclude("X11/Xlib.h"); +}); + +pub fn main() !void { + const display = xlib.XOpenDisplay(null); + if (display == null) { + return error.DisplayOpenFailed; + } + + const rootWindow = xlib.XDefaultRootWindow(display); + + const mainWindow = xlib.XCreateSimpleWindow( + display, + rootWindow, + 0, + 0, + 800, + 600, + 0, + 0, + 0xFF0000, + ); + + _ = xlib.XMapWindow(display, mainWindow); + _ = xlib.XFlush(display); + + while (true) { + std.time.sleep(1 * std.time.ns_per_s); + } +} |
