[Xquartz-changes] xserver: Branch 'master' - 12 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Wed Feb 22 21:17:08 PST 2012


Rebased ref, commits from common ancestor:
commit 9d25cd805bc5b7c68bbd62656dc8fabf6c693c87
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 17 13:15:12 2012 -0800

    XQuartz: Allow the user to avoid an abort on FatalError
    
    This allows users stuck in a trottle-restart loop to "deal" with it
    without popping up a crash report every 10 seconds.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index baee29d..29ead50 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -76,6 +76,8 @@ void X11ApplicationLaunchClient (const char *cmd);
 
 Bool X11ApplicationCanEnterRandR (void);
 
+void X11ApplicationFatalError(const char *f, va_list args) __printflike(1, 0);
+
 void X11ApplicationMain(int argc, char **argv, char **envp);
 
 #define PREFS_APPSMENU              "apps_menu"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 048e787..3e2fff1 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -69,6 +69,7 @@ static dispatch_queue_t eventTranslationQueue;
 #endif
 
 extern Bool noTestExtensions;
+extern BOOL serverRunning;
 
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 static TISInputSourceRef last_key_layout;
@@ -940,6 +941,47 @@ Bool X11ApplicationCanEnterRandR(void) {
     }
 }
 
+void X11ApplicationFatalError(const char *f, va_list args) {
+    NSString *title, *msg;
+    char *error_cmsg;
+
+    /* This is called by FatalError() in the server thread just before
+     * we would abort.  If the server never got off the ground, We should
+     * inform the user of the error rather than letting the ever-so-friendly
+     * CrashReporter do it for us.
+     *
+     * This also has the benefit of forcing user interaction rather than
+     * allowing an infinite throttled-restart if the crash occurs before
+     * we can drain the launchd socket.
+     */
+
+    if (serverRunning) {
+        return;
+    }
+
+    title = NSLocalizedString(@"Fatal Error",
+                              @"Dialog title when encountering a fatal error");
+    msg = NSLocalizedString(@"The X11 server encountered the following fatal error during startup.  You may either quit or trigger a crash report for more verbose information.",
+                            @"Dialog when encountering a fatal error");
+
+    vasprintf(&error_cmsg, f, args);
+    if (error_cmsg) {
+        NSString *error_msg = [NSString stringWithUTF8String:error_cmsg];
+        free(error_cmsg);
+
+        msg = [msg stringByAppendingString:@"\n\n"];
+        msg = [msg stringByAppendingString:error_msg];
+    }
+
+    if (NSAlertDefaultReturn == NSRunAlertPanel(title, msg, NSLocalizedString(@"Quit", @""),
+                                                NSLocalizedString (@"Crash", @""), nil)) {
+        exit(EXIT_FAILURE);
+    }
+
+    /* fall back to caller to do the abort() in the DIX */
+}
+
+
 static void check_xinitrc (void) {
     char *tem, buf[1024];
     NSString *msg;
diff --git a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings
index bf2089c..408462b 100644
Binary files a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings and b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings differ
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 5d2da03..c713cc1 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -77,6 +77,8 @@
 #include "quartzKeyboard.h"
 #include "quartz.h"
 
+#include "X11Application.h"
+
 aslclient aslc;
 
 void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...) {
@@ -607,7 +609,7 @@ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
  */
 void OsVendorFatalError(const char *f, va_list args)
 {
-    ErrorF( "   OsVendorFatalError\n" );
+    X11ApplicationFatalError(f, args);
 }
 
 
commit b4026421938c8b0e2e8d4c820996fe6d72fb229d
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 17 12:35:02 2012 -0800

    os: Pass the FatalError message to OsVendorFatalError
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 57c2425..9388833 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -855,7 +855,7 @@ void OsVendorInit(void)
  * OsVendorVErrorFProc will cause \a VErrorF() (which is called by the
  * two routines mentioned here, as well as by others) to use the
  * referenced routine instead of \a vfprintf().) */
