From 165c2c356688465b6f4f2df58593a3eb37ed6f3b Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 16 Jan 2021 21:32:38 +1100 Subject: [PATCH] [client] mouse: grab the pointer when entering capture mode if needed If the platform doesn't support warp then the move handler will never grab the pointer, as such we need to unconditionally grab it in `setGrabQuiet` --- client/src/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/src/main.c b/client/src/main.c index 43f68d17..0018d5e4 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1229,6 +1229,11 @@ static void setGrabQuiet(bool enable) g_cursor.acc.x = 0.0; g_cursor.acc.y = 0.0; + /* if the display server does not support warp we need to grab the pointer + * here instead of in the move handler */ + bool warpSupport = true; + app_getProp(LG_DS_WARP_SUPPORT, &warpSupport); + if (enable) { if (!g_cursor.inView) @@ -1236,6 +1241,10 @@ static void setGrabQuiet(bool enable) if (params.grabKeyboard) g_state.ds->grabKeyboard(); + + if (!warpSupport) + g_state.ds->grabPointer(); + } else { @@ -1244,6 +1253,9 @@ static void setGrabQuiet(bool enable) if (!g_state.focused || !params.grabKeyboardOnFocus) g_state.ds->ungrabKeyboard(); } + + if (!warpSupport) + g_state.ds->ungrabPointer(); } // if exiting capture when input on capture only, we want to show the cursor