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

Jeremy Huddleston jeremyhu at freedesktop.org
Thu May 17 16:00:55 PDT 2012


Rebased ref, commits from common ancestor:
commit b193d81277b2766aedbe284452ac210d822155f7
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu May 17 10:08:02 2012 -0700

    XQuartz: Avoid a race in initialization of darwinPointer
    
    http://xquartz.macosforge.org/trac/ticket/579
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 9f4c9b7..70043e3 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -1335,7 +1335,7 @@ untrusted_str(NSEvent *e)
     int ev_button, ev_type;
     static float pressure = 0.0;       // static so ProximityOut will have the value from the previous tablet event
     static NSPoint tilt;               // static so ProximityOut will have the value from the previous tablet event
-    static DeviceIntPtr darwinTabletCurrent = NULL;
+    static DeviceIntPtr *darwinTabletCurrent = &darwinTabletStylus;
     static BOOL needsProximityIn = NO; // Do we do need to handle a pending ProximityIn once we have pressure/tilt?
     DeviceIntPtr pDev;
     int modifierFlags;
@@ -1344,16 +1344,15 @@ untrusted_str(NSEvent *e)
 #ifdef HAVE_LIBDISPATCH
     static dispatch_once_t once_pred;
     dispatch_once(&once_pred, ^{
-                      tilt = NSZeroPoint;
-                      darwinTabletCurrent = darwinTabletStylus;
-                  });
+        tilt = NSZeroPoint;
+    });
 #else
     if (!darwinTabletCurrent) {
         tilt = NSZeroPoint;
-        darwinTabletCurrent = darwinTabletStylus;
     }
 #endif
 
+
     isMouseOrTabletEvent = [e type] == NSLeftMouseDown ||
                            [e type] == NSOtherMouseDown ||
                            [e type] == NSRightMouseDown ||
