mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 04:26:52 -04:00
Avoid requesting pointer lock then exiting pointer lock when pressing escape to open pause menu
This should further reduce chance where cursor gets stuck down
This commit is contained in:
parent
273473c922
commit
5245c317ee
10
src/Window.c
10
src/Window.c
@ -3212,8 +3212,6 @@ static int MapNativeKey(int k) {
|
||||
|
||||
static EM_BOOL OnKey(int type, const EmscriptenKeyboardEvent* ev, void* data) {
|
||||
int key = MapNativeKey(ev->keyCode);
|
||||
DeferredEnableRawMouse();
|
||||
if (!key) return false;
|
||||
|
||||
if (ev->location == DOM_KEY_LOCATION_RIGHT) {
|
||||
switch (key) {
|
||||
@ -3222,13 +3220,17 @@ static EM_BOOL OnKey(int type, const EmscriptenKeyboardEvent* ev , void* data) {
|
||||
case KEY_LSHIFT: key = KEY_RSHIFT; break;
|
||||
case KEY_LWIN: key = KEY_RWIN; break;
|
||||
}
|
||||
} else if (ev->location == DOM_KEY_LOCATION_NUMPAD) {
|
||||
}
|
||||
else if (ev->location == DOM_KEY_LOCATION_NUMPAD) {
|
||||
switch (key) {
|
||||
case KEY_ENTER: key = KEY_KP_ENTER; break;
|
||||
}
|
||||
}
|
||||
|
||||
Input_SetPressed(key, type == EMSCRIPTEN_EVENT_KEYDOWN);
|
||||
if (key) Input_SetPressed(key, type == EMSCRIPTEN_EVENT_KEYDOWN);
|
||||
DeferredEnableRawMouse();
|
||||
|
||||
if (!key) return false;
|
||||
/* KeyUp always intercepted */
|
||||
if (type != EMSCRIPTEN_EVENT_KEYDOWN) return true;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user