Skip to contentSkip to conversation

qemu + Windows NT (2000, XP, etc)

PATCH Michael Mohr 3 participants 3 messages Jun 7, 2007 – Jun 18, 2007 1 message not in the archive KVM

lore
Share & tools
lore
#0 lore 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 [email protected]

June 06, 2007

sdl.c +9 -2
diff -urN qemu-org/sdl.c qemu/sdl.c
@@ -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;
vl.c +1 -0
diff -urN qemu-org/vl.c qemu/vl.c
@@ -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;
             }
         }
     }
vl.h +1 -0
diff -urN qemu-org/vl.h qemu/vl.h
@@ -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;

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): 20070607002204.091c58d9-aGa9Ms5a4DHkKPOmnyCcLeTW4wlIGRCZ@public.gmane.org

#2 lore raw
Quoted 11 lines

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.

Quoted 7 lines

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.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

#3 lore raw
In reply to a message not in the archive
Quoted 15 lines · Michael 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.

Quoted 7 lines

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

Quoted 3 lines

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

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/