mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[client] overlay: remember and restore the grab and pointer state
When entering overlay mode if the cursor was previously grabbed we should restore the state when exiting overlay mode. This will also correct the pointer setting it to NONE or SQUARE depending on the prior grab state.
This commit is contained in:
@@ -842,6 +842,8 @@ void app_freeOverlays(void)
|
||||
|
||||
void app_setOverlay(bool enable)
|
||||
{
|
||||
static bool wasGrabbed = false;
|
||||
|
||||
if (g_state.overlayInput == enable)
|
||||
return;
|
||||
|
||||
@@ -850,6 +852,8 @@ void app_setOverlay(bool enable)
|
||||
|
||||
if (g_state.overlayInput)
|
||||
{
|
||||
wasGrabbed = g_cursor.grab;
|
||||
|
||||
g_state.io->ConfigFlags &= ~ImGuiConfigFlags_NoMouse;
|
||||
core_setGrabQuiet(false);
|
||||
core_setCursorInView(false);
|
||||
@@ -858,6 +862,8 @@ void app_setOverlay(bool enable)
|
||||
{
|
||||
g_state.io->ConfigFlags |= ImGuiConfigFlags_NoMouse;
|
||||
core_resetOverlayInputState();
|
||||
core_setGrabQuiet(wasGrabbed);
|
||||
app_invalidateWindow();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user