[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'upstream-unstable'



 Xext/saver.c                   |    2 
 configure.ac                   |    5 +-
 dix/eventconvert.c             |    1 
 dix/events.c                   |   36 ++++++++++++++
 dix/extension.c                |    5 +-
 glx/glxcmdsswap.c              |    8 +--
 hw/kdrive/linux/evdev.c        |    2 
 hw/xfree86/common/xf86Init.c   |    2 
 hw/xfree86/ramdac/xf86Cursor.c |    7 ++
 hw/xquartz/GL/indirect.c       |    2 
 hw/xquartz/X11Application.m    |   25 +++++++++-
 hw/xquartz/pbproxy/Makefile.am |    6 +-
 hw/xquartz/pbproxy/app-main.m  |   12 +---
 hw/xquartz/pbproxy/main.m      |   43 +++++------------
 hw/xquartz/pbproxy/pbproxy.h   |    3 -
 hw/xquartz/pbproxy/x-input.m   |  100 +++++++++++++++++------------------------
 hw/xquartz/quartz.c            |   26 +++++++---
 hw/xquartz/quartzKeyboard.c    |    5 +-
 render/glyph.c                 |    3 +
 test/input.c                   |    4 +
 xkb/xkbUtils.c                 |    2 
 21 files changed, 176 insertions(+), 123 deletions(-)

New commits:
commit 501c0ee63570da7501d047c51c40a2568af1df08
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Apr 12 11:51:21 2010 +1000

    xserver 1.7.6.901
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 45de198..058ad01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.7.6, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2010-03-17"
+AC_INIT([xorg-server], 1.7.6.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2010-04-12"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2 foreign])
 AM_MAINTAINER_MODE

commit 8c0548bc34dead67bc944a59664be6254be928bd
Author: Tiago Vignatti <tiago.vignatti@nokia.com>
Date:   Thu Apr 1 18:57:50 2010 +0300

    xfree86: die gracefully in the vga arbiter if AddScreen fails
    
    vga arbiter will be locked in one device while AbortDDX will call LeaveVT
    routines from the other device. Fail!
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>
    (cherry picked from commit b9ad452ec92a7dcbed680acb3f3b8ec29fa660df)
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index d3de670..09741d7 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1245,7 +1245,9 @@ AbortDDX(void)
 	       * we might not have been wrapped yet. Therefore enable
 	       * screen explicitely.
 	       */
+	      xf86VGAarbiterLock(xf86Screens[i]);
 	      (xf86Screens[i]->LeaveVT)(i, 0);
+	      xf86VGAarbiterUnlock(xf86Screens[i]);
 	  }
   }
 

