|
|
2c033f |
From e85d651ca9469b328c352373f668101f701f13ea Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
2c033f |
Date: Tue, 5 May 2015 22:40:13 +0200
|
|
|
2c033f |
Subject: [PATCH 01/16] Revert "accel-parse: Use libxkbcommon for keysym
|
|
|
2c033f |
parsing"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit e70f336a0970ca9e971218746560af0a2a7fee97.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/meta-accel-parse.c | 8 ++++----
|
|
|
2c033f |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/meta-accel-parse.c b/src/core/meta-accel-parse.c
|
|
|
2c033f |
index f4c5ee0..25d00d9 100644
|
|
|
2c033f |
--- a/src/core/meta-accel-parse.c
|
|
|
2c033f |
+++ b/src/core/meta-accel-parse.c
|
|
|
2c033f |
@@ -26,7 +26,7 @@
|
|
|
2c033f |
|
|
|
2c033f |
#include "meta-accel-parse.h"
|
|
|
2c033f |
|
|
|
2c033f |
-#include <xkbcommon/xkbcommon.h>
|
|
|
2c033f |
+#include <gtk/gtk.h>
|
|
|
2c033f |
#include <string.h>
|
|
|
2c033f |
#include <stdlib.h>
|
|
|
2c033f |
|
|
|
2c033f |
@@ -306,8 +306,8 @@ accelerator_parse (const gchar *accelerator,
|
|
|
2c033f |
}
|
|
|
2c033f |
else
|
|
|
2c033f |
{
|
|
|
2c033f |
- keyval = xkb_keysym_from_name (accelerator, XKB_KEYSYM_CASE_INSENSITIVE);
|
|
|
2c033f |
- if (keyval == XKB_KEY_NoSymbol)
|
|
|
2c033f |
+ keyval = gdk_keyval_from_name (accelerator);
|
|
|
2c033f |
+ if (keyval == GDK_KEY_VoidSymbol)
|
|
|
2c033f |
{
|
|
|
2c033f |
char *with_xf86 = g_strconcat ("XF86", accelerator, NULL);
|
|
|
2c033f |
keyval = xkb_keysym_from_name (with_xf86, XKB_KEYSYM_CASE_INSENSITIVE);
|
|
|
2c033f |
@@ -331,7 +331,7 @@ out:
|
|
|
2c033f |
return FALSE;
|
|
|
2c033f |
|
|
|
2c033f |
if (accelerator_key)
|
|
|
2c033f |
- *accelerator_key = keyval;
|
|
|
2c033f |
+ *accelerator_key = gdk_keyval_to_lower (keyval);
|
|
|
2c033f |
if (accelerator_keycode)
|
|
|
2c033f |
*accelerator_keycode = keycode;
|
|
|
2c033f |
if (accelerator_mods)
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From 978393bae8ff406608c6e5220ad188cbc2495215 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
2c033f |
Date: Tue, 5 May 2015 23:02:14 +0200
|
|
|
2c033f |
Subject: [PATCH 02/16] meta-accel-parse: Use GDK instead of xkb
|
|
|
2c033f |
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/meta-accel-parse.c | 4 ++--
|
|
|
2c033f |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/meta-accel-parse.c b/src/core/meta-accel-parse.c
|
|
|
2c033f |
index 25d00d9..22178b9 100644
|
|
|
2c033f |
--- a/src/core/meta-accel-parse.c
|
|
|
2c033f |
+++ b/src/core/meta-accel-parse.c
|
|
|
2c033f |
@@ -310,10 +310,10 @@ accelerator_parse (const gchar *accelerator,
|
|
|
2c033f |
if (keyval == GDK_KEY_VoidSymbol)
|
|
|
2c033f |
{
|
|
|
2c033f |
char *with_xf86 = g_strconcat ("XF86", accelerator, NULL);
|
|
|
2c033f |
- keyval = xkb_keysym_from_name (with_xf86, XKB_KEYSYM_CASE_INSENSITIVE);
|
|
|
2c033f |
+ keyval = gdk_keyval_from_name (with_xf86);
|
|
|
2c033f |
g_free (with_xf86);
|
|
|
2c033f |
|
|
|
2c033f |
- if (keyval == XKB_KEY_NoSymbol)
|
|
|
2c033f |
+ if (keyval == GDK_KEY_VoidSymbol)
|
|
|
2c033f |
{
|
|
|
2c033f |
error = TRUE;
|
|
|
2c033f |
goto out;
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From 8d8d7f19870ab188a71056f190902a2d4c763c85 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Wed, 5 Nov 2014 18:01:49 +0100
|
|
|
2c033f |
Subject: [PATCH 03/16] Revert "keybindings: Do a breadth first search in our
|
|
|
2c033f |
keysym to keycode code"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit 60c22b62366d737f7f6eabe7d46fa682c6f400d7.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/keybindings-private.h | 2 --
|
|
|
2c033f |
src/core/keybindings.c | 71 +++++++++++++-----------------------------
|
|
|
2c033f |
2 files changed, 21 insertions(+), 52 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/keybindings-private.h b/src/core/keybindings-private.h
|
|
|
2c033f |
index 359aeff..aadb294 100644
|
|
|
2c033f |
--- a/src/core/keybindings-private.h
|
|
|
2c033f |
+++ b/src/core/keybindings-private.h
|
|
|
2c033f |
@@ -101,8 +101,6 @@ typedef struct
|
|
|
2c033f |
MetaKeyCombo *iso_next_group_combos;
|
|
|
2c033f |
int n_iso_next_group_combos;
|
|
|
2c033f |
|
|
|
2c033f |
- xkb_level_index_t keymap_num_levels;
|
|
|
2c033f |
-
|
|
|
2c033f |
/* Alt+click button grabs */
|
|
|
2c033f |
ClutterModifierType window_grab_modifiers;
|
|
|
2c033f |
} MetaKeyBindingManager;
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index cdc6556..9c03bef 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -240,19 +240,29 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
|
|
|
2c033f |
static gboolean
|
|
|
2c033f |
is_keycode_for_keysym (struct xkb_keymap *keymap,
|
|
|
2c033f |
- xkb_layout_index_t layout,
|
|
|
2c033f |
- xkb_level_index_t level,
|
|
|
2c033f |
xkb_keycode_t keycode,
|
|
|
2c033f |
xkb_keysym_t keysym)
|
|
|
2c033f |
{
|
|
|
2c033f |
- const xkb_keysym_t *syms;
|
|
|
2c033f |
- int num_syms, k;
|
|
|
2c033f |
+ xkb_layout_index_t num_layouts, i;
|
|
|
2c033f |
|
|
|
2c033f |
- num_syms = xkb_keymap_key_get_syms_by_level (keymap, keycode, layout, level, &syms);
|
|
|
2c033f |
- for (k = 0; k < num_syms; k++)
|
|
|
2c033f |
+ num_layouts = xkb_keymap_num_layouts_for_key (keymap, keycode);
|
|
|
2c033f |
+ for (i = 0; i < num_layouts; i++)
|
|
|
2c033f |
{
|
|
|
2c033f |
- if (syms[k] == keysym)
|
|
|
2c033f |
- return TRUE;
|
|
|
2c033f |
+ xkb_level_index_t num_levels, j;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ num_levels = xkb_keymap_num_levels_for_key (keymap, keycode, i);
|
|
|
2c033f |
+ for (j = 0; j < num_levels; j++)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ const xkb_keysym_t *syms;
|
|
|
2c033f |
+ int num_syms, k;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ num_syms = xkb_keymap_key_get_syms_by_level (keymap, keycode, i, j, &syms);
|
|
|
2c033f |
+ for (k = 0; k < num_syms; k++)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ if (syms[k] == keysym)
|
|
|
2c033f |
+ return TRUE;
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+ }
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
return FALSE;
|
|
|
2c033f |
@@ -262,8 +272,6 @@ typedef struct
|
|
|
2c033f |
{
|
|
|
2c033f |
GArray *keycodes;
|
|
|
2c033f |
xkb_keysym_t keysym;
|
|
|
2c033f |
- xkb_layout_index_t layout;
|
|
|
2c033f |
- xkb_level_index_t level;
|
|
|
2c033f |
} FindKeysymData;
|
|
|
2c033f |
|
|
|
2c033f |
static void
|
|
|
2c033f |
@@ -274,10 +282,8 @@ get_keycodes_for_keysym_iter (struct xkb_keymap *keymap,
|
|
|
2c033f |
FindKeysymData *search_data = data;
|
|
|
2c033f |
GArray *keycodes = search_data->keycodes;
|
|
|
2c033f |
xkb_keysym_t keysym = search_data->keysym;
|
|
|
2c033f |
- xkb_layout_index_t layout = search_data->layout;
|
|
|
2c033f |
- xkb_level_index_t level = search_data->level;
|
|
|
2c033f |
|
|
|
2c033f |
- if (is_keycode_for_keysym (keymap, layout, level, keycode, keysym))
|
|
|
2c033f |
+ if (is_keycode_for_keysym (keymap, keycode, keysym))
|
|
|
2c033f |
g_array_append_val (keycodes, keycode);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
@@ -305,15 +311,8 @@ get_keycodes_for_keysym (MetaKeyBindingManager *keys,
|
|
|
2c033f |
{
|
|
|
2c033f |
MetaBackend *backend = meta_get_backend ();
|
|
|
2c033f |
struct xkb_keymap *keymap = meta_backend_get_keymap (backend);
|
|
|
2c033f |
- xkb_layout_index_t i;
|
|
|
2c033f |
- xkb_level_index_t j;
|
|
|
2c033f |
-
|
|
|
2c033f |
- for (i = 0; i < xkb_keymap_num_layouts (keymap); i++)
|
|
|
2c033f |
- for (j = 0; j < keys->keymap_num_levels; j++)
|
|
|
2c033f |
- {
|
|
|
2c033f |
- FindKeysymData search_data = { retval, keysym, i, j };
|
|
|
2c033f |
- xkb_keymap_key_for_each (keymap, get_keycodes_for_keysym_iter, &search_data);
|
|
|
2c033f |
- }
|
|
|
2c033f |
+ FindKeysymData search_data = { retval, keysym };
|
|
|
2c033f |
+ xkb_keymap_key_for_each (keymap, get_keycodes_for_keysym_iter, &search_data);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
out:
|
|
|
2c033f |
@@ -342,32 +341,6 @@ get_first_keycode_for_keysym (MetaKeyBindingManager *keys,
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
static void
|
|
|
2c033f |
-determine_keymap_num_levels_iter (struct xkb_keymap *keymap,
|
|
|
2c033f |
- xkb_keycode_t keycode,
|
|
|
2c033f |
- void *data)
|
|
|
2c033f |
-{
|
|
|
2c033f |
- xkb_level_index_t *num_levels = data;
|
|
|
2c033f |
- xkb_layout_index_t i;
|
|
|
2c033f |
-
|
|
|
2c033f |
- for (i = 0; i < xkb_keymap_num_layouts_for_key (keymap, keycode); i++)
|
|
|
2c033f |
- {
|
|
|
2c033f |
- xkb_level_index_t level = xkb_keymap_num_levels_for_key (keymap, keycode, i);
|
|
|
2c033f |
- if (level > *num_levels)
|
|
|
2c033f |
- *num_levels = level;
|
|
|
2c033f |
- }
|
|
|
2c033f |
-}
|
|
|
2c033f |
-
|
|
|
2c033f |
-static void
|
|
|
2c033f |
-determine_keymap_num_levels (MetaKeyBindingManager *keys)
|
|
|
2c033f |
-{
|
|
|
2c033f |
- MetaBackend *backend = meta_get_backend ();
|
|
|
2c033f |
- struct xkb_keymap *keymap = meta_backend_get_keymap (backend);
|
|
|
2c033f |
-
|
|
|
2c033f |
- keys->keymap_num_levels = 0;
|
|
|
2c033f |
- xkb_keymap_key_for_each (keymap, determine_keymap_num_levels_iter, &keys->keymap_num_levels);
|
|
|
2c033f |
-}
|
|
|
2c033f |
-
|
|
|
2c033f |
-static void
|
|
|
2c033f |
reload_iso_next_group_combos (MetaKeyBindingManager *keys)
|
|
|
2c033f |
{
|
|
|
2c033f |
const char *iso_next_group_option;
|
|
|
2c033f |
@@ -515,8 +488,6 @@ reload_keycodes (MetaKeyBindingManager *keys)
|
|
|
2c033f |
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
2c033f |
"Reloading keycodes for binding tables\n");
|
|
|
2c033f |
|
|
|
2c033f |
- determine_keymap_num_levels (keys);
|
|
|
2c033f |
-
|
|
|
2c033f |
if (keys->overlay_key_combo.keysym != 0)
|
|
|
2c033f |
{
|
|
|
2c033f |
keys->overlay_key_combo.keycode =
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From 498e4eb5c0363bce78d1e7ad706fbf92fa414284 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Wed, 5 Nov 2014 18:01:55 +0100
|
|
|
2c033f |
Subject: [PATCH 04/16] Revert "keybindings: Fix indentation"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit 4a71621fbcaaa0d7992d6e86e54f872e0f737bae.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/keybindings.c | 2 +-
|
|
|
2c033f |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index 9c03bef..e8a97b1 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -323,7 +323,7 @@ get_keycodes_for_keysym (MetaKeyBindingManager *keys,
|
|
|
2c033f |
|
|
|
2c033f |
static guint
|
|
|
2c033f |
get_first_keycode_for_keysym (MetaKeyBindingManager *keys,
|
|
|
2c033f |
- guint keysym)
|
|
|
2c033f |
+ guint keysym)
|
|
|
2c033f |
{
|
|
|
2c033f |
int *keycodes;
|
|
|
2c033f |
int n_keycodes;
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From 9b8c5d718fbf807d89143ecd27771c5462fa829a Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Wed, 5 Nov 2014 18:01:57 +0100
|
|
|
2c033f |
Subject: [PATCH 05/16] Revert "keybindings: Do not depend on linux headers for
|
|
|
2c033f |
above-tab key"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit 565b9d73d532c7759fce432eb5c397ff535ac0ff.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/keybindings.c | 4 ----
|
|
|
2c033f |
1 file changed, 4 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index e8a97b1..5296fd7 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -40,11 +40,7 @@
|
|
|
2c033f |
#include <meta/prefs.h>
|
|
|
2c033f |
#include "meta-accel-parse.h"
|
|
|
2c033f |
|
|
|
2c033f |
-#ifdef __linux__
|
|
|
2c033f |
#include <linux/input.h>
|
|
|
2c033f |
-#elif !defined KEY_GRAVE
|
|
|
2c033f |
-#define KEY_GRAVE 0x29 /* assume the use of xf86-input-keyboard */
|
|
|
2c033f |
-#endif
|
|
|
2c033f |
|
|
|
2c033f |
#include "backends/x11/meta-backend-x11.h"
|
|
|
2c033f |
#include "x11/window-x11.h"
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From 0c2b7ee2381127907c1d114cd336a7d0bc0a9208 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Wed, 5 Nov 2014 18:02:01 +0100
|
|
|
2c033f |
Subject: [PATCH 06/16] Revert "keybindings: Make sure to filter out the
|
|
|
2c033f |
virtualized mod itself"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit 8a0da1cb0775607e0738b93792225d499e6545f2.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/keybindings.c | 5 ++---
|
|
|
2c033f |
1 file changed, 2 insertions(+), 3 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index 5296fd7..e269424 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -213,9 +213,8 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
|
|
|
2c033f |
if (idx != XKB_MOD_INVALID)
|
|
|
2c033f |
{
|
|
|
2c033f |
- xkb_mod_mask_t vmodmask = (1 << idx);
|
|
|
2c033f |
- xkb_state_update_mask (scratch_state, vmodmask, 0, 0, 0, 0, 0);
|
|
|
2c033f |
- *mask_p = xkb_state_serialize_mods (scratch_state, XKB_STATE_MODS_DEPRESSED) & ~vmodmask;
|
|
|
2c033f |
+ xkb_state_update_mask (scratch_state, 1 << idx, 0, 0, 0, 0, 0);
|
|
|
2c033f |
+ *mask_p = xkb_state_serialize_mods (scratch_state, XKB_STATE_MODS_DEPRESSED);
|
|
|
2c033f |
}
|
|
|
2c033f |
else
|
|
|
2c033f |
*mask_p = 0;
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From c1d2de6932ae492dfb7f214b0f951d7a7a5af361 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Wed, 5 Nov 2014 18:02:02 +0100
|
|
|
2c033f |
Subject: [PATCH 07/16] Revert "keybindings: Use a less hacky method of getting
|
|
|
2c033f |
the proper modifier mask"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit 5f7b81eb952ad928ef97a0b511a53d59739cf338.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/Makefile.am | 2 +
|
|
|
2c033f |
src/core/keybindings.c | 11 +----
|
|
|
2c033f |
src/core/xkbcommon-hacks.c | 112 +++++++++++++++++++++++++++++++++++++++++++++
|
|
|
2c033f |
src/core/xkbcommon-hacks.h | 34 ++++++++++++++
|
|
|
2c033f |
4 files changed, 150 insertions(+), 9 deletions(-)
|
|
|
2c033f |
create mode 100644 src/core/xkbcommon-hacks.c
|
|
|
2c033f |
create mode 100644 src/core/xkbcommon-hacks.h
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
|
2c033f |
index e73a053..fabb0f1 100644
|
|
|
2c033f |
--- a/src/Makefile.am
|
|
|
2c033f |
+++ b/src/Makefile.am
|
|
|
2c033f |
@@ -166,6 +166,8 @@ libmutter_la_SOURCES = \
|
|
|
2c033f |
meta/gradient.h \
|
|
|
2c033f |
core/meta-gesture-tracker.c \
|
|
|
2c033f |
core/meta-gesture-tracker-private.h \
|
|
|
2c033f |
+ core/xkbcommon-hacks.c \
|
|
|
2c033f |
+ core/xkbcommon-hacks.h \
|
|
|
2c033f |
core/keybindings.c \
|
|
|
2c033f |
core/keybindings-private.h \
|
|
|
2c033f |
core/main.c \
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index e269424..a4b1dbe 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -39,6 +39,7 @@
|
|
|
2c033f |
#include "screen-private.h"
|
|
|
2c033f |
#include <meta/prefs.h>
|
|
|
2c033f |
#include "meta-accel-parse.h"
|
|
|
2c033f |
+#include "xkbcommon-hacks.h"
|
|
|
2c033f |
|
|
|
2c033f |
#include <linux/input.h>
|
|
|
2c033f |
|
|
|
2c033f |
@@ -189,7 +190,6 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
{
|
|
|
2c033f |
MetaBackend *backend = meta_get_backend ();
|
|
|
2c033f |
struct xkb_keymap *keymap = meta_backend_get_keymap (backend);
|
|
|
2c033f |
- struct xkb_state *scratch_state;
|
|
|
2c033f |
xkb_mod_mask_t scroll_lock_mask;
|
|
|
2c033f |
|
|
|
2c033f |
/* Modifiers to find. */
|
|
|
2c033f |
@@ -203,8 +203,6 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
{ "Super", &keys->super_mask },
|
|
|
2c033f |
};
|
|
|
2c033f |
|
|
|
2c033f |
- scratch_state = xkb_state_new (keymap);
|
|
|
2c033f |
-
|
|
|
2c033f |
gsize i;
|
|
|
2c033f |
for (i = 0; i < G_N_ELEMENTS (mods); i++)
|
|
|
2c033f |
{
|
|
|
2c033f |
@@ -212,16 +210,11 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
xkb_mod_index_t idx = xkb_keymap_mod_get_index (keymap, mods[i].name);
|
|
|
2c033f |
|
|
|
2c033f |
if (idx != XKB_MOD_INVALID)
|
|
|
2c033f |
- {
|
|
|
2c033f |
- xkb_state_update_mask (scratch_state, 1 << idx, 0, 0, 0, 0, 0);
|
|
|
2c033f |
- *mask_p = xkb_state_serialize_mods (scratch_state, XKB_STATE_MODS_DEPRESSED);
|
|
|
2c033f |
- }
|
|
|
2c033f |
+ *mask_p = my_xkb_keymap_mod_get_mask (keymap, idx);
|
|
|
2c033f |
else
|
|
|
2c033f |
*mask_p = 0;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
- xkb_state_unref (scratch_state);
|
|
|
2c033f |
-
|
|
|
2c033f |
keys->ignored_modifier_mask = (scroll_lock_mask | Mod2Mask | LockMask);
|
|
|
2c033f |
|
|
|
2c033f |
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
2c033f |
diff --git a/src/core/xkbcommon-hacks.c b/src/core/xkbcommon-hacks.c
|
|
|
2c033f |
new file mode 100644
|
|
|
2c033f |
index 0000000..330f0f7
|
|
|
2c033f |
--- /dev/null
|
|
|
2c033f |
+++ b/src/core/xkbcommon-hacks.c
|
|
|
2c033f |
@@ -0,0 +1,112 @@
|
|
|
2c033f |
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
2c033f |
+
|
|
|
2c033f |
+/*
|
|
|
2c033f |
+ * Copyright (C) 2014 Red Hat
|
|
|
2c033f |
+ *
|
|
|
2c033f |
+ * This program is free software; you can redistribute it and/or
|
|
|
2c033f |
+ * modify it under the terms of the GNU General Public License as
|
|
|
2c033f |
+ * published by the Free Software Foundation; either version 2 of the
|
|
|
2c033f |
+ * License, or (at your option) any later version.
|
|
|
2c033f |
+ *
|
|
|
2c033f |
+ * This program is distributed in the hope that it will be useful, but
|
|
|
2c033f |
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
2c033f |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
2c033f |
+ * General Public License for more details.
|
|
|
2c033f |
+ *
|
|
|
2c033f |
+ * You should have received a copy of the GNU General Public License
|
|
|
2c033f |
+ * along with this program; if not, write to the Free Software
|
|
|
2c033f |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
2c033f |
+ * 02111-1307, USA.
|
|
|
2c033f |
+ *
|
|
|
2c033f |
+ * Written by:
|
|
|
2c033f |
+ * Jasper St. Pierre <jstpierre@mecheye.net>
|
|
|
2c033f |
+ */
|
|
|
2c033f |
+
|
|
|
2c033f |
+#include "config.h"
|
|
|
2c033f |
+
|
|
|
2c033f |
+#include "xkbcommon-hacks.h"
|
|
|
2c033f |
+
|
|
|
2c033f |
+/* Terrible, gross hackery to provide an implementation for xkb_keymap_mod_get_mask.
|
|
|
2c033f |
+ * Delete when https://github.com/xkbcommon/libxkbcommon/pull/10 is pushed. */
|
|
|
2c033f |
+
|
|
|
2c033f |
+/* The structures here have been pulled from libxkbcommon. */
|
|
|
2c033f |
+
|
|
|
2c033f |
+enum xkb_action_controls {
|
|
|
2c033f |
+ CONTROL_REPEAT = (1 << 0),
|
|
|
2c033f |
+ CONTROL_SLOW = (1 << 1),
|
|
|
2c033f |
+ CONTROL_DEBOUNCE = (1 << 2),
|
|
|
2c033f |
+ CONTROL_STICKY = (1 << 3),
|
|
|
2c033f |
+ CONTROL_MOUSEKEYS = (1 << 4),
|
|
|
2c033f |
+ CONTROL_MOUSEKEYS_ACCEL = (1 << 5),
|
|
|
2c033f |
+ CONTROL_AX = (1 << 6),
|
|
|
2c033f |
+ CONTROL_AX_TIMEOUT = (1 << 7),
|
|
|
2c033f |
+ CONTROL_AX_FEEDBACK = (1 << 8),
|
|
|
2c033f |
+ CONTROL_BELL = (1 << 9),
|
|
|
2c033f |
+ CONTROL_IGNORE_GROUP_LOCK = (1 << 10),
|
|
|
2c033f |
+ CONTROL_ALL = \
|
|
|
2c033f |
+ (CONTROL_REPEAT | CONTROL_SLOW | CONTROL_DEBOUNCE | CONTROL_STICKY | \
|
|
|
2c033f |
+ CONTROL_MOUSEKEYS | CONTROL_MOUSEKEYS_ACCEL | CONTROL_AX | \
|
|
|
2c033f |
+ CONTROL_AX_TIMEOUT | CONTROL_AX_FEEDBACK | CONTROL_BELL | \
|
|
|
2c033f |
+ CONTROL_IGNORE_GROUP_LOCK)
|
|
|
2c033f |
+};
|
|
|
2c033f |
+
|
|
|
2c033f |
+typedef uint32_t xkb_atom_t;
|
|
|
2c033f |
+
|
|
|
2c033f |
+/* Don't allow more modifiers than we can hold in xkb_mod_mask_t. */
|
|
|
2c033f |
+#define XKB_MAX_MODS ((xkb_mod_index_t) (sizeof(xkb_mod_mask_t) * 8))
|
|
|
2c033f |
+
|
|
|
2c033f |
+/* These should all go away. */
|
|
|
2c033f |
+enum mod_type {
|
|
|
2c033f |
+ MOD_REAL = (1 << 0),
|
|
|
2c033f |
+ MOD_VIRT = (1 << 1),
|
|
|
2c033f |
+ MOD_BOTH = (MOD_REAL | MOD_VIRT),
|
|
|
2c033f |
+};
|
|
|
2c033f |
+
|
|
|
2c033f |
+struct xkb_mod {
|
|
|
2c033f |
+ xkb_atom_t name;
|
|
|
2c033f |
+ enum mod_type type;
|
|
|
2c033f |
+ xkb_mod_mask_t mapping; /* vmod -> real mod mapping */
|
|
|
2c033f |
+};
|
|
|
2c033f |
+
|
|
|
2c033f |
+struct xkb_mod_set {
|
|
|
2c033f |
+ struct xkb_mod mods[XKB_MAX_MODS];
|
|
|
2c033f |
+ unsigned int num_mods;
|
|
|
2c033f |
+};
|
|
|
2c033f |
+
|
|
|
2c033f |
+/* Common keyboard description structure */
|
|
|
2c033f |
+struct xkb_keymap_real {
|
|
|
2c033f |
+ struct xkb_context *ctx;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ int refcnt;
|
|
|
2c033f |
+ enum xkb_keymap_compile_flags flags;
|
|
|
2c033f |
+ enum xkb_keymap_format format;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ enum xkb_action_controls enabled_ctrls;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ xkb_keycode_t min_key_code;
|
|
|
2c033f |
+ xkb_keycode_t max_key_code;
|
|
|
2c033f |
+ void *keys;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ /* aliases in no particular order */
|
|
|
2c033f |
+ unsigned int num_key_aliases;
|
|
|
2c033f |
+ void *key_aliases;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ void *types;
|
|
|
2c033f |
+ unsigned int num_types;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ unsigned int num_sym_interprets;
|
|
|
2c033f |
+ void *sym_interprets;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ struct xkb_mod_set mods;
|
|
|
2c033f |
+};
|
|
|
2c033f |
+
|
|
|
2c033f |
+xkb_mod_mask_t
|
|
|
2c033f |
+my_xkb_keymap_mod_get_mask(struct xkb_keymap *_keymap, xkb_mod_index_t idx)
|
|
|
2c033f |
+{
|
|
|
2c033f |
+ struct xkb_keymap_real *keymap = (struct xkb_keymap_real *) _keymap;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ if (idx >= keymap->mods.num_mods)
|
|
|
2c033f |
+ return 0;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ return keymap->mods.mods[idx].mapping;
|
|
|
2c033f |
+}
|
|
|
2c033f |
diff --git a/src/core/xkbcommon-hacks.h b/src/core/xkbcommon-hacks.h
|
|
|
2c033f |
new file mode 100644
|
|
|
2c033f |
index 0000000..9b64118
|
|
|
2c033f |
--- /dev/null
|
|
|
2c033f |
+++ b/src/core/xkbcommon-hacks.h
|
|
|
2c033f |
@@ -0,0 +1,34 @@
|
|
|
2c033f |
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
2c033f |
+
|
|
|
2c033f |
+/*
|
|
|
2c033f |
+ * Copyright (C) 2014 Red Hat
|
|
|
2c033f |
+ *
|
|
|
2c033f |
+ * This program is free software; you can redistribute it and/or
|
|
|
2c033f |
+ * modify it under the terms of the GNU General Public License as
|
|
|
2c033f |
+ * published by the Free Software Foundation; either version 2 of the
|
|
|
2c033f |
+ * License, or (at your option) any later version.
|
|
|
2c033f |
+ *
|
|
|
2c033f |
+ * This program is distributed in the hope that it will be useful, but
|
|
|
2c033f |
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
2c033f |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
2c033f |
+ * General Public License for more details.
|
|
|
2c033f |
+ *
|
|
|
2c033f |
+ * You should have received a copy of the GNU General Public License
|
|
|
2c033f |
+ * along with this program; if not, write to the Free Software
|
|
|
2c033f |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
2c033f |
+ * 02111-1307, USA.
|
|
|
2c033f |
+ *
|
|
|
2c033f |
+ * Written by:
|
|
|
2c033f |
+ * Jasper St. Pierre <jstpierre@mecheye.net>
|
|
|
2c033f |
+ */
|
|
|
2c033f |
+
|
|
|
2c033f |
+
|
|
|
2c033f |
+#ifndef XKBCOMMON_HACKS_H
|
|
|
2c033f |
+#define XKBCOMMON_HACKS_H
|
|
|
2c033f |
+
|
|
|
2c033f |
+#include <xkbcommon/xkbcommon.h>
|
|
|
2c033f |
+
|
|
|
2c033f |
+xkb_mod_mask_t
|
|
|
2c033f |
+my_xkb_keymap_mod_get_mask(struct xkb_keymap *keymap, xkb_mod_index_t idx);
|
|
|
2c033f |
+
|
|
|
2c033f |
+#endif /* XKBCOMMON_HACKS_H */
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From e8c8ca3d95afdfea125409253c46e38e1e4dde2f Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Wed, 5 Nov 2014 18:02:04 +0100
|
|
|
2c033f |
Subject: [PATCH 08/16] Revert "keybindings: Rewrite the keymap code so that it
|
|
|
2c033f |
uses libxkbcommon"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit 1af00333682cda21db2d08b9fc590888d8e23e57.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/keybindings-private.h | 6 +++
|
|
|
2c033f |
src/core/keybindings.c | 106 +++++++++++++++++++----------------------
|
|
|
2c033f |
2 files changed, 55 insertions(+), 57 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/keybindings-private.h b/src/core/keybindings-private.h
|
|
|
2c033f |
index aadb294..9dfa4e8 100644
|
|
|
2c033f |
--- a/src/core/keybindings-private.h
|
|
|
2c033f |
+++ b/src/core/keybindings-private.h
|
|
|
2c033f |
@@ -90,8 +90,14 @@ typedef struct
|
|
|
2c033f |
|
|
|
2c033f |
typedef struct
|
|
|
2c033f |
{
|
|
|
2c033f |
+ Display *xdisplay;
|
|
|
2c033f |
+
|
|
|
2c033f |
GHashTable *key_bindings;
|
|
|
2c033f |
GHashTable *key_bindings_index;
|
|
|
2c033f |
+ int min_keycode;
|
|
|
2c033f |
+ int max_keycode;
|
|
|
2c033f |
+ KeySym *keymap;
|
|
|
2c033f |
+ int keysyms_per_keycode;
|
|
|
2c033f |
xkb_mod_mask_t ignored_modifier_mask;
|
|
|
2c033f |
xkb_mod_mask_t hyper_mask;
|
|
|
2c033f |
xkb_mod_mask_t super_mask;
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index a4b1dbe..23e82b9 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -177,6 +177,18 @@ key_binding_key (guint32 keycode,
|
|
|
2c033f |
return (key << 16) | (mask & 0xffff);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
+
|
|
|
2c033f |
+static void
|
|
|
2c033f |
+reload_keymap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
+{
|
|
|
2c033f |
+ meta_XFree (keys->keymap);
|
|
|
2c033f |
+ keys->keymap = XGetKeyboardMapping (keys->xdisplay,
|
|
|
2c033f |
+ keys->min_keycode,
|
|
|
2c033f |
+ keys->max_keycode -
|
|
|
2c033f |
+ keys->min_keycode + 1,
|
|
|
2c033f |
+ &keys->keysyms_per_keycode);
|
|
|
2c033f |
+}
|
|
|
2c033f |
+
|
|
|
2c033f |
static const char *
|
|
|
2c033f |
keysym_name (xkb_keysym_t keysym)
|
|
|
2c033f |
{
|
|
|
2c033f |
@@ -226,61 +238,12 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
keys->meta_mask);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
-static gboolean
|
|
|
2c033f |
-is_keycode_for_keysym (struct xkb_keymap *keymap,
|
|
|
2c033f |
- xkb_keycode_t keycode,
|
|
|
2c033f |
- xkb_keysym_t keysym)
|
|
|
2c033f |
-{
|
|
|
2c033f |
- xkb_layout_index_t num_layouts, i;
|
|
|
2c033f |
-
|
|
|
2c033f |
- num_layouts = xkb_keymap_num_layouts_for_key (keymap, keycode);
|
|
|
2c033f |
- for (i = 0; i < num_layouts; i++)
|
|
|
2c033f |
- {
|
|
|
2c033f |
- xkb_level_index_t num_levels, j;
|
|
|
2c033f |
-
|
|
|
2c033f |
- num_levels = xkb_keymap_num_levels_for_key (keymap, keycode, i);
|
|
|
2c033f |
- for (j = 0; j < num_levels; j++)
|
|
|
2c033f |
- {
|
|
|
2c033f |
- const xkb_keysym_t *syms;
|
|
|
2c033f |
- int num_syms, k;
|
|
|
2c033f |
-
|
|
|
2c033f |
- num_syms = xkb_keymap_key_get_syms_by_level (keymap, keycode, i, j, &syms);
|
|
|
2c033f |
- for (k = 0; k < num_syms; k++)
|
|
|
2c033f |
- {
|
|
|
2c033f |
- if (syms[k] == keysym)
|
|
|
2c033f |
- return TRUE;
|
|
|
2c033f |
- }
|
|
|
2c033f |
- }
|
|
|
2c033f |
- }
|
|
|
2c033f |
-
|
|
|
2c033f |
- return FALSE;
|
|
|
2c033f |
-}
|
|
|
2c033f |
-
|
|
|
2c033f |
-typedef struct
|
|
|
2c033f |
-{
|
|
|
2c033f |
- GArray *keycodes;
|
|
|
2c033f |
- xkb_keysym_t keysym;
|
|
|
2c033f |
-} FindKeysymData;
|
|
|
2c033f |
-
|
|
|
2c033f |
-static void
|
|
|
2c033f |
-get_keycodes_for_keysym_iter (struct xkb_keymap *keymap,
|
|
|
2c033f |
- xkb_keycode_t keycode,
|
|
|
2c033f |
- void *data)
|
|
|
2c033f |
-{
|
|
|
2c033f |
- FindKeysymData *search_data = data;
|
|
|
2c033f |
- GArray *keycodes = search_data->keycodes;
|
|
|
2c033f |
- xkb_keysym_t keysym = search_data->keysym;
|
|
|
2c033f |
-
|
|
|
2c033f |
- if (is_keycode_for_keysym (keymap, keycode, keysym))
|
|
|
2c033f |
- g_array_append_val (keycodes, keycode);
|
|
|
2c033f |
-}
|
|
|
2c033f |
-
|
|
|
2c033f |
/* Original code from gdk_x11_keymap_get_entries_for_keyval() in
|
|
|
2c033f |
* gdkkeys-x11.c */
|
|
|
2c033f |
static int
|
|
|
2c033f |
get_keycodes_for_keysym (MetaKeyBindingManager *keys,
|
|
|
2c033f |
- int keysym,
|
|
|
2c033f |
- int **keycodes)
|
|
|
2c033f |
+ int keysym,
|
|
|
2c033f |
+ int **keycodes)
|
|
|
2c033f |
{
|
|
|
2c033f |
GArray *retval;
|
|
|
2c033f |
int n_keycodes;
|
|
|
2c033f |
@@ -296,12 +259,22 @@ get_keycodes_for_keysym (MetaKeyBindingManager *keys,
|
|
|
2c033f |
goto out;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
- {
|
|
|
2c033f |
- MetaBackend *backend = meta_get_backend ();
|
|
|
2c033f |
- struct xkb_keymap *keymap = meta_backend_get_keymap (backend);
|
|
|
2c033f |
- FindKeysymData search_data = { retval, keysym };
|
|
|
2c033f |
- xkb_keymap_key_for_each (keymap, get_keycodes_for_keysym_iter, &search_data);
|
|
|
2c033f |
- }
|
|
|
2c033f |
+ keycode = keys->min_keycode;
|
|
|
2c033f |
+ while (keycode <= keys->max_keycode)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ const KeySym *syms = keys->keymap + (keycode - keys->min_keycode) * keys->keysyms_per_keycode;
|
|
|
2c033f |
+ int i = 0;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ while (i < keys->keysyms_per_keycode)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ if (syms[i] == (unsigned int)keysym)
|
|
|
2c033f |
+ g_array_append_val (retval, keycode);
|
|
|
2c033f |
+
|
|
|
2c033f |
+ ++i;
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+
|
|
|
2c033f |
+ ++keycode;
|
|
|
2c033f |
+ }
|
|
|
2c033f |
|
|
|
2c033f |
out:
|
|
|
2c033f |
n_keycodes = retval->len;
|
|
|
2c033f |
@@ -888,6 +861,8 @@ on_keymap_changed (MetaBackend *backend,
|
|
|
2c033f |
|
|
|
2c033f |
ungrab_key_bindings (display);
|
|
|
2c033f |
|
|
|
2c033f |
+ reload_keymap (keys);
|
|
|
2c033f |
+
|
|
|
2c033f |
/* Deciphering the modmap depends on the loaded keysyms to find out
|
|
|
2c033f |
* what modifiers is Super and so forth, so we need to reload it
|
|
|
2c033f |
* even when only the keymap changes */
|
|
|
2c033f |
@@ -1157,6 +1132,8 @@ meta_display_shutdown_keys (MetaDisplay *display)
|
|
|
2c033f |
|
|
|
2c033f |
meta_prefs_remove_listener (prefs_changed_callback, display);
|
|
|
2c033f |
|
|
|
2c033f |
+ meta_XFree (keys->keymap);
|
|
|
2c033f |
+
|
|
|
2c033f |
g_hash_table_destroy (keys->key_bindings_index);
|
|
|
2c033f |
g_hash_table_destroy (keys->key_bindings);
|
|
|
2c033f |
}
|
|
|
2c033f |
@@ -4045,6 +4022,11 @@ meta_display_init_keys (MetaDisplay *display)
|
|
|
2c033f |
MetaKeyHandler *handler;
|
|
|
2c033f |
|
|
|
2c033f |
/* Keybindings */
|
|
|
2c033f |
+ keys->xdisplay = display->xdisplay;
|
|
|
2c033f |
+ keys->keymap = NULL;
|
|
|
2c033f |
+ keys->keysyms_per_keycode = 0;
|
|
|
2c033f |
+ keys->min_keycode = 0;
|
|
|
2c033f |
+ keys->max_keycode = 0;
|
|
|
2c033f |
keys->ignored_modifier_mask = 0;
|
|
|
2c033f |
keys->hyper_mask = 0;
|
|
|
2c033f |
keys->super_mask = 0;
|
|
|
2c033f |
@@ -4053,6 +4035,16 @@ meta_display_init_keys (MetaDisplay *display)
|
|
|
2c033f |
keys->key_bindings = g_hash_table_new_full (NULL, NULL, NULL, g_free);
|
|
|
2c033f |
keys->key_bindings_index = g_hash_table_new (NULL, NULL);
|
|
|
2c033f |
|
|
|
2c033f |
+ XDisplayKeycodes (keys->xdisplay,
|
|
|
2c033f |
+ &keys->min_keycode,
|
|
|
2c033f |
+ &keys->max_keycode);
|
|
|
2c033f |
+
|
|
|
2c033f |
+ meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
2c033f |
+ "Display has keycode range %d to %d\n",
|
|
|
2c033f |
+ keys->min_keycode,
|
|
|
2c033f |
+ keys->max_keycode);
|
|
|
2c033f |
+
|
|
|
2c033f |
+ reload_keymap (keys);
|
|
|
2c033f |
reload_modmap (keys);
|
|
|
2c033f |
|
|
|
2c033f |
key_handlers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From 45f427e9717d2ebb7a6a7c4c48952f72c5bd8d37 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Wed, 5 Nov 2014 18:02:07 +0100
|
|
|
2c033f |
Subject: [PATCH 09/16] Revert "keybindings: Rewrite the modmap code so that it
|
|
|
2c033f |
uses libxkbcommon"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit 3645c63c0842f4c416d20c36601c0b4fb91e08a4.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/Makefile.am | 2 -
|
|
|
2c033f |
src/core/keybindings-private.h | 9 ++--
|
|
|
2c033f |
src/core/keybindings.c | 93 +++++++++++++++++++++++++---------
|
|
|
2c033f |
src/core/xkbcommon-hacks.c | 112 -----------------------------------------
|
|
|
2c033f |
src/core/xkbcommon-hacks.h | 34 -------------
|
|
|
2c033f |
5 files changed, 73 insertions(+), 177 deletions(-)
|
|
|
2c033f |
delete mode 100644 src/core/xkbcommon-hacks.c
|
|
|
2c033f |
delete mode 100644 src/core/xkbcommon-hacks.h
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
|
2c033f |
index fabb0f1..e73a053 100644
|
|
|
2c033f |
--- a/src/Makefile.am
|
|
|
2c033f |
+++ b/src/Makefile.am
|
|
|
2c033f |
@@ -166,8 +166,6 @@ libmutter_la_SOURCES = \
|
|
|
2c033f |
meta/gradient.h \
|
|
|
2c033f |
core/meta-gesture-tracker.c \
|
|
|
2c033f |
core/meta-gesture-tracker-private.h \
|
|
|
2c033f |
- core/xkbcommon-hacks.c \
|
|
|
2c033f |
- core/xkbcommon-hacks.h \
|
|
|
2c033f |
core/keybindings.c \
|
|
|
2c033f |
core/keybindings-private.h \
|
|
|
2c033f |
core/main.c \
|
|
|
2c033f |
diff --git a/src/core/keybindings-private.h b/src/core/keybindings-private.h
|
|
|
2c033f |
index 9dfa4e8..5cd8c0e 100644
|
|
|
2c033f |
--- a/src/core/keybindings-private.h
|
|
|
2c033f |
+++ b/src/core/keybindings-private.h
|
|
|
2c033f |
@@ -29,7 +29,6 @@
|
|
|
2c033f |
|
|
|
2c033f |
#include <gio/gio.h>
|
|
|
2c033f |
#include <meta/keybindings.h>
|
|
|
2c033f |
-#include <xkbcommon/xkbcommon.h>
|
|
|
2c033f |
|
|
|
2c033f |
typedef struct _MetaKeyHandler MetaKeyHandler;
|
|
|
2c033f |
struct _MetaKeyHandler
|
|
|
2c033f |
@@ -98,10 +97,10 @@ typedef struct
|
|
|
2c033f |
int max_keycode;
|
|
|
2c033f |
KeySym *keymap;
|
|
|
2c033f |
int keysyms_per_keycode;
|
|
|
2c033f |
- xkb_mod_mask_t ignored_modifier_mask;
|
|
|
2c033f |
- xkb_mod_mask_t hyper_mask;
|
|
|
2c033f |
- xkb_mod_mask_t super_mask;
|
|
|
2c033f |
- xkb_mod_mask_t meta_mask;
|
|
|
2c033f |
+ unsigned int ignored_modifier_mask;
|
|
|
2c033f |
+ unsigned int hyper_mask;
|
|
|
2c033f |
+ unsigned int super_mask;
|
|
|
2c033f |
+ unsigned int meta_mask;
|
|
|
2c033f |
MetaKeyCombo overlay_key_combo;
|
|
|
2c033f |
gboolean overlay_key_only_pressed;
|
|
|
2c033f |
MetaKeyCombo *iso_next_group_combos;
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index 23e82b9..03a52aa 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -39,10 +39,11 @@
|
|
|
2c033f |
#include "screen-private.h"
|
|
|
2c033f |
#include <meta/prefs.h>
|
|
|
2c033f |
#include "meta-accel-parse.h"
|
|
|
2c033f |
-#include "xkbcommon-hacks.h"
|
|
|
2c033f |
|
|
|
2c033f |
#include <linux/input.h>
|
|
|
2c033f |
|
|
|
2c033f |
+#include <xkbcommon/xkbcommon.h>
|
|
|
2c033f |
+
|
|
|
2c033f |
#include "backends/x11/meta-backend-x11.h"
|
|
|
2c033f |
#include "x11/window-x11.h"
|
|
|
2c033f |
|
|
|
2c033f |
@@ -200,31 +201,73 @@ keysym_name (xkb_keysym_t keysym)
|
|
|
2c033f |
static void
|
|
|
2c033f |
reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
{
|
|
|
2c033f |
- MetaBackend *backend = meta_get_backend ();
|
|
|
2c033f |
- struct xkb_keymap *keymap = meta_backend_get_keymap (backend);
|
|
|
2c033f |
- xkb_mod_mask_t scroll_lock_mask;
|
|
|
2c033f |
-
|
|
|
2c033f |
- /* Modifiers to find. */
|
|
|
2c033f |
- struct {
|
|
|
2c033f |
- char *name;
|
|
|
2c033f |
- xkb_mod_mask_t *mask_p;
|
|
|
2c033f |
- } mods[] = {
|
|
|
2c033f |
- { "ScrollLock", &scroll_lock_mask },
|
|
|
2c033f |
- { "Meta", &keys->meta_mask },
|
|
|
2c033f |
- { "Hyper", &keys->hyper_mask },
|
|
|
2c033f |
- { "Super", &keys->super_mask },
|
|
|
2c033f |
- };
|
|
|
2c033f |
-
|
|
|
2c033f |
- gsize i;
|
|
|
2c033f |
- for (i = 0; i < G_N_ELEMENTS (mods); i++)
|
|
|
2c033f |
+ XModifierKeymap *modmap;
|
|
|
2c033f |
+ int map_size;
|
|
|
2c033f |
+ int i;
|
|
|
2c033f |
+ int scroll_lock_mask = 0;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ modmap = XGetModifierMapping (keys->xdisplay);
|
|
|
2c033f |
+ keys->ignored_modifier_mask = 0;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ /* Multiple bits may get set in each of these */
|
|
|
2c033f |
+ keys->meta_mask = 0;
|
|
|
2c033f |
+ keys->hyper_mask = 0;
|
|
|
2c033f |
+ keys->super_mask = 0;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ /* there are 8 modifiers, and the first 3 are shift, shift lock,
|
|
|
2c033f |
+ * and control
|
|
|
2c033f |
+ */
|
|
|
2c033f |
+ map_size = 8 * modmap->max_keypermod;
|
|
|
2c033f |
+ i = 3 * modmap->max_keypermod;
|
|
|
2c033f |
+ while (i < map_size)
|
|
|
2c033f |
{
|
|
|
2c033f |
- xkb_mod_mask_t *mask_p = mods[i].mask_p;
|
|
|
2c033f |
- xkb_mod_index_t idx = xkb_keymap_mod_get_index (keymap, mods[i].name);
|
|
|
2c033f |
+ /* get the key code at this point in the map,
|
|
|
2c033f |
+ * see if its keysym is one we're interested in
|
|
|
2c033f |
+ */
|
|
|
2c033f |
+ int keycode = modmap->modifiermap[i];
|
|
|
2c033f |
|
|
|
2c033f |
- if (idx != XKB_MOD_INVALID)
|
|
|
2c033f |
- *mask_p = my_xkb_keymap_mod_get_mask (keymap, idx);
|
|
|
2c033f |
- else
|
|
|
2c033f |
- *mask_p = 0;
|
|
|
2c033f |
+ if (keycode >= keys->min_keycode &&
|
|
|
2c033f |
+ keycode <= keys->max_keycode)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ int j = 0;
|
|
|
2c033f |
+ KeySym *syms = keys->keymap +
|
|
|
2c033f |
+ (keycode - keys->min_keycode) * keys->keysyms_per_keycode;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ while (j < keys->keysyms_per_keycode)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ if (syms[j] != 0)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
2c033f |
+ "Keysym %s bound to modifier 0x%x\n",
|
|
|
2c033f |
+ keysym_name (syms[j]),
|
|
|
2c033f |
+ (1 << ( i / modmap->max_keypermod)));
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+
|
|
|
2c033f |
+ if (syms[j] == XKB_KEY_Scroll_Lock)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ scroll_lock_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+ else if (syms[j] == XKB_KEY_Super_L ||
|
|
|
2c033f |
+ syms[j] == XKB_KEY_Super_R)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ keys->super_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+ else if (syms[j] == XKB_KEY_Hyper_L ||
|
|
|
2c033f |
+ syms[j] == XKB_KEY_Hyper_R)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ keys->hyper_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+ else if (syms[j] == XKB_KEY_Meta_L ||
|
|
|
2c033f |
+ syms[j] == XKB_KEY_Meta_R)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ keys->meta_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+
|
|
|
2c033f |
+ ++j;
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+
|
|
|
2c033f |
+ ++i;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
keys->ignored_modifier_mask = (scroll_lock_mask | Mod2Mask | LockMask);
|
|
|
2c033f |
@@ -236,6 +279,8 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
keys->hyper_mask,
|
|
|
2c033f |
keys->super_mask,
|
|
|
2c033f |
keys->meta_mask);
|
|
|
2c033f |
+
|
|
|
2c033f |
+ XFreeModifiermap (modmap);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
/* Original code from gdk_x11_keymap_get_entries_for_keyval() in
|
|
|
2c033f |
diff --git a/src/core/xkbcommon-hacks.c b/src/core/xkbcommon-hacks.c
|
|
|
2c033f |
deleted file mode 100644
|
|
|
2c033f |
index 330f0f7..0000000
|
|
|
2c033f |
--- a/src/core/xkbcommon-hacks.c
|
|
|
2c033f |
+++ /dev/null
|
|
|
2c033f |
@@ -1,112 +0,0 @@
|
|
|
2c033f |
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
2c033f |
-
|
|
|
2c033f |
-/*
|
|
|
2c033f |
- * Copyright (C) 2014 Red Hat
|
|
|
2c033f |
- *
|
|
|
2c033f |
- * This program is free software; you can redistribute it and/or
|
|
|
2c033f |
- * modify it under the terms of the GNU General Public License as
|
|
|
2c033f |
- * published by the Free Software Foundation; either version 2 of the
|
|
|
2c033f |
- * License, or (at your option) any later version.
|
|
|
2c033f |
- *
|
|
|
2c033f |
- * This program is distributed in the hope that it will be useful, but
|
|
|
2c033f |
- * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
2c033f |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
2c033f |
- * General Public License for more details.
|
|
|
2c033f |
- *
|
|
|
2c033f |
- * You should have received a copy of the GNU General Public License
|
|
|
2c033f |
- * along with this program; if not, write to the Free Software
|
|
|
2c033f |
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
2c033f |
- * 02111-1307, USA.
|
|
|
2c033f |
- *
|
|
|
2c033f |
- * Written by:
|
|
|
2c033f |
- * Jasper St. Pierre <jstpierre@mecheye.net>
|
|
|
2c033f |
- */
|
|
|
2c033f |
-
|
|
|
2c033f |
-#include "config.h"
|
|
|
2c033f |
-
|
|
|
2c033f |
-#include "xkbcommon-hacks.h"
|
|
|
2c033f |
-
|
|
|
2c033f |
-/* Terrible, gross hackery to provide an implementation for xkb_keymap_mod_get_mask.
|
|
|
2c033f |
- * Delete when https://github.com/xkbcommon/libxkbcommon/pull/10 is pushed. */
|
|
|
2c033f |
-
|
|
|
2c033f |
-/* The structures here have been pulled from libxkbcommon. */
|
|
|
2c033f |
-
|
|
|
2c033f |
-enum xkb_action_controls {
|
|
|
2c033f |
- CONTROL_REPEAT = (1 << 0),
|
|
|
2c033f |
- CONTROL_SLOW = (1 << 1),
|
|
|
2c033f |
- CONTROL_DEBOUNCE = (1 << 2),
|
|
|
2c033f |
- CONTROL_STICKY = (1 << 3),
|
|
|
2c033f |
- CONTROL_MOUSEKEYS = (1 << 4),
|
|
|
2c033f |
- CONTROL_MOUSEKEYS_ACCEL = (1 << 5),
|
|
|
2c033f |
- CONTROL_AX = (1 << 6),
|
|
|
2c033f |
- CONTROL_AX_TIMEOUT = (1 << 7),
|
|
|
2c033f |
- CONTROL_AX_FEEDBACK = (1 << 8),
|
|
|
2c033f |
- CONTROL_BELL = (1 << 9),
|
|
|
2c033f |
- CONTROL_IGNORE_GROUP_LOCK = (1 << 10),
|
|
|
2c033f |
- CONTROL_ALL = \
|
|
|
2c033f |
- (CONTROL_REPEAT | CONTROL_SLOW | CONTROL_DEBOUNCE | CONTROL_STICKY | \
|
|
|
2c033f |
- CONTROL_MOUSEKEYS | CONTROL_MOUSEKEYS_ACCEL | CONTROL_AX | \
|
|
|
2c033f |
- CONTROL_AX_TIMEOUT | CONTROL_AX_FEEDBACK | CONTROL_BELL | \
|
|
|
2c033f |
- CONTROL_IGNORE_GROUP_LOCK)
|
|
|
2c033f |
-};
|
|
|
2c033f |
-
|
|
|
2c033f |
-typedef uint32_t xkb_atom_t;
|
|
|
2c033f |
-
|
|
|
2c033f |
-/* Don't allow more modifiers than we can hold in xkb_mod_mask_t. */
|
|
|
2c033f |
-#define XKB_MAX_MODS ((xkb_mod_index_t) (sizeof(xkb_mod_mask_t) * 8))
|
|
|
2c033f |
-
|
|
|
2c033f |
-/* These should all go away. */
|
|
|
2c033f |
-enum mod_type {
|
|
|
2c033f |
- MOD_REAL = (1 << 0),
|
|
|
2c033f |
- MOD_VIRT = (1 << 1),
|
|
|
2c033f |
- MOD_BOTH = (MOD_REAL | MOD_VIRT),
|
|
|
2c033f |
-};
|
|
|
2c033f |
-
|
|
|
2c033f |
-struct xkb_mod {
|
|
|
2c033f |
- xkb_atom_t name;
|
|
|
2c033f |
- enum mod_type type;
|
|
|
2c033f |
- xkb_mod_mask_t mapping; /* vmod -> real mod mapping */
|
|
|
2c033f |
-};
|
|
|
2c033f |
-
|
|
|
2c033f |
-struct xkb_mod_set {
|
|
|
2c033f |
- struct xkb_mod mods[XKB_MAX_MODS];
|
|
|
2c033f |
- unsigned int num_mods;
|
|
|
2c033f |
-};
|
|
|
2c033f |
-
|
|
|
2c033f |
-/* Common keyboard description structure */
|
|
|
2c033f |
-struct xkb_keymap_real {
|
|
|
2c033f |
- struct xkb_context *ctx;
|
|
|
2c033f |
-
|
|
|
2c033f |
- int refcnt;
|
|
|
2c033f |
- enum xkb_keymap_compile_flags flags;
|
|
|
2c033f |
- enum xkb_keymap_format format;
|
|
|
2c033f |
-
|
|
|
2c033f |
- enum xkb_action_controls enabled_ctrls;
|
|
|
2c033f |
-
|
|
|
2c033f |
- xkb_keycode_t min_key_code;
|
|
|
2c033f |
- xkb_keycode_t max_key_code;
|
|
|
2c033f |
- void *keys;
|
|
|
2c033f |
-
|
|
|
2c033f |
- /* aliases in no particular order */
|
|
|
2c033f |
- unsigned int num_key_aliases;
|
|
|
2c033f |
- void *key_aliases;
|
|
|
2c033f |
-
|
|
|
2c033f |
- void *types;
|
|
|
2c033f |
- unsigned int num_types;
|
|
|
2c033f |
-
|
|
|
2c033f |
- unsigned int num_sym_interprets;
|
|
|
2c033f |
- void *sym_interprets;
|
|
|
2c033f |
-
|
|
|
2c033f |
- struct xkb_mod_set mods;
|
|
|
2c033f |
-};
|
|
|
2c033f |
-
|
|
|
2c033f |
-xkb_mod_mask_t
|
|
|
2c033f |
-my_xkb_keymap_mod_get_mask(struct xkb_keymap *_keymap, xkb_mod_index_t idx)
|
|
|
2c033f |
-{
|
|
|
2c033f |
- struct xkb_keymap_real *keymap = (struct xkb_keymap_real *) _keymap;
|
|
|
2c033f |
-
|
|
|
2c033f |
- if (idx >= keymap->mods.num_mods)
|
|
|
2c033f |
- return 0;
|
|
|
2c033f |
-
|
|
|
2c033f |
- return keymap->mods.mods[idx].mapping;
|
|
|
2c033f |
-}
|
|
|
2c033f |
diff --git a/src/core/xkbcommon-hacks.h b/src/core/xkbcommon-hacks.h
|
|
|
2c033f |
deleted file mode 100644
|
|
|
2c033f |
index 9b64118..0000000
|
|
|
2c033f |
--- a/src/core/xkbcommon-hacks.h
|
|
|
2c033f |
+++ /dev/null
|
|
|
2c033f |
@@ -1,34 +0,0 @@
|
|
|
2c033f |
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
2c033f |
-
|
|
|
2c033f |
-/*
|
|
|
2c033f |
- * Copyright (C) 2014 Red Hat
|
|
|
2c033f |
- *
|
|
|
2c033f |
- * This program is free software; you can redistribute it and/or
|
|
|
2c033f |
- * modify it under the terms of the GNU General Public License as
|
|
|
2c033f |
- * published by the Free Software Foundation; either version 2 of the
|
|
|
2c033f |
- * License, or (at your option) any later version.
|
|
|
2c033f |
- *
|
|
|
2c033f |
- * This program is distributed in the hope that it will be useful, but
|
|
|
2c033f |
- * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
2c033f |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
2c033f |
- * General Public License for more details.
|
|
|
2c033f |
- *
|
|
|
2c033f |
- * You should have received a copy of the GNU General Public License
|
|
|
2c033f |
- * along with this program; if not, write to the Free Software
|
|
|
2c033f |
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
2c033f |
- * 02111-1307, USA.
|
|
|
2c033f |
- *
|
|
|
2c033f |
- * Written by:
|
|
|
2c033f |
- * Jasper St. Pierre <jstpierre@mecheye.net>
|
|
|
2c033f |
- */
|
|
|
2c033f |
-
|
|
|
2c033f |
-
|
|
|
2c033f |
-#ifndef XKBCOMMON_HACKS_H
|
|
|
2c033f |
-#define XKBCOMMON_HACKS_H
|
|
|
2c033f |
-
|
|
|
2c033f |
-#include <xkbcommon/xkbcommon.h>
|
|
|
2c033f |
-
|
|
|
2c033f |
-xkb_mod_mask_t
|
|
|
2c033f |
-my_xkb_keymap_mod_get_mask(struct xkb_keymap *keymap, xkb_mod_index_t idx);
|
|
|
2c033f |
-
|
|
|
2c033f |
-#endif /* XKBCOMMON_HACKS_H */
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From d560a87141675d935418ad47c5316c55df0d424b Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Wed, 5 Nov 2014 18:02:09 +0100
|
|
|
2c033f |
Subject: [PATCH 10/16] Revert "keybindings: Remove unused includes"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit 7d1ef3f4478610864370c27ab7d8321922424d2b.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/keybindings.c | 8 ++++++++
|
|
|
2c033f |
1 file changed, 8 insertions(+)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index 03a52aa..05d3d27 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -36,14 +36,22 @@
|
|
|
2c033f |
#include <meta/errors.h>
|
|
|
2c033f |
#include "edge-resistance.h"
|
|
|
2c033f |
#include "frame.h"
|
|
|
2c033f |
+#include "place.h"
|
|
|
2c033f |
#include "screen-private.h"
|
|
|
2c033f |
#include <meta/prefs.h>
|
|
|
2c033f |
+#include "util-private.h"
|
|
|
2c033f |
#include "meta-accel-parse.h"
|
|
|
2c033f |
|
|
|
2c033f |
+#include <string.h>
|
|
|
2c033f |
+#include <stdio.h>
|
|
|
2c033f |
+#include <stdlib.h>
|
|
|
2c033f |
+
|
|
|
2c033f |
#include <linux/input.h>
|
|
|
2c033f |
|
|
|
2c033f |
#include <xkbcommon/xkbcommon.h>
|
|
|
2c033f |
|
|
|
2c033f |
+#include <X11/XKBlib.h>
|
|
|
2c033f |
+
|
|
|
2c033f |
#include "backends/x11/meta-backend-x11.h"
|
|
|
2c033f |
#include "x11/window-x11.h"
|
|
|
2c033f |
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From 2f8d525c6318689e54341923ed0763abaae4f234 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Tue, 5 May 2015 18:59:05 +0200
|
|
|
2c033f |
Subject: [PATCH 11/16] Revert "keybindings: Hardcode Mod2Mask for Num Lock"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit fb6438cdd42c3cea3ae88c4c86a35008f5deb1c4.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/keybindings.c | 19 ++++++++++++++++---
|
|
|
2c033f |
1 file changed, 16 insertions(+), 3 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index 05d3d27..72e06b6 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -212,6 +212,7 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
XModifierKeymap *modmap;
|
|
|
2c033f |
int map_size;
|
|
|
2c033f |
int i;
|
|
|
2c033f |
+ int num_lock_mask = 0;
|
|
|
2c033f |
int scroll_lock_mask = 0;
|
|
|
2c033f |
|
|
|
2c033f |
modmap = XGetModifierMapping (keys->xdisplay);
|
|
|
2c033f |
@@ -251,7 +252,16 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
(1 << ( i / modmap->max_keypermod)));
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
- if (syms[j] == XKB_KEY_Scroll_Lock)
|
|
|
2c033f |
+ if (syms[j] == XKB_KEY_Num_Lock)
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ /* Mod1Mask is 1 << 3 for example, i.e. the
|
|
|
2c033f |
+ * fourth modifier, i / keyspermod is the modifier
|
|
|
2c033f |
+ * index
|
|
|
2c033f |
+ */
|
|
|
2c033f |
+
|
|
|
2c033f |
+ num_lock_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+ else if (syms[j] == XKB_KEY_Scroll_Lock)
|
|
|
2c033f |
{
|
|
|
2c033f |
scroll_lock_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
2c033f |
}
|
|
|
2c033f |
@@ -278,11 +288,14 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
++i;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
- keys->ignored_modifier_mask = (scroll_lock_mask | Mod2Mask | LockMask);
|
|
|
2c033f |
+ keys->ignored_modifier_mask = (num_lock_mask |
|
|
|
2c033f |
+ scroll_lock_mask |
|
|
|
2c033f |
+ LockMask);
|
|
|
2c033f |
|
|
|
2c033f |
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
2c033f |
- "Ignoring modmask 0x%x scroll lock 0x%x hyper 0x%x super 0x%x meta 0x%x\n",
|
|
|
2c033f |
+ "Ignoring modmask 0x%x num lock 0x%x scroll lock 0x%x hyper 0x%x super 0x%x meta 0x%x\n",
|
|
|
2c033f |
keys->ignored_modifier_mask,
|
|
|
2c033f |
+ num_lock_mask,
|
|
|
2c033f |
scroll_lock_mask,
|
|
|
2c033f |
keys->hyper_mask,
|
|
|
2c033f |
keys->super_mask,
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From e4f9f33800aa8def5dab25417370147d78fe4bb4 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Tue, 5 May 2015 19:00:56 +0200
|
|
|
2c033f |
Subject: [PATCH 12/16] Revert "Use libxkbcommon keysym names everywhere"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit a730361d6c96a58c73cd3c782a7741c0737ba52d.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/keybindings.c | 37 +++++++++++++++++++------------------
|
|
|
2c033f |
1 file changed, 19 insertions(+), 18 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index 72e06b6..d77b133 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -42,6 +42,7 @@
|
|
|
2c033f |
#include "util-private.h"
|
|
|
2c033f |
#include "meta-accel-parse.h"
|
|
|
2c033f |
|
|
|
2c033f |
+#include <X11/keysym.h>
|
|
|
2c033f |
#include <string.h>
|
|
|
2c033f |
#include <stdio.h>
|
|
|
2c033f |
#include <stdlib.h>
|
|
|
2c033f |
@@ -252,7 +253,7 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
(1 << ( i / modmap->max_keypermod)));
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
- if (syms[j] == XKB_KEY_Num_Lock)
|
|
|
2c033f |
+ if (syms[j] == XK_Num_Lock)
|
|
|
2c033f |
{
|
|
|
2c033f |
/* Mod1Mask is 1 << 3 for example, i.e. the
|
|
|
2c033f |
* fourth modifier, i / keyspermod is the modifier
|
|
|
2c033f |
@@ -261,22 +262,22 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
|
|
|
2c033f |
num_lock_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
2c033f |
}
|
|
|
2c033f |
- else if (syms[j] == XKB_KEY_Scroll_Lock)
|
|
|
2c033f |
+ else if (syms[j] == XK_Scroll_Lock)
|
|
|
2c033f |
{
|
|
|
2c033f |
scroll_lock_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
2c033f |
}
|
|
|
2c033f |
- else if (syms[j] == XKB_KEY_Super_L ||
|
|
|
2c033f |
- syms[j] == XKB_KEY_Super_R)
|
|
|
2c033f |
+ else if (syms[j] == XK_Super_L ||
|
|
|
2c033f |
+ syms[j] == XK_Super_R)
|
|
|
2c033f |
{
|
|
|
2c033f |
keys->super_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
2c033f |
}
|
|
|
2c033f |
- else if (syms[j] == XKB_KEY_Hyper_L ||
|
|
|
2c033f |
- syms[j] == XKB_KEY_Hyper_R)
|
|
|
2c033f |
+ else if (syms[j] == XK_Hyper_L ||
|
|
|
2c033f |
+ syms[j] == XK_Hyper_R)
|
|
|
2c033f |
{
|
|
|
2c033f |
keys->hyper_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
2c033f |
}
|
|
|
2c033f |
- else if (syms[j] == XKB_KEY_Meta_L ||
|
|
|
2c033f |
- syms[j] == XKB_KEY_Meta_R)
|
|
|
2c033f |
+ else if (syms[j] == XK_Meta_L ||
|
|
|
2c033f |
+ syms[j] == XK_Meta_R)
|
|
|
2c033f |
{
|
|
|
2c033f |
keys->meta_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
2c033f |
}
|
|
|
2c033f |
@@ -384,7 +385,7 @@ reload_iso_next_group_combos (MetaKeyBindingManager *keys)
|
|
|
2c033f |
if (iso_next_group_option == NULL)
|
|
|
2c033f |
return;
|
|
|
2c033f |
|
|
|
2c033f |
- n_keycodes = get_keycodes_for_keysym (keys, XKB_KEY_ISO_Next_Group, &keycodes);
|
|
|
2c033f |
+ n_keycodes = get_keycodes_for_keysym (keys, XK_ISO_Next_Group, &keycodes);
|
|
|
2c033f |
|
|
|
2c033f |
if (g_str_equal (iso_next_group_option, "toggle") ||
|
|
|
2c033f |
g_str_equal (iso_next_group_option, "lalt_toggle") ||
|
|
|
2c033f |
@@ -403,7 +404,7 @@ reload_iso_next_group_combos (MetaKeyBindingManager *keys)
|
|
|
2c033f |
|
|
|
2c033f |
for (i = 0; i < n_keycodes; ++i)
|
|
|
2c033f |
{
|
|
|
2c033f |
- combos[i].keysym = XKB_KEY_ISO_Next_Group;
|
|
|
2c033f |
+ combos[i].keysym = XK_ISO_Next_Group;
|
|
|
2c033f |
combos[i].keycode = keycodes[i];
|
|
|
2c033f |
combos[i].modifiers = 0;
|
|
|
2c033f |
}
|
|
|
2c033f |
@@ -416,7 +417,7 @@ reload_iso_next_group_combos (MetaKeyBindingManager *keys)
|
|
|
2c033f |
|
|
|
2c033f |
for (i = 0; i < n_keycodes; ++i)
|
|
|
2c033f |
{
|
|
|
2c033f |
- combos[i].keysym = XKB_KEY_ISO_Next_Group;
|
|
|
2c033f |
+ combos[i].keysym = XK_ISO_Next_Group;
|
|
|
2c033f |
combos[i].keycode = keycodes[i];
|
|
|
2c033f |
combos[i].modifiers = ShiftMask;
|
|
|
2c033f |
}
|
|
|
2c033f |
@@ -429,7 +430,7 @@ reload_iso_next_group_combos (MetaKeyBindingManager *keys)
|
|
|
2c033f |
|
|
|
2c033f |
for (i = 0; i < n_keycodes; ++i)
|
|
|
2c033f |
{
|
|
|
2c033f |
- combos[i].keysym = XKB_KEY_ISO_Next_Group;
|
|
|
2c033f |
+ combos[i].keysym = XK_ISO_Next_Group;
|
|
|
2c033f |
combos[i].keycode = keycodes[i];
|
|
|
2c033f |
combos[i].modifiers = Mod1Mask;
|
|
|
2c033f |
}
|
|
|
2c033f |
@@ -443,11 +444,11 @@ reload_iso_next_group_combos (MetaKeyBindingManager *keys)
|
|
|
2c033f |
|
|
|
2c033f |
for (i = 0; i < n_keycodes; ++i)
|
|
|
2c033f |
{
|
|
|
2c033f |
- combos[i].keysym = XKB_KEY_ISO_Next_Group;
|
|
|
2c033f |
+ combos[i].keysym = XK_ISO_Next_Group;
|
|
|
2c033f |
combos[i].keycode = keycodes[i];
|
|
|
2c033f |
combos[i].modifiers = ShiftMask;
|
|
|
2c033f |
|
|
|
2c033f |
- combos[i + n_keycodes].keysym = XKB_KEY_ISO_Next_Group;
|
|
|
2c033f |
+ combos[i + n_keycodes].keysym = XK_ISO_Next_Group;
|
|
|
2c033f |
combos[i + n_keycodes].keycode = keycodes[i];
|
|
|
2c033f |
combos[i + n_keycodes].modifiers = ControlMask;
|
|
|
2c033f |
}
|
|
|
2c033f |
@@ -459,11 +460,11 @@ reload_iso_next_group_combos (MetaKeyBindingManager *keys)
|
|
|
2c033f |
|
|
|
2c033f |
for (i = 0; i < n_keycodes; ++i)
|
|
|
2c033f |
{
|
|
|
2c033f |
- combos[i].keysym = XKB_KEY_ISO_Next_Group;
|
|
|
2c033f |
+ combos[i].keysym = XK_ISO_Next_Group;
|
|
|
2c033f |
combos[i].keycode = keycodes[i];
|
|
|
2c033f |
combos[i].modifiers = Mod1Mask;
|
|
|
2c033f |
|
|
|
2c033f |
- combos[i + n_keycodes].keysym = XKB_KEY_ISO_Next_Group;
|
|
|
2c033f |
+ combos[i + n_keycodes].keysym = XK_ISO_Next_Group;
|
|
|
2c033f |
combos[i + n_keycodes].keycode = keycodes[i];
|
|
|
2c033f |
combos[i + n_keycodes].modifiers = ControlMask;
|
|
|
2c033f |
}
|
|
|
2c033f |
@@ -476,11 +477,11 @@ reload_iso_next_group_combos (MetaKeyBindingManager *keys)
|
|
|
2c033f |
|
|
|
2c033f |
for (i = 0; i < n_keycodes; ++i)
|
|
|
2c033f |
{
|
|
|
2c033f |
- combos[i].keysym = XKB_KEY_ISO_Next_Group;
|
|
|
2c033f |
+ combos[i].keysym = XK_ISO_Next_Group;
|
|
|
2c033f |
combos[i].keycode = keycodes[i];
|
|
|
2c033f |
combos[i].modifiers = Mod1Mask;
|
|
|
2c033f |
|
|
|
2c033f |
- combos[i + n_keycodes].keysym = XKB_KEY_ISO_Next_Group;
|
|
|
2c033f |
+ combos[i + n_keycodes].keysym = XK_ISO_Next_Group;
|
|
|
2c033f |
combos[i + n_keycodes].keycode = keycodes[i];
|
|
|
2c033f |
combos[i + n_keycodes].modifiers = ShiftMask;
|
|
|
2c033f |
}
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From 6820bec12c9f3c2ce146c9ce7ddf0515fd2fd943 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Tue, 5 May 2015 19:01:20 +0200
|
|
|
2c033f |
Subject: [PATCH 13/16] Revert "keybindings: Use xkb_keysym_get_name"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit db058d4a81af745dee3865965edf9171cd716ad8.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/keybindings.c | 25 ++++++++++++++++---------
|
|
|
2c033f |
1 file changed, 16 insertions(+), 9 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index d77b133..bb5fd33 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -199,14 +199,6 @@ reload_keymap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
&keys->keysyms_per_keycode);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
-static const char *
|
|
|
2c033f |
-keysym_name (xkb_keysym_t keysym)
|
|
|
2c033f |
-{
|
|
|
2c033f |
- static char name[32] = "";
|
|
|
2c033f |
- xkb_keysym_get_name (keysym, name, sizeof (name));
|
|
|
2c033f |
- return name;
|
|
|
2c033f |
-}
|
|
|
2c033f |
-
|
|
|
2c033f |
static void
|
|
|
2c033f |
reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
{
|
|
|
2c033f |
@@ -247,9 +239,12 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
{
|
|
|
2c033f |
if (syms[j] != 0)
|
|
|
2c033f |
{
|
|
|
2c033f |
+ const char *str;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ str = XKeysymToString (syms[j]);
|
|
|
2c033f |
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
2c033f |
"Keysym %s bound to modifier 0x%x\n",
|
|
|
2c033f |
- keysym_name (syms[j]),
|
|
|
2c033f |
+ str ? str : "none",
|
|
|
2c033f |
(1 << ( i / modmap->max_keypermod)));
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
@@ -1205,6 +1200,18 @@ meta_display_shutdown_keys (MetaDisplay *display)
|
|
|
2c033f |
g_hash_table_destroy (keys->key_bindings);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
+static const char*
|
|
|
2c033f |
+keysym_name (int keysym)
|
|
|
2c033f |
+{
|
|
|
2c033f |
+ const char *name;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ name = XKeysymToString (keysym);
|
|
|
2c033f |
+ if (name == NULL)
|
|
|
2c033f |
+ name = "(unknown)";
|
|
|
2c033f |
+
|
|
|
2c033f |
+ return name;
|
|
|
2c033f |
+}
|
|
|
2c033f |
+
|
|
|
2c033f |
/* Grab/ungrab, ignoring all annoying modifiers like NumLock etc. */
|
|
|
2c033f |
static void
|
|
|
2c033f |
meta_change_keygrab (MetaKeyBindingManager *keys,
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From d9af7f17af9e850314b6fdafa81ef15ca130ce85 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Tue, 5 May 2015 19:21:31 +0200
|
|
|
2c033f |
Subject: [PATCH 14/16] Revert "keybindings: Eliminate the use of the stored
|
|
|
2c033f |
modmap"
|
|
|
2c033f |
|
|
|
2c033f |
This reverts commit 15cf804dbcb9978d76c548c91d70dda871dad0df.
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/keybindings-private.h | 1 +
|
|
|
2c033f |
src/core/keybindings.c | 56 +++++++++++++++++++++++-------------------
|
|
|
2c033f |
2 files changed, 32 insertions(+), 25 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/keybindings-private.h b/src/core/keybindings-private.h
|
|
|
2c033f |
index 5cd8c0e..7983dfa 100644
|
|
|
2c033f |
--- a/src/core/keybindings-private.h
|
|
|
2c033f |
+++ b/src/core/keybindings-private.h
|
|
|
2c033f |
@@ -97,6 +97,7 @@ typedef struct
|
|
|
2c033f |
int max_keycode;
|
|
|
2c033f |
KeySym *keymap;
|
|
|
2c033f |
int keysyms_per_keycode;
|
|
|
2c033f |
+ XModifierKeymap *modmap;
|
|
|
2c033f |
unsigned int ignored_modifier_mask;
|
|
|
2c033f |
unsigned int hyper_mask;
|
|
|
2c033f |
unsigned int super_mask;
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index bb5fd33..404e965 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -49,8 +49,6 @@
|
|
|
2c033f |
|
|
|
2c033f |
#include <linux/input.h>
|
|
|
2c033f |
|
|
|
2c033f |
-#include <xkbcommon/xkbcommon.h>
|
|
|
2c033f |
-
|
|
|
2c033f |
#include <X11/XKBlib.h>
|
|
|
2c033f |
|
|
|
2c033f |
#include "backends/x11/meta-backend-x11.h"
|
|
|
2c033f |
@@ -208,7 +206,12 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
int num_lock_mask = 0;
|
|
|
2c033f |
int scroll_lock_mask = 0;
|
|
|
2c033f |
|
|
|
2c033f |
+ if (keys->modmap)
|
|
|
2c033f |
+ XFreeModifiermap (keys->modmap);
|
|
|
2c033f |
+
|
|
|
2c033f |
modmap = XGetModifierMapping (keys->xdisplay);
|
|
|
2c033f |
+ keys->modmap = modmap;
|
|
|
2c033f |
+
|
|
|
2c033f |
keys->ignored_modifier_mask = 0;
|
|
|
2c033f |
|
|
|
2c033f |
/* Multiple bits may get set in each of these */
|
|
|
2c033f |
@@ -296,8 +299,6 @@ reload_modmap (MetaKeyBindingManager *keys)
|
|
|
2c033f |
keys->hyper_mask,
|
|
|
2c033f |
keys->super_mask,
|
|
|
2c033f |
keys->meta_mask);
|
|
|
2c033f |
-
|
|
|
2c033f |
- XFreeModifiermap (modmap);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
/* Original code from gdk_x11_keymap_get_entries_for_keyval() in
|
|
|
2c033f |
@@ -1196,6 +1197,9 @@ meta_display_shutdown_keys (MetaDisplay *display)
|
|
|
2c033f |
|
|
|
2c033f |
meta_XFree (keys->keymap);
|
|
|
2c033f |
|
|
|
2c033f |
+ if (keys->modmap)
|
|
|
2c033f |
+ XFreeModifiermap (keys->modmap);
|
|
|
2c033f |
+
|
|
|
2c033f |
g_hash_table_destroy (keys->key_bindings_index);
|
|
|
2c033f |
g_hash_table_destroy (keys->key_bindings);
|
|
|
2c033f |
}
|
|
|
2c033f |
@@ -1711,28 +1715,29 @@ meta_display_unfreeze_keyboard (MetaDisplay *display, guint32 timestamp)
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
static gboolean
|
|
|
2c033f |
-is_modifier (xkb_keysym_t keysym)
|
|
|
2c033f |
+is_modifier (MetaDisplay *display,
|
|
|
2c033f |
+ unsigned int keycode)
|
|
|
2c033f |
{
|
|
|
2c033f |
- switch (keysym)
|
|
|
2c033f |
+ MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
2c033f |
+ int i;
|
|
|
2c033f |
+ int map_size;
|
|
|
2c033f |
+ gboolean retval = FALSE;
|
|
|
2c033f |
+
|
|
|
2c033f |
+ g_assert (keys->modmap);
|
|
|
2c033f |
+
|
|
|
2c033f |
+ map_size = 8 * keys->modmap->max_keypermod;
|
|
|
2c033f |
+ i = 0;
|
|
|
2c033f |
+ while (i < map_size)
|
|
|
2c033f |
{
|
|
|
2c033f |
- case XKB_KEY_Shift_L:
|
|
|
2c033f |
- case XKB_KEY_Shift_R:
|
|
|
2c033f |
- case XKB_KEY_Control_L:
|
|
|
2c033f |
- case XKB_KEY_Control_R:
|
|
|
2c033f |
- case XKB_KEY_Caps_Lock:
|
|
|
2c033f |
- case XKB_KEY_Shift_Lock:
|
|
|
2c033f |
- case XKB_KEY_Meta_L:
|
|
|
2c033f |
- case XKB_KEY_Meta_R:
|
|
|
2c033f |
- case XKB_KEY_Alt_L:
|
|
|
2c033f |
- case XKB_KEY_Alt_R:
|
|
|
2c033f |
- case XKB_KEY_Super_L:
|
|
|
2c033f |
- case XKB_KEY_Super_R:
|
|
|
2c033f |
- case XKB_KEY_Hyper_L:
|
|
|
2c033f |
- case XKB_KEY_Hyper_R:
|
|
|
2c033f |
- return TRUE;
|
|
|
2c033f |
- default:
|
|
|
2c033f |
- return FALSE;
|
|
|
2c033f |
+ if (keycode == keys->modmap->modifiermap[i])
|
|
|
2c033f |
+ {
|
|
|
2c033f |
+ retval = TRUE;
|
|
|
2c033f |
+ break;
|
|
|
2c033f |
+ }
|
|
|
2c033f |
+ ++i;
|
|
|
2c033f |
}
|
|
|
2c033f |
+
|
|
|
2c033f |
+ return retval;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
static void
|
|
|
2c033f |
@@ -2141,7 +2146,7 @@ process_keyboard_move_grab (MetaDisplay *display,
|
|
|
2c033f |
return TRUE;
|
|
|
2c033f |
|
|
|
2c033f |
/* don't end grab on modifier key presses */
|
|
|
2c033f |
- if (is_modifier (event->keyval))
|
|
|
2c033f |
+ if (is_modifier (display, event->hardware_keycode))
|
|
|
2c033f |
return TRUE;
|
|
|
2c033f |
|
|
|
2c033f |
meta_window_get_frame_rect (window, &frame_rect);
|
|
|
2c033f |
@@ -2381,7 +2386,7 @@ process_keyboard_resize_grab (MetaDisplay *display,
|
|
|
2c033f |
return TRUE;
|
|
|
2c033f |
|
|
|
2c033f |
/* don't end grab on modifier key presses */
|
|
|
2c033f |
- if (is_modifier (event->keyval))
|
|
|
2c033f |
+ if (is_modifier (display, event->hardware_keycode))
|
|
|
2c033f |
return TRUE;
|
|
|
2c033f |
|
|
|
2c033f |
if (event->keyval == CLUTTER_KEY_Escape)
|
|
|
2c033f |
@@ -4099,6 +4104,7 @@ meta_display_init_keys (MetaDisplay *display)
|
|
|
2c033f |
keys->xdisplay = display->xdisplay;
|
|
|
2c033f |
keys->keymap = NULL;
|
|
|
2c033f |
keys->keysyms_per_keycode = 0;
|
|
|
2c033f |
+ keys->modmap = NULL;
|
|
|
2c033f |
keys->min_keycode = 0;
|
|
|
2c033f |
keys->max_keycode = 0;
|
|
|
2c033f |
keys->ignored_modifier_mask = 0;
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From 6598ece2747ef1a85f4688fd4ed607f63f4cb591 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Wed, 5 Nov 2014 18:53:22 +0100
|
|
|
2c033f |
Subject: [PATCH 15/16] Stop using xkbcommon
|
|
|
2c033f |
|
|
|
2c033f |
Now that we reverted all the patches that made us hard depend on
|
|
|
2c033f |
xkbcommon we can finally remove the last bits that still use it on the
|
|
|
2c033f |
code paths we're interested in.
|
|
|
2c033f |
|
|
|
2c033f |
Note that this won't build if the native backend or the wayland
|
|
|
2c033f |
frontend is enabled.
|
|
|
2c033f |
---
|
|
|
2c033f |
configure.ac | 3 ---
|
|
|
2c033f |
src/backends/meta-backend-private.h | 6 -----
|
|
|
2c033f |
src/backends/meta-backend.c | 10 -------
|
|
|
2c033f |
src/backends/x11/meta-backend-x11.c | 54 +++++++------------------------------
|
|
|
2c033f |
4 files changed, 9 insertions(+), 64 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/configure.ac b/configure.ac
|
|
|
2c033f |
index f63ffc2..871fbc9 100644
|
|
|
2c033f |
--- a/configure.ac
|
|
|
2c033f |
+++ b/configure.ac
|
|
|
2c033f |
@@ -88,9 +88,6 @@ MUTTER_PC_MODULES="
|
|
|
2c033f |
xi >= 1.6.0
|
|
|
2c033f |
xkbfile
|
|
|
2c033f |
xkeyboard-config
|
|
|
2c033f |
- xkbcommon >= 0.4.3
|
|
|
2c033f |
- xkbcommon-x11
|
|
|
2c033f |
- x11-xcb
|
|
|
2c033f |
xcb-randr
|
|
|
2c033f |
"
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h
|
|
|
2c033f |
index bd665c1..b9bfe21 100644
|
|
|
2c033f |
--- a/src/backends/meta-backend-private.h
|
|
|
2c033f |
+++ b/src/backends/meta-backend-private.h
|
|
|
2c033f |
@@ -28,8 +28,6 @@
|
|
|
2c033f |
|
|
|
2c033f |
#include <glib-object.h>
|
|
|
2c033f |
|
|
|
2c033f |
-#include <xkbcommon/xkbcommon.h>
|
|
|
2c033f |
-
|
|
|
2c033f |
#include <meta/meta-backend.h>
|
|
|
2c033f |
#include <meta/meta-idle-monitor.h>
|
|
|
2c033f |
#include "meta-cursor-renderer.h"
|
|
|
2c033f |
@@ -80,8 +78,6 @@ struct _MetaBackendClass
|
|
|
2c033f |
const char *variants,
|
|
|
2c033f |
const char *options);
|
|
|
2c033f |
|
|
|
2c033f |
- struct xkb_keymap * (* get_keymap) (MetaBackend *backend);
|
|
|
2c033f |
-
|
|
|
2c033f |
void (* lock_layout_group) (MetaBackend *backend,
|
|
|
2c033f |
guint idx);
|
|
|
2c033f |
|
|
|
2c033f |
@@ -105,6 +101,4 @@ void meta_backend_warp_pointer (MetaBackend *backend,
|
|
|
2c033f |
int x,
|
|
|
2c033f |
int y);
|
|
|
2c033f |
|
|
|
2c033f |
-struct xkb_keymap * meta_backend_get_keymap (MetaBackend *backend);
|
|
|
2c033f |
-
|
|
|
2c033f |
#endif /* META_BACKEND_PRIVATE_H */
|
|
|
2c033f |
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
|
|
|
2c033f |
index a3b74ed..f2a36e1 100644
|
|
|
2c033f |
--- a/src/backends/meta-backend.c
|
|
|
2c033f |
+++ b/src/backends/meta-backend.c
|
|
|
2c033f |
@@ -350,16 +350,6 @@ meta_backend_set_keymap (MetaBackend *backend,
|
|
|
2c033f |
META_BACKEND_GET_CLASS (backend)->set_keymap (backend, layouts, variants, options);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
-/**
|
|
|
2c033f |
- * meta_backend_get_keymap: (skip)
|
|
|
2c033f |
- */
|
|
|
2c033f |
-struct xkb_keymap *
|
|
|
2c033f |
-meta_backend_get_keymap (MetaBackend *backend)
|
|
|
2c033f |
-
|
|
|
2c033f |
-{
|
|
|
2c033f |
- return META_BACKEND_GET_CLASS (backend)->get_keymap (backend);
|
|
|
2c033f |
-}
|
|
|
2c033f |
-
|
|
|
2c033f |
void
|
|
|
2c033f |
meta_backend_lock_layout_group (MetaBackend *backend,
|
|
|
2c033f |
guint idx)
|
|
|
2c033f |
diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c
|
|
|
2c033f |
index fa99e0d..586f991 100644
|
|
|
2c033f |
--- a/src/backends/x11/meta-backend-x11.c
|
|
|
2c033f |
+++ b/src/backends/x11/meta-backend-x11.c
|
|
|
2c033f |
@@ -34,8 +34,6 @@
|
|
|
2c033f |
#include <X11/extensions/sync.h>
|
|
|
2c033f |
#include <X11/XKBlib.h>
|
|
|
2c033f |
#include <X11/extensions/XKBrules.h>
|
|
|
2c033f |
-#include <X11/Xlib-xcb.h>
|
|
|
2c033f |
-#include <xkbcommon/xkbcommon-x11.h>
|
|
|
2c033f |
|
|
|
2c033f |
#include "meta-idle-monitor-xsync.h"
|
|
|
2c033f |
#include "meta-monitor-manager-xrandr.h"
|
|
|
2c033f |
@@ -50,7 +48,6 @@ struct _MetaBackendX11Private
|
|
|
2c033f |
{
|
|
|
2c033f |
/* The host X11 display */
|
|
|
2c033f |
Display *xdisplay;
|
|
|
2c033f |
- xcb_connection_t *xcb;
|
|
|
2c033f |
GSource *source;
|
|
|
2c033f |
|
|
|
2c033f |
int xsync_event_base;
|
|
|
2c033f |
@@ -61,10 +58,9 @@ struct _MetaBackendX11Private
|
|
|
2c033f |
int xinput_error_base;
|
|
|
2c033f |
Time latest_evtime;
|
|
|
2c033f |
|
|
|
2c033f |
- uint8_t xkb_event_base;
|
|
|
2c033f |
- uint8_t xkb_error_base;
|
|
|
2c033f |
+ int xkb_event_base;
|
|
|
2c033f |
+ int xkb_error_base;
|
|
|
2c033f |
|
|
|
2c033f |
- struct xkb_keymap *keymap;
|
|
|
2c033f |
gchar *keymap_layouts;
|
|
|
2c033f |
gchar *keymap_variants;
|
|
|
2c033f |
gchar *keymap_options;
|
|
|
2c033f |
@@ -166,15 +162,6 @@ maybe_spoof_event_as_stage_event (MetaBackendX11 *x11,
|
|
|
2c033f |
static void
|
|
|
2c033f |
keymap_changed (MetaBackend *backend)
|
|
|
2c033f |
{
|
|
|
2c033f |
- MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
|
|
|
2c033f |
- MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
|
|
|
2c033f |
-
|
|
|
2c033f |
- if (priv->keymap)
|
|
|
2c033f |
- {
|
|
|
2c033f |
- xkb_keymap_unref (priv->keymap);
|
|
|
2c033f |
- priv->keymap = NULL;
|
|
|
2c033f |
- }
|
|
|
2c033f |
-
|
|
|
2c033f |
g_signal_emit_by_name (backend, "keymap-changed", 0);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
@@ -381,16 +368,13 @@ meta_backend_x11_post_init (MetaBackend *backend)
|
|
|
2c033f |
|
|
|
2c033f |
take_touch_grab (backend);
|
|
|
2c033f |
|
|
|
2c033f |
- priv->xcb = XGetXCBConnection (priv->xdisplay);
|
|
|
2c033f |
- if (!xkb_x11_setup_xkb_extension (priv->xcb,
|
|
|
2c033f |
- XKB_X11_MIN_MAJOR_XKB_VERSION,
|
|
|
2c033f |
- XKB_X11_MIN_MINOR_XKB_VERSION,
|
|
|
2c033f |
- XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS,
|
|
|
2c033f |
- NULL, NULL,
|
|
|
2c033f |
- &priv->xkb_event_base,
|
|
|
2c033f |
- &priv->xkb_error_base))
|
|
|
2c033f |
- meta_fatal ("X server doesn't have the XKB extension, version %d.%d or newer\n",
|
|
|
2c033f |
- XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION);
|
|
|
2c033f |
+ if (!XkbQueryExtension (priv->xdisplay,
|
|
|
2c033f |
+ NULL,
|
|
|
2c033f |
+ &priv->xkb_event_base,
|
|
|
2c033f |
+ &priv->xkb_error_base,
|
|
|
2c033f |
+ NULL,
|
|
|
2c033f |
+ NULL))
|
|
|
2c033f |
+ meta_fatal ("X server doesn't have the XKB extension");
|
|
|
2c033f |
|
|
|
2c033f |
g_signal_connect_object (clutter_device_manager_get_default (), "device-added",
|
|
|
2c033f |
G_CALLBACK (on_device_added), backend, 0);
|
|
|
2c033f |
@@ -637,25 +621,6 @@ meta_backend_x11_set_keymap (MetaBackend *backend,
|
|
|
2c033f |
apply_keymap (x11);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
-static struct xkb_keymap *
|
|
|
2c033f |
-meta_backend_x11_get_keymap (MetaBackend *backend)
|
|
|
2c033f |
-{
|
|
|
2c033f |
- MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
|
|
|
2c033f |
- MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
|
|
|
2c033f |
-
|
|
|
2c033f |
- if (priv->keymap == NULL)
|
|
|
2c033f |
- {
|
|
|
2c033f |
- struct xkb_context *context = xkb_context_new (XKB_CONTEXT_NO_FLAGS);
|
|
|
2c033f |
- priv->keymap = xkb_x11_keymap_new_from_device (context,
|
|
|
2c033f |
- priv->xcb,
|
|
|
2c033f |
- xkb_x11_get_core_keyboard_device_id (priv->xcb),
|
|
|
2c033f |
- XKB_KEYMAP_COMPILE_NO_FLAGS);
|
|
|
2c033f |
- xkb_context_unref (context);
|
|
|
2c033f |
- }
|
|
|
2c033f |
-
|
|
|
2c033f |
- return priv->keymap;
|
|
|
2c033f |
-}
|
|
|
2c033f |
-
|
|
|
2c033f |
static void
|
|
|
2c033f |
meta_backend_x11_lock_layout_group (MetaBackend *backend,
|
|
|
2c033f |
guint idx)
|
|
|
2c033f |
@@ -723,7 +688,6 @@ meta_backend_x11_class_init (MetaBackendX11Class *klass)
|
|
|
2c033f |
backend_class->ungrab_device = meta_backend_x11_ungrab_device;
|
|
|
2c033f |
backend_class->warp_pointer = meta_backend_x11_warp_pointer;
|
|
|
2c033f |
backend_class->set_keymap = meta_backend_x11_set_keymap;
|
|
|
2c033f |
- backend_class->get_keymap = meta_backend_x11_get_keymap;
|
|
|
2c033f |
backend_class->lock_layout_group = meta_backend_x11_lock_layout_group;
|
|
|
2c033f |
backend_class->update_screen_size = meta_backend_x11_update_screen_size;
|
|
|
2c033f |
backend_class->select_stage_events = meta_backend_x11_select_stage_events;
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|
|
|
2c033f |
|
|
|
2c033f |
From 41261d54978c24f2bcc0f3045f97c7cde8815706 Mon Sep 17 00:00:00 2001
|
|
|
2c033f |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2c033f |
Date: Thu, 6 Nov 2014 13:30:51 +0100
|
|
|
2c033f |
Subject: [PATCH 16/16] keybindings: Fix keysym to keycode lookup
|
|
|
2c033f |
|
|
|
2c033f |
This partially reverts 1d08d751086c4b0a112f79c7543425809a9a736a to fix
|
|
|
2c033f |
the keycode lookup order as in the reverted
|
|
|
2c033f |
60c22b62366d737f7f6eabe7d46fa682c6f400d7 .
|
|
|
2c033f |
---
|
|
|
2c033f |
src/core/keybindings.c | 25 ++++---------------------
|
|
|
2c033f |
1 file changed, 4 insertions(+), 21 deletions(-)
|
|
|
2c033f |
|
|
|
2c033f |
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
|
|
|
2c033f |
index 404e965..28d7d04 100644
|
|
|
2c033f |
--- a/src/core/keybindings.c
|
|
|
2c033f |
+++ b/src/core/keybindings.c
|
|
|
2c033f |
@@ -314,14 +314,6 @@ get_keycodes_for_keysym (MetaKeyBindingManager *keys,
|
|
|
2c033f |
|
|
|
2c033f |
retval = g_array_new (FALSE, FALSE, sizeof (int));
|
|
|
2c033f |
|
|
|
2c033f |
- /* Special-case: Fake mutter keysym */
|
|
|
2c033f |
- if (keysym == META_KEY_ABOVE_TAB)
|
|
|
2c033f |
- {
|
|
|
2c033f |
- keycode = KEY_GRAVE + 8;
|
|
|
2c033f |
- g_array_append_val (retval, keycode);
|
|
|
2c033f |
- goto out;
|
|
|
2c033f |
- }
|
|
|
2c033f |
-
|
|
|
2c033f |
keycode = keys->min_keycode;
|
|
|
2c033f |
while (keycode <= keys->max_keycode)
|
|
|
2c033f |
{
|
|
|
2c033f |
@@ -339,7 +331,6 @@ get_keycodes_for_keysym (MetaKeyBindingManager *keys,
|
|
|
2c033f |
++keycode;
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
- out:
|
|
|
2c033f |
n_keycodes = retval->len;
|
|
|
2c033f |
*keycodes = (int*) g_array_free (retval, n_keycodes == 0 ? TRUE : FALSE);
|
|
|
2c033f |
return n_keycodes;
|
|
|
2c033f |
@@ -349,19 +340,11 @@ static guint
|
|
|
2c033f |
get_first_keycode_for_keysym (MetaKeyBindingManager *keys,
|
|
|
2c033f |
guint keysym)
|
|
|
2c033f |
{
|
|
|
2c033f |
- int *keycodes;
|
|
|
2c033f |
- int n_keycodes;
|
|
|
2c033f |
- int keycode;
|
|
|
2c033f |
-
|
|
|
2c033f |
- n_keycodes = get_keycodes_for_keysym (keys, keysym, &keycodes);
|
|
|
2c033f |
-
|
|
|
2c033f |
- if (n_keycodes > 0)
|
|
|
2c033f |
- keycode = keycodes[0];
|
|
|
2c033f |
+ /* Special-case: Fake mutter keysym */
|
|
|
2c033f |
+ if (keysym == META_KEY_ABOVE_TAB)
|
|
|
2c033f |
+ return KEY_GRAVE + 8;
|
|
|
2c033f |
else
|
|
|
2c033f |
- keycode = 0;
|
|
|
2c033f |
-
|
|
|
2c033f |
- g_free (keycodes);
|
|
|
2c033f |
- return keycode;
|
|
|
2c033f |
+ return XKeysymToKeycode (keys->xdisplay, keysym);
|
|
|
2c033f |
}
|
|
|
2c033f |
|
|
|
2c033f |
static void
|
|
|
2c033f |
--
|
|
|
2c033f |
2.3.6
|
|
|
2c033f |
|