[mutter/bilelmoussaoui/gdk-x11-only: 77/77] core: Replace MetaVirtualModifier




commit b1e33f8c3ee2864b47c210e98376fbf808ca200f
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Fri May 27 16:03:43 2022 +0200

    core: Replace MetaVirtualModifier
    
    By making all the types uses ClutterModifierType instead.

 src/core/keybindings-private.h    |  2 +-
 src/core/keybindings.c            | 26 +++++++++++++-------------
 src/core/meta-accel-parse.c       | 34 +++++++++++++++++-----------------
 src/core/meta-accel-parse.h       |  2 +-
 src/core/meta-pad-action-mapper.c | 10 +++++-----
 src/core/prefs.c                  |  6 +++---
 src/meta/common.h                 | 30 ------------------------------
 src/meta/keybindings.h            |  2 +-
 src/meta/prefs.h                  |  2 +-
 9 files changed, 42 insertions(+), 72 deletions(-)
---
diff --git a/src/core/keybindings-private.h b/src/core/keybindings-private.h
index 56792c200a..36599c0808 100644
--- a/src/core/keybindings-private.h
+++ b/src/core/keybindings-private.h
@@ -60,7 +60,7 @@ struct _MetaKeyCombo
 {
   unsigned int keysym;
   unsigned int keycode;
-  MetaVirtualModifier modifiers;
+  ClutterModifierType modifiers;
 };
 
 struct _MetaKeyBinding
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 975e68897a..8e92955e2e 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -152,7 +152,7 @@ meta_key_binding_get_name (MetaKeyBinding *binding)
   return binding->name;
 }
 
