summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2020-04-08 11:43:23 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2020-04-30 16:52:40 +0200
commit129d1347044731d0d43c3f77b7a901a54e6cc271 (patch)
tree429716a4cece019308ea55dd0c21b05f1870a37c
parent4078ba182849003584567584708a08cd846b1e80 (diff)
downloadmutter-129d1347044731d0d43c3f77b7a901a54e6cc271.tar.gz
wayland: preserve `xkb_state` on VT switch
On VT switch, the devices are removed, which means for Wayland disabling the keyboard. When the keyboard is disabled, the associated `xkb_state` is freed and recreated whenever the keyboard is re-enabled when switching back to the compositor VT. That means the `xkb_state` for Wayland is lost whereas the same for clutter is kept, which causes to a discrepancy with locked modifiers on VT switch. To avoid that issue, preserve the XKB info only to dispose it when the keyboard is eventually finalized. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/344 https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1185 (cherry picked from commit 5b30a52bbda87f903d7008d09d1d70cd750cac4a)
-rw-r--r--src/wayland/meta-wayland-keyboard.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index d74ef0dfa..1cde419c7 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -599,7 +599,6 @@ meta_wayland_keyboard_disable (MetaWaylandKeyboard *keyboard)
meta_wayland_keyboard_end_grab (keyboard);
meta_wayland_keyboard_set_focus (keyboard, NULL);
- meta_wayland_xkb_info_destroy (&keyboard->xkb_info);
wl_list_remove (&keyboard->resource_list);
wl_list_init (&keyboard->resource_list);
@@ -914,6 +913,17 @@ meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard)
}
static void
+meta_wayland_keyboard_finalize (GObject *object)
+{
+ MetaWaylandKeyboard *keyboard = META_WAYLAND_KEYBOARD (object);
+
+ meta_wayland_xkb_info_destroy (&keyboard->xkb_info);
+}
+
+static void
meta_wayland_keyboard_class_init (MetaWaylandKeyboardClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = meta_wayland_keyboard_finalize;
}