mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 12:05:14 -04:00
Fix pressing escape to exit menus on web client not making cursor disappear
This commit is contained in:
parent
ed59099e5c
commit
05798fda7c
@ -457,13 +457,19 @@ static void InputHandler_KeyDown(void* obj, int key, bool was) {
|
|||||||
if (!was && InputHandler_SimulateMouse(key, true)) return;
|
if (!was && InputHandler_SimulateMouse(key, true)) return;
|
||||||
active = Gui_GetActiveScreen();
|
active = Gui_GetActiveScreen();
|
||||||
|
|
||||||
|
#ifndef CC_BUILD_WEB
|
||||||
|
if (key == KEY_ESCAPE && active->Closable) {
|
||||||
|
/* Don't want holding escape to go in and out of pause menu */
|
||||||
|
if (!was) Gui_Close(active);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (InputHandler_IsShutdown(key)) {
|
if (InputHandler_IsShutdown(key)) {
|
||||||
/* TODO: Do we need a separate exit function in Game class? */
|
/* TODO: Do we need a separate exit function in Game class? */
|
||||||
Window_Close(); return;
|
Window_Close(); return;
|
||||||
} else if (key == KeyBinds[KEYBIND_SCREENSHOT] && !was) {
|
} else if (key == KeyBinds[KEYBIND_SCREENSHOT] && !was) {
|
||||||
Game_ScreenshotRequested = true; return;
|
Game_ScreenshotRequested = true; return;
|
||||||
} else if (key == KEY_ESCAPE && active->Closable) {
|
|
||||||
Gui_Close(active);
|
|
||||||
} else if (Elem_HandlesKeyDown(active, key, was)) {
|
} else if (Elem_HandlesKeyDown(active, key, was)) {
|
||||||
return;
|
return;
|
||||||
} else if ((key == KEY_ESCAPE || key == KEY_PAUSE) && !active->HandlesAllInput) {
|
} else if ((key == KEY_ESCAPE || key == KEY_PAUSE) && !active->HandlesAllInput) {
|
||||||
@ -498,6 +504,15 @@ static void InputHandler_KeyUp(void* obj, int key) {
|
|||||||
Game_SetFov(Game_DefaultFov);
|
Game_SetFov(Game_DefaultFov);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CC_BUILD_WEB
|
||||||
|
/* When closing menus (which reacquires mouse focus) in key down, */
|
||||||
|
/* this still leaves the cursor visible. But if this is instead */
|
||||||
|
/* done in key up, the cursor disappears as expected. */
|
||||||
|
if (key == KEY_ESCAPE && active->Closable) {
|
||||||
|
Gui_Close(active); return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
active = Gui_GetActiveScreen();
|
active = Gui_GetActiveScreen();
|
||||||
Elem_HandlesKeyUp(active, key);
|
Elem_HandlesKeyUp(active, key);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user