commit e7154e9375e6b624db01a787d9ec6c8cedc2eb81
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Mar 17 14:32:38 2010 +1000

    dix: if owner-events is true for passive grabs, add the window mask (#25400)
    
    A client requesting a GrabModeSync button grab, owner-events true, with only
    the ButtonRelease mask set would never receive the press event even if the
    grab window had the ButtonPress mask set.
    
    The protocol requires that if owner-events is true, then the delivery mask
    is the combination of the grab mask + the window event mask.
    
    X.Org Bug 25400 <http://bugs.freedesktop.org/show_bug.cgi?id=25400>
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Tested-by: Jim Ramsay <i.am@jimramsay.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>
    (cherry picked from commit 1c612acca8568fcdf9761d23f112adaf4d496f1b)
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/dix/events.c b/dix/events.c
index 3c625db..732740e 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3552,6 +3552,8 @@ CheckPassiveGrabsOnWindow(
                 xE = &core;
                 count = 1;
                 mask = grab->eventMask;
+                if (grab->ownerEvents)
+                    mask |= pWin->eventMask;
             } else if (match & XI2_MATCH)
             {
                 rc = EventToXI2((InternalEvent*)event, &xE);
@@ -3573,6 +3575,24 @@ CheckPassiveGrabsOnWindow(
                     mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
                 else if (event->type == XI_Enter || event->type == XI_FocusIn)
                     mask = grab->xi2mask[device->id][event->type/8];
+
+                if (grab->ownerEvents && wOtherInputMasks(grab->window))
+                {
+                    InputClientsPtr icp =
+                        wOtherInputMasks(grab->window)->inputClients;
+
+                    while(icp)
+                    {
+                        if (rClient(icp) == rClient(grab))
+                        {
+                            int evtype = (xE) ? ((xGenericEvent*)xE)->evtype : event->type;
+                            mask |= icp->xi2mask[device->id][evtype/8];
+                            break;
+                        }
+
+                        icp = icp->next;
+                    }
+                }
             } else
             {
                 rc = EventToXI((InternalEvent*)event, &xE, &count);
@@ -3584,6 +3604,22 @@ CheckPassiveGrabsOnWindow(
                     continue;
                 }
                 mask = grab->eventMask;
+                if (grab->ownerEvents && wOtherInputMasks(grab->window))
+                {
+                    InputClientsPtr icp =
+                        wOtherInputMasks(grab->window)->inputClients;
+
+                    while(icp)
+                    {
+                        if (rClient(icp) == rClient(grab))
+                        {
+                            mask |= icp->mask[device->id];
+                            break;
+                        }
+
+                        icp = icp->next;
+                    }
+                }
             }
 
 	    (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);

commit d33b3bf41b92e088e7aacbbcb01df18bae50baa8
Author: Michel Dänzer <daenzer@vmware.com>
Date:   Mon Mar 22 18:01:17 2010 +0100

    Xext: Fix cursor reference counting hazard.
    
    Make sure the reference count of the new cursor is increased before the old
    one is decreased, otherwise bad things will happen if they're one and the
    same and the reference count is 1 initially. Not sure this can actually happen
    here, but better safe than sorry.
    
    Signed-off-by: Michel Dänzer <daenzer@vmware.com>
    Reviewed-by: Roland Scheidegger <sroland@vmware.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>
    (cherry picked from commit 3083c5d0c4386cdd7083b7a83ac72fdad2f1e61e)
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/Xext/saver.c b/Xext/saver.c
index 04e6497..1f54a2c 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -618,10 +618,10 @@ CreateSaverWindow (ScreenPtr pScreen)
     	    	FreeResource (pWin->drawable.id, RT_NONE);
     	    	return FALSE;
 	    }
+	pAttr->pCursor->refcnt++;
 	if (pWin->optional->cursor)
 	    FreeCursor (pWin->optional->cursor, (Cursor)0);
 	pWin->optional->cursor = pAttr->pCursor;
-	pAttr->pCursor->refcnt++;
 	pWin->cursorIsNone = FALSE;
 	CheckWindowOptionalNeed (pWin);
 	mask |= CWCursor;

commit 4520d5cc5faccc5a3b623d4c7e61068431a927cc
Author: Mikhail Gusarov <dottedmag@dottedmag.net>
Date:   Tue Mar 23 01:03:53 2010 +0600

    kdrive: Bump evdev maxKeycode
    
    There are keycodes > 193 in evdev, e.g. KEY_WIMAX which is 246 .
    
    Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Acked-by: Adam Jackson <ajax@nwnk.net>
    Signed-off-by: Keith Packard <keithp@keithp.com>
    (cherry picked from commit e086b99c1f5ce351b578de7cd9f616bc79d6cf64)
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/hw/kdrive/linux/evdev.c b/hw/kdrive/linux/evdev.c
index 096a2dd..7953a75 100644
--- a/hw/kdrive/linux/evdev.c
+++ b/hw/kdrive/linux/evdev.c
@@ -362,7 +362,7 @@ readMapping (KdKeyboardInfo *ki)
         return;
 
     ki->minScanCode = 0;
-    ki->maxScanCode = 193;
+    ki->maxScanCode = 247;
 }
 
 static void

commit 48f8a7d1259a559b3cc774598b5d0d6edbc984bc
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Mar 22 09:20:49 2010 +1000

    configure: Always define XINPUT.
    
    This define was removed in e251c9e75afdc "Remove all traces of #ifdef XINPUT
    and the matching bits from the configure.ac". Drivers that support multiple
    server versions and still check for ifdef XINPUT now always build without
    XINPUT support if they're calling XORG_DRIVER_CHECK_EXT(XINPUT, inputproto).
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
    (cherry picked from commit 6389405b56d2221d8a7b80c4bb3bd3b4e1a29bab)
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 4a19ae4..45de198 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1078,6 +1078,7 @@ MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la'
 MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
 
 # XINPUT extension is integral part of the server
+AC_DEFINE(XINPUT, 1, [Support X Input extension])
 XI_LIB='$(top_builddir)/Xi/libXi.la'
 XI_INC='-I$(top_srcdir)/Xi'
 