-void OsVendorFatalError(void)
+void OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/dmx/dmxlog.c b/hw/dmx/dmxlog.c
index 94b8035..0ebe9f9 100644
--- a/hw/dmx/dmxlog.c
+++ b/hw/dmx/dmxlog.c
@@ -102,9 +102,6 @@ static void VFatalError(const char *format, va_list args)
 {
     VErrorF(format, args);
     ErrorF("\n");
-#ifdef DDXOSFATALERROR
-    OsVendorFatalError();
-#endif
     AbortServer();
     /*NOTREACHED*/
 }
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index f6cc351..5d69830 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -1167,7 +1167,7 @@ KdInitOutput (ScreenInfo    *pScreenInfo,
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index e1af5a4..71c7b6d 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -219,7 +219,7 @@ OsVendorInit(void)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 5263b5f..56550c9 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1036,7 +1036,7 @@ AbortDDX(enum ExitCode error)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 #ifdef VENDORSUPPORT
     ErrorF("\nPlease refer to your Operating System Vendor support pages\n"
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index af57518..b7e76b5 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -138,7 +138,7 @@ void OsVendorInit(void)
     return;
 }
 
-void OsVendorFatalError(void)
+void OsVendorFatalError(const char *f, va_list args)
 {
     return;
 }
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 465a96d..5d2da03 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -605,7 +605,7 @@ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
 /*
  * OsVendorFatalError
  */
-void OsVendorFatalError( void )
+void OsVendorFatalError(const char *f, va_list args)
 {
     ErrorF( "   OsVendorFatalError\n" );
 }
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 0440d13..82ab382 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -71,7 +71,7 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args)
  * Attempt to do last-ditch, safe, important cleanup here.
  */
 void
-OsVendorFatalError (void)
+OsVendorFatalError (const char *f, va_list args)
 {
   /* Don't give duplicate warning if UseMsg was called */
   if (g_fSilentFatalError)
diff --git a/include/os.h b/include/os.h
index 48ce329..ae7a6f1 100644
--- a/include/os.h
+++ b/include/os.h
@@ -296,7 +296,7 @@ extern _X_EXPORT void OsInit(void);
 
 extern _X_EXPORT void OsCleanup(Bool);
 
-extern _X_EXPORT void OsVendorFatalError(void);
+extern _X_EXPORT void OsVendorFatalError(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);;
 
 extern _X_EXPORT void OsVendorInit(void);
 
diff --git a/os/log.c b/os/log.c
index 671a01b..cdff7d1 100644
--- a/os/log.c
+++ b/os/log.c
@@ -585,6 +585,7 @@ void
 FatalError(const char *f, ...)
 {
     va_list args;
+    va_list args2;
     static Bool beenhere = FALSE;
 
     if (beenhere)
@@ -592,20 +593,23 @@ FatalError(const char *f, ...)
     else
 	ErrorF("\nFatal server error:\n");
 
-    va_start(args, f);
+    /* Make a copy for OsVendorFatalError */
+    va_copy(args2, args);
+
 #ifdef __APPLE__
     {
-        va_list args2;
-        va_copy(args2, args);
-        (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), f, args2);
-        va_end(args2);
+        va_list apple_args;
+        va_copy(apple_args, args);
+        (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), f, apple_args);
+        va_end(apple_args);
     }
 #endif
     VErrorF(f, args);
     va_end(args);
     ErrorF("\n");
     if (!beenhere)
-	OsVendorFatalError();
+	OsVendorFatalError(f, args2);
+    va_end(args2);
     if (!beenhere) {
 	beenhere = TRUE;
 	AbortServer();
diff --git a/test/ddxstubs.c b/test/ddxstubs.c
index baf2a7a..afaadfc 100644
--- a/test/ddxstubs.c
+++ b/test/ddxstubs.c
@@ -43,7 +43,7 @@ void ProcessInputEvents(void) {
 void OsVendorInit(void) {
 }
 
-void OsVendorFatalError(void) {
+void OsVendorFatalError(const char *f, va_list args) {
 }
 
 void AbortDDX(enum ExitCode error) {
commit 38000e7d1f958f5944e641de3e716944a5876d41
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Jan 31 11:06:21 2012 -0800

    Revert "dix: don't XWarpPointer through the last slave anymore (#38313)"
    
    This reverts commit 2bfb802839688ecf328119c4c6979390fc60348d.
    
    This commit caused a regression.
    
    See: http://xquartz.macosforge.org/trac/ticket/517#comment:10
    
    Acked-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index 9998845..9244795 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3449,21 +3449,16 @@ XineramaWarpPointer(ClientPtr client)
 {
     WindowPtr	dest = NULL;
     int		x, y, rc;
-    DeviceIntPtr dev;
-    SpritePtr   pSprite;
+    SpritePtr   pSprite = PickPointer(client)->spriteInfo->sprite;
 
     REQUEST(xWarpPointerReq);
 
+
     if (stuff->dstWid != None) {
 	rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
 	if (rc != Success)
 	    return rc;
     }
-
-    /* Post through the XTest device */
-    dev = PickPointer(client);
-    dev = GetXTestDevice(dev);
-    pSprite = dev->spriteInfo->sprite;
     x = pSprite->hotPhys.x;
     y = pSprite->hotPhys.y;
 
@@ -3513,9 +3508,9 @@ XineramaWarpPointer(ClientPtr client)
     else if (y >= pSprite->physLimits.y2)
 	y = pSprite->physLimits.y2 - 1;
     if (pSprite->hotShape)
-	ConfineToShape(dev, pSprite->hotShape, &x, &y);
+	ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y);
 
-    XineramaSetCursorPosition(dev, x, y, TRUE);
+    XineramaSetCursorPosition(PickPointer(client), x, y, TRUE);
 
     return Success;
 }
@@ -3533,7 +3528,7 @@ ProcWarpPointer(ClientPtr client)
     WindowPtr	dest = NULL;
     int		x, y, rc;
     ScreenPtr	newScreen;
-    DeviceIntPtr dev, tmp, xtest_dev = NULL;
+    DeviceIntPtr dev, tmp;
     SpritePtr   pSprite;
 
     REQUEST(xWarpPointerReq);
@@ -3546,13 +3541,11 @@ ProcWarpPointer(ClientPtr client)
 	    rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess);
 	    if (rc != Success)
 		return rc;
-            if (IsXTestDevice(tmp, dev))
-                xtest_dev = tmp;
 	}
     }
 
-    /* Use the XTest device to actually move the pointer */
-    dev = xtest_dev;
+    if (dev->lastSlave)
+        dev = dev->lastSlave;
     pSprite = dev->spriteInfo->sprite;
 
 #ifdef PANORAMIX
