qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Mohr <m.mohr@laposte.net>
To: qemu-devel@nongnu.org, kvm-devel@lists.sourceforge.net
Subject: [Qemu-devel] qemu + Windows NT (2000, XP, etc)
Date: Thu, 7 Jun 2007 00:22:04 -0700	[thread overview]
Message-ID: <20070607002204.091c58d9@rosetta.temerity.net> (raw)

QEMU developers:

I have been using QEMU off and on for some time.  Recently I had a need
for a Windows XP VM to be joined to a domain.  I discovered a rather
annoying issue in the form of the key-grab: NT-based Microsoft
operating systems make heavy use of Ctrl-Alt-Delete, i.e. to sign on,
open the task manager, change your password, lock your screen, etc.
I've started using the tablet USB device specifically because I don't
like this grabby behaviour, and it started becoming a real problem for
everyday use.

I wrote a patch that adds a command-line switch to qemu (-alt-grab).
It allows you to remap the keygrab combination to Ctrl-Alt-Shift when
using SDL-based displays.  It has only been tested on Linux / AMD64.

Please reply to me off-list, as I am not subscribed.  Comments are
appreciated, and I would like to see this make it into the mainline
QEMU branch.

---------------------------------------------------------------------

Patches below are against kvm-26.

The included patches were written by Michael Mohr.
They are licensed to you under the GNU GPL version 2
or (at your discretion) any later version.

Michael Mohr can be contacted at m.mohr@laposte.net

June 06, 2007

diff -urN qemu-org/sdl.c qemu/sdl.c
--- qemu-org/sdl.c	2007-06-06 23:58:13.000000000 -0700
+++ qemu/sdl.c	2007-06-06 23:57:41.000000000 -0700
@@ -223,7 +223,11 @@
         strcat(buf, " [Stopped]");
     }
     if (gui_grab) {
-        strcat(buf, " - Press Ctrl-Alt to exit grab");
+        if (!alt_grab) {
+	  strcat(buf, " - Press Ctrl-Alt to exit grab");
+	} else {
+	  strcat(buf, " - Press Ctrl-Alt-Shift to exit grab");
+	}
     }
     SDL_WM_SetCaption(buf, "QEMU");
 }
@@ -331,8 +335,13 @@
         case SDL_KEYDOWN:
         case SDL_KEYUP:
             if (ev->type == SDL_KEYDOWN) {
-                mod_state = (SDL_GetModState() & gui_grab_code) ==
+	        if (!alt_grab) {
+		  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;
                 if (gui_key_modifier_pressed) {
                     int keycode;
@@ -392,7 +401,11 @@
                     }
                 }
             } 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 (gui_key_modifier_pressed) {
                         gui_key_modifier_pressed = 0;
diff -urN qemu-org/vl.c qemu/vl.c
--- qemu-org/vl.c	2007-06-06 23:58:13.000000000 -0700
+++ qemu/vl.c	2007-06-06 23:57:41.000000000 -0700
@@ -182,6 +182,7 @@
 int autostart = 1;
 int time_drift_fix = 0;
 const char *cpu_vendor_string;
+int alt_grab = 0;
 
 /***********************************************************/
 /* x86 ISA bus support */
@@ -6341,6 +6342,7 @@
            "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM
(d), or network (n)\n" "-snapshot       write to temporary files
instead of disk image files\n" #ifdef CONFIG_SDL
+           "-alt-grab       use Ctrl-Alt-Shift to grab mouse (instead
of Ctrl-Alt)\n" "-no-quit        disable SDL window close capability\n"
 #endif
 #ifdef TARGET_I386
@@ -6541,6 +6543,7 @@
     QEMU_OPTION_no_rtc,
 #endif
     QEMU_OPTION_cpu_vendor,
+    QEMU_OPTION_alt_grab
 };
 
 typedef struct QEMUOption {
@@ -6638,6 +6641,7 @@
     { "no-rtc", 0, QEMU_OPTION_no_rtc },
 #endif
     { "cpu-vendor", HAS_ARG, QEMU_OPTION_cpu_vendor },
+    { "alt-grab", 0, QEMU_OPTION_alt_grab },
     { NULL },
 };
 
@@ -7364,6 +7368,9 @@
 	    case QEMU_OPTION_cpu_vendor:
 		cpu_vendor_string = optarg;
 		break;
+	    case QEMU_OPTION_alt_grab:
+	        alt_grab = 1;
+		break;
             }
         }
     }
diff -urN qemu-org/vl.h qemu/vl.h
--- qemu-org/vl.h	2007-06-06 23:58:13.000000000 -0700
+++ qemu/vl.h	2007-06-06 23:57:41.000000000 -0700
@@ -159,6 +159,7 @@
 extern int kqemu_allowed;
 extern int kvm_allowed;
 extern int win2k_install_hack;
+extern int alt_grab;
 extern int usb_enabled;
 extern int smp_cpus;
 extern int no_quit;

             reply	other threads:[~2007-06-07  7:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07  7:22 Michael Mohr [this message]
2007-06-07 12:05 ` [Qemu-devel] qemu + Windows NT (2000, XP, etc) Dor Laor
2007-06-18 19:17 ` Thiemo Seufer

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=20070607002204.091c58d9@rosetta.temerity.net \
    --to=m.mohr@laposte.net \
    --cc=kvm-devel@lists.sourceforge.net \
    --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).