From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 7/8] sdl: use ctrl-alt-g as grab hotkey
Date: Thu, 25 Jan 2018 15:32:17 +0100 [thread overview]
Message-ID: <20180125143218.29528-8-kraxel@redhat.com> (raw)
In-Reply-To: <20180125143218.29528-1-kraxel@redhat.com>
Be consistent with gtk and cocoa.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180115154855.30850-2-kraxel@redhat.com
---
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 f26048d3a2..0017b4a912 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -323,11 +323,11 @@ static void sdl_update_caption(void)
status = " [Stopped]";
else if (gui_grab) {
if (alt_grab)
- status = " - Press Ctrl-Alt-Shift to exit mouse grab";
+ status = " - Press Ctrl-Alt-Shift-G to exit mouse grab";
else if (ctrl_grab)
- status = " - Press Right-Ctrl to exit mouse grab";
+ status = " - Press Right-Ctrl-G to exit mouse grab";
else
- status = " - Press Ctrl-Alt to exit mouse grab";
+ status = " - Press Ctrl-Alt-G to exit mouse grab";
}
if (qemu_name) {
@@ -531,6 +531,16 @@ static void handle_keydown(SDL_Event *ev)
toggle_full_screen();
gui_keysym = 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 = 1;
+ break;
case 0x16: /* 'u' key on US keyboard */
if (scaling_active) {
scaling_active = 0;
@@ -666,20 +676,6 @@ static void handle_keyup(SDL_Event *ev)
}
if (!mod_state && gui_key_modifier_pressed) {
gui_key_modifier_pressed = 0;
- if (gui_keysym == 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 = 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 *scon)
status = " [Stopped]";
} else if (gui_grab) {
if (alt_grab) {
- status = " - Press Ctrl-Alt-Shift to exit grab";
+ status = " - Press Ctrl-Alt-Shift-G to exit grab";
} else if (ctrl_grab) {
- status = " - Press Right-Ctrl to exit grab";
+ status = " - Press Right-Ctrl-G to exit grab";
} else {
- status = " - Press Ctrl-Alt to exit grab";
+ status = " - Press Ctrl-Alt-G to exit grab";
}
}
@@ -364,6 +364,14 @@ static void handle_keydown(SDL_Event *ev)
toggle_full_screen(scon);
gui_keysym = 1;
break;
+ case SDL_SCANCODE_G:
+ gui_keysym = 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 = 0;
- if (gui_keysym == 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 = 0;
}
if (!gui_keysym) {
--
2.9.3
next prev parent reply other threads:[~2018-01-25 14:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 14:32 [Qemu-devel] [PULL 0/8] Ui 20180125 patches Gerd Hoffmann
2018-01-25 14:32 ` [Qemu-devel] [PULL 1/8] ui: avoid sign extension using client width/height Gerd Hoffmann
2018-01-25 14:32 ` [Qemu-devel] [PULL 2/8] ui: convert the SDL2 frontend to keycodemapdb Gerd Hoffmann
2018-02-01 17:28 ` Paolo Bonzini
2018-02-01 17:35 ` Daniel P. Berrangé
2018-02-01 17:37 ` Paolo Bonzini
2018-02-01 17:54 ` Daniel P. Berrangé
2018-02-01 18:10 ` Paolo Bonzini
2018-02-01 18:13 ` Daniel P. Berrangé
2018-01-25 14:32 ` [Qemu-devel] [PULL 3/8] ui: convert GTK and SDL1 frontends " Gerd Hoffmann
2018-01-25 14:32 ` [Qemu-devel] [PULL 4/8] ui: add fix for GTK Pause key handling on Win32 Gerd Hoffmann
2018-01-25 14:32 ` [Qemu-devel] [PULL 5/8] ui: ignore hardware keycode 255 on win32 Gerd Hoffmann
2018-01-25 14:32 ` [Qemu-devel] [PULL 6/8] ui: deprecate use of SDL 1.2 in favour of 2.0 series Gerd Hoffmann
2018-01-25 14:32 ` Gerd Hoffmann [this message]
2018-01-25 14:32 ` [Qemu-devel] [PULL 8/8] sdl: reorganize -no-frame support Gerd Hoffmann
2018-01-26 10:08 ` [Qemu-devel] [PULL 0/8] Ui 20180125 patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180125143218.29528-8-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).