[70211] trunk/dports/x11/xorg-server-devel

jeremyhu at macports.org jeremyhu at macports.org
Sun Aug 1 23:21:01 PDT 2010


Revision: 70211
          http://trac.macports.org/changeset/70211
Author:   jeremyhu at macports.org
Date:     2010-08-01 23:21:01 -0700 (Sun, 01 Aug 2010)
Log Message:
-----------
xorg-server-devel: Pull in changes from my git branch for AIGLX fix and RandR support

Modified Paths:
--------------
    trunk/dports/x11/xorg-server-devel/Portfile

Added Paths:
-----------
    trunk/dports/x11/xorg-server-devel/files/0001-rootless-Adjust-the-frame-size-of-the-native-root-w.patch
    trunk/dports/x11/xorg-server-devel/files/0002-dix-hack-around-enter-leave-event-issues-for-grabbe.patch
    trunk/dports/x11/xorg-server-devel/files/0003-xkb-use-GetMaster-instead-of-dev-u.master.patch
    trunk/dports/x11/xorg-server-devel/files/0004-Use-DocBook-stylesheets-from-xorg-sgml-doctools-if-t.patch
    trunk/dports/x11/xorg-server-devel/files/0005-Add-name-argument-to-CreateNewResourceType-documenta.patch
    trunk/dports/x11/xorg-server-devel/files/0006-Add-documentation-of-the-Xserver-DTrace-probes.patch
    trunk/dports/x11/xorg-server-devel/files/0007-XQuartz-GLX-Don-t-mangle-__GLXDrawable-s-pDraw.patch
    trunk/dports/x11/xorg-server-devel/files/0008-XQuartz-xpbproxy-Don-t-take-down-the-whole-server.patch
    trunk/dports/x11/xorg-server-devel/files/0009-ddc-Fix-memory-leak-in-GetEDID_DDC1.patch
    trunk/dports/x11/xorg-server-devel/files/0010-XQuartz-Make-application-switching-work-better-for.patch
    trunk/dports/x11/xorg-server-devel/files/0011-XQuartz-UpdateScreen-at-the-end-of-SetRootless.patch
    trunk/dports/x11/xorg-server-devel/files/0012-XQuartz-xpr-Bail-on-errors-during-unlock-and-dest.patch
    trunk/dports/x11/xorg-server-devel/files/0013-XQuartz-RandR-Implement-basic-RandR-functionality.patch
    trunk/dports/x11/xorg-server-devel/files/0014-XQuartz-RandR-Toggle-rootless-mode-on-XRandR-mode.patch
    trunk/dports/x11/xorg-server-devel/files/0015-XQuartz-RandR-Remove-FAKE_RANDR-code.patch
    trunk/dports/x11/xorg-server-devel/files/0016-XQuartz-RandR-use-deprecated-CG-APIs-only-on-Leopa.patch
    trunk/dports/x11/xorg-server-devel/files/0017-XQuartz-Ignore-kXquartzToggleFullscreen-when-rootle.patch
    trunk/dports/x11/xorg-server-devel/files/0018-XQuartz-RandR-Respond-better-to-resolution-changes.patch
    trunk/dports/x11/xorg-server-devel/files/0019-XQuartz-RandR-Better-handle-switching-betwen-RandR.patch
    trunk/dports/x11/xorg-server-devel/files/0020-XQuartz-Don-t-change-the-rootless-preference-when-c.patch
    trunk/dports/x11/xorg-server-devel/files/0021-Workaround-the-GC-clipping-problem-in-miPaintWindow.patch
    trunk/dports/x11/xorg-server-devel/files/0022-fb-Revert-fb-changes-that-broke-XQuartz.patch

Removed Paths:
-------------
    trunk/dports/x11/xorg-server-devel/files/0006-Workaround-the-GC-clipping-problem-in-miPaintWindow-.patch
    trunk/dports/x11/xorg-server-devel/files/0007-fb-Revert-fb-changes-that-broke-XQuartz.patch

Modified: trunk/dports/x11/xorg-server-devel/Portfile
===================================================================
--- trunk/dports/x11/xorg-server-devel/Portfile	2010-08-02 06:10:16 UTC (rev 70210)
+++ trunk/dports/x11/xorg-server-devel/Portfile	2010-08-02 06:21:01 UTC (rev 70211)
@@ -6,6 +6,7 @@
 conflicts       xorg-server
 set my_name	xorg-server
 version		1.8.99.905
+revision        1
 categories	x11 devel
 maintainers	jeremyhu openmaintainer
 description	The X.org / Xquartz X server.
@@ -83,11 +84,34 @@
 	RAWCPP=${configure.cpp}
 
 patchfiles \
-        0006-Workaround-the-GC-clipping-problem-in-miPaintWindow-.patch \
-        0007-fb-Revert-fb-changes-that-broke-XQuartz.patch
+        0001-rootless-Adjust-the-frame-size-of-the-native-root-w.patch \
+        0002-dix-hack-around-enter-leave-event-issues-for-grabbe.patch \
+        0003-xkb-use-GetMaster-instead-of-dev-u.master.patch \
+        0004-Use-DocBook-stylesheets-from-xorg-sgml-doctools-if-t.patch \
+        0005-Add-name-argument-to-CreateNewResourceType-documenta.patch \
+        0006-Add-documentation-of-the-Xserver-DTrace-probes.patch \
+        0007-XQuartz-GLX-Don-t-mangle-__GLXDrawable-s-pDraw.patch \
+        0008-XQuartz-xpbproxy-Don-t-take-down-the-whole-server.patch \
+        0009-ddc-Fix-memory-leak-in-GetEDID_DDC1.patch \
+        0010-XQuartz-Make-application-switching-work-better-for.patch \
+        0011-XQuartz-UpdateScreen-at-the-end-of-SetRootless.patch \
+        0012-XQuartz-xpr-Bail-on-errors-during-unlock-and-dest.patch \
+        0013-XQuartz-RandR-Implement-basic-RandR-functionality.patch \
+        0014-XQuartz-RandR-Toggle-rootless-mode-on-XRandR-mode.patch \
+        0015-XQuartz-RandR-Remove-FAKE_RANDR-code.patch \
+        0016-XQuartz-RandR-use-deprecated-CG-APIs-only-on-Leopa.patch \
+        0017-XQuartz-Ignore-kXquartzToggleFullscreen-when-rootle.patch \
+        0018-XQuartz-RandR-Respond-better-to-resolution-changes.patch \
+        0019-XQuartz-RandR-Better-handle-switching-betwen-RandR.patch \
+        0020-XQuartz-Don-t-change-the-rootless-preference-when-c.patch \
+        0021-Workaround-the-GC-clipping-problem-in-miPaintWindow.patch \
+        0022-fb-Revert-fb-changes-that-broke-XQuartz.patch
 
 patch.pre_args -p1
 
