From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364292127316.6640088797567; Tue, 5 Feb 2019 02:58:12 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 9D6CE8667E; Tue, 5 Feb 2019 10:58:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AB7417D32; Tue, 5 Feb 2019 10:58:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F033C3F7D0; Tue, 5 Feb 2019 10:58:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15Aw5nK025036 for ; Tue, 5 Feb 2019 05:58:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 61E681055009; Tue, 5 Feb 2019 10:58:05 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84B7A100194A; Tue, 5 Feb 2019 10:57:59 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C4899A1E7; Tue, 5 Feb 2019 11:57:58 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:45 +0100 Message-Id: <20190205105758.4230-2-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Thomas Huth , Gerd Hoffmann , Peter Maydell Subject: [libvirt] [PULL 01/14] Remove deprecated -no-frame option X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 05 Feb 2019 10:58:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Thomas Huth The -no-frame option has been deprecated with QEMU v2.12. It was only useful with SDL1.2 - now that we've removed support for SDL1.2, we can certainly remove the -no-frame option, too. Signed-off-by: Thomas Huth Message-id: 1549351769-19620-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann --- include/sysemu/sysemu.h | 1 - vl.c | 23 +++-------------------- qemu-deprecated.texi | 6 ------ qemu-options.hx | 11 ----------- 4 files changed, 3 insertions(+), 38 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 85877b7e43..4b5a6b77f9 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -102,7 +102,6 @@ extern const char *keyboard_layout; extern int win2k_install_hack; extern int alt_grab; extern int ctrl_grab; -extern int no_frame; extern int smp_cpus; extern unsigned int max_cpus; extern int cursor_hide; diff --git a/vl.c b/vl.c index 9cf0fbe0b8..33d226fb48 100644 --- a/vl.c +++ b/vl.c @@ -160,7 +160,6 @@ static int rtc_host_datetime_offset =3D -1; /* valid & = used only with QEMUClockType rtc_clock; int vga_interface_type =3D VGA_NONE; static DisplayOptions dpy; -int no_frame; static int num_serial_hds; static Chardev **serial_hds; Chardev *parallel_hds[MAX_PARALLEL_PORTS]; @@ -2113,18 +2112,7 @@ static void parse_display(const char *p) while (*opts) { const char *nextopt; =20 - if (strstart(opts, ",frame=3D", &nextopt)) { - g_printerr("The frame=3D sdl option is deprecated, and wil= l be\n" - "removed in a future release.\n"); - opts =3D nextopt; - if (strstart(opts, "on", &nextopt)) { - no_frame =3D 0; - } else if (strstart(opts, "off", &nextopt)) { - no_frame =3D 1; - } else { - goto invalid_sdl_args; - } - } else if (strstart(opts, ",alt_grab=3D", &nextopt)) { + if (strstart(opts, ",alt_grab=3D", &nextopt)) { opts =3D nextopt; if (strstart(opts, "on", &nextopt)) { alt_grab =3D 1; @@ -3596,11 +3584,6 @@ int main(int argc, char **argv, char **envp) dpy.has_full_screen =3D true; dpy.full_screen =3D true; break; - case QEMU_OPTION_no_frame: - g_printerr("The -no-frame switch is deprecated, and will b= e\n" - "removed in a future release.\n"); - no_frame =3D 1; - break; case QEMU_OPTION_alt_grab: alt_grab =3D 1; break; @@ -4279,8 +4262,8 @@ int main(int argc, char **argv, char **envp) dpy.type =3D DISPLAY_TYPE_NONE; } =20 - if ((no_frame || alt_grab || ctrl_grab) && dpy.type !=3D DISPLAY_TYPE_= SDL) { - error_report("-no-frame, -alt-grab and -ctrl-grab are only valid " + if ((alt_grab || ctrl_grab) && dpy.type !=3D DISPLAY_TYPE_SDL) { + error_report("-alt-grab and -ctrl-grab are only valid " "for SDL, ignoring option"); } if (dpy.has_window_close && diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 9cc20b365c..0b508e738f 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -37,12 +37,6 @@ would automatically enable USB support on the machine ty= pe. If using the new syntax, USB support must be explicitly enabled via the ``-machine usb=3Don'' argument. =20 -@subsection -no-frame (since 2.12.0) - -The @code{--no-frame} argument works with SDL 1.2 only. The other user -interfaces never implemented this in the first place. So this will be -removed together with SDL 1.2 support. - @subsection -virtioconsole (since 3.0.0) =20 Option @option{-virtioconsole} has been replaced by diff --git a/qemu-options.hx b/qemu-options.hx index 521511ec13..0180467dee 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1294,17 +1294,6 @@ mode using a curses/ncurses interface. Nothing is di= splayed in graphical mode. ETEXI =20 -DEF("no-frame", 0, QEMU_OPTION_no_frame, - "-no-frame open SDL window without a frame and window decoration= s\n", - QEMU_ARCH_ALL) -STEXI -@item -no-frame -@findex -no-frame -Do not use decorations for SDL windows and start them using the whole -available screen space. This makes the using QEMU in a dedicated desktop -workspace more convenient. -ETEXI - DEF("alt-grab", 0, QEMU_OPTION_alt_grab, "-alt-grab use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt= )\n", QEMU_ARCH_ALL) --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364335353361.252680894671; Tue, 5 Feb 2019 02:58:55 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id BC14359451; Tue, 5 Feb 2019 10:58:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FE30105958A; Tue, 5 Feb 2019 10:58:52 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0E4B618033AD; Tue, 5 Feb 2019 10:58:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15AwC2P025143 for ; Tue, 5 Feb 2019 05:58:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id CA90D6152D; Tue, 5 Feb 2019 10:58:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8BCAC5D6A6; Tue, 5 Feb 2019 10:57:59 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CC8449D85; Tue, 5 Feb 2019 11:57:58 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:46 +0100 Message-Id: <20190205105758.4230-3-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Sergio Lopez , Peter Maydell Subject: [libvirt] [PULL 02/14] ui: don't send any event if delta_y == 0 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 05 Feb 2019 10:58:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Sergio Lopez When the user raises their fingers from the touchpad, we may receive a GDK_SMOOTH_SCROLL event with delta_y =3D=3D 0. Avoid generating a WHEEL_UP event in this situation. Signed-off-by: Sergio Lopez Message-id: 20190204122043.43007-1-slp@redhat.com Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index 87c0e33d2a..5a584353bd 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1004,7 +1004,9 @@ static gboolean gd_scroll_event(GtkWidget *widget, Gd= kEventScroll *scroll, &delta_x, &delta_y)) { return TRUE; } - if (delta_y > 0) { + if (delta_y =3D=3D 0) { + return TRUE; + } else if (delta_y > 0) { btn =3D INPUT_BUTTON_WHEEL_DOWN; } else { btn =3D INPUT_BUTTON_WHEEL_UP; --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364329691799.787972718429; Tue, 5 Feb 2019 02:58:49 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5B7359453; Tue, 5 Feb 2019 10:58:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7CCD161522; Tue, 5 Feb 2019 10:58:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 252FC3F611; Tue, 5 Feb 2019 10:58:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15Aw84i025106 for ; Tue, 5 Feb 2019 05:58:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id A4C63183D6; Tue, 5 Feb 2019 10:58:08 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86DA716906; Tue, 5 Feb 2019 10:57:59 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D47AA245; Tue, 5 Feb 2019 11:57:58 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:47 +0100 Message-Id: <20190205105758.4230-4-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Sergio Lopez , Peter Maydell Subject: [libvirt] [PULL 03/14] ui: listen for GDK_SMOOTH_SCROLL events X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 05 Feb 2019 10:58:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Sergio Lopez On Wayland, without grabbing focus, two-finger scrolling generates GDK_SMOOTH_SCROLL events instead of GDK_SCROLL_*, so listen for them. Signed-off-by: Sergio Lopez Message-id: 20190204120823.41333-1-slp@redhat.com Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/gtk.c b/ui/gtk.c index 5a584353bd..57af69b0c4 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2045,6 +2045,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vir= tualConsole *vc, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK | + GDK_SMOOTH_SCROLL_MASK | GDK_KEY_PRESS_MASK); gtk_widget_set_can_focus(vc->gfx.drawing_area, TRUE); =20 --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364303441534.0399300648199; Tue, 5 Feb 2019 02:58:23 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id DB75188E4A; Tue, 5 Feb 2019 10:58:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FBC3105706A; Tue, 5 Feb 2019 10:58:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1C0DF1803399; Tue, 5 Feb 2019 10:58:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15Aw5FD025035 for ; Tue, 5 Feb 2019 05:58:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 588621059588; Tue, 5 Feb 2019 10:58:05 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F4CA1048125; Tue, 5 Feb 2019 10:57:59 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DCD9897BA; Tue, 5 Feb 2019 11:57:58 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:48 +0100 Message-Id: <20190205105758.4230-5-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Thomas Huth , Gerd Hoffmann , Peter Maydell Subject: [libvirt] [PULL 04/14] ui/sdl_keysym: Remove obsolete SDL1.2 related code X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 05 Feb 2019 10:58:21 +0000 (UTC) From: Thomas Huth sdl_keysym.h has only been included by sdl.c which has recently been removed recently with this commit: 0015ca5cbabe0b31d31610ddfaafd90a9e5911a4 ("ui: remove support for SDL1.2 in favour of SDL2") So we can drop this header file now completely, too. Signed-off-by: Thomas Huth Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 1549282241-23535-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann --- ui/sdl_keysym.h | 278 ----------------------------------------------------= ---- 1 file changed, 278 deletions(-) delete mode 100644 ui/sdl_keysym.h diff --git a/ui/sdl_keysym.h b/ui/sdl_keysym.h deleted file mode 100644 index 599d9fc64d..0000000000 --- a/ui/sdl_keysym.h +++ /dev/null @@ -1,278 +0,0 @@ - -#include "keymaps.h" - -static const name2keysym_t name2keysym[]=3D{ -/* ascii */ - { "space", 0x020}, - { "exclam", 0x021}, - { "quotedbl", 0x022}, - { "numbersign", 0x023}, - { "dollar", 0x024}, - { "percent", 0x025}, - { "ampersand", 0x026}, - { "apostrophe", 0x027}, - { "parenleft", 0x028}, - { "parenright", 0x029}, - { "asterisk", 0x02a}, - { "plus", 0x02b}, - { "comma", 0x02c}, - { "minus", 0x02d}, - { "period", 0x02e}, - { "slash", 0x02f}, - { "0", 0x030}, - { "1", 0x031}, - { "2", 0x032}, - { "3", 0x033}, - { "4", 0x034}, - { "5", 0x035}, - { "6", 0x036}, - { "7", 0x037}, - { "8", 0x038}, - { "9", 0x039}, - { "colon", 0x03a}, - { "semicolon", 0x03b}, - { "less", 0x03c}, - { "equal", 0x03d}, - { "greater", 0x03e}, - { "question", 0x03f}, - { "at", 0x040}, - { "A", 0x041}, - { "B", 0x042}, - { "C", 0x043}, - { "D", 0x044}, - { "E", 0x045}, - { "F", 0x046}, - { "G", 0x047}, - { "H", 0x048}, - { "I", 0x049}, - { "J", 0x04a}, - { "K", 0x04b}, - { "L", 0x04c}, - { "M", 0x04d}, - { "N", 0x04e}, - { "O", 0x04f}, - { "P", 0x050}, - { "Q", 0x051}, - { "R", 0x052}, - { "S", 0x053}, - { "T", 0x054}, - { "U", 0x055}, - { "V", 0x056}, - { "W", 0x057}, - { "X", 0x058}, - { "Y", 0x059}, - { "Z", 0x05a}, - { "bracketleft", 0x05b}, - { "backslash", 0x05c}, - { "bracketright", 0x05d}, - { "asciicircum", 0x05e}, - { "underscore", 0x05f}, - { "grave", 0x060}, - { "a", 0x061}, - { "b", 0x062}, - { "c", 0x063}, - { "d", 0x064}, - { "e", 0x065}, - { "f", 0x066}, - { "g", 0x067}, - { "h", 0x068}, - { "i", 0x069}, - { "j", 0x06a}, - { "k", 0x06b}, - { "l", 0x06c}, - { "m", 0x06d}, - { "n", 0x06e}, - { "o", 0x06f}, - { "p", 0x070}, - { "q", 0x071}, - { "r", 0x072}, - { "s", 0x073}, - { "t", 0x074}, - { "u", 0x075}, - { "v", 0x076}, - { "w", 0x077}, - { "x", 0x078}, - { "y", 0x079}, - { "z", 0x07a}, - { "braceleft", 0x07b}, - { "bar", 0x07c}, - { "braceright", 0x07d}, - { "asciitilde", 0x07e}, - -/* latin 1 extensions */ -{ "nobreakspace", 0x0a0}, -{ "exclamdown", 0x0a1}, -{ "cent", 0x0a2}, -{ "sterling", 0x0a3}, -{ "currency", 0x0a4}, -{ "yen", 0x0a5}, -{ "brokenbar", 0x0a6}, -{ "section", 0x0a7}, -{ "diaeresis", 0x0a8}, -{ "copyright", 0x0a9}, -{ "ordfeminine", 0x0aa}, -{ "guillemotleft", 0x0ab}, -{ "notsign", 0x0ac}, -{ "hyphen", 0x0ad}, -{ "registered", 0x0ae}, -{ "macron", 0x0af}, -{ "degree", 0x0b0}, -{ "plusminus", 0x0b1}, -{ "twosuperior", 0x0b2}, -{ "threesuperior", 0x0b3}, -{ "acute", 0x0b4}, -{ "mu", 0x0b5}, -{ "paragraph", 0x0b6}, -{ "periodcentered", 0x0b7}, -{ "cedilla", 0x0b8}, -{ "onesuperior", 0x0b9}, -{ "masculine", 0x0ba}, -{ "guillemotright", 0x0bb}, -{ "onequarter", 0x0bc}, -{ "onehalf", 0x0bd}, -{ "threequarters", 0x0be}, -{ "questiondown", 0x0bf}, -{ "Agrave", 0x0c0}, -{ "Aacute", 0x0c1}, -{ "Acircumflex", 0x0c2}, -{ "Atilde", 0x0c3}, -{ "Adiaeresis", 0x0c4}, -{ "Aring", 0x0c5}, -{ "AE", 0x0c6}, -{ "Ccedilla", 0x0c7}, -{ "Egrave", 0x0c8}, -{ "Eacute", 0x0c9}, -{ "Ecircumflex", 0x0ca}, -{ "Ediaeresis", 0x0cb}, -{ "Igrave", 0x0cc}, -{ "Iacute", 0x0cd}, -{ "Icircumflex", 0x0ce}, -{ "Idiaeresis", 0x0cf}, -{ "ETH", 0x0d0}, -{ "Eth", 0x0d0}, -{ "Ntilde", 0x0d1}, -{ "Ograve", 0x0d2}, -{ "Oacute", 0x0d3}, -{ "Ocircumflex", 0x0d4}, -{ "Otilde", 0x0d5}, -{ "Odiaeresis", 0x0d6}, -{ "multiply", 0x0d7}, -{ "Ooblique", 0x0d8}, -{ "Oslash", 0x0d8}, -{ "Ugrave", 0x0d9}, -{ "Uacute", 0x0da}, -{ "Ucircumflex", 0x0db}, -{ "Udiaeresis", 0x0dc}, -{ "Yacute", 0x0dd}, -{ "THORN", 0x0de}, -{ "Thorn", 0x0de}, -{ "ssharp", 0x0df}, -{ "agrave", 0x0e0}, -{ "aacute", 0x0e1}, -{ "acircumflex", 0x0e2}, -{ "atilde", 0x0e3}, -{ "adiaeresis", 0x0e4}, -{ "aring", 0x0e5}, -{ "ae", 0x0e6}, -{ "ccedilla", 0x0e7}, -{ "egrave", 0x0e8}, -{ "eacute", 0x0e9}, -{ "ecircumflex", 0x0ea}, -{ "ediaeresis", 0x0eb}, -{ "igrave", 0x0ec}, -{ "iacute", 0x0ed}, -{ "icircumflex", 0x0ee}, -{ "idiaeresis", 0x0ef}, -{ "eth", 0x0f0}, -{ "ntilde", 0x0f1}, -{ "ograve", 0x0f2}, -{ "oacute", 0x0f3}, -{ "ocircumflex", 0x0f4}, -{ "otilde", 0x0f5}, -{ "odiaeresis", 0x0f6}, -{ "division", 0x0f7}, -{ "oslash", 0x0f8}, -{ "ooblique", 0x0f8}, -{ "ugrave", 0x0f9}, -{ "uacute", 0x0fa}, -{ "ucircumflex", 0x0fb}, -{ "udiaeresis", 0x0fc}, -{ "yacute", 0x0fd}, -{ "thorn", 0x0fe}, -{ "ydiaeresis", 0x0ff}, -#if SDL_MAJOR_VERSION =3D=3D 1 -{"EuroSign", SDLK_EURO}, - - /* modifiers */ -{"Control_L", SDLK_LCTRL}, -{"Control_R", SDLK_RCTRL}, -{"Alt_L", SDLK_LALT}, -{"Alt_R", SDLK_RALT}, -{"Caps_Lock", SDLK_CAPSLOCK}, -{"Meta_L", SDLK_LMETA}, -{"Meta_R", SDLK_RMETA}, -{"Shift_L", SDLK_LSHIFT}, -{"Shift_R", SDLK_RSHIFT}, -{"Super_L", SDLK_LSUPER}, -{"Super_R", SDLK_RSUPER}, - - /* special keys */ -{"BackSpace", SDLK_BACKSPACE}, -{"Tab", SDLK_TAB}, -{"Return", SDLK_RETURN}, -{"Right", SDLK_RIGHT}, -{"Left", SDLK_LEFT}, -{"Up", SDLK_UP}, -{"Down", SDLK_DOWN}, -{"Page_Down", SDLK_PAGEDOWN}, -{"Page_Up", SDLK_PAGEUP}, -{"Insert", SDLK_INSERT}, -{"Delete", SDLK_DELETE}, -{"Home", SDLK_HOME}, -{"End", SDLK_END}, -{"Scroll_Lock", SDLK_SCROLLOCK}, -{"F1", SDLK_F1}, -{"F2", SDLK_F2}, -{"F3", SDLK_F3}, -{"F4", SDLK_F4}, -{"F5", SDLK_F5}, -{"F6", SDLK_F6}, -{"F7", SDLK_F7}, -{"F8", SDLK_F8}, -{"F9", SDLK_F9}, -{"F10", SDLK_F10}, -{"F11", SDLK_F11}, -{"F12", SDLK_F12}, -{"F13", SDLK_F13}, -{"F14", SDLK_F14}, -{"F15", SDLK_F15}, -{"Sys_Req", SDLK_SYSREQ}, -{"KP_0", SDLK_KP0}, -{"KP_1", SDLK_KP1}, -{"KP_2", SDLK_KP2}, -{"KP_3", SDLK_KP3}, -{"KP_4", SDLK_KP4}, -{"KP_5", SDLK_KP5}, -{"KP_6", SDLK_KP6}, -{"KP_7", SDLK_KP7}, -{"KP_8", SDLK_KP8}, -{"KP_9", SDLK_KP9}, -{"KP_Add", SDLK_KP_PLUS}, -{"KP_Decimal", SDLK_KP_PERIOD}, -{"KP_Divide", SDLK_KP_DIVIDE}, -{"KP_Enter", SDLK_KP_ENTER}, -{"KP_Equal", SDLK_KP_EQUALS}, -{"KP_Multiply", SDLK_KP_MULTIPLY}, -{"KP_Subtract", SDLK_KP_MINUS}, -{"help", SDLK_HELP}, -{"Menu", SDLK_MENU}, -{"Power", SDLK_POWER}, -{"Print", SDLK_PRINT}, -{"Mode_switch", SDLK_MODE}, -{"Multi_Key", SDLK_COMPOSE}, -{"Num_Lock", SDLK_NUMLOCK}, -{"Pause", SDLK_PAUSE}, -{"Escape", SDLK_ESCAPE}, -#endif -{NULL, 0}, -}; --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364313095217.23196042321638; Tue, 5 Feb 2019 02:58:33 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id C8F5681DF3; Tue, 5 Feb 2019 10:58:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B43426E5E; Tue, 5 Feb 2019 10:58:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 208DC18033A9; Tue, 5 Feb 2019 10:58:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15Aw6tj025055 for ; Tue, 5 Feb 2019 05:58:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8ADDF1055009; Tue, 5 Feb 2019 10:58:06 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05CE71048116; Tue, 5 Feb 2019 10:58:05 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E4C9197BC; Tue, 5 Feb 2019 11:57:58 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:49 +0100 Message-Id: <20190205105758.4230-6-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Brendan Shanks , Peter Maydell Subject: [libvirt] [PULL 05/14] ui/cocoa.m: Fix macOS 10.14 deprecation warnings X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 05 Feb 2019 10:58:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Brendan Shanks macOS 10.14 deprecated NSOnState/NSOffState in favour of NSControlStateValueOn/NSControlStateValueOff. Use the new constants, and #define them to the old ones when compiling against a pre-10.13 SDK. Also [NSGraphicsContext graphicsPort] is now deprecated, use [NSGraphicsContext CGContext] when available. Signed-off-by: Brendan Shanks Message-id: 20190201071225.20576-1-brendan@bslabs.net Signed-off-by: Gerd Hoffmann --- ui/cocoa.m | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index ddc058e76e..e2567d6946 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -54,6 +54,9 @@ #ifndef MAC_OS_X_VERSION_10_12 #define MAC_OS_X_VERSION_10_12 101200 #endif +#ifndef MAC_OS_X_VERSION_10_13 +#define MAC_OS_X_VERSION_10_13 101300 +#endif =20 /* macOS 10.12 deprecated many constants, #define the new names for older = SDKs */ #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 @@ -90,6 +93,14 @@ #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9 #define NSModalResponseOK NSFileHandlingPanelOKButton #endif +/* 10.14 deprecates NSOnState and NSOffState in favor of + * NSControlStateValueOn/Off, which were introduced in 10.13. + * Define for older versions + */ +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13 +#define NSControlStateValueOn NSOnState +#define NSControlStateValueOff NSOffState +#endif =20 //#define DEBUG =20 @@ -377,7 +388,12 @@ QemuCocoaView *cocoaView; COCOA_DEBUG("QemuCocoaView: drawRect\n"); =20 // get CoreGraphic context +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10 CGContextRef viewContextRef =3D [[NSGraphicsContext currentContext] gr= aphicsPort]; +#else + CGContextRef viewContextRef =3D [[NSGraphicsContext currentContext] CG= Context]; +#endif + CGContextSetInterpolationQuality (viewContextRef, kCGInterpolationNone= ); CGContextSetShouldAntialias (viewContextRef, NO); =20 @@ -1147,9 +1163,9 @@ QemuCocoaView *cocoaView; { stretch_video =3D !stretch_video; if (stretch_video =3D=3D true) { - [sender setState: NSOnState]; + [sender setState: NSControlStateValueOn]; } else { - [sender setState: NSOffState]; + [sender setState: NSControlStateValueOff]; } } =20 @@ -1390,15 +1406,15 @@ QemuCocoaView *cocoaView; { /* Unselect the currently selected item */ for (NSMenuItem *item in [menu itemArray]) { - if (item.state =3D=3D NSOnState) { - [item setState: NSOffState]; + if (item.state =3D=3D NSControlStateValueOn) { + [item setState: NSControlStateValueOff]; break; } } } =20 // check the menu item - [sender setState: NSOnState]; + [sender setState: NSControlStateValueOn]; =20 // get the throttle percentage throttle_pct =3D [sender tag]; @@ -1502,7 +1518,7 @@ int main (int argc, const char * argv[]) { initWithTitle: [NSString stringWithFormat: @"%d%%", per= centage] action:@selector(adjustSpeed:) keyEquivalent:@""] autorelease]; =20 if (percentage =3D=3D 100) { - [menuItem setState: NSOnState]; + [menuItem setState: NSControlStateValueOn]; } =20 /* Calculate the throttle percentage */ --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364292292287.15589142850774; Tue, 5 Feb 2019 02:58:12 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id BDBAE3DBDB; Tue, 5 Feb 2019 10:58:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 56F4C105706A; Tue, 5 Feb 2019 10:58:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A77373F7D5; Tue, 5 Feb 2019 10:58:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15Aw65X025053 for ; Tue, 5 Feb 2019 05:58:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7BF0A1897A; Tue, 5 Feb 2019 10:58:06 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAF48183D6; Tue, 5 Feb 2019 10:58:05 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id F1E6697BE; Tue, 5 Feb 2019 11:57:58 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:50 +0100 Message-Id: <20190205105758.4230-7-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Chen Zhang , Peter Maydell Subject: [libvirt] [PULL 06/14] ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey scales of viewport X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 05 Feb 2019 10:58:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Chen Zhang This would help gtk-egl display showing scaled DMABuf cursor images when gtk window was zoomed. A default scale of (1.0, 1.0) was presumed for call sites where no scaling is needed. Signed-off-by: Chen Zhang Message-id: 23B229B3-3095-4DFB-8369-866784808D30@me.com Signed-off-by: Gerd Hoffmann --- include/ui/egl-helpers.h | 2 +- ui/egl-headless.c | 3 ++- ui/egl-helpers.c | 9 +++++---- ui/gtk-egl.c | 3 ++- ui/spice-display.c | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h index 3fc656a7ba..b976cb8728 100644 --- a/include/ui/egl-helpers.h +++ b/include/ui/egl-helpers.h @@ -27,7 +27,7 @@ void egl_fb_read(void *dst, egl_fb *src); =20 void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool fl= ip); void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool f= lip, - int x, int y); + int x, int y, double scale_x, double scale_y); =20 #ifdef CONFIG_OPENGL_DMABUF =20 diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 519e7bad32..e67b47aeff 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -142,7 +142,8 @@ static void egl_scanout_flush(DisplayChangeListener *dc= l, egl_texture_blit(edpy->gls, &edpy->blit_fb, &edpy->guest_fb, !edpy->y_0_top); egl_texture_blend(edpy->gls, &edpy->blit_fb, &edpy->cursor_fb, - !edpy->y_0_top, edpy->pos_x, edpy->pos_y); + !edpy->y_0_top, edpy->pos_x, edpy->pos_y, + 1.0, 1.0); } else { /* no cursor -> use simple framebuffer blit */ egl_fb_blit(&edpy->blit_fb, &edpy->guest_fb, edpy->y_0_top); diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index 5e115b3fb4..e90eef8c9c 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -120,14 +120,15 @@ void egl_texture_blit(QemuGLShader *gls, egl_fb *dst,= egl_fb *src, bool flip) } =20 void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool f= lip, - int x, int y) + int x, int y, double scale_x, double scale_y) { glBindFramebuffer(GL_FRAMEBUFFER_EXT, dst->framebuffer); + int w =3D scale_x * src->width; + int h =3D scale_y * src->height; if (flip) { - glViewport(x, y, src->width, src->height); + glViewport(x, y, w, h); } else { - glViewport(x, dst->height - src->height - y, - src->width, src->height); + glViewport(x, dst->height - h - y, w, h); } glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, src->texture); diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index afd17148c0..42801b688b 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -278,7 +278,8 @@ void gd_egl_scanout_flush(DisplayChangeListener *dcl, vc->gfx.y0_top); egl_texture_blend(vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.cursor_fb, vc->gfx.y0_top, - vc->gfx.cursor_x, vc->gfx.cursor_y); + vc->gfx.cursor_x, vc->gfx.cursor_y, + vc->gfx.scale_x, vc->gfx.scale_y); } else { egl_fb_blit(&vc->gfx.win_fb, &vc->gfx.guest_fb, !vc->gfx.y0_top); } diff --git a/ui/spice-display.c b/ui/spice-display.c index 52f8cb5ae1..aea6f6ebce 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -1090,7 +1090,7 @@ static void qemu_spice_gl_update(DisplayChangeListene= r *dcl, egl_texture_blit(ssd->gls, &ssd->blit_fb, &ssd->guest_fb, !y_0_top); egl_texture_blend(ssd->gls, &ssd->blit_fb, &ssd->cursor_fb, - !y_0_top, x, y); + !y_0_top, x, y, 1.0, 1.0); glFlush(); } =20 --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364328734384.7817318346083; Tue, 5 Feb 2019 02:58:48 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 51BB21838; Tue, 5 Feb 2019 10:58:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16064620D6; Tue, 5 Feb 2019 10:58:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A617B18033CC; Tue, 5 Feb 2019 10:58:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15AwEps025163 for ; Tue, 5 Feb 2019 05:58:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 096BA6932D; Tue, 5 Feb 2019 10:58:14 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14E936A530; Tue, 5 Feb 2019 10:58:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 08A54960F; Tue, 5 Feb 2019 11:57:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:51 +0100 Message-Id: <20190205105758.4230-8-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Peter Maydell Subject: [libvirt] [PULL 07/14] kbd-state: add keyboard state tracker X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 05 Feb 2019 10:58:40 +0000 (UTC) Now that most user interfaces are using QKeyCodes it is easier to have common keyboard code useable by all user interfaces. This patch adds helper code to track the state of all keyboard keys, using a bitmap indexed by QKeyCode. Modifier state is tracked too, as separate bitmap. That makes checking modifier state easier. Likewise we can easily apply special handling for capslock & numlock (toggles on keypress) and ctrl + shift (we have two keys for that). Signed-off-by: Gerd Hoffmann Message-id: 20190122092814.14919-2-kraxel@redhat.com [ kraxel: added license boilerplate header ] Reviewed-by: Daniel P. Berrang=C3=A9 --- include/ui/kbd-state.h | 101 ++++++++++++++++++++++++++++++++++++++ ui/kbd-state.c | 130 +++++++++++++++++++++++++++++++++++++++++++++= ++++ ui/Makefile.objs | 2 +- 3 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 include/ui/kbd-state.h create mode 100644 ui/kbd-state.c diff --git a/include/ui/kbd-state.h b/include/ui/kbd-state.h new file mode 100644 index 0000000000..d87833553a --- /dev/null +++ b/include/ui/kbd-state.h @@ -0,0 +1,101 @@ +/* + * 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. + */ +#ifndef QEMU_UI_KBD_STATE_H +#define QEMU_UI_KBD_STATE_H 1 + +#include "qapi/qapi-types-ui.h" + +typedef enum QKbdModifier QKbdModifier; + +enum QKbdModifier { + QKBD_MOD_NONE =3D 0, + + QKBD_MOD_SHIFT, + QKBD_MOD_CTRL, + QKBD_MOD_ALT, + QKBD_MOD_ALTGR, + + QKBD_MOD_NUMLOCK, + QKBD_MOD_CAPSLOCK, + + QKBD_MOD__MAX +}; + +typedef struct QKbdState QKbdState; + +/** + * qkbd_state_init: init keyboard state tracker. + * + * Allocates and initializes keyboard state struct. + * + * @con: QemuConsole for this state tracker. Gets passed down to + * qemu_input_*() functions when sending key events to the guest. + */ +QKbdState *qkbd_state_init(QemuConsole *con); + +/** + * qkbd_state_free: free keyboard tracker state. + * + * @kbd: state tracker state. + */ +void qkbd_state_free(QKbdState *kbd); + +/** + * qkbd_state_key_event: process key event. + * + * Update keyboard state, send event to the guest. + * + * This function takes care to not send suspious events (keyup event + * for a key not pressed for example). + * + * @kbd: state tracker state. + * @qcode: the key pressed or released. + * @down: true for key down events, false otherwise. + */ +void qkbd_state_key_event(QKbdState *kbd, QKeyCode qcode, bool down); + +/** + * qkbd_state_set_delay: set key press delay. + * + * When set the specified delay will be added after each key event, + * using qemu_input_event_send_key_delay(). + * + * @kbd: state tracker state. + * @delay_ms: the delay in miliseconds. + */ +void qkbd_state_set_delay(QKbdState *kbd, int delay_ms); + +/** + * qkbd_state_key_get: get key state. + * + * Returns true when the key is down. + * + * @kbd: state tracker state. + * @qcode: the key to query. + */ +bool qkbd_state_key_get(QKbdState *kbd, QKeyCode qcode); + +/** + * qkbd_state_modifier_get: get modifier state. + * + * Returns true when the modifier is active. + * + * @kbd: state tracker state. + * @mod: the modifier to query. + */ +bool qkbd_state_modifier_get(QKbdState *kbd, QKbdModifier mod); + +/** + * qkbd_state_lift_all_keys: lift all pressed keys. + * + * This sends key up events to the guest for all keys which are in + * down state. + * + * @kbd: state tracker state. + */ +void qkbd_state_lift_all_keys(QKbdState *kbd); + +#endif /* QEMU_UI_KBD_STATE_H */ diff --git a/ui/kbd-state.c b/ui/kbd-state.c new file mode 100644 index 0000000000..ac14add70e --- /dev/null +++ b/ui/kbd-state.c @@ -0,0 +1,130 @@ +/* + * 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 "qemu/bitmap.h" +#include "qemu/queue.h" +#include "ui/console.h" +#include "ui/input.h" +#include "ui/kbd-state.h" + +struct QKbdState { + QemuConsole *con; + int key_delay_ms; + DECLARE_BITMAP(keys, Q_KEY_CODE__MAX); + DECLARE_BITMAP(mods, QKBD_MOD__MAX); +}; + +static void qkbd_state_modifier_update(QKbdState *kbd, + QKeyCode qcode1, QKeyCode qcode2, + QKbdModifier mod) +{ + if (test_bit(qcode1, kbd->keys) || test_bit(qcode2, kbd->keys)) { + set_bit(mod, kbd->mods); + } else { + clear_bit(mod, kbd->mods); + } +} + +bool qkbd_state_modifier_get(QKbdState *kbd, QKbdModifier mod) +{ + return test_bit(mod, kbd->mods); +} + +bool qkbd_state_key_get(QKbdState *kbd, QKeyCode qcode) +{ + return test_bit(qcode, kbd->keys); +} + +void qkbd_state_key_event(QKbdState *kbd, QKeyCode qcode, bool down) +{ + bool state =3D test_bit(qcode, kbd->keys); + + if (state =3D=3D down) { + /* + * Filter out events which don't change the keyboard state. + * + * Most notably this allows to simply send along all key-up + * events, and this function will filter out everything where + * the corresponding key-down event wasn't send to the guest, + * for example due to being a host hotkey. + */ + return; + } + + /* update key and modifier state */ + change_bit(qcode, kbd->keys); + switch (qcode) { + case Q_KEY_CODE_SHIFT: + case Q_KEY_CODE_SHIFT_R: + qkbd_state_modifier_update(kbd, Q_KEY_CODE_SHIFT, Q_KEY_CODE_SHIFT= _R, + QKBD_MOD_SHIFT); + break; + case Q_KEY_CODE_CTRL: + case Q_KEY_CODE_CTRL_R: + qkbd_state_modifier_update(kbd, Q_KEY_CODE_CTRL, Q_KEY_CODE_CTRL_R, + QKBD_MOD_CTRL); + break; + case Q_KEY_CODE_ALT: + qkbd_state_modifier_update(kbd, Q_KEY_CODE_ALT, Q_KEY_CODE_ALT, + QKBD_MOD_ALT); + break; + case Q_KEY_CODE_ALT_R: + qkbd_state_modifier_update(kbd, Q_KEY_CODE_ALT_R, Q_KEY_CODE_ALT_R, + QKBD_MOD_ALTGR); + break; + case Q_KEY_CODE_CAPS_LOCK: + if (down) { + change_bit(QKBD_MOD_CAPSLOCK, kbd->mods); + } + break; + case Q_KEY_CODE_NUM_LOCK: + if (down) { + change_bit(QKBD_MOD_NUMLOCK, kbd->mods); + } + break; + default: + /* keep gcc happy */ + break; + } + + /* send to guest */ + if (qemu_console_is_graphic(kbd->con)) { + qemu_input_event_send_key_qcode(kbd->con, qcode, down); + if (kbd->key_delay_ms) { + qemu_input_event_send_key_delay(kbd->key_delay_ms); + } + } +} + +void qkbd_state_lift_all_keys(QKbdState *kbd) +{ + int qcode; + + for (qcode =3D 0; qcode < Q_KEY_CODE__MAX; qcode++) { + if (test_bit(qcode, kbd->keys)) { + qkbd_state_key_event(kbd, qcode, false); + } + } +} + +void qkbd_state_set_delay(QKbdState *kbd, int delay_ms) +{ + kbd->key_delay_ms =3D delay_ms; +} + +void qkbd_state_free(QKbdState *kbd) +{ + g_free(kbd); +} + +QKbdState *qkbd_state_init(QemuConsole *con) +{ + QKbdState *kbd =3D g_new0(QKbdState, 1); + + kbd->con =3D con; + + return kbd; +} diff --git a/ui/Makefile.objs b/ui/Makefile.objs index 9b6f0c6b67..7f8b3da791 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -8,7 +8,7 @@ vnc-obj-y +=3D vnc-ws.o vnc-obj-y +=3D vnc-jobs.o =20 common-obj-y +=3D keymaps.o console.o cursor.o qemu-pixman.o -common-obj-y +=3D input.o input-keymap.o input-legacy.o +common-obj-y +=3D input.o input-keymap.o input-legacy.o kbd-state.o common-obj-$(CONFIG_LINUX) +=3D input-linux.o common-obj-$(CONFIG_SPICE) +=3D spice-core.o spice-input.o spice-display.o common-obj-$(CONFIG_COCOA) +=3D cocoa.o --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364307242251.93392947599534; Tue, 5 Feb 2019 02:58:27 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 2F6B989AC6; Tue, 5 Feb 2019 10:58:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EBE3C5FCA0; Tue, 5 Feb 2019 10:58:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 66F963F608; Tue, 5 Feb 2019 10:58:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15Aw61b025048 for ; Tue, 5 Feb 2019 05:58:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 66D7A1897A; Tue, 5 Feb 2019 10:58:06 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1683D5FCA0; Tue, 5 Feb 2019 10:58:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 11D6093E8; Tue, 5 Feb 2019 11:57:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:52 +0100 Message-Id: <20190205105758.4230-9-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Peter Maydell Subject: [libvirt] [PULL 08/14] sdl2: remove sdl2_reset_keys() function X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 05 Feb 2019 10:58:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" No users left, dead code. Signed-off-by: Gerd Hoffmann Message-id: 20190122092814.14919-3-kraxel@redhat.com --- include/ui/sdl2.h | 1 - ui/sdl2-input.c | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index f6db642b65..71f5cfc6e3 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -44,7 +44,6 @@ void sdl2_window_destroy(struct sdl2_console *scon); void sdl2_window_resize(struct sdl2_console *scon); void sdl2_poll_events(struct sdl2_console *scon); =20 -void sdl2_reset_keys(struct sdl2_console *scon); void sdl2_process_key(struct sdl2_console *scon, SDL_KeyboardEvent *ev); =20 diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c index 1378b63dd9..208266c6a5 100644 --- a/ui/sdl2-input.c +++ b/ui/sdl2-input.c @@ -32,22 +32,6 @@ =20 static uint8_t modifiers_state[SDL_NUM_SCANCODES]; =20 -void sdl2_reset_keys(struct sdl2_console *scon) -{ - QemuConsole *con =3D scon ? scon->dcl.con : NULL; - int i; - - for (i =3D 0 ; - i < SDL_NUM_SCANCODES && i < qemu_input_map_usb_to_qcode_len ; - i++) { - if (modifiers_state[i]) { - int qcode =3D qemu_input_map_usb_to_qcode[i]; - qemu_input_event_send_key_qcode(con, qcode, false); - modifiers_state[i] =3D 0; - } - } -} - void sdl2_process_key(struct sdl2_console *scon, SDL_KeyboardEvent *ev) { --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 154936432595740.583508898828086; Tue, 5 Feb 2019 02:58:45 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1054B2D80A; Tue, 5 Feb 2019 10:58:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A45856152F; Tue, 5 Feb 2019 10:58:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 365253F60E; Tue, 5 Feb 2019 10:58:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15Aw6Ec025068 for ; Tue, 5 Feb 2019 05:58:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id ABE231055009; Tue, 5 Feb 2019 10:58:06 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20E901048125; Tue, 5 Feb 2019 10:58:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1D2D38FA0; Tue, 5 Feb 2019 11:57:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:53 +0100 Message-Id: <20190205105758.4230-10-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Peter Maydell Subject: [libvirt] [PULL 09/14] kbd-state: use state tracker for sdl2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 05 Feb 2019 10:58:37 +0000 (UTC) Use the new keyboard state tracked for sdl2. We can drop the modifier state tracking from sdl2. Also keyup code is simpler, the state tracker will take care to not send suspious keyup events to the guest. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20190122092814.14919-4-kraxel@redhat.com --- include/ui/sdl2.h | 2 ++ ui/sdl2-input.c | 27 ++------------------------- ui/sdl2.c | 12 +++--------- 3 files changed, 7 insertions(+), 34 deletions(-) diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index 71f5cfc6e3..0875b8d56b 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -10,6 +10,7 @@ # include #endif =20 +#include "ui/kbd-state.h" #ifdef CONFIG_OPENGL # include "ui/egl-helpers.h" #endif @@ -30,6 +31,7 @@ struct sdl2_console { int idle_counter; int ignore_hotkeys; SDL_GLContext winctx; + QKbdState *kbd; #ifdef CONFIG_OPENGL QemuGLShader *gls; egl_fb guest_fb; diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c index 208266c6a5..22e3336aab 100644 --- a/ui/sdl2-input.c +++ b/ui/sdl2-input.c @@ -30,8 +30,6 @@ #include "ui/sdl2.h" #include "sysemu/sysemu.h" =20 -static uint8_t modifiers_state[SDL_NUM_SCANCODES]; - void sdl2_process_key(struct sdl2_console *scon, SDL_KeyboardEvent *ev) { @@ -43,31 +41,10 @@ void sdl2_process_key(struct sdl2_console *scon, } =20 qcode =3D qemu_input_map_usb_to_qcode[ev->keysym.scancode]; - - /* modifier state tracking */ - switch (ev->keysym.scancode) { - case SDL_SCANCODE_LCTRL: - case SDL_SCANCODE_LSHIFT: - case SDL_SCANCODE_LALT: - case SDL_SCANCODE_LGUI: - case SDL_SCANCODE_RCTRL: - case SDL_SCANCODE_RSHIFT: - case SDL_SCANCODE_RALT: - case SDL_SCANCODE_RGUI: - if (ev->type =3D=3D SDL_KEYUP) { - modifiers_state[ev->keysym.scancode] =3D 0; - } else { - modifiers_state[ev->keysym.scancode] =3D 1; - } - break; - default: - /* nothing */ - break; - } + qkbd_state_key_event(scon->kbd, qcode, ev->type =3D=3D SDL_KEYDOWN); =20 if (!qemu_console_is_graphic(con)) { - bool ctrl =3D (modifiers_state[SDL_SCANCODE_LCTRL] || - modifiers_state[SDL_SCANCODE_RCTRL]); + bool ctrl =3D qkbd_state_modifier_get(scon->kbd, QKBD_MOD_CTRL); if (ev->type =3D=3D SDL_KEYDOWN) { switch (ev->keysym.scancode) { case SDL_SCANCODE_RETURN: diff --git a/ui/sdl2.c b/ui/sdl2.c index cde7feba91..1277cf28fb 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -38,7 +38,6 @@ static int gui_grab; /* if true, all keyboard/mouse event= s are grabbed */ =20 static int gui_saved_grab; static int gui_fullscreen; -static int gui_keysym; static int gui_grab_code =3D KMOD_LALT | KMOD_LCTRL; static SDL_Cursor *sdl_cursor_normal; static SDL_Cursor *sdl_cursor_hidden; @@ -330,6 +329,7 @@ static void handle_keydown(SDL_Event *ev) int win; struct sdl2_console *scon =3D get_scon_from_window(ev->key.windowID); int gui_key_modifier_pressed =3D get_mod_state(); + int gui_keysym =3D 0; =20 if (!scon->ignore_hotkeys && gui_key_modifier_pressed && !ev->key.repe= at) { switch (ev->key.keysym.scancode) { @@ -410,16 +410,9 @@ static void handle_keydown(SDL_Event *ev) static void handle_keyup(SDL_Event *ev) { struct sdl2_console *scon =3D get_scon_from_window(ev->key.windowID); - int gui_key_modifier_pressed =3D get_mod_state(); =20 scon->ignore_hotkeys =3D false; - - if (!gui_key_modifier_pressed) { - gui_keysym =3D 0; - } - if (!gui_keysym) { - sdl2_process_key(scon, &ev->key); - } + sdl2_process_key(scon, &ev->key); } =20 static void handle_textinput(SDL_Event *ev) @@ -823,6 +816,7 @@ static void sdl2_display_init(DisplayState *ds, Display= Options *o) sdl2_console[i].dcl.ops =3D &dcl_2d_ops; #endif sdl2_console[i].dcl.con =3D con; + sdl2_console[i].kbd =3D qkbd_state_init(con); register_displaychangelistener(&sdl2_console[i].dcl); =20 #if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_X11) --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364305211296.098304858501; Tue, 5 Feb 2019 02:58:25 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0918281F12; Tue, 5 Feb 2019 10:58:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A55765D6A6; Tue, 5 Feb 2019 10:58:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 39A7B3F607; Tue, 5 Feb 2019 10:58:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15AwD3a025148 for ; Tue, 5 Feb 2019 05:58:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4690E4251; Tue, 5 Feb 2019 10:58:13 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D4FE17CEE; Tue, 5 Feb 2019 10:58:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 254357849; Tue, 5 Feb 2019 11:57:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:54 +0100 Message-Id: <20190205105758.4230-11-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Peter Maydell Subject: [libvirt] [PULL 10/14] sdl2: use only QKeyCode in sdl2_process_key() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 05 Feb 2019 10:58:22 +0000 (UTC) Also: sdl2_process_key is never called with scon =3D=3D NULL. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20190122092814.14919-5-kraxel@redhat.com --- ui/sdl2-input.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c index 22e3336aab..664364a5e5 100644 --- a/ui/sdl2-input.c +++ b/ui/sdl2-input.c @@ -34,20 +34,19 @@ void sdl2_process_key(struct sdl2_console *scon, SDL_KeyboardEvent *ev) { int qcode; - QemuConsole *con =3D scon ? scon->dcl.con : NULL; + QemuConsole *con =3D scon->dcl.con; =20 if (ev->keysym.scancode >=3D qemu_input_map_usb_to_qcode_len) { return; } - qcode =3D qemu_input_map_usb_to_qcode[ev->keysym.scancode]; qkbd_state_key_event(scon->kbd, qcode, ev->type =3D=3D SDL_KEYDOWN); =20 if (!qemu_console_is_graphic(con)) { bool ctrl =3D qkbd_state_modifier_get(scon->kbd, QKBD_MOD_CTRL); if (ev->type =3D=3D SDL_KEYDOWN) { - switch (ev->keysym.scancode) { - case SDL_SCANCODE_RETURN: + switch (qcode) { + case Q_KEY_CODE_RET: kbd_put_keysym_console(con, '\n'); break; default: --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364308941339.9745083589024; Tue, 5 Feb 2019 02:58:28 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id C654A10F8F; Tue, 5 Feb 2019 10:58:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 84246608C5; Tue, 5 Feb 2019 10:58:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2586618033A5; Tue, 5 Feb 2019 10:58:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15Aw78p025080 for ; Tue, 5 Feb 2019 05:58:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4A2DC5FCA0; Tue, 5 Feb 2019 10:58:07 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDA67183DE; Tue, 5 Feb 2019 10:58:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2E8D87850; Tue, 5 Feb 2019 11:57:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:55 +0100 Message-Id: <20190205105758.4230-12-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Peter Maydell Subject: [libvirt] [PULL 11/14] kbd-state: use state tracker for gtk X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 05 Feb 2019 10:58:27 +0000 (UTC) Use the new keyboard state tracked for gtk. Allows to drop the gtk-specific modifier state tracking code. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20190122092814.14919-6-kraxel@redhat.com --- include/ui/gtk.h | 2 ++ ui/gtk.c | 38 ++++++-------------------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 99edd3c085..d9eedad976 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -22,6 +22,7 @@ #include #endif =20 +#include "ui/kbd-state.h" #if defined(CONFIG_OPENGL) #include "ui/egl-helpers.h" #include "ui/egl-context.h" @@ -32,6 +33,7 @@ typedef struct GtkDisplayState GtkDisplayState; typedef struct VirtualGfxConsole { GtkWidget *drawing_area; DisplayChangeListener dcl; + QKbdState *kbd; DisplaySurface *ds; pixman_image_t *convert; cairo_surface_t *surface; diff --git a/ui/gtk.c b/ui/gtk.c index 57af69b0c4..949b143e4e 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -122,17 +122,6 @@ =20 #define HOTKEY_MODIFIERS (GDK_CONTROL_MASK | GDK_MOD1_MASK) =20 -static const int modifier_keycode[] =3D { - Q_KEY_CODE_SHIFT, - Q_KEY_CODE_SHIFT_R, - Q_KEY_CODE_CTRL, - Q_KEY_CODE_CTRL_R, - Q_KEY_CODE_ALT, - Q_KEY_CODE_ALT_R, - Q_KEY_CODE_META_L, - Q_KEY_CODE_META_R, -}; - static const guint16 *keycode_map; static size_t keycode_maplen; =20 @@ -187,7 +176,6 @@ struct GtkDisplayState { =20 bool external_pause_update; =20 - bool modifier_pressed[ARRAY_SIZE(modifier_keycode)]; bool ignore_keys; =20 DisplayOptions *opts; @@ -426,20 +414,12 @@ static void gd_update_full_redraw(VirtualConsole *vc) static void gtk_release_modifiers(GtkDisplayState *s) { VirtualConsole *vc =3D gd_vc_find_current(s); - int i, qcode; =20 if (vc->type !=3D GD_VC_GFX || !qemu_console_is_graphic(vc->gfx.dcl.con)) { return; } - for (i =3D 0; i < ARRAY_SIZE(modifier_keycode); i++) { - qcode =3D modifier_keycode[i]; - if (!s->modifier_pressed[i]) { - continue; - } - qemu_input_event_send_key_qcode(vc->gfx.dcl.con, qcode, false); - s->modifier_pressed[i] =3D false; - } + qkbd_state_lift_all_keys(vc->gfx.kbd); } =20 static void gd_widget_reparent(GtkWidget *from, GtkWidget *to, @@ -1115,7 +1095,6 @@ static gboolean gd_key_event(GtkWidget *widget, GdkEv= entKey *key, void *opaque) VirtualConsole *vc =3D opaque; GtkDisplayState *s =3D vc->s; int qcode; - int i; =20 if (s->ignore_keys) { s->ignore_keys =3D (key->type =3D=3D GDK_KEY_PRESS); @@ -1136,8 +1115,8 @@ static gboolean gd_key_event(GtkWidget *widget, GdkEv= entKey *key, void *opaque) || key->hardware_keycode =3D=3D VK_PAUSE #endif ) { - qemu_input_event_send_key_qcode(vc->gfx.dcl.con, Q_KEY_CODE_PAUSE, - key->type =3D=3D GDK_KEY_PRESS); + qkbd_state_key_event(vc->gfx.kbd, Q_KEY_CODE_PAUSE, + key->type =3D=3D GDK_KEY_PRESS); return TRUE; } =20 @@ -1146,14 +1125,8 @@ static gboolean gd_key_event(GtkWidget *widget, GdkE= ventKey *key, void *opaque) trace_gd_key_event(vc->label, key->hardware_keycode, qcode, (key->type =3D=3D GDK_KEY_PRESS) ? "down" : "up"); =20 - for (i =3D 0; i < ARRAY_SIZE(modifier_keycode); i++) { - if (qcode =3D=3D modifier_keycode[i]) { - s->modifier_pressed[i] =3D (key->type =3D=3D GDK_KEY_PRESS); - } - } - - qemu_input_event_send_key_qcode(vc->gfx.dcl.con, qcode, - key->type =3D=3D GDK_KEY_PRESS); + qkbd_state_key_event(vc->gfx.kbd, qcode, + key->type =3D=3D GDK_KEY_PRESS); =20 return TRUE; } @@ -2055,6 +2028,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vir= tualConsole *vc, gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), vc->tab_item, gtk_label_new(vc->label)); =20 + vc->gfx.kbd =3D qkbd_state_init(con); vc->gfx.dcl.con =3D con; register_displaychangelistener(&vc->gfx.dcl); =20 --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364311142389.3461163457921; Tue, 5 Feb 2019 02:58:31 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id F0BF588E50; Tue, 5 Feb 2019 10:58:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9F0317D32; Tue, 5 Feb 2019 10:58:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 654C118033A6; Tue, 5 Feb 2019 10:58:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15AwDJX025154 for ; Tue, 5 Feb 2019 05:58:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 678B3183EC; Tue, 5 Feb 2019 10:58:13 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A93760BEE; Tue, 5 Feb 2019 10:58:07 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 38AB17851; Tue, 5 Feb 2019 11:57:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:56 +0100 Message-Id: <20190205105758.4230-13-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Peter Maydell Subject: [libvirt] [PULL 12/14] kbd-state: use state tracker for vnc X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 05 Feb 2019 10:58:28 +0000 (UTC) Use the new keyboard state tracked for vnc. Allows to drop the vnc-specific modifier state tracking code. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20190122092814.14919-7-kraxel@redhat.com --- ui/vnc.h | 5 ++- ui/vnc.c | 120 ++++++++++++++++++-----------------------------------------= ---- 2 files changed, 35 insertions(+), 90 deletions(-) diff --git a/ui/vnc.h b/ui/vnc.h index a86e0610e8..81daa7a0eb 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -44,6 +44,7 @@ #include "keymaps.h" #include "vnc-palette.h" #include "vnc-enc-zrle.h" +#include "ui/kbd-state.h" =20 // #define _VNC_DEBUG 1 =20 @@ -155,7 +156,7 @@ struct VncDisplay int lock_key_sync; QEMUPutLEDEntry *led; int ledstate; - int key_delay_ms; + QKbdState *kbd; QemuMutex mutex; =20 QEMUCursor *cursor; @@ -326,8 +327,6 @@ struct VncState =20 VncReadEvent *read_handler; size_t read_handler_expect; - /* input */ - uint8_t modifiers_state[256]; =20 bool abort; QemuMutex output_mutex; diff --git a/ui/vnc.c b/ui/vnc.c index 6002d09407..8e52b999b8 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -59,7 +59,6 @@ static QTAILQ_HEAD(, VncDisplay) vnc_displays =3D QTAILQ_HEAD_INITIALIZER(vnc_displays); =20 static int vnc_cursor_define(VncState *vs); -static void vnc_release_modifiers(VncState *vs); static void vnc_update_throttle_offset(VncState *vs); =20 static void vnc_set_share_mode(VncState *vs, VncShareMode mode) @@ -1267,7 +1266,7 @@ void vnc_disconnect_finish(VncState *vs) vnc_sasl_client_cleanup(vs); #endif /* CONFIG_VNC_SASL */ audio_del(vs); - vnc_release_modifiers(vs); + qkbd_state_lift_all_keys(vs->vd->kbd); =20 if (vs->mouse_mode_notifier.notify !=3D NULL) { qemu_remove_mouse_mode_change_notifier(&vs->mouse_mode_notifier); @@ -1756,26 +1755,10 @@ static void pointer_event(VncState *vs, int button_= mask, int x, int y) qemu_input_event_sync(); } =20 -static void reset_keys(VncState *vs) +static void press_key(VncState *vs, QKeyCode qcode) { - int i; - for(i =3D 0; i < 256; i++) { - if (vs->modifiers_state[i]) { - qemu_input_event_send_key_number(vs->vd->dcl.con, i, false); - qemu_input_event_send_key_delay(vs->vd->key_delay_ms); - vs->modifiers_state[i] =3D 0; - } - } -} - -static void press_key(VncState *vs, int keysym) -{ - int keycode =3D keysym2scancode(vs->vd->kbd_layout, keysym, - false, false, false) & SCANCODE_KEYMASK; - qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, true); - qemu_input_event_send_key_delay(vs->vd->key_delay_ms); - qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, false); - qemu_input_event_send_key_delay(vs->vd->key_delay_ms); + qkbd_state_key_event(vs->vd->kbd, qcode, true); + qkbd_state_key_event(vs->vd->kbd, qcode, false); } =20 static void vnc_led_state_change(VncState *vs) @@ -1816,32 +1799,20 @@ static void kbd_leds(void *opaque, int ledstate) =20 static void do_key_event(VncState *vs, int down, int keycode, int sym) { + QKeyCode qcode =3D qemu_input_key_number_to_qcode(keycode); + /* QEMU console switch */ - switch(keycode) { - case 0x2a: /* Left Shift */ - case 0x36: /* Right Shift */ - case 0x1d: /* Left CTRL */ - case 0x9d: /* Right CTRL */ - case 0x38: /* Left ALT */ - case 0xb8: /* Right ALT */ - if (down) - vs->modifiers_state[keycode] =3D 1; - else - vs->modifiers_state[keycode] =3D 0; - break; - case 0x02 ... 0x0a: /* '1' to '9' keys */ - if (vs->vd->dcl.con =3D=3D NULL && - down && vs->modifiers_state[0x1d] && vs->modifiers_state[0x38]= ) { + switch (qcode) { + case Q_KEY_CODE_1 ... Q_KEY_CODE_9: /* '1' to '9' keys */ + if (vs->vd->dcl.con =3D=3D NULL && down && + qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CTRL) && + qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_ALT)) { /* Reset the modifiers sent to the current console */ - reset_keys(vs); - console_select(keycode - 0x02); + qkbd_state_lift_all_keys(vs->vd->kbd); + console_select(qcode - Q_KEY_CODE_1); return; } - break; - case 0x3a: /* CapsLock */ - case 0x45: /* NumLock */ - if (down) - vs->modifiers_state[keycode] ^=3D 1; + default: break; } =20 @@ -1856,16 +1827,14 @@ static void do_key_event(VncState *vs, int down, in= t keycode, int sym) toggles numlock away from the VNC window. */ if (keysym_is_numlock(vs->vd->kbd_layout, sym & 0xFFFF)) { - if (!vs->modifiers_state[0x45]) { + if (!qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_NUMLOCK)) { trace_vnc_key_sync_numlock(true); - vs->modifiers_state[0x45] =3D 1; - press_key(vs, 0xff7f); + press_key(vs, Q_KEY_CODE_NUM_LOCK); } } else { - if (vs->modifiers_state[0x45]) { + if (qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_NUMLOCK)) { trace_vnc_key_sync_numlock(false); - vs->modifiers_state[0x45] =3D 0; - press_key(vs, 0xff7f); + press_key(vs, Q_KEY_CODE_NUM_LOCK); } } } @@ -1878,30 +1847,25 @@ static void do_key_event(VncState *vs, int down, in= t keycode, int sym) toggles capslock away from the VNC window. */ int uppercase =3D !!(sym >=3D 'A' && sym <=3D 'Z'); - int shift =3D !!(vs->modifiers_state[0x2a] | vs->modifiers_state[0= x36]); - int capslock =3D !!(vs->modifiers_state[0x3a]); + bool shift =3D qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_SHIFT= ); + bool capslock =3D qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CA= PSLOCK); if (capslock) { if (uppercase =3D=3D shift) { trace_vnc_key_sync_capslock(false); - vs->modifiers_state[0x3a] =3D 0; - press_key(vs, 0xffe5); + press_key(vs, Q_KEY_CODE_CAPS_LOCK); } } else { if (uppercase !=3D shift) { trace_vnc_key_sync_capslock(true); - vs->modifiers_state[0x3a] =3D 1; - press_key(vs, 0xffe5); + press_key(vs, Q_KEY_CODE_CAPS_LOCK); } } } =20 - if (qemu_console_is_graphic(NULL)) { - qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, down); - qemu_input_event_send_key_delay(vs->vd->key_delay_ms); - } else { - bool numlock =3D vs->modifiers_state[0x45]; - bool control =3D (vs->modifiers_state[0x1d] || - vs->modifiers_state[0x9d]); + qkbd_state_key_event(vs->vd->kbd, qcode, down); + if (!qemu_console_is_graphic(NULL)) { + bool numlock =3D qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_NUM= LOCK); + bool control =3D qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CTR= L); /* QEMU console emulation */ if (down) { switch (keycode) { @@ -2002,27 +1966,6 @@ static void do_key_event(VncState *vs, int down, int= keycode, int sym) } } =20 -static void vnc_release_modifiers(VncState *vs) -{ - static const int keycodes[] =3D { - /* shift, control, alt keys, both left & right */ - 0x2a, 0x36, 0x1d, 0x9d, 0x38, 0xb8, - }; - int i, keycode; - - if (!qemu_console_is_graphic(NULL)) { - return; - } - for (i =3D 0; i < ARRAY_SIZE(keycodes); i++) { - keycode =3D keycodes[i]; - if (!vs->modifiers_state[keycode]) { - continue; - } - qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, false); - qemu_input_event_send_key_delay(vs->vd->key_delay_ms); - } -} - static const char *code2name(int keycode) { return QKeyCode_str(qemu_input_key_number_to_qcode(keycode)); @@ -2030,9 +1973,9 @@ static const char *code2name(int keycode) =20 static void key_event(VncState *vs, int down, uint32_t sym) { - bool shift =3D vs->modifiers_state[0x2a] || vs->modifiers_state[0x36]; - bool altgr =3D vs->modifiers_state[0xb8]; - bool ctrl =3D vs->modifiers_state[0x1d] || vs->modifiers_state[0x9d]; + bool shift =3D qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_SHIFT); + bool altgr =3D qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_ALTGR); + bool ctrl =3D qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CTRL); int keycode; int lsym =3D sym; =20 @@ -3259,6 +3202,7 @@ void vnc_display_init(const char *id, Error **errp) =20 vd->dcl.ops =3D &dcl_ops; register_displaychangelistener(&vd->dcl); + vd->kbd =3D qkbd_state_init(vd->dcl.con); } =20 =20 @@ -3995,7 +3939,6 @@ void vnc_display_open(const char *id, Error **errp) vd->led =3D qemu_add_led_event_handler(kbd_leds, vd); } vd->ledstate =3D 0; - vd->key_delay_ms =3D key_delay_ms; =20 device_id =3D qemu_opt_get(opts, "display"); if (device_id) { @@ -4012,10 +3955,13 @@ void vnc_display_open(const char *id, Error **errp) } =20 if (con !=3D vd->dcl.con) { + qkbd_state_free(vd->kbd); unregister_displaychangelistener(&vd->dcl); vd->dcl.con =3D con; register_displaychangelistener(&vd->dcl); + vd->kbd =3D qkbd_state_init(vd->dcl.con); } + qkbd_state_set_delay(vd->kbd, key_delay_ms); =20 if (saddr =3D=3D NULL) { goto cleanup; --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364330197123.26994583466637; Tue, 5 Feb 2019 02:58:50 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id B11AA5944F; Tue, 5 Feb 2019 10:58:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6EF84608C3; Tue, 5 Feb 2019 10:58:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0D1873F60B; Tue, 5 Feb 2019 10:58:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15Aw79J025081 for ; Tue, 5 Feb 2019 05:58:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5B99F1897A; Tue, 5 Feb 2019 10:58:07 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id D432867155; Tue, 5 Feb 2019 10:58:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 447097852; Tue, 5 Feb 2019 11:57:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:57 +0100 Message-Id: <20190205105758.4230-14-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Peter Maydell Subject: [libvirt] [PULL 13/14] keymap: pass full keyboard state to keysym2scancode X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 05 Feb 2019 10:58:33 +0000 (UTC) Pass the keyboard state tracker handle down to keysym2scancode(), so the code can fully inspect the keyboard state as needed. No functional change. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20190122092814.14919-8-kraxel@redhat.com --- ui/keymaps.h | 3 ++- ui/curses.c | 2 +- ui/keymaps.c | 8 ++++---- ui/vnc.c | 5 +---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ui/keymaps.h b/ui/keymaps.h index 4e9c87fb8f..d8652b8a5a 100644 --- a/ui/keymaps.h +++ b/ui/keymaps.h @@ -26,6 +26,7 @@ #define QEMU_KEYMAPS_H =20 #include "qemu-common.h" +#include "ui/kbd-state.h" =20 typedef struct { const char* name; @@ -55,7 +56,7 @@ typedef struct kbd_layout_t kbd_layout_t; kbd_layout_t *init_keyboard_layout(const name2keysym_t *table, const char *language, Error **errp); int keysym2scancode(kbd_layout_t *k, int keysym, - bool shift, bool altgr, bool ctrl); + QKbdState *kbd); int keycode_is_keypad(kbd_layout_t *k, int keycode); int keysym_is_numlock(kbd_layout_t *k, int keysym); =20 diff --git a/ui/curses.c b/ui/curses.c index f4e7a12f74..54687589d4 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -273,7 +273,7 @@ static void curses_refresh(DisplayChangeListener *dcl) } =20 keycode =3D keysym2scancode(kbd_layout, keysym & KEYSYM_MASK, - false, false, false); + NULL); if (keycode =3D=3D 0) continue; =20 diff --git a/ui/keymaps.c b/ui/keymaps.c index 6e44f738ed..c8b2135340 100644 --- a/ui/keymaps.c +++ b/ui/keymaps.c @@ -188,7 +188,7 @@ kbd_layout_t *init_keyboard_layout(const name2keysym_t = *table, =20 =20 int keysym2scancode(kbd_layout_t *k, int keysym, - bool shift, bool altgr, bool ctrl) + QKbdState *kbd) { static const uint32_t mask =3D SCANCODE_SHIFT | SCANCODE_ALTGR | SCANCODE_CTRL; @@ -220,13 +220,13 @@ int keysym2scancode(kbd_layout_t *k, int keysym, * If so, prefer that one. */ mods =3D 0; - if (shift) { + if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_SHIFT)) { mods |=3D SCANCODE_SHIFT; } - if (altgr) { + if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_ALTGR)) { mods |=3D SCANCODE_ALTGR; } - if (ctrl) { + if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_CTRL)) { mods |=3D SCANCODE_CTRL; } =20 diff --git a/ui/vnc.c b/ui/vnc.c index 8e52b999b8..f66ed53094 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1973,9 +1973,6 @@ static const char *code2name(int keycode) =20 static void key_event(VncState *vs, int down, uint32_t sym) { - bool shift =3D qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_SHIFT); - bool altgr =3D qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_ALTGR); - bool ctrl =3D qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CTRL); int keycode; int lsym =3D sym; =20 @@ -1984,7 +1981,7 @@ static void key_event(VncState *vs, int down, uint32_= t sym) } =20 keycode =3D keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF, - shift, altgr, ctrl) & SCANCODE_KEYMASK; + vs->vd->kbd) & SCANCODE_KEYMASK; trace_vnc_key_event_map(down, sym, keycode, code2name(keycode)); do_key_event(vs, down, keycode, sym); } --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:54:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549364324794787.2689275122129; Tue, 5 Feb 2019 02:58:44 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id B8E3CC01DE09; Tue, 5 Feb 2019 10:58:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 351D718A5A; Tue, 5 Feb 2019 10:58:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CD96518033A5; Tue, 5 Feb 2019 10:58:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15Aw7n4025091 for ; Tue, 5 Feb 2019 05:58:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id CADB11048116; Tue, 5 Feb 2019 10:58:07 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-249.ams2.redhat.com [10.36.116.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45C721055009; Tue, 5 Feb 2019 10:58:07 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 511A07853; Tue, 5 Feb 2019 11:57:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 11:57:58 +0100 Message-Id: <20190205105758.4230-15-kraxel@redhat.com> In-Reply-To: <20190205105758.4230-1-kraxel@redhat.com> References: <20190205105758.4230-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Paolo Bonzini , Gerd Hoffmann , Peter Maydell Subject: [libvirt] [PULL 14/14] keymap: fix keyup mappings X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 05 Feb 2019 10:58:43 +0000 (UTC) It is possible that the modifier state on keyup is different from the modifier state on keydown. In that case the keycode lookup can end up with different keys in case multiple keysym -> keycode mappings exist, because it picks the mapping depending on modifier state. To fix that change the lookup logic for keyup events. Instead of looking at the modifier state check the key state and prefer a keycodes where the key is in "down" state right now. Fixes: abb4f2c965 keymap: consider modifier state when picking a mapping Buglink: https://bugs.launchpad.net/bugs/1738283 Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1658676 Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20190122092814.14919-9-kraxel@redhat.com --- ui/keymaps.h | 2 +- ui/curses.c | 2 +- ui/keymaps.c | 55 ++++++++++++++++++++++++++++++++++--------------------- ui/vnc.c | 2 +- 4 files changed, 37 insertions(+), 24 deletions(-) diff --git a/ui/keymaps.h b/ui/keymaps.h index d8652b8a5a..b6d48aac40 100644 --- a/ui/keymaps.h +++ b/ui/keymaps.h @@ -56,7 +56,7 @@ typedef struct kbd_layout_t kbd_layout_t; kbd_layout_t *init_keyboard_layout(const name2keysym_t *table, const char *language, Error **errp); int keysym2scancode(kbd_layout_t *k, int keysym, - QKbdState *kbd); + QKbdState *kbd, bool down); int keycode_is_keypad(kbd_layout_t *k, int keycode); int keysym_is_numlock(kbd_layout_t *k, int keysym); =20 diff --git a/ui/curses.c b/ui/curses.c index 54687589d4..6e0091c3b2 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -273,7 +273,7 @@ static void curses_refresh(DisplayChangeListener *dcl) } =20 keycode =3D keysym2scancode(kbd_layout, keysym & KEYSYM_MASK, - NULL); + NULL, false); if (keycode =3D=3D 0) continue; =20 diff --git a/ui/keymaps.c b/ui/keymaps.c index c8b2135340..544b55c27b 100644 --- a/ui/keymaps.c +++ b/ui/keymaps.c @@ -28,6 +28,7 @@ #include "trace.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "ui/input.h" =20 struct keysym2code { uint32_t count; @@ -188,7 +189,7 @@ kbd_layout_t *init_keyboard_layout(const name2keysym_t = *table, =20 =20 int keysym2scancode(kbd_layout_t *k, int keysym, - QKbdState *kbd) + QKbdState *kbd, bool down) { static const uint32_t mask =3D SCANCODE_SHIFT | SCANCODE_ALTGR | SCANCODE_CTRL; @@ -212,27 +213,39 @@ int keysym2scancode(kbd_layout_t *k, int keysym, return keysym2code->keycodes[0]; } =20 - /* - * We have multiple keysym -> keycode mappings. - * - * Check whenever we find one mapping where the modifier state of - * the mapping matches the current user interface modifier state. - * If so, prefer that one. - */ - mods =3D 0; - if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_SHIFT)) { - mods |=3D SCANCODE_SHIFT; - } - if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_ALTGR)) { - mods |=3D SCANCODE_ALTGR; - } - if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_CTRL)) { - mods |=3D SCANCODE_CTRL; - } + /* We have multiple keysym -> keycode mappings. */ + if (down) { + /* + * On keydown: Check whenever we find one mapping where the + * modifier state of the mapping matches the current user + * interface modifier state. If so, prefer that one. + */ + mods =3D 0; + if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_SHIFT)) { + mods |=3D SCANCODE_SHIFT; + } + if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_ALTGR)) { + mods |=3D SCANCODE_ALTGR; + } + if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_CTRL)) { + mods |=3D SCANCODE_CTRL; + } =20 - for (i =3D 0; i < keysym2code->count; i++) { - if ((keysym2code->keycodes[i] & mask) =3D=3D mods) { - return keysym2code->keycodes[i]; + for (i =3D 0; i < keysym2code->count; i++) { + if ((keysym2code->keycodes[i] & mask) =3D=3D mods) { + return keysym2code->keycodes[i]; + } + } + } else { + /* + * On keyup: Try find a key which is actually down. + */ + for (i =3D 0; i < keysym2code->count; i++) { + QKeyCode qcode =3D qemu_input_key_number_to_qcode + (keysym2code->keycodes[i]); + if (kbd && qkbd_state_key_get(kbd, qcode)) { + return keysym2code->keycodes[i]; + } } } return keysym2code->keycodes[0]; diff --git a/ui/vnc.c b/ui/vnc.c index f66ed53094..0fef646fc4 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1981,7 +1981,7 @@ static void key_event(VncState *vs, int down, uint32_= t sym) } =20 keycode =3D keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF, - vs->vd->kbd) & SCANCODE_KEYMASK; + vs->vd->kbd, down) & SCANCODE_KEYMASK; trace_vnc_key_event_map(down, sym, keycode, code2name(keycode)); do_key_event(vs, down, keycode, sym); } --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list