From nobody Sat Apr 27 23:32:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516025988496362.0150579518868; Mon, 15 Jan 2018 06:19:48 -0800 (PST) Received: from localhost ([::1]:38924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eb5c1-0001U0-Pc for importer@patchew.org; Mon, 15 Jan 2018 09:19:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eb5aX-0000hv-09 for qemu-devel@nongnu.org; Mon, 15 Jan 2018 09:18:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eb5aR-0002DK-2g for qemu-devel@nongnu.org; Mon, 15 Jan 2018 09:18:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60386) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eb5aQ-0002D4-QC for qemu-devel@nongnu.org; Mon, 15 Jan 2018 09:18:07 -0500 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 CC8AB486BD for ; Mon, 15 Jan 2018 14:18:05 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-239.ams2.redhat.com [10.36.116.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76CF45F937; Mon, 15 Jan 2018 14:18:00 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9E6E696B41; Mon, 15 Jan 2018 15:17:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 15 Jan 2018 15:17:58 +0100 Message-Id: <20180115141759.11857-2-kraxel@redhat.com> In-Reply-To: <20180115141759.11857-1-kraxel@redhat.com> References: <20180115141759.11857-1-kraxel@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]); Mon, 15 Jan 2018 14:18:05 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/2] sdl: use ctrl-alt-g as grab hotkey X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Be consistent with gtk and cocoa. Signed-off-by: Gerd Hoffmann --- ui/sdl.c | 30 +++++++++++++----------------- ui/sdl2.c | 27 +++++++++++---------------- 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/ui/sdl.c b/ui/sdl.c index 7b71a9ac58..9c664c86a0 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -368,11 +368,11 @@ static void sdl_update_caption(void) status =3D " [Stopped]"; else if (gui_grab) { if (alt_grab) - status =3D " - Press Ctrl-Alt-Shift to exit mouse grab"; + status =3D " - Press Ctrl-Alt-Shift-G to exit mouse grab"; else if (ctrl_grab) - status =3D " - Press Right-Ctrl to exit mouse grab"; + status =3D " - Press Right-Ctrl-G to exit mouse grab"; else - status =3D " - Press Ctrl-Alt to exit mouse grab"; + status =3D " - Press Ctrl-Alt-G to exit mouse grab"; } =20 if (qemu_name) { @@ -576,6 +576,16 @@ static void handle_keydown(SDL_Event *ev) toggle_full_screen(); gui_keysym =3D 1; break; + case 0x22: /* 'g' key */ + if (!gui_grab) { + if (qemu_console_is_graphic(NULL)) { + sdl_grab_start(); + } + } else if (!gui_fullscreen) { + sdl_grab_end(); + } + gui_keysym =3D 1; + break; case 0x16: /* 'u' key on US keyboard */ if (scaling_active) { scaling_active =3D 0; @@ -711,20 +721,6 @@ static void handle_keyup(SDL_Event *ev) } if (!mod_state && gui_key_modifier_pressed) { gui_key_modifier_pressed =3D 0; - if (gui_keysym =3D=3D 0) { - /* exit/enter grab if pressing Ctrl-Alt */ - if (!gui_grab) { - if (qemu_console_is_graphic(NULL)) { - sdl_grab_start(); - } - } else if (!gui_fullscreen) { - sdl_grab_end(); - } - /* SDL does not send back all the modifiers key, so we must - * correct it. */ - reset_keys(); - return; - } gui_keysym =3D 0; } if (qemu_console_is_graphic(NULL) && !gui_keysym) { diff --git a/ui/sdl2.c b/ui/sdl2.c index 89c6a2633c..1db5dd6f5f 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -141,11 +141,11 @@ static void sdl_update_caption(struct sdl2_console *s= con) status =3D " [Stopped]"; } else if (gui_grab) { if (alt_grab) { - status =3D " - Press Ctrl-Alt-Shift to exit grab"; + status =3D " - Press Ctrl-Alt-Shift-G to exit grab"; } else if (ctrl_grab) { - status =3D " - Press Right-Ctrl to exit grab"; + status =3D " - Press Right-Ctrl-G to exit grab"; } else { - status =3D " - Press Ctrl-Alt to exit grab"; + status =3D " - Press Ctrl-Alt-G to exit grab"; } } =20 @@ -364,6 +364,14 @@ static void handle_keydown(SDL_Event *ev) toggle_full_screen(scon); gui_keysym =3D 1; break; + case SDL_SCANCODE_G: + gui_keysym =3D 1; + if (!gui_grab) { + sdl_grab_start(scon); + } else if (!gui_fullscreen) { + sdl_grab_end(scon); + } + break; case SDL_SCANCODE_U: sdl2_window_destroy(scon); sdl2_window_create(scon); @@ -416,19 +424,6 @@ static void handle_keyup(SDL_Event *ev) } if (!mod_state && gui_key_modifier_pressed) { gui_key_modifier_pressed =3D 0; - if (gui_keysym =3D=3D 0) { - /* exit/enter grab if pressing Ctrl-Alt */ - if (!gui_grab) { - sdl_grab_start(scon); - } else if (!gui_fullscreen) { - sdl_grab_end(scon); - } - /* SDL does not send back all the modifiers key, so we must - * correct it. */ - sdl2_reset_keys(scon); - return; - } - sdl2_reset_keys(scon); gui_keysym =3D 0; } if (!gui_keysym) { --=20 2.9.3 From nobody Sat Apr 27 23:32:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516026088114614.9842383799617; Mon, 15 Jan 2018 06:21:28 -0800 (PST) Received: from localhost ([::1]:39018 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eb5df-0002lD-7Y for importer@patchew.org; Mon, 15 Jan 2018 09:21:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eb5ab-0000l6-MN for qemu-devel@nongnu.org; Mon, 15 Jan 2018 09:18:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eb5aV-0002Eb-Ep for qemu-devel@nongnu.org; Mon, 15 Jan 2018 09:18:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:31096) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eb5aV-0002EJ-5o for qemu-devel@nongnu.org; Mon, 15 Jan 2018 09:18:11 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 59A81780EC for ; Mon, 15 Jan 2018 14:18:10 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-239.ams2.redhat.com [10.36.116.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id 776F95C3F8; Mon, 15 Jan 2018 14:18:00 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AA2D296B43; Mon, 15 Jan 2018 15:17:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 15 Jan 2018 15:17:59 +0100 Message-Id: <20180115141759.11857-3-kraxel@redhat.com> In-Reply-To: <20180115141759.11857-1-kraxel@redhat.com> References: <20180115141759.11857-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 15 Jan 2018 14:18:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/2] sdl: reorganize -no-frame support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Drop no_frame flag from sdl_display_init argument list, use a global variable instead. This is temporary until -no-frame support is dropped altogether when we remove sdl1 support. Remove any traces of noframe from sdl2 code. It is just dead code as sdl2 doesn't support the SDL_NOFRAME window flag any more. Signed-off-by: Gerd Hoffmann --- include/sysemu/sysemu.h | 1 + include/ui/console.h | 5 ++--- ui/sdl.c | 8 ++------ ui/sdl2.c | 7 +------ vl.c | 4 ++-- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 31612caf10..1c925309e3 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -112,6 +112,7 @@ 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/include/ui/console.h b/include/ui/console.h index 580dfc57ee..7b35778444 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -436,7 +436,7 @@ void surface_gl_setup_viewport(QemuGLShader *gls, /* sdl.c */ #ifdef CONFIG_SDL void sdl_display_early_init(int opengl); -void sdl_display_init(DisplayState *ds, int full_screen, int no_frame); +void sdl_display_init(DisplayState *ds, int full_screen); #else static inline void sdl_display_early_init(int opengl) { @@ -444,8 +444,7 @@ static inline void sdl_display_early_init(int opengl) error_report("SDL support is disabled"); abort(); } -static inline void sdl_display_init(DisplayState *ds, int full_screen, - int no_frame) +static inline void sdl_display_init(DisplayState *ds, int full_screen) { /* This must never be called if CONFIG_SDL is disabled */ error_report("SDL support is disabled"); diff --git a/ui/sdl.c b/ui/sdl.c index 9c664c86a0..0a6a94bf7c 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -48,7 +48,6 @@ static int gui_saved_width; static int gui_saved_height; static int gui_saved_grab; static int gui_fullscreen; -static int gui_noframe; static int gui_key_modifier_pressed; static int gui_keysym; static int gui_grab_code =3D KMOD_LALT | KMOD_LCTRL; @@ -114,7 +113,7 @@ static void do_sdl_resize(int width, int height, int bp= p) } else { flags |=3D SDL_RESIZABLE; } - if (gui_noframe) + if (no_frame) flags |=3D SDL_NOFRAME; =20 tmp_screen =3D SDL_SetVideoMode(width, height, bpp, flags); @@ -940,7 +939,7 @@ void sdl_display_early_init(int opengl) } } =20 -void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) +void sdl_display_init(DisplayState *ds, int full_screen) { int flags; uint8_t data =3D 0; @@ -959,9 +958,6 @@ void sdl_display_init(DisplayState *ds, int full_screen= , int no_frame) exit(1); } =20 - if (no_frame) - gui_noframe =3D 1; - if (!full_screen) { setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0); } diff --git a/ui/sdl2.c b/ui/sdl2.c index 1db5dd6f5f..812c315891 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_noframe; static int gui_key_modifier_pressed; static int gui_keysym; static int gui_grab_code =3D KMOD_LALT | KMOD_LCTRL; @@ -767,7 +766,7 @@ void sdl_display_early_init(int opengl) } } =20 -void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) +void sdl_display_init(DisplayState *ds, int full_screen) { int flags; uint8_t data =3D 0; @@ -775,10 +774,6 @@ void sdl_display_init(DisplayState *ds, int full_scree= n, int no_frame) int i; SDL_SysWMinfo info; =20 - if (no_frame) { - gui_noframe =3D 1; - } - #ifdef __linux__ /* on Linux, SDL may use fbcon|directfb|svgalib when run without * accessible $DISPLAY to open X11 window. This is often the case diff --git a/vl.c b/vl.c index 444b7507da..24d89ddca8 100644 --- a/vl.c +++ b/vl.c @@ -150,7 +150,7 @@ static int rtc_date_offset =3D -1; /* -1 means no chang= e */ QEMUClockType rtc_clock; int vga_interface_type =3D VGA_NONE; static int full_screen =3D 0; -static int no_frame =3D 0; +int no_frame =3D 0; int no_quit =3D 0; static bool grab_on_hover; Chardev *serial_hds[MAX_SERIAL_PORTS]; @@ -4692,7 +4692,7 @@ int main(int argc, char **argv, char **envp) curses_display_init(ds, full_screen); break; case DT_SDL: - sdl_display_init(ds, full_screen, no_frame); + sdl_display_init(ds, full_screen); break; case DT_COCOA: cocoa_display_init(ds, full_screen); --=20 2.9.3