← easystroke

Improve shortcut recording

e745ff8f716ee6a4f6ae1083d5ea63dba4cda87c · Thomas Jaeger · Apr 21, 2010 00:32

What we do depends on whether or not any modifiers besides Shift are
pressed:
 * If there are, we translate the Keycode to a Keysym, bypassing gtk.
   This way we don't get things like Alt+Shift+!, causing problems
   when the layout is changed
 * If there aren't, we let gtk translate the Keycode to a Keysym,
   removing Shift if we're dealing with a Keysym that can't be
   converted to lower case (essentially the old behavior).

Fixes https://sourceforge.net/tracker/?func=detail&atid=1078454&aid=2989485&group_id=229797

+8 −3 · 1 file changed

  • actions.cc +8 −3
diff --git a/actions.cc b/actions.cc
index db1ed5c..543eae0 100644
--- a/actions.cc
+++ b/actions.cc
@@ -88,10 +88,15 @@ protected:
 			case GDK_Hyper_R:
 				return true;
 		}
-		guint key = gdk_keyval_to_lower(event->keyval);
 		guint mods = event->state & gtk_accelerator_get_default_mod_mask();
-		if (key == event->keyval)
-			mods &= ~GDK_Shift_L & ~GDK_Shift_R;
+		guint key;
+		if (mods & ~GDK_SHIFT_MASK) {
+			key = XKeycodeToKeysym(dpy, event->hardware_keycode, 0);
+		} else {
+			key = gdk_keyval_to_lower(event->keyval);
+			if (key == event->keyval)
+				mods = 0;
+		}
 
 		editing_done();
 		remove_widget();