mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 22:31:46 +00:00
[client] imgui: improved overlay input handling
1. Overlay always releases confines. 2. Overlay turns off mouse sync with guest.
This commit is contained in:
parent
d9a3b6523c
commit
c991de7ccd
2 changed files with 13 additions and 10 deletions
|
@ -241,7 +241,6 @@ void app_handleButtonPress(int button)
|
|||
int igButton = mapSpiceToImGuiButton(button);
|
||||
if (igButton != -1)
|
||||
g_state.io->MouseDown[igButton] = true;
|
||||
if (g_state.io->WantCaptureMouse)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -261,7 +260,6 @@ void app_handleButtonRelease(int button)
|
|||
int igButton = mapSpiceToImGuiButton(button);
|
||||
if (igButton != -1)
|
||||
g_state.io->MouseDown[igButton] = false;
|
||||
if (g_state.io->WantCaptureMouse)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -291,7 +289,6 @@ void app_handleKeyPress(int sc)
|
|||
if (g_state.overlayInput)
|
||||
{
|
||||
g_state.io->KeysDown[sc] = true;
|
||||
if (g_state.io->WantCaptureKeyboard)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -323,7 +320,7 @@ void app_handleKeyRelease(int sc)
|
|||
{
|
||||
if (g_state.escapeAction == -1)
|
||||
{
|
||||
if (!g_state.escapeHelp && g_params.useSpiceInput)
|
||||
if (!g_state.escapeHelp && g_params.useSpiceInput && !g_state.overlayInput)
|
||||
core_setGrab(!g_cursor.grab);
|
||||
}
|
||||
else
|
||||
|
@ -346,7 +343,6 @@ void app_handleKeyRelease(int sc)
|
|||
if (g_state.overlayInput)
|
||||
{
|
||||
g_state.io->KeysDown[sc] = false;
|
||||
if (g_state.io->WantCaptureKeyboard)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -373,6 +369,9 @@ void app_handleKeyRelease(int sc)
|
|||
void app_handleMouseRelative(double normx, double normy,
|
||||
double rawx, double rawy)
|
||||
{
|
||||
if (g_state.overlayInput)
|
||||
return;
|
||||
|
||||
if (g_cursor.grab)
|
||||
{
|
||||
if (g_params.rawMouse)
|
||||
|
@ -392,7 +391,7 @@ void app_handleMouseRelative(double normx, double normy,
|
|||
void app_handleMouseBasic()
|
||||
{
|
||||
/* do not pass mouse events to the guest if we do not have focus */
|
||||
if (!g_cursor.guest.valid || !g_state.haveSrcSize || !g_state.focused)
|
||||
if (!g_cursor.guest.valid || !g_state.haveSrcSize || !g_state.focused || g_state.overlayInput)
|
||||
return;
|
||||
|
||||
if (!core_inputEnabled())
|
||||
|
|
|
@ -137,7 +137,11 @@ static void bind_toggleOverlay(int sc, void * opaque)
|
|||
{
|
||||
g_state.overlayInput ^= true;
|
||||
if (g_state.overlayInput)
|
||||
{
|
||||
g_state.io->ConfigFlags &= ~ImGuiConfigFlags_NoMouse;
|
||||
core_setGrabQuiet(false);
|
||||
core_setCursorInView(false);
|
||||
}
|
||||
else
|
||||
g_state.io->ConfigFlags |= ImGuiConfigFlags_NoMouse;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue