xserver: Branch 'server-1.8-branch' - 5 commits

Peter Hutterer whot at kemper.freedesktop.org
Tue Apr 20 18:12:01 PDT 2010


 hw/xfree86/common/xf86Xinput.c |    8 +--
 include/xkbsrv.h               |    1 
 xkb/ddxDevBtn.c                |   16 +-----
 xkb/ddxFakeMtn.c               |  100 +++++++++--------------------------------
 xkb/xkbActions.c               |    4 -
 5 files changed, 34 insertions(+), 95 deletions(-)

New commits:
commit 5455df65207aa367531f5a3c35d39cb6c390e5de
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Apr 14 09:48:53 2010 +1000

    xkb: purge unneeded includes from ddxDevBtn.c
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    (cherry picked from commit da4e2e382828d7ba460766709368ec6214b286dd)

diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
index b8a222d..b8a1255 100644
--- a/xkb/ddxDevBtn.c
+++ b/xkb/ddxDevBtn.c
@@ -28,18 +28,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <dix-config.h>
 #endif
 
-#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/keysym.h>
 #include "inputstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "eventstr.h"
 #include <xkbsrv.h>
 #include "mi.h"
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
 
 void
 XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
commit 72664a84e0f700fc51737b76bfd89b1d3b9cbdce
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Apr 13 14:44:59 2010 +1000

    xkb: use GPE for XKB fake motion events.
    
    Section 4.6.1 of the XKB spec says that "the initial event always moves the
    cursor the distance specified in the action [...]", so skip the
    POINTER_ACCELERATE flag for GPE, it would cause double-acceleration.
    
    Potential regression - GPE expects the coordinates to be either relative or
    both. XKB in theory allows for x to be relative and y to be absolute (or
    vice versa). Let's pretend that scenario has no users.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Simon Thum <simon.thum at gmx.de>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit f4106c02318fcc4b534224df5b95a58aff555fb4)

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 278ff76..239b7a1 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -769,6 +769,7 @@ extern _X_EXPORT void XkbDDXUpdateDeviceIndicators(
 );
 
 extern _X_EXPORT void XkbDDXFakePointerMotion(
+	DeviceIntPtr	/* dev */,
  	unsigned int	/* flags */,
 	int		/* x */,
 	int		/* y */
diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c
index f90d209..b383716 100644
--- a/xkb/ddxFakeMtn.c
+++ b/xkb/ddxFakeMtn.c
@@ -28,91 +28,37 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <dix-config.h>
 #endif
 
-#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/keysym.h>
 #include "inputstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
 #include <xkbsrv.h>
-#include <X11/extensions/XI.h>
-
-#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-#endif
-
-#include "mipointer.h"
-#include "mipointrst.h"
+#include "mi.h"
 
 void
-XkbDDXFakePointerMotion(unsigned flags,int x,int y)
+XkbDDXFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
 {
-int 		   oldX,oldY;
-ScreenPtr	   pScreen, oldScreen;
-
-    GetSpritePosition(inputInfo.pointer, &oldX, &oldY);
-    pScreen = oldScreen = GetSpriteWindow(inputInfo.pointer)->drawable.pScreen;
-
-#ifdef PANORAMIX
-    if (!noPanoramiXExtension) {
-	BoxRec box;
-	int i;
+    EventListPtr        events;
+    int                 nevents, i;
+    DeviceIntPtr        ptr;
+    int                 gpe_flags = 0;
 
-	if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
-							    oldX, oldY, &box)) {
-	    FOR_NSCREENS(i) {
-		if(i == pScreen->myNum)
-		    continue;
-		if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i],
-				   oldX, oldY, &box)) {
-		    pScreen = screenInfo.screens[i];
-		    break;
-		}
-	    }
-	}
-	oldScreen = pScreen;
-
-	if (flags&XkbSA_MoveAbsoluteX)
-	     oldX=  x;
-	else oldX+= x;
-	if (flags&XkbSA_MoveAbsoluteY)
-	     oldY=  y;
-	else oldY+= y;
+    if (!dev->u.master)
+        ptr = dev;
+    else
+        ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
 
-	if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
-							    oldX, oldY, &box)) {
-	    FOR_NSCREENS(i) {
-		if(i == pScreen->myNum)
-		    continue;
-		if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i],
-				   oldX, oldY, &box)) {
-		    pScreen = screenInfo.screens[i];
-		    break;
-		}
-	    }
-	}
-	oldX -= panoramiXdataPtr[pScreen->myNum].x;
-	oldY -= panoramiXdataPtr[pScreen->myNum].y;
-    }
+    if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY)
+        gpe_flags = POINTER_ABSOLUTE;
     else
-#endif
-    {
-	if (flags&XkbSA_MoveAbsoluteX)
-	     oldX=  x;
-	else oldX+= x;
-	if (flags&XkbSA_MoveAbsoluteY)
-	     oldY=  y;
-	else oldY+= y;
+        gpe_flags = POINTER_RELATIVE;
+
+    events = InitEventList(GetMaximumEventsNum());
+    OsBlockSignals();
+    nevents = GetPointerEvents(events, ptr,
+                               MotionNotify, 0,
+                               gpe_flags, 0, 2, (int[]){x, y});
+    OsReleaseSignals();
 
-#define GetScreenPrivate(s) ((miPointerScreenPtr)dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey))
-	(*(GetScreenPrivate(oldScreen))->screenFuncs->CursorOffScreen)
-	    (&pScreen, &oldX, &oldY);
-    }
+    for (i = 0; i < nevents; i++)
+        mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);
 
