Add helper macros for calling xcb function and wait for reply
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
ff27ca4072
commit
e0bc6f5f7c
11
src/x.h
11
src/x.h
|
@ -11,6 +11,17 @@
|
||||||
typedef struct session session_t;
|
typedef struct session session_t;
|
||||||
typedef struct winprop winprop_t;
|
typedef struct winprop winprop_t;
|
||||||
|
|
||||||
|
#define XCB_SYNCED_VOID(func, c, ...) xcb_request_check(c, func##_checked(c, __VA_ARGS__));
|
||||||
|
#define XCB_SYNCED(func, c, ...) ({ \
|
||||||
|
xcb_generic_error_t *e = NULL; \
|
||||||
|
__auto_type r = func##_reply(c, func(c, __VA_ARGS__), &e); \
|
||||||
|
if (e) { \
|
||||||
|
x_print_error(e->sequence, e->major_code, e->minor_code, e->error_code); \
|
||||||
|
free(e); \
|
||||||
|
} \
|
||||||
|
r; \
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a specific attribute of a window.
|
* Get a specific attribute of a window.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue