[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-input-vmmouse: cursor does move :)



Hi,

since nobody else wanted to fix the driver I had to do it by myself. With the 
attached patch applied the mouse is moving again. It turned out that the 
curent x-server does no longer call the conversion_proc function to convert 
the values provided by the vmmouse (values between 0 and 0xffff) to the 
actual screen dimensions. Hence, I ripped relevant parts out of 
VMMouseConvertProc and used them to do the conversation just before passing 
the coordinates to X. Maybe there are better ways to do this but this seems 
to work. The problem has already been discusse for the wacom driver here 
http://lists.freedesktop.org/pipermail/xorg/2007-February/022126.html

regards,
Jörg

PS: Brice, please apply this patch to the vmmouse driver, since it makes the 
driver usable even if it might not be the best solution.
--- vmmouse.c	2007-09-26 01:11:47.000000000 +0200
+++ vmmouse-new.c	2007-12-04 22:44:21.000000000 +0100
@@ -960,12 +960,15 @@
 static void
 GetVMMouseMotionEvent(InputInfoPtr pInfo){
    MouseDevPtr pMse;
+   VMMousePrivPtr mPriv;
    int buttons, dx, dy, dz, dw;
+   double factorX, factorY;
    VMMOUSE_INPUT_DATA  vmmouseInput;
    int ps2Buttons = 0;
    int numPackets;
 
    pMse = pInfo->private;  
+   mPriv = pMse->mousePriv;
    while((numPackets = VMMouseClient_GetInput(&vmmouseInput))){
       if (numPackets == VMMOUSE_ERROR) {
          VMMouseClient_Disable();
@@ -990,6 +993,13 @@
       dy = vmmouseInput.Y; 
       dz = (char)vmmouseInput.Z;
       dw = 0;
+      /* scale the input data based on the screen dimensions */
+      factorX = ((double) screenInfo.screens[mPriv->screenNum]->width) / (double) 65535;
+      factorY = ((double) screenInfo.screens[mPriv->screenNum]->height) / (double) 65535;
+
+      dx = dx * factorX + 0.5;
+      dy = dy * factorY + 0.5;
+
       /* post an event */
       pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
    }

Reply to: