[mutter/gnome-3-36] wayland: preserve `xkb_state` on VT switch



commit 9a2471db477becded8c1529b83305901b6377ccf
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Wed Apr 8 09:43:23 2020 +0000

    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)

 src/wayland/meta-wayland-keyboard.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index 671bd3ab6..6b6c1f778 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -603,7 +603,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);
@@ -917,7 +916,18 @@ meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard)
     keyboard_handle_focus_surface_destroy;
 }
 
+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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]