Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int redirect(xcb_connection_t* conn)
- {
- xcb_screen_iterator_t iter;
- uint32_t root_redirect_values[] = {
- XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
- XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_COLOR_MAP_CHANGE |
- XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
- XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_KEY_PRESS
- };
- /* this assume conn has been initialized */
- iter = xcb_setup_roots_iterator(xcb_get_setup(conn));
- while (iter.rem) {
- xcb_screen_t* screen = iter.data;
- xcb_void_cookie_t cookie;
- xcb_generic_error_t* error;
- cookie = xcb_change_window_attributes_checked(conn, screen->root, XCB_CW_EVENT_MASK, root_redirect_values);
- xcb_flush(conn);
- if (error = xcb_request_check(conn, cookie)) {
- /*
- * Unable to redirect... another window manager is running...?
- */
- fprintf(stderr, "Unable to redirect, another window manager is running...\nerror code: %d\n",
- error->error_code);
- return false;
- }
- fprintf(stdout, "Redirecting root window of screen %p succeeded...\n", screen);
- /* do some initial setup for this screen */
- xcb_screen_next(&iter);
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement