[gtk/keymap-rework-2: 13/18] gdk: Remove gdk_keymap_get_modifier_mask



commit d1ea6bb3ea8f1ab60005c54b96b68a3ee5cfd566
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Apr 5 20:41:26 2020 -0400

    gdk: Remove gdk_keymap_get_modifier_mask
    
    This function is no longer public and no longer used.

 gdk/gdkkeys.c               | 64 ---------------------------------------------
 gdk/gdkkeysprivate.h        |  4 ---
 gdk/gdktypes.h              | 40 ----------------------------
 gdk/quartz/gdkkeys-quartz.c | 35 -------------------------
 gdk/x11/gdkkeys-x11.c       | 14 ----------
 5 files changed, 157 deletions(-)
---
diff --git a/gdk/gdkkeys.c b/gdk/gdkkeys.c
index 7b4878d18e..1fed1045ea 100644
--- a/gdk/gdkkeys.c
+++ b/gdk/gdkkeys.c
@@ -111,9 +111,6 @@ enum {
 static GParamSpec *props[LAST_PROP] = { NULL, };
 static guint signals[LAST_SIGNAL] = { 0 };
 
-static GdkModifierType gdk_keymap_real_get_modifier_mask (GdkKeymap         *keymap,
-                                                          GdkModifierIntent  intent);
-
 G_DEFINE_TYPE (GdkKeymap, gdk_keymap, G_TYPE_OBJECT)
 
 static void
@@ -161,8 +158,6 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
   object_class->get_property = gdk_keymap_get_property;
   object_class->set_property = gdk_keymap_set_property;
 
-  klass->get_modifier_mask = gdk_keymap_real_get_modifier_mask;
-
   props[PROP_DISPLAY] =
     g_param_spec_object ("display",
                          "Display",
@@ -615,65 +610,6 @@ gdk_keymap_translate_keyboard_state (GdkKeymap       *keymap,
                                                                  consumed_modifiers);
 }
 
-static GdkModifierType
-gdk_keymap_real_get_modifier_mask (GdkKeymap         *keymap,
-                                   GdkModifierIntent  intent)
-{
-  switch (intent)
-    {
-    case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
-      return GDK_CONTROL_MASK;
-
-    case GDK_MODIFIER_INTENT_CONTEXT_MENU:
-      return 0;
-
-    case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
-      return GDK_SHIFT_MASK;
-
-    case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
-      return GDK_CONTROL_MASK;
-
-    case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
-      return GDK_ALT_MASK | GDK_CONTROL_MASK;
-
-    case GDK_MODIFIER_INTENT_SHIFT_GROUP:
-      return 0;
-
-    case GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK:
-      return (GDK_SHIFT_MASK   | GDK_CONTROL_MASK | GDK_ALT_MASK    |
-             GDK_SUPER_MASK   | GDK_HYPER_MASK   | GDK_META_MASK);
-
-    default:
-      g_return_val_if_reached (0);
-    }
-}
-
-/**
- * gdk_keymap_get_modifier_mask:
- * @keymap: a #GdkKeymap
- * @intent: the use case for the modifier mask
- *
- * Returns the modifier mask the @keymap’s windowing system backend
- * uses for a particular purpose.
- *
- * Note that this function always returns real hardware modifiers, not
- * virtual ones (e.g. it will return #GDK_ALT_MASK rather than
- * #GDK_META_MASK if the backend maps MOD1 to META), so there are use
- * cases where the return value of this function has to be transformed
- * by gdk_keymap_add_virtual_modifiers() in order to contain the
- * expected result.
- *
- * Returns: the modifier mask used for @intent.
- **/
-GdkModifierType
-gdk_keymap_get_modifier_mask (GdkKeymap         *keymap,
-                              GdkModifierIntent  intent)
-{
-  g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0);
-
-  return GDK_KEYMAP_GET_CLASS (keymap)->get_modifier_mask (keymap, intent);
-}
-
 #include "gdkkeynames.c"
 
 /**
diff --git a/gdk/gdkkeysprivate.h b/gdk/gdkkeysprivate.h
index 24b473b698..c7cf7424b6 100644
--- a/gdk/gdkkeysprivate.h
+++ b/gdk/gdkkeysprivate.h
@@ -60,8 +60,6 @@ struct _GdkKeymapClass
                                          gint            *effective_group,
                                          gint            *level,
                                          GdkModifierType *consumed_modifiers);
-  GdkModifierType (*get_modifier_mask)  (GdkKeymap         *keymap,
-                                         GdkModifierIntent  intent);
   guint (* get_modifier_state)          (GdkKeymap *keymap);
 
 
@@ -107,8 +105,6 @@ gboolean       gdk_keymap_get_caps_lock_state      (GdkKeymap           *keymap)
 gboolean       gdk_keymap_get_num_lock_state       (GdkKeymap           *keymap);
 gboolean       gdk_keymap_get_scroll_lock_state    (GdkKeymap           *keymap);
 guint          gdk_keymap_get_modifier_state       (GdkKeymap           *keymap);
-GdkModifierType gdk_keymap_get_modifier_mask       (GdkKeymap           *keymap,
-                                                    GdkModifierIntent    intent);
 
 G_END_DECLS
 
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 9061d1dd33..9e8a7997fa 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -246,46 +246,6 @@ typedef enum
                            GDK_ALT_MASK|GDK_SUPER_MASK|GDK_HYPER_MASK|GDK_META_MASK| \
                            GDK_BUTTON1_MASK|GDK_BUTTON2_MASK|GDK_BUTTON3_MASK| \
                            GDK_BUTTON4_MASK|GDK_BUTTON5_MASK)
-/**
- * GdkModifierIntent:
- * @GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR: the primary modifier used to invoke
- *  menu accelerators.
- * @GDK_MODIFIER_INTENT_CONTEXT_MENU: the modifier used to invoke context menus.
- *  Note that mouse button 3 always triggers context menus. When this modifier
- *  is not 0, it additionally triggers context menus when used with mouse button 1.
- * @GDK_MODIFIER_INTENT_EXTEND_SELECTION: the modifier used to extend selections
- *  using `modifier`-click or `modifier`-cursor-key
- * @GDK_MODIFIER_INTENT_MODIFY_SELECTION: the modifier used to modify selections,
- *  which in most cases means toggling the clicked item into or out of the selection.
- * @GDK_MODIFIER_INTENT_NO_TEXT_INPUT: when any of these modifiers is pressed, the
- *  key event cannot produce a symbol directly. This is meant to be used for
- *  input methods, and for use cases like typeahead search.
- * @GDK_MODIFIER_INTENT_SHIFT_GROUP: the modifier that switches between keyboard
- *  groups (AltGr on X11/Windows and Option/Alt on OS X).
- * @GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK: The set of modifier masks accepted
- * as modifiers in accelerators. Needed because Command is mapped to MOD2 on
- * OSX, which is widely used, but on X11 MOD2 is NumLock and using that for a
- * mod key is problematic at best.
- * Ref: https://bugzilla.gnome.org/show_bug.cgi?id=736125.
- *
- * This enum is used with gdk_keymap_get_modifier_mask()
- * in order to determine what modifiers the
- * currently used windowing system backend uses for particular
- * purposes. For example, on X11/Windows, the Control key is used for
- * invoking menu shortcuts (accelerators), whereas on Apple computers
- * it’s the Command key (which correspond to %GDK_CONTROL_MASK and
- * %GDK_MOD2_MASK, respectively).
- **/
-typedef enum
-{
-  GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR,
-  GDK_MODIFIER_INTENT_CONTEXT_MENU,
-  GDK_MODIFIER_INTENT_EXTEND_SELECTION,
-  GDK_MODIFIER_INTENT_MODIFY_SELECTION,
-  GDK_MODIFIER_INTENT_NO_TEXT_INPUT,
-  GDK_MODIFIER_INTENT_SHIFT_GROUP,
-  GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK,
-} GdkModifierIntent;
 
 /**
  * GdkEventMask:
diff --git a/gdk/quartz/gdkkeys-quartz.c b/gdk/quartz/gdkkeys-quartz.c
index 6237d0d0cc..baa86144cd 100644
--- a/gdk/quartz/gdkkeys-quartz.c
+++ b/gdk/quartz/gdkkeys-quartz.c
@@ -735,40 +735,6 @@ gdk_quartz_keymap_map_virtual_modifiers (GdkKeymap       *keymap,
   return TRUE;
 }
 
-static GdkModifierType
-gdk_quartz_keymap_get_modifier_mask (GdkKeymap         *keymap,
-                                     GdkModifierIntent  intent)
-{
-  switch (intent)
-    {
-    case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
-      return GDK_MOD2_MASK;
-
-    case GDK_MODIFIER_INTENT_CONTEXT_MENU:
-      return GDK_CONTROL_MASK;
-
-    case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
-      return GDK_SHIFT_MASK;
-
-    case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
-      return GDK_MOD2_MASK;
-
-    case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
-      return GDK_MOD2_MASK | GDK_CONTROL_MASK;
-
-    case GDK_MODIFIER_INTENT_SHIFT_GROUP:
-      return GDK_ALT_MASK;
-
-    case GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK:
-      return (GDK_SHIFT_MASK   | GDK_CONTROL_MASK | GDK_ALT_MASK    |
-             GDK_MOD2_MASK    | GDK_SUPER_MASK   | GDK_HYPER_MASK   |
-             GDK_META_MASK);
-
-    default:
-      g_return_val_if_reached (0);
-    }
-}
-
 /* What sort of key event is this? Returns one of
  * GDK_KEY_PRESS, GDK_KEY_RELEASE, GDK_NOTHING (should be ignored)
  */