commit cb6a32da27f09261c4d561c19d1877c750d98cc3
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 17 13:44:12 2012 -0800

    XQuartz: Short-circuit activateX:
    
    This also avoids a deadlock when calling activateX: before the server
    thread has initialized
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 5b38eae..048e787 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -191,6 +191,9 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
 }
 
 - (void) activateX:(OSX_BOOL)state {
+    if (_x_active == state)
+        return;
+
     DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active);
     if (state) {
         if(bgMouseLocationUpdated) {
commit 1562c4a1ca748d2c4a8c69d57ba09ff7ca9cc453
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 17 13:54:57 2012 -0800

    XQuartz: Actually install the new locales
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/bundle/mk_bundke.sh b/hw/xquartz/bundle/mk_bundke.sh
index 58d5f6a..288c6a9 100755
--- a/hw/xquartz/bundle/mk_bundke.sh
+++ b/hw/xquartz/bundle/mk_bundke.sh
@@ -6,7 +6,7 @@ SRCDIR=$1
 BUILDDIR=$2
 BUNDLE_ROOT=$3
 
-localities="Dutch English French German Italian Japanese Spanish da fi ko no pl pt pt_PT ru sv zh_CN zh_TW"
+localities="Dutch English French German Italian Japanese Spanish ar ca cs da el fi he hr hu ko no pl pt pt_PT ro ru sk sv th tr uk zh_CN zh_TW"
 for lang in ${localities} ; do
     [ -d ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj ] && rm -rf ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj
     mkdir -p ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib
commit 71594746c7da32e1c7986341a0da30f241a7a2be
Merge: d53235a eaba06a
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Feb 22 18:07:20 2012 +1300

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

commit eaba06a27c5520a02f08431ac1e4b0e0bdc22cd8
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Mon Feb 13 16:00:48 2012 -0800

    Keep virtual core pointer touch class around if new slave doesn't have one
    
    The VCP may have active touch grabs. The touch records must be kept so
    these touch grabs may be accepted/rejected in the future. This means the
    touch class list will not represent the touch class of the attached
    slave device if it does not have a touch class, but we already were
    breaking that assumption by keeping a separate touches array for the
    VCP.
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index ca8060d..f390f67 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -704,13 +704,10 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
         t->motionMask = f->motionMask;
         /* to->touches and to->num_touches are separate on the master,
          * don't copy */
-    } else if (to->touch)
-    {
-        ClassesPtr classes;
-        classes = to->unused_classes;
-        classes->touch = to->touch;
-        to->touch      = NULL;
     }
+    /* Don't remove touch class if from->touch is non-existent. The to device
+     * may have an active touch grab, so we need to keep the touch class record
+     * around. */
 }
 
 /**
commit 8573b3519af138a3a12a2e77098718165f9fd8ff
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Feb 13 16:00:47 2012 -0800

    Don't clobber virtual core pointer touches array length
    
    The VCP has its own touches array, don't overwrite it when the class is
    copied from the SD to the master.
    
    Reported-by: Chase Douglas <chase.douglas at canonical.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 816dfa7..ca8060d 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -671,7 +671,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
 
     if (from->touch)
     {
-        TouchPointInfoPtr tmp;
+        TouchClassPtr t, f;
         if (!to->touch)
         {
             classes = to->unused_classes;
@@ -692,10 +692,18 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
             } else
                 classes->touch = NULL;
         }
-        tmp = to->touch->touches;
-        memcpy(to->touch, from->touch, sizeof(TouchClassRec));
-        to->touch->touches = tmp;
-        to->touch->sourceid = from->id;
+
+
+        t = to->touch;
+        f = from->touch;
+        t->sourceid = f->sourceid;
+        t->max_touches = f->max_touches;
+        t->mode = f->mode;
+        t->buttonsDown = f->buttonsDown;
+        t->state = f->state;
+        t->motionMask = f->motionMask;
+        /* to->touches and to->num_touches are separate on the master,
+         * don't copy */
     } else if (to->touch)
     {
         ClassesPtr classes;
commit 03d32fe7a718d9016053cdb5d57f51a74ef99b59
Author: Chase Douglas <chase.douglas at ubuntu.com>
Date:   Mon Feb 13 12:09:32 2012 -0800

    Don't dereference a touch after it has been ended when punting to next owner
    
    In this case, we have ended the touch because the last owner has
    rejected it. We need to return from the function right now so we don't
    attempt to dereference another touch client for early acceptance
    processing.
    
    Signed-off-by: Chase Douglas <chase.douglas at ubuntu.com>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index de7d50a..816dfa7 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1164,6 +1164,7 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
     {
         EmitTouchEnd(dev, ti, 0, 0);
         TouchEndTouch(dev, ti);
+        return;
     }
 
     if (ti->listeners[0].state == LISTENER_EARLY_ACCEPT)
commit 1ecb7aaf2adedad1996cd26176ef5802113e3ad9
Author: Chase Douglas <chase.douglas at ubuntu.com>
Date:   Sat Feb 11 07:58:38 2012 -0800

    Focus event button state must show the logical buttons, not physical buttons
    
    Similar to the fix in fcda98c48610fd507ca0b89c6006a5497d9dc1c9. This
    ensures we show the correct logical state of the buttons in device focus
    events too.
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 1ecc3ba..de7d50a 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -2215,7 +2215,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
 
     for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
         if (BitIsOn(mouse->button->down, i))
-            SetBit(&xi2event[1], i);
+            SetBit(&xi2event[1], mouse->button->map[i]);
 
     if (dev->key)
     {
commit 6f28388187cffae9e5bc9bfc9425acff4f478b59
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Sat Feb 11 01:29:26 2012 +1000

    dix: reset last.scroll when resetting the valuator (#45611)
    
    last.scroll remained on the last-submitted scrolling value but last.valuator
    was changed whenever the slave device changed. The first scrolling delta
    after a switch was then calculated as (last.scroll - new abs value), causing
    erroneous scrolling events.
    
    Test case:
    - synaptics with a scrolling method enabled, other device with 3+ axes (e.g.
      wacom)
    - scroll on touchpad
    - use other device
    - scroll on touchpad
    
    The second scroll caused erroneous button press/release events.
    
    X.Org Bug 45611 <http://bugs.freedesktop.org/show_bug.cgi?id=45611>
    
    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 7678aa1..6ea4ba0 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -360,6 +360,7 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
             if (i >= lastSlave->valuator->numAxes)
             {
                 pDev->last.valuators[i] = 0;
+                valuator_mask_set_double(pDev->last.scroll, i, 0);
             }
             else
             {
@@ -367,6 +368,7 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
                 val = rescaleValuatorAxis(val, lastSlave->valuator->axes + i,
                                           pDev->valuator->axes + i, 0, 0);
                 pDev->last.valuators[i] = val;
+                valuator_mask_set_double(pDev->last.scroll, i, val);
             }
         }
     }
commit ceb026c6a6f1eea8b34e745f06f1ebcd652c0ba1
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jan 27 12:41:09 2012 +1000

    Xi: handle new XIAllowEvents request in inputproto 2.1.99.6
    
    grab_window and touchid were removed from the struct for ABI compatibility
    reasons, we need to pull in the new, XI 2.2-specific struct.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c
index 38967b2..d0856b6 100644
--- a/Xi/xiallowev.c
+++ b/Xi/xiallowev.c
@@ -41,6 +41,7 @@
 #include <X11/extensions/XI2proto.h>
 
 #include "exglobals.h" /* BadDevice */
+#include "exevents.h"
 #include "xiallowev.h"
 
 int
@@ -51,8 +52,12 @@ SProcXIAllowEvents(ClientPtr client)
     swaps(&stuff->length);
     swaps(&stuff->deviceid);
     swapl(&stuff->time);
-    /* FIXME swap touchid */
-    /* FIXME swap window */
+    if (stuff->length > 3)
+    {
+        xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq*)stuff;
+        swapl(&req_xi22->touchid);
+        swapl(&req_xi22->grab_window);
+    }
 
     return ProcXIAllowEvents(client);
 }
