]> Pileus Git - ~andy/gtk/blobdiff - gdk/x11/gdkkeys-x11.c
Try harder to discriminate Shift-F10 and F10
[~andy/gtk] / gdk / x11 / gdkkeys-x11.c
index ac8e401ebf742aff70910a3360048236e16851b2..9d06cbaeafce0bb0734750c4f626b8cb4c7a134d 100644 (file)
@@ -1113,6 +1113,8 @@ MyEnhancedXkbTranslateKeyCode(register XkbDescPtr     xkb,
         int found = 0;
 
         for (i=0,entry=type->map;i<type->map_count;i++,entry++) {
+            if (!entry->active)
+              continue;
             if (mods_rtrn) {
                 int bits = 0;
                 unsigned long tmp = entry->mods.mask;
@@ -1123,14 +1125,22 @@ MyEnhancedXkbTranslateKeyCode(register XkbDescPtr     xkb,
                 }
                 /* We always add one-modifiers levels to mods_rtrn since
                  * they can't wipe out bits in the state unless the
-                 * level would be triggered. But return other modifiers
-                 *
+                 * level would be triggered. But not if they don't change
+                 * the symbol (otherwise we can't discriminate Shift-F10
+                 * and F10 anymore). And don't add modifiers that are
+                 * explicitly marked as preserved, either.
                  */
-                if (bits == 1 || (mods&type->mods.mask)==entry->mods.mask)
-                    *mods_rtrn |= entry->mods.mask;
+                if ((bits == 1 && syms[col+entry->level] != syms[col]) ||
+                    (mods&type->mods.mask) == entry->mods.mask)
+                  {
+                    if (type->preserve)
+                      *mods_rtrn |= (entry->mods.mask & ~type->preserve[i].mask);
+                    else
+                      *mods_rtrn |= entry->mods.mask;
+                  }
             }
 
-            if (!found&&entry->active&&((mods&type->mods.mask)==entry->mods.mask)) {
+            if (!found&&((mods&type->mods.mask)==entry->mods.mask)) {
                 col+= entry->level;
                 if (type->preserve)
                     preserve= type->preserve[i].mask;