Commit 3780e197 authored by ths's avatar ths

Add alternate grab key, by Michael Mohr.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2990 c046a42c-6fe2-441c-8c8c-71466251a162
parent 731345e1
...@@ -223,8 +223,12 @@ static void sdl_update_caption(void) ...@@ -223,8 +223,12 @@ static void sdl_update_caption(void)
if (!vm_running) if (!vm_running)
status = " [Stopped]"; status = " [Stopped]";
else if (gui_grab) else if (gui_grab) {
status = " - Press Ctrl-Alt to exit grab"; if (!alt_grab)
status = " - Press Ctrl-Alt to exit grab";
else
status = " - Press Ctrl-Alt-Shift to exit grab";
}
if (qemu_name) if (qemu_name)
snprintf(buf, sizeof(buf), "QEMU (%s)%s", qemu_name, status); snprintf(buf, sizeof(buf), "QEMU (%s)%s", qemu_name, status);
...@@ -357,8 +361,13 @@ static void sdl_refresh(DisplayState *ds) ...@@ -357,8 +361,13 @@ static void sdl_refresh(DisplayState *ds)
case SDL_KEYDOWN: case SDL_KEYDOWN:
case SDL_KEYUP: case SDL_KEYUP:
if (ev->type == SDL_KEYDOWN) { if (ev->type == SDL_KEYDOWN) {
mod_state = (SDL_GetModState() & gui_grab_code) == if (!alt_grab) {
gui_grab_code; 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; gui_key_modifier_pressed = mod_state;
if (gui_key_modifier_pressed) { if (gui_key_modifier_pressed) {
int keycode; int keycode;
...@@ -419,7 +428,12 @@ static void sdl_refresh(DisplayState *ds) ...@@ -419,7 +428,12 @@ static void sdl_refresh(DisplayState *ds)
} }
} }
} else if (ev->type == SDL_KEYUP) { } 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 (!mod_state) {
if (gui_key_modifier_pressed) { if (gui_key_modifier_pressed) {
gui_key_modifier_pressed = 0; gui_key_modifier_pressed = 0;
......
...@@ -196,6 +196,7 @@ int nb_option_roms; ...@@ -196,6 +196,7 @@ int nb_option_roms;
int semihosting_enabled = 0; int semihosting_enabled = 0;
int autostart = 1; int autostart = 1;
const char *qemu_name; const char *qemu_name;
int alt_grab = 0;
#ifdef TARGET_SPARC #ifdef TARGET_SPARC
unsigned int nb_prom_envs = 0; unsigned int nb_prom_envs = 0;
const char *prom_envs[MAX_PROM_ENVS]; const char *prom_envs[MAX_PROM_ENVS];
...@@ -6553,6 +6554,7 @@ void help(void) ...@@ -6553,6 +6554,7 @@ void help(void)
"-snapshot write to temporary files instead of disk image files\n" "-snapshot write to temporary files instead of disk image files\n"
#ifdef CONFIG_SDL #ifdef CONFIG_SDL
"-no-frame open SDL window without a frame and window decorations\n" "-no-frame open SDL window without a frame and window decorations\n"
"-alt-grab use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt)\n"
"-no-quit disable SDL window close capability\n" "-no-quit disable SDL window close capability\n"
#endif #endif
#ifdef TARGET_I386 #ifdef TARGET_I386
...@@ -6736,6 +6738,7 @@ enum { ...@@ -6736,6 +6738,7 @@ enum {
QEMU_OPTION_loadvm, QEMU_OPTION_loadvm,
QEMU_OPTION_full_screen, QEMU_OPTION_full_screen,
QEMU_OPTION_no_frame, QEMU_OPTION_no_frame,
QEMU_OPTION_alt_grab,
QEMU_OPTION_no_quit, QEMU_OPTION_no_quit,
QEMU_OPTION_pidfile, QEMU_OPTION_pidfile,
QEMU_OPTION_no_kqemu, QEMU_OPTION_no_kqemu,
...@@ -6829,6 +6832,7 @@ const QEMUOption qemu_options[] = { ...@@ -6829,6 +6832,7 @@ const QEMUOption qemu_options[] = {
{ "full-screen", 0, QEMU_OPTION_full_screen }, { "full-screen", 0, QEMU_OPTION_full_screen },
#ifdef CONFIG_SDL #ifdef CONFIG_SDL
{ "no-frame", 0, QEMU_OPTION_no_frame }, { "no-frame", 0, QEMU_OPTION_no_frame },
{ "alt-grab", 0, QEMU_OPTION_alt_grab },
{ "no-quit", 0, QEMU_OPTION_no_quit }, { "no-quit", 0, QEMU_OPTION_no_quit },
#endif #endif
{ "pidfile", HAS_ARG, QEMU_OPTION_pidfile }, { "pidfile", HAS_ARG, QEMU_OPTION_pidfile },
...@@ -7544,6 +7548,9 @@ int main(int argc, char **argv) ...@@ -7544,6 +7548,9 @@ int main(int argc, char **argv)
case QEMU_OPTION_no_frame: case QEMU_OPTION_no_frame:
no_frame = 1; no_frame = 1;
break; break;
case QEMU_OPTION_alt_grab:
alt_grab = 1;
break;
case QEMU_OPTION_no_quit: case QEMU_OPTION_no_quit:
no_quit = 1; no_quit = 1;
break; break;
......
...@@ -156,6 +156,7 @@ extern int graphic_depth; ...@@ -156,6 +156,7 @@ extern int graphic_depth;
extern const char *keyboard_layout; extern const char *keyboard_layout;
extern int kqemu_allowed; extern int kqemu_allowed;
extern int win2k_install_hack; extern int win2k_install_hack;
extern int alt_grab;
extern int usb_enabled; extern int usb_enabled;
extern int smp_cpus; extern int smp_cpus;
extern int cursor_hide; extern int cursor_hide;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment