From nobody Sat Nov 1 22:28:28 2025 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509710614184852.9664849890099; Fri, 3 Nov 2017 05:03:34 -0700 (PDT) Received: from localhost ([::1]:36224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAah4-0002jl-Ch for importer@patchew.org; Fri, 03 Nov 2017 08:03:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAach-0007pL-Ep for qemu-devel@nongnu.org; Fri, 03 Nov 2017 07:58:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eAacd-00068U-AU for qemu-devel@nongnu.org; Fri, 03 Nov 2017 07:58:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48978) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eAacd-00066h-1M for qemu-devel@nongnu.org; Fri, 03 Nov 2017 07:58:51 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 048414E4C3 for ; Fri, 3 Nov 2017 11:58:50 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-41.ams2.redhat.com [10.36.116.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 196495D972; Fri, 3 Nov 2017 11:58:45 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B98243F13B; Fri, 3 Nov 2017 12:58:42 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 048414E4C3 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kraxel@redhat.com From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 3 Nov 2017 12:58:42 +0100 Message-Id: <20171103115842.1534-4-kraxel@redhat.com> In-Reply-To: <20171103115842.1534-1-kraxel@redhat.com> References: <20171103115842.1534-1-kraxel@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.38]); Fri, 03 Nov 2017 11:58:50 +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 3/3] 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 | 26 +++++++++++--------------- ui/sdl2.c | 22 +++++++++------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/ui/sdl.c b/ui/sdl.c index 2c85482b5e..6ce67eeb5a 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -364,7 +364,7 @@ static void sdl_update_caption(void) if (!runstate_is_running()) status =3D " [Stopped]"; else if (gui_grab) { - status =3D " - Press Ctrl-Alt to exit mouse grab"; + status =3D " - Press Ctrl-Alt-G to exit mouse grab"; } =20 if (qemu_name) { @@ -561,6 +561,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; @@ -692,20 +702,6 @@ static void handle_keyup(SDL_Event *ev) mod_state =3D (ev->key.keysym.mod & gui_grab_code); 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 e15566877b..105c461b21 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -139,7 +139,7 @@ static void sdl_update_caption(struct sdl2_console *sco= n) if (!runstate_is_running()) { status =3D " [Stopped]"; } else if (gui_grab) { - status =3D " - Press Ctrl-Alt to exit grab"; + status =3D " - Press Ctrl-Alt-G to exit grab"; } =20 if (qemu_name) { @@ -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); @@ -410,18 +418,6 @@ static void handle_keyup(SDL_Event *ev) mod_state =3D (ev->key.keysym.mod & gui_grab_code); 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; - } gui_keysym =3D 0; } if (!gui_keysym) { --=20 2.9.3