xcb: minor touch-ups
This commit is contained in:
@@ -30,24 +30,26 @@ pub fn main(init: std.process.Init) !void {
|
||||
1,
|
||||
.INPUT_OUTPUT,
|
||||
screen.root_visual,
|
||||
.{
|
||||
.BACK_PIXEL = true,
|
||||
},
|
||||
&[_]u32{
|
||||
screen.black_pixel,
|
||||
},
|
||||
.{ .BACK_PIXEL = true },
|
||||
&[_]u32{screen.black_pixel},
|
||||
);
|
||||
|
||||
const wm_protocols_atom_cookie = connection.internAtom(true, "WM_PROTOCOLS");
|
||||
const wm_delete_window_atom_cookie = connection.internAtom(false, "WM_DELETE_WINDOW");
|
||||
|
||||
const wm_protocols_atom_reply = connection.internAtomReply(wm_protocols_atom_cookie, null) orelse return error.XcbInternAtom;
|
||||
defer std.c.free(wm_protocols_atom_reply);
|
||||
const wm_protocols_atom = wm_protocols_atom_reply.atom;
|
||||
const wm_protocols_atom = blk: {
|
||||
const reply = connection.internAtomReply(wm_protocols_atom_cookie, null) orelse return error.XcbInternAtom;
|
||||
const ret = reply.atom;
|
||||
std.c.free(reply);
|
||||
break :blk ret;
|
||||
};
|
||||
|
||||
const wm_delete_window_atom_reply = connection.internAtomReply(wm_delete_window_atom_cookie, null) orelse return error.XcbInternAtom;
|
||||
defer std.c.free(wm_delete_window_atom_reply);
|
||||
const wm_delete_window_atom = wm_delete_window_atom_reply.atom;
|
||||
const wm_delete_window_atom = blk: {
|
||||
const reply = connection.internAtomReply(wm_delete_window_atom_cookie, null) orelse return error.XcbInternAtom;
|
||||
const ret = reply.atom;
|
||||
std.c.free(reply);
|
||||
break :blk ret;
|
||||
};
|
||||
|
||||
_ = connection.changeProperty(
|
||||
.REPLACE,
|
||||
@@ -70,7 +72,7 @@ pub fn main(init: std.process.Init) !void {
|
||||
switch (event.response_type & ~@as(u8, 0x80)) {
|
||||
xcb.CLIENT_MESSAGE => {
|
||||
const client_message_event = @as(*xcb.ClientMessageEvent, @ptrCast(event));
|
||||
if (client_message_event.data.data32[0] == @intFromEnum(wm_delete_window_atom_reply.atom)) {
|
||||
if (client_message_event.data.data32[0] == @intFromEnum(wm_delete_window_atom)) {
|
||||
running = false;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user