Commit a695036a authored by Thomas Guillem's avatar Thomas Guillem

vout: xcb: window: implement VOUT_WINDOW_HIDE_MOUSE

Ref #9787
parent 1a0a8254
......@@ -46,6 +46,8 @@ struct vout_window_sys_t
key_handler_t *keys;
vlc_thread_t thread;
xcb_cursor_t cursor; /* blank cursor */
xcb_window_t root;
xcb_atom_t wm_state;
xcb_atom_t wm_state_above;
......@@ -219,6 +221,14 @@ static int Control (vout_window_t *wnd, int cmd, va_list ap)
change_wm_state (wnd, fs, p_sys->wm_state_fullscreen);
break;
}
case VOUT_WINDOW_HIDE_MOUSE:
{
xcb_cursor_t cursor = (va_arg (ap, int) ? p_sys->cursor
: XCB_CURSOR_NONE);
xcb_change_window_attributes (p_sys->conn, wnd->handle.xid,
XCB_CW_CURSOR, &(uint32_t){ cursor });
break;
}
default:
msg_Err (wnd, "request %d not implemented", cmd);
......@@ -299,6 +309,18 @@ xcb_atom_t get_atom (xcb_connection_t *conn, xcb_intern_atom_cookie_t ck)
return atom;
}
static
xcb_cursor_t CursorCreate(xcb_connection_t *conn,
const xcb_screen_t *scr)
{
xcb_cursor_t cur = xcb_generate_id (conn);
xcb_pixmap_t pix = xcb_generate_id (conn);
xcb_create_pixmap (conn, 1, pix, scr->root, 1, 1);
xcb_create_cursor (conn, cur, pix, pix, 0, 0, 0, 0, 0, 0, 1, 1);
return cur;
}
static void CacheAtoms (vout_window_sys_t *p_sys)
{
xcb_connection_t *conn = p_sys->conn;
......@@ -474,6 +496,9 @@ static int Open (vout_window_t *wnd, const vout_window_cfg_t *cfg)
goto error;
}
/* Create cursor */
p_sys->cursor = CursorCreate(conn, scr);
xcb_flush (conn); /* Make sure map_window is sent (should be useless) */
return VLC_SUCCESS;
......@@ -497,6 +522,11 @@ static void Close (vout_window_t *wnd)
vlc_join (p_sys->thread, NULL);
if (p_sys->keys != NULL)
XCB_keyHandler_Destroy (p_sys->keys);
/* show the default cursor */
xcb_change_window_attributes (p_sys->conn, wnd->handle.xid, XCB_CW_CURSOR,
&(uint32_t) { XCB_CURSOR_NONE });
xcb_disconnect (conn);
free (wnd->display.x11);
free (p_sys);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment