XCB: follow pointer motion in the parent window
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 28 Oct 2009 19:03:11 +0000 (21:03 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 28 Oct 2009 19:03:11 +0000 (21:03 +0200)
This ensures events are delivered when the mouse moves outside the
rendering area but within the embedding drawable. This is necessary to
autonatically unhide the cursor. As a side effect, we need to adjust
the pointer coordinates.

modules/video_output/xcb/common.c
modules/video_output/xcb/events.c
modules/video_output/xcb/x11.c
modules/video_output/xcb/xvideo.c

index 80e6958..77ddd01 100644 (file)
@@ -126,7 +126,8 @@ vout_window_t *GetWindow (vout_display_t *vd,
         free (geo);
 
         /* Subscribe to parent window resize events */
-        uint32_t value = XCB_EVENT_MASK_STRUCTURE_NOTIFY;
+        uint32_t value = XCB_EVENT_MASK_POINTER_MOTION
+                       | XCB_EVENT_MASK_STRUCTURE_NOTIFY;
         xcb_change_window_attributes (conn, wnd->handle.xid,
                                       XCB_CW_EVENT_MASK, &value);
         /* Try to subscribe to click events */
index 87197e5..1542279 100644 (file)
@@ -64,9 +64,9 @@ static void HandleMotionNotify (vout_display_t *vd,
         return;
 
     const int x = vd->source.i_x_offset +
-        (int64_t)(ev->event_x -0*place.x) * vd->source.i_visible_width / place.width;
+        (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 -0*place.y) * vd->source.i_visible_height/ place.height;
+        (int64_t)(ev->event_y - place.y) * vd->source.i_visible_height/ place.height;
 
     /* TODO show the cursor ? */
     if (x >= vd->source.i_x_offset && x < vd->source.i_x_offset + vd->source.i_visible_width &&
@@ -153,6 +153,3 @@ int ManageEvent (vout_display_t *vd, xcb_connection_t *conn, bool *visible)
 
     return VLC_SUCCESS;
 }
-
-
-
index 68e5214..116a396 100644 (file)
@@ -257,7 +257,7 @@ static int Open (vlc_object_t *obj)
         const uint32_t values[] = {
             /* XCB_CW_EVENT_MASK */
             XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
-            XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_VISIBILITY_CHANGE,
+            XCB_EVENT_MASK_VISIBILITY_CHANGE,
             /* XCB_CW_COLORMAP */
             cmap,
         };
index d2cb1ca..316635f 100644 (file)
@@ -447,7 +447,7 @@ static int Open (vlc_object_t *obj)
         const uint32_t mask =
             /* XCB_CW_EVENT_MASK */
             XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
-            XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_VISIBILITY_CHANGE;
+            XCB_EVENT_MASK_VISIBILITY_CHANGE;
         xcb_void_cookie_t c;
         xcb_window_t window = xcb_generate_id (conn);