I am trying to make a very simple window that doesn't get resized or positioned by a window manager. I thought what I wrote below would work, am I missing something?
// Create a window
xcb_window_t \
window = xcb_generate_id(connection);
uint32_t \
mask = \
XCB_CW_BACK_PIXEL | \
XCB_CW_BORDER_PIXEL | \
XCB_CW_EVENT_MASK | \
XCB_CW_OVERRIDE_REDIRECT;
uint32_t \
win_values[] = {
default_screen->white_pixel,
0,
XCB_EVENT_MASK_EXPOSURE,
1
};
xcb_create_window(
connection,
default_screen->root_depth,
window,
default_screen->root,
0, 0, 500, 500, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
default_screen->root_visual,
mask, win_values
);
it seems to work if I remove the event mask, how can I handle events then?
You have to switch the event mask and override redirect:
uint32_t \
win_values[] = {
default_screen->white_pixel,
0,
1,
XCB_EVENT_MASK_EXPOSURE
};
For clarity, you should also switch the order in mask
, but it does not really matter there. The value would not change.
How did I find this? I look at /usr/include/xcb/xproto.h
and search for XCB_CW_BACK_PIXEL
. This leads to the xcb_cw_t
enum. The values you provide must be in the same order as in this enum.
(And no, I do not know a simpler way to figure this out. I know other ways, but no simpler one.)