qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] qemu + Windows NT (2000, XP, etc)
@ 2007-06-07  7:22 Michael Mohr
  2007-06-07 12:05 ` Dor Laor
  2007-06-18 19:17 ` Thiemo Seufer
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Mohr @ 2007-06-07  7:22 UTC (permalink / raw)
  To: qemu-devel, kvm-devel

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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Qemu-devel] qemu + Windows NT (2000, XP, etc)
  2007-06-07  7:22 [Qemu-devel] qemu + Windows NT (2000, XP, etc) Michael Mohr
@ 2007-06-07 12:05 ` Dor Laor
  2007-06-18 19:17 ` Thiemo Seufer
  1 sibling, 0 replies; 3+ messages in thread
From: Dor Laor @ 2007-06-07 12:05 UTC (permalink / raw)
  To: qemu-devel, kvm-devel, m.mohr

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

It bothered us too, it fits us like a globe.
Hope that it will be joined to qemu's mainline.
We'll anyway add it to kvm.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] qemu + Windows NT (2000, XP, etc)
  2007-06-07  7:22 [Qemu-devel] qemu + Windows NT (2000, XP, etc) Michael Mohr
  2007-06-07 12:05 ` Dor Laor
@ 2007-06-18 19:17 ` Thiemo Seufer
  1 sibling, 0 replies; 3+ messages in thread
From: Thiemo Seufer @ 2007-06-18 19:17 UTC (permalink / raw)
  To: Michael Mohr; +Cc: kvm-devel, qemu-devel

Michael Mohr wrote:
> 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.

I forward-ported this patch to qemu CVS, but see below...

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

I would like to keep the license the same on a per-file basis, could
you grant an (additional) BSD-style license as declared at the top of
the respective files?


Thiemo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-18 19:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-07  7:22 [Qemu-devel] qemu + Windows NT (2000, XP, etc) Michael Mohr
2007-06-07 12:05 ` Dor Laor
2007-06-18 19:17 ` Thiemo Seufer

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).