qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Change the behaviour of -alt-grab and add X11-short


From: Tobias Gleißner
Subject: [Qemu-devel] [PATCH] Change the behaviour of -alt-grab and add X11-shortcuts
Date: Thu, 7 Feb 2008 23:20:03 +0100
User-agent: Thunderbird 2.0.0.9 (X11/20071031)

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.
--- 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;
                     }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]