mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 13:37:22 +00:00
[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:
parent
cebc728a67
commit
701dfd5694
@ -38,7 +38,19 @@ LG_ClipboardData;
|
|||||||
|
|
||||||
typedef enum LG_DSProperty
|
typedef enum LG_DSProperty
|
||||||
{
|
{
|
||||||
LG_DS_MAX_MULTISAMPLE // data type is `int`
|
/**
|
||||||
|
* returns the maximum number of samples supported
|
||||||
|
* if not implemented LG assumes no multisample support
|
||||||
|
* return data type: int
|
||||||
|
*/
|
||||||
|
LG_DS_MAX_MULTISAMPLE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns if the platform is warp capable
|
||||||
|
* if not implemented LG assumes that the platform is warp capable
|
||||||
|
* return data type: bool
|
||||||
|
*/
|
||||||
|
LG_DS_WARP_SUPPORT,
|
||||||
}
|
}
|
||||||
LG_DSProperty;
|
LG_DSProperty;
|
||||||
|
|
||||||
@ -64,7 +76,11 @@ struct LG_DisplayServerOps
|
|||||||
/* final free */
|
/* final free */
|
||||||
void (*free)();
|
void (*free)();
|
||||||
|
|
||||||
/* return a system specific property, returns false if unsupported or failure */
|
/*
|
||||||
|
* return a system specific property, returns false if unsupported or failure
|
||||||
|
* if the platform does not support/implement the requested property the value
|
||||||
|
* of `ret` must not be altered.
|
||||||
|
*/
|
||||||
bool (*getProp)(LG_DSProperty prop, void * ret);
|
bool (*getProp)(LG_DSProperty prop, void * ret);
|
||||||
|
|
||||||
/* event filter, return true if the event has been handled */
|
/* event filter, return true if the event has been handled */
|
||||||
|
@ -915,6 +915,11 @@ static void setCursorInView(bool enable)
|
|||||||
if (enable && !g_state.focused)
|
if (enable && !g_state.focused)
|
||||||
return;
|
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.inView = enable;
|
||||||
g_cursor.draw = params.alwaysShowCursor ? true : enable;
|
g_cursor.draw = params.alwaysShowCursor ? true : enable;
|
||||||
g_cursor.redraw = true;
|
g_cursor.redraw = true;
|
||||||
@ -926,6 +931,7 @@ static void setCursorInView(bool enable)
|
|||||||
if (params.hideMouse)
|
if (params.hideMouse)
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
|
||||||
|
if (warpSupport)
|
||||||
g_state.ds->grabPointer();
|
g_state.ds->grabPointer();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -933,6 +939,7 @@ static void setCursorInView(bool enable)
|
|||||||
if (params.hideMouse)
|
if (params.hideMouse)
|
||||||
SDL_ShowCursor(SDL_ENABLE);
|
SDL_ShowCursor(SDL_ENABLE);
|
||||||
|
|
||||||
|
if (warpSupport)
|
||||||
g_state.ds->ungrabPointer();
|
g_state.ds->ungrabPointer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user