xserver: Branch 'master' - 6 commits

Keith Packard keithp at kemper.freedesktop.org
Tue Dec 14 15:04:35 PST 2010


 dix/getevents.c                |   60 +++++++++++++++++++++++++----------------
 hw/xfree86/common/xf86Option.c |    2 -
 hw/xfree86/common/xf86Xinput.c |   23 ++++++++++-----
 3 files changed, 53 insertions(+), 32 deletions(-)

New commits:
commit f1542f1d716723cba7c323849086585635121893
Merge: 9716d31... 8a8fdd7...
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Dec 14 15:04:12 2010 -0800

    Merge remote branch 'whot/for-keith'

commit 8a8fdd762ad89c350854943311ec4aadc50245fa
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Dec 13 11:28:30 2010 +1000

    xfree86: always report the input options before initialising the device.
    
    After collecting the driver's default options, report the list of options
    set for the device before calling PreInit(). This helps with debugging those
    cases where options are not merged correctly.
    
    xf86OptionListReport reports with verbosity 5, higher than the default
    verbosity so this won't generate logspam in the default case.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    Reviewed-by: Simon Thum <simon.thum at gmx.de>

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 4ee8336..b9006ab 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -684,6 +684,7 @@ xf86AddInput(InputDriverPtr drv, InputInfoPtr pInfo)
     pInfo->next = NULL;
 
     xf86CollectInputOptions(pInfo, (const char**)drv->default_options);
+    xf86OptionListReport(pInfo->options);
     xf86ProcessCommonOptions(pInfo, pInfo->options);
 }
 
commit 9db9e964f6ca553dcbd3b7b037745d9581eaa065
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Dec 10 13:23:13 2010 +1000

    xfree86: swap the order to-be-merged lists in xf86CollectInputOptions.
    
    Current order causes the user-configured option list to be overwritten with
    the default list supplied by the driver. Swap around so we overwrite the
    driver's default values instead.
    
    This only affected options supplied by the driver such as XkbLayout in the
    case of evdev.
    
    Reported-by: Sebastian Glita <glseba at yahoo.com>
    Reported-by: Simon Thum <simon.thum at gmx.de>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Simon Thum <simon.thum at gmx.de>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    Tested-by: Sebastian Glita <glseba at yahoo.com>

diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index d49aa31..16c27e5 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -130,7 +130,7 @@ xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts)
     if (defaultOpts) {
 	XF86OptionPtr tmp =xf86optionListCreate(defaultOpts, -1, 0);
 	if (pInfo->options)
-	    pInfo->options = xf86optionListMerge(pInfo->options, tmp);
+	    pInfo->options = xf86optionListMerge(tmp, pInfo->options);
 	else
 	    pInfo->options = tmp;
     }
