From 3780e197e4e32f0e6341bdc9a1943d0842b48ec6 Mon Sep 17 00:00:00 2001 From: ths Date: Thu, 21 Jun 2007 21:08:02 +0000 Subject: Add alternate grab key, by Michael Mohr. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2990 c046a42c-6fe2-441c-8c8c-71466251a162 --- sdl.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'sdl.c') diff --git a/sdl.c b/sdl.c index 5e70ac0..16e4df6 100644 --- a/sdl.c +++ b/sdl.c @@ -223,8 +223,12 @@ static void sdl_update_caption(void) if (!vm_running) status = " [Stopped]"; - else if (gui_grab) - status = " - Press Ctrl-Alt to exit grab"; + else if (gui_grab) { + if (!alt_grab) + status = " - Press Ctrl-Alt to exit grab"; + else + status = " - Press Ctrl-Alt-Shift to exit grab"; + } if (qemu_name) snprintf(buf, sizeof(buf), "QEMU (%s)%s", qemu_name, status); @@ -357,8 +361,13 @@ static void sdl_refresh(DisplayState *ds) case SDL_KEYDOWN: case SDL_KEYUP: if (ev->type == SDL_KEYDOWN) { - mod_state = (SDL_GetModState() & gui_grab_code) == - gui_grab_code; + if (!alt_grab) { + mod_state = (SDL_GetModState() & gui_grab_code) == + gui_grab_code; + } else { + mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) == + (gui_grab_code | KMOD_LSHIFT); + } gui_key_modifier_pressed = mod_state; if (gui_key_modifier_pressed) { int keycode; @@ -419,7 +428,12 @@ static void sdl_refresh(DisplayState *ds) } } } else if (ev->type == SDL_KEYUP) { - mod_state = (ev->key.keysym.mod & gui_grab_code); + if (!alt_grab) { + mod_state = (ev->key.keysym.mod & gui_grab_code); + } else { + mod_state = (ev->key.keysym.mod & + (gui_grab_code | KMOD_LSHIFT)); + } if (!mod_state) { if (gui_key_modifier_pressed) { gui_key_modifier_pressed = 0; -- cgit v1.1