mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
prefs: Track the XKB 'grp:' option in gsettings as a keybinding pref
We'll use the value of this option to establish a passive grab on the keycode/modifier combos generating XK_ISO_Next_Group. https://bugzilla.gnome.org/show_bug.cgi?id=697002
This commit is contained in:
parent
056cc16b82
commit
d664cfcc90
@ -55,6 +55,7 @@
|
|||||||
#define KEY_GNOME_ANIMATIONS "enable-animations"
|
#define KEY_GNOME_ANIMATIONS "enable-animations"
|
||||||
#define KEY_GNOME_CURSOR_THEME "cursor-theme"
|
#define KEY_GNOME_CURSOR_THEME "cursor-theme"
|
||||||
#define KEY_GNOME_CURSOR_SIZE "cursor-size"
|
#define KEY_GNOME_CURSOR_SIZE "cursor-size"
|
||||||
|
#define KEY_XKB_OPTIONS "xkb-options"
|
||||||
|
|
||||||
#define KEY_OVERLAY_KEY "overlay-key"
|
#define KEY_OVERLAY_KEY "overlay-key"
|
||||||
#define KEY_WORKSPACES_ONLY_ON_PRIMARY "workspaces-only-on-primary"
|
#define KEY_WORKSPACES_ONLY_ON_PRIMARY "workspaces-only-on-primary"
|
||||||
@ -65,6 +66,7 @@
|
|||||||
#define SCHEMA_GENERAL "org.gnome.desktop.wm.preferences"
|
#define SCHEMA_GENERAL "org.gnome.desktop.wm.preferences"
|
||||||
#define SCHEMA_MUTTER "org.gnome.mutter"
|
#define SCHEMA_MUTTER "org.gnome.mutter"
|
||||||
#define SCHEMA_INTERFACE "org.gnome.desktop.interface"
|
#define SCHEMA_INTERFACE "org.gnome.desktop.interface"
|
||||||
|
#define SCHEMA_INPUT_SOURCES "org.gnome.desktop.input-sources"
|
||||||
|
|
||||||
#define SETTINGS(s) g_hash_table_lookup (settings_schemas, (s))
|
#define SETTINGS(s) g_hash_table_lookup (settings_schemas, (s))
|
||||||
|
|
||||||
@ -115,6 +117,7 @@ static gboolean workspaces_only_on_primary = FALSE;
|
|||||||
|
|
||||||
static gboolean no_tab_popup = FALSE;
|
static gboolean no_tab_popup = FALSE;
|
||||||
|
|
||||||
|
static char *iso_next_group_option = NULL;
|
||||||
|
|
||||||
static void handle_preference_update_enum (GSettings *settings,
|
static void handle_preference_update_enum (GSettings *settings,
|
||||||
gchar *key);
|
gchar *key);
|
||||||
@ -139,6 +142,7 @@ static gboolean theme_name_handler (GVariant*, gpointer*, gpointer);
|
|||||||
static gboolean mouse_button_mods_handler (GVariant*, gpointer*, gpointer);
|
static gboolean mouse_button_mods_handler (GVariant*, gpointer*, gpointer);
|
||||||
static gboolean button_layout_handler (GVariant*, gpointer*, gpointer);
|
static gboolean button_layout_handler (GVariant*, gpointer*, gpointer);
|
||||||
static gboolean overlay_key_handler (GVariant*, gpointer*, gpointer);
|
static gboolean overlay_key_handler (GVariant*, gpointer*, gpointer);
|
||||||
|
static gboolean iso_next_group_handler (GVariant*, gpointer*, gpointer);
|
||||||
|
|
||||||
static void do_override (char *key, char *schema);
|
static void do_override (char *key, char *schema);
|
||||||
|
|
||||||
@ -451,6 +455,14 @@ static MetaStringArrayPreference preferences_string_array[] =
|
|||||||
NULL,
|
NULL,
|
||||||
&workspace_names,
|
&workspace_names,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
{ KEY_XKB_OPTIONS,
|
||||||
|
SCHEMA_INPUT_SOURCES,
|
||||||
|
META_PREF_KEYBINDINGS,
|
||||||
|
},
|
||||||
|
iso_next_group_handler,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
{ { NULL, 0, 0 }, NULL },
|
{ { NULL, 0, 0 }, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -961,6 +973,11 @@ meta_prefs_init (void)
|
|||||||
G_CALLBACK (settings_changed), NULL);
|
G_CALLBACK (settings_changed), NULL);
|
||||||
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings);
|
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings);
|
||||||
|
|
||||||
|
settings = g_settings_new (SCHEMA_INPUT_SOURCES);
|
||||||
|
g_signal_connect (settings, "changed::" KEY_XKB_OPTIONS,
|
||||||
|
G_CALLBACK (settings_changed), NULL);
|
||||||
|
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INPUT_SOURCES), settings);
|
||||||
|
|
||||||
|
|
||||||
for (tmp = overridden_keys; tmp; tmp = tmp->next)
|
for (tmp = overridden_keys; tmp; tmp = tmp->next)
|
||||||
{
|
{
|
||||||
@ -1652,6 +1669,39 @@ overlay_key_handler (GVariant *value,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
iso_next_group_handler (GVariant *value,
|
||||||
|
gpointer *result,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
const char **xkb_options, **p;
|
||||||
|
const char *option = NULL;
|
||||||
|
gboolean changed = FALSE;
|
||||||
|
|
||||||
|
*result = NULL; /* ignored */
|
||||||
|
xkb_options = g_variant_get_strv (value, NULL);
|
||||||
|
|
||||||
|
for (p = xkb_options; p && *p; ++p)
|
||||||
|
if (g_str_has_prefix (*p, "grp:"))
|
||||||
|
{
|
||||||
|
option = (*p + 4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
changed = (g_strcmp0 (option, iso_next_group_option) != 0);
|
||||||
|
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
|
g_free (iso_next_group_option);
|
||||||
|
iso_next_group_option = g_strdup (option);
|
||||||
|
queue_changed (META_PREF_KEYBINDINGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (xkb_options);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
const PangoFontDescription*
|
const PangoFontDescription*
|
||||||
meta_prefs_get_titlebar_font (void)
|
meta_prefs_get_titlebar_font (void)
|
||||||
{
|
{
|
||||||
@ -2155,6 +2205,12 @@ meta_prefs_get_overlay_binding (MetaKeyCombo *combo)
|
|||||||
*combo = overlay_key_combo;
|
*combo = overlay_key_combo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
meta_prefs_get_iso_next_group_option (void)
|
||||||
|
{
|
||||||
|
return iso_next_group_option;
|
||||||
|
}
|
||||||
|
|
||||||
GDesktopTitlebarAction
|
GDesktopTitlebarAction
|
||||||
meta_prefs_get_action_double_click_titlebar (void)
|
meta_prefs_get_action_double_click_titlebar (void)
|
||||||
{
|
{
|
||||||
|
@ -353,6 +353,7 @@ typedef enum _MetaKeyBindingAction
|
|||||||
META_KEYBINDING_ACTION_MOVE_TO_SIDE_W,
|
META_KEYBINDING_ACTION_MOVE_TO_SIDE_W,
|
||||||
META_KEYBINDING_ACTION_MOVE_TO_CENTER,
|
META_KEYBINDING_ACTION_MOVE_TO_CENTER,
|
||||||
META_KEYBINDING_ACTION_OVERLAY_KEY,
|
META_KEYBINDING_ACTION_OVERLAY_KEY,
|
||||||
|
META_KEYBINDING_ACTION_ISO_NEXT_GROUP,
|
||||||
|
|
||||||
META_KEYBINDING_ACTION_LAST
|
META_KEYBINDING_ACTION_LAST
|
||||||
} MetaKeyBindingAction;
|
} MetaKeyBindingAction;
|
||||||
@ -442,6 +443,7 @@ void meta_prefs_get_window_binding (const char *name,
|
|||||||
MetaVirtualModifier *modifiers);
|
MetaVirtualModifier *modifiers);
|
||||||
|
|
||||||
void meta_prefs_get_overlay_binding (MetaKeyCombo *combo);
|
void meta_prefs_get_overlay_binding (MetaKeyCombo *combo);
|
||||||
|
const char *meta_prefs_get_iso_next_group_option (void);
|
||||||
|
|
||||||
gboolean meta_prefs_get_visual_bell (void);
|
gboolean meta_prefs_get_visual_bell (void);
|
||||||
gboolean meta_prefs_bell_is_audible (void);
|
gboolean meta_prefs_bell_is_audible (void);
|
||||||
|
Loading…
Reference in New Issue
Block a user