@@ -63,9 +68,21 @@ ProcXIAllowEvents(ClientPtr client)
     TimeStamp time;
     DeviceIntPtr dev;
     int ret = Success;
+    XIClientPtr xi_client;
+    Bool have_xi22 = FALSE;
+    REQUEST(xXI2_2AllowEventsReq);
 
-    REQUEST(xXIAllowEventsReq);
-    /* FIXME: check request length, 12 for XI 2.0+, 20 for XI 2.2+ */
+    xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
+
+    if (version_compare(xi_client->major_version,
+                        xi_client->minor_version, 2, 2) >= 0)
+    {
+        REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq);
+        have_xi22 = TRUE;
+    } else
+    {
+        REQUEST_SIZE_MATCH(xXIAllowEventsReq);
+    }
 
     ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
     if (ret != Success)
@@ -97,8 +114,20 @@ ProcXIAllowEvents(ClientPtr client)
 	break;
     case XIRejectTouch:
     case XIAcceptTouch:
-        ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid,
-                                stuff->grab_window, &client->errorValue);
+        {
+            int rc;
+            WindowPtr win;
+
+            if (!have_xi22)
+                return BadValue;
+
+            rc = dixLookupWindow(&win, stuff->grab_window, client, DixReadAccess);
+            if (rc != Success)
+                return rc;
+
+            ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid,
+                                    stuff->grab_window, &client->errorValue);
+        }
         break;
     default:
 	client->errorValue = stuff->mode;
diff --git a/configure.ac b/configure.ac
index 6241119..7e48d44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -776,7 +776,7 @@ XPROTO="xproto >= 7.0.22"
 RANDRPROTO="randrproto >= 1.2.99.3"
 RENDERPROTO="renderproto >= 0.11"
 XEXTPROTO="xextproto >= 7.1.99"
-INPUTPROTO="inputproto >= 2.1.99.5"
+INPUTPROTO="inputproto >= 2.1.99.6"
 KBPROTO="kbproto >= 1.0.3"
 FONTSPROTO="fontsproto"
 FIXESPROTO="fixesproto >= 5.0"


More information about the Xquartz-changes mailing list