aboutsummaryrefslogtreecommitdiff
path: root/sdl.c
diff options
context:
space:
mode:
authorDustin Kirkland <kirkland@canonical.com>2009-09-17 15:48:04 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-06 14:36:09 -0500
commit0ca9f8a42d64571d3310ea25a63588d77efd58c3 (patch)
treecd2f18ba56b3f3dbb5ceb68e0cf9accc812e71f8 /sdl.c
parenta6af8e5f96d4815c13e58af106bb9b8535f799a4 (diff)
downloadqemu-0ca9f8a42d64571d3310ea25a63588d77efd58c3.zip
qemu-0ca9f8a42d64571d3310ea25a63588d77efd58c3.tar.gz
qemu-0ca9f8a42d64571d3310ea25a63588d77efd58c3.tar.bz2
offer right-ctrl as a grab option
Add support for -ctrl-grab to use the right-ctrl button to grab/release the mouse in SDL. The multi-button ctrl-alt and ctrl-alt-shift grab buttons present an accessibility problem to users who cannot press more than one button at a time. https://bugs.edge.launchpad.net/ubuntu/+source/qemu-kvm/+bug/237635 Signed-off-by: Dustin Kirkland <kirkland@canonical.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'sdl.c')
-rw-r--r--sdl.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sdl.c b/sdl.c
index 42b6f37..034440f 100644
--- a/sdl.c
+++ b/sdl.c
@@ -414,10 +414,12 @@ static void sdl_update_caption(void)
if (!vm_running)
status = " [Stopped]";
else if (gui_grab) {
- if (!alt_grab)
- status = " - Press Ctrl-Alt to exit grab";
- else
+ if (alt_grab)
status = " - Press Ctrl-Alt-Shift to exit grab";
+ else if (ctrl_grab)
+ status = " - Press Right-Ctrl to exit grab";
+ else
+ status = " - Press Ctrl-Alt to exit grab";
}
if (qemu_name) {
@@ -557,12 +559,14 @@ static void sdl_refresh(DisplayState *ds)
case SDL_KEYDOWN:
case SDL_KEYUP:
if (ev->type == SDL_KEYDOWN) {
- if (!alt_grab) {
- mod_state = (SDL_GetModState() & gui_grab_code) ==
- gui_grab_code;
- } else {
+ if (alt_grab) {
mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) ==
(gui_grab_code | KMOD_LSHIFT);
+ } else if (ctrl_grab) {
+ mod_state = (SDL_GetModState() & KMOD_RCTRL) == KMOD_RCTRL;
+ } else {
+ mod_state = (SDL_GetModState() & gui_grab_code) ==
+ gui_grab_code;
}
gui_key_modifier_pressed = mod_state;
if (gui_key_modifier_pressed) {