- {
- vout_display_DeleteWindow (vd, wnd);
- return NULL;
- }
- else
- {
- xcb_get_geometry_reply_t *geo;
- xcb_get_geometry_cookie_t ck;
-
- ck = xcb_get_geometry (conn, wnd->xid);
- geo = xcb_get_geometry_reply (conn, ck, NULL);
- if (geo == NULL)
- {
- msg_Err (vd, "parent window not valid");
- goto error;
- }
- root = geo->root;
- *pdepth = geo->depth;
- free (geo);
-
- /* Subscribe to parent window resize events */
- uint32_t value = XCB_EVENT_MASK_POINTER_MOTION
- | XCB_EVENT_MASK_STRUCTURE_NOTIFY;
- xcb_change_window_attributes (conn, wnd->xid,
- XCB_CW_EVENT_MASK, &value);
- /* Try to subscribe to click events */
- /* (only one X11 client can get them, so might not work) */
- if (var_CreateGetBool (vd, "mouse-events"))
- {
- value |= XCB_EVENT_MASK_BUTTON_PRESS
- | XCB_EVENT_MASK_BUTTON_RELEASE;
- xcb_change_window_attributes (conn, wnd->xid,
- XCB_CW_EVENT_MASK, &value);
- }
- }
-
- /* Find the selected screen */
- const xcb_setup_t *setup = xcb_get_setup (conn);
- const xcb_screen_t *screen = NULL;
- for (xcb_screen_iterator_t i = xcb_setup_roots_iterator (setup);
- i.rem > 0 && screen == NULL; xcb_screen_next (&i))
- {
- if (i.data->root == root)
- screen = i.data;
- }