* [Qemu-devel] [PATCH] Change the behaviour of -alt-grab and add X11-shortcuts
@ 2008-02-07 22:20 Tobias Gleißner
0 siblings, 0 replies; only message in thread
From: Tobias Gleißner @ 2008-02-07 22:20 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 755 bytes --]
Hello,
this patch to sdl.c (qemu 0.9.1) changes the behavior of -alt-grab to be
similar to VirtualBox.
The reason for this is to have an easy way for sending ctrl-alt-Fn and
ctrl-alt-backspace to the guest. Since ctrl-alt-Fn and
ctrl-alt-backspace are intercepted by X11 new shortcuts are added:
<grab_key>+<Fn>
<grab_key>+<backspace>
For this to work the alternative grab key is changed from
<left_ctrl>+<left_alt>+<left_shift> to <right_ctrl>. When a ctrl-key is
needed, the left ctrl-key can still be used (this also applies to
combinations like ctrl-alt-delete for which the -alt-grab option was
originally added).
Disclaimer: I'm not very familiar with the qemu sources and perhaps
there is a nicer way for sending the keys to the guest.
[-- Attachment #2: alt-grab.patch --]
[-- Type: text/x-diff, Size: 1795 bytes --]
--- qemu/sdl.c 2008-01-06 20:38:42.000000000 +0100
+++ qemu-altgrabmod/sdl.c 2008-02-07 20:04:58.000000000 +0100
@@ -229,7 +229,7 @@
if (!alt_grab)
status = " - Press Ctrl-Alt to exit grab";
else
- status = " - Press Ctrl-Alt-Shift to exit grab";
+ status = " - Press Ctrl (right) to exit grab";
}
if (qemu_name)
@@ -367,8 +367,8 @@
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);
+ mod_state = (SDL_GetModState() & KMOD_RCTRL) ==
+ KMOD_RCTRL;
}
gui_key_modifier_pressed = mod_state;
if (gui_key_modifier_pressed) {
@@ -390,6 +390,19 @@
}
gui_keysym = 1;
break;
+ case 0x3b ... 0x44: /* F1 .. F10 keys */
+ case 0xe: /* backspace */
+ /* like sendkey ctrl-alt-(fn|backspace) */
+ /* key down */
+ kbd_put_keycode(0x1d); /* left ctrl key */
+ kbd_put_keycode(0x38); /* left alt key */
+ kbd_put_keycode(keycode);
+ /* key up */
+ kbd_put_keycode(0x1d|0x80);
+ kbd_put_keycode(0x38|0x80);
+ kbd_put_keycode(keycode|0x80);
+ gui_keysym = 1;
+ break;
default:
break;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-07 22:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-07 22:20 [Qemu-devel] [PATCH] Change the behaviour of -alt-grab and add X11-shortcuts Tobias Gleißner
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).