@@ -881,5 +847,4 @@ gdk_quartz_keymap_class_init (GdkQuartzKeymapClass *klass)
   keymap_class->translate_keyboard_state = gdk_quartz_keymap_translate_keyboard_state;
   keymap_class->add_virtual_modifiers = gdk_quartz_keymap_add_virtual_modifiers;
   keymap_class->map_virtual_modifiers = gdk_quartz_keymap_map_virtual_modifiers;
-  keymap_class->get_modifier_mask = gdk_quartz_keymap_get_modifier_mask;
 }
diff --git a/gdk/x11/gdkkeys-x11.c b/gdk/x11/gdkkeys-x11.c
index 9901e82866..1276c00eb7 100644
--- a/gdk/x11/gdkkeys-x11.c
+++ b/gdk/x11/gdkkeys-x11.c
@@ -1524,19 +1524,6 @@ gdk_x11_keymap_key_is_modifier (GdkKeymap *keymap,
   return FALSE;
 }
 
-static GdkModifierType
-gdk_x11_keymap_get_modifier_mask (GdkKeymap         *keymap,
-                                  GdkModifierIntent  intent)
-{
-  GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (keymap);
-
-  if (intent == GDK_MODIFIER_INTENT_SHIFT_GROUP)
-    return keymap_x11->group_switch_mask;
-
-  return GDK_KEYMAP_CLASS (gdk_x11_keymap_parent_class)->get_modifier_mask (keymap,
-                                                                            intent);
-}
-
 static void
 gdk_x11_keymap_class_init (GdkX11KeymapClass *klass)
 {
@@ -1555,5 +1542,4 @@ gdk_x11_keymap_class_init (GdkX11KeymapClass *klass)
   keymap_class->get_entries_for_keycode = gdk_x11_keymap_get_entries_for_keycode;
   keymap_class->lookup_key = gdk_x11_keymap_lookup_key;
   keymap_class->translate_keyboard_state = gdk_x11_keymap_translate_keyboard_state;
-  keymap_class->get_modifier_mask = gdk_x11_keymap_get_modifier_mask;
 }


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