diff options
author | Rui Matos <tiagomatos@gmail.com> | 2015-11-03 17:52:10 +0100 |
---|---|---|
committer | Rui Matos <tiagomatos@gmail.com> | 2016-04-19 18:02:25 +0200 |
commit | 82a247ccf5b7c3cc78127374a8e9bc15d6deab67 (patch) | |
tree | bd04175fe674a3d4034ae68582627e1aced91081 | |
parent | 5d6af70bc92f6acb913e22328b8581151000f526 (diff) | |
download | mutter-82a247ccf5b7c3cc78127374a8e9bc15d6deab67.tar.gz |
keybindings: Keep virtual modifier masks around
Besides the resolved real modifier masks, having the virtual masks
around will be useful too.
https://bugzilla.gnome.org/show_bug.cgi?id=748526
-rw-r--r-- | src/core/keybindings-private.h | 3 | ||||
-rw-r--r-- | src/core/keybindings.c | 17 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/core/keybindings-private.h b/src/core/keybindings-private.h index 793966e5d..5a17c991f 100644 --- a/src/core/keybindings-private.h +++ b/src/core/keybindings-private.h @@ -94,8 +94,11 @@ typedef struct GHashTable *key_bindings_index; xkb_mod_mask_t ignored_modifier_mask; xkb_mod_mask_t hyper_mask; + xkb_mod_mask_t virtual_hyper_mask; xkb_mod_mask_t super_mask; + xkb_mod_mask_t virtual_super_mask; xkb_mod_mask_t meta_mask; + xkb_mod_mask_t virtual_meta_mask; MetaKeyCombo overlay_key_combo; MetaResolvedKeyCombo overlay_resolved_key_combo; gboolean overlay_key_only_pressed; diff --git a/src/core/keybindings.c b/src/core/keybindings.c index a5cb0d745..2a8063eb5 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -185,16 +185,18 @@ reload_modmap (MetaKeyBindingManager *keys) struct xkb_keymap *keymap = meta_backend_get_keymap (backend); struct xkb_state *scratch_state; xkb_mod_mask_t scroll_lock_mask; + xkb_mod_mask_t dummy_mask; /* Modifiers to find. */ struct { const char *name; xkb_mod_mask_t *mask_p; + xkb_mod_mask_t *virtual_mask_p; } mods[] = { - { "ScrollLock", &scroll_lock_mask }, - { "Meta", &keys->meta_mask }, - { "Hyper", &keys->hyper_mask }, - { "Super", &keys->super_mask }, + { "ScrollLock", &scroll_lock_mask, &dummy_mask }, + { "Meta", &keys->meta_mask, &keys->virtual_meta_mask }, + { "Hyper", &keys->hyper_mask, &keys->virtual_hyper_mask }, + { "Super", &keys->super_mask, &keys->virtual_super_mask }, }; scratch_state = xkb_state_new (keymap); @@ -203,6 +205,7 @@ reload_modmap (MetaKeyBindingManager *keys) for (i = 0; i < G_N_ELEMENTS (mods); i++) { xkb_mod_mask_t *mask_p = mods[i].mask_p; + xkb_mod_mask_t *virtual_mask_p = mods[i].virtual_mask_p; xkb_mod_index_t idx = xkb_keymap_mod_get_index (keymap, mods[i].name); if (idx != XKB_MOD_INVALID) @@ -210,9 +213,13 @@ reload_modmap (MetaKeyBindingManager *keys) xkb_mod_mask_t vmodmask = (1 << idx); xkb_state_update_mask (scratch_state, vmodmask, 0, 0, 0, 0, 0); *mask_p = xkb_state_serialize_mods (scratch_state, XKB_STATE_MODS_DEPRESSED) & ~vmodmask; + *virtual_mask_p = vmodmask; } else - *mask_p = 0; + { + *mask_p = 0; + *virtual_mask_p = 0; + } } xkb_state_unref (scratch_state); |