[client] mouse: do not grab the pointer if the platform has no warp

Platforms such as Wayland have no abillity to warp the cursor, as such
can not operate in an always relative mode. This property allows
platforms to report the lack of warp support and prevent LG from
grabbing the pointer.
This commit is contained in:
Geoffrey McRae
2021-01-16 21:17:35 +11:00
parent cebc728a67
commit 701dfd5694
2 changed files with 27 additions and 4 deletions

View File

@@ -915,6 +915,11 @@ static void setCursorInView(bool enable)
if (enable && !g_state.focused)
return;
/* if the display server does not support warp, then we can not operate in
* always relative mode and we should not grab the pointer */
bool warpSupport = true;
app_getProp(LG_DS_WARP_SUPPORT, &warpSupport);
g_cursor.inView = enable;
g_cursor.draw = params.alwaysShowCursor ? true : enable;
g_cursor.redraw = true;
@@ -926,14 +931,16 @@ static void setCursorInView(bool enable)
if (params.hideMouse)
SDL_ShowCursor(SDL_DISABLE);
g_state.ds->grabPointer();
if (warpSupport)
g_state.ds->grabPointer();
}
else
{
if (params.hideMouse)
SDL_ShowCursor(SDL_ENABLE);
g_state.ds->ungrabPointer();
if (warpSupport)
g_state.ds->ungrabPointer();
}
}