diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2016-09-22 15:33:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-22 15:33:15 +0200 |
commit | 53c1c7ff8f062529bcdceabd62416c6f483ca523 (patch) | |
tree | d60ce4314eaf54d91019d7a4dbba69295de15896 /platform/x11/os_x11.cpp | |
parent | a63167459c6972f3750bf22799897a711e7556ba (diff) | |
parent | 6fcf2b2bd87e16c9cfc55f3c1293797c24124e85 (diff) |
Merge pull request #6584 from Hinsbart/mod_release
x11: Fix event.is_action() for release of modifier keys
Diffstat (limited to 'platform/x11/os_x11.cpp')
-rw-r--r-- | platform/x11/os_x11.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 9a2d610e78..5f1ab5b4aa 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1176,6 +1176,19 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { event.key.mod.shift=true; } + //don't set mod state if modifier keys are released by themselves + //else event.is_action() will not work correctly here + if (!event.key.pressed) { + if (event.key.scancode == KEY_SHIFT) + event.key.mod.shift = false; + else if (event.key.scancode == KEY_CONTROL) + event.key.mod.control = false; + else if (event.key.scancode == KEY_ALT) + event.key.mod.alt = false; + else if (event.key.scancode == KEY_META) + event.key.mod.meta = false; + } + //printf("key: %x\n",event.key.scancode); input->parse_input_event( event); } |