-MetaVirtualModifier
+ClutterModifierType
 meta_key_binding_get_modifiers (MetaKeyBinding *binding)
 {
   return binding->combo.modifiers;
@@ -540,30 +540,30 @@ reload_iso_next_group_combos (MetaKeyBindingManager *keys)
 
 static void
 devirtualize_modifiers (MetaKeyBindingManager *keys,
-                        MetaVirtualModifier    modifiers,
+                        ClutterModifierType    modifiers,
                         unsigned int          *mask)
 {
   *mask = 0;
 
-  if (modifiers & META_VIRTUAL_SHIFT_MASK)
+  if (modifiers & CLUTTER_SHIFT_MASK)
     *mask |= ShiftMask;
-  if (modifiers & META_VIRTUAL_CONTROL_MASK)
+  if (modifiers & CLUTTER_CONTROL_MASK)
     *mask |= ControlMask;
-  if (modifiers & META_VIRTUAL_ALT_MASK)
+  if (modifiers & CLUTTER_MOD1_MASK)
     *mask |= Mod1Mask;
-  if (modifiers & META_VIRTUAL_META_MASK)
+  if (modifiers & CLUTTER_META_MASK)
     *mask |= keys->meta_mask;
-  if (modifiers & META_VIRTUAL_HYPER_MASK)
+  if (modifiers & CLUTTER_HYPER_MASK)
     *mask |= keys->hyper_mask;
-  if (modifiers & META_VIRTUAL_SUPER_MASK)
+  if (modifiers & CLUTTER_SUPER_MASK)
     *mask |= keys->super_mask;
-  if (modifiers & META_VIRTUAL_MOD2_MASK)
+  if (modifiers & CLUTTER_MOD2_MASK)
     *mask |= Mod2Mask;
-  if (modifiers & META_VIRTUAL_MOD3_MASK)
+  if (modifiers & CLUTTER_MOD3_MASK)
     *mask |= Mod3Mask;
-  if (modifiers & META_VIRTUAL_MOD4_MASK)
+  if (modifiers & CLUTTER_MOD4_MASK)
     *mask |= Mod4Mask;
-  if (modifiers & META_VIRTUAL_MOD5_MASK)
+  if (modifiers & CLUTTER_MOD5_MASK)
     *mask |= Mod5Mask;
 }
 
@@ -1300,7 +1300,7 @@ static void
 update_window_grab_modifiers (MetaDisplay *display)
 {
   MetaKeyBindingManager *keys = &display->key_binding_manager;
-  MetaVirtualModifier virtual_mods;
+  ClutterModifierType virtual_mods;
   unsigned int mods;
 
   virtual_mods = meta_prefs_get_mouse_button_mods ();
diff --git a/src/core/meta-accel-parse.c b/src/core/meta-accel-parse.c
index c0a5fa4a28..b9651ac658 100644
--- a/src/core/meta-accel-parse.c
+++ b/src/core/meta-accel-parse.c
@@ -179,7 +179,7 @@ accelerator_parse (const gchar         *accelerator,
                    MetaKeyCombo        *combo)
 {
   guint keyval, keycode;
-  MetaVirtualModifier mods;
+  ClutterModifierType mods;
   gint len;
 
   combo->keysym = 0;
@@ -202,40 +202,40 @@ accelerator_parse (const gchar         *accelerator,
               /* Primary is treated the same as Control */
               accelerator += 9;
               len -= 9;
-              mods |= META_VIRTUAL_CONTROL_MASK;
+              mods |= CLUTTER_CONTROL_MASK;
             }
           else if (len >= 9 && is_control (accelerator))
             {
               accelerator += 9;
               len -= 9;
-              mods |= META_VIRTUAL_CONTROL_MASK;
+              mods |= CLUTTER_CONTROL_MASK;
             }
           else if (len >= 7 && is_shift (accelerator))
             {
               accelerator += 7;
               len -= 7;
-              mods |= META_VIRTUAL_SHIFT_MASK;
+              mods |= CLUTTER_SHIFT_MASK;
             }
           else if (len >= 6 && is_shft (accelerator))
             {
               accelerator += 6;
               len -= 6;
-              mods |= META_VIRTUAL_SHIFT_MASK;
+              mods |= CLUTTER_SHIFT_MASK;
             }
           else if (len >= 6 && is_ctrl (accelerator))
             {
               accelerator += 6;
               len -= 6;
-              mods |= META_VIRTUAL_CONTROL_MASK;
+              mods |= CLUTTER_CONTROL_MASK;
             }
           else if (len >= 6 && is_modx (accelerator))
             {
               static const guint mod_vals[] = {
-                META_VIRTUAL_ALT_MASK,
-                META_VIRTUAL_MOD2_MASK,
-                META_VIRTUAL_MOD3_MASK,
-                META_VIRTUAL_MOD4_MASK,
-                META_VIRTUAL_MOD5_MASK,
+                CLUTTER_MOD1_MASK,
+                CLUTTER_MOD2_MASK,
+                CLUTTER_MOD3_MASK,
+                CLUTTER_MOD4_MASK,
+                CLUTTER_MOD5_MASK,
               };
 
               len -= 6;
@@ -247,31 +247,31 @@ accelerator_parse (const gchar         *accelerator,
             {
               accelerator += 5;
               len -= 5;
-              mods |= META_VIRTUAL_CONTROL_MASK;
+              mods |= CLUTTER_CONTROL_MASK;
             }
           else if (len >= 5 && is_alt (accelerator))
             {
               accelerator += 5;
               len -= 5;
-              mods |= META_VIRTUAL_ALT_MASK;
+              mods |= CLUTTER_MOD1_MASK;
             }
           else if (len >= 6 && is_meta (accelerator))
             {
               accelerator += 6;
               len -= 6;
-              mods |= META_VIRTUAL_META_MASK;
+              mods |= CLUTTER_META_MASK;
             }
           else if (len >= 7 && is_hyper (accelerator))
             {
               accelerator += 7;
               len -= 7;
-              mods |= META_VIRTUAL_HYPER_MASK;
+              mods |= CLUTTER_HYPER_MASK;
             }
           else if (len >= 7 && is_super (accelerator))
             {
               accelerator += 7;
               len -= 7;
-              mods |= META_VIRTUAL_SUPER_MASK;
+              mods |= CLUTTER_SUPER_MASK;
             }
           else
             {
@@ -340,7 +340,7 @@ meta_parse_accelerator (const char   *accel,
 
 gboolean
 meta_parse_modifier (const char          *accel,
-                     MetaVirtualModifier *mask)
+                     ClutterModifierType *mask)
 {
   MetaKeyCombo combo = { 0 };
 
diff --git a/src/core/meta-accel-parse.h b/src/core/meta-accel-parse.h
index 6c323f3be4..bd0d38ce6a 100644
--- a/src/core/meta-accel-parse.h
+++ b/src/core/meta-accel-parse.h
@@ -39,7 +39,7 @@ typedef struct _MetaKeyCombo MetaKeyCombo;
 gboolean meta_parse_accelerator (const char   *accel,
                                  MetaKeyCombo *combo);
 gboolean meta_parse_modifier    (const char          *accel,
-                                 MetaVirtualModifier *mask);
+                                 ClutterModifierType *mask);
 
 META_EXPORT
 char * meta_accelerator_name    (ClutterModifierType accelerator_mods,
diff --git a/src/core/meta-pad-action-mapper.c b/src/core/meta-pad-action-mapper.c
index 3366cb3dfb..95360735c2 100644
--- a/src/core/meta-pad-action-mapper.c
+++ b/src/core/meta-pad-action-mapper.c
@@ -450,17 +450,17 @@ meta_pad_action_mapper_is_button_grabbed (MetaPadActionMapper *mapper,
 
 static void
 emulate_modifiers (ClutterVirtualInputDevice *device,
-                   MetaVirtualModifier        mods,
+                   ClutterModifierType        mods,
                    ClutterKeyState            state)
 {
   guint i;
   struct {
-    MetaVirtualModifier mod;
+    ClutterModifierType mod;
     guint keyval;
   } mod_map[] = {
-    { META_VIRTUAL_SHIFT_MASK, CLUTTER_KEY_Shift_L },
-    { META_VIRTUAL_CONTROL_MASK, CLUTTER_KEY_Control_L },
-    { META_VIRTUAL_META_MASK, CLUTTER_KEY_Meta_L }
+    { CLUTTER_SHIFT_MASK, CLUTTER_KEY_Shift_L },
+    { CLUTTER_CONTROL_MASK, CLUTTER_KEY_Control_L },
+    { CLUTTER_META_MASK, CLUTTER_KEY_Meta_L }
   };
 
   for (i = 0; i < G_N_ELEMENTS (mod_map); i++)
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 536d9dd579..82bf58d8c1 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -80,7 +80,7 @@ static GHashTable *settings_schemas;
 
 static gboolean use_system_font = FALSE;
 static PangoFontDescription *titlebar_font = NULL;
-static MetaVirtualModifier mouse_button_mods = Mod1Mask;
+static ClutterModifierType mouse_button_mods = CLUTTER_MOD1_MASK;
 static MetaKeyCombo overlay_key_combo = { 0, 0, 0 };
 static MetaKeyCombo locate_pointer_key_combo = { 0, 0, 0 };
 static GDesktopFocusMode focus_mode = G_DESKTOP_FOCUS_MODE_CLICK;
@@ -1162,7 +1162,7 @@ maybe_give_disable_workarounds_warning (void)
     }
 }
 
-MetaVirtualModifier
+ClutterModifierType
 meta_prefs_get_mouse_button_mods  (void)
 {
   return mouse_button_mods;
@@ -1278,7 +1278,7 @@ mouse_button_mods_handler (GVariant *value,
                            gpointer *result,
                            gpointer  data)
 {
-  MetaVirtualModifier mods;
+  ClutterModifierType mods;
   const gchar *string_value;
 
   *result = NULL; /* ignored */
diff --git a/src/meta/common.h b/src/meta/common.h
index d1f5caddd3..97ac244f39 100644
--- a/src/meta/common.h
+++ b/src/meta/common.h
@@ -249,36 +249,6 @@ typedef enum
   META_FRAME_TYPE_LAST
 } MetaFrameType;
 
-/**
- * MetaVirtualModifier:
- * @META_VIRTUAL_SHIFT_MASK: Shift mask
- * @META_VIRTUAL_CONTROL_MASK: Control mask
- * @META_VIRTUAL_ALT_MASK: Alt mask
- * @META_VIRTUAL_META_MASK: Meta mask
- * @META_VIRTUAL_SUPER_MASK: Super mask
- * @META_VIRTUAL_HYPER_MASK: Hyper mask
- * @META_VIRTUAL_MOD2_MASK: Mod2 mask
- * @META_VIRTUAL_MOD3_MASK: Mod3 mask
- * @META_VIRTUAL_MOD4_MASK: Mod4 mask
- * @META_VIRTUAL_MOD5_MASK: Mod5 mask
- */
-typedef enum
-{
-  /* Create gratuitous divergence from regular
-   * X mod bits, to be sure we find bugs
-   */
-  META_VIRTUAL_SHIFT_MASK    = 1 << 5,
-  META_VIRTUAL_CONTROL_MASK  = 1 << 6,
-  META_VIRTUAL_ALT_MASK      = 1 << 7,
-  META_VIRTUAL_META_MASK     = 1 << 8,
-  META_VIRTUAL_SUPER_MASK    = 1 << 9,
-  META_VIRTUAL_HYPER_MASK    = 1 << 10,
-  META_VIRTUAL_MOD2_MASK     = 1 << 11,
-  META_VIRTUAL_MOD3_MASK     = 1 << 12,
-  META_VIRTUAL_MOD4_MASK     = 1 << 13,
-  META_VIRTUAL_MOD5_MASK     = 1 << 14
-} MetaVirtualModifier;
-
 /**
  * MetaDirection:
  * @META_DIRECTION_LEFT: Left
diff --git a/src/meta/keybindings.h b/src/meta/keybindings.h
index ac1cee5b3a..3782c0b40d 100644
--- a/src/meta/keybindings.h
+++ b/src/meta/keybindings.h
@@ -27,7 +27,7 @@ META_EXPORT
 const char          *meta_key_binding_get_name      (MetaKeyBinding *binding);
 
 META_EXPORT
-MetaVirtualModifier  meta_key_binding_get_modifiers (MetaKeyBinding *binding);
+ClutterModifierType  meta_key_binding_get_modifiers (MetaKeyBinding *binding);
 
 META_EXPORT
 guint                meta_key_binding_get_mask      (MetaKeyBinding *binding);
diff --git a/src/meta/prefs.h b/src/meta/prefs.h
index 227de68bf2..f1c9e58053 100644
--- a/src/meta/prefs.h
+++ b/src/meta/prefs.h
@@ -123,7 +123,7 @@ META_EXPORT
 const char* meta_preference_to_string (MetaPreference pref);
 
 META_EXPORT
-MetaVirtualModifier         meta_prefs_get_mouse_button_mods  (void);
+ClutterModifierType         meta_prefs_get_mouse_button_mods  (void);
 
 META_EXPORT
 gint                        meta_prefs_get_mouse_button_resize (void);


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