-    if (pScreen != oldScreen)
-	NewCurrentScreen(inputInfo.pointer, pScreen, oldX, oldY);
-    if (pScreen->SetCursorPosition)
-	(*pScreen->SetCursorPosition)(inputInfo.pointer, pScreen, oldX, oldY, TRUE);
+    FreeEventList(events, GetMaximumEventsNum());
 }
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 2cdb6fc..4c7bce2 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -479,7 +479,7 @@ int		dx,dy;
 	dx= xkbi->mouseKeysDX;
 	dy= xkbi->mouseKeysDY;
     }
-    XkbDDXFakePointerMotion(xkbi->mouseKeysFlags,dx,dy);
+    XkbDDXFakePointerMotion(xkbi->device, xkbi->mouseKeysFlags,dx,dy);
     return xkbi->desc->ctrls->mk_interval;
 }
 
@@ -507,7 +507,7 @@ Bool	accel;
 	accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0);
 	x= XkbPtrActionX(&pAction->ptr);
 	y= XkbPtrActionY(&pAction->ptr);
-	XkbDDXFakePointerMotion(pAction->ptr.flags,x,y);
+	XkbDDXFakePointerMotion(xkbi->device, pAction->ptr.flags,x,y);
 	AccessXCancelRepeatKey(xkbi,keycode);
 	xkbi->mouseKeysAccel= accel&&
 		(xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask);
commit 3e76abe1c16ff45f25de8f20c3aaf3268dff10c8
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Apr 14 10:51:41 2010 +1000

    xkb: Guard against SIGIO updates during PointerKeys.
    
    In theory, an event coming in during GPE could reset our lastSlave, leading
    to rather interesting events lateron.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Simon Thum <simon.thum at gmx.de>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 6c42c8c356be305dc7f3f92ad8d58675da8c2f07)

diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
index 3bee84b..b8a222d 100644
--- a/xkb/ddxDevBtn.c
+++ b/xkb/ddxDevBtn.c
@@ -64,11 +64,12 @@ XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
         return;
 
     events = InitEventList(GetMaximumEventsNum());
+    OsBlockSignals();
     nevents = GetPointerEvents(events, ptr,
                                press ? ButtonPress : ButtonRelease, button,
                                0 /* flags */, 0 /* first */,
                                0 /* num_val */, NULL);
-
+    OsReleaseSignals();
 
     for (i = 0; i < nevents; i++)
         mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);
commit 37c3d2aef089a8bb45adecb4f0372c47b62e0bb7
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Apr 13 14:41:07 2010 +1000

    xkb: Post PointerKeys through the XTEST device.
    
    Posting an event through a master device may cause pointer jumps once
    lastSlave == master, caused by double scaling. To avoid this, post the fake
    event generated by XKB through the XTEST device instead.
    
    Fedora bug #560356 <https://bugzilla.redhat.com/560356>
    Tested-by: Andrew McNabb
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 108457dff816569453a2d88cd72595fa7eb02479)

diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
index 94630d1..3bee84b 100644
--- a/xkb/ddxDevBtn.c
+++ b/xkb/ddxDevBtn.c
@@ -51,13 +51,13 @@ XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
     /* If dev is a slave device, and the SD is attached, do nothing. If we'd
      * post through the attached master pointer we'd get duplicate events.
      *
-     * if dev is a master keyboard, post through the master pointer.
+     * if dev is a master keyboard, post through the XTEST device
      *
      * if dev is a floating slave, post through the device itself.
      */
 
     if (IsMaster(dev))
-        ptr = GetMaster(dev, MASTER_POINTER);
+        ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
     else if (!dev->u.master)
         ptr = dev;
     else
commit a9c978bb9723ec7c291074ff75423623c8bf7209
Author: Benjamin Tissoires <tissoire at cena.fr>
Date:   Wed Apr 14 17:27:51 2010 +0200

    xf86ScaleAxis: support for high resolution devices
    
    High resolution devices was generating integer overflow.
    For instance the wacom Cintiq 21UX has an axis value up to
    87000. Thus the term (dSx * (Cx - Rxlow)) is greater than
    MAX_INT32.
    
    Using 64bits integer avoids such problem.
    
    Signed-off-by: Philippe Ribet <ribet at cena.fr>
    Signed-off-by: Benjamin Tissoires <tissoire at cena.fr>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit a780e5b3638a0ff81301fc68aca15b47ba0befb7)

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 7723ba6..dba3370 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -86,6 +86,7 @@
 #include "windowstr.h"	/* screenIsSaved */
 
 #include <stdarg.h>
+#include <stdint.h>          /* for int64_t */
 
 #include <X11/Xpoll.h>
 
@@ -1177,12 +1178,11 @@ xf86ScaleAxis(int	Cx,
               int	Rxlow )
 {
     int X;
-    int dSx = Sxhigh - Sxlow;
-    int dRx = Rxhigh - Rxlow;
+    int64_t dSx = Sxhigh - Sxlow;
+    int64_t dRx = Rxhigh - Rxlow;
 
-    dSx = Sxhigh - Sxlow;
     if (dRx) {
-	X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow;
+	X = (int)(((dSx * (Cx - Rxlow)) / dRx) + Sxlow);
     }
     else {
 	X = 0;


More information about the xorg-commit mailing list