qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Tobias Gleißner" <Tobias.Gleissner@student.fh-nuernberg.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Change the behaviour of -alt-grab and add X11-shortcuts
Date: Thu, 7 Feb 2008 23:20:03 +0100	[thread overview]
Message-ID: <47AB8413.2020300@student.fh-nuernberg.de> (raw)

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

                 reply	other threads:[~2008-02-07 22:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47AB8413.2020300@student.fh-nuernberg.de \
    --to=tobias.gleissner@student.fh-nuernberg.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).