commit 1130a0def920fdeb064cd5958d59ee2882a79d28
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date:   Tue Mar 23 10:37:36 2010 -0700

    XKB: Fix garbage initialization
    
    XkbEnableDisableControls set extra garbage bits on the xkbControlsNotify
    changedControls mask because it was uninitialized on the stack.
    
    Found by clang
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    (cherry picked from commit 8311cd5f89ca6781842bb24671b8122cdf8be148)
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 75e243c..30ec438 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -753,7 +753,7 @@ XkbSrvLedInfoPtr	sli;
     if (cause!=NULL) {
 	xkbControlsNotify cn;
 	cn.numGroups= ctrls->num_groups;
-	cn.changedControls|= XkbControlsEnabledMask;
+	cn.changedControls= XkbControlsEnabledMask;
 	cn.enabledControls= ctrls->enabled_ctrls;
 	cn.enabledControlChanges= (ctrls->enabled_ctrls^old);
 	cn.keycode= cause->kc;

commit ff5af4dc2d14c1bf2676f69e7dcee62eb9a08f78
Author: Paulo Ricardo Zanoni <pzanoni@mandriva.com>
Date:   Thu Mar 11 14:28:18 2010 -0300

    dix: be more verbose when we run out of opcodes
    
    If we run out of opcodes, nothing is print on the log, making the
    problem hard to debug. In the current Xserver, if you enable some
    extensions like multibuffer (+2 events) and use nvidia binary driver (+5
    events) you can run out of opcode numbers.
    
    Signed-off-by: Paulo Ricardo Zanoni <pzanoni@mandriva.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Julien Cristau <jcristau@debian.org>
    Signed-off-by: Keith Packard <keithp@keithp.com>
    (cherry picked from commit a9fe7cfa77ccee64d68732dc3f37d35cbfc27a65)
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/dix/extension.c b/dix/extension.c
index fb83af1..f348665 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -83,8 +83,11 @@ AddExtension(char *name, int NumEvents, int NumErrors,
     if (!MainProc || !SwappedMainProc || !MinorOpcodeProc)
         return((ExtensionEntry *) NULL);
     if ((lastEvent + NumEvents > LAST_EVENT) || 
-	        (unsigned)(lastError + NumErrors > LAST_ERROR))
+	        (unsigned)(lastError + NumErrors > LAST_ERROR)) {
+        LogMessage(X_ERROR, "Not enabling extension %s: maximum number of "
+                   "events or errors exceeded.\n", name);
         return((ExtensionEntry *) NULL);
+    }
 
     ext = xalloc(sizeof(ExtensionEntry));
     if (!ext)

commit 2350035463bcfb6d80249b55ce392a154a8d91da
Author: Pierre-Loup A. Griffais <pgriffais@nvidia.com>
Date:   Fri Apr 2 12:48:21 2010 -0700

    Don't keep a pointer to a possibly freed cursor when changing screens, preventing a crash in xf86CursorEnableDisableFBAccess() trying to restore it.
    
    Signed-off-by: Pierre-Loup A. Griffais <pgriffais@nvidia.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    (cherry picked from commit 6b09f66d8c6ebcee70382b5cca1ba82b68f20afa)
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index 7f23d9e..f5f0873 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -312,6 +312,7 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
             xf86SetCursor(pScreen, NullCursor, x, y);
             ScreenPriv->isUp = FALSE;
         }
+        ScreenPriv->CurrentCursor = NullCursor;
         return;
     }
 

commit 2297ad916a15a116e92f2549f59b222449f08b89
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Jan 8 15:18:41 2010 +1000

    dix: EventToCore needs to copy the root window too.
    
    This value isn't actually set for normal events but it saves us some work
    for the record extension support.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>
    (cherry picked from commit b4baab90c0d98bef98d485682d4a69a327a380d6)
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index e25f3ee..878dba5 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -119,6 +119,7 @@ EventToCore(InternalEvent *event, xEvent *core)
                 core->u.keyButtonPointer.rootX = e->root_x;
                 core->u.keyButtonPointer.rootY = e->root_y;
                 core->u.keyButtonPointer.state = e->corestate;
+                core->u.keyButtonPointer.root = e->root;
                 EventSetKeyRepeatFlag(core, (e->type == ET_KeyPress && e->key_repeat));
             }
             break;
diff --git a/test/input.c b/test/input.c
index 2de55bc..63d1a18 100644
--- a/test/input.c
+++ b/test/input.c
@@ -153,6 +153,7 @@ static void dix_event_to_core(int type)
     int rc;
     int state;
     int detail;
+    const int ROOT_WINDOW_ID = 0x100;
 
     /* EventToCore memsets the event to 0 */
 #define test_event() \
@@ -165,7 +166,7 @@ static void dix_event_to_core(int type)
     g_assert(core.u.keyButtonPointer.state == state); \
     g_assert(core.u.keyButtonPointer.eventX == 0); \
     g_assert(core.u.keyButtonPointer.eventY == 0); \