+use_autoreconf yes
+autoreconf.args -fvi
+
 build.args V=1
 
 post-destroot {

Added: trunk/dports/x11/xorg-server-devel/files/0001-rootless-Adjust-the-frame-size-of-the-native-root-w.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0001-rootless-Adjust-the-frame-size-of-the-native-root-w.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0001-rootless-Adjust-the-frame-size-of-the-native-root-w.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,59 @@
+From 95756f410c65a6510a797e94a792b959d45cdb9e Mon Sep 17 00:00:00 2001
+From: Jan Hauffa <hauffa at in.tum.de>
+Date: Sat, 17 Jul 2010 12:18:39 -0700
+Subject: [PATCH] rootless: Adjust the frame size of the native root window in RootlessResizeWindow
+
+If the native root window isn't resized as well, we will likely crash the
+next time we draw to the root.  On OS X, this can be seen by:
+
+1) Put the display preferences in the menu bar and set X11's preferences so you
+   can access the menu bar in fullscreen mode
+2) Set the resolution of your screen lower than normal.
+3) Start X11 in fullscreen mode.  The root window will cover the screen as
+   expected.
+4) Use the menu bar to increase the resolution of the display.  The root
+   window will now cover the old area and not the full screen, but
+   'xwininfo -root' will report the full width.
+5) Run 'xsetroot -solid red', and we have the crash you mention above.
+
+Leaving/entering fullscreen after #4 will fix the problem.  This is because the
+WINREC is erased when we leave fullscreen mode and it is recreated upon
+re-entry:
+
+RootlessUpdateRooted(FALSE)
+    RootlessDisableRoot(screenInfo.screens[0])
+        RootlessDestroyFrame (pRoot, winRec);
+RootlessUpdateRooted(TRUE)
+    RootlessEnableRoot(screenInfo.screens[0])
+        RootlessEnsureFrame(screenInfo.screens[0]->pRoot)
+            creates a new WINREC...
+
+Signed-off-by: Jan Hauffa <hauffa at in.tum.de>
+Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
+Acked-By: Jon TURNEY <jon.turney at dronecode.org.uk>
+Tested-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ miext/rootless/rootlessWindow.c |    7 +++++++
+ 1 files changed, 7 insertions(+), 0 deletions(-)
+
+diff --git xorg-server-1.8.99.905/miext/rootless/rootlessWindow.c xorg-server-1.8.99.905/miext/rootless/rootlessWindow.c
+index 7fe5e1d..bef8a2f 100644
+--- xorg-server-1.8.99.905/miext/rootless/rootlessWindow.c
++++ xorg-server-1.8.99.905/miext/rootless/rootlessWindow.c
+@@ -1315,6 +1315,13 @@ RootlessResizeWindow(WindowPtr pWin, int x, int y,
+         RegionCopy(&pWin->clipList, &pWin->winSize);
+         RegionCopy(&pWin->borderClip, &pWin->winSize);
+ 
++        if (winRec) {
++            SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen,
++                                                 x + SCREEN_TO_GLOBAL_X,
++                                                 y + SCREEN_TO_GLOBAL_Y,
++                                                 w, h, RL_GRAVITY_NONE);
++        }
++
+         miSendExposures(pWin, &pWin->borderClip,
+                         pWin->drawable.x, pWin->drawable.y);        
+     }
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0002-dix-hack-around-enter-leave-event-issues-for-grabbe.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0002-dix-hack-around-enter-leave-event-issues-for-grabbe.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0002-dix-hack-around-enter-leave-event-issues-for-grabbe.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,121 @@
+From c54f81ba7a58faf37a612bd9a45276bb2922b5d8 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Thu, 15 Jul 2010 13:24:14 +1000
+Subject: [PATCH] dix: hack around enter/leave event issues for grabbed devices (#27804)
+
+The current core enter/leave does not cater for device grabs during
+enter/leave events. If a window W contains a pointer P1 and a client grabs a
+pointer P2, this pointer will not generate enter/leave events inside this
+window.
+
+Hack around this by forcing grabbed devices to always send enter/leave
+events.
+
+X.Org Bug 27804 <http://bugs.freedesktop.org/show_bug.cgi?id=27804>
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+Reviewed-by: Keith Packard <keithp at keithp.com>
+---
+ dix/enterleave.c |   27 ++++++++++++++++++---------
+ 1 files changed, 18 insertions(+), 9 deletions(-)
+
+diff --git xorg-server-1.8.99.905/dix/enterleave.c xorg-server-1.8.99.905/dix/enterleave.c
+index eefa7ab..7a3ecf5 100644
+--- xorg-server-1.8.99.905/dix/enterleave.c
++++ xorg-server-1.8.99.905/dix/enterleave.c
+@@ -78,10 +78,19 @@ static WindowPtr FocusWindows[MAXDEVICES];
+  * window.
+  */
+ static BOOL
+-HasPointer(WindowPtr win)
++HasPointer(DeviceIntPtr dev, WindowPtr win)
+ {
+     int i;
+ 
++    /* FIXME: The enter/leave model does not cater for grabbed devices. For
++     * now, a quickfix: if the device about to send an enter/leave event to
++     * a window is grabbed, assume there is no pointer in that window.
++     * Fixes fdo 27804.
++     * There isn't enough beer in my fridge to fix this properly.
++     */
++    if (dev->deviceGrab.grab)
++        return FALSE;
++
+     for (i = 0; i < MAXDEVICES; i++)
+         if (PointerWindows[i] == win)
+             return TRUE;
+@@ -270,7 +279,7 @@ CoreEnterNotifies(DeviceIntPtr dev,
+           may need to be changed from Virtual to NonlinearVirtual depending
+           on the previous P(W). */
+ 
+-    if (!HasPointer(parent) && !FirstPointerChild(parent))
++    if (!HasPointer(dev, parent) && !FirstPointerChild(parent))
+             CoreEnterLeaveEvent(dev, EnterNotify, mode, detail, parent,
+                                 child->drawable.id);
+ }
+@@ -309,7 +318,7 @@ CoreLeaveNotifies(DeviceIntPtr dev,
+ 
+         /* If one window has a pointer or a child with a pointer, skip some
+          * work and exit. */
+-        if (HasPointer(win) || FirstPointerChild(win))
++        if (HasPointer(dev, win) || FirstPointerChild(win))
+             return;
+ 
+         CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win, child->drawable.id);
+@@ -373,7 +382,7 @@ CoreEnterLeaveNonLinear(DeviceIntPtr dev,
+           vice versa depending on the the new P(W)
+      */
+ 
+-    if (!HasPointer(A))
++    if (!HasPointer(dev, A))
+     {
+         WindowPtr child = FirstPointerChild(A);
+         if (child)
+@@ -417,7 +426,7 @@ CoreEnterLeaveNonLinear(DeviceIntPtr dev,
+           The detail may need to be changed from Ancestor to Nonlinear
+           or vice-versa depending on the previous P(W). */
+ 
+-     if (!HasPointer(B))
++     if (!HasPointer(dev, B))
+      {
+          WindowPtr child = FirstPointerChild(B);
+          if (child)
+@@ -455,7 +464,7 @@ CoreEnterLeaveToAncestor(DeviceIntPtr dev,
+           The detail may need to be changed from Ancestor to Nonlinear or
+           vice versa depending on the the new P(W)
+      */
+-    if (!HasPointer(A))
++    if (!HasPointer(dev, A))
+     {
+         WindowPtr child = FirstPointerChild(A);
+         if (child)
+@@ -479,7 +488,7 @@ CoreEnterLeaveToAncestor(DeviceIntPtr dev,
+           P(W) changes from a descendant to W itself. The subwindow
+           field should be set to the child containing the old P(W) <<< WRONG */
+ 
+-    if (!HasPointer(B))
++    if (!HasPointer(dev, B))
+         CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None);
+ 
+ }
+@@ -507,7 +516,7 @@ CoreEnterLeaveToDescendant(DeviceIntPtr dev,
+           P(W) changes from W to a descendant of W. The subwindow field
+           is set to the child containing the new P(W) <<< THIS IS WRONG */
+ 
+-    if (!HasPointer(A))
++    if (!HasPointer(dev, A))
+         CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None);
+ 
+ 
+@@ -531,7 +540,7 @@ CoreEnterLeaveToDescendant(DeviceIntPtr dev,
+           The detail may need to be changed from Ancestor to Nonlinear
+           or vice-versa depending on the previous P(W). */
+ 
+-     if (!HasPointer(B))
++     if (!HasPointer(dev, B))
+      {
+          WindowPtr child = FirstPointerChild(B);
+          if (child)
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0003-xkb-use-GetMaster-instead-of-dev-u.master.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0003-xkb-use-GetMaster-instead-of-dev-u.master.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0003-xkb-use-GetMaster-instead-of-dev-u.master.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,168 @@
+From 9ac8e206ffe1016a8bc203261ade6c763a8a4f86 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Thu, 15 Jul 2010 15:46:15 +1000
+Subject: [PATCH] xkb: use GetMaster instead of dev->u.master.
+
+Devices that are both pointers and keyboards are not affected by keyboard
+changes as their master device is a master pointer, not a master keyboard.
+Use GetMaster() instead to ensure devices that are attached to the paired
+master pointer device will still be update.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+Reviewed-by: Keith Packard <keithp at keithp.com>
+Reviewed-by: Daniel Stone <daniel at fooishbar.org>
+---
+ xkb/xkb.c |   32 ++++++++++++++++----------------
+ 1 files changed, 16 insertions(+), 16 deletions(-)
+
+diff --git xorg-server-1.8.99.905/xkb/xkb.c xorg-server-1.8.99.905/xkb/xkb.c
+index bd73e9a..935f5ea 100644
+--- xorg-server-1.8.99.905/xkb/xkb.c
++++ xorg-server-1.8.99.905/xkb/xkb.c
+@@ -523,7 +523,7 @@ ProcXkbBell(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev))
++            if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
+             {
+                 rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixBellAccess);
+                 if (rc == Success)
+@@ -606,7 +606,7 @@ ProcXkbLatchLockState(ClientPtr client)
+     status = Success;
+ 
+     for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
+-        if ((tmpd == dev) || (!IsMaster(tmpd) && tmpd->u.master == dev)) {
++        if ((tmpd == dev) || (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) {
+             if (!tmpd->key || !tmpd->key->xkbInfo)
+                 continue;
+ 
+@@ -748,7 +748,7 @@ ProcXkbSetControls(ClientPtr client)
+     for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
+         if (!tmpd->key || !tmpd->key->xkbInfo)
+             continue;
+-        if ((tmpd == dev) || (!IsMaster(tmpd) && tmpd->u.master == dev)) {
++        if ((tmpd == dev) || (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) {
+             xkbi = tmpd->key->xkbInfo;
+             ctrl = xkbi->desc->ctrls;
+             new = *ctrl;
+@@ -2558,7 +2558,7 @@ ProcXkbSetMap(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev))
++            if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
+             {
+                 rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+                 if (rc == Success)
+@@ -2581,7 +2581,7 @@ ProcXkbSetMap(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev))
++            if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
+             {
+                 rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+                 if (rc == Success)
+@@ -2887,7 +2887,7 @@ ProcXkbSetCompatMap(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev))
++            if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
+             {
+                 rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+                 if (rc == Success)
+@@ -2910,7 +2910,7 @@ ProcXkbSetCompatMap(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev))
++            if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
+             {
+                 rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+                 if (rc == Success)
+@@ -3165,7 +3165,7 @@ ProcXkbSetIndicatorMap(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev))
++            if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
+             {
+                 rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess);
+                 if (rc == Success)
+@@ -3434,7 +3434,7 @@ ProcXkbSetNamedIndicator(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if ((other != dev) && !IsMaster(other) && (other->u.master == dev) &&
++            if ((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev &&
+                 (other->kbdfeed || other->leds) &&
+                 (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success))
+             {
+@@ -3458,7 +3458,7 @@ ProcXkbSetNamedIndicator(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if ((other != dev) && !IsMaster(other) && (other->u.master == dev) &&
++            if ((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev &&
+                 (other->kbdfeed || other->leds) &&
+                 (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success))
+             {
+@@ -4249,7 +4249,7 @@ ProcXkbSetNames(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev))
++            if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
+             {
+ 
+                 rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+@@ -4274,7 +4274,7 @@ ProcXkbSetNames(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev))
++            if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
+             {
+ 
+                 rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+@@ -5328,7 +5328,7 @@ ProcXkbSetGeometry(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev))
++            if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
+             {
+                 rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+                 if (rc == Success)
+@@ -5840,7 +5840,7 @@ ProcXkbGetKbdByName(ClientPtr client)
+ 	xkb->ctrls->num_groups= nTG;
+ 
+         for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
+-            if ((tmpd == dev) || (!IsMaster(tmpd) && tmpd->u.master == dev)) {
++            if ((tmpd == dev) || (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) {
+                 if (tmpd != dev)
+                     XkbCopyDeviceKeymap(tmpd, dev);
+ 
+@@ -6519,7 +6519,7 @@ ProcXkbSetDeviceInfo(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if (((other != dev) && !IsMaster(other) && (other->u.master == dev)) &&
++            if (((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) &&
+                 ((stuff->deviceSpec == XkbUseCoreKbd && other->key) ||
+                 (stuff->deviceSpec == XkbUseCorePtr && other->button)))
+             {
+@@ -6544,7 +6544,7 @@ ProcXkbSetDeviceInfo(ClientPtr client)
+         DeviceIntPtr other;
+         for (other = inputInfo.devices; other; other = other->next)
+         {
+-            if (((other != dev) && !IsMaster(other) && (other->u.master == dev)) &&
++            if (((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) &&
+                 ((stuff->deviceSpec == XkbUseCoreKbd && other->key) ||
+                 (stuff->deviceSpec == XkbUseCorePtr && other->button)))
+             {
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0004-Use-DocBook-stylesheets-from-xorg-sgml-doctools-if-t.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0004-Use-DocBook-stylesheets-from-xorg-sgml-doctools-if-t.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0004-Use-DocBook-stylesheets-from-xorg-sgml-doctools-if-t.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,68 @@
+From 44c9350d72b3eda982c642feb45d6648afc626cf Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <alan.coopersmith at oracle.com>
+Date: Sat, 19 Jun 2010 23:40:37 -0700
+Subject: [PATCH] Use DocBook stylesheets from xorg-sgml-doctools if they're available
+
+Bumps minimum xorg-macros requirement from 1.6 to 1.10
+
+Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
+Reviewed-by: Patrick E. Kane <pekane52 at gmail.com>
+---
+ configure.ac                   |    7 ++++---
+ doc/xml/.gitignore             |    1 +
+ doc/xml/xmlrules.in            |   10 +++++++++-
+ hw/xfree86/doc/sgml/.gitignore |    1 +
+ 4 files changed, 15 insertions(+), 4 deletions(-)
+
+diff --git xorg-server-1.8.99.905/configure.ac xorg-server-1.8.99.905/configure.ac
+index baa0b5c..c61c60c 100644
+--- xorg-server-1.8.99.905/configure.ac
++++ xorg-server-1.8.99.905/configure.ac
+@@ -32,12 +32,13 @@ AC_CONFIG_SRCDIR([Makefile.am])
+ AM_INIT_AUTOMAKE([foreign dist-bzip2])
+ AM_MAINTAINER_MODE
+ 
+-# Require xorg-macros: XORG_DEFAULT_OPTIONS
++# Require xorg-macros minimum of 1.10 for XORG_CHECK_SGML_DOCTOOLS
+ m4_ifndef([XORG_MACROS_VERSION],
+-          [m4_fatal([must install xorg-macros 1.6 or later before running autoconf/autogen])])
+-XORG_MACROS_VERSION(1.6)
++          [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.10)
+ XORG_DEFAULT_OPTIONS
+ XORG_WITH_DOXYGEN(1.6.1)
++XORG_CHECK_SGML_DOCTOOLS(1.5)
+ 
+ m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])])
+ XORG_FONT_MACROS_VERSION(1.1)
+diff --git xorg-server-1.8.99.905/doc/xml/xmlrules.in xorg-server-1.8.99.905/doc/xml/xmlrules.in
+index 1be3691..0d094be 100644
+--- xorg-server-1.8.99.905/doc/xml/xmlrules.in
++++ xorg-server-1.8.99.905/doc/xml/xmlrules.in
+@@ -39,6 +39,14 @@ SUFFIXES = .xml .txt .html .pdf
+ XML_ENT_DIR = $(abs_top_builddir)/doc/xml
+ XMLTO_FLAGS = --searchpath $(XML_ENT_DIR)
+ 
++if HAVE_STYLESHEETS
++XMLTO_FLAGS += -m $(XSL_STYLESHEET)
++BUILT_DOC_FILES += xorg.css
++
++xorg.css: $(STYLESHEET_SRCDIR)/xorg.css
++	$(AM_V_GEN)cp -pf $(STYLESHEET_SRCDIR)/xorg.css $@
++endif
++
+ if HAVE_XMLTO
+ BUILT_DOC_FILES += $(TXT_FILES)
+ .xml.txt:
+@@ -59,7 +67,7 @@ endif
+ 
+ endif
+ 
+-CLEAN_DOC_FILES = $(TXT_FILES) $(HTML_FILES) $(PDF_FILES)
++CLEAN_DOC_FILES = $(TXT_FILES) $(HTML_FILES) $(PDF_FILES) xorg.css
+ 
+ # All the files we build depend on the entities
+ $(BUILT_DOC_FILES): $(XML_ENT_DIR)/xserver.ent
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0005-Add-name-argument-to-CreateNewResourceType-documenta.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0005-Add-name-argument-to-CreateNewResourceType-documenta.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0005-Add-name-argument-to-CreateNewResourceType-documenta.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,38 @@
+From 6b912b08ce65072b2401167fbf2150b99c0ca6b0 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <alan.coopersmith at oracle.com>
+Date: Sat, 19 Jun 2010 23:56:20 -0700
+Subject: [PATCH] Add name argument to CreateNewResourceType documentation
+
+Reflects API change made in commit 895f40792a during Xorg 1.8 development
+
+Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
+Reviewed-by: Patrick E. Kane <pekane52 at gmail.com>
+---
+ doc/xml/Xserver-spec.xml |    8 ++++++--
+ 1 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git xorg-server-1.8.99.905/doc/xml/Xserver-spec.xml xorg-server-1.8.99.905/doc/xml/Xserver-spec.xml
+index 88885ae..466b79d 100644
+--- xorg-server-1.8.99.905/doc/xml/Xserver-spec.xml
++++ xorg-server-1.8.99.905/doc/xml/Xserver-spec.xml
+@@ -357,11 +357,15 @@ Resource types are integer values starting at 1.  Get
+ a resource type by calling
+ <blockquote><programlisting>
+ 
+-    RESTYPE CreateNewResourceType(deleteFunc)
++    RESTYPE CreateNewResourceType(deleteFunc, char *name)
+ 
+ </programlisting></blockquote>
+ deleteFunc will be called to destroy all resources with this
+-type.</para>
++type.   name will be used to identify this type of resource
++to clients using the X-Resource extension, to security
++extensions such as SELinux, and to tracing frameworks such as DTrace.
++[The name argument was added in xorg-server 1.8.]
++</para>
+ <para>
+ Resource classes are masks starting at 1 &lt;&lt; 31 which can
+ be or'ed with any resource type to provide attributes for the
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0006-Add-documentation-of-the-Xserver-DTrace-probes.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0006-Add-documentation-of-the-Xserver-DTrace-probes.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0006-Add-documentation-of-the-Xserver-DTrace-probes.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,675 @@
+From 9c171d4aee695ab66e6db1ab92539557bd368cfa Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <alan.coopersmith at oracle.com>
+Date: Fri, 25 Jun 2010 16:52:42 -0700
+Subject: [PATCH] Add documentation of the Xserver DTrace probes
+
+Mostly pulled together from posts to my blog and the docs posted
+at http://people.freedesktop.org/~alanc/dtrace/ and converted to
+DocBook.
+
+Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
+Reviewed-by: Patrick E. Kane <pekane52 at gmail.com>
+---
+ configure.ac                      |    1 +
+ doc/xml/Makefile.am               |    2 +
+ doc/xml/dtrace/Makefile.am        |   36 +++
+ doc/xml/dtrace/Xserver-DTrace.xml |  579 +++++++++++++++++++++++++++++++++++++
+ 4 files changed, 618 insertions(+), 0 deletions(-)
+ create mode 100644 doc/xml/dtrace/Makefile.am
+ create mode 100644 doc/xml/dtrace/Xserver-DTrace.xml
+
+diff --git xorg-server-1.8.99.905/configure.ac xorg-server-1.8.99.905/configure.ac
+index c61c60c..23a0f10 100644
+--- xorg-server-1.8.99.905/configure.ac
++++ xorg-server-1.8.99.905/configure.ac
+@@ -2183,6 +2183,7 @@ dbe/Makefile
+ dix/Makefile
+ doc/Makefile
+ doc/xml/Makefile
++doc/xml/dtrace/Makefile
+ doc/xml/xserver.ent
+ fb/Makefile
+ record/Makefile
+diff --git xorg-server-1.8.99.905/doc/xml/Makefile.am xorg-server-1.8.99.905/doc/xml/Makefile.am
+index df4833c..e66f192 100644
+--- xorg-server-1.8.99.905/doc/xml/Makefile.am
++++ xorg-server-1.8.99.905/doc/xml/Makefile.am
+@@ -21,6 +21,8 @@
+ # DEALINGS IN THE SOFTWARE.
+ #
+ 
++SUBDIRS = dtrace
++
+ XML_FILES = Xserver-spec.xml
+ 
+ include xmlrules.in
+diff --git xorg-server-1.8.99.905/doc/xml/dtrace/Makefile.am xorg-server-1.8.99.905/doc/xml/dtrace/Makefile.am
+new file mode 100644
+index 0000000..0e25e5d
+--- /dev/null
++++ xorg-server-1.8.99.905/doc/xml/dtrace/Makefile.am
+@@ -0,0 +1,36 @@
++#
++# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++#
++# Permission is hereby granted, free of charge, to any person obtaining a
++# copy of this software and associated documentation files (the "Software"),
++# to deal in the Software without restriction, including without limitation
++# the rights to use, copy, modify, merge, publish, distribute, sublicense,
++# and/or sell copies of the Software, and to permit persons to whom the
++# Software is furnished to do so, subject to the following conditions:
++#
++# The above copyright notice and this permission notice (including the next
++# paragraph) shall be included in all copies or substantial portions of the
++# Software.
++#
++# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
++# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++# DEALINGS IN THE SOFTWARE.
++#
++
++XML_FILES = Xserver-DTrace.xml
++
++include ../xmlrules.in
++
++if XSERVER_DTRACE
++doc_DATA = $(BUILT_DOC_FILES)
++else
++noinst_DATA = $(BUILT_DOC_FILES)
++endif
++
++CLEANFILES = $(CLEAN_DOC_FILES)
++
++EXTRA_DIST = $(XML_FILES)
+diff --git xorg-server-1.8.99.905/doc/xml/dtrace/Xserver-DTrace.xml xorg-server-1.8.99.905/doc/xml/dtrace/Xserver-DTrace.xml
+new file mode 100644
+index 0000000..290f0d3
+--- /dev/null
++++ xorg-server-1.8.99.905/doc/xml/dtrace/Xserver-DTrace.xml
+@@ -0,0 +1,579 @@
++<?xml version="1.0" encoding="ISO-8859-1"?>
++<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
++ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
++ <!ENTITY % defs SYSTEM "/xserver/doc/xml/xserver.ent"> %defs;
++]>
++
++<article id="Xserver-DTrace">
++  <articleinfo>
++    <title>Xserver provider for DTrace</title>
++    <author>
++      <firstname>Alan</firstname><surname>Coopersmith</surname>
++      <affiliation>
++	<orgname>Oracle Corporation</orgname>
++	<orgdiv>Solaris Engineering</orgdiv>
++      </affiliation>
++    </author>
++    <releaseinfo>X.Org Xserver version &xserver.version;</releaseinfo>
++    <legalnotice>
++      <para>
++Copyright (c) 2005, 2006, 2007, 2010, Oracle and/or its affiliates.
++All rights reserved.
++      </para><para>
++Permission is hereby granted, free of charge, to any person obtaining a
++copy of this software and associated documentation files (the "Software"),
++to deal in the Software without restriction, including without limitation
++the rights to use, copy, modify, merge, publish, distribute, sublicense,
++and/or sell copies of the Software, and to permit persons to whom the
++Software is furnished to do so, subject to the following conditions:
++      </para><para>
++The above copyright notice and this permission notice (including the next
++paragraph) shall be included in all copies or substantial portions of the
++Software.
++      </para><para>
++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
++THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++DEALINGS IN THE SOFTWARE.
++      </para>
++    </legalnotice>
++  </articleinfo>
++
++  <sect1 id="introduction">
++    <title>Introduction</title>
++    <para>
++      This page provides details on a
++      <ulink url="http://wikis.sun.com/display/DTrace/Statically+Defined+Tracing+for+User+Applications">statically defined user application tracing provider</ulink>
++      for the
++      <ulink url="http://hub.opensolaris.org/bin/view/Community+Group+dtrace/">DTrace</ulink>
++      facility in <productname>Solaris</productname> 10,
++      <productname>MacOS X</productname> 10.5, and later releases.  This
++      provider instruments various points in the X server, to allow
++      tracing what client applications are up to.
++    </para>
++
++    <para>
++      The provider was integrated into the X.Org git master repository
++      with Solaris 10 &amp; OpenSolaris support for the Xserver 1.4 release,
++      released in 2007 with X11R7.3.   Support for DTrace on MacOS X
++      was added in Xserver 1.7.
++    </para>
++
++    <para>
++      These probes expose the request and reply structure of the X protocol
++      between clients and the X server, so an understanding of that basic
++      nature will aid in learning how to use these probes.
++    </para>
++  </sect1>
++
++  <sect1 id="probes">
++    <title>Available probes</title>
++
++    <para>
++      Due to the way User-Defined DTrace probes work, arguments to
++      these probes all bear undistinguished names of
++      <parameter>arg0</parameter>, <parameter>arg1</parameter>,
++      <parameter>arg2</parameter>, etc.  These tables should help you
++      determine what the real data is for each of the probe arguments.
++
++    <table>
++      <title>Probes and their arguments</title>
++      <tgroup cols='7'>
++	<colspec colname="probe" colwidth="2*"/>
++	<colspec colname="desc" colwidth="3*"/>
++	<colspec colname="arg0" colwidth="1*"/>
++	<colspec colname="arg1" colwidth="1*"/>
++	<colspec colname="arg2" colwidth="1*"/>
++	<colspec colname="arg3" colwidth="1*"/>
++	<colspec colname="arg4" colwidth="1*"/>
++	<spanspec spanname="all" namest="probe" nameend="arg4"/>
++	<thead>
++	  <row>
++	    <entry>Probe name</entry>
++	    <entry>Description</entry>
++	    <entry>arg0</entry>
++	    <entry>arg1</entry>
++	    <entry>arg2</entry>
++	    <entry>arg3</entry>
++	    <entry>arg4</entry>
++	  </row>
++	</thead>
++	<tbody>
++	  <row>
++	    <entry spanname="all" class="grouphead">Request Probes</entry>
++	  </row>
++	  <row>
++	    <entry>request-start</entry>
++	    <entry>Called just before processing each client request.</entry>
++	    <entry><parameter>requestName</parameter></entry>
++	    <entry><parameter>requestCode</parameter></entry>
++	    <entry><parameter>requestLength</parameter></entry>
++	    <entry><parameter>clientId</parameter></entry>
++	    <entry><parameter>requestBuffer</parameter></entry>
++	  </row>
++	  <row>
++	    <entry>request-done</entry>
++	    <entry>Called just after processing each client request.</entry>
++	    <entry><parameter>requestName</parameter></entry>
++	    <entry><parameter>requestCode</parameter></entry>
++	    <entry><parameter>sequenceNumber</parameter></entry>
++	    <entry><parameter>clientId</parameter></entry>
++	    <entry><parameter>resultCode</parameter></entry>
++	  </row>
++	  <row>
++	    <entry spanname="all" class="grouphead">Event Probes</entry>
++	  </row>
++	  <row>
++	    <entry>send-event</entry>
++	    <entry>Called just before send each event to a client.</entry>
++	    <entry><parameter>clientId</parameter></entry>
++	    <entry><parameter>eventCode</parameter></entry>
++	    <entry><parameter>eventBuffer</parameter></entry>
++	    <entry nameend="arg4" class="unused"/>
++	  </row>
++	  <row>
++	    <entry spanname="all" class="grouphead">Client Connection Probes</entry>
++	  </row>
++	  <row>
++	    <entry>client-connect</entry>
++	    <entry>Called when a new connection is opened from a client</entry>
++	    <entry><parameter>clientId</parameter></entry>
++	    <entry><parameter>clientFD</parameter></entry>
++	    <entry nameend="arg4" class="unused"/>
++	  </row>
++	  <row>
++	    <entry>client-auth</entry>
++	    <entry>Called when client authenticates (normally just after connection opened)</entry>
++	    <entry><parameter>clientId</parameter></entry>
++	    <entry><parameter>clientAddr</parameter></entry>
++	    <entry><parameter>clientPid</parameter></entry>
++	    <entry><parameter>clientZoneId</parameter></entry>
++	    <entry nameend="arg4" class="unused"/>
++	  </row>
++	  <row>
++	    <entry>client-disconnect</entry>
++	    <entry>Called when a client connection is closed</entry>
++	    <entry><parameter>clientId</parameter></entry>
++	    <entry nameend="arg4" class="unused"/>
++	  </row>
++	  <row>
++	    <entry spanname="all" class="grouphead">Resource Allocation Probes</entry>
++	  </row>
++	  <row>
++	    <entry>resource-alloc</entry>
++	    <entry>Called when a new resource (pixmap, gc, colormap, etc.) is allocated</entry>
++	    <entry><parameter>resourceId</parameter></entry>
++	    <entry><parameter>resourceTypeId</parameter></entry>
++	    <entry><parameter>resourceValue</parameter></entry>
++	    <entry><parameter>resourceTypeName</parameter></entry>
++	    <entry nameend="arg4" class="unused"/>
++	  </row>
++	  <row>
++	    <entry>resource-free</entry>
++	    <entry>Called when a resource is freed</entry>
++	    <entry><parameter>resourceId</parameter></entry>
++	    <entry><parameter>resourceTypeId</parameter></entry>
++	    <entry><parameter>resourceValue</parameter></entry>
++	    <entry><parameter>resourceTypeName</parameter></entry>
++	    <entry nameend="arg4" class="unused"/>
++	  </row>
++	</tbody>
++      </tgroup>
++    </table>
++    </para>
++  </sect1>
++
++  <sect1 id="arguments">
++    <title>Data Available in Probe Arguments</title>
++
++    <para>
++      To access data in arguments of type <type>string</type>, you will need
++      to use <ulink url="http://wikis.sun.com/display/DTrace/Actions+and+Subroutines#ActionsandSubroutines-{{copyinstr}}"><function>copyinstr()</function></ulink>.
++      To access data buffers referenced via <type>uintptr_t</type>'s, you will
++      need to use <ulink url="http://wikis.sun.com/display/DTrace/Actions+and+Subroutines#ActionsandSubroutines-{{copyin}}"><function>copyin()</function></ulink>.
++
++    <table>
++      <title>Probe Arguments</title>
++      <tgroup cols='3'>
++	<colspec colname="arg" colwidth="2*"/>
++	<colspec colname="type" colwidth="1*"/>
++	<colspec colname="desc" colwidth="7*"/>
++	<thead>
++	  <row>
++	    <entry>Argument name</entry>
++	    <entry>Type</entry>
++	    <entry>Description</entry>
++	  </row>
++	</thead>
++	<tbody>
++	  <row>
++	    <entry><parameter>clientAddr</parameter></entry>
++	    <entry><type>string</type></entry>
++	    <entry>String representing address client connected from</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>clientFD</parameter></entry>
++	    <entry><type>int</type></entry>
++	    <entry>X server's file descriptor for server side of each connection</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>clientId</parameter></entry>
++	    <entry><type>int</type></entry>
++	    <entry>Unique integer identifier for each connection to the
++	      X server</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>clientPid</parameter></entry>
++	    <entry><type>pid_t</type></entry>
++	    <entry>Process id of client, if connection is local
++	      (from <function>getpeerucred()</function>)</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>clientZoneId</parameter></entry>
++	    <entry><type>zoneid_t</type></entry>
++	    <entry>Solaris: Zone id of client, if connection is local
++	      (from <function>getpeerucred()</function>)</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>eventBuffer</parameter></entry>
++	    <entry><type>uintptr_t</type></entry>
++	    <entry>Pointer to buffer containing X event - decode using
++	      structures in
++	      &lt;<ulink url="http://cgit.freedesktop.org/xorg/proto/xproto/tree/Xproto.h"><filename class="headerfile">X11/Xproto.h</filename></ulink>&gt;
++	      and similar headers for each extension</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>eventCode</parameter></entry>
++	    <entry><type>uint8_t</type></entry>
++	    <entry>Event number of X event</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>resourceId</parameter></entry>
++	    <entry><type>uint32_t</type></entry>
++	    <entry>X resource id (XID)</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>resourceTypeId</parameter></entry>
++	    <entry><type>uint32_t</type></entry>
++	    <entry>Resource type id</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>resourceTypeName</parameter></entry>
++	    <entry><type>string</type></entry>
++	    <entry>String representing X resource type
++		(<literal>"PIXMAP"</literal>, etc.)</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>resourceValue</parameter></entry>
++	    <entry><type>uintptr_t</type></entry>
++	    <entry>Pointer to data for X resource</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>resultCode</parameter></entry>
++	    <entry><type>int</type></entry>
++	    <entry>Integer code representing result status of request</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>requestBuffer</parameter></entry>
++	    <entry><type>uintptr_t</type></entry>
++	    <entry>Pointer to buffer containing X request - decode using
++	      structures in
++	      &lt;<ulink url="http://cgit.freedesktop.org/xorg/proto/xproto/tree/Xproto.h"><filename class="headerfile">X11/Xproto.h</filename></ulink>&gt;
++	      and similar headers for each extension</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>requestCode</parameter></entry>
++	    <entry><type>uint8_t</type></entry>
++	    <entry>Request number of X request or Extension</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>requestName</parameter></entry>
++	    <entry><type>string</type></entry>
++	    <entry>Name of X request or Extension</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>requestLength</parameter></entry>
++	    <entry><type>uint16_t</type></entry>
++	    <entry>Length of X request</entry>
++	  </row>
++	  <row>
++	    <entry><parameter>sequenceNumber</parameter></entry>
++	    <entry><type>uint32_t</type></entry>
++	    <entry>Number of X request in in this connection</entry>
++	  </row>
++	</tbody>
++      </tgroup>
++    </table>
++    </para>
++  </sect1>
++
++  <sect1 id="examples">
++    <title>Examples</title>
++
++    <example>
++      <title>Counting requests by request name</title>
++
++      <para>
++	This script simply increments a counter for each different request
++	made, and when you exit the script (such as by hitting
++	<keycombo action='simul'><keycap>Control</keycap><keycap>C</keycap>
++	</keycombo>) prints the counts.
++
++	<programlisting>
++#!/usr/sbin/dtrace -s
++
++Xserver*:::request-start
++{
++    @counts[copyinstr(arg0)] = count();
++}
++	</programlisting>
++
++	The output from a short run may appear as:
++	<screen>
++  QueryPointer                                                      1
++  CreatePixmap                                                      2
++  FreePixmap                                                        2
++  PutImage                                                          2
++  ChangeGC                                                         10
++  CopyArea                                                         10
++  CreateGC                                                         14
++  FreeGC                                                           14
++  RENDER                                                           28
++  SetClipRectangles                                                40
++	</screen>
++      </para>
++
++      <para>
++	This can be rewritten slightly to cache the string containing the name
++	of the request since it will be reused many times, instead of copying
++	it over and over from the kernel:
++
++	<programlisting>
++#!/usr/sbin/dtrace -s
++
++string Xrequest[uintptr_t];
++
++Xserver*:::request-start
++/Xrequest[arg0] == ""/
++{
++    Xrequest[arg0] = copyinstr(arg0);
++}
++
++Xserver*:::request-start
++{
++    @counts[Xrequest[arg0]] = count();
++}
++	</programlisting>
++      </para>
++    </example>
++
++    <example>
++      <title>Get average CPU time per request</title>
++
++      <para>This script records the CPU time used between the probes at
++	the start and end of each request and aggregates it per request type.
++
++	<programlisting>
++#!/usr/sbin/dtrace -s
++
++Xserver*:::request-start
++{
++    reqstart = vtimestamp;
++}
++
++Xserver*:::request-done
++{
++    @times[copyinstr(arg0)] = avg(vtimestamp - reqstart);
++}
++	</programlisting>
++
++	The output from a sample run might look like:
++
++	<screen>
++  ChangeGC                                                        889
++  MapWindow                                                       907
++  SetClipRectangles                                              1319
++  PolyPoint                                                      1413
++  PolySegment                                                    1434
++  PolyRectangle                                                  1828
++  FreeCursor                                                     1895
++  FreeGC                                                         1950
++  CreateGC                                                       2244
++  FreePixmap                                                     2246
++  GetInputFocus                                                  2249
++  TranslateCoords                                                8508
++  QueryTree                                                      8846
++  GetGeometry                                                    9948
++  CreatePixmap                                                  12111
++  AllowEvents                                                   14090
++  GrabServer                                                    14791
++  MIT-SCREEN-SAVER                                              16747
++  ConfigureWindow                                               22917
++  SetInputFocus                                                 28521
++  PutImage                                                     240841
++
++	</screen>
++      </para>
++    </example>
++
++    <example>
++      <title>Monitoring clients that connect and disconnect</title>
++
++      <para>
++	This script simply prints information about each client that
++	connects or disconnects from the server while it is running.
++	Since the provider is specified as <code>Xserver$1</code> instead
++	of <code>Xserver*</code> like previous examples, it won't monitor
++	all Xserver processes running on the machine, but instead expects
++	the process id of the X server to monitor to be specified as the
++	argument to the script.
++
++	<programlisting>
++#!/usr/sbin/dtrace -s
++
++Xserver$1:::client-connect
++{
++	printf("** Client Connect: id %d\n", arg0);
++}
++
++Xserver$1:::client-auth
++{
++	printf("** Client auth'ed: id %d =&gt; %s pid %d\n",
++		arg0, copyinstr(arg1), arg2);
++}
++
++Xserver$1:::client-disconnect
++{
++	printf("** Client Disconnect: id %d\n", arg0);
++}
++	</programlisting>
++
++	A sample run:
++
++	<screen>
++<prompt>#</prompt> <userinput>./foo.d 5790</userinput>
++<computeroutput>dtrace: script './foo.d' matched 4 probes
++CPU     ID                    FUNCTION:NAME
++  0  15774 CloseDownClient:client-disconnect ** Client Disconnect: id 65
++
++  2  15774 CloseDownClient:client-disconnect ** Client Disconnect: id 64
++
++  0  15773 EstablishNewConnections:client-connect ** Client Connect: id 64
++
++  0  15772            AuthAudit:client-auth ** Client auth'ed: id 64 =&gt; local host pid 2034
++
++  0  15773 EstablishNewConnections:client-connect ** Client Connect: id 65
++
++  0  15772            AuthAudit:client-auth ** Client auth'ed: id 65 =&gt; local host pid 2034
++
++  0  15774 CloseDownClient:client-disconnect ** Client Disconnect: id 64
++	  </computeroutput>
++	</screen>
++
++      </para>
++    </example>
++
++    <example>
++      <title>Monitoring clients creating Pixmaps</title>
++
++      <para>
++	This script can be used to determine which clients are creating
++	pixmaps in the X server, printing information about each client
++	as it connects to help trace it back to the program on the other
++	end of the X connection.
++
++	<programlisting>
++#!/usr/sbin/dtrace -qs
++
++string Xrequest[uintptr_t];
++string Xrestype[uintptr_t];
++
++Xserver$1:::request-start
++/Xrequest[arg0] == ""/
++{
++	Xrequest[arg0] = copyinstr(arg0);
++}
++
++Xserver$1:::resource-alloc
++/arg3 != 0 &amp;&amp; Xrestype[arg3] == ""/
++{
++	Xrestype[arg3] = copyinstr(arg3);
++}
++
++
++Xserver$1:::request-start
++/Xrequest[arg0] == "X_CreatePixmap"/
++{
++	printf("-&gt; %s: client %d\n", Xrequest[arg0], arg3);
++}
++
++Xserver$1:::request-done
++/Xrequest[arg0] == "X_CreatePixmap"/
++{
++	printf("&lt;- %s: client %d\n", Xrequest[arg0], arg3);
++}
++
++Xserver$1:::resource-alloc
++/Xrestype[arg3] == "PIXMAP"/
++{
++	printf("** Pixmap alloc: %08x\n", arg0);
++}
++
++
++Xserver$1:::resource-free
++/Xrestype[arg3] == "PIXMAP"/
++{
++	printf("** Pixmap free:  %08x\n", arg0);
++}
++
++Xserver$1:::client-connect
++{
++	printf("** Client Connect: id %d\n", arg0);
++}
++
++Xserver$1:::client-auth
++{
++	printf("** Client auth'ed: id %d =&gt; %s pid %d\n",
++		arg0, copyinstr(arg1), arg2);
++}
++
++Xserver$1:::client-disconnect
++{
++	printf("** Client Disconnect: id %d\n", arg0);
++}
++	</programlisting>
++
++	Sample output from a run of this script:
++	<screen><computeroutput>
++** Client Connect: id 17
++** Client auth'ed: id 17 =&gt; local host pid 20273
++-&gt; X_CreatePixmap: client 17
++** Pixmap alloc: 02200009
++&lt;- X_CreatePixmap: client 17
++-&gt; X_CreatePixmap: client 15
++** Pixmap alloc: 01e00180
++&lt;- X_CreatePixmap: client 15
++-&gt; X_CreatePixmap: client 15
++** Pixmap alloc: 01e00181
++&lt;- X_CreatePixmap: client 15
++-&gt; X_CreatePixmap: client 14
++** Pixmap alloc: 01c004c8
++&lt;- X_CreatePixmap: client 14
++** Pixmap free:  02200009
++** Client Disconnect: id 17
++** Pixmap free:  01e00180
++** Pixmap free:  01e00181
++	  </computeroutput></screen>
++
++      </para>
++
++    </example>
++
++
++  </sect1>
++
++</article>
++
+-- 
+1.5.6.6
+

Deleted: trunk/dports/x11/xorg-server-devel/files/0006-Workaround-the-GC-clipping-problem-in-miPaintWindow-.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0006-Workaround-the-GC-clipping-problem-in-miPaintWindow-.patch	2010-08-02 06:10:16 UTC (rev 70210)
+++ trunk/dports/x11/xorg-server-devel/files/0006-Workaround-the-GC-clipping-problem-in-miPaintWindow-.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -1,164 +0,0 @@
-From 29e41824960c0f7ccd4da39eb33c570cad41ed20 Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston <jeremyhu at apple.com>
-Date: Fri, 30 Apr 2010 13:08:25 -0700
-Subject: [PATCH 6/7] Workaround the GC clipping problem in miPaintWindow and add some debugging output.
-
-Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
----
- mi/miexpose.c |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++------
- 1 files changed, 94 insertions(+), 11 deletions(-)
-
-diff --git xorg-server-1.8.99.901/mi/miexpose.c xorg-server-1.8.99.901/mi/miexpose.c
-index 94258b8..4f25c23 100644
---- xorg-server-1.8.99.901/mi/miexpose.c
-+++ xorg-server-1.8.99.901/mi/miexpose.c
-@@ -521,6 +521,7 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
- void RootlessStartDrawing(WindowPtr pWin);
- void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
- Bool IsFramedWindow(WindowPtr pWin);
-+#include "../fb/fb.h"
- #endif 
- 
- void
-@@ -548,24 +549,37 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
-     Bool	solid = TRUE;
-     DrawablePtr	drawable = &pWin->drawable;
- 
-+#ifdef XQUARTZ_CLIP_DEBUG
-+    ErrorF("START %d BS %d (pR = %ld)\n", what, pWin->backgroundState, ParentRelative);
-+    ErrorF("      Rgn: %d %d %d %d\n", prgn->extents.x1, prgn->extents.y1,
-+	                               prgn->extents.x2 - prgn->extents.x1,
-+	                               prgn->extents.y2 - prgn->extents.y1);
-+    ErrorF("      Win: %d %d (%d %d) %d %d\n", pWin->origin.x, pWin->origin.y,
-+	                                       pWin->winSize.extents.x1, pWin->winSize.extents.y1,
-+	                                       pWin->winSize.extents.x2 - pWin->winSize.extents.x1,
-+					       pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
-+    ErrorF("     Draw: %d %d %d %d\n", pWin->drawable.x, pWin->drawable.y,
-+				       pWin->drawable.width, pWin->drawable.height);
-+#endif
-+
- #ifdef ROOTLESS
-     if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
- 	return;
--
--    if(IsFramedWindow(pWin)) {
--        RootlessStartDrawing(pWin);
--        RootlessDamageRegion(pWin, prgn);
--    
--        if(pWin->backgroundState == ParentRelative) {
--            if((what == PW_BACKGROUND) || 
--               (what == PW_BORDER && !pWin->borderIsPixel))
--                RootlessSetPixmapOfAncestors(pWin);
--        }
--    }
- #endif
-     
-     if (what == PW_BACKGROUND)
-     {
-+#ifdef ROOTLESS
-+	if(IsFramedWindow(pWin)) {
-+	    RootlessStartDrawing(pWin);
-+	    RootlessDamageRegion(pWin, prgn);
-+
-+	    if(pWin->backgroundState == ParentRelative) {
-+		RootlessSetPixmapOfAncestors(pWin);
-+	    }
-+	}
-+#endif
-+
- 	while (pWin->backgroundState == ParentRelative)
- 	    pWin = pWin->parent;
- 
-@@ -587,6 +601,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
-     {
- 	PixmapPtr   pixmap;
- 
-+#ifdef ROOTLESS
-+	if(IsFramedWindow(pWin)) {
-+	    RootlessStartDrawing(pWin);
-+	    RootlessDamageRegion(pWin, prgn);
-+	    
-+	    if(!pWin->borderIsPixel &&
-+		pWin->backgroundState == ParentRelative) {
-+		RootlessSetPixmapOfAncestors(pWin);
-+	    }
-+	}
-+#endif
-+
- 	tile_x_off = drawable->x;
- 	tile_y_off = drawable->y;
- 	
-@@ -595,6 +621,12 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
- 	    return;
- 	pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
- 	drawable = &pixmap->drawable;
-+
-+#ifdef XQUARTZ_CLIP_DEBUG
-+	ErrorF("     Draw: %d %d %d %d\n",
-+	       drawable->x, drawable->y, drawable->width, drawable->height);    
-+#endif
-+	
- #ifdef COMPOSITE
- 	draw_x_off = pixmap->screen_x;
- 	draw_y_off = pixmap->screen_y;
-@@ -657,6 +689,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
-     ChangeGC (NullClient, pGC, gcmask, gcval);
-     ValidateGC (drawable, pGC);
- 
-+#ifdef XQUARTZ_CLIP_DEBUG
-+    ErrorF("       GC: %d %d %d %d\n",
-+	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
-+	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
-+	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
-+#endif
-+    
-+#ifdef XQUARTZ
-+    /* Looks like our clipping isn't set right for some reason:
-+     * http://xquartz.macosforge.org/trac/ticket/290
-+     */
-+    if(what == PW_BORDER) {
-+
-+#if 0
-+	if(solid) {
-+#if 1
-+	    fbFillRegionSolid(&pWin->drawable,
-+			      prgn,
-+			      0,
-+			      fbReplicatePixel(fill.pixel,
-+					       pWin->drawable.bitsPerPixel));
-+#else
-+	    fbFillRegionSolid(drawable,
-+			      prgn,
-+			      0,
-+			      fbReplicatePixel(fill.pixel,
-+					       drawable->bitsPerPixel));
-+#endif
-+	    return;
-+	}
-+#endif
-+    
-+	pGC->pCompositeClip->extents.x1 += prgn->extents.x1;
-+	pGC->pCompositeClip->extents.y1 += prgn->extents.y1;
-+	pGC->pCompositeClip->extents.x2 += prgn->extents.x1;
-+	pGC->pCompositeClip->extents.y2 += prgn->extents.y1;
-+	
-+	if(pGC->pCompositeClip->extents.x2 > drawable->pScreen->width)
-+	    pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
-+	if(pGC->pCompositeClip->extents.y2 > drawable->pScreen->height)
-+	    pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
-+    }
-+#endif
-+
-+#ifdef XQUARTZ_CLIP_DEBUG
-+    ErrorF("       GC: %d %d %d %d\n",
-+	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
-+	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
-+	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);    
-+#endif
-+
-     numRects = RegionNumRects(prgn);
-     pbox = RegionRects(prgn);
-     for (i= numRects; --i >= 0; pbox++, prect++)
--- 
-1.7.1
-

Added: trunk/dports/x11/xorg-server-devel/files/0007-XQuartz-GLX-Don-t-mangle-__GLXDrawable-s-pDraw.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0007-XQuartz-GLX-Don-t-mangle-__GLXDrawable-s-pDraw.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0007-XQuartz-GLX-Don-t-mangle-__GLXDrawable-s-pDraw.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,43 @@
+From 98f90145d786695ecbc02a667c6ffe7c619dc67e Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Wed, 28 Jul 2010 18:08:02 -0700
+Subject: [PATCH] XQuartz: GLX: Don't mangle __GLXDrawable's pDraw
+
+We were incorrectly NULLing out pDraw in __GLXDrawable instead of ours in
+__GLXAquaDrawable. (we should refactor to eliminate this redundancy later)
+
+This was causing http://xquartz.macosforge.org/trac/ticket/426
+This was benign until commit f0006aa58f6cf7552a239e169ff6e7e4fda532f4
+The root cause of this change was  fed7ccc481ad1caaa518cafe944c2327a5d0b6c65
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/GL/indirect.c |    5 ++---
+ 1 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/GL/indirect.c xorg-server-1.8.99.905/hw/xquartz/GL/indirect.c
+index 3e8d730..58f78fb 100644
+--- xorg-server-1.8.99.905/hw/xquartz/GL/indirect.c
++++ xorg-server-1.8.99.905/hw/xquartz/GL/indirect.c
+@@ -271,8 +271,7 @@ static void __glXAquaContextDestroy(__GLXcontext *baseContext) {
+ 
+     __GLXAquaContext *context = (__GLXAquaContext *) baseContext;
+     
+-    GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx 0x%x)\n",
+-                     (unsigned int) baseContext);
++    GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx %p)\n", baseContext);
+     if (context != NULL) {
+       if (context->sid != 0 && surface_hash != NULL) {
+ 		lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(context->sid), NULL);
+@@ -321,7 +320,7 @@ static void surface_notify(void *_arg, void *data) {
+     case AppleDRISurfaceNotifyDestroyed:
+         if (surface_hash != NULL)
+             x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(arg->id));
+-	draw->base.pDraw = NULL;
++	draw->pDraw = NULL;
+ 	draw->sid = 0;
+         break;
+ 
+-- 
+1.5.6.6
+

Deleted: trunk/dports/x11/xorg-server-devel/files/0007-fb-Revert-fb-changes-that-broke-XQuartz.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0007-fb-Revert-fb-changes-that-broke-XQuartz.patch	2010-08-02 06:10:16 UTC (rev 70210)
+++ trunk/dports/x11/xorg-server-devel/files/0007-fb-Revert-fb-changes-that-broke-XQuartz.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -1,231 +0,0 @@
-From 383ca613f5f71ad5058d7845ebf55051a07d66c5 Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston <jeremyhu at apple.com>
-Date: Fri, 12 Feb 2010 19:48:52 -0800
-Subject: [PATCH 7/7] fb: Revert fb changes that broke XQuartz
-
-http://bugs.freedesktop.org/show_bug.cgi?id=26124
-
-Revert "Fix source pictures getting random transforms after 2d6a8f668342a5190cdf43b5."
-Revert "fb: Adjust transform or composite coordinates for pixman operations"
-
-http://bugs.freedesktop.org/26124
-
-This reverts commit a72c65e9176c51de95db2fdbf4c5d946a4911695.
-This reverts commit a6bd5d2e482a5aa84acb3d4932e2a166d8670ef1.
-
-Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
----
- fb/fb.h     |    7 +----
- fb/fbpict.c |   72 ++++++++++++++++++-----------------------------------------
- fb/fbtrap.c |    6 +---
- 3 files changed, 26 insertions(+), 59 deletions(-)
-
-diff --git xorg-server-1.8.99.901/fb/fb.h xorg-server-1.8.99.901/fb/fb.h
-index a06f98b..3b9efea 100644
---- xorg-server-1.8.99.901/fb/fb.h
-+++ xorg-server-1.8.99.901/fb/fb.h
-@@ -2080,11 +2080,8 @@ fbFillRegionSolid (DrawablePtr	pDrawable,
- 		   FbBits	xor);
- 
- extern _X_EXPORT pixman_image_t *
--image_from_pict (PicturePtr	pict,
--		 Bool		has_clip,
--		 int		*xoff,
--		 int		*yoff);
--
-+image_from_pict (PicturePtr pict,
-+		 Bool       has_clip);
- extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
- 
- #endif /* _FB_H_ */
-diff --git xorg-server-1.8.99.901/fb/fbpict.c xorg-server-1.8.99.901/fb/fbpict.c
-index 26cdc0d..f2ddb63 100644
---- xorg-server-1.8.99.901/fb/fbpict.c
-+++ xorg-server-1.8.99.901/fb/fbpict.c
-@@ -156,24 +156,19 @@ fbComposite (CARD8      op,
- 	     CARD16     height)
- {
-     pixman_image_t *src, *mask, *dest;
--    int src_xoff, src_yoff;
--    int msk_xoff, msk_yoff;
--    int dst_xoff, dst_yoff;
-     
-     miCompositeSourceValidate (pSrc, xSrc - xDst, ySrc - yDst, width, height);
-     if (pMask)
- 	miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, height);
-     
--    src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
--    mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
--    dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
-+    src = image_from_pict (pSrc, TRUE);
-+    mask = image_from_pict (pMask, TRUE);
-+    dest = image_from_pict (pDst, TRUE);
- 
-     if (src && dest && !(pMask && !mask))
-     {
- 	pixman_image_composite (op, src, mask, dest,
--				xSrc + src_xoff, ySrc + src_yoff,
--				xMask + msk_xoff, yMask + msk_yoff,
--				xDst + dst_xoff, yDst + dst_yoff,
-+				xSrc, ySrc, xMask, yMask, xDst, yDst,
- 				width, height);
-     }
- 
-@@ -271,22 +266,22 @@ create_conical_gradient_image (PictGradient *gradient)
- 
- static pixman_image_t *
- create_bits_picture (PicturePtr pict,
--		     Bool       has_clip,
--		     int	*xoff,
--		     int	*yoff)
-+		     Bool       has_clip)
- {
--    PixmapPtr pixmap;
-     FbBits *bits;
-     FbStride stride;
--    int bpp;
-+    int bpp, xoff, yoff;
-     pixman_image_t *image;
-     
--    fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
--    fbGetPixmapBitsData(pixmap, bits, stride, bpp);
-+    fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
-+
-+    bits = (FbBits*)((CARD8*)bits +
-+		     (pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
-+		     (pict->pDrawable->x + xoff) * (bpp / 8));
- 
-     image = pixman_image_create_bits (
- 	pict->format,
--	pixmap->drawable.width, pixmap->drawable.height,
-+	pict->pDrawable->width, pict->pDrawable->height,
- 	(uint32_t *)bits, stride * sizeof (FbStride));
-     
-     
-@@ -312,52 +307,30 @@ create_bits_picture (PicturePtr pict,
- 	if (pict->clientClipType != CT_NONE)
- 	    pixman_image_set_has_client_clip (image, TRUE);
- 
--	if (*xoff || *yoff)
--	    pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
-+	pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
- 
- 	pixman_image_set_clip_region (image, pict->pCompositeClip);
- 
--	if (*xoff || *yoff)
--	    pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
-+	pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
-     }
-     
-     /* Indexed table */
-     if (pict->pFormat->index.devPrivate)
- 	pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
- 
--    /* Add in drawable origin to position within the image */
--    *xoff += pict->pDrawable->x;
--    *yoff += pict->pDrawable->y;
--
-     return image;
- }
- 
- static void
--set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
-+set_image_properties (pixman_image_t *image, PicturePtr pict)
- {
-     pixman_repeat_t repeat;
-     pixman_filter_t filter;
-     
-     if (pict->transform)
-     {
--	/* For source images, adjust the transform to account
--	 * for the drawable offset within the pixman image,
--	 * then set the offset to 0 as it will be used
--	 * to compute positions within the transformed image.
--	 */
--	if (!has_clip) {
--	    struct pixman_transform	adjusted;
--
--	    adjusted = *pict->transform;
--	    pixman_transform_translate(&adjusted,
--				       NULL,
--				       pixman_int_to_fixed(*xoff),
--				       pixman_int_to_fixed(*yoff));
--	    pixman_image_set_transform (image, &adjusted);
--	    *xoff = 0;
--	    *yoff = 0;
--	} else
--	    pixman_image_set_transform (image, pict->transform);
-+	pixman_image_set_transform (
-+	    image, (pixman_transform_t *)pict->transform);
-     }
-     
-     switch (pict->repeatType)
-@@ -384,8 +357,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
-     
-     if (pict->alphaMap)
-     {
--	int alpha_xoff, alpha_yoff;
--	pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff);
-+	pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, TRUE);
- 	
- 	pixman_image_set_alpha_map (
- 	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
-@@ -418,7 +390,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
- }
- 
- pixman_image_t *
--image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
-+image_from_pict (PicturePtr pict,
-+		 Bool has_clip)
- {
-     pixman_image_t *image = NULL;
- 
-@@ -427,7 +400,7 @@ image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
- 
-     if (pict->pDrawable)
-     {
--	image = create_bits_picture (pict, has_clip, xoff, yoff);
-+	image = create_bits_picture (pict, has_clip);
-     }
-     else if (pict->pSourcePict)
-     {
-@@ -448,11 +421,10 @@ image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
- 	    else if (sp->type == SourcePictTypeConical)
- 		image = create_conical_gradient_image (gradient);
- 	}
--	*xoff = *yoff = 0;
-     }
-     
-     if (image)
--	set_image_properties (image, pict, has_clip, xoff, yoff);
-+	set_image_properties (image, pict);
-     
-     return image;
- }
-diff --git xorg-server-1.8.99.901/fb/fbtrap.c xorg-server-1.8.99.901/fb/fbtrap.c
-index 9f5c39f..9c55236 100644
---- xorg-server-1.8.99.901/fb/fbtrap.c
-+++ xorg-server-1.8.99.901/fb/fbtrap.c
-@@ -38,8 +38,7 @@ fbAddTraps (PicturePtr	pPicture,
- 	    int		ntrap,
- 	    xTrap	*traps)
- {
--    int image_xoff, image_yoff;
--    pixman_image_t *image = image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff);
-+    pixman_image_t *image = image_from_pict (pPicture, FALSE);
- 
-     if (!image)
- 	return;
-@@ -55,8 +54,7 @@ fbRasterizeTrapezoid (PicturePtr    pPicture,
- 		      int	    x_off,
- 		      int	    y_off)
- {
--    int	mask_xoff, mask_yoff;
--    pixman_image_t *image = image_from_pict (pPicture, FALSE, &mask_xoff, &mask_yoff);
-+    pixman_image_t *image = image_from_pict (pPicture, FALSE);
- 
-     if (!image)
- 	return;
--- 
-1.7.1
-

Added: trunk/dports/x11/xorg-server-devel/files/0008-XQuartz-xpbproxy-Don-t-take-down-the-whole-server.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0008-XQuartz-xpbproxy-Don-t-take-down-the-whole-server.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0008-XQuartz-xpbproxy-Don-t-take-down-the-whole-server.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,30 @@
+From 750d4e82a0c1161292d24216bcff200cd6647611 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Thu, 29 Jul 2010 11:39:40 -0700
+Subject: [PATCH] XQuartz: xpbproxy: Don't take down the whole server on an IO error
+
+Calls pthread_exit to prevent _XIOError from calling exit()
+
+This fixes http://xquartz.macosforge.org/trac/ticket/421
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/pbproxy/main.m |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/pbproxy/main.m xorg-server-1.8.99.905/hw/xquartz/pbproxy/main.m
+index 560cf01..bb06465 100644
+--- xorg-server-1.8.99.905/hw/xquartz/pbproxy/main.m
++++ xorg-server-1.8.99.905/hw/xquartz/pbproxy/main.m
+@@ -75,6 +75,8 @@ static int x_io_error_handler (Display *dpy) {
+         exit(EXIT_FAILURE);
+ #endif
+ 
++    /* Prevent _XIOError from calling exit() */
++    pthread_exit(NULL);
+     return 0;
+ }
+ 
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0009-ddc-Fix-memory-leak-in-GetEDID_DDC1.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0009-ddc-Fix-memory-leak-in-GetEDID_DDC1.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0009-ddc-Fix-memory-leak-in-GetEDID_DDC1.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,42 @@
+From 7e0575baf14ec4a89492fd2780f9ab5b9244afbd Mon Sep 17 00:00:00 2001
+From: Matt Turner <mattst88 at gmail.com>
+Date: Tue, 27 Jul 2010 23:32:36 -0400
+Subject: [PATCH] ddc: Fix memory leak in GetEDID_DDC1
+
+Mark argument to DDC_checksum as const too.
+
+Signed-off-by: Matt Turner <mattst88 at gmail.com>
+Reviewed-by: Adam Jackson <ajax at redhat.com>
+Signed-off-by: Keith Packard <keithp at keithp.com>
+---
+ hw/xfree86/ddc/ddc.c |    7 +++++--
+ 1 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xfree86/ddc/ddc.c xorg-server-1.8.99.905/hw/xfree86/ddc/ddc.c
+index 7379e95..2d9d4dc 100644
+--- xorg-server-1.8.99.905/hw/xfree86/ddc/ddc.c
++++ xorg-server-1.8.99.905/hw/xfree86/ddc/ddc.c
+@@ -102,7 +102,7 @@ resort(unsigned char *s_block)
+ }
+ 
+ static int
+-DDC_checksum(unsigned char *block, int len)
++DDC_checksum(const unsigned char *block, int len)
+ {
+     int i, result = 0;
+     int not_null = 0;
+@@ -149,7 +149,10 @@ GetEDID_DDC1(unsigned int *s_ptr)
+ 	d_pos++;
+     }
+     free(s_ptr);
+-    if (d_block && DDC_checksum(d_block,EDID1_LEN)) return NULL;
++    if (d_block && DDC_checksum(d_block,EDID1_LEN)) {
++	free(d_block);
++	return NULL;
++    }
+     return (resort(d_block));
+ }
+ 
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0010-XQuartz-Make-application-switching-work-better-for.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0010-XQuartz-Make-application-switching-work-better-for.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0010-XQuartz-Make-application-switching-work-better-for.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,133 @@
+From bcffc2ab1408e62797d224302b84df3e7a2fa47f Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Thu, 29 Jul 2010 14:49:10 -0700
+Subject: [PATCH] XQuartz: Make application switching work better for the no-spaces case
+
+We still have the issue with not raising the frontmost window for the case
+when spaces is enabled, and the AppleSpacesSwitchOnActivate preference is
+disabled.
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/X11Application.m     |   28 +++++++++++++++++++++-------
+ hw/xquartz/xpr/xprEvent.c       |    2 +-
+ miext/rootless/rootless.h       |    4 ++--
+ miext/rootless/rootlessWindow.c |   12 +++++++++---
+ 4 files changed, 33 insertions(+), 13 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/X11Application.m xorg-server-1.8.99.905/hw/xquartz/X11Application.m
+index 805ed99..36c39e5 100644
+--- xorg-server-1.8.99.905/hw/xquartz/X11Application.m
++++ xorg-server-1.8.99.905/hw/xquartz/X11Application.m
+@@ -337,7 +337,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
+                 case NSApplicationActivatedEventType:
+                     for_x = NO;
+                     if ([self modalWindow] == nil) {
+-                        BOOL switch_on_activate, ok;
++                        BOOL order_all_windows = YES, workspaces, ok;
+                         for_appkit = NO;
+                         
+                         /* FIXME: hack to avoid having to pass the event to appkit,
+@@ -347,13 +347,27 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
+                         [self activateX:YES];
+                         
+                         /* Get the Spaces preference for SwitchOnActivate */
+-                        (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences"));
+-                        switch_on_activate = CFPreferencesGetAppBooleanValue(CFSTR("AppleSpacesSwitchOnActivate"), CFSTR(".GlobalPreferences"), &ok);
+-                        if(!ok)
+-                            switch_on_activate = YES;
++                        (void)CFPreferencesAppSynchronize(CFSTR("com.apple.dock"));
++                        workspaces = CFPreferencesGetAppBooleanValue(CFSTR("workspaces"), CFSTR("com.apple.dock"), &ok);
++                        if (!ok)
++                            workspaces = NO;
++
++                        if (workspaces) {
++                            (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences"));
++                            order_all_windows = CFPreferencesGetAppBooleanValue(CFSTR("AppleSpacesSwitchOnActivate"), CFSTR(".GlobalPreferences"), &ok);
++                            if (!ok)
++                                order_all_windows = YES;
++                        }
+                         
+-                        if ([e data2] & 0x10 && switch_on_activate) // 0x10 is set when we use cmd-tab or the dock icon
+-                            DarwinSendDDXEvent(kXquartzBringAllToFront, 0);
++                        /* TODO: In the workspaces && !AppleSpacesSwitchOnActivate case, the windows are ordered
++                         *       correctly, but we need to activate the top window on this space if there is
++                         *       none active.
++                         *
++                         *       If there are no active windows, and there are minimized windows, we should
++                         *       be restoring one of them.
++                         */
++                        if ([e data2] & 0x10) // 0x10 is set when we use cmd-tab or the dock icon
++                            DarwinSendDDXEvent(kXquartzBringAllToFront, 1, order_all_windows);
+                     }
+                     break;
+                     
+diff --git xorg-server-1.8.99.905/hw/xquartz/xpr/xprEvent.c xorg-server-1.8.99.905/hw/xquartz/xpr/xprEvent.c
+index 6245cce..342b54c 100644
+--- xorg-server-1.8.99.905/hw/xquartz/xpr/xprEvent.c
++++ xorg-server-1.8.99.905/hw/xquartz/xpr/xprEvent.c
+@@ -73,7 +73,7 @@ Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) {
+             
+         case kXquartzBringAllToFront:
+             DEBUG_LOG("kXquartzBringAllToFront\n");
+-            RootlessOrderAllWindows();
++            RootlessOrderAllWindows(e->data[0]);
+             return TRUE;
+         default:
+             return FALSE;
+diff --git xorg-server-1.8.99.905/miext/rootless/rootless.h xorg-server-1.8.99.905/miext/rootless/rootless.h
+index 00eac4e..dc4213f 100644
+--- xorg-server-1.8.99.905/miext/rootless/rootless.h
++++ xorg-server-1.8.99.905/miext/rootless/rootless.h
+@@ -444,7 +444,7 @@ void RootlessUpdateScreenPixmap(ScreenPtr pScreen);
+ void RootlessRepositionWindows(ScreenPtr pScreen);
+ 
+ /*
+- * Bring all windows to the front of the Aqua stack
++ * Bring all windows to the front of the native stack
+  */
+-void RootlessOrderAllWindows (void);
++void RootlessOrderAllWindows (Bool include_unhitable);
+ #endif /* _ROOTLESS_H */
+diff --git xorg-server-1.8.99.905/miext/rootless/rootlessWindow.c xorg-server-1.8.99.905/miext/rootless/rootlessWindow.c
+index bef8a2f..c1c6bdb 100644
+--- xorg-server-1.8.99.905/miext/rootless/rootlessWindow.c
++++ xorg-server-1.8.99.905/miext/rootless/rootlessWindow.c
+@@ -581,10 +581,15 @@ RootlessReorderWindow(WindowPtr pWin)
+ 
+         RootlessStopDrawing(pWin, FALSE);
+ 
+-        /* Find the next window above this one that has a mapped frame. */
++        /* Find the next window above this one that has a mapped frame. 
++         * Only include cases where the windows are in the same category of
++         * hittability to ensure offscreen windows dont get restacked
++         * relative to onscreen ones (but that the offscreen ones maintain
++         * their stacking order if they are explicitly asked to Reorder
++         */
+ 
+         newPrevW = pWin->prevSib;
+-        while (newPrevW && (WINREC(newPrevW) == NULL || !newPrevW->realized))
++        while (newPrevW && (WINREC(newPrevW) == NULL || !newPrevW->realized || newPrevW->rootlessUnhittable != pWin->rootlessUnhittable))
+             newPrevW = newPrevW->prevSib;
+ 
+         newPrev = newPrevW != NULL ? WINREC(newPrevW) : NULL;
+@@ -1502,7 +1507,7 @@ RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width)
+  * (i.e in front of Aqua windows) -- called when X11.app is given focus
+  */
+ void
+-RootlessOrderAllWindows (void)
++RootlessOrderAllWindows (Bool include_unhitable)
+ {
+     int i;
+     WindowPtr pWin;
+@@ -1519,6 +1524,7 @@ RootlessOrderAllWindows (void)
+       for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) {
+ 	if (!pWin->realized) continue;
+ 	if (RootlessEnsureFrame(pWin) == NULL) continue;
++        if (!include_unhitable && pWin->rootlessUnhittable) continue;
+ 	RootlessReorderWindow (pWin);
+       }
+     }
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0011-XQuartz-UpdateScreen-at-the-end-of-SetRootless.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0011-XQuartz-UpdateScreen-at-the-end-of-SetRootless.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0011-XQuartz-UpdateScreen-at-the-end-of-SetRootless.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,44 @@
+From 68b0a89942e4cdf8e59d95de49950d20378a5261 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Sun, 1 Aug 2010 11:39:14 -0700
+Subject: [PATCH] XQuartz: UpdateScreen at the end of SetRootless
+
+This will ensure that pRoot is unlocked after the miPaintWindow
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/quartz.c |    4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartz.c xorg-server-1.8.99.905/hw/xquartz/quartz.c
+index bdaa262..eee6151 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartz.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartz.c
+@@ -265,7 +265,6 @@ void QuartzUpdateScreens(void) {
+     pScreen->height = height;
+     
+     DarwinAdjustScreenOrigins(&screenInfo);
+-    quartzProcs->UpdateScreen(pScreen);
+     
+     /* DarwinAdjustScreenOrigins or UpdateScreen may change pScreen->x/y,
+      * so use it rather than x/y
+@@ -277,6 +276,7 @@ void QuartzUpdateScreens(void) {
+     pRoot = pScreen->root;
+     AppleWMSetScreenOrigin(pRoot);
+     pScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL);
++
+     miPaintWindow(pRoot, &pRoot->borderClip,  PW_BACKGROUND);
+ 
+     /* <rdar://problem/7770779> pointer events are clipped to old display region after display reconfiguration
+@@ -303,6 +303,8 @@ void QuartzUpdateScreens(void) {
+     e.u.configureNotify.borderWidth = wBorderWidth(pRoot);
+     e.u.configureNotify.override = pRoot->overrideRedirect;
+     DeliverEvents(pRoot, &e, 1, NullWindow);
++
++    quartzProcs->UpdateScreen(pScreen);
+     
+ #ifdef FAKE_RANDR
+     RREditConnectionInfo(pScreen);
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0012-XQuartz-xpr-Bail-on-errors-during-unlock-and-dest.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0012-XQuartz-xpr-Bail-on-errors-during-unlock-and-dest.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0012-XQuartz-xpr-Bail-on-errors-during-unlock-and-dest.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,49 @@
+From 7420e5e7515ee77e0d408d9efdb7743c024d590b Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Sun, 1 Aug 2010 11:41:58 -0700
+Subject: [PATCH] XQuartz: xpr: Bail on  errors during unlock and destroy
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/xpr/xprFrame.c |   10 ++++++++--
+ 1 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/xpr/xprFrame.c xorg-server-1.8.99.905/hw/xquartz/xpr/xprFrame.c
+index 9f5d8a6..42f06ef 100644
+--- xorg-server-1.8.99.905/hw/xquartz/xpr/xprFrame.c
++++ xorg-server-1.8.99.905/hw/xquartz/xpr/xprFrame.c
+@@ -206,13 +206,16 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ static void
+ xprDestroyFrame(RootlessFrameID wid)
+ {
++    xp_error err;
+     TA_SERVER();
+     
+     pthread_mutex_lock(&window_hash_mutex);
+     x_hash_table_remove(window_hash, wid);
+     pthread_mutex_unlock(&window_hash_mutex);
+ 
+-    xp_destroy_window(x_cvt_vptr_to_uint(wid));
++    err = xp_destroy_window(x_cvt_vptr_to_uint(wid));
++    if (err != Success)
++        FatalError("Could not destroy window %i.", (int)x_cvt_vptr_to_uint(wid));
+ }
+ 
+ 
+@@ -366,9 +369,12 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
+ static void
+ xprStopDrawing(RootlessFrameID wid, Bool flush)
+ {
++    xp_error err;
+     TA_SERVER();
+     
+-    xp_unlock_window(x_cvt_vptr_to_uint(wid), flush);
++    err = xp_unlock_window(x_cvt_vptr_to_uint(wid), flush);
++    if(err != Success)
++        FatalError("Could not unlock window %i after drawing.", (int)x_cvt_vptr_to_uint(wid));
+ }
+ 
+ 
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0013-XQuartz-RandR-Implement-basic-RandR-functionality.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0013-XQuartz-RandR-Implement-basic-RandR-functionality.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0013-XQuartz-RandR-Implement-basic-RandR-functionality.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,729 @@
+From 6bbe82131e4e714c29bbc9e56452ae4f20358d42 Mon Sep 17 00:00:00 2001
+From: Jan Hauffa <hauffa at in.tum.de>
+Date: Fri, 16 Jul 2010 17:18:03 +0200
+Subject: [PATCH] XQuartz: RandR: Implement basic RandR functionality.
+
+Querying and changing of resolution and refresh rate is supported,
+rotation is not implemented yet.
+
+Signed-off-by: Jan Hauffa <hauffa at in.tum.de>
+Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/Makefile.am     |    2 +
+ hw/xquartz/quartz.c        |  104 +++---------
+ hw/xquartz/quartz.h        |    3 +-
+ hw/xquartz/quartzCommon.h  |    3 +
+ hw/xquartz/quartzRandR.c   |  394 ++++++++++++++++++++++++++++++++++++++++++++
+ hw/xquartz/quartzRandR.h   |   37 ++++
+ hw/xquartz/xpr/xprScreen.c |    6 +-
+ 7 files changed, 469 insertions(+), 80 deletions(-)
+ create mode 100644 hw/xquartz/quartzRandR.c
+ create mode 100644 hw/xquartz/quartzRandR.h
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/Makefile.am xorg-server-1.8.99.905/hw/xquartz/Makefile.am
+index 96b139f..721d272 100644
+--- xorg-server-1.8.99.905/hw/xquartz/Makefile.am
++++ xorg-server-1.8.99.905/hw/xquartz/Makefile.am
+@@ -34,6 +34,7 @@ libXquartz_la_SOURCES = \
+ 	quartzCocoa.m \
+ 	quartzKeyboard.c \
+ 	quartzStartup.c \
++	quartzRandR.c \
+ 	threadSafety.c
+ 
+ EXTRA_DIST = \
+@@ -49,6 +50,7 @@ EXTRA_DIST = \
+ 	quartzAudio.h \
+ 	quartzCommon.h \
+ 	quartzKeyboard.h \
++	quartzRandR.h \
+ 	sanitizedCarbon.h \
+ 	sanitizedCocoa.h \
+ 	threadSafety.h
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartz.c xorg-server-1.8.99.905/hw/xquartz/quartz.c
+index eee6151..a4d7474 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartz.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartz.c
+@@ -35,6 +35,7 @@
+ #endif
+ 
+ #include "quartzCommon.h"
++#include "quartzRandR.h"
+ #include "inputstr.h"
+ #include "quartz.h"
+ #include "darwin.h"
+@@ -46,7 +47,6 @@
+ #include "X11Application.h"
+ 
+ #include <X11/extensions/applewmconst.h>
+-#include <X11/extensions/randr.h>
+ 
+ // X headers
+ #include "scrnintstr.h"
+@@ -56,6 +56,8 @@
+ #include "mi.h"
+ 
+ // System headers
++#include <stdlib.h>
++#include <string.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+@@ -64,8 +66,6 @@
+ #include <rootlessCommon.h>
+ #include <Xplugin.h>
+ 
+-#define FAKE_RANDR 1
+-
+ // Shared global variables for Quartz modes
+ int                     quartzUseSysBeep = 0;
+ int                     quartzServerVisible = FALSE;
+@@ -76,30 +76,6 @@ const char             *quartzOpenGLBundle = NULL;
+ int                     quartzFullscreenDisableHotkeys = TRUE;
+ int                     quartzOptionSendsAlt = FALSE;
+ 
+-#if defined(RANDR) && !defined(FAKE_RANDR)
+-Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
+-  return FALSE;
+-}
+-
+-Bool QuartzRandRSetConfig (ScreenPtr           pScreen,
+-			       Rotation            randr,
+-			       int                 rate,
+-			       RRScreenSizePtr     pSize) {
+-  return FALSE;
+-}
+-
+-Bool QuartzRandRInit (ScreenPtr pScreen) {
+-  rrScrPrivPtr    pScrPriv;
+-    
+-  if (!RRScreenInit (pScreen)) return FALSE;
+-
+-  pScrPriv = rrGetScrPriv(pScreen);
+-  pScrPriv->rrGetInfo = QuartzRandRGetInfo;
+-  pScrPriv->rrSetConfig = QuartzRandRSetConfig;
+-  return TRUE;
+-}
+-#endif
+-
+ /*
+ ===========================================================================
+ 
+@@ -143,6 +119,13 @@ Bool QuartzSetupScreen(
+     if (! quartzProcs->InitCursor(pScreen))
+         return FALSE;
+ 
++#if defined(RANDR) && !defined(FAKE_RANDR)
++    if(!QuartzRandRInit(pScreen)) {
++        DEBUG_LOG("Failed to init RandR extension.\n");
++        return FALSE;
++    }
++#endif
++
+     return TRUE;
+ }
+ 
+@@ -165,11 +148,6 @@ void QuartzInitOutput(
+     if (!dixRegisterPrivateKey(&quartzScreenKeyRec, PRIVATE_SCREEN, 0))
+ 	FatalError("Failed to alloc quartz screen private.\n");
+ 
+-#if defined(RANDR) && !defined(FAKE_RANDR)
+-    if(!QuartzRandRInit(pScreen))
+-        FatalError("Failed to init RandR extension.\n");
+-#endif
+-
+     // Do display mode specific initialization
+     quartzProcs->DisplayInit();
+ }
+@@ -191,50 +169,6 @@ void QuartzInitInput(
+ }
+ 
+ 
+-#ifdef FAKE_RANDR
+-
+-static const int padlength[4] = {0, 3, 2, 1};
+-
+-static void
+-RREditConnectionInfo (ScreenPtr pScreen)
+-{
+-    xConnSetup	    *connSetup;
+-    char	    *vendor;
+-    xPixmapFormat   *formats;
+-    xWindowRoot	    *root;
+-    xDepth	    *depth;
+-    xVisualType	    *visual;
+-    int		    screen = 0;
+-    int		    d;
+-
+-    connSetup = (xConnSetup *) ConnectionInfo;
+-    vendor = (char *) connSetup + sizeof (xConnSetup);
+-    formats = (xPixmapFormat *) ((char *) vendor +
+-				 connSetup->nbytesVendor +
+-				 padlength[connSetup->nbytesVendor & 3]);
+-    root = (xWindowRoot *) ((char *) formats +
+-			    sizeof (xPixmapFormat) * screenInfo.numPixmapFormats);
+-    while (screen != pScreen->myNum)
+-    {
+-	depth = (xDepth *) ((char *) root + 
+-			    sizeof (xWindowRoot));
+-	for (d = 0; d < root->nDepths; d++)
+-	{
+-	    visual = (xVisualType *) ((char *) depth +
+-				      sizeof (xDepth));
+-	    depth = (xDepth *) ((char *) visual +
+-				depth->nVisuals * sizeof (xVisualType));
+-	}
+-	root = (xWindowRoot *) ((char *) depth);
+-	screen++;
+-    }
+-    root->pixWidth = pScreen->width;
+-    root->pixHeight = pScreen->height;
+-    root->mmWidth = pScreen->mmWidth;
+-    root->mmHeight = pScreen->mmHeight;
+-}
+-#endif
+-
+ void QuartzUpdateScreens(void) {
+     ScreenPtr pScreen;
+     WindowPtr pRoot;
+@@ -255,7 +189,7 @@ void QuartzUpdateScreens(void) {
+     pScreen = screenInfo.screens[0];
+     
+     PseudoramiXResetScreens();
+-    quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height);
++    quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height, pScreen);
+     
+     pScreen->x = x;
+     pScreen->y = y;
+@@ -446,3 +380,19 @@ void QuartzSpaceChanged(uint32_t space_id) {
+     /* Do something special here, so we don't depend on quartz-wm for spaces to work... */
+     DEBUG_LOG("Space Changed (%u) ... do something interesting...\n", space_id);
+ }
++
++/*
++ * QuartzCopyDisplayIDs
++ *  Associate an X11 screen with one or more CoreGraphics display IDs by copying
++ *  the list into a private array. Free the previously copied array, if present.
++ */
++void QuartzCopyDisplayIDs(ScreenPtr pScreen,
++                          int displayCount, CGDirectDisplayID *displayIDs) {
++    QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
++    int size = displayCount * sizeof(CGDirectDisplayID);
++
++    free(pQuartzScreen->displayIDs);
++    pQuartzScreen->displayIDs = malloc(size);
++    memcpy(pQuartzScreen->displayIDs, displayIDs, size);
++    pQuartzScreen->displayCount = displayCount;
++}
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartz.h xorg-server-1.8.99.905/hw/xquartz/quartz.h
+index b1a3f31..1b924e7 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartz.h
++++ xorg-server-1.8.99.905/hw/xquartz/quartz.h
+@@ -62,7 +62,8 @@ typedef void (*ResumeScreenProc)(ScreenPtr pScreen);
+ /*
+  * Screen state change support
+  */
+-typedef void (*AddPseudoramiXScreensProc)(int *x, int *y, int *width, int *height);
++typedef void (*AddPseudoramiXScreensProc)
++    (int *x, int *y, int *width, int *height, ScreenPtr pScreen);
+ typedef void (*UpdateScreenProc)(ScreenPtr pScreen);
+ 
+ /*
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
+index eb761ed..d0d358b 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
++++ xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
+@@ -51,6 +51,9 @@ typedef struct {
+ #define QUARTZ_PRIV(pScreen) \
+     ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
+ 
++void QuartzCopyDisplayIDs(ScreenPtr pScreen,
++                          int displayCount, CGDirectDisplayID *displayIDs);
++
+ // User preferences used by Quartz modes
+ extern int              quartzUseSysBeep;
+ extern int              quartzFullscreenDisableHotkeys;
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+new file mode 100644
+index 0000000..6747752
+--- /dev/null
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+@@ -0,0 +1,394 @@
++/*
++ *
++ * Quartz-specific support for the XRandR extension
++ *
++ * Copyright (c) 2001-2004 Greg Parker and Torrey T. Lyons,
++ *               2010      Jan Hauffa.
++ *                 All Rights Reserved.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be included in
++ * all copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
++ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
++ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++ * DEALINGS IN THE SOFTWARE.
++ *
++ * Except as contained in this notice, the name(s) of the above copyright
++ * holders shall not be used in advertising or otherwise to promote the sale,
++ * use or other dealings in this Software without prior written authorization.
++ */
++
++#include "sanitizedCarbon.h"
++
++#ifdef HAVE_DIX_CONFIG_H
++#include <dix-config.h>
++#endif
++
++#include "quartzCommon.h"
++#include "quartzRandR.h"
++
++#if defined(FAKE_RANDR)
++#include "scrnintstr.h"
++#include "windowstr.h"
++#else
++#include <X11/extensions/randr.h>
++#include <randrstr.h>
++#include <IOKit/graphics/IOGraphicsTypes.h>
++#endif
++
++
++#if defined(FAKE_RANDR)
++
++static const int padlength[4] = {0, 3, 2, 1};
++
++void
++RREditConnectionInfo (ScreenPtr pScreen)
++{
++    xConnSetup	    *connSetup;
++    char	    *vendor;
++    xPixmapFormat   *formats;
++    xWindowRoot	    *root;
++    xDepth	    *depth;
++    xVisualType	    *visual;
++    int		    screen = 0;
++    int		    d;
++
++    connSetup = (xConnSetup *) ConnectionInfo;
++    vendor = (char *) connSetup + sizeof (xConnSetup);
++    formats = (xPixmapFormat *) ((char *) vendor +
++				 connSetup->nbytesVendor +
++				 padlength[connSetup->nbytesVendor & 3]);
++    root = (xWindowRoot *) ((char *) formats +
++			    sizeof (xPixmapFormat) * screenInfo.numPixmapFormats);
++    while (screen != pScreen->myNum)
++    {
++	depth = (xDepth *) ((char *) root + 
++			    sizeof (xWindowRoot));
++	for (d = 0; d < root->nDepths; d++)
++	{
++	    visual = (xVisualType *) ((char *) depth +
++				      sizeof (xDepth));
++	    depth = (xDepth *) ((char *) visual +
++				depth->nVisuals * sizeof (xVisualType));
++	}
++	root = (xWindowRoot *) ((char *) depth);
++	screen++;
++    }
++    root->pixWidth = pScreen->width;
++    root->pixHeight = pScreen->height;
++    root->mmWidth = pScreen->mmWidth;
++    root->mmHeight = pScreen->mmHeight;
++}
++
++#else  /* defined(FAKE_RANDR) */
++
++#define DEFAULT_REFRESH  60
++#define kDisplayModeUsableFlags  (kDisplayModeValidFlag | kDisplayModeSafeFlag)
++
++typedef struct {
++    size_t width, height;
++    int refresh;
++    const void *ref;
++} QuartzModeInfo, *QuartzModeInfoPtr;
++
++typedef Bool (*QuartzModeCallback)
++    (ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
++
++
++#if defined(USE_DEPRECATED_CG_API)
++
++static long getDictLong (CFDictionaryRef dictRef, CFStringRef key) {
++    long value;
++
++    CFNumberRef numRef = (CFNumberRef) CFDictionaryGetValue(dictRef, key);
++    if (!numRef)
++        return 0;
++
++    if (!CFNumberGetValue(numRef, kCFNumberLongType, &value))
++        return 0;
++    return value;
++}
++
++static double getDictDouble (CFDictionaryRef dictRef, CFStringRef key) {
++    double value;
++
++    CFNumberRef numRef = (CFNumberRef) CFDictionaryGetValue(dictRef, key);
++    if (!numRef)
++        return 0.0;
++
++    if (!CFNumberGetValue(numRef, kCFNumberDoubleType, &value))
++        return 0.0;
++    return value;
++}
++
++static void QuartzRandRGetModeInfo (CFDictionaryRef modeRef,
++                                    QuartzModeInfoPtr pMode) {
++    pMode->width = (size_t) getDictLong(modeRef, kCGDisplayWidth);
++    pMode->height = (size_t) getDictLong(modeRef, kCGDisplayHeight);
++    pMode->refresh = (int)(getDictDouble(modeRef, kCGDisplayRefreshRate) + 0.5);
++    if (pMode->refresh == 0)
++        pMode->refresh = DEFAULT_REFRESH;
++    pMode->ref = NULL;
++}
++
++static Bool QuartzRandRGetCurrentModeInfo (CGDirectDisplayID screenId,
++                                           QuartzModeInfoPtr pMode) {
++    CFDictionaryRef curModeRef = CGDisplayCurrentMode(screenId);
++    if (!curModeRef)
++        return FALSE;
++
++    QuartzRandRGetModeInfo(curModeRef, pMode);
++    return TRUE;
++}
++
++static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
++                                QuartzModeInfoPtr pMode) {
++    CFDictionaryRef modeRef = (CFDictionaryRef) pMode->ref;
++    return (CGDisplaySwitchToMode(screenId, modeRef) != kCGErrorSuccess);
++}
++
++static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
++                                       CGDirectDisplayID screenId,
++                                       QuartzModeCallback callback,
++                                       void *data) {
++    CFDictionaryRef curModeRef, modeRef;
++    long curBpp;
++    CFArrayRef modes;
++    QuartzModeInfo modeInfo;
++    int i;
++
++    curModeRef = CGDisplayCurrentMode(screenId);
++    if (!curModeRef)
++        return FALSE;
++    curBpp = getDictLong(curModeRef, kCGDisplayBitsPerPixel);
++
++    modes = CGDisplayAvailableModes(screenId);
++    if (!modes)
++        return FALSE;
++    for (i = 0; i < CFArrayGetCount(modes); i++) {
++        modeRef = (CFDictionaryRef) CFArrayGetValueAtIndex(modes, i);
++
++        /* Skip modes that are not usable on the current display or have a
++           different pixel encoding than the current mode. */
++        if (((unsigned long) getDictLong(modeRef, kCGDisplayIOFlags) &
++             kDisplayModeUsableFlags) != kDisplayModeUsableFlags)
++            continue;
++        if (getDictLong(modeRef, kCGDisplayBitsPerPixel) != curBpp)
++            continue;
++
++        QuartzRandRGetModeInfo(modeRef, &modeInfo);
++        modeInfo.ref = modeRef;
++        if (!callback(pScreen, screenId, &modeInfo, data))
++            break;
++    }
++    return TRUE;
++}
++
++#else  /* defined(USE_DEPRECATED_CG_API) */
++
++static void QuartzRandRGetModeInfo (CGDisplayModeRef modeRef,
++                                    QuartzModeInfoPtr pMode) {
++    pMode->width = CGDisplayModeGetWidth(modeRef);
++    pMode->height = CGDisplayModeGetHeight(modeRef);
++    pMode->refresh = (int) (CGDisplayModeGetRefreshRate(modeRef) + 0.5);
++    if (pMode->refresh == 0)
++        pMode->refresh = DEFAULT_REFRESH;
++    pMode->ref = NULL;
++}
++
++static Bool QuartzRandRGetCurrentModeInfo (CGDirectDisplayID screenId,
++                                           QuartzModeInfoPtr pMode) {
++    CGDisplayModeRef curModeRef = CGDisplayCopyDisplayMode(screenId);
++    if (!curModeRef)
++        return FALSE;
++
++    QuartzRandRGetModeInfo(curModeRef, pMode);
++    CGDisplayModeRelease(curModeRef);
++    return TRUE;
++}
++
++static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
++                                QuartzModeInfoPtr pMode) {
++    CGDisplayModeRef modeRef = (CGDisplayModeRef) pMode->ref;
++    if (!modeRef)
++        return FALSE;
++
++    return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) !=
++            kCGErrorSuccess);
++}
++
++static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
++                                       CGDirectDisplayID screenId,
++                                       QuartzModeCallback callback,
++                                       void *data) {
++    CGDisplayModeRef curModeRef, modeRef;
++    CFStringRef curPixelEnc, pixelEnc;
++    CFComparisonResult pixelEncEqual;
++    CFArrayRef modes;
++    QuartzModeInfo modeInfo;
++    int i;
++
++    curModeRef = CGDisplayCopyDisplayMode(screenId);
++    if (!curModeRef)
++        return FALSE;
++    curPixelEnc = CGDisplayModeCopyPixelEncoding(curModeRef);
++    CGDisplayModeRelease(curModeRef);
++
++    modes = CGDisplayCopyAllDisplayModes(screenId, NULL);
++    if (!modes) {
++        CFRelease(curPixelEnc);
++        return FALSE;
++    }
++    for (i = 0; i < CFArrayGetCount(modes); i++) {
++        modeRef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
++
++        /* Skip modes that are not usable on the current display or have a
++           different pixel encoding than the current mode. */
++        if ((CGDisplayModeGetIOFlags(modeRef) & kDisplayModeUsableFlags) !=
++            kDisplayModeUsableFlags)
++            continue;
++        pixelEnc = CGDisplayModeCopyPixelEncoding(modeRef);
++        pixelEncEqual = CFStringCompare(pixelEnc, curPixelEnc, 0);
++        CFRelease(pixelEnc);
++        if (pixelEncEqual != kCFCompareEqualTo)
++            continue;
++
++        QuartzRandRGetModeInfo(modeRef, &modeInfo);
++        modeInfo.ref = modeRef;
++        if (!callback(pScreen, screenId, &modeInfo, data))
++            break;
++    }
++    CFRelease(modes);
++
++    CFRelease(curPixelEnc);
++    return TRUE;
++}
++
++#endif  /* defined(USE_DEPRECATED_CG_API) */
++
++
++static Bool QuartzRandRModesEqual (QuartzModeInfoPtr pMode1,
++                                   QuartzModeInfoPtr pMode2) {
++    if (pMode1->width != pMode2->width)
++        return FALSE;
++    if (pMode1->height != pMode2->height)
++        return FALSE;
++    if (pMode1->refresh != pMode2->refresh)
++        return FALSE;
++    return TRUE;
++}
++
++static Bool QuartzRandRGetModeCallback (ScreenPtr pScreen,
++                                        CGDirectDisplayID screenId,
++                                        QuartzModeInfoPtr pMode,
++                                        void *data) {
++    QuartzModeInfoPtr pCurMode = (QuartzModeInfoPtr) data;
++
++    RRScreenSizePtr pSize = RRRegisterSize(pScreen,
++        pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
++    if (pSize) {
++        RRRegisterRate(pScreen, pSize, pMode->refresh);
++
++        if (QuartzRandRModesEqual(pMode, pCurMode))
++            RRSetCurrentConfig(pScreen, RR_Rotate_0, pMode->refresh, pSize);
++    }
++    return TRUE;
++}
++
++static Bool QuartzRandRSetModeCallback (ScreenPtr pScreen,
++                                        CGDirectDisplayID screenId,
++                                        QuartzModeInfoPtr pMode,
++                                        void *data) {
++    QuartzModeInfoPtr pReqMode = (QuartzModeInfoPtr) data;
++
++    if (!QuartzRandRModesEqual(pMode, pReqMode))
++        return TRUE;  /* continue enumeration */
++
++    return QuartzRandRSetMode(screenId, pMode);
++}
++
++static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
++    QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
++    CGDirectDisplayID screenId;
++    QuartzModeInfo curMode;
++
++    *rotations = RR_Rotate_0;  /* TODO: support rotation */
++
++    if (pQuartzScreen->displayCount == 0)
++        return FALSE;
++    if (pQuartzScreen->displayCount > 1) {
++        /* RandR operations are not well-defined for an X11 screen spanning
++           multiple CG displays. Create a single entry for the current virtual
++           resolution. */
++        RRScreenSizePtr pSize = RRRegisterSize(pScreen, pScreen->width,
++            pScreen->height, pScreen->mmWidth, pScreen->mmHeight);
++        if (pSize) {
++            RRRegisterRate(pScreen, pSize, DEFAULT_REFRESH);
++            RRSetCurrentConfig(pScreen, RR_Rotate_0, DEFAULT_REFRESH, pSize);
++        }
++        return TRUE;
++    }
++    screenId = pQuartzScreen->displayIDs[0];
++
++    if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
++        return FALSE;
++    return QuartzRandREnumerateModes(pScreen, screenId,
++        QuartzRandRGetModeCallback, &curMode);
++}
++
++static Bool QuartzRandRSetConfig (ScreenPtr           pScreen,
++			          Rotation            randr,
++			          int                 rate,
++			          RRScreenSizePtr     pSize) {
++    QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
++    CGDirectDisplayID screenId;
++    QuartzModeInfo reqMode, curMode;
++
++    if (pQuartzScreen->displayCount == 0)
++        return FALSE;
++    if (pQuartzScreen->displayCount > 1) {
++        /* RandR operations are not well-defined for an X11 screen spanning
++           multiple CG displays. Do not accept any configuations that differ
++           from the current configuration. */
++        return ((pSize->width == pScreen->width) &&
++                (pSize->height == pScreen->height));
++    }
++    screenId = pQuartzScreen->displayIDs[0];
++
++    reqMode.width = pSize->width;
++    reqMode.height = pSize->height;
++    reqMode.refresh = rate;
++
++    /* Do not switch modes if requested mode is equal to current mode. */
++    if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
++        return FALSE;
++    if (QuartzRandRModesEqual(&reqMode, &curMode))
++        return TRUE;
++
++    return QuartzRandREnumerateModes(pScreen, screenId,
++        QuartzRandRSetModeCallback, &reqMode);
++}
++
++Bool QuartzRandRInit (ScreenPtr pScreen) {
++    rrScrPrivPtr    pScrPriv;
++    
++    if (!RRScreenInit (pScreen)) return FALSE;
++
++    pScrPriv = rrGetScrPriv(pScreen);
++    pScrPriv->rrGetInfo = QuartzRandRGetInfo;
++    pScrPriv->rrSetConfig = QuartzRandRSetConfig;
++    return TRUE;
++}
++
++#endif  /* defined(FAKE_RANDR) */
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+new file mode 100644
+index 0000000..a190205
+--- /dev/null
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+@@ -0,0 +1,37 @@
++/*
++ * quartzRandR.h
++ *
++ * Copyright (c) 2010 Jan Hauffa.
++ *                 All Rights Reserved.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be included in
++ * all copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
++ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
++ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++ * DEALINGS IN THE SOFTWARE.
++ *
++ * Except as contained in this notice, the name(s) of the above copyright
++ * holders shall not be used in advertising or otherwise to promote the sale,
++ * use or other dealings in this Software without prior written authorization.
++ */
++
++/*define FAKE_RANDR 1*/
++#define USE_DEPRECATED_CG_API 1
++
++#if defined(FAKE_RANDR)
++void RREditConnectionInfo (ScreenPtr pScreen);
++#else
++Bool QuartzRandRInit (ScreenPtr pScreen);
++#endif
+diff --git xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c
+index 87e97d4..0e36ee1 100644
+--- xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c
++++ xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c
+@@ -176,7 +176,7 @@ displayScreenBounds(CGDirectDisplayID id)
+  *  with PseudoramiX.
+  */
+ static void
+-xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
++xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, ScreenPtr pScreen)
+ {
+     CGDisplayCount i, displayCount;
+     CGDirectDisplayID *displayList = NULL;
+@@ -199,6 +199,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
+     if(!displayList)
+         FatalError("Unable to allocate memory for list of displays.\n");
+     CGGetActiveDisplayList(displayCount, displayList, &displayCount);
++    QuartzCopyDisplayIDs(pScreen, displayCount, displayList);
+ 
+     /* Get the union of all screens */
+     for (i = 0; i < displayCount; i++) {
+@@ -336,6 +337,7 @@ xprAddScreen(int index, ScreenPtr pScreen)
+         ErrorF("Warning: noPseudoramiXExtension!\n");
+         
+         dpy = displayAtIndex(index);
++        QuartzCopyDisplayIDs(pScreen, 1, &dpy);
+ 
+         frame = displayScreenBounds(dpy);
+ 
+@@ -346,7 +348,7 @@ xprAddScreen(int index, ScreenPtr pScreen)
+     }
+     else
+     {
+-        xprAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height);
++        xprAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height, pScreen);
+     }
+ 
+     /* Passing zero width (pitch) makes miCreateScreenResources set the
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0014-XQuartz-RandR-Toggle-rootless-mode-on-XRandR-mode.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0014-XQuartz-RandR-Toggle-rootless-mode-on-XRandR-mode.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0014-XQuartz-RandR-Toggle-rootless-mode-on-XRandR-mode.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,209 @@
+From 3fddb177b1238ac1ba0af0d1ceb589e2e7df5b4f Mon Sep 17 00:00:00 2001
+From: Jan Hauffa <hauffa at in.tum.de>
+Date: Fri, 16 Jul 2010 17:54:55 +0200
+Subject: [PATCH] XQuartz: RandR: Toggle rootless mode on XRandR mode switch.
+
+Report a fake screen mode that corresponds to the screen mode at startup of the
+server excluding the height of the menu bar. If a client requests this mode,
+rootless mode is enabled. In all other modes, the root window is shown.
+
+Signed-off-by: Jan Hauffa <hauffa at in.tum.de>
+Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/quartzCommon.h |    7 +++
+ hw/xquartz/quartzRandR.c  |   93 +++++++++++++++++++++++++++++++-------------
+ 2 files changed, 72 insertions(+), 28 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
+index d0d358b..851e74c 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
++++ xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
+@@ -38,6 +38,12 @@
+ #include <X11/Xdefs.h>
+ #include "privates.h"
+ 
++typedef struct {
++    size_t width, height;
++    int refresh;
++    const void *ref;
++} QuartzModeInfo, *QuartzModeInfoPtr;
++
+ // Quartz specific per screen storage structure
+ typedef struct {
+     // List of CoreGraphics displays that this X11 screen covers.
+@@ -46,6 +52,7 @@ typedef struct {
+     // No CG display will be covered by more than one X11 screen.
+     int displayCount;
+     CGDirectDisplayID *displayIDs;
++    QuartzModeInfo originalMode, fakeMode;
+ } QuartzScreenRec, *QuartzScreenPtr;
+ 
+ #define QUARTZ_PRIV(pScreen) \
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+index 6747752..f61ff93 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+@@ -37,6 +37,7 @@
+ 
+ #include "quartzCommon.h"
+ #include "quartzRandR.h"
++#include "quartz.h"
+ 
+ #if defined(FAKE_RANDR)
+ #include "scrnintstr.h"
+@@ -96,12 +97,6 @@ RREditConnectionInfo (ScreenPtr pScreen)
+ #define DEFAULT_REFRESH  60
+ #define kDisplayModeUsableFlags  (kDisplayModeValidFlag | kDisplayModeSafeFlag)
+ 
+-typedef struct {
+-    size_t width, height;
+-    int refresh;
+-    const void *ref;
+-} QuartzModeInfo, *QuartzModeInfoPtr;
+-
+ typedef Bool (*QuartzModeCallback)
+     (ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
+ 
+@@ -289,21 +284,30 @@ static Bool QuartzRandRModesEqual (QuartzModeInfoPtr pMode1,
+     return TRUE;
+ }
+ 
+-static Bool QuartzRandRGetModeCallback (ScreenPtr pScreen,
+-                                        CGDirectDisplayID screenId,
+-                                        QuartzModeInfoPtr pMode,
+-                                        void *data) {
+-    QuartzModeInfoPtr pCurMode = (QuartzModeInfoPtr) data;
+-
++static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
++                                     QuartzModeInfoPtr pMode,
++                                     Bool isCurrentMode) {
+     RRScreenSizePtr pSize = RRRegisterSize(pScreen,
+         pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
+     if (pSize) {
+         RRRegisterRate(pScreen, pSize, pMode->refresh);
+ 
+-        if (QuartzRandRModesEqual(pMode, pCurMode))
++        if (isCurrentMode)
+             RRSetCurrentConfig(pScreen, RR_Rotate_0, pMode->refresh, pSize);
++
++        return TRUE;
+     }
+-    return TRUE;
++    return FALSE;
++}
++
++static Bool QuartzRandRGetModeCallback (ScreenPtr pScreen,
++                                        CGDirectDisplayID screenId,
++                                        QuartzModeInfoPtr pMode,
++                                        void *data) {
++    QuartzModeInfoPtr pCurMode = (QuartzModeInfoPtr) data;
++
++    return QuartzRandRRegisterMode(pScreen, pMode,
++        QuartzRandRModesEqual(pMode, pCurMode));
+ }
+ 
+ static Bool QuartzRandRSetModeCallback (ScreenPtr pScreen,
+@@ -329,20 +333,29 @@ static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
+         return FALSE;
+     if (pQuartzScreen->displayCount > 1) {
+         /* RandR operations are not well-defined for an X11 screen spanning
+-           multiple CG displays. Create a single entry for the current virtual
+-           resolution. */
+-        RRScreenSizePtr pSize = RRRegisterSize(pScreen, pScreen->width,
+-            pScreen->height, pScreen->mmWidth, pScreen->mmHeight);
+-        if (pSize) {
+-            RRRegisterRate(pScreen, pSize, DEFAULT_REFRESH);
+-            RRSetCurrentConfig(pScreen, RR_Rotate_0, DEFAULT_REFRESH, pSize);
+-        }
++           multiple CG displays. Create two entries for the current virtual
++           resolution including/excluding the menu bar. */
++        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode,
++            !quartzHasRoot);
++        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->originalMode,
++            quartzHasRoot);
+         return TRUE;
+     }
+     screenId = pQuartzScreen->displayIDs[0];
+ 
+     if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
+         return FALSE;
++
++    /* Add a fake mode corresponding to the original resolution excluding the
++       height of the menu bar. */
++    if (!quartzHasRoot &&
++        QuartzRandRModesEqual(&pQuartzScreen->originalMode, &curMode)) {
++        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode, TRUE);
++        curMode = pQuartzScreen->fakeMode;
++    }
++    else
++        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode, FALSE);
++
+     return QuartzRandREnumerateModes(pScreen, screenId,
+         QuartzRandRGetModeCallback, &curMode);
+ }
+@@ -354,6 +367,21 @@ static Bool QuartzRandRSetConfig (ScreenPtr           pScreen,
+     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+     CGDirectDisplayID screenId;
+     QuartzModeInfo reqMode, curMode;
++    Bool rootless = FALSE;
++
++    reqMode.width = pSize->width;
++    reqMode.height = pSize->height;
++    reqMode.refresh = rate;
++
++    /* If the client requested the fake screen mode, switch to rootless mode.
++       Switch to fullscreen mode (root window visible) if a real screen mode was
++       requested. */
++    if (QuartzRandRModesEqual(&reqMode, &pQuartzScreen->fakeMode)) {
++        rootless = TRUE;
++        reqMode = pQuartzScreen->originalMode;
++    }
++    QuartzSetFullscreen(!rootless);
++    QuartzSetRootless(rootless);
+ 
+     if (pQuartzScreen->displayCount == 0)
+         return FALSE;
+@@ -361,15 +389,10 @@ static Bool QuartzRandRSetConfig (ScreenPtr           pScreen,
+         /* RandR operations are not well-defined for an X11 screen spanning
+            multiple CG displays. Do not accept any configuations that differ
+            from the current configuration. */
+-        return ((pSize->width == pScreen->width) &&
+-                (pSize->height == pScreen->height));
++        return QuartzRandRModesEqual(&reqMode, &pQuartzScreen->originalMode);
+     }
+     screenId = pQuartzScreen->displayIDs[0];
+ 
+-    reqMode.width = pSize->width;
+-    reqMode.height = pSize->height;
+-    reqMode.refresh = rate;
+-
+     /* Do not switch modes if requested mode is equal to current mode. */
+     if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
+         return FALSE;
+@@ -382,9 +405,23 @@ static Bool QuartzRandRSetConfig (ScreenPtr           pScreen,
+ 
+ Bool QuartzRandRInit (ScreenPtr pScreen) {
+     rrScrPrivPtr    pScrPriv;
++    QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+     
+     if (!RRScreenInit (pScreen)) return FALSE;
+ 
++    if (pQuartzScreen->displayCount == 1) {
++        if (!QuartzRandRGetCurrentModeInfo(pQuartzScreen->displayIDs[0],
++                                           &pQuartzScreen->originalMode))
++            return FALSE;
++    }
++    else {
++        pQuartzScreen->originalMode.width = pScreen->width;
++        pQuartzScreen->originalMode.height = pScreen->height;
++        pQuartzScreen->originalMode.refresh = DEFAULT_REFRESH;
++    }
++    pQuartzScreen->fakeMode = pQuartzScreen->originalMode;
++    pQuartzScreen->fakeMode.height -= aquaMenuBarHeight;
++
+     pScrPriv = rrGetScrPriv(pScreen);
+     pScrPriv->rrGetInfo = QuartzRandRGetInfo;
+     pScrPriv->rrSetConfig = QuartzRandRSetConfig;
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0015-XQuartz-RandR-Remove-FAKE_RANDR-code.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0015-XQuartz-RandR-Remove-FAKE_RANDR-code.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0015-XQuartz-RandR-Remove-FAKE_RANDR-code.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,127 @@
+From e3e4f48c231b5fab37146f05b59daa9675db8e90 Mon Sep 17 00:00:00 2001
+From: Jan Hauffa <hauffa at in.tum.de>
+Date: Fri, 16 Jul 2010 17:56:44 +0200
+Subject: [PATCH] XQuartz: RandR: Remove FAKE_RANDR code.
+
+Signed-off-by: Jan Hauffa <hauffa at in.tum.de>
+Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/quartz.c      |    6 +----
+ hw/xquartz/quartzRandR.c |   52 ----------------------------------------------
+ hw/xquartz/quartzRandR.h |    5 ----
+ 3 files changed, 1 insertions(+), 62 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartz.c xorg-server-1.8.99.905/hw/xquartz/quartz.c
+index a4d7474..a52cac9 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartz.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartz.c
+@@ -119,7 +119,7 @@ Bool QuartzSetupScreen(
+     if (! quartzProcs->InitCursor(pScreen))
+         return FALSE;
+ 
+-#if defined(RANDR) && !defined(FAKE_RANDR)
++#if defined(RANDR)
+     if(!QuartzRandRInit(pScreen)) {
+         DEBUG_LOG("Failed to init RandR extension.\n");
+         return FALSE;
+@@ -239,10 +239,6 @@ void QuartzUpdateScreens(void) {
+     DeliverEvents(pRoot, &e, 1, NullWindow);
+ 
+     quartzProcs->UpdateScreen(pScreen);
+-    
+-#ifdef FAKE_RANDR
+-    RREditConnectionInfo(pScreen);
+-#endif    
+ }
+ 
+ void QuartzSetFullscreen(Bool state) {
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+index f61ff93..b3b315c 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+@@ -39,60 +39,10 @@
+ #include "quartzRandR.h"
+ #include "quartz.h"
+ 
+-#if defined(FAKE_RANDR)
+-#include "scrnintstr.h"
+-#include "windowstr.h"
+-#else
+ #include <X11/extensions/randr.h>
+ #include <randrstr.h>
+ #include <IOKit/graphics/IOGraphicsTypes.h>
+-#endif
+-
+-
+-#if defined(FAKE_RANDR)
+-
+-static const int padlength[4] = {0, 3, 2, 1};
+-
+-void
+-RREditConnectionInfo (ScreenPtr pScreen)
+-{
+-    xConnSetup	    *connSetup;
+-    char	    *vendor;
+-    xPixmapFormat   *formats;
+-    xWindowRoot	    *root;
+-    xDepth	    *depth;
+-    xVisualType	    *visual;
+-    int		    screen = 0;
+-    int		    d;
+-
+-    connSetup = (xConnSetup *) ConnectionInfo;
+-    vendor = (char *) connSetup + sizeof (xConnSetup);
+-    formats = (xPixmapFormat *) ((char *) vendor +
+-				 connSetup->nbytesVendor +
+-				 padlength[connSetup->nbytesVendor & 3]);
+-    root = (xWindowRoot *) ((char *) formats +
+-			    sizeof (xPixmapFormat) * screenInfo.numPixmapFormats);
+-    while (screen != pScreen->myNum)
+-    {
+-	depth = (xDepth *) ((char *) root + 
+-			    sizeof (xWindowRoot));
+-	for (d = 0; d < root->nDepths; d++)
+-	{
+-	    visual = (xVisualType *) ((char *) depth +
+-				      sizeof (xDepth));
+-	    depth = (xDepth *) ((char *) visual +
+-				depth->nVisuals * sizeof (xVisualType));
+-	}
+-	root = (xWindowRoot *) ((char *) depth);
+-	screen++;
+-    }
+-    root->pixWidth = pScreen->width;
+-    root->pixHeight = pScreen->height;
+-    root->mmWidth = pScreen->mmWidth;
+-    root->mmHeight = pScreen->mmHeight;
+-}
+ 
+-#else  /* defined(FAKE_RANDR) */
+ 
+ #define DEFAULT_REFRESH  60
+ #define kDisplayModeUsableFlags  (kDisplayModeValidFlag | kDisplayModeSafeFlag)
+@@ -427,5 +377,3 @@ Bool QuartzRandRInit (ScreenPtr pScreen) {
+     pScrPriv->rrSetConfig = QuartzRandRSetConfig;
+     return TRUE;
+ }
+-
+-#endif  /* defined(FAKE_RANDR) */
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+index a190205..711c3f3 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+@@ -27,11 +27,6 @@
+  * use or other dealings in this Software without prior written authorization.
+  */
+ 
+-/*define FAKE_RANDR 1*/
+ #define USE_DEPRECATED_CG_API 1
+ 
+-#if defined(FAKE_RANDR)
+-void RREditConnectionInfo (ScreenPtr pScreen);
+-#else
+ Bool QuartzRandRInit (ScreenPtr pScreen);
+-#endif
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0016-XQuartz-RandR-use-deprecated-CG-APIs-only-on-Leopa.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0016-XQuartz-RandR-use-deprecated-CG-APIs-only-on-Leopa.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0016-XQuartz-RandR-use-deprecated-CG-APIs-only-on-Leopa.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,88 @@
+From 7ced60fcd8ae041bab948239b8f7cbcc8056fe92 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Sun, 25 Jul 2010 22:25:49 -0700
+Subject: [PATCH] XQuartz: RandR: use deprecated CG APIs only on Leopard and earlier
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/quartzRandR.c |   10 ++++++----
+ hw/xquartz/quartzRandR.h |    6 +++++-
+ 2 files changed, 11 insertions(+), 5 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+index b3b315c..e46e904 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+@@ -1,9 +1,9 @@
+ /*
+- *
+  * Quartz-specific support for the XRandR extension
+  *
+  * Copyright (c) 2001-2004 Greg Parker and Torrey T. Lyons,
+  *               2010      Jan Hauffa.
++ *               2010      Apple Inc.
+  *                 All Rights Reserved.
+  *
+  * Permission is hereby granted, free of charge, to any person obtaining a
+@@ -39,6 +39,8 @@
+ #include "quartzRandR.h"
+ #include "quartz.h"
+ 
++#include <AvailabilityMacros.h>
++
+ #include <X11/extensions/randr.h>
+ #include <randrstr.h>
+ #include <IOKit/graphics/IOGraphicsTypes.h>
+@@ -51,7 +53,7 @@ typedef Bool (*QuartzModeCallback)
+     (ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
+ 
+ 
+-#if defined(USE_DEPRECATED_CG_API)
++#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+ 
+ static long getDictLong (CFDictionaryRef dictRef, CFStringRef key) {
+     long value;
+@@ -140,7 +142,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+     return TRUE;
+ }
+ 
+-#else  /* defined(USE_DEPRECATED_CG_API) */
++#else /* we have the new CG APIs from Snow Leopard */
+ 
+ static void QuartzRandRGetModeInfo (CGDisplayModeRef modeRef,
+                                     QuartzModeInfoPtr pMode) {
+@@ -220,7 +222,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+     return TRUE;
+ }
+ 
+-#endif  /* defined(USE_DEPRECATED_CG_API) */
++#endif  /* Snow Leopard CoreGraphics APIs */
+ 
+ 
+ static Bool QuartzRandRModesEqual (QuartzModeInfoPtr pMode1,
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+index 711c3f3..d57dc3b 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+@@ -2,6 +2,7 @@
+  * quartzRandR.h
+  *
+  * Copyright (c) 2010 Jan Hauffa.
++ *               2010 Apple Inc.
+  *                 All Rights Reserved.
+  *
+  * Permission is hereby granted, free of charge, to any person obtaining a
+@@ -27,6 +28,9 @@
+  * use or other dealings in this Software without prior written authorization.
+  */
+ 
+-#define USE_DEPRECATED_CG_API 1
++#ifndef _QUARTZRANDR_H_
++#define _QUARTZRANDR_H_
+ 
+ Bool QuartzRandRInit (ScreenPtr pScreen);
++
++#endif
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0017-XQuartz-Ignore-kXquartzToggleFullscreen-when-rootle.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0017-XQuartz-Ignore-kXquartzToggleFullscreen-when-rootle.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0017-XQuartz-Ignore-kXquartzToggleFullscreen-when-rootle.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,28 @@
+From 247debfb2118f1fb61bea2bfe7df780f5bc5da9a Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Sun, 25 Jul 2010 22:29:11 -0700
+Subject: [PATCH] XQuartz: Ignore kXquartzToggleFullscreen when rootless
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/darwinEvents.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c
+index 147b32a..7b34b8a 100644
+--- xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c
++++ xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c
+@@ -238,8 +238,8 @@ static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr de
+             
+         case kXquartzToggleFullscreen:
+             DEBUG_LOG("kXquartzToggleFullscreen\n");
+-            if (quartzEnableRootless) 
+-                QuartzSetFullscreen(!quartzHasRoot);
++            if(quartzEnableRootless) 
++                ErrorF("Ignoring kXquartzToggleFullscreen because of rootless mode.");
+             else if (quartzHasRoot)
+                 QuartzHide();
+             else
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0018-XQuartz-RandR-Respond-better-to-resolution-changes.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0018-XQuartz-RandR-Respond-better-to-resolution-changes.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0018-XQuartz-RandR-Respond-better-to-resolution-changes.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,401 @@
+From 912d2e2cd9ea0aa0b687c25a0f552c3841f1d554 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Mon, 26 Jul 2010 01:17:12 -0700
+Subject: [PATCH] XQuartz: RandR: Respond better to resolution changes made outside X
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/darwinEvents.c  |    6 ++
+ hw/xquartz/quartzCommon.h  |   23 ------
+ hw/xquartz/quartzRandR.c   |  174 ++++++++++++++++++++++++++------------------
+ hw/xquartz/quartzRandR.h   |   24 ++++++
+ hw/xquartz/xpr/xprScreen.c |    1 +
+ 5 files changed, 135 insertions(+), 93 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c
+index 7b34b8a..7367068 100644
+--- xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c
++++ xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c
+@@ -52,6 +52,7 @@ in this Software without prior written authorization from The Open Group.
+ #include "darwin.h"
+ #include "quartz.h"
+ #include "quartzKeyboard.h"
++#include "quartzRandR.h"
+ #include "darwinEvents.h"
+ 
+ #include <sys/types.h>
+@@ -276,7 +277,12 @@ static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr de
+             break;
+             
+         case kXquartzDisplayChanged:
++            DEBUG_LOG("kXquartzDisplayChanged\n");
+             QuartzUpdateScreens();
++#ifdef RANDR
++            /* Update our RandR info */
++            QuartzRandRUpdateFakeModes(TRUE);
++#endif
+             break;
+             
+         default:
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
+index 851e74c..718df4b 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
++++ xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
+@@ -38,29 +38,6 @@
+ #include <X11/Xdefs.h>
+ #include "privates.h"
+ 
+-typedef struct {
+-    size_t width, height;
+-    int refresh;
+-    const void *ref;
+-} QuartzModeInfo, *QuartzModeInfoPtr;
+-
+-// Quartz specific per screen storage structure
+-typedef struct {
+-    // List of CoreGraphics displays that this X11 screen covers.
+-    // This is more than one CG display for video mirroring and
+-    // rootless PseudoramiX mode.
+-    // No CG display will be covered by more than one X11 screen.
+-    int displayCount;
+-    CGDirectDisplayID *displayIDs;
+-    QuartzModeInfo originalMode, fakeMode;
+-} QuartzScreenRec, *QuartzScreenPtr;
+-
+-#define QUARTZ_PRIV(pScreen) \
+-    ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
+-
+-void QuartzCopyDisplayIDs(ScreenPtr pScreen,
+-                          int displayCount, CGDirectDisplayID *displayIDs);
+-
+ // User preferences used by Quartz modes
+ extern int              quartzUseSysBeep;
+ extern int              quartzFullscreenDisableHotkeys;
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+index e46e904..65dce22 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+@@ -38,6 +38,7 @@
+ #include "quartzCommon.h"
+ #include "quartzRandR.h"
+ #include "quartz.h"
++#include "darwin.h"
+ 
+ #include <AvailabilityMacros.h>
+ 
+@@ -45,6 +46,13 @@
+ #include <randrstr.h>
+ #include <IOKit/graphics/IOGraphicsTypes.h>
+ 
++/* TODO: UGLY, find a better way!
++ * We want to ignore kXquartzDisplayChanged which are generated by us
++ */
++static Bool ignore_next_fake_mode_update = FALSE;
++
++#define FAKE_REFRESH_ROOTLESS 1
++#define FAKE_REFRESH_FULLSCREEN 2
+ 
+ #define DEFAULT_REFRESH  60
+ #define kDisplayModeUsableFlags  (kDisplayModeValidFlag | kDisplayModeSafeFlag)
+@@ -171,8 +179,7 @@ static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
+     if (!modeRef)
+         return FALSE;
+ 
+-    return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) !=
+-            kCGErrorSuccess);
++    return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) != kCGErrorSuccess);
+ }
+ 
+ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+@@ -227,18 +234,15 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+ 
+ static Bool QuartzRandRModesEqual (QuartzModeInfoPtr pMode1,
+                                    QuartzModeInfoPtr pMode2) {
+-    if (pMode1->width != pMode2->width)
+-        return FALSE;
+-    if (pMode1->height != pMode2->height)
+-        return FALSE;
+-    if (pMode1->refresh != pMode2->refresh)
+-        return FALSE;
+-    return TRUE;
++    return (pMode1->width == pMode2->width) &&
++           (pMode1->height == pMode2->height) &&
++           (pMode1->refresh == pMode2->refresh);
+ }
+ 
+ static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
+-                                     QuartzModeInfoPtr pMode,
+-                                     Bool isCurrentMode) {
++                                     QuartzModeInfoPtr pMode) {
++    QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
++    Bool isCurrentMode = QuartzRandRModesEqual(&pQuartzScreen->currentMode, pMode);
+     RRScreenSizePtr pSize = RRRegisterSize(pScreen,
+         pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
+     if (pSize) {
+@@ -252,14 +256,11 @@ static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
+     return FALSE;
+ }
+ 
+-static Bool QuartzRandRGetModeCallback (ScreenPtr pScreen,
++static Bool QuartzRandRRegisterModeCallback (ScreenPtr pScreen,
+                                         CGDirectDisplayID screenId,
+                                         QuartzModeInfoPtr pMode,
+-                                        void *data) {
+-    QuartzModeInfoPtr pCurMode = (QuartzModeInfoPtr) data;
+-
+-    return QuartzRandRRegisterMode(pScreen, pMode,
+-        QuartzRandRModesEqual(pMode, pCurMode));
++                                        void *data __unused) {
++    return QuartzRandRRegisterMode(pScreen, pMode);
+ }
+ 
+ static Bool QuartzRandRSetModeCallback (ScreenPtr pScreen,
+@@ -267,73 +268,64 @@ static Bool QuartzRandRSetModeCallback (ScreenPtr pScreen,
+                                         QuartzModeInfoPtr pMode,
+                                         void *data) {
+     QuartzModeInfoPtr pReqMode = (QuartzModeInfoPtr) data;
++    QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+ 
+     if (!QuartzRandRModesEqual(pMode, pReqMode))
+         return TRUE;  /* continue enumeration */
+ 
+-    return QuartzRandRSetMode(screenId, pMode);
++    if (pReqMode->ref == pQuartzScreen->currentMode.ref) {
++        DEBUG_LOG("Requested RandR resolution matches current CG mode\n");
++        return FALSE; /* We don't need to do anything in CG */
++    }
++
++    if (QuartzRandRSetMode(screenId, pMode) == FALSE) {
++        ignore_next_fake_mode_update = TRUE;
++        return FALSE;
++    } else {
++        return TRUE;
++    };
+ }
+ 
+ static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
+     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+     CGDirectDisplayID screenId;
+-    QuartzModeInfo curMode;
+ 
+     *rotations = RR_Rotate_0;  /* TODO: support rotation */
+ 
+     if (pQuartzScreen->displayCount == 0)
+         return FALSE;
++
++    QuartzRandRRegisterMode(pScreen, &pQuartzScreen->rootlessMode);
++    QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullScreenMode);
++
+     if (pQuartzScreen->displayCount > 1) {
+         /* RandR operations are not well-defined for an X11 screen spanning
+            multiple CG displays. Create two entries for the current virtual
+            resolution including/excluding the menu bar. */
+-        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode,
+-            !quartzHasRoot);
+-        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->originalMode,
+-            quartzHasRoot);
+         return TRUE;
+     }
+     screenId = pQuartzScreen->displayIDs[0];
+ 
+-    if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
+-        return FALSE;
+-
+-    /* Add a fake mode corresponding to the original resolution excluding the
+-       height of the menu bar. */
+-    if (!quartzHasRoot &&
+-        QuartzRandRModesEqual(&pQuartzScreen->originalMode, &curMode)) {
+-        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode, TRUE);
+-        curMode = pQuartzScreen->fakeMode;
+-    }
+-    else
+-        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fakeMode, FALSE);
+-
+-    return QuartzRandREnumerateModes(pScreen, screenId,
+-        QuartzRandRGetModeCallback, &curMode);
++    return QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRRegisterModeCallback, NULL);
+ }
+ 
+ static Bool QuartzRandRSetConfig (ScreenPtr           pScreen,
+-			          Rotation            randr,
+-			          int                 rate,
+-			          RRScreenSizePtr     pSize) {
++                                  Rotation            randr,
++                                  int                 rate,
++                                  RRScreenSizePtr     pSize) {
+     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+     CGDirectDisplayID screenId;
+-    QuartzModeInfo reqMode, curMode;
+-    Bool rootless = FALSE;
++    QuartzModeInfo reqMode;
+ 
+     reqMode.width = pSize->width;
+     reqMode.height = pSize->height;
+     reqMode.refresh = rate;
+ 
+-    /* If the client requested the fake screen mode, switch to rootless mode.
+-       Switch to fullscreen mode (root window visible) if a real screen mode was
+-       requested. */
+-    if (QuartzRandRModesEqual(&reqMode, &pQuartzScreen->fakeMode)) {
+-        rootless = TRUE;
+-        reqMode = pQuartzScreen->originalMode;
+-    }
+-    QuartzSetFullscreen(!rootless);
+-    QuartzSetRootless(rootless);
++    /* If the client requested the fake rootless mode, switch to rootless.
++     * Otherwise, force fullscreen mode.
++     */
++    QuartzSetFullscreen(reqMode.refresh != FAKE_REFRESH_ROOTLESS);
++    QuartzSetRootless(reqMode.refresh == FAKE_REFRESH_ROOTLESS);
+ 
+     if (pQuartzScreen->displayCount == 0)
+         return FALSE;
+@@ -341,38 +333,80 @@ static Bool QuartzRandRSetConfig (ScreenPtr           pScreen,
+         /* RandR operations are not well-defined for an X11 screen spanning
+            multiple CG displays. Do not accept any configuations that differ
+            from the current configuration. */
+-        return QuartzRandRModesEqual(&reqMode, &pQuartzScreen->originalMode);
++        return TRUE;
+     }
+-    screenId = pQuartzScreen->displayIDs[0];
+ 
+     /* Do not switch modes if requested mode is equal to current mode. */
+-    if (!QuartzRandRGetCurrentModeInfo(screenId, &curMode))
+-        return FALSE;
+-    if (QuartzRandRModesEqual(&reqMode, &curMode))
++    if (QuartzRandRModesEqual(&reqMode, &pQuartzScreen->currentMode))
+         return TRUE;
++        
++    screenId = pQuartzScreen->displayIDs[0];
++    if (QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRSetModeCallback, &reqMode)) {
++        pQuartzScreen->currentMode = reqMode;
++        return TRUE;
++    }
++    
++    DEBUG_LOG("Unable to find a matching config: %d x %d @ %d\n", (int)reqMode.width, (int)reqMode.height, (int)reqMode.refresh);
+ 
+-    return QuartzRandREnumerateModes(pScreen, screenId,
+-        QuartzRandRSetModeCallback, &reqMode);
++    return FALSE;
+ }
+ 
+-Bool QuartzRandRInit (ScreenPtr pScreen) {
+-    rrScrPrivPtr    pScrPriv;
++static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
+     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+-    
+-    if (!RRScreenInit (pScreen)) return FALSE;
+ 
+     if (pQuartzScreen->displayCount == 1) {
+         if (!QuartzRandRGetCurrentModeInfo(pQuartzScreen->displayIDs[0],
+-                                           &pQuartzScreen->originalMode))
++                                           &pQuartzScreen->fullScreenMode))
+             return FALSE;
++    } else {
++        pQuartzScreen->fullScreenMode.width = pScreen->width;
++        pQuartzScreen->fullScreenMode.height = pScreen->height;
++        if(quartzEnableRootless)
++            pQuartzScreen->fullScreenMode.height += aquaMenuBarHeight;
+     }
+-    else {
+-        pQuartzScreen->originalMode.width = pScreen->width;
+-        pQuartzScreen->originalMode.height = pScreen->height;
+-        pQuartzScreen->originalMode.refresh = DEFAULT_REFRESH;
++
++    pQuartzScreen->fullScreenMode.refresh = FAKE_REFRESH_FULLSCREEN;
++
++    pQuartzScreen->rootlessMode = pQuartzScreen->fullScreenMode;
++    pQuartzScreen->rootlessMode.refresh = FAKE_REFRESH_ROOTLESS;
++    pQuartzScreen->rootlessMode.height -= aquaMenuBarHeight;
++
++    if(quartzEnableRootless) {
++        pQuartzScreen->currentMode = pQuartzScreen->rootlessMode;
++    } else {
++        pQuartzScreen->currentMode = pQuartzScreen->fullScreenMode;
+     }
+-    pQuartzScreen->fakeMode = pQuartzScreen->originalMode;
+-    pQuartzScreen->fakeMode.height -= aquaMenuBarHeight;
++    
++    DEBUG_LOG("rootlessMode: %d x %d\n", (int)pQuartzScreen->rootlessMode.width, (int)pQuartzScreen->rootlessMode.height);
++    DEBUG_LOG("fullScreenMode: %d x %d\n", (int)pQuartzScreen->fullScreenMode.width, (int)pQuartzScreen->fullScreenMode.height);
++    DEBUG_LOG("currentMode: %d x %d\n", (int)pQuartzScreen->currentMode.width, (int)pQuartzScreen->currentMode.height);
++    
++    return TRUE;
++}
++
++Bool QuartzRandRUpdateFakeModes (BOOL force_update) {
++    ScreenPtr pScreen = screenInfo.screens[0];
++    
++    if(ignore_next_fake_mode_update) {
++        DEBUG_LOG("Ignoring update request caused by RandR resolution change.\n");
++        ignore_next_fake_mode_update = FALSE;
++        return TRUE;
++    }
++    
++    if(!_QuartzRandRUpdateFakeModes(pScreen))
++        return FALSE;
++    
++    if(force_update)
++        RRGetInfo(pScreen, TRUE);
++
++    return TRUE;
++}
++
++Bool QuartzRandRInit (ScreenPtr pScreen) {
++    rrScrPrivPtr    pScrPriv;
++    
++    if (!RRScreenInit (pScreen)) return FALSE;
++    if (!_QuartzRandRUpdateFakeModes (pScreen)) return FALSE;
+ 
+     pScrPriv = rrGetScrPriv(pScreen);
+     pScrPriv->rrGetInfo = QuartzRandRGetInfo;
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+index d57dc3b..8ee2818 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+@@ -31,6 +31,30 @@
+ #ifndef _QUARTZRANDR_H_
+ #define _QUARTZRANDR_H_
+ 
++typedef struct {
++    size_t width, height;
++    int refresh;
++    const void *ref;
++} QuartzModeInfo, *QuartzModeInfoPtr;
++
++// Quartz specific per screen storage structure
++typedef struct {
++    // List of CoreGraphics displays that this X11 screen covers.
++    // This is more than one CG display for video mirroring and
++    // rootless PseudoramiX mode.
++    // No CG display will be covered by more than one X11 screen.
++    int displayCount;
++    CGDirectDisplayID *displayIDs;
++    QuartzModeInfo rootlessMode, fullScreenMode, currentMode;
++} QuartzScreenRec, *QuartzScreenPtr;
++
++#define QUARTZ_PRIV(pScreen) \
++    ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
++
++void QuartzCopyDisplayIDs(ScreenPtr pScreen,
++                          int displayCount, CGDirectDisplayID *displayIDs);
++
++Bool QuartzRandRUpdateFakeModes (BOOL force_update);
+ Bool QuartzRandRInit (ScreenPtr pScreen);
+ 
+ #endif
+diff --git xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c
+index 0e36ee1..b3ac693 100644
+--- xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c
++++ xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c
+@@ -36,6 +36,7 @@
+ #include "quartzCommon.h"
+ #include "inputstr.h"
+ #include "quartz.h"
++#include "quartzRandR.h"
+ #include "xpr.h"
+ #include "xprEvent.h"
+ #include "pseudoramiX.h"
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0019-XQuartz-RandR-Better-handle-switching-betwen-RandR.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0019-XQuartz-RandR-Better-handle-switching-betwen-RandR.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0019-XQuartz-RandR-Better-handle-switching-betwen-RandR.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,352 @@
+From 73954993d4d173b3d515e517c6bad13fe83a801c Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Mon, 26 Jul 2010 11:45:59 -0700
+Subject: [PATCH] XQuartz: RandR: Better handle switching betwen RandR modes that share CG modes
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/quartzRandR.c |  156 +++++++++++++++++++++++++++++++++++----------
+ hw/xquartz/quartzRandR.h |    2 +-
+ 2 files changed, 122 insertions(+), 36 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+index 65dce22..9b84fa1 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+@@ -57,9 +57,12 @@ static Bool ignore_next_fake_mode_update = FALSE;
+ #define DEFAULT_REFRESH  60
+ #define kDisplayModeUsableFlags  (kDisplayModeValidFlag | kDisplayModeSafeFlag)
+ 
+-typedef Bool (*QuartzModeCallback)
+-    (ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
++#define CALLBACK_SUCCESS 0
++#define CALLBACK_CONTINUE 1
++#define CALLBACK_ERROR -1
+ 
++typedef int (*QuartzModeCallback)
++    (ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
+ 
+ #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+ 
+@@ -97,20 +100,22 @@ static void QuartzRandRGetModeInfo (CFDictionaryRef modeRef,
+     pMode->ref = NULL;
+ }
+ 
+-static Bool QuartzRandRGetCurrentModeInfo (CGDirectDisplayID screenId,
++static Bool QuartzRandRCopyCurrentModeInfo (CGDirectDisplayID screenId,
+                                            QuartzModeInfoPtr pMode) {
+     CFDictionaryRef curModeRef = CGDisplayCurrentMode(screenId);
+     if (!curModeRef)
+         return FALSE;
+ 
+     QuartzRandRGetModeInfo(curModeRef, pMode);
++    pMode->ref = curModeRef;
++    CFRetain(pMode->ref);
+     return TRUE;
+ }
+ 
+ static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
+                                 QuartzModeInfoPtr pMode) {
+     CFDictionaryRef modeRef = (CFDictionaryRef) pMode->ref;
+-    return (CGDisplaySwitchToMode(screenId, modeRef) != kCGErrorSuccess);
++    return (CGDisplaySwitchToMode(screenId, modeRef) == kCGErrorSuccess);
+ }
+ 
+ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+@@ -122,6 +127,28 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+     CFArrayRef modes;
+     QuartzModeInfo modeInfo;
+     int i;
++    BOOL retval = FALSE;
++    QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
++
++    switch(callback(pScreen, screenId, &pQuartzScreen->rootlessMode, data)) {
++        case CALLBACK_SUCCESS:
++            return TRUE;
++        case CALLBACK_ERROR:
++            return FALSE;
++        case CALLBACK_CONTINUE:
++        default:
++            break;
++    }
++
++    switch(callback(pScreen, screenId, &pQuartzScreen->fullScreenMode, data)) {
++        case CALLBACK_SUCCESS:
++            return TRUE;
++        case CALLBACK_ERROR:
++            return FALSE;
++        case CALLBACK_CONTINUE:
++        default:
++            break;
++    }
+ 
+     curModeRef = CGDisplayCurrentMode(screenId);
+     if (!curModeRef)
+@@ -132,6 +159,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+     if (!modes)
+         return FALSE;
+     for (i = 0; i < CFArrayGetCount(modes); i++) {
++        int cb;
+         modeRef = (CFDictionaryRef) CFArrayGetValueAtIndex(modes, i);
+ 
+         /* Skip modes that are not usable on the current display or have a
+@@ -144,10 +172,15 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+ 
+         QuartzRandRGetModeInfo(modeRef, &modeInfo);
+         modeInfo.ref = modeRef;
+-        if (!callback(pScreen, screenId, &modeInfo, data))
++        cb = callback(pScreen, screenId, &modeInfo, data);
++        if (cb == CALLBACK_SUCCESS)
++            break;
++        if (cb == CALLBACK_ERROR) {
++            retval = FALSE;
+             break;
++        }
+     }
+-    return TRUE;
++    return retval;
+ }
+ 
+ #else /* we have the new CG APIs from Snow Leopard */
+@@ -162,14 +195,14 @@ static void QuartzRandRGetModeInfo (CGDisplayModeRef modeRef,
+     pMode->ref = NULL;
+ }
+ 
+-static Bool QuartzRandRGetCurrentModeInfo (CGDirectDisplayID screenId,
+-                                           QuartzModeInfoPtr pMode) {
++static Bool QuartzRandRCopyCurrentModeInfo (CGDirectDisplayID screenId,
++                                            QuartzModeInfoPtr pMode) {
+     CGDisplayModeRef curModeRef = CGDisplayCopyDisplayMode(screenId);
+     if (!curModeRef)
+         return FALSE;
+ 
+     QuartzRandRGetModeInfo(curModeRef, pMode);
+-    CGDisplayModeRelease(curModeRef);
++    pMode->ref = curModeRef;
+     return TRUE;
+ }
+ 
+@@ -179,7 +212,7 @@ static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
+     if (!modeRef)
+         return FALSE;
+ 
+-    return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) != kCGErrorSuccess);
++    return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) == kCGErrorSuccess);
+ }
+ 
+ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+@@ -192,6 +225,29 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+     CFArrayRef modes;
+     QuartzModeInfo modeInfo;
+     int i;
++    Bool retval = TRUE;
++
++    QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
++
++    switch(callback(pScreen, screenId, &pQuartzScreen->rootlessMode, data)) {
++        case CALLBACK_SUCCESS:
++            return TRUE;
++        case CALLBACK_ERROR:
++            return FALSE;
++        case CALLBACK_CONTINUE:
++        default:
++            break;
++    }
++
++    switch(callback(pScreen, screenId, &pQuartzScreen->fullScreenMode, data)) {
++        case CALLBACK_SUCCESS:
++            return TRUE;
++        case CALLBACK_ERROR:
++            return FALSE;
++        case CALLBACK_CONTINUE:
++        default:
++            break;
++    }
+ 
+     curModeRef = CGDisplayCopyDisplayMode(screenId);
+     if (!curModeRef)
+@@ -205,6 +261,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+         return FALSE;
+     }
+     for (i = 0; i < CFArrayGetCount(modes); i++) {
++        int cb;
+         modeRef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
+ 
+         /* Skip modes that are not usable on the current display or have a
+@@ -220,13 +277,19 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+ 
+         QuartzRandRGetModeInfo(modeRef, &modeInfo);
+         modeInfo.ref = modeRef;
+-        if (!callback(pScreen, screenId, &modeInfo, data))
++        cb = callback(pScreen, screenId, &modeInfo, data);
++        if (cb == CALLBACK_SUCCESS)
++            break;
++		if (cb == CALLBACK_ERROR) {
++			retval = FALSE;
+             break;
++		}
+     }
++		
+     CFRelease(modes);
+ 
+     CFRelease(curPixelEnc);
+-    return TRUE;
++    return retval;
+ }
+ 
+ #endif  /* Snow Leopard CoreGraphics APIs */
+@@ -246,6 +309,7 @@ static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
+     RRScreenSizePtr pSize = RRRegisterSize(pScreen,
+         pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
+     if (pSize) {
++        //DEBUG_LOG("registering: %d x %d @ %d %s\n", (int)pMode->width, (int)pMode->height, (int)pMode->refresh, isCurrentMode ? "*" : "");
+         RRRegisterRate(pScreen, pSize, pMode->refresh);
+ 
+         if (isCurrentMode)
+@@ -256,34 +320,46 @@ static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
+     return FALSE;
+ }
+ 
+-static Bool QuartzRandRRegisterModeCallback (ScreenPtr pScreen,
++static int QuartzRandRRegisterModeCallback (ScreenPtr pScreen,
+                                         CGDirectDisplayID screenId,
+                                         QuartzModeInfoPtr pMode,
+                                         void *data __unused) {
+-    return QuartzRandRRegisterMode(pScreen, pMode);
++    if(QuartzRandRRegisterMode(pScreen, pMode)) {
++        return CALLBACK_CONTINUE;
++    } else {
++        return CALLBACK_ERROR;
++    }
+ }
+ 
+-static Bool QuartzRandRSetModeCallback (ScreenPtr pScreen,
+-                                        CGDirectDisplayID screenId,
+-                                        QuartzModeInfoPtr pMode,
+-                                        void *data) {
++static int QuartzRandRSetModeCallback (ScreenPtr pScreen,
++                                       CGDirectDisplayID screenId,
++                                       QuartzModeInfoPtr pMode,
++                                       void *data) {
+     QuartzModeInfoPtr pReqMode = (QuartzModeInfoPtr) data;
+     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+-
++	
+     if (!QuartzRandRModesEqual(pMode, pReqMode))
+-        return TRUE;  /* continue enumeration */
++        return CALLBACK_CONTINUE;  /* continue enumeration */
++
++    DEBUG_LOG("Found a match for requested RandR resolution (%dx%d@%d).\n", (int)pMode->width, (int)pMode->height, (int)pMode->refresh);
+ 
+-    if (pReqMode->ref == pQuartzScreen->currentMode.ref) {
++    if (pQuartzScreen->currentMode.ref && CFEqual(pMode->ref, pQuartzScreen->currentMode.ref)) {
+         DEBUG_LOG("Requested RandR resolution matches current CG mode\n");
+-        return FALSE; /* We don't need to do anything in CG */
++        return CALLBACK_SUCCESS; /* We don't need to do anything in CG */
+     }
+ 
+-    if (QuartzRandRSetMode(screenId, pMode) == FALSE) {
++    if (QuartzRandRSetMode(screenId, pMode)) {
++        if(pQuartzScreen->currentMode.ref)
++            CFRelease(pQuartzScreen->currentMode.ref);
++        pQuartzScreen->currentMode = *pMode;
++        CFRetain(pQuartzScreen->currentMode.ref);
++
+         ignore_next_fake_mode_update = TRUE;
+-        return FALSE;
++        return CALLBACK_SUCCESS;
+     } else {
+-        return TRUE;
+-    };
++        DEBUG_LOG("Error while requesting CG resolution change.\n");
++        return CALLBACK_ERROR;
++    }
+ }
+ 
+ static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
+@@ -295,17 +371,17 @@ static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
+     if (pQuartzScreen->displayCount == 0)
+         return FALSE;
+ 
+-    QuartzRandRRegisterMode(pScreen, &pQuartzScreen->rootlessMode);
+-    QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullScreenMode);
+-
+     if (pQuartzScreen->displayCount > 1) {
+         /* RandR operations are not well-defined for an X11 screen spanning
+            multiple CG displays. Create two entries for the current virtual
+            resolution including/excluding the menu bar. */
++
++        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->rootlessMode);
++        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullScreenMode);
+         return TRUE;
+     }
+-    screenId = pQuartzScreen->displayIDs[0];
+ 
++    screenId = pQuartzScreen->displayIDs[0];
+     return QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRRegisterModeCallback, NULL);
+ }
+ 
+@@ -323,9 +399,14 @@ static Bool QuartzRandRSetConfig (ScreenPtr           pScreen,
+ 
+     /* If the client requested the fake rootless mode, switch to rootless.
+      * Otherwise, force fullscreen mode.
++     * TODO: Refactor all this fullscreen/rootless crap as it is spaghetti
++     *       has redundancies.
+      */
+-    QuartzSetFullscreen(reqMode.refresh != FAKE_REFRESH_ROOTLESS);
+     QuartzSetRootless(reqMode.refresh == FAKE_REFRESH_ROOTLESS);
++    QuartzSetFullscreen(reqMode.refresh != FAKE_REFRESH_ROOTLESS);
++    if(reqMode.refresh != FAKE_REFRESH_ROOTLESS &&
++       reqMode.refresh != FAKE_REFRESH_FULLSCREEN)
++        QuartzShow();
+ 
+     if (pQuartzScreen->displayCount == 0)
+         return FALSE;
+@@ -342,12 +423,10 @@ static Bool QuartzRandRSetConfig (ScreenPtr           pScreen,
+         
+     screenId = pQuartzScreen->displayIDs[0];
+     if (QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRSetModeCallback, &reqMode)) {
+-        pQuartzScreen->currentMode = reqMode;
+         return TRUE;
+     }
+     
+     DEBUG_LOG("Unable to find a matching config: %d x %d @ %d\n", (int)reqMode.width, (int)reqMode.height, (int)reqMode.refresh);
+-
+     return FALSE;
+ }
+ 
+@@ -355,9 +434,16 @@ static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
+     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+ 
+     if (pQuartzScreen->displayCount == 1) {
+-        if (!QuartzRandRGetCurrentModeInfo(pQuartzScreen->displayIDs[0],
+-                                           &pQuartzScreen->fullScreenMode))
++        if(pQuartzScreen->fullScreenMode.ref)
++            CFRelease(pQuartzScreen->fullScreenMode.ref);
++        if(pQuartzScreen->currentMode.ref)
++            CFRelease(pQuartzScreen->currentMode.ref);
++        
++        if (!QuartzRandRCopyCurrentModeInfo(pQuartzScreen->displayIDs[0],
++                                            &pQuartzScreen->fullScreenMode))
+             return FALSE;
++
++        CFRetain(pQuartzScreen->fullScreenMode.ref);  /* This extra retain is for currentMode's copy */
+     } else {
+         pQuartzScreen->fullScreenMode.width = pScreen->width;
+         pQuartzScreen->fullScreenMode.height = pScreen->height;
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+index 8ee2818..4a7990e 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+@@ -34,7 +34,7 @@
+ typedef struct {
+     size_t width, height;
+     int refresh;
+-    const void *ref;
++    void *ref; /* CGDisplayModeRef or CFDictionaryRef */
+ } QuartzModeInfo, *QuartzModeInfoPtr;
+ 
+ // Quartz specific per screen storage structure
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0020-XQuartz-Don-t-change-the-rootless-preference-when-c.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0020-XQuartz-Don-t-change-the-rootless-preference-when-c.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0020-XQuartz-Don-t-change-the-rootless-preference-when-c.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,742 @@
+From 5603c80b0020c47f84328752aa0518c1cd80bbc7 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Mon, 26 Jul 2010 23:34:49 -0700
+Subject: [PATCH] XQuartz: Don't change the rootless preference when changing RandR mode
+
+Also renames a bunch of other variables for better consistency.
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ hw/xquartz/X11Application.h |    3 --
+ hw/xquartz/X11Application.m |   44 +++++++++++++++----------------
+ hw/xquartz/X11Controller.m  |   42 +++++++++++++++---------------
+ hw/xquartz/darwinEvents.c   |    6 ++--
+ hw/xquartz/quartz.c         |   59 +++++++++++++++++++++++-------------------
+ hw/xquartz/quartz.h         |   18 +++++++++++-
+ hw/xquartz/quartzAudio.c    |    4 +-
+ hw/xquartz/quartzCommon.h   |    6 ----
+ hw/xquartz/quartzKeyboard.c |    6 ++--
+ hw/xquartz/quartzRandR.c    |   32 +++++++++++-----------
+ hw/xquartz/quartzRandR.h    |    2 +-
+ hw/xquartz/xpr/xprAppleWM.c |    2 +-
+ hw/xquartz/xpr/xprCursor.c  |    6 ++--
+ hw/xquartz/xpr/xprFrame.c   |    4 +-
+ hw/xquartz/xpr/xprScreen.c  |    5 ++-
+ 15 files changed, 124 insertions(+), 115 deletions(-)
+
+diff --git xorg-server-1.8.99.905/hw/xquartz/X11Application.h xorg-server-1.8.99.905/hw/xquartz/X11Application.h
+index ce19e03..4621284 100644
+--- xorg-server-1.8.99.905/hw/xquartz/X11Application.h
++++ xorg-server-1.8.99.905/hw/xquartz/X11Application.h
+@@ -75,9 +75,6 @@ void X11ApplicationLaunchClient (const char *cmd);
+ 
+ void X11ApplicationMain(int argc, char **argv, char **envp);
+ 
+-extern int X11EnableKeyEquivalents;
+-extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu;
+-
+ #define PREFS_APPSMENU              "apps_menu"
+ #define PREFS_FAKEBUTTONS           "enable_fake_buttons"
+ #define PREFS_SYSBEEP               "enable_system_beep"
+diff --git xorg-server-1.8.99.905/hw/xquartz/X11Application.m xorg-server-1.8.99.905/hw/xquartz/X11Application.m
+index 36c39e5..781dccc 100644
+--- xorg-server-1.8.99.905/hw/xquartz/X11Application.m
++++ xorg-server-1.8.99.905/hw/xquartz/X11Application.m
+@@ -38,6 +38,7 @@
+ #import "X11Application.h"
+ 
+ #include "darwin.h"
++#include "quartz.h"
+ #include "darwinEvents.h"
+ #include "quartzKeyboard.h"
+ #include "quartz.h"
+@@ -63,9 +64,6 @@ extern int xpbproxy_run (void);
+ /* Stuck modifier / button state... force release when we context switch */
+ static NSEventType keyState[NUM_KEYCODES];
+ 
+-int X11EnableKeyEquivalents = TRUE, quartzFullscreenMenu = FALSE;
+-int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
+-
+ extern Bool noTestExtensions;
+ 
+ #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+@@ -287,23 +285,23 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
+                         do_swallow = YES;
+                         for_x = NO;
+ #if XPLUGIN_VERSION >= 1
+-                    } else if(X11EnableKeyEquivalents &&
++                    } else if(XQuartzEnableKeyEquivalents &&
+                              xp_is_symbolic_hotkey_event([e eventRef])) {
+                         swallow_keycode = [e keyCode];
+                         do_swallow = YES;
+                         for_x = NO;
+ #endif
+-                    } else if(X11EnableKeyEquivalents &&
++                    } else if(XQuartzEnableKeyEquivalents &&
+                               [[self mainMenu] performKeyEquivalent:e]) {
+                         swallow_keycode = [e keyCode];
+                         do_swallow = YES;
+                         for_appkit = NO;
+                         for_x = NO;
+-                    } else if(!quartzEnableRootless
++                    } else if(!XQuartzIsRootless
+                               && ([e modifierFlags] & ALL_KEY_MASKS) == (NSCommandKeyMask | NSAlternateKeyMask)
+                               && ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) {
+                         /* We have this here to force processing fullscreen 
+-                         * toggle even if X11EnableKeyEquivalents is disabled */
++                         * toggle even if XQuartzEnableKeyEquivalents is disabled */
+                         swallow_keycode = [e keyCode];
+                         do_swallow = YES;
+                         for_x = NO;
+@@ -372,7 +370,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
+                     break;
+                     
+                 case 18: /* ApplicationDidReactivate */
+-                    if (quartzHasRoot) for_appkit = NO;
++                    if (XQuartzHasRoot) for_appkit = NO;
+                     break;
+                     
+                 case NSApplicationDeactivatedEventType:
+@@ -422,7 +420,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
+     if ([state boolValue])
+         SetSystemUIMode(kUIModeNormal, 0); 
+     else
+-        SetSystemUIMode(kUIModeAllHidden, quartzFullscreenMenu ? kUIOptionAutoShowMenuBar : 0); // kUIModeAllSuppressed or kUIOptionAutoShowMenuBar can be used to allow "mouse-activation"
++        SetSystemUIMode(kUIModeAllHidden, XQuartzFullscreenMenu ? kUIOptionAutoShowMenuBar : 0); // kUIModeAllSuppressed or kUIOptionAutoShowMenuBar can be used to allow "mouse-activation"
+ }
+ 
+ - (void) launch_client:(NSString *)cmd {
+@@ -720,18 +718,18 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
+     NSString *nsstr;
+     const char *tem;
+ 	
+-    quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP
+-                                       default:quartzUseSysBeep];
+-    quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS
+-                                           default:quartzEnableRootless];
+-    quartzFullscreenMenu = [self prefs_get_boolean:@PREFS_FULLSCREEN_MENU
+-                                           default:quartzFullscreenMenu];
+-    quartzFullscreenDisableHotkeys = ![self prefs_get_boolean:@PREFS_FULLSCREEN_HOTKEYS
+-                                                      default:!quartzFullscreenDisableHotkeys];
++    XQuartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP
++                                       default:XQuartzUseSysBeep];
++    XQuartzRootlessDefault = [self prefs_get_boolean:@PREFS_ROOTLESS
++                                           default:XQuartzRootlessDefault];
++    XQuartzFullscreenMenu = [self prefs_get_boolean:@PREFS_FULLSCREEN_MENU
++                                           default:XQuartzFullscreenMenu];
++    XQuartzFullscreenDisableHotkeys = ![self prefs_get_boolean:@PREFS_FULLSCREEN_HOTKEYS
++                                                      default:!XQuartzFullscreenDisableHotkeys];
+     darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS
+                                         default:darwinFakeButtons];
+-    quartzOptionSendsAlt = [self prefs_get_boolean:@PREFS_OPTION_SENDS_ALT
+-                                           default:quartzOptionSendsAlt];
++    XQuartzOptionSendsAlt = [self prefs_get_boolean:@PREFS_OPTION_SENDS_ALT
++                                           default:XQuartzOptionSendsAlt];
+ 
+     if (darwinFakeButtons) {
+         const char *fake2, *fake3;
+@@ -759,8 +757,8 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
+         }
+     }
+ 
+-    X11EnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS
+-                                              default:X11EnableKeyEquivalents];
++    XQuartzEnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS
++                                              default:XQuartzEnableKeyEquivalents];
+ 	
+     darwinSyncKeymap = [self prefs_get_boolean:@PREFS_SYNC_KEYMAP
+                                        default:darwinSyncKeymap];
+@@ -1158,7 +1156,7 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
+                 pDev = darwinTabletCurrent;
+             }
+ 
+-            if(!quartzServerVisible && noTestExtensions) {
++            if(!XQuartzServerVisible && noTestExtensions) {
+ #if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0
+ /* Older libXplugin (Tiger/"Stock" Leopard) aren't thread safe, so we can't call xp_find_window from the Appkit thread */
+                 xp_window_id wid = 0;
+@@ -1218,7 +1216,7 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
+             /* If we're in the background, we need to send a MotionNotify event
+              * first, since we aren't getting them on background mouse motion
+              */
+-            if(!quartzServerVisible && noTestExtensions) {
++            if(!XQuartzServerVisible && noTestExtensions) {
+                 bgMouseLocationUpdated = FALSE;
+                 DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, location.x,
+                                         location.y, pressure, tilt.x, tilt.y);
+diff --git xorg-server-1.8.99.905/hw/xquartz/X11Controller.m xorg-server-1.8.99.905/hw/xquartz/X11Controller.m
+index d66d039..13b6366 100644
+--- xorg-server-1.8.99.905/hw/xquartz/X11Controller.m
++++ xorg-server-1.8.99.905/hw/xquartz/X11Controller.m
+@@ -609,13 +609,13 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+ }
+ 
+ - (IBAction) enable_fullscreen_changed:sender {
+-    int value = ![enable_fullscreen intValue];
++    XQuartzRootlessDefault = ![enable_fullscreen intValue];
+ 
+-    [enable_fullscreen_menu setEnabled:!value];
++    [enable_fullscreen_menu setEnabled:!XQuartzRootlessDefault];
+ 
+-    DarwinSendDDXEvent(kXquartzSetRootless, 1, value);
++    DarwinSendDDXEvent(kXquartzSetRootless, 1, XQuartzRootlessDefault);
+ 
+-    [NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value];
++    [NSApp prefs_set_boolean:@PREFS_ROOTLESS value:XQuartzRootlessDefault];
+     [NSApp prefs_synchronize];
+ }
+ 
+@@ -638,24 +638,24 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+         darwinFakeButtons = [fake_buttons intValue];
+         [NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons];
+     } else if(sender == use_sysbeep) {
+-        quartzUseSysBeep = [use_sysbeep intValue];
+-        [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep];
++        XQuartzUseSysBeep = [use_sysbeep intValue];
++        [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:XQuartzUseSysBeep];
+     } else if(sender == enable_keyequivs) {
+-        X11EnableKeyEquivalents =  [enable_keyequivs intValue];
+-        [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents];
++        XQuartzEnableKeyEquivalents =  [enable_keyequivs intValue];
++        [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:XQuartzEnableKeyEquivalents];
+     } else if(sender == sync_keymap) {
+         darwinSyncKeymap = [sync_keymap intValue];
+         [NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap];
+     } else if(sender == enable_fullscreen_menu) {
+-        quartzFullscreenMenu = [enable_fullscreen_menu intValue];
+-        [NSApp prefs_set_boolean:@PREFS_FULLSCREEN_MENU value:quartzFullscreenMenu];
++        XQuartzFullscreenMenu = [enable_fullscreen_menu intValue];
++        [NSApp prefs_set_boolean:@PREFS_FULLSCREEN_MENU value:XQuartzFullscreenMenu];
+     } else if(sender == option_sends_alt) {
+-        BOOL prev_opt_sends_alt = quartzOptionSendsAlt;
++        BOOL prev_opt_sends_alt = XQuartzOptionSendsAlt;
+         
+-        quartzOptionSendsAlt = [option_sends_alt intValue];
+-        [NSApp prefs_set_boolean:@PREFS_OPTION_SENDS_ALT value:quartzOptionSendsAlt];
++        XQuartzOptionSendsAlt = [option_sends_alt intValue];
++        [NSApp prefs_set_boolean:@PREFS_OPTION_SENDS_ALT value:XQuartzOptionSendsAlt];
+ 
+-        if(prev_opt_sends_alt != quartzOptionSendsAlt)
++        if(prev_opt_sends_alt != XQuartzOptionSendsAlt)
+             QuartsResyncKeymap(TRUE);
+     } else if(sender == click_through) {
+         [NSApp prefs_set_boolean:@PREFS_CLICK_THROUGH value:[click_through intValue]];
+@@ -701,10 +701,10 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+     BOOL pbproxy_active = [NSApp prefs_get_boolean:@PREFS_SYNC_PB default:YES];
+     
+     [fake_buttons setIntValue:darwinFakeButtons];
+-    [use_sysbeep setIntValue:quartzUseSysBeep];
+-    [enable_keyequivs setIntValue:X11EnableKeyEquivalents];
++    [use_sysbeep setIntValue:XQuartzUseSysBeep];
++    [enable_keyequivs setIntValue:XQuartzEnableKeyEquivalents];
+     [sync_keymap setIntValue:darwinSyncKeymap];
+-    [option_sends_alt setIntValue:quartzOptionSendsAlt];
++    [option_sends_alt setIntValue:XQuartzOptionSendsAlt];
+     [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_CLICK_THROUGH default:NO]];
+     [focus_follows_mouse setIntValue:[NSApp prefs_get_boolean:@PREFS_FFM default:NO]];
+     [focus_on_new_window setIntValue:[NSApp prefs_get_boolean:@PREFS_FOCUS_ON_NEW_WINDOW default:YES]];
+@@ -729,9 +729,9 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+     [sync_text1 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
+     [sync_text2 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
+ 	
+-    [enable_fullscreen setIntValue:!quartzEnableRootless];
+-    [enable_fullscreen_menu setEnabled:!quartzEnableRootless];
+-    [enable_fullscreen_menu setIntValue:quartzFullscreenMenu];
++    [enable_fullscreen setIntValue:!XQuartzRootlessDefault];
++    [enable_fullscreen_menu setEnabled:!XQuartzRootlessDefault];
++    [enable_fullscreen_menu setIntValue:XQuartzFullscreenMenu];
+     
+     [prefs_panel makeKeyAndOrderFront:sender];
+ }
+@@ -752,7 +752,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+   NSMenu *menu = [item menu];
+     
+   if (item == toggle_fullscreen_item)
+-    return !quartzEnableRootless;
++    return !XQuartzIsRootless;
+   else if (menu == [X11App windowsMenu] || menu == dock_menu
+ 	   || (menu == [x11_about_item menu] && [item tag] == 42))
+     return (AppleWMSelectedEvents () & AppleWMControllerNotifyMask) != 0;
+diff --git xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c
+index 7367068..4332202 100644
+--- xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c
++++ xorg-server-1.8.99.905/hw/xquartz/darwinEvents.c
+@@ -239,9 +239,9 @@ static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr de
+             
+         case kXquartzToggleFullscreen:
+             DEBUG_LOG("kXquartzToggleFullscreen\n");
+-            if(quartzEnableRootless) 
++            if(XQuartzIsRootless)
+                 ErrorF("Ignoring kXquartzToggleFullscreen because of rootless mode.");
+-            else if (quartzHasRoot)
++            else if (XQuartzHasRoot)
+                 QuartzHide();
+             else
+                 QuartzShow();
+@@ -250,7 +250,7 @@ static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr de
+         case kXquartzSetRootless:
+             DEBUG_LOG("kXquartzSetRootless\n");
+             QuartzSetRootless(e->data[0]);
+-            if (!quartzEnableRootless && !quartzHasRoot)
++            if (!XQuartzIsRootless && !XQuartzHasRoot)
+                 QuartzHide();
+             break;
+             
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartz.c xorg-server-1.8.99.905/hw/xquartz/quartz.c
+index a52cac9..cd90457 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartz.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartz.c
+@@ -66,15 +66,20 @@
+ #include <rootlessCommon.h>
+ #include <Xplugin.h>
+ 
+-// Shared global variables for Quartz modes
+-int                     quartzUseSysBeep = 0;
+-int                     quartzServerVisible = FALSE;
+ DevPrivateKeyRec        quartzScreenKeyRec;
+ int                     aquaMenuBarHeight = 0;
+ QuartzModeProcsPtr      quartzProcs = NULL;
+ const char             *quartzOpenGLBundle = NULL;
+-int                     quartzFullscreenDisableHotkeys = TRUE;
+-int                     quartzOptionSendsAlt = FALSE;
++
++Bool XQuartzFullscreenDisableHotkeys = TRUE;
++Bool XQuartzOptionSendsAlt = FALSE;
++Bool XQuartzEnableKeyEquivalents = TRUE;
++Bool XQuartzHasRoot = FALSE;
++Bool XQuartzRootlessDefault = TRUE;
++Bool XQuartzIsRootless = TRUE;
++Bool XQuartzServerVisible = FALSE;
++Bool XQuartzFullscreenMenu = FALSE;
++Bool XQuartzUseSysBeep = FALSE;
+ 
+ /*
+ ===========================================================================
+@@ -245,61 +250,61 @@ void QuartzSetFullscreen(Bool state) {
+     
+     DEBUG_LOG("QuartzSetFullscreen: state=%d\n", state);
+     
+-    if(quartzHasRoot == state)
++    if(XQuartzHasRoot == state)
+         return;
+     
+-    quartzHasRoot = state;
++    XQuartzHasRoot = state;
+     
+     xp_disable_update ();
+     
+-    if (!quartzHasRoot && !quartzEnableRootless)
++    if (!XQuartzHasRoot && !XQuartzIsRootless)
+         RootlessHideAllWindows();
+     
+-    RootlessUpdateRooted(quartzHasRoot);
++    RootlessUpdateRooted(XQuartzHasRoot);
+     
+-    if (quartzHasRoot && !quartzEnableRootless)
++    if (XQuartzHasRoot && !XQuartzIsRootless)
+         RootlessShowAllWindows ();
+     
+-    if (quartzHasRoot || quartzEnableRootless) {
++    if (XQuartzHasRoot || XQuartzIsRootless) {
+         RootlessRepositionWindows(screenInfo.screens[0]);
+     }
+ 
+     /* Somehow the menubar manages to interfere with our event stream
+      * in fullscreen mode, even though it's not visible. 
+      */
+-    X11ApplicationShowHideMenubar(!quartzHasRoot);
++    X11ApplicationShowHideMenubar(!XQuartzHasRoot);
+     
+     xp_reenable_update ();
+     
+-    if (quartzFullscreenDisableHotkeys)
+-        xp_disable_hot_keys(quartzHasRoot);
++    if (XQuartzFullscreenDisableHotkeys)
++        xp_disable_hot_keys(XQuartzHasRoot);
+ }
+ 
+ void QuartzSetRootless(Bool state) {
+-    if(quartzEnableRootless == state)
++    if(XQuartzIsRootless == state)
+         return;
+     
+-    quartzEnableRootless = state;
++    XQuartzIsRootless = state;
+ 
+     xp_disable_update();
+ 
+     /* When in rootless, the menubar is not part of the screen, so we need to update our screens on toggle */    
+     QuartzUpdateScreens();
+ 
+-    if(!quartzHasRoot) {
+-        if(!quartzEnableRootless) {
++    if(!XQuartzHasRoot) {
++        if(!XQuartzIsRootless) {
+             RootlessHideAllWindows();
+         } else {
+             RootlessShowAllWindows();
+         }
+     }
+ 
+-    X11ApplicationShowHideMenubar(!quartzHasRoot);
++    X11ApplicationShowHideMenubar(!XQuartzHasRoot);
+ 
+     xp_reenable_update();
+ 
+-    if (!quartzEnableRootless && quartzFullscreenDisableHotkeys)
+-        xp_disable_hot_keys(quartzHasRoot);
++    if (!XQuartzIsRootless && XQuartzFullscreenDisableHotkeys)
++        xp_disable_hot_keys(XQuartzHasRoot);
+ }
+ 
+ /*
+@@ -311,17 +316,17 @@ void QuartzSetRootless(Bool state) {
+ void QuartzShow(void) {
+     int i;
+ 
+-    if (quartzServerVisible)
++    if (XQuartzServerVisible)
+         return;
+     
+-    quartzServerVisible = TRUE;
++    XQuartzServerVisible = TRUE;
+     for (i = 0; i < screenInfo.numScreens; i++) {
+         if (screenInfo.screens[i]) {
+             quartzProcs->ResumeScreen(screenInfo.screens[i]);
+         }
+     }
+     
+-    if (!quartzEnableRootless)
++    if (!XQuartzIsRootless)
+         QuartzSetFullscreen(TRUE);
+ }
+ 
+@@ -336,7 +341,7 @@ void QuartzHide(void)
+ {
+     int i;
+ 
+-    if (quartzServerVisible) {
++    if (XQuartzServerVisible) {
+         for (i = 0; i < screenInfo.numScreens; i++) {
+             if (screenInfo.screens[i]) {
+                 quartzProcs->SuspendScreen(screenInfo.screens[i]);
+@@ -345,7 +350,7 @@ void QuartzHide(void)
+     }
+     
+     QuartzSetFullscreen(FALSE);
+-    quartzServerVisible = FALSE;
++    XQuartzServerVisible = FALSE;
+ }
+ 
+ 
+@@ -358,7 +363,7 @@ void QuartzSetRootClip(
+ {
+     int i;
+ 
+-    if (!quartzServerVisible)
++    if (!XQuartzServerVisible)
+         return;
+ 
+     for (i = 0; i < screenInfo.numScreens; i++) {
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartz.h xorg-server-1.8.99.905/hw/xquartz/quartz.h
+index 1b924e7..a0a17cb 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartz.h
++++ xorg-server-1.8.99.905/hw/xquartz/quartz.h
+@@ -35,6 +35,7 @@
+ 
+ #include "screenint.h"
+ #include "window.h"
++#include "pixmap.h"
+ 
+ /*------------------------------------------
+    Quartz display mode function types
+@@ -113,7 +114,20 @@ typedef struct _QuartzModeProcs {
+ } QuartzModeProcsRec, *QuartzModeProcsPtr;
+ 
+ extern QuartzModeProcsPtr quartzProcs;
+-extern int quartzHasRoot, quartzEnableRootless;
++
++extern Bool XQuartzHasRoot;          /* TODO: These two booleans are very similar and */
++extern Bool XQuartzServerVisible;    /* the code that uses them needs to be refactored
++                                      * XQuartzHasRoot is essentially the "saved" XQuartzServerVisible
++                                      * value from when the server was not in rootless mode.
++                                      */
++
++extern Bool XQuartzEnableKeyEquivalents;
++extern Bool XQuartzRootlessDefault;  /* Is our default mode rootless? */
++extern Bool XQuartzIsRootless;       /* Is our current mode rootless (or FS)? */
++extern Bool XQuartzFullscreenMenu;   /* Show the menu bar (autohide) while in FS */
++extern Bool XQuartzFullscreenDisableHotkeys;
++extern Bool XQuartzOptionSendsAlt;   /* Alt or Mode_switch? */
++extern Bool XQuartzUseSysBeep;       /* Sys beep or our own? */
+ 
+ Bool QuartzAddScreen(int index, ScreenPtr pScreen);
+ Bool QuartzSetupScreen(int index, ScreenPtr pScreen);
+@@ -129,8 +143,8 @@ void QuartzHide(void);
+ void QuartzSetRootClip(BOOL enable);
+ void QuartzSpaceChanged(uint32_t space_id);
+ 
+-void QuartzSetFullscreen(Bool state);
+ void QuartzSetRootless(Bool state);
++void QuartzSetFullscreen(Bool state);
+ 
+ int server_main(int argc, char **argv, char **envp);
+ #endif
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzAudio.c xorg-server-1.8.99.905/hw/xquartz/quartzAudio.c
+index 708202b..d0f7c53 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzAudio.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartzAudio.c
+@@ -42,7 +42,7 @@
+ #include <dix-config.h>
+ #endif
+ 
+-#include "quartzCommon.h"
++#include "quartz.h"
+ #include "quartzAudio.h"
+ 
+ #include <CoreAudio/CoreAudio.h>
+@@ -220,7 +220,7 @@ void DDXRingBell(
+     int pitch,          // pitch is Hz
+     int duration )      // duration is milliseconds
+ {
+-    if (quartzUseSysBeep) {
++    if (XQuartzUseSysBeep) {
+         if (volume)
+             NSBeep();
+         return;
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
+index 718df4b..fbfe6f8 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
++++ xorg-server-1.8.99.905/hw/xquartz/quartzCommon.h
+@@ -38,13 +38,7 @@
+ #include <X11/Xdefs.h>
+ #include "privates.h"
+ 
+-// User preferences used by Quartz modes
+-extern int              quartzUseSysBeep;
+-extern int              quartzFullscreenDisableHotkeys;
+-extern int              quartzOptionSendsAlt;
+-
+ // Other shared data
+-extern int              quartzServerVisible;
+ extern DevPrivateKeyRec quartzScreenKeyRec;
+ #define quartzScreenKey (&quartzScreenKeyRec)
+ extern int              aquaMenuBarHeight;
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzKeyboard.c xorg-server-1.8.99.905/hw/xquartz/quartzKeyboard.c
+index 75cf23f..f54c686 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzKeyboard.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartzKeyboard.c
+@@ -48,7 +48,7 @@
+ #include <sys/stat.h>
+ #include <AvailabilityMacros.h>
+ 
+-#include "quartzCommon.h"
++#include "quartz.h"
+ #include "darwin.h"
+ #include "darwinEvents.h"
+ 
+@@ -262,7 +262,7 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
+             case XK_Alt_L:
+                 info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+                 info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+-                if(!quartzOptionSendsAlt)
++                if(!XQuartzOptionSendsAlt)
+                     *k = XK_Mode_switch; // Yes, this is ugly.  This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
+                 break;
+ 
+@@ -272,7 +272,7 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
+ #else
+                 info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+ #endif
+-                if(!quartzOptionSendsAlt)
++                if(!XQuartzOptionSendsAlt)
+                     *k = XK_Mode_switch; // Yes, this is ugly.  This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
+                 info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+                 break;
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+index 9b84fa1..7534267 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.c
+@@ -140,7 +140,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+             break;
+     }
+ 
+-    switch(callback(pScreen, screenId, &pQuartzScreen->fullScreenMode, data)) {
++    switch(callback(pScreen, screenId, &pQuartzScreen->fullscreenMode, data)) {
+         case CALLBACK_SUCCESS:
+             return TRUE;
+         case CALLBACK_ERROR:
+@@ -239,7 +239,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
+             break;
+     }
+ 
+-    switch(callback(pScreen, screenId, &pQuartzScreen->fullScreenMode, data)) {
++    switch(callback(pScreen, screenId, &pQuartzScreen->fullscreenMode, data)) {
+         case CALLBACK_SUCCESS:
+             return TRUE;
+         case CALLBACK_ERROR:
+@@ -377,7 +377,7 @@ static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
+            resolution including/excluding the menu bar. */
+ 
+         QuartzRandRRegisterMode(pScreen, &pQuartzScreen->rootlessMode);
+-        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullScreenMode);
++        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullscreenMode);
+         return TRUE;
+     }
+ 
+@@ -434,37 +434,37 @@ static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
+     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+ 
+     if (pQuartzScreen->displayCount == 1) {
+-        if(pQuartzScreen->fullScreenMode.ref)
+-            CFRelease(pQuartzScreen->fullScreenMode.ref);
++        if(pQuartzScreen->fullscreenMode.ref)
++            CFRelease(pQuartzScreen->fullscreenMode.ref);
+         if(pQuartzScreen->currentMode.ref)
+             CFRelease(pQuartzScreen->currentMode.ref);
+         
+         if (!QuartzRandRCopyCurrentModeInfo(pQuartzScreen->displayIDs[0],
+-                                            &pQuartzScreen->fullScreenMode))
++                                            &pQuartzScreen->fullscreenMode))
+             return FALSE;
+ 
+-        CFRetain(pQuartzScreen->fullScreenMode.ref);  /* This extra retain is for currentMode's copy */
++        CFRetain(pQuartzScreen->fullscreenMode.ref);  /* This extra retain is for currentMode's copy */
+     } else {
+-        pQuartzScreen->fullScreenMode.width = pScreen->width;
+-        pQuartzScreen->fullScreenMode.height = pScreen->height;
+-        if(quartzEnableRootless)
+-            pQuartzScreen->fullScreenMode.height += aquaMenuBarHeight;
++        pQuartzScreen->fullscreenMode.width = pScreen->width;
++        pQuartzScreen->fullscreenMode.height = pScreen->height;
++        if(XQuartzIsRootless)
++            pQuartzScreen->fullscreenMode.height += aquaMenuBarHeight;
+     }
+ 
+-    pQuartzScreen->fullScreenMode.refresh = FAKE_REFRESH_FULLSCREEN;
++    pQuartzScreen->fullscreenMode.refresh = FAKE_REFRESH_FULLSCREEN;
+ 
+-    pQuartzScreen->rootlessMode = pQuartzScreen->fullScreenMode;
++    pQuartzScreen->rootlessMode = pQuartzScreen->fullscreenMode;
+     pQuartzScreen->rootlessMode.refresh = FAKE_REFRESH_ROOTLESS;
+     pQuartzScreen->rootlessMode.height -= aquaMenuBarHeight;
+ 
+-    if(quartzEnableRootless) {
++    if(XQuartzIsRootless) {
+         pQuartzScreen->currentMode = pQuartzScreen->rootlessMode;
+     } else {
+-        pQuartzScreen->currentMode = pQuartzScreen->fullScreenMode;
++        pQuartzScreen->currentMode = pQuartzScreen->fullscreenMode;
+     }
+     
+     DEBUG_LOG("rootlessMode: %d x %d\n", (int)pQuartzScreen->rootlessMode.width, (int)pQuartzScreen->rootlessMode.height);
+-    DEBUG_LOG("fullScreenMode: %d x %d\n", (int)pQuartzScreen->fullScreenMode.width, (int)pQuartzScreen->fullScreenMode.height);
++    DEBUG_LOG("fullscreenMode: %d x %d\n", (int)pQuartzScreen->fullscreenMode.width, (int)pQuartzScreen->fullscreenMode.height);
+     DEBUG_LOG("currentMode: %d x %d\n", (int)pQuartzScreen->currentMode.width, (int)pQuartzScreen->currentMode.height);
+     
+     return TRUE;
+diff --git xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+index 4a7990e..b2d4d09 100644
+--- xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
++++ xorg-server-1.8.99.905/hw/xquartz/quartzRandR.h
+@@ -45,7 +45,7 @@ typedef struct {
+     // No CG display will be covered by more than one X11 screen.
+     int displayCount;
+     CGDirectDisplayID *displayIDs;
+-    QuartzModeInfo rootlessMode, fullScreenMode, currentMode;
++    QuartzModeInfo rootlessMode, fullscreenMode, currentMode;
+ } QuartzScreenRec, *QuartzScreenPtr;
+ 
+ #define QUARTZ_PRIV(pScreen) \
+diff --git xorg-server-1.8.99.905/hw/xquartz/xpr/xprAppleWM.c xorg-server-1.8.99.905/hw/xquartz/xpr/xprAppleWM.c
+index 4b31e3a..1a3d427 100644
+--- xorg-server-1.8.99.905/hw/xquartz/xpr/xprAppleWM.c
++++ xorg-server-1.8.99.905/hw/xquartz/xpr/xprAppleWM.c
+@@ -67,7 +67,7 @@ static int xprSetWindowLevel(
+     if(!winRec)
+         return BadWindow;
+     
+-    if(quartzEnableRootless)
++    if(XQuartzIsRootless)
+         wc.window_level = normal_window_levels[level];
+     else
+         wc.window_level = rooted_window_levels[level];
+diff --git xorg-server-1.8.99.905/hw/xquartz/xpr/xprCursor.c xorg-server-1.8.99.905/hw/xquartz/xpr/xprCursor.c
+index a106e72..216678e 100644
+--- xorg-server-1.8.99.905/hw/xquartz/xpr/xprCursor.c
++++ xorg-server-1.8.99.905/hw/xquartz/xpr/xprCursor.c
+@@ -35,7 +35,7 @@
+ #include <dix-config.h>
+ #endif
+ 
+-#include "quartzCommon.h"
++#include "quartz.h"
+ #include "xpr.h"
+ #include "darwin.h"
+ #include "darwinEvents.h"
+@@ -226,7 +226,7 @@ QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
+ {
+     QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
+ 
+-    if (!quartzServerVisible)
++    if (!XQuartzServerVisible)
+         return;
+ 
+     if (pCursor == NULL)
+@@ -295,7 +295,7 @@ QuartzCrossScreen(ScreenPtr pScreen, Bool entering)
+ static void
+ QuartzWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+ {
+-    if (quartzServerVisible)
++    if (XQuartzServerVisible)
+     {
+         int sx, sy;
+ 
+diff --git xorg-server-1.8.99.905/hw/xquartz/xpr/xprFrame.c xorg-server-1.8.99.905/hw/xquartz/xpr/xprFrame.c
+index 42f06ef..ede5af5 100644
+--- xorg-server-1.8.99.905/hw/xquartz/xpr/xprFrame.c
++++ xorg-server-1.8.99.905/hw/xquartz/xpr/xprFrame.c
+@@ -171,7 +171,7 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ 
+     pFrame->level = !IsRoot (pWin) ? AppleWMWindowLevelNormal : AppleWMNumWindowLevels;
+ 
+-    if(quartzEnableRootless)
++    if(XQuartzIsRootless)
+         wc.window_level = normal_window_levels[pFrame->level];
+     else
+         wc.window_level = rooted_window_levels[pFrame->level];
+@@ -285,7 +285,7 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
+         RootlessWindowRec *winRec = x_hash_table_lookup(window_hash, wid, NULL);
+ 
+         if(winRec) {
+-            if(quartzEnableRootless)
++            if(XQuartzIsRootless)
+                 wc.window_level = normal_window_levels[winRec->level];
+             else
+                 wc.window_level = rooted_window_levels[winRec->level];
+diff --git xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c
+index b3ac693..599ef6f 100644
+--- xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c
++++ xorg-server-1.8.99.905/hw/xquartz/xpr/xprScreen.c
+@@ -158,7 +158,7 @@ displayScreenBounds(CGDirectDisplayID id)
+               (int)frame.origin.x, (int)frame.origin.y);
+     
+     /* Remove menubar to help standard X11 window managers. */
+-    if (quartzEnableRootless && 
++    if (XQuartzIsRootless && 
+         frame.origin.x == 0 && frame.origin.y == 0) {
+         frame.origin.y += aquaMenuBarHeight;
+         frame.size.height -= aquaMenuBarHeight;
+@@ -274,7 +274,8 @@ xprDisplayInit(void)
+     AppleDRIExtensionInit();
+     xprAppleWMInit();
+ 
+-    if (!quartzEnableRootless)
++    XQuartzIsRootless = XQuartzRootlessDefault;
++    if (!XQuartzIsRootless)
+         RootlessHideAllWindows();
+ }
+ 
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0021-Workaround-the-GC-clipping-problem-in-miPaintWindow.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0021-Workaround-the-GC-clipping-problem-in-miPaintWindow.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0021-Workaround-the-GC-clipping-problem-in-miPaintWindow.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,164 @@
+From ea91343b7537da418c38e50289efa39a07662fbd Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Fri, 30 Apr 2010 13:08:25 -0700
+Subject: [PATCH] Workaround the GC clipping problem in miPaintWindow and add some debugging output.
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ mi/miexpose.c |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++------
+ 1 files changed, 94 insertions(+), 11 deletions(-)
+
+diff --git xorg-server-1.8.99.905/mi/miexpose.c xorg-server-1.8.99.905/mi/miexpose.c
+index 94258b8..4f25c23 100644
+--- xorg-server-1.8.99.905/mi/miexpose.c
++++ xorg-server-1.8.99.905/mi/miexpose.c
+@@ -521,6 +521,7 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
+ void RootlessStartDrawing(WindowPtr pWin);
+ void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
+ Bool IsFramedWindow(WindowPtr pWin);
++#include "../fb/fb.h"
+ #endif 
+ 
+ void
+@@ -548,24 +549,37 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
+     Bool	solid = TRUE;
+     DrawablePtr	drawable = &pWin->drawable;
+ 
++#ifdef XQUARTZ_CLIP_DEBUG
++    ErrorF("START %d BS %d (pR = %ld)\n", what, pWin->backgroundState, ParentRelative);
++    ErrorF("      Rgn: %d %d %d %d\n", prgn->extents.x1, prgn->extents.y1,
++	                               prgn->extents.x2 - prgn->extents.x1,
++	                               prgn->extents.y2 - prgn->extents.y1);
++    ErrorF("      Win: %d %d (%d %d) %d %d\n", pWin->origin.x, pWin->origin.y,
++	                                       pWin->winSize.extents.x1, pWin->winSize.extents.y1,
++	                                       pWin->winSize.extents.x2 - pWin->winSize.extents.x1,
++					       pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
++    ErrorF("     Draw: %d %d %d %d\n", pWin->drawable.x, pWin->drawable.y,
++				       pWin->drawable.width, pWin->drawable.height);
++#endif
++
+ #ifdef ROOTLESS
+     if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
+ 	return;
+-
+-    if(IsFramedWindow(pWin)) {
+-        RootlessStartDrawing(pWin);
+-        RootlessDamageRegion(pWin, prgn);
+-    
+-        if(pWin->backgroundState == ParentRelative) {
+-            if((what == PW_BACKGROUND) || 
+-               (what == PW_BORDER && !pWin->borderIsPixel))
+-                RootlessSetPixmapOfAncestors(pWin);
+-        }
+-    }
+ #endif
+     
+     if (what == PW_BACKGROUND)
+     {
++#ifdef ROOTLESS
++	if(IsFramedWindow(pWin)) {
++	    RootlessStartDrawing(pWin);
++	    RootlessDamageRegion(pWin, prgn);
++
++	    if(pWin->backgroundState == ParentRelative) {
++		RootlessSetPixmapOfAncestors(pWin);
++	    }
++	}
++#endif
++
+ 	while (pWin->backgroundState == ParentRelative)
+ 	    pWin = pWin->parent;
+ 
+@@ -587,6 +601,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
+     {
+ 	PixmapPtr   pixmap;
+ 
++#ifdef ROOTLESS
++	if(IsFramedWindow(pWin)) {
++	    RootlessStartDrawing(pWin);
++	    RootlessDamageRegion(pWin, prgn);
++	    
++	    if(!pWin->borderIsPixel &&
++		pWin->backgroundState == ParentRelative) {
++		RootlessSetPixmapOfAncestors(pWin);
++	    }
++	}
++#endif
++
+ 	tile_x_off = drawable->x;
+ 	tile_y_off = drawable->y;
+ 	
+@@ -595,6 +621,12 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
+ 	    return;
+ 	pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
+ 	drawable = &pixmap->drawable;
++
++#ifdef XQUARTZ_CLIP_DEBUG
++	ErrorF("     Draw: %d %d %d %d\n",
++	       drawable->x, drawable->y, drawable->width, drawable->height);    
++#endif
++	
+ #ifdef COMPOSITE
+ 	draw_x_off = pixmap->screen_x;
+ 	draw_y_off = pixmap->screen_y;
+@@ -657,6 +689,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
+     ChangeGC (NullClient, pGC, gcmask, gcval);
+     ValidateGC (drawable, pGC);
+ 
++#ifdef XQUARTZ_CLIP_DEBUG
++    ErrorF("       GC: %d %d %d %d\n",
++	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
++	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
++	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
++#endif
++    
++#ifdef XQUARTZ
++    /* Looks like our clipping isn't set right for some reason:
++     * http://xquartz.macosforge.org/trac/ticket/290
++     */
++    if(what == PW_BORDER) {
++
++#if 0
++	if(solid) {
++#if 1
++	    fbFillRegionSolid(&pWin->drawable,
++			      prgn,
++			      0,
++			      fbReplicatePixel(fill.pixel,
++					       pWin->drawable.bitsPerPixel));
++#else
++	    fbFillRegionSolid(drawable,
++			      prgn,
++			      0,
++			      fbReplicatePixel(fill.pixel,
++					       drawable->bitsPerPixel));
++#endif
++	    return;
++	}
++#endif
++    
++	pGC->pCompositeClip->extents.x1 += prgn->extents.x1;
++	pGC->pCompositeClip->extents.y1 += prgn->extents.y1;
++	pGC->pCompositeClip->extents.x2 += prgn->extents.x1;
++	pGC->pCompositeClip->extents.y2 += prgn->extents.y1;
++	
++	if(pGC->pCompositeClip->extents.x2 > drawable->pScreen->width)
++	    pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
++	if(pGC->pCompositeClip->extents.y2 > drawable->pScreen->height)
++	    pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
++    }
++#endif
++
++#ifdef XQUARTZ_CLIP_DEBUG
++    ErrorF("       GC: %d %d %d %d\n",
++	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
++	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
++	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);    
++#endif
++
+     numRects = RegionNumRects(prgn);
+     pbox = RegionRects(prgn);
+     for (i= numRects; --i >= 0; pbox++, prect++)
+-- 
+1.5.6.6
+

Added: trunk/dports/x11/xorg-server-devel/files/0022-fb-Revert-fb-changes-that-broke-XQuartz.patch
===================================================================
--- trunk/dports/x11/xorg-server-devel/files/0022-fb-Revert-fb-changes-that-broke-XQuartz.patch	                        (rev 0)
+++ trunk/dports/x11/xorg-server-devel/files/0022-fb-Revert-fb-changes-that-broke-XQuartz.patch	2010-08-02 06:21:01 UTC (rev 70211)
@@ -0,0 +1,231 @@
+From e4ac2f7440bca8592dcc6d15e945ac64f17098d2 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu at apple.com>
+Date: Fri, 12 Feb 2010 19:48:52 -0800
+Subject: [PATCH] fb: Revert fb changes that broke XQuartz
+
+http://bugs.freedesktop.org/show_bug.cgi?id=26124
+
+Revert "Fix source pictures getting random transforms after 2d6a8f668342a5190cdf43b5."
+Revert "fb: Adjust transform or composite coordinates for pixman operations"
+
+http://bugs.freedesktop.org/26124
+
+This reverts commit a72c65e9176c51de95db2fdbf4c5d946a4911695.
+This reverts commit a6bd5d2e482a5aa84acb3d4932e2a166d8670ef1.
+
+Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
+---
+ fb/fb.h     |    7 +----
+ fb/fbpict.c |   72 ++++++++++++++++++-----------------------------------------
+ fb/fbtrap.c |    6 +---
+ 3 files changed, 26 insertions(+), 59 deletions(-)
+
+diff --git xorg-server-1.8.99.905/fb/fb.h xorg-server-1.8.99.905/fb/fb.h
+index a06f98b..3b9efea 100644
+--- xorg-server-1.8.99.905/fb/fb.h
++++ xorg-server-1.8.99.905/fb/fb.h
+@@ -2080,11 +2080,8 @@ fbFillRegionSolid (DrawablePtr	pDrawable,
+ 		   FbBits	xor);
+ 
+ extern _X_EXPORT pixman_image_t *
+-image_from_pict (PicturePtr	pict,
+-		 Bool		has_clip,
+-		 int		*xoff,
+-		 int		*yoff);
+-
++image_from_pict (PicturePtr pict,
++		 Bool       has_clip);
+ extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
+ 
+ #endif /* _FB_H_ */
+diff --git xorg-server-1.8.99.905/fb/fbpict.c xorg-server-1.8.99.905/fb/fbpict.c
+index 26cdc0d..f2ddb63 100644
+--- xorg-server-1.8.99.905/fb/fbpict.c
++++ xorg-server-1.8.99.905/fb/fbpict.c
+@@ -156,24 +156,19 @@ fbComposite (CARD8      op,
+ 	     CARD16     height)
+ {
+     pixman_image_t *src, *mask, *dest;
+-    int src_xoff, src_yoff;
+-    int msk_xoff, msk_yoff;
+-    int dst_xoff, dst_yoff;
+     
+     miCompositeSourceValidate (pSrc, xSrc - xDst, ySrc - yDst, width, height);
+     if (pMask)
+ 	miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, height);
+     
+-    src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
+-    mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
+-    dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
++    src = image_from_pict (pSrc, TRUE);
++    mask = image_from_pict (pMask, TRUE);
++    dest = image_from_pict (pDst, TRUE);
+ 
+     if (src && dest && !(pMask && !mask))
+     {
+ 	pixman_image_composite (op, src, mask, dest,
+-				xSrc + src_xoff, ySrc + src_yoff,
+-				xMask + msk_xoff, yMask + msk_yoff,
+-				xDst + dst_xoff, yDst + dst_yoff,
++				xSrc, ySrc, xMask, yMask, xDst, yDst,
+ 				width, height);
+     }
+ 
+@@ -271,22 +266,22 @@ create_conical_gradient_image (PictGradient *gradient)
+ 
+ static pixman_image_t *
+ create_bits_picture (PicturePtr pict,
+-		     Bool       has_clip,
+-		     int	*xoff,
+-		     int	*yoff)
++		     Bool       has_clip)
+ {
+-    PixmapPtr pixmap;
+     FbBits *bits;
+     FbStride stride;
+-    int bpp;
++    int bpp, xoff, yoff;
+     pixman_image_t *image;
+     
+-    fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
+-    fbGetPixmapBitsData(pixmap, bits, stride, bpp);
++    fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
++
++    bits = (FbBits*)((CARD8*)bits +
++		     (pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
++		     (pict->pDrawable->x + xoff) * (bpp / 8));
+ 
+     image = pixman_image_create_bits (
+ 	pict->format,
+-	pixmap->drawable.width, pixmap->drawable.height,
++	pict->pDrawable->width, pict->pDrawable->height,
+ 	(uint32_t *)bits, stride * sizeof (FbStride));
+     
+     
+@@ -312,52 +307,30 @@ create_bits_picture (PicturePtr pict,
+ 	if (pict->clientClipType != CT_NONE)
+ 	    pixman_image_set_has_client_clip (image, TRUE);
+ 
+-	if (*xoff || *yoff)
+-	    pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
++	pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
+ 
+ 	pixman_image_set_clip_region (image, pict->pCompositeClip);
+ 
+-	if (*xoff || *yoff)
+-	    pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
++	pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
+     }
+     
+     /* Indexed table */
+     if (pict->pFormat->index.devPrivate)
+ 	pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
+ 
+-    /* Add in drawable origin to position within the image */
+-    *xoff += pict->pDrawable->x;
+-    *yoff += pict->pDrawable->y;
+-
+     return image;
+ }
+ 
+ static void
+-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
++set_image_properties (pixman_image_t *image, PicturePtr pict)
+ {
+     pixman_repeat_t repeat;
+     pixman_filter_t filter;
+     
+     if (pict->transform)
+     {
+-	/* For source images, adjust the transform to account
+-	 * for the drawable offset within the pixman image,
+-	 * then set the offset to 0 as it will be used
+-	 * to compute positions within the transformed image.
+-	 */
+-	if (!has_clip) {
+-	    struct pixman_transform	adjusted;
+-
+-	    adjusted = *pict->transform;
+-	    pixman_transform_translate(&adjusted,
+-				       NULL,
+-				       pixman_int_to_fixed(*xoff),
+-				       pixman_int_to_fixed(*yoff));
+-	    pixman_image_set_transform (image, &adjusted);
+-	    *xoff = 0;
+-	    *yoff = 0;
+-	} else
+-	    pixman_image_set_transform (image, pict->transform);
++	pixman_image_set_transform (
++	    image, (pixman_transform_t *)pict->transform);
+     }
+     
+     switch (pict->repeatType)
+@@ -384,8 +357,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
+     
+     if (pict->alphaMap)
+     {
+-	int alpha_xoff, alpha_yoff;
+-	pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff);
++	pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, TRUE);
+ 	
+ 	pixman_image_set_alpha_map (
+ 	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
+@@ -418,7 +390,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
+ }
+ 
+ pixman_image_t *
+-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
++image_from_pict (PicturePtr pict,
++		 Bool has_clip)
+ {
+     pixman_image_t *image = NULL;
+ 
+@@ -427,7 +400,7 @@ image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+ 
+     if (pict->pDrawable)
+     {
+-	image = create_bits_picture (pict, has_clip, xoff, yoff);
++	image = create_bits_picture (pict, has_clip);
+     }
+     else if (pict->pSourcePict)
+     {
+@@ -448,11 +421,10 @@ image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+ 	    else if (sp->type == SourcePictTypeConical)
+ 		image = create_conical_gradient_image (gradient);
+ 	}
+-	*xoff = *yoff = 0;
+     }
+     
+     if (image)
+-	set_image_properties (image, pict, has_clip, xoff, yoff);
++	set_image_properties (image, pict);
+     
+     return image;
+ }
+diff --git xorg-server-1.8.99.905/fb/fbtrap.c xorg-server-1.8.99.905/fb/fbtrap.c
+index 9f5c39f..9c55236 100644
+--- xorg-server-1.8.99.905/fb/fbtrap.c
++++ xorg-server-1.8.99.905/fb/fbtrap.c
+@@ -38,8 +38,7 @@ fbAddTraps (PicturePtr	pPicture,
+ 	    int		ntrap,
+ 	    xTrap	*traps)
+ {
+-    int image_xoff, image_yoff;
+-    pixman_image_t *image = image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff);
++    pixman_image_t *image = image_from_pict (pPicture, FALSE);
+ 
+     if (!image)
+ 	return;
+@@ -55,8 +54,7 @@ fbRasterizeTrapezoid (PicturePtr    pPicture,
+ 		      int	    x_off,
+ 		      int	    y_off)
+ {
+-    int	mask_xoff, mask_yoff;
+-    pixman_image_t *image = image_from_pict (pPicture, FALSE, &mask_xoff, &mask_yoff);
++    pixman_image_t *image = image_from_pict (pPicture, FALSE);
+ 
+     if (!image)
+ 	return;
+-- 
+1.5.6.6
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100801/e2f8d935/attachment-0001.html>


More information about the macports-changes mailing list