@@ -1531,24 +1530,24 @@ handle_mouse:
             [e subtype] == NSTabletProximityEventSubtype) {
             switch ([e pointingDeviceType]) {
             case NSEraserPointingDevice:
-                darwinTabletCurrent = darwinTabletEraser;
+                darwinTabletCurrent = &darwinTabletEraser;
                 break;
 
             case NSPenPointingDevice:
-                darwinTabletCurrent = darwinTabletStylus;
+                darwinTabletCurrent = &darwinTabletStylus;
                 break;
 
             case NSCursorPointingDevice:
             case NSUnknownPointingDevice:
             default:
-                darwinTabletCurrent = darwinTabletCursor;
+                darwinTabletCurrent = &darwinTabletCursor;
                 break;
             }
 
             if ([e isEnteringProximity])
                 needsProximityIn = YES;
             else
-                DarwinSendTabletEvents(darwinTabletCurrent, ProximityOut, 0,
+                DarwinSendTabletEvents(*darwinTabletCurrent, ProximityOut, 0,
                                        location.x, location.y, pressure,
                                        tilt.x, tilt.y);
             return;
@@ -1559,10 +1558,10 @@ handle_mouse:
             pressure = [e pressure];
             tilt = [e tilt];
 
-            pDev = darwinTabletCurrent;
+            pDev = *darwinTabletCurrent;
 
             if (needsProximityIn) {
-                DarwinSendTabletEvents(darwinTabletCurrent, ProximityIn, 0,
+                DarwinSendTabletEvents(*darwinTabletCurrent, ProximityIn, 0,
                                        location.x, location.y, pressure,
                                        tilt.x, tilt.y);
 
@@ -1617,24 +1616,24 @@ handle_mouse:
     case NSTabletProximity:
         switch ([e pointingDeviceType]) {
         case NSEraserPointingDevice:
-            darwinTabletCurrent = darwinTabletEraser;
+            darwinTabletCurrent = &darwinTabletEraser;
             break;
 
         case NSPenPointingDevice:
-            darwinTabletCurrent = darwinTabletStylus;
+            darwinTabletCurrent = &darwinTabletStylus;
             break;
 
         case NSCursorPointingDevice:
         case NSUnknownPointingDevice:
         default:
-            darwinTabletCurrent = darwinTabletCursor;
+            darwinTabletCurrent = &darwinTabletCursor;
             break;
         }
 
         if ([e isEnteringProximity])
             needsProximityIn = YES;
         else
-            DarwinSendTabletEvents(darwinTabletCurrent, ProximityOut, 0,
+            DarwinSendTabletEvents(*darwinTabletCurrent, ProximityOut, 0,
                                    location.x, location.y, pressure,
                                    tilt.x, tilt.y);
         break;
commit f5fc5334116ad2b0c8930ac68c52bf0f7a2f1417
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon May 7 17:07:27 2012 -0700

    XQuartz: Provide fls implementation for Tiger
    
    Regression-from: 30623d6ff7bca223f9e1a825e86bd317eef8bf16
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/console_redirect.c b/hw/xquartz/console_redirect.c
index 1e0e56b..91d693b 100644
--- a/hw/xquartz/console_redirect.c
+++ b/hw/xquartz/console_redirect.c
@@ -310,6 +310,20 @@ xq_asl_init(void)
     atexit(redirect_atexit);
 }
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+#define fls(v) xq_fls(v)
+
+static inline int fls(int value) {
+    unsigned int b, v;
+
+    v = *((unsigned int *)&value);
+
+    for(b=0 ; v ; v >>= 1 , b++);
+
+    return b;
+}
+#endif
+
 int
 xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd)
 {
commit e0097ce9719f9b0aeccf7102630c0299f8acdf93
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon May 7 16:31:38 2012 -0700

    XQuartz: Tiger build fix
    
    http://trac.macports.org/ticket/34364
    
    Regression-from: 662d41acdde1dcb9774fbe4054e251c708acaffe
    
    Reported-by: Peter Dyballa <Peter_Dyballa at Freenet.DE>
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 0c3283e..9f4c9b7 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -1641,6 +1641,11 @@ handle_mouse:
 
     case NSScrollWheel:
     {
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
+        float deltaX = [e deltaX];
+        float deltaY = [e deltaY];
+        BOOL isContinuous = NO;
+#else
         CGFloat deltaX = [e deltaX];
         CGFloat deltaY = [e deltaY];
         CGEventRef cge = [e CGEvent];
@@ -1662,6 +1667,7 @@ handle_mouse:
             deltaY *= lineHeight / 5.0;
         }
 #endif
+#endif
         
 #if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0
         /* If we're in the background, we need to send a MotionNotify event
commit 4acbaa3027d89728ed932616f6ef66d93537b101
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon May 7 16:16:20 2012 -0700

    XQuartz: Workaround an SDK bug on Leopard/x86_64
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index ebaa567..62a2852 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -69,6 +69,12 @@
 #include <rootlessCommon.h>
 #include <Xplugin.h>
 
+/* Work around a bug on Leopard's headers */
+#if defined (__LP64__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 && MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+extern OSErr UpdateSystemActivity(UInt8 activity);
+#define OverallAct 0
+#endif
+
 DevPrivateKeyRec quartzScreenKeyRec;
 int aquaMenuBarHeight = 0;
 QuartzModeProcsPtr quartzProcs = NULL;
commit 31174565ec0090b4c03c9334c82878be2455f938
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Wed Apr 25 15:03:31 2012 +0200

    dix: Remove redundant declarations.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/dix/enterleave.h b/dix/enterleave.h
index 729059b..c937c0e 100644
--- a/dix/enterleave.h
+++ b/dix/enterleave.h
@@ -60,9 +60,6 @@ extern void LeaveWindow(DeviceIntPtr dev);
 extern void CoreFocusEvent(DeviceIntPtr kbd,
                            int type, int mode, int detail, WindowPtr pWin);
 
-extern void DeviceFocusEvent(DeviceIntPtr kbd,
-                             int type, int mode, int detail, WindowPtr pWin);
-
 extern void SetFocusIn(DeviceIntPtr kbd, WindowPtr win);
 
 extern void SetFocusOut(DeviceIntPtr dev);
diff --git a/include/dixevents.h b/include/dixevents.h
index c8f384e..d472969 100644
--- a/include/dixevents.h
+++ b/include/dixevents.h
@@ -77,11 +77,4 @@ extern _X_EXPORT int ProcUngrabButton(ClientPtr /* client */ );
 
 extern _X_EXPORT int ProcRecolorCursor(ClientPtr /* client */ );
 
-#ifdef PANORAMIX
-extern _X_EXPORT void PostSyntheticMotion(DeviceIntPtr pDev,
-                                          int x,
-                                          int y,
-                                          int screen, unsigned long time);
-#endif
-
 #endif                          /* DIXEVENTS_H */
diff --git a/include/input.h b/include/input.h
index 991d648..bcf98a6 100644
--- a/include/input.h
+++ b/include/input.h
@@ -472,6 +472,9 @@ extern _X_EXPORT int GetProximityEvents(InternalEvent *events,
 extern _X_EXPORT void QueueProximityEvents(DeviceIntPtr pDev,
                                            int type, const ValuatorMask *mask);
 
+#ifdef PANORAMIX
+_X_EXPORT
+#endif
 extern void PostSyntheticMotion(DeviceIntPtr pDev,
                                 int x, int y, int screen, unsigned long time);
 
commit f1cec791d1def506b99b0e6c160e9e8be107bd13
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 20:08:02 2012 +0200

    xfree86: Add ifdef wrapper to xvmodproc.h
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/dixmods/extmod/xvmodproc.h b/hw/xfree86/dixmods/extmod/xvmodproc.h
index be51e55..0090547 100644
--- a/hw/xfree86/dixmods/extmod/xvmodproc.h
+++ b/hw/xfree86/dixmods/extmod/xvmodproc.h
@@ -3,6 +3,8 @@
 #include <dix-config.h>
 #endif
 
+#ifndef XVMODPROC_H
+#define XVMODPROC_H
 #include "xvmcext.h"
 
 extern DevPrivateKey (*XvGetScreenKeyProc) (void);
@@ -11,3 +13,5 @@ extern int (*XvScreenInitProc) (ScreenPtr);
 extern int (*XvMCScreenInitProc) (ScreenPtr, int, XvMCAdaptorPtr);
 
 extern void XvRegister(void);
+
+#endif /* XVMODPROC_H */
commit d2f71b13946a14d9698d0355cc45b114b236e73b
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:44:48 2012 +0200

    Xi: Remove redundant declaration.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/Xi/chgptr.h b/Xi/chgptr.h
index 47265b3..275511f 100644
--- a/Xi/chgptr.h
+++ b/Xi/chgptr.h
@@ -39,10 +39,4 @@ int ProcXChangePointerDevice(ClientPtr  /* client */
 void DeleteFocusClassDeviceStruct(DeviceIntPtr  /* dev */
     );
 
-void SendEventToAllWindows(DeviceIntPtr /* dev */ ,
-                           Mask /* mask */ ,
-                           xEvent * /* ev */ ,
-                           int  /* count */
-    );
-
 #endif                          /* CHGPTR_H */
commit a4f87f885a55373a6daf56fd540e10c5f1db5a5c
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:43:31 2012 +0200

    kdrive: Remove redundant declarations.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 6c2f293..293798a 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -552,9 +552,6 @@ void
  KdEnableInput(void);
 
 void
- ProcessInputEvents(void);
-
-void
  KdRingBell(KdKeyboardInfo * ki, int volume, int pitch, int duration);
 
 /* kmode.c */
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index e16fe78..66cdf67 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -702,8 +702,6 @@ KdKbdCtrl(DeviceIntPtr pDevice, KeybdCtrl * ctrl)
     ki->bellDuration = ctrl->bell_duration;
 }
 
-extern KeybdCtrl defaultKeyboardControl;
-
 static int
 KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
 {
commit 369edd78769fa1a174e4091d0fa0722350df5d68
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:41:07 2012 +0200

    dix: don't duplicate DoFocusEvents declaration.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/dix/enterleave.h b/dix/enterleave.h
index c1729f8..729059b 100644
--- a/dix/enterleave.h
+++ b/dix/enterleave.h
@@ -31,13 +31,12 @@
 #ifndef ENTERLEAVE_H
 #define ENTERLEAVE_H
 
+#include <dix.h> /* DoFocusEvents() */
+
 extern void DoEnterLeaveEvents(DeviceIntPtr pDev,
                                int sourceid,
                                WindowPtr fromWin, WindowPtr toWin, int mode);
 
-extern void DoFocusEvents(DeviceIntPtr pDev,
-                          WindowPtr fromWin, WindowPtr toWin, int mode);
-
 extern void EnterLeaveEvent(DeviceIntPtr mouse,
                             int type,
                             int mode, int detail, WindowPtr pWin, Window child);
commit 36377fb0e88a6d237d98805e802ab3793582c976
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:37:30 2012 +0200

    dix: Remove redundant declarations.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/dix/events.c b/dix/events.c
index 9496b6f..83ae5c9 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -349,8 +349,6 @@ IsFloating(DeviceIntPtr dev)
  */
 extern int lastEvent;
 
-extern int DeviceMotionNotify;
-
 #define CantBeFiltered NoEventMask
 /**
  * Event masks for each event type.
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index acbb479..a788575 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -61,10 +61,7 @@
  ****************************************************************************/
 
 /* fwds */
-int
- SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
 static double
-
 SimpleSmoothProfile(DeviceIntPtr dev, DeviceVelocityPtr vel, double velocity,
                     double threshold, double acc);
 static PointerAccelerationProfileFunc
commit ea9ed83f8f0da241099d0a11c3460d46c5114dea
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:32:53 2012 +0200

    xfree86: don't include xvmodproc.h when not needed
    
    The functions are already declared in xf86xv.h
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 88e2f31..0e5b0cf 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -51,7 +51,6 @@
 #include <X11/extensions/Xv.h>
 #include <X11/extensions/Xvproto.h>
 #include "xvdix.h"
-#include "xvmodproc.h"
 
 #include "xf86xvpriv.h"
 
diff --git a/hw/xfree86/common/xf86xvmc.c b/hw/xfree86/common/xf86xvmc.c
index e584652..7321efa 100644
--- a/hw/xfree86/common/xf86xvmc.c
+++ b/hw/xfree86/common/xf86xvmc.c
@@ -40,8 +40,6 @@
 #include "resource.h"
 #include "dixstruct.h"
 
-#include "xvmodproc.h"
-
 #include "xf86xvpriv.h"
 #include "xf86xvmc.h"
 
commit 1927e5ab25c9c9bf481e75ac50f4b140a96e634a
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:24:19 2012 +0200

    xserver: Remove duplicate declaration in resource.h
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/include/resource.h b/include/resource.h
index 19f46d1..4a8dc31 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -177,9 +177,6 @@ typedef void (*FindTypeSubResources)(pointer /* value */,
                                      FindAllRes /* func */,
                                      pointer /* cdata */);
 
-extern _X_EXPORT void SetResourceTypeErrorValue(RESTYPE /*type */ ,
-                                                int /*errorValue */ );
-
 extern _X_EXPORT SizeType GetResourceTypeSizeFunc(
     RESTYPE /*type*/);
 
commit 1339681e4fbd4f5981e6246eedb23e8a9c5d10f4
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:19:43 2012 +0200

    miext: Remove redundant declaration.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/miext/shadow/shrotpackYX.h b/miext/shadow/shrotpackYX.h
index 57fcf22..f3df6c5 100644
--- a/miext/shadow/shrotpackYX.h
+++ b/miext/shadow/shrotpackYX.h
@@ -54,9 +54,6 @@
 #endif
 
 void
- FUNC(ScreenPtr pScreen, shadowBufPtr pBuf);
-
-void
 FUNC(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
     RegionPtr damage = shadowDamage(pBuf);
commit 6699f54fe0b3f4952a75e46fb6c3a643988e65dd
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:18:43 2012 +0200

    mi: Remove redundant declarations.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/mi/miinitext.c b/mi/miinitext.c
index 6ceae05..ca21b6f 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -93,64 +93,6 @@ SOFTWARE.
 #include "micmap.h"
 #include "globals.h"
 
-extern Bool noTestExtensions;
-
-#ifdef COMPOSITE
-extern Bool noCompositeExtension;
-#endif
-#ifdef DBE
-extern Bool noDbeExtension;
-#endif
-#ifdef DPMSExtension
-extern Bool noDPMSExtension;
-#endif
-#ifdef GLXEXT
-extern Bool noGlxExtension;
-#endif
-#ifdef SCREENSAVER
-extern Bool noScreenSaverExtension;
-#endif
-#ifdef MITSHM
-extern Bool noMITShmExtension;
-#endif
-#ifdef RANDR
-extern Bool noRRExtension;
-#endif
-extern Bool noRenderExtension;
-
-#ifdef XCSECURITY
-extern Bool noSecurityExtension;
-#endif
-#ifdef RES
-extern Bool noResExtension;
-#endif
-#ifdef XF86BIGFONT
-extern Bool noXFree86BigfontExtension;
-#endif
-#ifdef XFreeXDGA
-extern Bool noXFree86DGAExtension;
-#endif
-#ifdef XF86DRI
-extern Bool noXFree86DRIExtension;
-#endif
-#ifdef XF86VIDMODE
-extern Bool noXFree86VidModeExtension;
-#endif
-#ifdef XFIXES
-extern Bool noXFixesExtension;
-#endif
-#ifdef PANORAMIX
-extern Bool noPanoramiXExtension;
-#endif
-#ifdef INXQUARTZ
-extern Bool noPseudoramiXExtension;
-#endif
-#ifdef XSELINUX
-extern Bool noSELinuxExtension;
-#endif
-#ifdef XV
-extern Bool noXvExtension;
-#endif
 extern Bool noGEExtension;
 
 #ifndef XFree86LOADER
@@ -265,7 +207,6 @@ extern void DamageExtensionInit(INITARGS);
 #ifdef COMPOSITE
 extern void CompositeExtensionInit(INITARGS);
 #endif
-extern void GEExtensionInit(INITARGS);
 
 /* The following is only a small first step towards run-time
  * configurable extensions.
commit b4bf90f9fb20e0e56d2451096d4f62ecfc24a962
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:16:30 2012 +0200

    exa: Remove redundant declaration.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/exa/exa.c b/exa/exa.c
index 754c830..e22f2f0 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -483,9 +483,6 @@ static void
  exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
 
 static void
- exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
-
-static void
  exaDestroyClip(GCPtr pGC);
 
 const GCFuncs exaGCFuncs = {
commit 5595e7ce0735db6f82e1fe9df45434826019bf9e
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:15:17 2012 +0200

    randr: Remove redundant declaration.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/randr/randrstr.h b/randr/randrstr.h
index 273885d..1c0e9d4 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -575,25 +575,6 @@ extern _X_EXPORT void
  RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
 
 /*
- * Compute the complete transformation matrix including
- * client-specified transform, rotation/reflection values and the crtc 
- * offset.
- *
- * Return TRUE if the resulting transform is not a simple translation.
- */
-extern _X_EXPORT Bool
-
-RRTransformCompute(int x,
-                   int y,
-                   int width,
-                   int height,
-                   Rotation rotation,
-                   RRTransformPtr rr_transform,
-                   PictTransformPtr transform,
-                   struct pict_f_transform *f_transform,
-                   struct pict_f_transform *f_inverse);
-
-/*
  * Return crtc transform
  */
 extern _X_EXPORT RRTransformPtr RRCrtcGetTransform(RRCrtcPtr crtc);
diff --git a/randr/rrtransform.h b/randr/rrtransform.h
index efce7e0..2269b4c 100644
--- a/randr/rrtransform.h
+++ b/randr/rrtransform.h
@@ -57,6 +57,13 @@ RRTransformSetFilter(RRTransformPtr dst,
 extern _X_EXPORT Bool
  RRTransformCopy(RRTransformPtr dst, RRTransformPtr src);
 
+/*
+ * Compute the complete transformation matrix including
+ * client-specified transform, rotation/reflection values and the crtc 
+ * offset.
+ *
+ * Return TRUE if the resulting transform is not a simple translation.
+ */
 extern _X_EXPORT Bool
 
 RRTransformCompute(int x,
commit c59c9dac84301f8eb2a0e4a09a8839146aa5a069
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:13:22 2012 +0200

    xkb: Remove redundant declarations.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 111bf9f..95e28e7 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -694,7 +694,6 @@ AccessXFilterReleaseEvent(DeviceEvent *event, DeviceIntPtr keybd)
 /*									*/
 /************************************************************************/
 extern int xkbDevicePrivateIndex;
-extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer);
 void
 ProcessPointerEvent(InternalEvent *ev, DeviceIntPtr mouse)
 {
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 5ec1ed5..1adb389 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -47,7 +47,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 DevPrivateKeyRec xkbDevicePrivateKeyRec;
 
-void XkbFakeDeviceButton(DeviceIntPtr dev, Bool press, int button);
 static void XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags, int x,
                                  int y);
 
commit d0a83460451df1a4c5667b2f414c35ee81b4ffa4
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Tue Apr 24 18:11:16 2012 +0200

    xfixes: remove redundant declaration.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/xfixes/region.c b/xfixes/region.c
index 624109d..0acbada 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -27,7 +27,6 @@
 #include "xfixesint.h"
 #include "scrnintstr.h"
 #include <picturestr.h>
-extern int RenderErrBase;
 
 #include <regionstr.h>
 #include <gcstruct.h>
commit 3a94b338aaa48b656aae1bb3a5a9d64300c0a093
Merge: afc153a c91d00e
Author: Keith Packard <keithp at keithp.com>
Date:   Wed May 9 21:17:16 2012 -0700

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

commit afc153a5b4fc58ae70dc214f61a71b1a8c855f06
Author: James Cloos <cloos at jhcloos.com>
Date:   Tue May 8 17:55:10 2012 -0400

    Fix RANDR’s gamma_to_ramp().
    
    In order to generate a 256-entry ramp in [0,65535] which covers the full
    range, one must mupliply eight-bit values not by 256 but rather by 257.
    
    Many years back – well before the RANDR extension was written, and
    before xorg at fdo – a similar bug fix was made to the DIX for converting
    client-supplied eight-bit color values into sixteen-bit values.
    
    Noticed by: Elle Stone and Graeme Gill.
    
    Signed-off-by: James Cloos <cloos at jhcloos.com>

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index a773c34..aca0734 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1679,11 +1679,11 @@ gamma_to_ramp(float gamma, CARD16 *ramp, int size)
 
     for (i = 0; i < size; i++) {
         if (gamma == 1.0)
-            ramp[i] = i << 8;
+            ramp[i] = i | i << 8;
         else
             ramp[i] =
                 (CARD16) (pow((double) i / (double) (size - 1), 1. / gamma)
-                          * (double) (size - 1) * 256);
+                          * (double) (size - 1) * 257);
     }
 }
 
commit c91d00e0f330b9de604068e1bfcb0a307096434f
Author: Daniel Kurtz <djkurtz at chromium.org>
Date:   Wed Apr 18 17:51:53 2012 +0800

    os/log: refactor logging
    
    It is not safe to ever use an arbitrary (possibly user supplied) string as
    part of the format for a *sprintf() call.
    
    For example:
      1. Name a Bluetooth keyboard "%n%n%n%n%n%n%n%n"
      2. Pair it with a computer running X and try to use it
      3. X is not happy when trying to do the following in xf86-input-evdev:
         xf86IDrvMsg(pInfo, X_CONFIG, "Device: \"%s\"\n", device);
         because LogVHdrMessageVerb() has put the %n from the device name
         into a format string of the form:
            "evdev: %n%n%n%n%n%n%n%n: Device: \"%s\"\n"
    
    Instead, build up a log message in place by appending successive formatted
    strings by sncprintf'ing to the end of the previous.
    
    Signed-off-by: Daniel Kurtz <djkurtz at chromium.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/os/log.c b/os/log.c
index 36378e4..2c13c1a 100644
--- a/os/log.c
+++ b/os/log.c
@@ -268,36 +268,19 @@ LogSetParameter(LogParameter param, int value)
 }
 
 /* This function does the actual log message writes. */
-
-void
-LogVWrite(int verb, const char *f, va_list args)
+static void
+LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
 {
-    static char tmpBuffer[1024];
-    int len = 0;
     static Bool newline = TRUE;
 
-    if (verb > logFileVerbosity && verb > logVerbosity)
-        return;
-
-    /*
-     * Since a va_list can only be processed once, write the string to a
-     * buffer, and then write the buffer out to the appropriate output
-     * stream(s).
-     */
-    if (verb < 0 || logFileVerbosity >= verb || logVerbosity >= verb) {
-        len = Xvscnprintf(tmpBuffer, sizeof(tmpBuffer), f, args);
-        /* If message is truncated, terminate with '\n' */
-        if (sizeof(tmpBuffer) - len == 1)
-            tmpBuffer[len - 1] = '\n';
-    }
-    if ((verb < 0 || logVerbosity >= verb) && len > 0)
-        fwrite(tmpBuffer, len, 1, stderr);
-    if ((verb < 0 || logFileVerbosity >= verb) && len > 0) {
+    if (verb < 0 || logVerbosity >= verb)
+        fwrite(buf, len, 1, stderr);
+    if (verb < 0 || logFileVerbosity >= verb) {
         if (logFile) {
             if (newline)
                 fprintf(logFile, "[%10.3f] ", GetTimeInMillis() / 1000.0);
-            newline = (tmpBuffer[len - 1] == '\n');
-            fwrite(tmpBuffer, len, 1, logFile);
+            newline = end_line;
+            fwrite(buf, len, 1, logFile);
             if (logFlush) {
                 fflush(logFile);
 #ifndef WIN32
@@ -315,13 +298,19 @@ LogVWrite(int verb, const char *f, va_list args)
                     FatalError("realloc() failed while saving log messages\n");
             }
             bufferUnused -= len;
-            memcpy(saveBuffer + bufferPos, tmpBuffer, len);
+            memcpy(saveBuffer + bufferPos, buf, len);
             bufferPos += len;
         }
     }
 }
 
 void
+LogVWrite(int verb, const char *f, va_list args)
+{
+    return LogVMessageVerb(X_NONE, verb, f, args);
+}
+
+void
 LogWrite(int verb, const char *f, ...)
 {
     va_list args;
@@ -376,22 +365,28 @@ void
 LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
 {
     const char *type_str;
-    char tmpFormat[1024];
-    const char *new_format;
+    char buf[1024];
+    const size_t size = sizeof(buf);
+    Bool newline;
+    size_t len = 0;
 
     type_str = LogMessageTypeVerbString(type, verb);
     if (!type_str)
         return;
 
-    /* if type_str is not "", prepend it and ' ', to format */
-    if (type_str[0] == '\0')
-        new_format = format;
-    else {
-        new_format = tmpFormat;
-        snprintf(tmpFormat, sizeof(tmpFormat), "%s %s", type_str, format);
-    }
+    /* if type_str is not "", prepend it and ' ', to message */
+    if (type_str[0] != '\0')
+        len += Xscnprintf(&buf[len], size - len, "%s ", type_str);
+
+    if (size - len > 1)
+        len += Xvscnprintf(&buf[len], size - len, format, args);
+
+    /* Force '\n' at end of truncated line */
+    if (size - len == 1)
+        buf[len - 1] = '\n';
 
-    LogVWrite(verb, new_format, args);
+    newline = (buf[len - 1] == '\n');
+    LogSWrite(verb, buf, len, newline);
 }
 
 /* Log message with verbosity level specified. */
@@ -421,31 +416,31 @@ LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format,
                    va_list msg_args, const char *hdr_format, va_list hdr_args)
 {
     const char *type_str;
-    char tmpFormat[1024];
-    char *tmpFormat_end = &tmpFormat[sizeof(tmpFormat)];
-    char *p;
-    int left;
+    char buf[1024];
+    const size_t size = sizeof(buf);
+    Bool newline;
+    size_t len = 0;
 
     type_str = LogMessageTypeVerbString(type, verb);
     if (!type_str)
         return;
 
-    /* if type_str != "", copy it and ' ' to tmpFormat; set p after ' ' */
-    p = tmpFormat;
+    /* if type_str is not "", prepend it and ' ', to message */
     if (type_str[0] != '\0')
-        p += snprintf(tmpFormat, sizeof(tmpFormat), "%s ", type_str);
+        len += Xscnprintf(&buf[len], size - len, "%s ", type_str);
+
+    if (hdr_format && size - len > 1)
+        len += Xvscnprintf(&buf[len], size - len, hdr_format, hdr_args);
 
-    /* append as much of hdr as fits after type_str (if there was one) */
-    left = tmpFormat_end - p;
-    if (left > 1)
-        p += vsnprintf(p, left, hdr_format, hdr_args);
+    if (msg_format && size - len > 1)
+        len += Xvscnprintf(&buf[len], size - len, msg_format, msg_args);
 
-    /* append as much of msg_format as will fit after hdr */
-    left = tmpFormat_end - p;
-    if (left > 1)
-        snprintf(p, left, "%s", msg_format);
+    /* Force '\n' at end of truncated line */
+    if (size - len == 1)
+        buf[len - 1] = '\n';
 
-    LogVWrite(verb, tmpFormat, msg_args);
+    newline = (buf[len - 1] == '\n');
+    LogSWrite(verb, buf, len, newline);
 }
 
 void
commit 6ce0eac4f8a05f6d7401445cab95027709d3a479
Author: Daniel Kurtz <djkurtz at chromium.org>
Date:   Wed Apr 18 17:51:52 2012 +0800

    os/log: only write timestamp if a message is actually written to logfile
    
    The current code will write a timestamps into the logFile whenever
    the last message ended with a '\n' - even if the verb for that timestamp
    is at too high a level.  This timestamp will sit there with no matching
    message until the next call to LogVWrite with a valid verb.
    
    In other words, in some cases, timestamps in the X.org.log are for some
    completely unrelated message that was previously ignored due to
    insufficient verbosity, and not for the message that appears next to it
    in the log file.
    
    We keep the current policy which appears to be to only apply timestamps if
    a message is actually written to a log file.  That is, no timestamps on
    stderr, or in the mem buffer.  Therefore, the timestamp stringification
    is moved to the conditional where it is used.
    
    Since logging uses a fixed length buffer, this patch also forces a '\n'
    whenever a buffer is terminated due to a too-long write request.  This
    allows the newline detection to work even on overflow, and also cleans up
    the log a bit in the overflow case.
    
    Signed-off-by: Daniel Kurtz <djkurtz at chromium.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/os/log.c b/os/log.c
index 92cb7aa..36378e4 100644
--- a/os/log.c
+++ b/os/log.c
@@ -276,12 +276,8 @@ LogVWrite(int verb, const char *f, va_list args)
     int len = 0;
     static Bool newline = TRUE;
 
-    if (newline) {
-        sprintf(tmpBuffer, "[%10.3f] ", GetTimeInMillis() / 1000.0);
-        len = strlen(tmpBuffer);
-        if (logFile)
-            fwrite(tmpBuffer, len, 1, logFile);
-    }
+    if (verb > logFileVerbosity && verb > logVerbosity)
+        return;
 
     /*
      * Since a va_list can only be processed once, write the string to a
@@ -289,14 +285,18 @@ LogVWrite(int verb, const char *f, va_list args)
      * stream(s).
      */
     if (verb < 0 || logFileVerbosity >= verb || logVerbosity >= verb) {
-        vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args);
-        len = strlen(tmpBuffer);
+        len = Xvscnprintf(tmpBuffer, sizeof(tmpBuffer), f, args);
+        /* If message is truncated, terminate with '\n' */
+        if (sizeof(tmpBuffer) - len == 1)
+            tmpBuffer[len - 1] = '\n';
     }
-    newline = (tmpBuffer[len - 1] == '\n');
     if ((verb < 0 || logVerbosity >= verb) && len > 0)
         fwrite(tmpBuffer, len, 1, stderr);
     if ((verb < 0 || logFileVerbosity >= verb) && len > 0) {
         if (logFile) {
+            if (newline)
+                fprintf(logFile, "[%10.3f] ", GetTimeInMillis() / 1000.0);
+            newline = (tmpBuffer[len - 1] == '\n');
             fwrite(tmpBuffer, len, 1, logFile);
             if (logFlush) {
                 fflush(logFile);
commit 5c2e2a164d615ab06be28a663734e782614b5cc7
Author: Daniel Kurtz <djkurtz at chromium.org>
Date:   Wed Apr 18 09:51:51 2012 +0000

    os/xprintf: add Xvscnprintf and Xscnprintf
    
    Normal snprintf() usually returns the number of bytes that would have been
    written into a buffer had the buffer been long enough.
    
    The scnprintf() variants return the actual number of bytes written,
    excluding the trailing '\0'.
    
    Signed-off-by: Daniel Kurtz <djkurtz at chromium.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/include/Xprintf.h b/include/Xprintf.h
index 414fd46..9e8cdc5 100644
--- a/include/Xprintf.h
+++ b/include/Xprintf.h
@@ -66,4 +66,16 @@ _X_ATTRIBUTE_PRINTF(2, 0);
 #define vasprintf Xvasprintf
 #endif
 
+/*
+ * These functions provide a portable implementation of the linux kernel
+ * scnprintf & vscnprintf routines that return the number of bytes actually
+ * copied during a snprintf, (excluding the final '\0').
+ */
+extern _X_EXPORT int
+Xscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, ...)
+_X_ATTRIBUTE_PRINTF(3,4);
+extern _X_EXPORT int
+Xvscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, va_list va)
+_X_ATTRIBUTE_PRINTF(3,0);
+
 #endif                          /* XPRINTF_H */
diff --git a/os/xprintf.c b/os/xprintf.c
index 17fea2e..80caa57 100644
--- a/os/xprintf.c
+++ b/os/xprintf.c
@@ -186,6 +186,50 @@ XNFasprintf(char **ret, const char *_X_RESTRICT_KYWD format, ...)
     return size;
 }
 
+/**
+ * Varargs snprintf that returns the actual number of bytes (excluding final
+ * '\0') that were copied into the buffer.
+ * This is opposed to the normal sprintf() usually returns the number of bytes
+ * that would have been written.
+ *
+ * @param s       buffer to copy into
+ * @param n       size of buffer s
+ * @param format  printf style format string
+ * @param va      variable argument list
+ * @return        number of bytes actually copied, excluding final '\0'
+ */
+int
+Xvscnprintf(char *s, int n, const char *format, va_list args)
+{
+    int x;
+    if (n == 0)
+        return 0;
+    x = vsnprintf(s, n , format, args);
+    return (x >= n) ? (n - 1) : x;
+}
+
+/**
+ * snprintf that returns the actual number of bytes (excluding final '\0') that
+ * were copied into the buffer.
+ * This is opposed to the normal sprintf() usually returns the number of bytes
+ * that would have been written.
+ *
+ * @param s       buffer to copy into
+ * @param n       size of buffer s
+ * @param format  printf style format string
+ * @param ...     arguments for specified format
+ * @return        number of bytes actually copied, excluding final '\0'
+ */
+int Xscnprintf(char *s, int n, const char *format, ...)
+{
+    int x;
+    va_list ap;
+    va_start(ap, format);
+    x = Xvscnprintf(s, n, format, ap);
+    va_end(ap);
+    return x;
+}
+
 /* Old api, now deprecated, may be removed in the future */
 char *
 Xvprintf(const char *format, va_list va)
commit c30862879d2c766519780bb7f353f35edf0daa9b
Author: Daniel Kurtz <djkurtz at chromium.org>
Date:   Wed Apr 18 17:51:50 2012 +0800

    os/log: trivial cleanups
    
     * space->tab
     * remove comment that doesn't make any sense
    
    Signed-off-by: Daniel Kurtz <djkurtz at chromium.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/os/log.c b/os/log.c
index 061b3dd..92cb7aa 100644
--- a/os/log.c
+++ b/os/log.c
@@ -168,7 +168,7 @@ asm(".desc ___crashreporter_info__, 0x10");
 #define X_DEBUG_STRING			"(DB)"
 #endif
 #ifndef X_NONE_STRING
-#define X_NONE_STRING                   ""
+#define X_NONE_STRING			""
 #endif
 
 /*
@@ -226,7 +226,7 @@ LogInit(const char *fname, const char *backup)
      * needed.
      */
     if (saveBuffer && bufferSize > 0) {
-        free(saveBuffer);       /* Must be free(), not free() */
+        free(saveBuffer);
         saveBuffer = NULL;
         bufferSize = 0;
     }


More information about the Xquartz-changes mailing list