mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-26 00:26:32 +00:00
[client] app: allow overlay exit with KEY_ESC
This commit is contained in:
parent
f49948506b
commit
fcbd255e99
@ -84,6 +84,7 @@ void app_glSwapBuffers(void);
|
|||||||
|
|
||||||
#define MAX_OVERLAY_RECTS 10
|
#define MAX_OVERLAY_RECTS 10
|
||||||
void app_registerOverlay(const struct LG_OverlayOps * ops, void * params);
|
void app_registerOverlay(const struct LG_OverlayOps * ops, void * params);
|
||||||
|
void app_setOverlay(bool enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* render the overlay
|
* render the overlay
|
||||||
|
@ -313,6 +313,9 @@ void app_handleKeyPress(int sc)
|
|||||||
|
|
||||||
if (g_state.overlayInput)
|
if (g_state.overlayInput)
|
||||||
{
|
{
|
||||||
|
if (sc == KEY_ESC)
|
||||||
|
app_setOverlay(false);
|
||||||
|
else
|
||||||
g_state.io->KeysDown[sc] = true;
|
g_state.io->KeysDown[sc] = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -797,3 +800,24 @@ void app_freeOverlays(void)
|
|||||||
free(overlay);
|
free(overlay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void app_setOverlay(bool enable)
|
||||||
|
{
|
||||||
|
if (g_state.overlayInput == enable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_state.overlayInput = enable;
|
||||||
|
g_state.cursorLast = -2;
|
||||||
|
|
||||||
|
if (g_state.overlayInput)
|
||||||
|
{
|
||||||
|
g_state.io->ConfigFlags &= ~ImGuiConfigFlags_NoMouse;
|
||||||
|
core_setGrabQuiet(false);
|
||||||
|
core_setCursorInView(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_state.io->ConfigFlags |= ImGuiConfigFlags_NoMouse;
|
||||||
|
core_resetOverlayInputState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -135,16 +135,7 @@ static void bind_passthrough(int sc, void * opaque)
|
|||||||
|
|
||||||
static void bind_toggleOverlay(int sc, void * opaque)
|
static void bind_toggleOverlay(int sc, void * opaque)
|
||||||
{
|
{
|
||||||
g_state.overlayInput ^= true;
|
app_setOverlay(!g_state.overlayInput);
|
||||||
g_state.cursorLast = -2;
|
|
||||||
if (g_state.overlayInput)
|
|
||||||
{
|
|
||||||
g_state.io->ConfigFlags &= ~ImGuiConfigFlags_NoMouse;
|
|
||||||
core_setGrabQuiet(false);
|
|
||||||
core_setCursorInView(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
g_state.io->ConfigFlags |= ImGuiConfigFlags_NoMouse;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void keybind_register(void)
|
void keybind_register(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user