From f8d2c9369b8302f65f4f43f14ed3987c2268a02a Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 15 Jan 2018 16:48:54 +0100 Subject: sdl: use ctrl-alt-g as grab hotkey Be consistent with gtk and cocoa. Signed-off-by: Gerd Hoffmann Message-id: 20180115154855.30850-2-kraxel@redhat.com --- ui/sdl2.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'ui/sdl2.c') 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) { -- cgit v1.2.1