9e2c567
From 170c95978530f6373bdf4488116902b273f3abf4 Mon Sep 17 00:00:00 2001
9e2c567
From: Olivier Fourdan <ofourdan@redhat.com>
9e2c567
Date: Fri, 15 Dec 2017 16:43:47 +0100
9e2c567
Subject: [PATCH xserver] xwayland: avoid race condition on new keymap
9e2c567
MIME-Version: 1.0
9e2c567
Content-Type: text/plain; charset=UTF-8
9e2c567
Content-Transfer-Encoding: 8bit
9e2c567
9e2c567
When the Wayland compositor notifies of a new keymap, for the first X11
9e2c567
client using the keyboard, the last slave keyboard used might still not
9e2c567
be set (i.e. “lastSlave” is still NULL).
9e2c567
9e2c567
As a result, the new keymap is not applied, and the first X11 window
9e2c567
will have the wrong keymap set initially.
9e2c567
9e2c567
Apply the new keymap to the master keyboard as long as there's one.
9e2c567
9e2c567
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=791383
9e2c567
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
9e2c567
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9e2c567
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9e2c567
---
9e2c567
 hw/xwayland/xwayland-input.c | 2 +-
9e2c567
 1 file changed, 1 insertion(+), 1 deletion(-)
9e2c567
9e2c567
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
9e2c567
index 439903032..c613690cd 100644
9e2c567
--- a/hw/xwayland/xwayland-input.c
9e2c567
+++ b/hw/xwayland/xwayland-input.c
9e2c567
@@ -710,7 +710,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
9e2c567
     XkbDeviceApplyKeymap(xwl_seat->keyboard, xkb);
9e2c567
 
9e2c567
     master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD);
9e2c567
-    if (master && master->lastSlave == xwl_seat->keyboard)
9e2c567
+    if (master)
9e2c567
         XkbDeviceApplyKeymap(master, xkb);
9e2c567
 
9e2c567
     XkbFreeKeyboard(xkb, XkbAllComponentsMask, TRUE);
9e2c567
-- 
9e2c567
2.14.3
9e2c567