Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-11-16 11:56:38 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-11-16 11:56:38 +0300
commite385bdb228acd3a4c64a886e6fee39f5fcb3cebf (patch)
tree40a843c04d2c55a5c3cd91776b6449039d87993c
parente5b788bad8bcb526fba273915290ef3abc9b24d2 (diff)
Fix a bug in the T34039 hack in case when a modifier key is not mapped.
In order to recover from a transient Focus Out - Focus In disruption in the middle of a shortcut, which can be caused by certain window managers, Blender has code that checks which modifier keys are pressed after Focus In and restores the modifier state based on that. If one of the Ctrl, Shift, Alt, Super keys is not mapped anywhere in the active keyboard layout, XKeysymToKeycode returns the invalid zero keycode, and reading the key state produces garbage, which can cause an invalid modifier state. Check the return value to avoid this.
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 1ca412fbccc..cb2a04a8a87 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -700,7 +700,7 @@ bool GHOST_SystemX11::processEvents(bool waitForEvent)
for (int i = 0; i < (sizeof(modifiers) / sizeof(*modifiers)); i++) {
KeyCode kc = XKeysymToKeycode(m_display, modifiers[i]);
- if (((xevent.xkeymap.key_vector[kc >> 3] >> (kc & 7)) & 1) != 0) {
+ if (kc != 0 && ((xevent.xkeymap.key_vector[kc >> 3] >> (kc & 7)) & 1) != 0) {
pushEvent(new GHOST_EventKey(getMilliSeconds(),
GHOST_kEventKeyDown,
window,