keybindings: Do not grab the locate-pointer key if unnecessary
On X11, mutter needs to keep a grab on the locate-pointer key to be able to trigger the functionality time the corresponding key combo is pressed. However, doing so may have side effects on other X11 clients that would want to have a grab on the same key. Make sure we only actually grab the key combo for "locate-pointer" only when the feature is actually enabled, so that having the locate pointer feature turned off (the default) would not cause side effects on other X11 clients that might want to use the same key for their own use. Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/647
This commit is contained in:

committed by
Carlos Garnacho

parent
9c8ff5dbe8
commit
ac5d9ec558
@ -60,6 +60,7 @@
|
||||
|
||||
#define KEY_OVERLAY_KEY "overlay-key"
|
||||
#define KEY_WORKSPACES_ONLY_ON_PRIMARY "workspaces-only-on-primary"
|
||||
#define KEY_LOCATE_POINTER "locate-pointer"
|
||||
|
||||
/* These are the different schemas we are keeping
|
||||
* a GSettings instance for */
|
||||
@ -100,6 +101,7 @@ static gboolean bell_is_visible = FALSE;
|
||||
static gboolean bell_is_audible = TRUE;
|
||||
static gboolean gnome_accessibility = FALSE;
|
||||
static gboolean gnome_animations = TRUE;
|
||||
static gboolean locate_pointer_is_enabled = FALSE;
|
||||
static char *cursor_theme = NULL;
|
||||
/* cursor_size will, when running as an X11 compositing window manager, be the
|
||||
* actual cursor size, multiplied with the global window scaling factor. On
|
||||
@ -147,6 +149,7 @@ static gboolean mouse_button_mods_handler (GVariant*, gpointer*, gpointer);
|
||||
static gboolean button_layout_handler (GVariant*, gpointer*, gpointer);
|
||||
static gboolean overlay_key_handler (GVariant*, gpointer*, gpointer);
|
||||
static gboolean locate_pointer_key_handler (GVariant*, gpointer*, gpointer);
|
||||
|
||||
static gboolean iso_next_group_handler (GVariant*, gpointer*, gpointer);
|
||||
|
||||
static void init_bindings (void);
|
||||
@ -384,6 +387,13 @@ static MetaBoolPreference preferences_bool[] =
|
||||
},
|
||||
&auto_maximize,
|
||||
},
|
||||
{
|
||||
{ KEY_LOCATE_POINTER,
|
||||
SCHEMA_INTERFACE,
|
||||
META_PREF_LOCATE_POINTER,
|
||||
},
|
||||
&locate_pointer_is_enabled,
|
||||
},
|
||||
{ { NULL, 0, 0 }, NULL },
|
||||
};
|
||||
|
||||
@ -960,6 +970,8 @@ meta_prefs_init (void)
|
||||
G_CALLBACK (settings_changed), NULL);
|
||||
g_signal_connect (settings, "changed::" KEY_GNOME_CURSOR_SIZE,
|
||||
G_CALLBACK (settings_changed), NULL);
|
||||
g_signal_connect (settings, "changed::" KEY_LOCATE_POINTER,
|
||||
G_CALLBACK (settings_changed), NULL);
|
||||
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings);
|
||||
|
||||
settings = g_settings_new (SCHEMA_INPUT_SOURCES);
|
||||
@ -1680,6 +1692,9 @@ meta_preference_to_string (MetaPreference pref)
|
||||
|
||||
case META_PREF_AUTO_MAXIMIZE:
|
||||
return "AUTO_MAXIMIZE";
|
||||
|
||||
case META_PREF_LOCATE_POINTER:
|
||||
return "LOCATE_POINTER";
|
||||
}
|
||||
|
||||
return "(unknown)";
|
||||
@ -2020,6 +2035,12 @@ meta_prefs_get_locate_pointer_binding (MetaKeyCombo *combo)
|
||||
*combo = locate_pointer_key_combo;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_prefs_is_locate_pointer_enabled (void)
|
||||
{
|
||||
return locate_pointer_is_enabled;
|
||||
}
|
||||
|
||||
const char *
|
||||
meta_prefs_get_iso_next_group_option (void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user