xserver: Branch 'master' - 6 commits

Keith Packard keithp at kemper.freedesktop.org
Thu Jun 28 10:12:42 PDT 2012


 dix/getevents.c      |   40 ++++++++++++++++++++++++++++++++++------
 include/xkbsrv.h     |    5 +++++
 os/connection.c      |    1 +
 test/.gitignore      |    1 +
 test/Makefile.am     |    2 +-
 test/xi2/Makefile.am |    2 +-
 6 files changed, 43 insertions(+), 8 deletions(-)

New commits:
commit 59294a2179bd5bb996693af004b470932df00ac6
Merge: 855003c... 191b630...
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Jun 28 10:11:44 2012 -0700

    Merge remote-tracking branch 'whot/for-keith'

commit 191b630656ba206ad78b7803c3a76f7d9567d9d8
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jun 21 11:25:24 2012 +1000

    include: document _XkbErrCode2 macros
    
    Why sending the number of the (implementation-dependent) error statement to
    the client is a good idea is a bit beyond me, but at least document it so we
    can all share the despair.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index a19c8fb..d584785 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -301,6 +301,11 @@ extern _X_EXPORT const char *XkbBinDirectory;
 extern _X_EXPORT CARD32 xkbDebugFlags;
 
 #define	_XkbLibError(c,l,d)     /* Epoch fail */
+
+/* "a" is a "unique" numeric identifier that just defines which error
+ * code statement it is. _XkbErrCode2(4, foo) means "this is the 4th error
+ * statement in this function". lovely.
+ */
 #define	_XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff)))
 #define	_XkbErrCode3(a,b,c)	_XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
 #define	_XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))
commit 7100118c8d3314d73bfef0a262af56686b227055
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Jun 18 11:28:52 2012 +1000

    AC_SUBST the GLX_SYS_LIBS
    
    libxservertest needs -lpthread from glxapi.c's pthread_once() call. Usually
    this would be pulled in by the XORG_LIBS but not when building without Xorg.
    
    This commit has no visible effect on the current tree, preparation for test
    cleanups.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/test/Makefile.am b/test/Makefile.am
index b2a53aa..a5a2e5c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -20,7 +20,7 @@ INCLUDES += -I$(top_srcdir)/hw/xfree86/parser \
 	-I$(top_srcdir)/hw/xfree86/i2c -I$(top_srcdir)/hw/xfree86/modes \
 	-I$(top_srcdir)/hw/xfree86/ramdac
 endif
-TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
+TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 if XORG
 if SPECIAL_DTRACE_OBJECTS
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index 913ba0f..9de7abf 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -18,7 +18,7 @@ TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 INCLUDES = @XORG_INCS@
-TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
+TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 COMMON_SOURCES=protocol-common.h protocol-common.c
 
 if SPECIAL_DTRACE_OBJECTS
commit 014ad46f1b353a95e2c4289443ee857cfbabb3ae
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jun 21 14:26:15 2012 +1000

    os: print newline after printing display name
    
    Much easier for scripts that try to read the display value off the file
    descriptor. Plus, this restores the behaviour we had for this patch in
    Fedora since server 1.6 (April 2009).
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/os/connection.c b/os/connection.c
index 039942f..3441472 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -353,6 +353,7 @@ NotifyParentProcess(void)
 #if !defined(WIN32)
     if (dynamic_display[0]) {
         write(displayfd, dynamic_display, strlen(dynamic_display));
+        write(displayfd, "\n", 1);
         close(displayfd);
     }
     if (RunFromSmartParent) {
commit e1f86a7c77ed49e001ea42ef76ab83e87dbdf126
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Mon Jun 18 01:13:21 2012 +0300

    test/.gitignore: add hashtabletest
    
    Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/test/.gitignore b/test/.gitignore
index 5d4fdfa..23d4c8f 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,4 +1,5 @@
 fixes
+hashtabletest
 input
 list
 misc
commit 54476b5e4461ff523e935961affabcf0de12c556
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jun 7 16:52:20 2012 +1000

    dix: if the scroll valuator reaches INT_MAX, reset to 0
    
    Too much scrolling down may eventually trigger an overflow of the valuator.
    If this happens, reset the valuator to 0 and skip this event for button
    emulation. Clients will have to figure out a way to deal with this, but a
    scroll event from (close to) INT_MAX to 0 is a hint of that it needs to be
    ignored.
    
    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 baa26c4..7570852 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -35,6 +35,7 @@
 #include <X11/keysym.h>
 #include <X11/Xproto.h>
 #include <math.h>
+#include <limits.h>
 
 #include "misc.h"
 #include "resource.h"
@@ -756,6 +757,29 @@ clipAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
     }
 }
 
+static void
+add_to_scroll_valuator(DeviceIntPtr dev, ValuatorMask *mask, int valuator, double value)
+{
+    double v;
+
+    if (!valuator_mask_fetch_double(mask, valuator, &v))
+        return;
+
+    /* protect against scrolling overflow. INT_MAX for double, because
+     * we'll eventually write this as 32.32 fixed point */
+    if ((value > 0 && v > INT_MAX - value) || (value < 0 && v < INT_MIN - value)) {
+        v = 0;
+
+        /* reset last.scroll to avoid a button storm */
+        valuator_mask_set_double(dev->last.scroll, valuator, 0);
+    }
+    else
+        v += value;
+
+    valuator_mask_set_double(mask, valuator, v);
+}
+
+
 /**
  * Move the device's pointer by the values given in @valuators.
  *
@@ -774,13 +798,17 @@ moveRelative(DeviceIntPtr dev, ValuatorMask *mask)
 
         if (!valuator_mask_isset(mask, i))
             continue;
-        val += valuator_mask_get_double(mask, i);
+
+        add_to_scroll_valuator(dev, mask, i, val);
+
         /* x & y need to go over the limits to cross screens if the SD
          * isn't currently attached; otherwise, clip to screen bounds. */
         if (valuator_get_mode(dev, i) == Absolute &&
-            ((i != 0 && i != 1) || clip_xy))
+            ((i != 0 && i != 1) || clip_xy)) {
+            val = valuator_mask_get_double(mask, i);
             clipAxis(dev, i, &val);
-        valuator_mask_set_double(mask, i, val);
+            valuator_mask_set_double(mask, i, val);
+        }
     }
 }
 
@@ -1506,6 +1534,7 @@ emulate_scroll_button_events(InternalEvent *events,
     return num_events;
 }
 
+
 /**
  * Generate a complete series of InternalEvents (filled into the EventList)
  * representing pointer motion, or button presses.  If the device is a slave
@@ -1560,7 +1589,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
      * necessary. This only needs to cater for the XIScrollFlagPreferred
      * axis (if more than one scrolling axis is present) */
     if (type == ButtonPress) {
-        double val, adj;
+        double adj;
         int axis;
         int h_scroll_axis = -1;
         int v_scroll_axis = -1;
@@ -1596,8 +1625,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
 
         if (adj != 0.0 && axis != -1) {
             adj *= pDev->valuator->axes[axis].scroll.increment;
-            val = valuator_mask_get_double(&mask, axis) + adj;
-            valuator_mask_set_double(&mask, axis, val);
+            add_to_scroll_valuator(pDev, &mask, axis, adj);
             type = MotionNotify;
             buttons = 0;
             flags |= POINTER_EMULATED;


More information about the xorg-commit mailing list