[vlc-commits] xcb: remove mouse events
Rémi Denis-Courmont
git at videolan.org
Mon Nov 28 18:49:26 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Nov 28 19:38:55 2016 +0200| [a62fba042f4adb290dba0af49dfa45a310e80d86] | committer: Rémi Denis-Courmont
xcb: remove mouse events
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a62fba042f4adb290dba0af49dfa45a310e80d86
---
modules/video_output/xcb/events.c | 79 +++++----------------------------------
1 file changed, 10 insertions(+), 69 deletions(-)
diff --git a/modules/video_output/xcb/events.c b/modules/video_output/xcb/events.c
index 6b2bb73..9bde532 100644
--- a/modules/video_output/xcb/events.c
+++ b/modules/video_output/xcb/events.c
@@ -78,26 +78,6 @@ static xcb_connection_t *Connect (vlc_object_t *obj, const char *display)
}
/**
- * (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.
*/
static const xcb_screen_t *FindScreen (vlc_object_t *obj,
@@ -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,
More information about the vlc-commits
mailing list