commit 0d440a1c6e219cd39dbddd2b7e813c6431aac6ea
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Dec 8 14:52:19 2010 +1000

    dix: allow for button-only input devices (#21457)
    
    Add a few checks for the existence of a valuator class on the device to
    avoid null-pointer dereferences for button events from devices without a
    valuator class.
    
    X.Org Bug 21457 <http://bugs.freedesktop.org/show_bug.cgi?id=21457>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/dix/getevents.c b/dix/getevents.c
index 9feb216..794df42 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -767,7 +767,7 @@ moveRelative(DeviceIntPtr dev, int *x, int *y, ValuatorMask *mask)
     /* if attached, clip both x and y to the defined limits (usually
      * co-ord space limit). If it is attached, we need x/y to go over the
      * limits to be able to change screens. */
-    if(dev->u.master) {
+    if(dev->u.master && dev->valuator) {
         if (valuator_get_mode(dev, 0) == Absolute)
             clipAxis(dev, 0, x);
         if (valuator_get_mode(dev, 1) == Absolute)
@@ -830,7 +830,7 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
     int old_screenx, old_screeny;
 
     /* scale x&y to screen */
-    if (dev->valuator->numAxes > 0) {
+    if (dev->valuator && dev->valuator->numAxes > 0) {
         *screenx = rescaleValuatorAxis(*x, x_frac, screenx_frac,
                 dev->valuator->axes + 0, NULL, scr->width);
     } else {
@@ -838,7 +838,7 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
         *screenx_frac = dev->last.remainder[0];
     }
 
-    if (dev->valuator->numAxes > 1) {
+    if (dev->valuator && dev->valuator->numAxes > 1) {
         *screeny = rescaleValuatorAxis(*y, y_frac, screeny_frac,
                 dev->valuator->axes + 1, NULL, scr->height);
     } else {
@@ -872,18 +872,21 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
         dev->u.master->last.remainder[1] = *screeny_frac;
     }
 
-    /* Crossed screen? Scale back to device coordiantes */
-    if(*screenx != old_screenx)
+    if (dev->valuator)
     {
-        scr = miPointerGetScreen(dev);
-        *x = rescaleValuatorAxis(*screenx, *screenx_frac, &x_frac, NULL,
-                                dev->valuator->axes + 0, scr->width);
-    }
-    if(*screeny != old_screeny)
-    {
-        scr = miPointerGetScreen(dev);
-        *y = rescaleValuatorAxis(*screeny, *screeny_frac, &y_frac, NULL,
-                                 dev->valuator->axes + 1, scr->height);
+        /* Crossed screen? Scale back to device coordiantes */
+        if(*screenx != old_screenx)
+        {
+            scr = miPointerGetScreen(dev);
+            *x = rescaleValuatorAxis(*screenx, *screenx_frac, &x_frac, NULL,
+                                    dev->valuator->axes + 0, scr->width);
+        }
+        if(*screeny != old_screeny)
+        {
+            scr = miPointerGetScreen(dev);
+            *y = rescaleValuatorAxis(*screeny, *screeny_frac, &y_frac, NULL,
+                                     dev->valuator->axes + 1, scr->height);
+        }
     }
 
     /* dropy x/y (device coordinates) back into valuators for next event */
@@ -904,6 +907,9 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
 static void
 updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms)
 {
+    if (!dev->valuator)
+        return;
+
     updateMotionHistory(dev, ms, mask, dev->last.valuators);
     if (dev->u.master)
     {
@@ -1104,7 +1110,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
     if (!pDev->enabled)
         return 0;
 
-    if (!scr || !pDev->valuator)
+    if (!scr)
         return 0;
 
     switch (type)
commit 9cf055892dd413932e54b43cc2dfea70bafd525f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Dec 8 14:43:51 2010 +1000

    xfree86: don't set movement flags for non-valuator events.
    
    If a device doesn't send valuators, don't try to move its position.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index c2cf438..4ee8336 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -1015,10 +1015,13 @@ xf86PostMotionEventM(DeviceIntPtr	device,
     int dx = 0, dy = 0;
 #endif
 
-    if (is_absolute)
-        flags = POINTER_ABSOLUTE;
-    else
-        flags = POINTER_RELATIVE | POINTER_ACCELERATE;
+    if (valuator_mask_num_valuators(mask) > 0)
+    {
+        if (is_absolute)
+            flags = POINTER_ABSOLUTE;
+        else
+            flags = POINTER_RELATIVE | POINTER_ACCELERATE;
+    }
 
 #if XFreeXDGA
     /* The evdev driver may not always send all axes across. */
@@ -1160,10 +1163,13 @@ xf86PostButtonEventM(DeviceIntPtr	device,
     int index;
 #endif
 
-    if (is_absolute)
-        flags = POINTER_ABSOLUTE;
-    else
-        flags = POINTER_RELATIVE | POINTER_ACCELERATE;
+    if (valuator_mask_num_valuators(mask) > 0)
+    {
+        if (is_absolute)
+            flags = POINTER_ABSOLUTE;
+        else
+            flags = POINTER_RELATIVE | POINTER_ACCELERATE;
+    }
 
 #if XFreeXDGA
     if (miPointerGetScreen(device)) {
commit aba8133c9c5a50753c388d76407868ac69f4134b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Dec 8 14:02:17 2010 +1000

    dix: clear up an overly convoluted if statement.
    
    No functional changes, just improves readability. This statement had things
    added to/removed from it for a few server releases while the input event
    queue was revamped. What made sense once is now mainly confusing.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index 25889de..9feb216 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1104,17 +1104,25 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
     if (!pDev->enabled)
         return 0;
 
-    ms = GetTimeInMillis(); /* before pointer update to help precision */
-
-    if (!scr || !pDev->valuator ||
-        (type != MotionNotify && type != ButtonPress && type != ButtonRelease) ||
-        (type != MotionNotify && !pDev->button) ||
-        ((type == ButtonPress || type == ButtonRelease) && !buttons))
+    if (!scr || !pDev->valuator)
         return 0;
 
-    if (type == MotionNotify &&
-        (!mask_in || valuator_mask_num_valuators(mask_in) <= 0))
-        return 0;
+    switch (type)
+    {
+        case MotionNotify:
+            if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0)
+                return 0;
+            break;
+        case ButtonPress:
+        case ButtonRelease:
+            if (!pDev->button || !buttons)
+                return 0;
+            break;
+        default:
+            return 0;
+    }
+
+    ms = GetTimeInMillis(); /* before pointer update to help precision */
 
     events = UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events);
 


More information about the xorg-commit mailing list