[client] overlay: add modal message dialog support

This commit is contained in:
Geoffrey McRae
2022-01-08 15:37:44 +11:00
parent 0080e5f1b9
commit 780cf5f362
11 changed files with 267 additions and 52 deletions

View File

@@ -166,7 +166,7 @@ void core_setGrabQuiet(bool enable)
bool core_warpPointer(int x, int y, bool exiting)
{
if ((!g_cursor.inWindow && !exiting) ||
g_state.overlayInput ||
app_isOverlayMode() ||
g_cursor.warpState == WARP_STATE_OFF)
return false;
@@ -376,7 +376,7 @@ void core_handleGuestMouseUpdate(void)
if (!util_guestCurToLocal(&localPos))
return;
if (g_state.overlayInput || !g_cursor.inView)
if (app_isOverlayMode() || !g_cursor.inView)
return;
g_state.ds->guestPointerUpdated(
@@ -624,3 +624,34 @@ void core_resetOverlayInputState(void)
for(int key = 0; key < ARRAY_LENGTH(g_state.io->KeysDown); key++)
g_state.io->KeysDown[key] = false;
}
void core_updateOverlayState(void)
{
static bool lastState = false;
bool currentState = app_isOverlayMode();
if (lastState == currentState)
return;
lastState = currentState;
g_state.cursorLast = -2;
static bool wasGrabbed = false;
if (app_isOverlayMode())
{
wasGrabbed = g_cursor.grab;
g_state.io->ConfigFlags &= ~ImGuiConfigFlags_NoMouse;
g_state.io->MousePos = (ImVec2) { g_cursor.pos.x, g_cursor.pos.y };
core_setGrabQuiet(false);
core_setCursorInView(false);
}
else
{
g_state.io->ConfigFlags |= ImGuiConfigFlags_NoMouse;
core_resetOverlayInputState();
core_setGrabQuiet(wasGrabbed);
core_invalidatePointer(true);
app_invalidateWindow(false);
}
}