core: Replace MetaVirtualModifier

By making all the types uses ClutterModifierType instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
This commit is contained in:
Bilal Elmoussaoui 2022-05-27 16:03:43 +02:00
parent 8b42bc77dc
commit d1d2496c99
8 changed files with 50 additions and 50 deletions

View File

@ -61,7 +61,7 @@ struct _MetaKeyCombo
{
unsigned int keysym;
unsigned int keycode;
MetaVirtualModifier modifiers;
ClutterModifierType modifiers;
};
struct _MetaKeyBinding

View File

@ -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 ();

View File

@ -180,7 +180,7 @@ accelerator_parse (const gchar *accelerator,
MetaKeyCombo *combo)
{
guint keyval, keycode;
MetaVirtualModifier mods;
ClutterModifierType mods;
gint len;
combo->keysym = 0;
@ -203,40 +203,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;
@ -248,31 +248,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
{
@ -294,16 +294,16 @@ accelerator_parse (const gchar *accelerator,
keycode = strtoul (accelerator, NULL, 16);
goto out;
}
else if (strcmp (accelerator, "Above_Tab") == 0)
else if (strcmp (accelerator, "Above_Tab") == 0)
{
keyval = META_KEY_ABOVE_TAB;
goto out;
}
else
{
{
keyval = xkb_keysym_from_name (accelerator, XKB_KEYSYM_CASE_INSENSITIVE);
if (keyval == XKB_KEY_NoSymbol)
{
if (keyval == XKB_KEY_NoSymbol)
{
char *with_xf86 = g_strconcat ("XF86", accelerator, NULL);
keyval = xkb_keysym_from_name (with_xf86, XKB_KEYSYM_CASE_INSENSITIVE);
g_free (with_xf86);
@ -311,14 +311,14 @@ accelerator_parse (const gchar *accelerator,
if (keyval == XKB_KEY_NoSymbol)
return FALSE;
}
}
}
accelerator += len;
len -= len;
}
}
out:
out:
combo->keysym = keyval;
combo->keycode = keycode;
combo->modifiers = mods;
@ -341,7 +341,7 @@ meta_parse_accelerator (const char *accel,
gboolean
meta_parse_modifier (const char *accel,
MetaVirtualModifier *mask)
ClutterModifierType *mask)
{
MetaKeyCombo combo = { 0 };
@ -363,9 +363,9 @@ meta_parse_modifier (const char *accel,
* meta_accelerator_name:
* @accelerator_mods: Accelerator modifier mask.
* @accelerator_key: Accelerator keyval.
*
*
* Convert an accelerator keyval and modifier mask into a string parsable by `meta_parse_accelerator`.
*
*
* Returns: The accelerator name.
*/
char *

View File

@ -39,6 +39,6 @@ typedef struct _MetaKeyCombo MetaKeyCombo;
gboolean meta_parse_accelerator (const char *accel,
MetaKeyCombo *combo);
gboolean meta_parse_modifier (const char *accel,
MetaVirtualModifier *mask);
ClutterModifierType *mask);
#endif /* META_ACCEL_PARSE_H */

View File

@ -466,17 +466,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++)

View File

@ -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 */

View File

@ -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);

View File

@ -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);