[mutter] keybindings: Keep a pointer to the backend
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] keybindings: Keep a pointer to the backend
- Date: Mon, 25 Sep 2017 19:34:19 +0000 (UTC)
commit 27d6c063ad58cc311e977548cc52c85f2ba367c9
Author: Jonas Ådahl <jadahl gmail com>
Date: Fri Sep 1 17:45:08 2017 +0800
keybindings: Keep a pointer to the backend
A few less singleton getting.
https://bugzilla.gnome.org/show_bug.cgi?id=787016
src/core/keybindings-private.h | 2 ++
src/core/keybindings.c | 17 ++++++++---------
2 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/core/keybindings-private.h b/src/core/keybindings-private.h
index dab43c8..5853965 100644
--- a/src/core/keybindings-private.h
+++ b/src/core/keybindings-private.h
@@ -91,6 +91,8 @@ typedef struct
typedef struct
{
+ MetaBackend *backend;
+
GHashTable *key_bindings;
GHashTable *key_bindings_index;
xkb_mod_mask_t ignored_modifier_mask;
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 26c7817..5214381 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -229,8 +229,7 @@ key_combo_key (MetaResolvedKeyCombo *resolved_combo,
static void
reload_modmap (MetaKeyBindingManager *keys)
{
- MetaBackend *backend = meta_get_backend ();
- struct xkb_keymap *keymap = meta_backend_get_keymap (backend);
+ struct xkb_keymap *keymap = meta_backend_get_keymap (keys->backend);
struct xkb_state *scratch_state;
xkb_mod_mask_t scroll_lock_mask;
xkb_mod_mask_t dummy_mask;
@@ -347,7 +346,6 @@ get_keycodes_for_keysym (MetaKeyBindingManager *keys,
int keysym,
MetaResolvedKeyCombo *resolved_combo)
{
- MetaBackend *backend = meta_get_backend ();
struct xkb_keymap *keymap;
xkb_layout_index_t layout_index;
xkb_level_index_t layout_level;
@@ -364,8 +362,8 @@ get_keycodes_for_keysym (MetaKeyBindingManager *keys,
goto out;
}
- keymap = meta_backend_get_keymap (backend);
- layout_index = meta_backend_get_keymap_layout_group (backend);
+ keymap = meta_backend_get_keymap (keys->backend);
+ layout_index = meta_backend_get_keymap_layout_group (keys->backend);
for (layout_level = 0; layout_level < keys->keymap_num_levels; layout_level++)
{
@@ -405,8 +403,7 @@ determine_keymap_num_levels_iter (struct xkb_keymap *keymap,
static void
determine_keymap_num_levels (MetaKeyBindingManager *keys)
{
- MetaBackend *backend = meta_get_backend ();
- struct xkb_keymap *keymap = meta_backend_get_keymap (backend);
+ struct xkb_keymap *keymap = meta_backend_get_keymap (keys->backend);
keys->keymap_num_levels = 0;
xkb_keymap_key_for_each (keymap, determine_keymap_num_levels_iter, &keys->keymap_num_levels);
@@ -996,7 +993,7 @@ meta_change_button_grab (MetaKeyBindingManager *keys,
if (meta_is_wayland_compositor ())
return;
- MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
+ MetaBackendX11 *backend = META_BACKEND_X11 (keys->backend);
Display *xdisplay = meta_backend_x11_get_xdisplay (backend);
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
@@ -1767,7 +1764,7 @@ process_overlay_key (MetaDisplay *display,
MetaWindow *window)
{
MetaKeyBindingManager *keys = &display->key_binding_manager;
- MetaBackend *backend = meta_get_backend ();
+ MetaBackend *backend = keys->backend;
Display *xdisplay;
if (META_IS_BACKEND_X11 (backend))
@@ -4164,6 +4161,8 @@ meta_display_init_keys (MetaDisplay *display)
MetaBackend *backend = meta_get_backend ();
MetaKeyHandler *handler;
+ keys->backend = backend;
+
/* Keybindings */
keys->ignored_modifier_mask = 0;
keys->hyper_mask = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]