Commit a62fba04 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

xcb: remove mouse events

parent 20839a09
......@@ -77,26 +77,6 @@ static xcb_connection_t *Connect (vlc_object_t *obj, const char *display)
return conn;
}
/**
* (Try to) register to mouse events on a window if needed.
*/
static void RegisterEvents (vlc_object_t *obj, xcb_connection_t *conn,
xcb_window_t wnd)
{
/* Subscribe to parent window resize events */
uint32_t value = XCB_EVENT_MASK_POINTER_MOTION;
xcb_change_window_attributes (conn, wnd, XCB_CW_EVENT_MASK, &value);
/* Try to subscribe to click events */
/* (only one X11 client can get them, so might not work) */
if (var_InheritBool (obj, "mouse-events"))
{
value |= XCB_EVENT_MASK_BUTTON_PRESS
| XCB_EVENT_MASK_BUTTON_RELEASE;
xcb_change_window_attributes (conn, wnd,
XCB_CW_EVENT_MASK, &value);
}
}
/**
* Find screen matching a given root window.
*/
......@@ -135,9 +115,9 @@ vout_window_t *vlc_xcb_parent_Create(vout_display_t *vd,
goto error;
*pconn = conn;
/* Events must be registered before the window geometry is queried, so as
* to avoid missing impeding resize events. */
RegisterEvents (VLC_OBJECT(vd), conn, wnd->handle.xid);
uint32_t value = XCB_EVENT_MASK_POINTER_MOTION;
xcb_change_window_attributes (conn, wnd->handle.xid,
XCB_CW_EVENT_MASK, &value);
xcb_get_geometry_reply_t *geo =
xcb_get_geometry_reply (conn, xcb_get_geometry (conn, wnd->handle.xid),
......@@ -178,43 +158,6 @@ xcb_cursor_t vlc_xcb_cursor_Create(xcb_connection_t *conn,
* Otherwise, we'd var_OrInteger() and var_NandInteger() functions...
*/
/* FIXME we assume direct mapping between XCB and VLC */
static void HandleButtonPress (vout_display_t *vd,
const xcb_button_press_event_t *ev)
{
vout_display_SendEventMousePressed (vd, ev->detail - 1);
}
static void HandleButtonRelease (vout_display_t *vd,
const xcb_button_release_event_t *ev)
{
vout_display_SendEventMouseReleased (vd, ev->detail - 1);
}
static void HandleMotionNotify (vout_display_t *vd, xcb_connection_t *conn,
const xcb_motion_notify_event_t *ev)
{
vout_display_place_t place;
/* show the default cursor */
xcb_change_window_attributes (conn, ev->event, XCB_CW_CURSOR,
&(uint32_t) { XCB_CURSOR_NONE });
xcb_flush (conn);
/* TODO it could be saved */
vout_display_PlacePicture (&place, &vd->source, vd->cfg, false);
if (place.width <= 0 || place.height <= 0)
return;
const int x = vd->source.i_x_offset +
(int64_t)(ev->event_x - place.x) * vd->source.i_visible_width / place.width;
const int y = vd->source.i_y_offset +
(int64_t)(ev->event_y - place.y) * vd->source.i_visible_height/ place.height;
vout_display_SendEventMouseMoved (vd, x, y);
}
static void HandleVisibilityNotify (vout_display_t *vd, bool *visible,
const xcb_visibility_notify_event_t *ev)
{
......@@ -230,17 +173,15 @@ static int ProcessEvent (vout_display_t *vd, xcb_connection_t *conn,
{
switch (ev->response_type & 0x7f)
{
case XCB_BUTTON_PRESS:
HandleButtonPress (vd, (xcb_button_press_event_t *)ev);
break;
case XCB_BUTTON_RELEASE:
HandleButtonRelease (vd, (xcb_button_release_event_t *)ev);
break;
case XCB_MOTION_NOTIFY:
HandleMotionNotify (vd, conn, (xcb_motion_notify_event_t *)ev);
{
const xcb_motion_notify_event_t *mne = (void *)ev;
/* show the default cursor */
xcb_change_window_attributes (conn, mne->event, XCB_CW_CURSOR,
&(uint32_t) { XCB_CURSOR_NONE });
xcb_flush (conn);
break;
}
case XCB_VISIBILITY_NOTIFY:
HandleVisibilityNotify (vd, visible,
......
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