From nobody Fri Nov 14 19:22:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589964458; cv=none; d=zohomail.com; s=zohoarc; b=eVSwvvtA0hfhZw81NO7S0PmUbXe6Qo3y+dVlsMvj+czN0EFhEXi8D9olniTo6ogNpYhPnLzb3REdTW5yM3qWpu9nbOGu7jde8OvWi0BnB3FX2UvtSit/aNIw3bJPu2ZPk0CD7Qibd9NWh60qS5jd/T9VsciZJaQn4p7lNdxAaoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589964458; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OhK5I6KM/fZFgDx8mOenKdAqjvyDlPH6uluHWhkizGE=; b=CJH4/LJ5qlglBBpNQZnhtoZLBjYZ/aZIncYgw81tyTUFIANZk7rbvSN9w7cjznEnkvpjn5PfRn7oCZOrUj6dkCkut1O5mvHNh2/0/Il9MyB2jTl3yP/NFgEaRmb4HWByJ27u3Sqzlc/PeFnMAREl6/agRlAyaBX46kURgKJyKwA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589964458879328.9916823677112; Wed, 20 May 2020 01:47:38 -0700 (PDT) Received: from localhost ([::1]:50614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbKO1-0001oI-O3 for importer@patchew.org; Wed, 20 May 2020 04:47:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbKK3-0001Ny-2y for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:31 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33846 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jbKK1-0006dh-4h for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:30 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-182-OWSb5vYkMQiCIxxSzdaXrw-1; Wed, 20 May 2020 04:43:22 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1378E8015CE; Wed, 20 May 2020 08:43:21 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-50.ams2.redhat.com [10.36.113.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DD5260C05; Wed, 20 May 2020 08:43:17 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 80C8A9DAD; Wed, 20 May 2020 10:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589964208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OhK5I6KM/fZFgDx8mOenKdAqjvyDlPH6uluHWhkizGE=; b=K9TQc3/fIY499Cp7DeTU3Mzi/cwa1zSo5EIFWz7yXOByumh/sEXXA2MvB9yJjuCpSQD/S8 wZ4fn4E+rqtwm6uiyj5N9gxWaL9YzJEewVonjBf4Lzbysvg5h53mhJGaoRgam5fjn0LUby hcPOXf8g3G6S3GtLIHQePjThDiMRNeQ= X-MC-Unique: OWSb5vYkMQiCIxxSzdaXrw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 01/11] ui/win32-kbd-hook: handle AltGr in a hook procedure Date: Wed, 20 May 2020 10:43:06 +0200 Message-Id: <20200520084316.22057-2-kraxel@redhat.com> In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com> References: <20200520084316.22057-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/19 22:48:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin Import win32 keyboard hooking code from project spice-gtk. This patch removes the extra left control key up/down input events inserted by Windows for the right alt key up/down input events with international keyboard layouts. Additionally there's some code to grab the keyboard. The next patches will use this code. Only Windows needs this. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200516072014.7766-1-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- include/ui/win32-kbd-hook.h | 14 +++++ stubs/win32-kbd-hook.c | 18 +++++++ ui/win32-kbd-hook.c | 102 ++++++++++++++++++++++++++++++++++++ stubs/Makefile.objs | 1 + ui/Makefile.objs | 3 ++ 5 files changed, 138 insertions(+) create mode 100644 include/ui/win32-kbd-hook.h create mode 100644 stubs/win32-kbd-hook.c create mode 100644 ui/win32-kbd-hook.c diff --git a/include/ui/win32-kbd-hook.h b/include/ui/win32-kbd-hook.h new file mode 100644 index 000000000000..4bd9f00f973f --- /dev/null +++ b/include/ui/win32-kbd-hook.h @@ -0,0 +1,14 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#ifndef UI_WIN32_KBD_HOOK_H +#define UI_WIN32_KBD_HOOK_H + +void win32_kbd_set_window(void *hwnd); +void win32_kbd_set_grab(bool grab); + +#endif diff --git a/stubs/win32-kbd-hook.c b/stubs/win32-kbd-hook.c new file mode 100644 index 000000000000..1a084b081ab6 --- /dev/null +++ b/stubs/win32-kbd-hook.c @@ -0,0 +1,18 @@ +/* + * Win32 keyboard hook stubs + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#include "qemu/osdep.h" +#include "ui/win32-kbd-hook.h" + +void win32_kbd_set_window(void *hwnd) +{ +} + +void win32_kbd_set_grab(bool grab) +{ +} diff --git a/ui/win32-kbd-hook.c b/ui/win32-kbd-hook.c new file mode 100644 index 000000000000..1ac237db9e9d --- /dev/null +++ b/ui/win32-kbd-hook.c @@ -0,0 +1,102 @@ +/* + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + * + * The win32 keyboard hooking code was imported from project spice-gtk. + */ + +#include "qemu/osdep.h" +#include "sysemu/sysemu.h" +#include "ui/win32-kbd-hook.h" + +static Notifier win32_unhook_notifier; +static HHOOK win32_keyboard_hook; +static HWND win32_window; +static DWORD win32_grab; + +static LRESULT CALLBACK keyboard_hook_cb(int code, WPARAM wparam, LPARAM l= param) +{ + if (win32_window && code =3D=3D HC_ACTION && win32_window =3D=3D GetF= ocus()) { + KBDLLHOOKSTRUCT *hooked =3D (KBDLLHOOKSTRUCT *)lparam; + + if (wparam !=3D WM_KEYUP) { + DWORD dwmsg =3D (hooked->flags << 24) | + ((hooked->scanCode & 0xff) << 16) | 1; + + switch (hooked->vkCode) { + case VK_CAPITAL: + /* fall through */ + case VK_SCROLL: + /* fall through */ + case VK_NUMLOCK: + /* fall through */ + case VK_LSHIFT: + /* fall through */ + case VK_RSHIFT: + /* fall through */ + case VK_RCONTROL: + /* fall through */ + case VK_LMENU: + /* fall through */ + case VK_RMENU: + break; + + case VK_LCONTROL: + /* + * When pressing AltGr, an extra VK_LCONTROL with a special + * scancode with bit 9 set is sent. Let's ignore the extra + * VK_LCONTROL, as that will make AltGr misbehave. + */ + if (hooked->scanCode & 0x200) { + return 1; + } + break; + + default: + if (win32_grab) { + SendMessage(win32_window, wparam, hooked->vkCode, dwms= g); + return 1; + } + break; + } + + } else { + switch (hooked->vkCode) { + case VK_LCONTROL: + if (hooked->scanCode & 0x200) { + return 1; + } + break; + } + } + } + + return CallNextHookEx(NULL, code, wparam, lparam); +} + +static void keyboard_hook_unhook(Notifier *n, void *data) +{ + UnhookWindowsHookEx(win32_keyboard_hook); + win32_keyboard_hook =3D NULL; +} + +void win32_kbd_set_window(void *hwnd) +{ + if (hwnd && !win32_keyboard_hook) { + /* note: the installing thread must have a message loop */ + win32_keyboard_hook =3D SetWindowsHookEx(WH_KEYBOARD_LL, keyboard_= hook_cb, + GetModuleHandle(NULL), 0); + if (win32_keyboard_hook) { + win32_unhook_notifier.notify =3D keyboard_hook_unhook; + qemu_add_exit_notifier(&win32_unhook_notifier); + } + } + + win32_window =3D hwnd; +} + +void win32_kbd_set_grab(bool grab) +{ + win32_grab =3D grab; +} diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 45be5dc0ed78..6a9e3135e8f9 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -32,6 +32,7 @@ stub-obj-y +=3D trace-control.o stub-obj-y +=3D uuid.o stub-obj-y +=3D vm-stop.o stub-obj-y +=3D vmstate.o +stub-obj-y +=3D win32-kbd-hook.o stub-obj-y +=3D fd-register.o stub-obj-y +=3D qmp_memory_device.o stub-obj-y +=3D target-monitor-defs.o diff --git a/ui/Makefile.objs b/ui/Makefile.objs index e6da6ff047fd..504b19647977 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -15,6 +15,9 @@ common-obj-$(CONFIG_SPICE) +=3D spice-core.o spice-input.= o spice-display.o common-obj-$(CONFIG_COCOA) +=3D cocoa.o common-obj-$(CONFIG_VNC) +=3D $(vnc-obj-y) common-obj-$(call lnot,$(CONFIG_VNC)) +=3D vnc-stubs.o +ifneq (,$(findstring m,$(CONFIG_SDL)$(CONFIG_GTK))) +common-obj-$(CONFIG_WIN32) +=3D win32-kbd-hook.o +endif =20 # ui-sdl module common-obj-$(CONFIG_SDL) +=3D sdl.mo --=20 2.18.4 From nobody Fri Nov 14 19:22:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589964272; cv=none; d=zohomail.com; s=zohoarc; b=ipefGUTnx7YzjdMyMuljtBW+ykHHTr7WkDO3nAiDtZjgkH2K+knkKi1ubnf5Q5jojHnhQR8CG3zOnVXkDsdIRl3dGCuJsB48v0mbDBTtCs9FP97pPxw5o7dvn7NxSQDn1BPgI9R4WjcIZ+Z9GkLYjLKHgMjwduLVtTG9/+O8fWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589964272; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GRHYaGS1LBT/IH54lYEaCrBHKuLKoBQxW+ut7Qbwy5Q=; b=efszCIiYJ0jmLlk4vKda/kPNB6H1O0yGD5QVVf3UyuXcbuEc3+fjuY5URgDng3t6T6PvJzGGCzbAUrnZJOgz0uRq4VqVYzTBTLqxFOy9gb0r0P/c3CaYW9777j5inlTOjEwcnXEGPmIGpoZ7OchztlPsr0YMfoY4FCpUl4r/e5I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158996427281846.49121321084078; Wed, 20 May 2020 01:44:32 -0700 (PDT) Received: from localhost ([::1]:34662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbKL1-0002tc-Hs for importer@patchew.org; Wed, 20 May 2020 04:44:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbKJx-0001CU-SN for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:25 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:59372 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jbKJx-0006cV-32 for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:25 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-188-cC6PVsXRMPysSO-ln1--3Q-1; Wed, 20 May 2020 04:43:21 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F9D8464; Wed, 20 May 2020 08:43:20 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-50.ams2.redhat.com [10.36.113.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76CBD2B6F6; Wed, 20 May 2020 08:43:17 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 8997E9DAE; Wed, 20 May 2020 10:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589964204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GRHYaGS1LBT/IH54lYEaCrBHKuLKoBQxW+ut7Qbwy5Q=; b=O24otX0HEjX4uMf2ZeRCbNHNYp0emQEtD3kM8bO7tsoeguKkfnp21lGYhcFdxVHXkcIJBr qO2Hyz3JEt+mrzQsVEQs4Jwq5u83VWBOPEKycLos3fvYhtyLoYjxU7bB63ofy59ZX3FKpE Mclvs9Vp+hblzcUlWL6g2xXkUQntO3I= X-MC-Unique: cC6PVsXRMPysSO-ln1--3Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 02/11] ui/gtk: fix handling of AltGr key on Windows Date: Wed, 20 May 2020 10:43:07 +0200 Message-Id: <20200520084316.22057-3-kraxel@redhat.com> In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com> References: <20200520084316.22057-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 02:22:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin Wire up the keyboard hooking code on Windows to fix the AltGr key and improve keyboard grabbing. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200516072014.7766-2-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index 83f2f5d49b2a..a0b10a140330 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -38,6 +38,10 @@ =20 #include "ui/console.h" #include "ui/gtk.h" +#ifdef G_OS_WIN32 +#include +#endif +#include "ui/win32-kbd-hook.h" =20 #include #include @@ -428,6 +432,16 @@ static void gd_widget_reparent(GtkWidget *from, GtkWid= get *to, g_object_unref(G_OBJECT(widget)); } =20 +static void *gd_win32_get_hwnd(VirtualConsole *vc) +{ +#ifdef G_OS_WIN32 + return gdk_win32_window_get_impl_hwnd( + gtk_widget_get_window(vc->window ? vc->window : vc->s->window)); +#else + return NULL; +#endif +} + /** DisplayState Callbacks **/ =20 static void gd_update(DisplayChangeListener *dcl, @@ -1451,6 +1465,7 @@ static void gd_grab_keyboard(VirtualConsole *vc, cons= t char *reason) } } =20 + win32_kbd_set_grab(true); #if GTK_CHECK_VERSION(3, 20, 0) gd_grab_update(vc, true, vc->s->ptr_owner =3D=3D vc); #else @@ -1472,6 +1487,7 @@ static void gd_ungrab_keyboard(GtkDisplayState *s) } s->kbd_owner =3D NULL; =20 + win32_kbd_set_grab(false); #if GTK_CHECK_VERSION(3, 20, 0) gd_grab_update(vc, false, vc->s->ptr_owner =3D=3D vc); #else @@ -1614,12 +1630,22 @@ static gboolean gd_leave_event(GtkWidget *widget, G= dkEventCrossing *crossing, return TRUE; } =20 +static gboolean gd_focus_in_event(GtkWidget *widget, + GdkEventFocus *event, gpointer opaque) +{ + VirtualConsole *vc =3D opaque; + + win32_kbd_set_window(gd_win32_get_hwnd(vc)); + return TRUE; +} + static gboolean gd_focus_out_event(GtkWidget *widget, - GdkEventCrossing *crossing, gpointer op= aque) + GdkEventFocus *event, gpointer opaque) { VirtualConsole *vc =3D opaque; GtkDisplayState *s =3D vc->s; =20 + win32_kbd_set_window(NULL); gtk_release_modifiers(s); return TRUE; } @@ -1878,6 +1904,8 @@ static void gd_connect_vc_gfx_signals(VirtualConsole = *vc) G_CALLBACK(gd_enter_event), vc); g_signal_connect(vc->gfx.drawing_area, "leave-notify-event", G_CALLBACK(gd_leave_event), vc); + g_signal_connect(vc->gfx.drawing_area, "focus-in-event", + G_CALLBACK(gd_focus_in_event), vc); g_signal_connect(vc->gfx.drawing_area, "focus-out-event", G_CALLBACK(gd_focus_out_event), vc); g_signal_connect(vc->gfx.drawing_area, "configure-event", --=20 2.18.4 From nobody Fri Nov 14 19:22:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589964448; cv=none; d=zohomail.com; s=zohoarc; b=Ks09ne8bUq8bV44YFdWsNGH7m1m6FZHmpAk+aQQtAPNHHya/bxaKcM9fNW6j0Bv1BH2qdHzfAupQrXL8UBJp2cc+4CIr8MTBTbWv3qzmKB881bnyq4tzUPUyZV0QrIxe9aioyyJTDrWJGmM20/yQmaAI5vKMi53slKBlZee2Phk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589964448; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CHC618mfJCkbhUNMlZCQHBjRbGPMMjkx3dWr+fhUcYo=; b=ly10s36CTDjx5y3yNj53cBZBARro2qlNK2lfJsSBP+/8GFNDagObq4YoKY256qK8Ew1nSRhEu/WIdpBpDQCdAbICrsqmf0sUE3ardz2dWkhaik835177CgqRnBEKCoQzoe8aT3XNAiCNsmURgDWGxLZ06j74q45B3VzB0UlYJeE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589964448740753.7022268569482; Wed, 20 May 2020 01:47:28 -0700 (PDT) Received: from localhost ([::1]:49766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbKNr-0001Rm-Cy for importer@patchew.org; Wed, 20 May 2020 04:47:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbKJz-0001EZ-HW for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:27 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:60907 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jbKJy-0006d4-Kc for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:27 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-491-tCbVI8QkPGu_DkfBYEgLXQ-1; Wed, 20 May 2020 04:43:21 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8BB2B100CCC0; Wed, 20 May 2020 08:43:20 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-50.ams2.redhat.com [10.36.113.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 800061001920; Wed, 20 May 2020 08:43:17 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 929F49DAF; Wed, 20 May 2020 10:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589964205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CHC618mfJCkbhUNMlZCQHBjRbGPMMjkx3dWr+fhUcYo=; b=LHhr5oO6iZAGaQ13agOpcN2wfvVqWuHm0GWljpc6LsnfnPLIv1JYdAnruXjUEtEf21lv9y bBXtnkPsTP/RxOmFNbDZPaCLMzprFpeI4KUt11hbJY64N5onycNjknuJiBJCRQ0Hk9Ty+V +d+RYftB2SAuxS4IvKGSPioGG0xDGIE= X-MC-Unique: tCbVI8QkPGu_DkfBYEgLXQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 03/11] ui/gkt: release all keys on grab-broken-event Date: Wed, 20 May 2020 10:43:08 +0200 Message-Id: <20200520084316.22057-4-kraxel@redhat.com> In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com> References: <20200520084316.22057-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 04:09:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin There is no way to grab the Ctrl-Alt-Del key combination on Windows. This key combination will leave all three keys in a stuck condition. This patch uses the grab-broken-event to release the keys. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200516072014.7766-3-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index a0b10a140330..655b26de384e 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1142,6 +1142,25 @@ static gboolean gd_key_event(GtkWidget *widget, GdkE= ventKey *key, void *opaque) return TRUE; } =20 +static gboolean gd_grab_broken_event(GtkWidget *widget, + GdkEventGrabBroken *event, void *opaq= ue) +{ +#ifdef CONFIG_WIN32 + /* + * On Windows the Ctrl-Alt-Del key combination can't be grabbed. This + * key combination leaves all three keys in a stuck condition. We use + * the grab-broken-event to release all keys. + */ + if (event->keyboard) { + VirtualConsole *vc =3D opaque; + GtkDisplayState *s =3D vc->s; + + gtk_release_modifiers(s); + } +#endif + return TRUE; +} + static gboolean gd_event(GtkWidget *widget, GdkEvent *event, void *opaque) { if (event->type =3D=3D GDK_MOTION_NOTIFY) { @@ -1910,6 +1929,8 @@ static void gd_connect_vc_gfx_signals(VirtualConsole = *vc) G_CALLBACK(gd_focus_out_event), vc); g_signal_connect(vc->gfx.drawing_area, "configure-event", G_CALLBACK(gd_configure), vc); + g_signal_connect(vc->gfx.drawing_area, "grab-broken-event", + G_CALLBACK(gd_grab_broken_event), vc); } else { g_signal_connect(vc->gfx.drawing_area, "key-press-event", G_CALLBACK(gd_text_key_down), vc); --=20 2.18.4 From nobody Fri Nov 14 19:22:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589964358; cv=none; d=zohomail.com; s=zohoarc; b=CF1VpYwdYceHt49468HFZMoXZK+GfksTNxMqbivhWe5CymPf71g7ljm4cdWZp3lI2GHgohp6RDpraqR0TuZ4LGRRYaRbgUaz2jQXzPKfHvL2wBF2edrzMTsEPw9aPRvguh73juqpNr82BIiaUQtimh3FRqrGQzEMgpp2isuMV6o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589964358; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bI/D6N0281xdiiHd5BdG07m8MXj2btuupYQGpk8O9Zc=; b=mbQj4nFuKF0tawslg5OYK8a/VB5WJ5pgdp9HymutJ3xNj78wFAQ/dF6tBFCEYaFVn976f/B39niVKlI1TAu08QYPkBJEl5AEIuzFrsWXzPjGWNwdDd2vYsJDCamV4qqEk1Y9FhtOPNB5FplRRWjWE5DjvCoTOEFKzvOUpwuTkpo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589964358696673.063345881386; Wed, 20 May 2020 01:45:58 -0700 (PDT) Received: from localhost ([::1]:42070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbKMN-0006jc-Ah for importer@patchew.org; Wed, 20 May 2020 04:45:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbKJx-0001Bp-Bn for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:25 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32368 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jbKJw-0006cT-M0 for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:25 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-igxrhstTM9iSM8qP_Xbjaw-1; Wed, 20 May 2020 04:43:21 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B357819200C0; Wed, 20 May 2020 08:43:20 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-50.ams2.redhat.com [10.36.113.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8264F5D9CA; Wed, 20 May 2020 08:43:17 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9B92C9DB0; Wed, 20 May 2020 10:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589964203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bI/D6N0281xdiiHd5BdG07m8MXj2btuupYQGpk8O9Zc=; b=iWCBaHGBBlhsApj8zBh7Ub0dPZImzVbfOvAeIN0dt5d2tjJHBvgd2mP6KS5Dhh8G4GlIxB 2WacRI/ww37A6Tdib8pbbh0Pkkd0DV1N6X288dUjvwLbabvRSGnENgCz2Wzhmb5OfRicYt FLjbtFE4A9MGMWG0WN/E/mMbJZAONts= X-MC-Unique: igxrhstTM9iSM8qP_Xbjaw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 04/11] ui/gtk: remove unused code Date: Wed, 20 May 2020 10:43:09 +0200 Message-Id: <20200520084316.22057-5-kraxel@redhat.com> In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com> References: <20200520084316.22057-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 01:34:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin This code was last used before commit 2ec78706d1 "ui: convert GTK and SDL1 frontends to keycodemapdb". Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Volker R=C3=BCmelin Message-id: 20200516072014.7766-4-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 655b26de384e..0e9503a0d1d9 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -112,15 +112,6 @@ # define VTE_CHECK_VERSION(a, b, c) 0 #endif =20 -/* Some older mingw versions lack this constant or have - * it conditionally defined */ -#ifdef _WIN32 -# ifndef MAPVK_VK_TO_VSC -# define MAPVK_VK_TO_VSC 0 -# endif -#endif - - #define HOTKEY_MODIFIERS (GDK_CONTROL_MASK | GDK_MOD1_MASK) =20 static const guint16 *keycode_map; --=20 2.18.4 From nobody Fri Nov 14 19:22:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589964272; cv=none; d=zohomail.com; s=zohoarc; b=WgGzKR0CAy7sN9mPoL10dK3l6cLUMyXIfi5h0aHSYLzX+J8YB9Yx/YJtUlaMNQL3D93cleTOlejHoKqH/W0msHjiuEjNzcUeNSitdLCG6e23R3/li1HM67dvsloXuiNZeuFguzhG4qqBVqQl/9kR6Cy4v6PmX8YGR6WnZwavkLY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589964272; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Dq4/sHXrghcxAuE9e4HtETpvu3EFqiazCzugnZPczUk=; b=Hb+kd/mUFpZ5m3V5s4znLV11t8q+PdjGMnY6rxN9da8fIjOaXbIDtZ8hyYir7HyUG6MWGdzGG5in4CU4BEJWaUKLpTrix0lka1c5qQ1ScqzO1IPputKs4Ie17PnJ96d9tUB9sAULb26NKvpwb9chntvdpScTa5jwSvCmTQ3eCqg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589964272713889.553959637985; Wed, 20 May 2020 01:44:32 -0700 (PDT) Received: from localhost ([::1]:34700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbKL1-0002ug-D1 for importer@patchew.org; Wed, 20 May 2020 04:44:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbKJz-0001Eg-KK for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:27 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:39448 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jbKJy-0006ct-AC for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:27 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-422-O2fLU_EoOuWNCTKbFe0xqA-1; Wed, 20 May 2020 04:43:23 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 217A21800D42; Wed, 20 May 2020 08:43:22 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-50.ams2.redhat.com [10.36.113.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3919100164D; Wed, 20 May 2020 08:43:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A46C89D54; Wed, 20 May 2020 10:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589964205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dq4/sHXrghcxAuE9e4HtETpvu3EFqiazCzugnZPczUk=; b=X4mHNTkZRgIZgls2CulsikFpGt/K+A/xbVoDD4gYA4lC65lTvyJH2b1gb9xZ2KYNDxXau2 CJZchfROtm/3be2puu5K/xhmZ74c4avmVRO9lDevQLXKL0hVN3WYE3aXyLPDb07JoRENWb uv08FIhOk2InTIIvFSAdcIxO4cTTU+M= X-MC-Unique: O2fLU_EoOuWNCTKbFe0xqA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 05/11] ui/gtk: remove unused variable ignore_keys Date: Wed, 20 May 2020 10:43:10 +0200 Message-Id: <20200520084316.22057-6-kraxel@redhat.com> In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com> References: <20200520084316.22057-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/19 22:48:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin Since the removal of GTK2 code in commit 89d85cde75 the code around ignore_keys is unused. See commit 1a01716a30 "gtk: Avoid accel key leakage into guest on console switch" why it was only needed for GTK2. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Volker R=C3=BCmelin Message-id: 20200516072014.7766-5-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 0e9503a0d1d9..354dd90e1898 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -168,8 +168,6 @@ struct GtkDisplayState { =20 bool external_pause_update; =20 - bool ignore_keys; - DisplayOptions *opts; }; =20 @@ -1095,14 +1093,8 @@ static gboolean gd_text_key_down(GtkWidget *widget, static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *op= aque) { VirtualConsole *vc =3D opaque; - GtkDisplayState *s =3D vc->s; int qcode; =20 - if (s->ignore_keys) { - s->ignore_keys =3D (key->type =3D=3D GDK_KEY_PRESS); - return TRUE; - } - #ifdef WIN32 /* on windows, we ought to ignore the reserved key event? */ if (key->hardware_keycode =3D=3D 0xff) @@ -1204,7 +1196,6 @@ static void gd_menu_switch_vc(GtkMenuItem *item, void= *opaque) gtk_notebook_set_current_page(nb, page); gtk_widget_grab_focus(vc->focus); } - s->ignore_keys =3D false; } =20 static void gd_accel_switch_vc(void *opaque) --=20 2.18.4 From nobody Fri Nov 14 19:22:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589964370; cv=none; d=zohomail.com; s=zohoarc; b=hjdHv09opp4YmW8rBX1wziMpCtI5Iy5tgzRk8qUWjsD7zD5BGzo4eiV5vt/GbLf0fOhgovKeSk+YVtshSIhVN3r9Ys3Z1RyqZoB+b/jviHQLdATi3sQHzxyiMrxdqvnTSNY5lxD5MyvmrWtW6WETPZAm26T6Kx1g+KmTRqZhAQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589964370; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+MTFofh9WuadtI7+M3O5h8JB/kkVmabuiTsntuabFXs=; b=BtF03RfCTP9MA2un2IZurfCzwPJK9/5HgRTmwrNJHM/4aM0dvXDpwfQkMvxHXOCZDMb/e4wsMtAdACKgepSELTCY42ylc8cyhqCzSsYTgdv+90/eVxtxxEXucpbMWb2f2z49dR1DBOvInyBut+Qc26hWHmq0xMZHz3lhTO2NfR8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589964370033708.3382851458257; Wed, 20 May 2020 01:46:10 -0700 (PDT) Received: from localhost ([::1]:43270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbKMa-0007G3-PJ for importer@patchew.org; Wed, 20 May 2020 04:46:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbKK0-0001GW-Ku for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:28 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:42855 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jbKJy-0006cj-4q for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-54-mNIxnFhWNT-hkh231EbU2A-1; Wed, 20 May 2020 04:43:23 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 31FC2EC1A0; Wed, 20 May 2020 08:43:22 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-50.ams2.redhat.com [10.36.113.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id C60CA1001920; Wed, 20 May 2020 08:43:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AD3F99D55; Wed, 20 May 2020 10:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589964205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+MTFofh9WuadtI7+M3O5h8JB/kkVmabuiTsntuabFXs=; b=IbDhPSg/76VmHI/mMBaS7MnBuMrVZRf1cNLUYfxsPhza/aIv8kt7tYH/BVGNGDKE3olKbx nuPqfUFpVm4VrsIQIpOvscQnRRf/vUc8CBVMvSqbb+YMB2yvMFjNrsSsy7agGftLE3h1yY 6Y8UgC+vvn/3RO/hhj8uwRHDLZeXZPc= X-MC-Unique: mNIxnFhWNT-hkh231EbU2A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 06/11] ui/sdl2: fix handling of AltGr key on Windows Date: Wed, 20 May 2020 10:43:11 +0200 Message-Id: <20200520084316.22057-7-kraxel@redhat.com> In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com> References: <20200520084316.22057-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 02:22:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin Wire up the keyboard hooking code on Windows to fix the AltGr key and improve keyboard grabbing. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200516072014.7766-6-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- ui/sdl2.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ui/sdl2.c b/ui/sdl2.c index 61c7956da334..79c1ea29d223 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -30,6 +30,7 @@ #include "ui/sdl2.h" #include "sysemu/runstate.h" #include "sysemu/sysemu.h" +#include "ui/win32-kbd-hook.h" =20 static int sdl2_num_outputs; static struct sdl2_console *sdl2_console; @@ -220,6 +221,7 @@ static void sdl_grab_start(struct sdl2_console *scon) } SDL_SetWindowGrab(scon->real_window, SDL_TRUE); gui_grab =3D 1; + win32_kbd_set_grab(true); sdl_update_caption(scon); } =20 @@ -227,6 +229,7 @@ static void sdl_grab_end(struct sdl2_console *scon) { SDL_SetWindowGrab(scon->real_window, SDL_FALSE); gui_grab =3D 0; + win32_kbd_set_grab(false); sdl_show_cursor(scon); sdl_update_caption(scon); } @@ -325,6 +328,19 @@ static int get_mod_state(void) } } =20 +static void *sdl2_win32_get_hwnd(struct sdl2_console *scon) +{ +#ifdef CONFIG_WIN32 + SDL_SysWMinfo info; + + SDL_VERSION(&info.version); + if (SDL_GetWindowWMInfo(scon->real_window, &info)) { + return info.info.win.window; + } +#endif + return NULL; +} + static void handle_keydown(SDL_Event *ev) { int win; @@ -544,6 +560,11 @@ static void handle_windowevent(SDL_Event *ev) sdl2_redraw(scon); break; case SDL_WINDOWEVENT_FOCUS_GAINED: + win32_kbd_set_grab(gui_grab); + if (qemu_console_is_graphic(scon->dcl.con)) { + win32_kbd_set_window(sdl2_win32_get_hwnd(scon)); + } + /* fall through */ case SDL_WINDOWEVENT_ENTER: if (!gui_grab && (qemu_input_is_absolute() || absolute_enabled)) { absolute_mouse_grab(scon); @@ -558,6 +579,9 @@ static void handle_windowevent(SDL_Event *ev) scon->ignore_hotkeys =3D get_mod_state(); break; case SDL_WINDOWEVENT_FOCUS_LOST: + if (qemu_console_is_graphic(scon->dcl.con)) { + win32_kbd_set_window(NULL); + } if (gui_grab && !gui_fullscreen) { sdl_grab_end(scon); } --=20 2.18.4 From nobody Fri Nov 14 19:22:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589964459; cv=none; d=zohomail.com; s=zohoarc; b=IF1rWD6E0S3XiiEILx0P4hRukK+uEvs3bENh5AaBzLpRS4X9lHCM+lkKF1OwA7Kxkark64OdIJ379KtE9RNGLOYRYeq+hQAoRVyPszSHjAbPskhTWMANo0auX5FZQiaaFs2d9DBs+8ZQbG7eVxsTH+T13/uHmtkd8wGdLHoPKGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589964459; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0h9Xrn5alrncjgk60MHQt9zTPyjvKPS+4HBKjbyq7MI=; b=EfyfuA53PnRBdTWnEAVTWHCF26/2lA5DucB+Reef1Go164J7Nw0J9j3tEHkm0Z8rI4XsCVFFmuLLSJCsGauoCL2TF+ne7AJwrx9FPGA/OwUtYLux0MoV3bpl5px5ecLhhakKtny4BL0qlKn9ofpkGZVMDk3SVcpKxxjBcmgj40M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589964459477397.1342176971418; Wed, 20 May 2020 01:47:39 -0700 (PDT) Received: from localhost ([::1]:50730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbKO2-0001r3-AN for importer@patchew.org; Wed, 20 May 2020 04:47:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbKK1-0001Ho-4P for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:29 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:56685 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jbKK0-0006dT-C5 for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-258-ycuPYvc7MXewFvH9HKutJA-1; Wed, 20 May 2020 04:43:25 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA68B107ACF2; Wed, 20 May 2020 08:43:24 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-50.ams2.redhat.com [10.36.113.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8E04579A5; Wed, 20 May 2020 08:43:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B60619D56; Wed, 20 May 2020 10:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589964207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0h9Xrn5alrncjgk60MHQt9zTPyjvKPS+4HBKjbyq7MI=; b=Df0c8kS6yrWh0zVShZNg5P/t322JluJucKOvrG3lWoPn+FDcYBuFgN1Xe8vXHBhrMFUc5l 8y538J6Vwy2Y3I1i3oiDUq5V01FA1QgdkmTDvT7HPx5Rp4zoRmjoPx/YIf91uugTYZpkQD R49KO4WlCWhh5xjq25gKVHmvTVWDfWw= X-MC-Unique: ycuPYvc7MXewFvH9HKutJA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 07/11] ui/sdl2: start in full screen with grab enabled Date: Wed, 20 May 2020 10:43:12 +0200 Message-Id: <20200520084316.22057-8-kraxel@redhat.com> In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com> References: <20200520084316.22057-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 02:22:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin QEMU with SDL 1.2 display used to enable keyboard and mouse grab- bing when started in full screen. The SDL 2.0 code tries to do the same but fails to enable grabbing because sdl_grab_start(0) returns early. To do it's work the sdl_grab_start() function needs a pointer to a sdl2_console structure. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200516072014.7766-7-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- ui/sdl2.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/sdl2.c b/ui/sdl2.c index 79c1ea29d223..b23a8f0a8ebf 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -881,17 +881,16 @@ static void sdl2_display_init(DisplayState *ds, Displ= ayOptions *o) SDL_SetWindowIcon(sdl2_console[0].real_window, icon); } =20 - gui_grab =3D 0; - if (gui_fullscreen) { - sdl_grab_start(0); - } - mouse_mode_notifier.notify =3D sdl_mouse_mode_change; qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier); =20 sdl_cursor_hidden =3D SDL_CreateCursor(&data, &data, 8, 1, 0, 0); sdl_cursor_normal =3D SDL_GetCursor(); =20 + if (gui_fullscreen) { + sdl_grab_start(&sdl2_console[0]); + } + atexit(sdl_cleanup); } =20 --=20 2.18.4 From nobody Fri Nov 14 19:22:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589964644; cv=none; d=zohomail.com; s=zohoarc; b=E8uK4ag/bINoKt8OuILtSqfoqOibUdHXBzDFVLzeP30qXu8Nqa0XxlyW7+nE+zk2v5XrwxBBX4kraNM1yc9G8HuW+GVKwOvwnIyKEuygCsQwnTY/fZyV/aihvFNnU8pvHR3hEZI0XXbNNwSr7S7IASI5gggAOjPAG/IIEFllm50= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589964644; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zuBuzj5GYz7RhXBC+9SUi2jwNTsF+AAg+8mDGbNWuVI=; b=JM6KYBD27sKvy7VdhcG9OmXp8MZB9duGVYs0T7uhtiB2a+U3apNG0luuU1wV2hO+oqxj/IqsdLqG02d2Z3koG7HnSEKsjSGqSYtB4M9jVA3dY5WS+enndrKUZQ8HngucaZxnUuLFjFrVtfdTkkB+vfMbV8O8rS0JNKopk5k3/1M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589964644509861.5834055869336; Wed, 20 May 2020 01:50:44 -0700 (PDT) Received: from localhost ([::1]:37634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbKR1-0000Hs-6c for importer@patchew.org; Wed, 20 May 2020 04:50:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbKK1-0001IY-Bu for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:29 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:27466 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jbKK0-0006dW-IL for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:29 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-300-v_ZQBq4WPzWZU9p2e_sY-Q-1; Wed, 20 May 2020 04:43:25 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7A1D8005AA; Wed, 20 May 2020 08:43:24 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-50.ams2.redhat.com [10.36.113.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBBC85C1C8; Wed, 20 May 2020 08:43:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C03E59D57; Wed, 20 May 2020 10:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589964207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zuBuzj5GYz7RhXBC+9SUi2jwNTsF+AAg+8mDGbNWuVI=; b=Bb98CC6yyq+wd2SCjRdkgL5uozMWK2sarPMHZebDDA+Y/1u76HMZ4BTI/zLz6y85uOd6lq qyxyZUYEoyKy0lY6U5mWNJn9R2k29kelEepet+Itcuj5PKUgxyg1OECc5sUOj83UANpSxO gSec/Q3Jp7h4iojCeG/2Y62uvNr9xIY= X-MC-Unique: v_ZQBq4WPzWZU9p2e_sY-Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 08/11] ui/sdl2-input: use trace-events to debug key events Date: Wed, 20 May 2020 10:43:13 +0200 Message-Id: <20200520084316.22057-9-kraxel@redhat.com> In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com> References: <20200520084316.22057-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 02:22:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Volker R=C3=BCmelin Message-id: 20200516072014.7766-8-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- ui/sdl2-input.c | 3 +++ ui/trace-events | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c index 1f9fe831b30d..f068382209cc 100644 --- a/ui/sdl2-input.c +++ b/ui/sdl2-input.c @@ -27,6 +27,7 @@ #include "ui/console.h" #include "ui/input.h" #include "ui/sdl2.h" +#include "trace.h" =20 void sdl2_process_key(struct sdl2_console *scon, SDL_KeyboardEvent *ev) @@ -38,6 +39,8 @@ void sdl2_process_key(struct sdl2_console *scon, return; } qcode =3D qemu_input_map_usb_to_qcode[ev->keysym.scancode]; + trace_sdl2_process_key(ev->keysym.scancode, qcode, + ev->type =3D=3D SDL_KEYDOWN ? "down" : "up"); qkbd_state_key_event(scon->kbd, qcode, ev->type =3D=3D SDL_KEYDOWN); =20 if (!qemu_console_is_graphic(con)) { diff --git a/ui/trace-events b/ui/trace-events index 0dcda393c1d6..5367fd3f1668 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -75,6 +75,9 @@ input_event_abs(int conidx, const char *axis, int value) = "con %d, axis %s, value input_event_sync(void) "" input_mouse_mode(int absolute) "absolute %d" =20 +# sdl2-input.c +sdl2_process_key(int sdl_scancode, int qcode, const char *action) "transla= ted SDL scancode %d to QKeyCode %d (%s)" + # spice-display.c qemu_spice_add_memslot(int qid, uint32_t slot_id, unsigned long virt_start= , unsigned long virt_end, int async) "%d %u: host virt 0x%lx - 0x%lx async= =3D%d" qemu_spice_del_memslot(int qid, uint32_t gid, uint32_t slot_id) "%d gid=3D= %u sid=3D%u" --=20 2.18.4 From nobody Fri Nov 14 19:22:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589964365; cv=none; d=zohomail.com; s=zohoarc; b=Xp+B3xJtXMOb0mUx6d2Rxgb/JCF1JGjby0xlLMOceMkTPygTSM5urvO1HpC/MONXWBsJVUBKu3fqEJbhf47O4FhYK94eI2/MLNi2gL0l+YSZ5L2pf98cjw4EpPR6x/cXkSR97h5Q6b2da+PXN9iZav4+157FyPMQxbvoNC8CcNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589964365; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HM2EzvwT9zl59oqop71KJ2LfsctJLRfA96gEblXv6/k=; b=bGf9O9fvX+OiHoKUk6073Ngt9DRVdrVRjbiWMNOg1j1R1x+O3K4r6JWRZjQSWmZidJm5MPz2N/qhoslNsQABptYm5de6v5rgoqxZV3aRtTqP7Cxrs3vZWGucuCIf11pTHtXe4CrVGLc0uRIC3+z8+aLHcwS1jlJETuvfzoASZ1k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589964365994328.46558436481746; Wed, 20 May 2020 01:46:05 -0700 (PDT) Received: from localhost ([::1]:42964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbKMW-00078W-Ia for importer@patchew.org; Wed, 20 May 2020 04:46:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbKK1-0001JP-Ig for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:29 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:43575 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jbKK0-0006db-Q1 for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:29 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-435-cf_TnPAKMce5CGu3MSKyvA-1; Wed, 20 May 2020 04:43:26 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D1152100CCC0; Wed, 20 May 2020 08:43:24 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-50.ams2.redhat.com [10.36.113.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1AED6F7F9; Wed, 20 May 2020 08:43:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C906D9D58; Wed, 20 May 2020 10:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589964208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HM2EzvwT9zl59oqop71KJ2LfsctJLRfA96gEblXv6/k=; b=YxYdTDFRZJ8ofb4sTmCmr40q+kqi/kVsCt6nX6zNrH+J9UoS/uhdnwQot6JWsSzU9SlRmz aiFaRlpUESzR2K+YtYb/jfTZjn3PLzYTD1lANkLUz/YvD8fMzrgwCibMd6+j+SaBc8yxbZ GPlrROZZLo5kJH22w+MU3zXppf3lLvE= X-MC-Unique: cf_TnPAKMce5CGu3MSKyvA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 09/11] ui/gtk: don't pass on win keys without keyboard grab Date: Wed, 20 May 2020 10:43:14 +0200 Message-Id: <20200520084316.22057-10-kraxel@redhat.com> In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com> References: <20200520084316.22057-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 01:34:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin Without keyboard grab Windows currently handles the two win keys and the key events are also sent to the guest. This is undesir- able. Only one program should handle key events. This patch ap- plies commit c68f74b02e "win32: do not handle win keys when the keyboard is not grabbed" from project spice-gtk to ui/gtk.c to fix this problem. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200516072014.7766-9-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index 354dd90e1898..1d51e14bb58d 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1095,10 +1095,17 @@ static gboolean gd_key_event(GtkWidget *widget, Gdk= EventKey *key, void *opaque) VirtualConsole *vc =3D opaque; int qcode; =20 -#ifdef WIN32 +#ifdef G_OS_WIN32 /* on windows, we ought to ignore the reserved key event? */ if (key->hardware_keycode =3D=3D 0xff) return false; + + if (!vc->s->kbd_owner) { + if (key->hardware_keycode =3D=3D VK_LWIN || + key->hardware_keycode =3D=3D VK_RWIN) { + return FALSE; + } + } #endif =20 if (key->keyval =3D=3D GDK_KEY_Pause --=20 2.18.4 From nobody Fri Nov 14 19:22:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589964369; cv=none; d=zohomail.com; s=zohoarc; b=gtQfzlKRefyG6uwzw8o6HK8LXpxWfRoFXYibB0JLa6bNUk2aJzrgxWAa5o4yFu1OKYgIMKRn+Nro4Gy1LB36o8IWVnWu3nWw5qw3o53BfXNFqDTDIsvQD+BY7GZbrp73grhFfKiONYyuPmW5sgZ7xYUrq24My2MleQJp/n+nWz8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589964369; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UaD4rYvLxcB1FA4C2TNqEWBEVXbc6nUjHd+2laVoEgQ=; b=Clykmu17AWvlkBOGbvrTscucleOBmf+NA02hoF7C/qlkyKKurQTJ5MJ/0rQ0uZ5CFZhRqAVFZkiol/MXqGpmuTWBXGM3MCPNYp0LB/fOAJsLxoi+1pfSSuH2cGC394g1o8Fl06jC2gnfR2BpyOzjQweS9f6hjX/St3VwkI+Uggc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589964369023240.51617184852364; Wed, 20 May 2020 01:46:09 -0700 (PDT) Received: from localhost ([::1]:43144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbKMZ-0007Cx-Rr for importer@patchew.org; Wed, 20 May 2020 04:46:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbKJz-0001F7-S7 for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:27 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:47076 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jbKJx-0006cn-Vx for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:27 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-119-fu7JA6ZJPeGoBj6dvAUi9g-1; Wed, 20 May 2020 04:43:23 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A63F8005AA; Wed, 20 May 2020 08:43:22 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-50.ams2.redhat.com [10.36.113.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4D1D10002A5; Wed, 20 May 2020 08:43:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D1CA29D59; Wed, 20 May 2020 10:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589964205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UaD4rYvLxcB1FA4C2TNqEWBEVXbc6nUjHd+2laVoEgQ=; b=Ki+s0DePghmtUcviiyyB4imCW3b0L/idZJWBI0D5aDBQ2IbubfZgKlbi4cc1rhHivygHk4 jXv6g7UqdnKlRQ55VWQn5H6F1fBC3dTHYe/qsRjqUP+spuGSRwUOTce6du/Ui6QGdo6ppV xbYvk6nHIADiY3+VOAt+y8gf7OcYXQs= X-MC-Unique: fu7JA6ZJPeGoBj6dvAUi9g-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 10/11] ui/gtk: use native keyboard scancodes on Windows Date: Wed, 20 May 2020 10:43:15 +0200 Message-Id: <20200520084316.22057-11-kraxel@redhat.com> In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com> References: <20200520084316.22057-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 01:34:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin Since GTK 3.22 the function gdk_event_get_scancode() is available. On Windows this function returns keyboard scancodes and some extended flags. These raw keyboard scancodes are much better suited for this use case than the half-cooked win32 virtual-key codes because scancodes report the key position on the keyboard and the positions are independent of national language settings. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200516072014.7766-10-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 1d51e14bb58d..68a5b901c72d 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1026,8 +1026,13 @@ static const guint16 *gd_get_keymap(size_t *maplen) #ifdef GDK_WINDOWING_WIN32 if (GDK_IS_WIN32_DISPLAY(dpy)) { trace_gd_keymap_windowing("win32"); +#if GTK_CHECK_VERSION(3, 22, 0) + *maplen =3D qemu_input_map_atset1_to_qcode_len; + return qemu_input_map_atset1_to_qcode; +#else *maplen =3D qemu_input_map_win32_to_qcode_len; return qemu_input_map_win32_to_qcode; +#endif } #endif =20 @@ -1073,6 +1078,25 @@ static int gd_map_keycode(int scancode) return keycode_map[scancode]; } =20 +static int gd_get_keycode(GdkEventKey *key) +{ +#if defined G_OS_WIN32 && GTK_CHECK_VERSION(3, 22, 0) + int scancode =3D gdk_event_get_scancode((GdkEvent *)key); + + /* translate Windows native scancodes to atset1 keycodes */ + switch (scancode & (KF_EXTENDED | 0xff)) { + case 0x145: /* NUMLOCK */ + return scancode & 0xff; + } + + return scancode & KF_EXTENDED ? + 0xe000 | (scancode & 0xff) : scancode & 0xff; + +#else + return key->hardware_keycode; +#endif +} + static gboolean gd_text_key_down(GtkWidget *widget, GdkEventKey *key, void *opaque) { @@ -1084,7 +1108,7 @@ static gboolean gd_text_key_down(GtkWidget *widget, } else if (key->length) { kbd_put_string_console(con, key->string, key->length); } else { - int qcode =3D gd_map_keycode(key->hardware_keycode); + int qcode =3D gd_map_keycode(gd_get_keycode(key)); kbd_put_qcode_console(con, qcode, false); } return TRUE; @@ -1093,7 +1117,7 @@ static gboolean gd_text_key_down(GtkWidget *widget, static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *op= aque) { VirtualConsole *vc =3D opaque; - int qcode; + int keycode, qcode; =20 #ifdef G_OS_WIN32 /* on windows, we ought to ignore the reserved key event? */ @@ -1121,9 +1145,10 @@ static gboolean gd_key_event(GtkWidget *widget, GdkE= ventKey *key, void *opaque) return TRUE; } =20 - qcode =3D gd_map_keycode(key->hardware_keycode); + keycode =3D gd_get_keycode(key); + qcode =3D gd_map_keycode(keycode); =20 - trace_gd_key_event(vc->label, key->hardware_keycode, qcode, + trace_gd_key_event(vc->label, keycode, qcode, (key->type =3D=3D GDK_KEY_PRESS) ? "down" : "up"); =20 qkbd_state_key_event(vc->gfx.kbd, qcode, --=20 2.18.4 From nobody Fri Nov 14 19:22:33 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589964554; cv=none; d=zohomail.com; s=zohoarc; b=QsJDhgbasS7twvZKQ6moTgalrhgqzHHxp6C7v2OP8BGjTTo2ztG9JqVQ2GjHxeLMjwMBOBF9dUWwjA9oTRFDBk5JXRN0J4RFG+JXjLndRzvHig3WP902Zx3NDy0tT5mMTkOKxhsbyodyqrHOrTcvOTWkT7PkEQmLNb6oBpZw9B0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589964554; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Md2mWso1GhuyDeZvE93g0tdXjKOnCcVGEV43QhcQayM=; b=j79nUsLL2U8lkVJ2C9hL3fPiRsF8frnjukcHWboTTj4SMuBwIMZfkxESWTVcIRiqIkl8NVMxXD2bw2j+Tsrjl0wvv97aKA/tRampy4Rfwvuw0iK4VDWEwwFvrBoU79XKZ0k1b6H+G7EYzoeljY/35iMV0DStCIfD1lKFPgH0cW0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589964554383431.1987865833055; Wed, 20 May 2020 01:49:14 -0700 (PDT) Received: from localhost ([::1]:58290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbKPY-0005Mq-VJ for importer@patchew.org; Wed, 20 May 2020 04:49:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbKK0-0001H7-TQ for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:28 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40132 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jbKJz-0006dG-Q8 for qemu-devel@nongnu.org; Wed, 20 May 2020 04:43:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-33-jAtPNHR8PVqEq70thy8iEw-1; Wed, 20 May 2020 04:43:23 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 834ED8014D7; Wed, 20 May 2020 08:43:22 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-50.ams2.redhat.com [10.36.113.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE92960C05; Wed, 20 May 2020 08:43:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DC7929D5A; Wed, 20 May 2020 10:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589964207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Md2mWso1GhuyDeZvE93g0tdXjKOnCcVGEV43QhcQayM=; b=Or9R34K9k7SDRdgd33FmEOE05wX8/yQ50Jj5BvhBGkcReGe1gW2nnnQf9bKI+vsYTNoNE3 dK9oVE14ZokT5A8b4KCx//AA3NURIEDA52uCXdn+XMgHjK4IUrU0Q5gmDzSXUsVuuL/Rqd xa3+QLqlb3OSQ/2161FWdNKE7tcpAW0= X-MC-Unique: jAtPNHR8PVqEq70thy8iEw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 11/11] ui: increase min required GTK version to 3.22.0 Date: Wed, 20 May 2020 10:43:16 +0200 Message-Id: <20200520084316.22057-12-kraxel@redhat.com> In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com> References: <20200520084316.22057-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 01:34:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin Based on a mail on the qemu-devel mailing list at https://lists.nongnu.org/archive/html/qemu-devel/2020-05/msg02909.html and some internet research the GTK3 versions on supported platforms are: RHEL-7.4: 3.22.10 RHEL-7.5: 3.22.26 Debian (Stretch): 3.22.11 Debian (Buster): 3.24.5 OpenBSD (Ports): 3.22.30 FreeBSD (Ports): 3.22.29 OpenSUSE Leap 15: 3.22.30 SLE12-SP2: Unknown SLE15: 3.22.30 Ubuntu (Bionic): 3.22.30 Ubuntu (Focal): 3.24.18 macOS (Homebrew): 3.22.30 This justifies increasing the minimum required GTK version in QEMU to 3.22.0. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200516072014.7766-11-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- configure | 2 +- ui/gtk.c | 91 +++++-------------------------------------------------- 2 files changed, 9 insertions(+), 84 deletions(-) diff --git a/configure b/configure index 26084fc53ad1..2fc05c4465cb 100755 --- a/configure +++ b/configure @@ -2897,7 +2897,7 @@ fi if test "$gtk" !=3D "no"; then gtkpackage=3D"gtk+-3.0" gtkx11package=3D"gtk+-x11-3.0" - gtkversion=3D"3.14.0" + gtkversion=3D"3.22.0" if $pkg_config --exists "$gtkpackage >=3D $gtkversion"; then gtk_cflags=3D$($pkg_config --cflags $gtkpackage) gtk_libs=3D$($pkg_config --libs $gtkpackage) diff --git a/ui/gtk.c b/ui/gtk.c index 68a5b901c72d..d4b49bd7dafe 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -490,12 +490,7 @@ static void gd_refresh(DisplayChangeListener *dcl) =20 static GdkDevice *gd_get_pointer(GdkDisplay *dpy) { -#if GTK_CHECK_VERSION(3, 20, 0) return gdk_seat_get_pointer(gdk_display_get_default_seat(dpy)); -#else - return gdk_device_manager_get_client_pointer( - gdk_display_get_device_manager(dpy)); -#endif } =20 static void gd_mouse_set(DisplayChangeListener *dcl, @@ -877,27 +872,18 @@ static gboolean gd_motion_event(GtkWidget *widget, Gd= kEventMotion *motion, =20 if (!qemu_input_is_absolute() && s->ptr_owner =3D=3D vc) { GdkScreen *screen =3D gtk_widget_get_screen(vc->gfx.drawing_area); + GdkDisplay *dpy =3D gtk_widget_get_display(widget); + GdkWindow *win =3D gtk_widget_get_window(widget); + GdkMonitor *monitor =3D gdk_display_get_monitor_at_window(dpy, win= ); + GdkRectangle geometry; int screen_width, screen_height; =20 int x =3D (int)motion->x_root; int y =3D (int)motion->y_root; =20 -#if GTK_CHECK_VERSION(3, 22, 0) - { - GdkDisplay *dpy =3D gtk_widget_get_display(widget); - GdkWindow *win =3D gtk_widget_get_window(widget); - GdkMonitor *monitor =3D gdk_display_get_monitor_at_window(dpy,= win); - GdkRectangle geometry; - gdk_monitor_get_geometry(monitor, &geometry); - screen_width =3D geometry.width; - screen_height =3D geometry.height; - } -#else - { - screen_width =3D gdk_screen_get_width(screen); - screen_height =3D gdk_screen_get_height(screen); - } -#endif + gdk_monitor_get_geometry(monitor, &geometry); + screen_width =3D geometry.width; + screen_height =3D geometry.height; =20 /* In relative mode check to see if client pointer hit * one of the screen edges, and if so move it back by @@ -1026,13 +1012,8 @@ static const guint16 *gd_get_keymap(size_t *maplen) #ifdef GDK_WINDOWING_WIN32 if (GDK_IS_WIN32_DISPLAY(dpy)) { trace_gd_keymap_windowing("win32"); -#if GTK_CHECK_VERSION(3, 22, 0) *maplen =3D qemu_input_map_atset1_to_qcode_len; return qemu_input_map_atset1_to_qcode; -#else - *maplen =3D qemu_input_map_win32_to_qcode_len; - return qemu_input_map_win32_to_qcode; -#endif } #endif =20 @@ -1080,7 +1061,7 @@ static int gd_map_keycode(int scancode) =20 static int gd_get_keycode(GdkEventKey *key) { -#if defined G_OS_WIN32 && GTK_CHECK_VERSION(3, 22, 0) +#ifdef G_OS_WIN32 int scancode =3D gdk_event_get_scancode((GdkEvent *)key); =20 /* translate Windows native scancodes to atset1 keycodes */ @@ -1437,7 +1418,6 @@ static void gd_menu_zoom_fit(GtkMenuItem *item, void = *opaque) gd_update_full_redraw(vc); } =20 -#if GTK_CHECK_VERSION(3, 20, 0) static void gd_grab_update(VirtualConsole *vc, bool kbd, bool ptr) { GdkDisplay *display =3D gtk_widget_get_display(vc->gfx.drawing_area); @@ -1461,32 +1441,6 @@ static void gd_grab_update(VirtualConsole *vc, bool = kbd, bool ptr) gdk_seat_ungrab(seat); } } -#else -static void gd_grab_devices(VirtualConsole *vc, bool grab, - GdkInputSource source, GdkEventMask mask, - GdkCursor *cursor) -{ - GdkDisplay *display =3D gtk_widget_get_display(vc->gfx.drawing_area); - GdkDeviceManager *mgr =3D gdk_display_get_device_manager(display); - GList *devs =3D gdk_device_manager_list_devices(mgr, GDK_DEVICE_TYPE_M= ASTER); - GList *tmp =3D devs; - - for (tmp =3D devs; tmp; tmp =3D tmp->next) { - GdkDevice *dev =3D tmp->data; - if (gdk_device_get_source(dev) !=3D source) { - continue; - } - if (grab) { - GdkWindow *win =3D gtk_widget_get_window(vc->gfx.drawing_area); - gdk_device_grab(dev, win, GDK_OWNERSHIP_NONE, FALSE, - mask, cursor, GDK_CURRENT_TIME); - } else { - gdk_device_ungrab(dev, GDK_CURRENT_TIME); - } - } - g_list_free(devs); -} -#endif =20 static void gd_grab_keyboard(VirtualConsole *vc, const char *reason) { @@ -1499,13 +1453,7 @@ static void gd_grab_keyboard(VirtualConsole *vc, con= st char *reason) } =20 win32_kbd_set_grab(true); -#if GTK_CHECK_VERSION(3, 20, 0) gd_grab_update(vc, true, vc->s->ptr_owner =3D=3D vc); -#else - gd_grab_devices(vc, true, GDK_SOURCE_KEYBOARD, - GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK, - NULL); -#endif vc->s->kbd_owner =3D vc; gd_update_caption(vc->s); trace_gd_grab(vc->label, "kbd", reason); @@ -1521,11 +1469,7 @@ static void gd_ungrab_keyboard(GtkDisplayState *s) s->kbd_owner =3D NULL; =20 win32_kbd_set_grab(false); -#if GTK_CHECK_VERSION(3, 20, 0) gd_grab_update(vc, false, vc->s->ptr_owner =3D=3D vc); -#else - gd_grab_devices(vc, false, GDK_SOURCE_KEYBOARD, 0, NULL); -#endif gd_update_caption(s); trace_gd_ungrab(vc->label, "kbd"); } @@ -1542,21 +1486,9 @@ static void gd_grab_pointer(VirtualConsole *vc, cons= t char *reason) } } =20 -#if GTK_CHECK_VERSION(3, 20, 0) gd_grab_update(vc, vc->s->kbd_owner =3D=3D vc, true); gdk_device_get_position(gd_get_pointer(display), NULL, &vc->s->grab_x_root, &vc->s->grab_y_root= ); -#else - gd_grab_devices(vc, true, GDK_SOURCE_MOUSE, - GDK_POINTER_MOTION_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_BUTTON_MOTION_MASK | - GDK_SCROLL_MASK, - vc->s->null_cursor); - gdk_device_get_position(gd_get_pointer(display), - NULL, &vc->s->grab_x_root, &vc->s->grab_y_root= ); -#endif vc->s->ptr_owner =3D vc; gd_update_caption(vc->s); trace_gd_grab(vc->label, "ptr", reason); @@ -1573,17 +1505,10 @@ static void gd_ungrab_pointer(GtkDisplayState *s) s->ptr_owner =3D NULL; =20 display =3D gtk_widget_get_display(vc->gfx.drawing_area); -#if GTK_CHECK_VERSION(3, 20, 0) gd_grab_update(vc, vc->s->kbd_owner =3D=3D vc, false); gdk_device_warp(gd_get_pointer(display), gtk_widget_get_screen(vc->gfx.drawing_area), vc->s->grab_x_root, vc->s->grab_y_root); -#else - gd_grab_devices(vc, false, GDK_SOURCE_MOUSE, 0, NULL); - gdk_device_warp(gd_get_pointer(display), - gtk_widget_get_screen(vc->gfx.drawing_area), - vc->s->grab_x_root, vc->s->grab_y_root); -#endif gd_update_caption(s); trace_gd_ungrab(vc->label, "ptr"); } --=20 2.18.4