Skip to contentSkip to conversation

WinXP mouse patch

Qemu-devel Mark Jonckheere 2 participants 2 messages Apr 15, 2004 – Apr 16, 2004

lore
Share & tools
lore
#0 lore raw

The following patch against the latest CVS (13 april) resolved for me the slow mouse movements in WinXP. It removes from the datastream dummy mouse-events that contain no movement or button-change. This is probably the same problem as in Win2K.

to apply the patch:
save attachment
cd qemu/hw
patch -p0 < /path/to/pckbd.diff
cd ..
make

Happy testing,
Mark.

Signature · 1 line
:wq
pckbd.c renamed from pckbd.c.orig +5 -0
@@ -442,9 +442,14 @@
     if (!(s->mouse_status & MOUSE_STATUS_ENABLED))
         return;
 
+#ifdef DEBUG_MOUSE
+    printf("MOUSE %d %d %d %d\n", dx, dy, dz, buttons_state);
+#endif
     s->mouse_dx += dx;
     s->mouse_dy -= dy;
     s->mouse_dz += dz;
+    if (s->mouse_dx == 0 && s->mouse_dy == 0 && s->mouse_dz == 0 && s->mouse_buttons == buttons_state)
+	return;
     s->mouse_buttons = buttons_state;
     
     if (!(s->mouse_status & MOUSE_STATUS_REMOTE) &&
#1 lore raw

I made this same change in bochs to make the mouse usable there. At least under linux I think it has to do with X sending the events even when they're not really needed. From Mike Nordell's post, it sounds like SDL just blindly forwards those events on without filtering.

Also, (although I don't know much about the qemu event queue) it might make sense to add the capability to merge multiple outstanding mouse events into a single event. This made a BIG difference on bochs, and could help in QEMU as well, if for no other reason than saving CPU cycles.

GREG

Quoted 43 lines · Mark Jonckheere

The following patch against the latest CVS (13 april) resolved for me the slow mouse movements in WinXP. It removes from the datastream dummy mouse-events that contain no movement or button-change. This is probably the same problem as in Win2K.

to apply the patch:
save attachment
cd qemu/hw
patch -p0 < /path/to/pckbd.diff
cd ..
make

Happy testing,
Mark.

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

pckbd.c renamed from pckbd.c.orig +5 -1
@@ -442,9 +442,14 @@
     if (!(s->mouse_status & MOUSE_STATUS_ENABLED))
         return;
 
+#ifdef DEBUG_MOUSE
+    printf("MOUSE %d %d %d %d\n", dx, dy, dz, buttons_state);
+#endif
     s->mouse_dx += dx;
     s->mouse_dy -= dy;
     s->mouse_dz += dz;
+    if (s->mouse_dx == 0 && s->mouse_dy == 0 && s->mouse_dz == 0 && s->mouse_buttons == buttons_state)
+	return;
     s->mouse_buttons = buttons_state;
 
     if (!(s->mouse_status & MOUSE_STATUS_REMOTE) &&
 
 
------------------------------------------------------------------------

_______________________________________________
Qemu-devel mailing list
[email protected]
http://mail.nongnu.org/mailman/listinfo/qemu-devel