tHandle errors in wm_reg_event() - libwm - X windows manipulation library
HTML git clone git://z3bra.org/libwm
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 65e44403ff65e1c15b76b7be8c20021475d07c1c
DIR parent 246faeb2f14e0be097f3d7629830b469bd6bb7b8
HTML Author: Willy Goiffon <dev@z3bra.org>
Date: Tue, 22 Oct 2019 19:48:27 +0200
Handle errors in wm_reg_event()
Diffstat:
M libwm.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
DIR diff --git a/libwm.c b/libwm.c
t@@ -400,7 +400,15 @@ int
wm_reg_event(xcb_window_t wid, uint32_t mask)
{
uint32_t val[] = { mask };
+ xcb_void_cookie_t c;
+ xcb_generic_error_t *e;
- xcb_change_window_attributes(conn, wid, XCB_CW_EVENT_MASK, val);
- return 0;
+ c = xcb_change_window_attributes_checked(conn, wid, XCB_CW_EVENT_MASK, val);
+ e = xcb_request_check(conn, c);
+ if (!e)
+ return 0;
+
+ free(e);
+
+ return 1;
}