-    g_assert(core.u.keyButtonPointer.root == 0); \
+    g_assert(core.u.keyButtonPointer.root == ROOT_WINDOW_ID); \
     g_assert(core.u.keyButtonPointer.event == 0); \
     g_assert(core.u.keyButtonPointer.child == 0); \
     g_assert(core.u.keyButtonPointer.sameScreen == FALSE);
@@ -181,6 +182,7 @@ static void dix_event_to_core(int type)
     ev.time     = time;
     ev.root_y   = x;
     ev.root_x   = y;
+    ev.root     = ROOT_WINDOW_ID;
     ev.corestate = state;
     ev.detail.key = detail;
 

commit 49a2b55e0e1e265c1393c04c9df8e73f30dccd33
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Sun Mar 28 13:46:23 2010 -0700

    XQuartz: Re-query dixScreenOrigins as the value could've changed.
    
    Fix a regression in 9c9c3a85b094a3c7b2763a572715d710325091aa
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
    Acked-by: Adam Jackson <ajax@redhat.com>
    (cherry picked from commit 28a5f14b4089dccb8045cc4fdc923542a73dd22d)

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 59107be..a611854 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -268,8 +268,11 @@ void QuartzUpdateScreens(void) {
     DarwinAdjustScreenOrigins(&screenInfo);
     quartzProcs->UpdateScreen(pScreen);
     
-    sx = x + darwinMainScreenX;
-    sy = y + darwinMainScreenY;
+    /* DarwinAdjustScreenOrigins or UpdateScreen may change dixScreenOrigins,
+     * so use it rather than x/y
+     */
+    sx = dixScreenOrigins[pScreen->myNum].x + darwinMainScreenX;
+    sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY;
     
     /* Adjust the root window. */
     pRoot = WindowTable[pScreen->myNum];

commit 68319e7f0755a7d36ed1544214dceae0afa05b76
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Thu Mar 25 22:15:58 2010 -0700

    XQuartz: Workaround weird key data reported on some layouts
    
    This should make 'Unicode Hex Input' work as an input layout.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
    Acked-by: Adam Jackson <ajax@redhat.com>
    (cherry picked from commit 339207be6f184cc783076fc7e2cc12f92f57f2ba)

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index c9ef7cc..a4a0b08 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -735,7 +735,10 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
                     if (err != noErr) continue;
                 }
 
