[mutter] keybindings: Use a less hacky method of getting the proper modifier mask
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] keybindings: Use a less hacky method of getting the proper modifier mask
- Date: Mon, 18 Aug 2014 19:55:22 +0000 (UTC)
commit 5f7b81eb952ad928ef97a0b511a53d59739cf338
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Aug 18 15:52:22 2014 -0400
keybindings: Use a less hacky method of getting the proper modifier mask
This is the method Ran suggests as a workaround in
https://github.com/xkbcommon/libxkbcommon/pull/10
src/Makefile.am | 2 -
src/core/keybindings.c | 11 ++++-
src/core/xkbcommon-hacks.c | 112 --------------------------------------------
src/core/xkbcommon-hacks.h | 34 -------------
4 files changed, 9 insertions(+), 150 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index a333113..a6606ee 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -153,8 +153,6 @@ libmutter_la_SOURCES = \
meta/gradient.h \
core/meta-gesture-tracker.c \
core/meta-gesture-tracker-private.h \
- core/xkbcommon-hacks.c \
- core/xkbcommon-hacks.h \
core/keybindings.c \
core/keybindings-private.h \
core/main.c \
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 0766eda..ba6a399 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -39,7 +39,6 @@
#include "screen-private.h"
#include <meta/prefs.h>
#include "meta-accel-parse.h"
-#include "xkbcommon-hacks.h"
#include <linux/input.h>
@@ -190,6 +189,7 @@ reload_modmap (MetaKeyBindingManager *keys)
{
MetaBackend *backend = meta_get_backend ();
struct xkb_keymap *keymap = meta_backend_get_keymap (backend);
+ struct xkb_state *scratch_state;
xkb_mod_mask_t scroll_lock_mask;
/* Modifiers to find. */
@@ -203,6 +203,8 @@ reload_modmap (MetaKeyBindingManager *keys)
{ "Super", &keys->super_mask },
};
+ scratch_state = xkb_state_new (keymap);
+
gsize i;
for (i = 0; i < G_N_ELEMENTS (mods); i++)
{
@@ -210,11 +212,16 @@ reload_modmap (MetaKeyBindingManager *keys)
xkb_mod_index_t idx = xkb_keymap_mod_get_index (keymap, mods[i].name);
if (idx != XKB_MOD_INVALID)
- *mask_p = my_xkb_keymap_mod_get_mask (keymap, idx);
+ {
+ xkb_state_update_mask (scratch_state, 1 << idx, 0, 0, 0, 0, 0);
+ *mask_p = xkb_state_serialize_mods (scratch_state, XKB_STATE_MODS_DEPRESSED);
+ }
else
*mask_p = 0;
}
+ xkb_state_unref (scratch_state);
+
keys->ignored_modifier_mask = (scroll_lock_mask | Mod2Mask | LockMask);
meta_topic (META_DEBUG_KEYBINDINGS,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]