From nobody Tue Feb 10 17:08:28 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1523352620515843.3533911245203; Tue, 10 Apr 2018 02:30:20 -0700 (PDT) Received: from localhost ([::1]:57117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5pbX-0001ST-MU for importer@patchew.org; Tue, 10 Apr 2018 05:30:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5pWD-0004ja-Ur for qemu-devel@nongnu.org; Tue, 10 Apr 2018 05:24:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5pWD-0006Ve-0F for qemu-devel@nongnu.org; Tue, 10 Apr 2018 05:24:49 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46880 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5pWC-0006UA-SU for qemu-devel@nongnu.org; Tue, 10 Apr 2018 05:24:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 247F27C6DC for ; Tue, 10 Apr 2018 09:24:48 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-121.ams2.redhat.com [10.36.116.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id B09E02140625; Tue, 10 Apr 2018 09:24:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B7E309C3E5; Tue, 10 Apr 2018 11:24:46 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 11:24:43 +0200 Message-Id: <20180410092446.26903-2-kraxel@redhat.com> In-Reply-To: <20180410092446.26903-1-kraxel@redhat.com> References: <20180410092446.26903-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 10 Apr 2018 09:24:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 10 Apr 2018 09:24:48 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 1/4] ui: fix keymap detection under Xwayland X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Daniel P. Berrang=C3=A9 The X11 code currently detects the keymap by looking for the keycode name property. Unfortunately due to the way Xwayland handles keyboards, this property gets unset almost immediately after the first application starts using Xwayland resulting in ** (qemu-system-x86_64:19644): WARNING **: Unknown X11 keycode mapping '(= unnamed)'. Please report to qemu-devel@nongnu.org including the following information: - Operating system - X11 Server - xprop -root - xdpyinfo Fortunately people will only see this problem if they built QEMU with GTK2, or have told GTK3 to prefer X11 by setting the GDK_BACKEND=3Dx11 env variable. To workaround the problem, we add a heuristic that looks at what scancode the XK_Page_Up keysymbol maps to, to determine if we've likely got the X11 kbd or evdev driver. Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20180313104235.20725-1-berrange@redhat.com> Signed-off-by: Gerd Hoffmann --- ui/x_keymap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/x_keymap.c b/ui/x_keymap.c index 22e0e77c4d..2bc01432e5 100644 --- a/ui/x_keymap.c +++ b/ui/x_keymap.c @@ -17,6 +17,7 @@ #include "ui/input.h" =20 #include +#include =20 static gboolean check_for_xwin(Display *dpy) { @@ -87,11 +88,13 @@ const guint16 *qemu_xkeymap_mapping_table(Display *dpy,= size_t *maplen) trace_xkeymap_keymap("xquartz"); *maplen =3D qemu_input_map_xorgxquartz_to_qcode_len; return qemu_input_map_xorgxquartz_to_qcode; - } else if (keycodes && g_str_has_prefix(keycodes, "evdev")) { + } else if ((keycodes && g_str_has_prefix(keycodes, "evdev")) || + (XKeysymToKeycode(dpy, XK_Page_Up) =3D=3D 0x70)) { trace_xkeymap_keymap("evdev"); *maplen =3D qemu_input_map_xorgevdev_to_qcode_len; return qemu_input_map_xorgevdev_to_qcode; - } else if (keycodes && g_str_has_prefix(keycodes, "xfree86")) { + } else if ((keycodes && g_str_has_prefix(keycodes, "xfree86")) || + (XKeysymToKeycode(dpy, XK_Page_Up) =3D=3D 0x63)) { trace_xkeymap_keymap("kbd"); *maplen =3D qemu_input_map_xorgkbd_to_qcode_len; return qemu_input_map_xorgkbd_to_qcode; --=20 2.9.3