[Bf-blender-cvs] [b80c073] master: Fix T47300: SHIFT TAB, CTRL SHIFT TAB shortcuts does not toggle snap, snap mode on off anymore.

Bastien Montagne noreply at git.blender.org
Tue Feb 2 21:30:20 CET 2016


Commit: b80c07321ba9611b19557d245c67f6933b80ec95
Author: Bastien Montagne
Date:   Tue Feb 2 21:27:33 2016 +0100
Branches: master
https://developer.blender.org/rBb80c07321ba9611b19557d245c67f6933b80ec95

Fix T47300: SHIFT TAB, CTRL SHIFT TAB shortcuts does not toggle snap, snap mode on off anymore.

Regression from rB12c71508c2d7.

Now, we systematically first try keycode from `XLookupKeysym()`, and only fall back to
the one from `XLookupString()` if it failed to convert to a valid gkey.

===================================================================

M	intern/ghost/intern/GHOST_SystemX11.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index f90ff81..beb8ab5 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -765,7 +765,8 @@ GHOST_SystemX11::processEvent(XEvent *xe)
 		case KeyRelease:
 		{
 			XKeyEvent *xke = &(xe->xkey);
-			KeySym key_sym = 0;
+			KeySym key_sym;
+			KeySym key_sym_str;
 			char ascii;
 #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
 			/* utf8_array[] is initial buffer used for Xutf8LookupString().
@@ -810,18 +811,20 @@ GHOST_SystemX11::processEvent(XEvent *xe)
             if ((xke->keycode >= 10 && xke->keycode < 20)) {
                 key_sym = XLookupKeysym(xke, ShiftMask);
                 if (!((key_sym >= XK_0) && (key_sym <= XK_9))) {
-                    key_sym = XLookupKeysym(xke, 0);
-                }
-                if (!((key_sym >= XK_0) && (key_sym <= XK_9))) {
-                    key_sym = 0;  /* Get current-keymap valid key_sym. */
+					key_sym = XLookupKeysym(xke, 0);
                 }
             }
+			else {
+				key_sym = XLookupKeysym(xke, 0);
+			}
 
-            if (!XLookupString(xke, &ascii, 1, (key_sym == 0) ? &key_sym : NULL, NULL)) {
+            if (!XLookupString(xke, &ascii, 1, &key_sym_str, NULL)) {
                 ascii = '\0';
             }
 
-			gkey = convertXKey(key_sym);
+			if ((gkey = convertXKey(key_sym)) == GHOST_kKeyUnknown) {
+				gkey = convertXKey(key_sym_str);
+			}
 #else
 			/* In keyboards like latin ones,
 			 * numbers needs a 'Shift' to be accessed but key_sym




More information about the Bf-blender-cvs mailing list