[vlc-commits] xcb/window: report initial mouse position (refs #24960)

Rémi Denis-Courmont git at videolan.org
Sun Nov 29 18:05:20 CET 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 29 18:52:13 2020 +0200| [473c520b4b412ac91d87365213baefbb9ec95ddd] | committer: Rémi Denis-Courmont

xcb/window: report initial mouse position (refs #24960)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=473c520b4b412ac91d87365213baefbb9ec95ddd
---

 modules/video_output/xcb/window.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index 5e58d10ebf..5b71cbb6d1 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -557,7 +557,20 @@ static int Enable(vout_window_t *wnd, const vout_window_cfg_t *restrict cfg)
 
     /* Make the window visible */
     xcb_map_window(conn, window);
-    xcb_flush(conn);
+
+    /* Report initial pointer position.
+     * This will implicitly flush the XCB connection so that the window gets
+     * mapped by the display server shortly.
+     */
+    xcb_query_pointer_cookie_t qpc = xcb_query_pointer(conn, window);
+    xcb_query_pointer_reply_t *pr = xcb_query_pointer_reply(conn, qpc, NULL);
+
+    if (pr != NULL)
+    {
+        vout_window_ReportMouseMoved(wnd, pr->win_x, pr->win_y);
+        free(pr);
+    }
+
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list