[gtk/keymap-rework-2: 9/19] gtk: Stop using GDK_MODx_MASK



commit 57b58874952369cf4cb8f01199cd7e3a70be5c9a
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Apr 5 09:53:02 2020 -0400

    gtk: Stop using GDK_MODx_MASK
    
    These are never used in practice, and we never want to
    see them in the UI, so stop supporting them. This is
    in preparation for cleaning up GdkModifierType.

 gtk/gtkaccelgroup.c    | 92 --------------------------------------------------
 gtk/gtkshortcutlabel.c |  8 -----
 2 files changed, 100 deletions(-)
---
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 6a1e5a5bec..b9af3b67d2 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -132,17 +132,6 @@ is_ctl (const gchar *string)
           (string[4] == '>'));
 }
 
-static inline gboolean
-is_modx (const gchar *string)
-{
-  return ((string[0] == '<') &&
-          (string[1] == 'm' || string[1] == 'M') &&
-          (string[2] == 'o' || string[2] == 'O') &&
-          (string[3] == 'd' || string[3] == 'D') &&
-          (string[4] >= '1' && string[4] <= '5') &&
-          (string[5] == '>'));
-}
-
 static inline gboolean
 is_ctrl (const gchar *string)
 {
@@ -335,18 +324,6 @@ gtk_accelerator_parse_with_keycode (const gchar     *accelerator,
               len -= 6;
               mods |= GDK_CONTROL_MASK;
             }
-          else if (len >= 6 && is_modx (accelerator))
-            {
-              static const guint mod_vals[] = {
-                GDK_ALT_MASK, GDK_MOD2_MASK, GDK_MOD3_MASK,
-                GDK_MOD4_MASK, GDK_MOD5_MASK
-              };
-
-              len -= 6;
-              accelerator += 4;
-              mods |= mod_vals[*accelerator - '1'];
-              accelerator += 2;
-            }
           else if (len >= 5 && is_ctl (accelerator))
             {
               accelerator += 5;
@@ -599,10 +576,6 @@ gtk_accelerator_name (guint           accelerator_key,
   static const gchar text_shift[] = "<Shift>";
   static const gchar text_control[] = "<Control>";
   static const gchar text_alt[] = "<Alt>";
-  static const gchar text_mod2[] = "<Mod2>";
-  static const gchar text_mod3[] = "<Mod3>";
-  static const gchar text_mod4[] = "<Mod4>";
-  static const gchar text_mod5[] = "<Mod5>";
   static const gchar text_meta[] = "<Meta>";
   static const gchar text_super[] = "<Super>";
   static const gchar text_hyper[] = "<Hyper>";
@@ -630,15 +603,6 @@ gtk_accelerator_name (guint           accelerator_key,
     l += sizeof (text_control) - 1;
   if (accelerator_mods & GDK_ALT_MASK)
     l += sizeof (text_alt) - 1;
-  if (accelerator_mods & GDK_MOD2_MASK)
-    l += sizeof (text_mod2) - 1;
-  if (accelerator_mods & GDK_MOD3_MASK)
-    l += sizeof (text_mod3) - 1;
-  if (accelerator_mods & GDK_MOD4_MASK)
-    l += sizeof (text_mod4) - 1;
-  if (accelerator_mods & GDK_MOD5_MASK)
-    l += sizeof (text_mod5) - 1;
-  l += strlen (keyval_name);
   if (accelerator_mods & GDK_META_MASK)
     l += sizeof (text_meta) - 1;
   if (accelerator_mods & GDK_HYPER_MASK)
@@ -672,26 +636,6 @@ gtk_accelerator_name (guint           accelerator_key,
       strcpy (accelerator + l, text_alt);
       l += sizeof (text_alt) - 1;
     }
-  if (accelerator_mods & GDK_MOD2_MASK)
-    {
-      strcpy (accelerator + l, text_mod2);
-      l += sizeof (text_mod2) - 1;
-    }
-  if (accelerator_mods & GDK_MOD3_MASK)
-    {
-      strcpy (accelerator + l, text_mod3);
-      l += sizeof (text_mod3) - 1;
-    }
-  if (accelerator_mods & GDK_MOD4_MASK)
-    {
-      strcpy (accelerator + l, text_mod4);
-      l += sizeof (text_mod4) - 1;
-    }
-  if (accelerator_mods & GDK_MOD5_MASK)
-    {
-      strcpy (accelerator + l, text_mod5);
-      l += sizeof (text_mod5) - 1;
-    }
   if (accelerator_mods & GDK_META_MASK)
     {
       strcpy (accelerator + l, text_meta);
@@ -964,42 +908,6 @@ gtk_accelerator_print_label (GString        *gstring,
       seen_mod = TRUE;
     }
 
-  if (accelerator_mods & GDK_MOD2_MASK)
-    {
-      if (seen_mod)
-        append_separator (gstring);
-
-      g_string_append (gstring, "Mod2");
-      seen_mod = TRUE;
-    }
-
-  if (accelerator_mods & GDK_MOD3_MASK)
-    {
-      if (seen_mod)
-        append_separator (gstring);
-
-      g_string_append (gstring, "Mod3");
-      seen_mod = TRUE;
-    }
-
-  if (accelerator_mods & GDK_MOD4_MASK)
-    {
-      if (seen_mod)
-        append_separator (gstring);
-
-      g_string_append (gstring, "Mod4");
-      seen_mod = TRUE;
-    }
-
-  if (accelerator_mods & GDK_MOD5_MASK)
-    {
-      if (seen_mod)
-        append_separator (gstring);
-
-      g_string_append (gstring, "Mod5");
-      seen_mod = TRUE;
-    }
-
   if (accelerator_mods & GDK_SUPER_MASK)
     {
       if (seen_mod)
diff --git a/gtk/gtkshortcutlabel.c b/gtk/gtkshortcutlabel.c
index 6062d9db04..5b453edd9d 100644
--- a/gtk/gtkshortcutlabel.c
+++ b/gtk/gtkshortcutlabel.c
@@ -139,14 +139,6 @@ get_labels (guint key, GdkModifierType modifier, guint *n_mods)
     labels[i++] = C_("keyboard label", "Ctrl");
   if (modifier & GDK_ALT_MASK)
     labels[i++] = C_("keyboard label", "Alt");
-  if (modifier & GDK_MOD2_MASK)
-    labels[i++] = "Mod2";
-  if (modifier & GDK_MOD3_MASK)
-    labels[i++] = "Mod3";
-  if (modifier & GDK_MOD4_MASK)
-    labels[i++] = "Mod4";
-  if (modifier & GDK_MOD5_MASK)
-    labels[i++] = "Mod5";
   if (modifier & GDK_SUPER_MASK)
     labels[i++] = C_("keyboard label", "Super");
   if (modifier & GDK_HYPER_MASK)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]