Commit 3e046d80 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

XCB: follow pointer motion in the parent window

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.
parent a15a7803
......@@ -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 */
......
......@@ -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;
}
......@@ -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,
};
......
......@@ -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);
......
Supports Markdown
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