-                if (len > 0 && s[0] != 0x0010) {
+                /* Not sure why 0x0010 is there.
+                 * 0x0000 - <rdar://problem/7793566> 'Unicode Hex Input' ...
+                 */
+                if (len > 0 && s[0] != 0x0010 && s[0] != 0x0000) {
                     k[j] = ucs2keysym (s[0]);
                     if (dead_key_state != 0) k[j] = make_dead_key (k[j]);
                 }

commit 2ad8aae749fe08f139e3046e923da8233b9a7cd5
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Fri Mar 12 16:53:30 2010 +0100

    hw/xfree86: move reference counting out of the UseHWCursor[ARGB] functions
    
    The problem is that the xf86_use_hw_cursor(_argb) functions may get this
    correctly now, some drivers will replace these generic versions with their
    own functions. It is pretty insane to expect them to do reference counting
    of the cursor (as an example, look at driver/xf86-video-vmware to see how
    that looks like as a workaround). There are even places in xserver itself
    which replace these two functions.
    The segfaults if no reference counting is done are caused because the
    reference count of the cursor reached zero, hence the cursor was freed,
    however xf86CursorEnableDisableFBAccess() brought it back to life from
    the dead (from the SavedCursor).
    This patch hence adds reference counting in xf86CursorSetCursor. As per Michel
    Daenzer's suggestion, also free the cursor upon xf86CursorCloseScreen.
    In theory with this it should be possible to remove the reference
    counting in the UseHwCursor functions I think, though it should also be
    safe to keep them.
    
    Signed-off-by: Roland Scheidegger <sroland@vmware.com>
    Reviewed-by: Michel Dänzer <michel@daenzer.net>
    Signed-off-by: Keith Packard <keithp@keithp.com>
    (cherry picked from commit 67a8c659f25218904bae64aac6e98e326c90330b)

diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index 6b71f46..7f23d9e 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -129,6 +129,9 @@ xf86CursorCloseScreen(int i, ScreenPtr pScreen)
     if (ScreenPriv->isUp && pScrn->vtSema)
 	xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
 
+    if (ScreenPriv->CurrentCursor)
+	FreeCursor(ScreenPriv->CurrentCursor, None);
+
     pScreen->CloseScreen = ScreenPriv->CloseScreen;
     pScreen->QueryBestSize = ScreenPriv->QueryBestSize;
     pScreen->RecolorCursor = ScreenPriv->RecolorCursor;
@@ -317,6 +320,9 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
     if (pDev == inputInfo.pointer ||
         (!IsMaster(pDev) && pDev->u.master == inputInfo.pointer))
     {
+	pCurs->refcnt++;
+	if (ScreenPriv->CurrentCursor)
+	    FreeCursor(ScreenPriv->CurrentCursor, None);
 	ScreenPriv->CurrentCursor = pCurs;
 	ScreenPriv->x = x;
 	ScreenPriv->y = y;

commit e481a4912bc53a09429002b2bf8c321b516d236f
Author: Tomas Carnecky <tom@dbservice.com>
Date:   Mon Mar 22 11:20:15 2010 -0700

    Fix typos in the swap functions
    
    This should fix bug #3539.
    
    Signed-off-by: Tomas Carnecky <tom@dbservice.com>
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>
    (cherry picked from commit 0c2fde5c8ad6e94b4ed1588aa93256a2b64f74d9)

diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c
index f1c0ce6..c414dc8 100644
--- a/glx/glxcmdsswap.c
+++ b/glx/glxcmdsswap.c
@@ -354,7 +354,7 @@ int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
 {
-    xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) req;
+    xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
     __GLX_SWAP_INT(&req->pbuffer);
@@ -364,7 +364,7 @@ int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
 {
-    xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) req;
+    xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
     __GLX_SWAP_INT(&req->pbuffer);
@@ -375,7 +375,7 @@ int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
 int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
 {
     xGLXChangeDrawableAttributesReq *req =
-	(xGLXChangeDrawableAttributesReq *) req;
+	(xGLXChangeDrawableAttributesReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
     __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
     CARD32 *attribs;
@@ -392,7 +392,7 @@ int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl,
 					       GLbyte *pc)
 {
     xGLXChangeDrawableAttributesSGIXReq *req =
-	(xGLXChangeDrawableAttributesSGIXReq *) req;
+	(xGLXChangeDrawableAttributesSGIXReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
     __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
     CARD32 *attribs;

commit 2fa794f246b0224c458295a271a4246b52eb75c0
Author: Peter Harris <pharris@opentext.com>
Date:   Tue Mar 23 12:08:19 2010 -0400

    Fix crash when all glyphs of a given depth are freed, but not all glyphsets
    
    This is how the crash can be triggered with only two clients on the system:
    Client A: (already running)
    Client B: Connect
    Client B: CreateGlyphSet(depthN)
    Client A: Disconnect
    Server: free globalGlyphs(depthN)
    Client B: AddGlyphs(depthN)
    Server: SEGV
    
    This crash was introduced with the FindGlyphsByHash function
    in 516b96387b0e57b524a37a96da22dbeeeb041712. Before that revision,
    ResizeGlyphSet was always called before FindGlyphRef, which would
    re-create globalGlyphs(depthN) if necessary.
    
    X.Org Bug 20718 <http://bugs.freedesktop.org/show_bug.cgi?id=20718>
    
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Peter Harris <pharris@opentext.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>
    (cherry picked from commit 185185eeb44a277c324be0f58a4b4a469b56b69b)

diff --git a/render/glyph.c b/render/glyph.c
index 7fcdfd9..7282705 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -235,6 +235,9 @@ FindGlyphByHash (unsigned char sha1[20], int format)
     GlyphRefPtr gr;
     CARD32 signature = *(CARD32 *) sha1;
 
+    if (!globalGlyphs[format].hashSet)
+	return NULL;
+
     gr = FindGlyphRef (&globalGlyphs[format],
 		       signature, TRUE, sha1);
 

commit 4c85c3815a6f1698e91d2043d51a716948f8c1df
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Fri Mar 19 17:24:27 2010 -0700

    XQuartz: Constrain the pointer to the updated display bounds on display reconfigure.
    
    http://xquartz.macosforge.org/trac/ticket/346
    (cherry picked from commit ed31d50b5f7f25e4db986711699704e615b8afcb)

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 3c04205..59107be 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -241,6 +241,7 @@ void QuartzUpdateScreens(void) {
     WindowPtr pRoot;
     int x, y, width, height, sx, sy;
     xEvent e;
+    BoxRec bounds;
     
     if (noPseudoramiXExtension || screenInfo.numScreens != 1)
     {
@@ -277,8 +278,16 @@ void QuartzUpdateScreens(void) {
     //pScreen->PaintWindowBackground (pRoot, &pRoot->borderClip,  PW_BACKGROUND);
     miPaintWindow(pRoot, &pRoot->borderClip,  PW_BACKGROUND);
 
-//  TODO: This is a noop in 1.6 and nuked in master... we may need to do something else now to handle it
-//    DefineInitialRootWindow(pRoot);
+    /* <rdar://problem/7770779> pointer events are clipped to old display region after display reconfiguration
+     * http://xquartz.macosforge.org/trac/ticket/346
+     */
+    bounds.x1 = 0;
+    bounds.x2 = width;
+    bounds.y1 = 0;
+    bounds.y2 = height;
+    pScreen->ConstrainCursor(inputInfo.pointer, pScreen, &bounds);
+    inputInfo.pointer->spriteInfo->sprite->physLimits = bounds;
+    inputInfo.pointer->spriteInfo->sprite->hotLimits = bounds;
 
     DEBUG_LOG("Root Window: %dx%d @ (%d, %d) darwinMainScreen (%d, %d) xy (%d, %d) dixScreenOrigins (%d, %d)\n", width, height, x - sx, y - sy, darwinMainScreenX, darwinMainScreenY, x, y, dixScreenOrigins[pScreen->myNum].x, dixScreenOrigins[pScreen->myNum].y);
 

commit b226618f55a5393e32f339a963ae7aaf145c51a4
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date:   Sat Mar 20 11:03:28 2010 -0700

    XQuartz: pbproxy: Make standalone xpbproxy respect the launchd prefix
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
    (cherry picked from commit 38215cc43e4c012588c7a50344b8fe368d1252cc)

diff --git a/hw/xquartz/pbproxy/Makefile.am b/hw/xquartz/pbproxy/Makefile.am
index 02da6b2..1886642 100644
--- a/hw/xquartz/pbproxy/Makefile.am
+++ b/hw/xquartz/pbproxy/Makefile.am
@@ -1,5 +1,7 @@
-AM_CPPFLAGS=-F/System/Library/Frameworks/ApplicationServices.framework/Frameworks
-AM_CFLAGS=$(XPBPROXY_CFLAGS)
+AM_CPPFLAGS=-F/System/Library/Frameworks/ApplicationServices.framework/Frameworks \
+	-DLAUNCHD_ID_PREFIX=\"$(LAUNCHD_ID_PREFIX)\"
+
+AM_CFLAGS=$(XPBPROXY_CFLAGS) 
 
 noinst_LTLIBRARIES = libxpbproxy.la
 libxpbproxy_la_SOURCES = \
diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m
index b30dfb8..b00e90a 100644
--- a/hw/xquartz/pbproxy/app-main.m
+++ b/hw/xquartz/pbproxy/app-main.m
@@ -34,7 +34,7 @@
 #include <unistd.h> /*for getpid*/
 #include <Cocoa/Cocoa.h>
 
-static const char *app_prefs_domain = "org.x.X11";
+static const char *app_prefs_domain = 	LAUNCHD_ID_PREFIX".xpbproxy";
 CFStringRef app_prefs_domain_cfstr;
 
 /* Stubs */
@@ -73,7 +73,7 @@ int main (int argc, const char *argv[]) {
             printf("usage: xpbproxy OPTIONS\n"
                    "Pasteboard proxying for X11.\n\n"
                    "--prefs-domain <domain>   Change the domain used for reading preferences\n"
-                   "                          (default: org.x.X11)\n");
+                   "                          (default: %s)\n", app_prefs_domain);
             return 0;
         } else {
             fprintf(stderr, "usage: xpbproxy OPTIONS...\n"

commit 088777f2b683d61d948cf346564a73b048da1ea2
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date:   Sat Mar 20 03:28:57 2010 -0700

    XQuartz: xpbproxy: Cleanup xpbproxy threading
    
    Confine xpbproxy to a single thread
    Runs inside its own CFRunLoop
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
    (cherry picked from commit 69869d79f4c21eb385ff3c64bac649d93c7dd2ad)

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 3faa1cb..5406640 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -52,7 +52,7 @@
 #include <Xplugin.h>
 
 // pbproxy/pbproxy.h
-extern BOOL xpbproxy_init (void);
+extern int xpbproxy_run (void);
 
 #define DEFAULTS_FILE X11LIBDIR"/X11/xserver/Xquartz.plist"
 
@@ -908,6 +908,26 @@ environment the next time you start X11?", @"Startup xinitrc dialog");
     [X11App prefs_synchronize];
 }
 
+static inline pthread_t create_thread(void *func, void *arg) {
+    pthread_attr_t attr;
+    pthread_t tid;
+    
+    pthread_attr_init(&attr);
+    pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
+    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+    pthread_create(&tid, &attr, func, arg);
+    pthread_attr_destroy(&attr);
+    
+    return tid;
+}
+
+static void *xpbproxy_x_thread(void *args) {
+    xpbproxy_run();
+
+    fprintf(stderr, "xpbproxy thread is terminating unexpectedly.\n");
+    return NULL;
+}
+
 void X11ApplicationMain (int argc, char **argv, char **envp) {
     NSAutoreleasePool *pool;
 
@@ -962,8 +982,7 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
      */
     check_xinitrc();
     
-    if(!xpbproxy_init())
-        fprintf(stderr, "Error initializing xpbproxy\n");
+    create_thread(xpbproxy_x_thread, NULL);
 
 #if XQUARTZ_SPARKLE
     [[X11App controller] setup_sparkle];
diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m
index f3f683a..b30dfb8 100644
--- a/hw/xquartz/pbproxy/app-main.m
+++ b/hw/xquartz/pbproxy/app-main.m
@@ -84,16 +84,10 @@ int main (int argc, const char *argv[]) {
     
     app_prefs_domain_cfstr = CFStringCreateWithCString(NULL, app_prefs_domain, kCFStringEncodingUTF8);
     
-    if(!xpbproxy_init())
-        return EXIT_FAILURE;
-    
     signal (SIGINT, signal_handler);
     signal (SIGTERM, signal_handler);
     signal (SIGHUP, signal_handler);
     signal (SIGPIPE, SIG_IGN);
 
-    [NSApplication sharedApplication];
-    [NSApp run];
-    
-    return EXIT_SUCCESS;
+    return xpbproxy_run();
 }
diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m
index d26b1b1..560cf01 100644
--- a/hw/xquartz/pbproxy/main.m
+++ b/hw/xquartz/pbproxy/main.m
@@ -82,25 +82,12 @@ static int x_error_handler (Display *dpy, XErrorEvent *errevent) {
     return 0;
 }
 
-static inline pthread_t create_thread(void *func, void *arg) {
-    pthread_attr_t attr;
-    pthread_t tid;
-    
-    pthread_attr_init(&attr);
-    pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
-    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-    pthread_create(&tid, &attr, func, arg);
-    pthread_attr_destroy(&attr);
-    
-    return tid;
-}
-
-static void *xpbproxy_x_thread(void *args) {
+int xpbproxy_run (void) {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     size_t i;
-
+    
     wait_for_server_init();
-
+    
     for(i=0, xpbproxy_dpy=NULL; !xpbproxy_dpy && i<5; i++) {
         xpbproxy_dpy = XOpenDisplay(NULL);
         
@@ -108,7 +95,7 @@ static void *xpbproxy_x_thread(void *args) {
             char _display[32];
             snprintf(_display, sizeof(_display), ":%s", display);
             setenv("DISPLAY", _display, TRUE);
-
+            
             xpbproxy_dpy=XOpenDisplay(_display);
         }
         if(!xpbproxy_dpy)
@@ -118,7 +105,7 @@ static void *xpbproxy_x_thread(void *args) {
     if (xpbproxy_dpy == NULL) {
         fprintf (stderr, "xpbproxy: can't open default display\n");
         [pool release];
-        return NULL;
+        return EXIT_FAILURE;
     }
     
     XSetIOErrorHandler (x_io_error_handler);
@@ -128,11 +115,11 @@ static void *xpbproxy_x_thread(void *args) {
                                  &xpbproxy_apple_wm_error_base)) {
         fprintf (stderr, "xpbproxy: can't open AppleWM server extension\n");
         [pool release];
-        return NULL;
+        return EXIT_FAILURE;
     }
-    
+
     xpbproxy_have_xfixes = XFixesQueryExtension(xpbproxy_dpy, &xpbproxy_xfixes_event_base, &xpbproxy_xfixes_error_base);
-    
+
     XAppleWMSelectInput (xpbproxy_dpy, AppleWMActivationNotifyMask |
                          AppleWMPasteboardNotifyMask);
     
@@ -140,18 +127,14 @@ static void *xpbproxy_x_thread(void *args) {
     
     if(!xpbproxy_input_register()) {
         [pool release];
-        return NULL;
+        return EXIT_FAILURE;
     }
-
+    
     [pool release];
- 
-    xpbproxy_input_loop();
-    return NULL;
-}
+    
+    CFRunLoopRun();
 
-BOOL xpbproxy_init (void) {
-    create_thread(xpbproxy_x_thread, NULL);
-    return TRUE;
+    return EXIT_SUCCESS;
 }
 
 id xpbproxy_selection_object (void) {
diff --git a/hw/xquartz/pbproxy/pbproxy.h b/hw/xquartz/pbproxy/pbproxy.h
index a6798ef..013f981 100644
--- a/hw/xquartz/pbproxy/pbproxy.h
+++ b/hw/xquartz/pbproxy/pbproxy.h
@@ -67,7 +67,7 @@ extern void xpbproxy_set_is_active (BOOL state);
 extern BOOL xpbproxy_get_is_active (void);
 extern id xpbproxy_selection_object (void);
 extern Time xpbproxy_current_timestamp (void);
-extern BOOL xpbproxy_init (void);
+extern int xpbproxy_run (void);
 
 extern Display *xpbproxy_dpy;
 extern int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base;
@@ -76,7 +76,6 @@ extern BOOL xpbproxy_have_xfixes;
 
 /* from x-input.m */
 extern BOOL xpbproxy_input_register (void);
-extern void xpbproxy_input_loop();
 
 #ifdef DEBUG
 /* BEWARE: this can cause a string memory leak, according to the leaks program. */
diff --git a/hw/xquartz/pbproxy/x-input.m b/hw/xquartz/pbproxy/x-input.m
index 6ba30c6..405ba3c 100644
--- a/hw/xquartz/pbproxy/x-input.m
+++ b/hw/xquartz/pbproxy/x-input.m
@@ -39,17 +39,12 @@
 
 #include <unistd.h>
 
-#include <pthread.h>
-
 static CFRunLoopSourceRef xpbproxy_dpy_source;
 
 #ifdef STANDALONE_XPBPROXY
 BOOL xpbproxy_prefs_reload = NO;
 #endif
 
-static pthread_mutex_t xpbproxy_dpy_rdy_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t xpbproxy_dpy_rdy_cond = PTHREAD_COND_INITIALIZER;
-
 /* Timestamp when the X server last told us it's active */
 static Time last_activation_time;
 
@@ -88,58 +83,51 @@ static void x_event_apple_wm_notify(XAppleWMNotifyEvent *e) {
     }
 }
 
-void xpbproxy_input_loop() {
-    pthread_mutex_lock(&xpbproxy_dpy_rdy_lock);
-    while(true) {
-        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+static void xpbproxy_process_xevents(void) {
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    
+    if(pool == nil) {
+        fprintf(stderr, "unable to allocate/init auto release pool!\n");
+        return;
+    }
+    
+    while (XPending(xpbproxy_dpy) != 0) {
+        XEvent e;
         
-        if(pool == nil) {
-            fprintf(stderr, "unable to allocate/init auto release pool!\n");
-            break;
-        }
+        XNextEvent (xpbproxy_dpy, &e);
         
-        while (XPending(xpbproxy_dpy) != 0) {
-            XEvent e;
-            
-            pthread_mutex_unlock(&xpbproxy_dpy_rdy_lock);
-            XNextEvent (xpbproxy_dpy, &e);
-            
-            switch (e.type) {                
-                case SelectionClear:
-                    if([xpbproxy_selection_object() is_active])
-                        [xpbproxy_selection_object () clear_event:&e.xselectionclear];
-                    break;
-                    
-                case SelectionRequest:
-                    [xpbproxy_selection_object () request_event:&e.xselectionrequest];
-                    break;
-                    
-                case SelectionNotify:
-                    [xpbproxy_selection_object () notify_event:&e.xselection];
-                    break;
-                    
-                case PropertyNotify:
-                    [xpbproxy_selection_object () property_event:&e.xproperty];
-                    break;
-                    
-                default:
-                    if(e.type >= xpbproxy_apple_wm_event_base &&
-                       e.type < xpbproxy_apple_wm_event_base + AppleWMNumberEvents) {
-                        x_event_apple_wm_notify((XAppleWMNotifyEvent *) &e);
-                    } else if(e.type == xpbproxy_xfixes_event_base + XFixesSelectionNotify) {
-                        [xpbproxy_selection_object() xfixes_selection_notify:(XFixesSelectionNotifyEvent *)&e];
-                    }
-                    break;
-            }
-            
-            XFlush(xpbproxy_dpy);
-            pthread_mutex_lock(&xpbproxy_dpy_rdy_lock);
+        switch (e.type) {                
+            case SelectionClear:
+                if([xpbproxy_selection_object() is_active])
+                    [xpbproxy_selection_object () clear_event:&e.xselectionclear];
+                break;
+                
+            case SelectionRequest:
+                [xpbproxy_selection_object () request_event:&e.xselectionrequest];
+                break;
+                
+            case SelectionNotify:
+                [xpbproxy_selection_object () notify_event:&e.xselection];
+                break;
+                
+            case PropertyNotify:
+                [xpbproxy_selection_object () property_event:&e.xproperty];
+                break;


Reply to: