aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libxcb/src/xcb_util.c36
-rw-r--r--xorg-server/Xext/panoramiX.c3
-rw-r--r--xorg-server/Xext/panoramiX.h13
-rw-r--r--xorg-server/Xext/panoramiXprocs.c2
-rw-r--r--xorg-server/Xext/shape.c6
-rw-r--r--xorg-server/dix/events.c1
-rw-r--r--xorg-server/dix/main.c4
-rw-r--r--xorg-server/exa/exa_unaccel.c8
-rw-r--r--xorg-server/hw/xfree86/common/xf86RandR.c4
-rw-r--r--xorg-server/mi/midispcur.c269
-rw-r--r--xorg-server/mi/miinitext.c3
11 files changed, 149 insertions, 200 deletions
diff --git a/libxcb/src/xcb_util.c b/libxcb/src/xcb_util.c
index 2980cb8d0..78bab5c5d 100644
--- a/libxcb/src/xcb_util.c
+++ b/libxcb/src/xcb_util.c
@@ -28,6 +28,7 @@
#include <assert.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <limits.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -70,7 +71,14 @@ static int _xcb_parse_display(const char *name, char **host, char **protocol,
name = getenv("DISPLAY");
if(!name)
return 0;
+
+#ifdef HAVE_LAUNCHD
+ if(strncmp(name, "/tmp/launch", 11) == 0)
+ slash = NULL;
+ else
+#endif
slash = strrchr(name, '/');
+
if (slash) {
len = slash - name;
if (protocol) {
@@ -138,12 +146,19 @@ static int _xcb_open(char *host, char *protocol, const int display)
#ifdef HAVE_ABSTRACT_SOCKETS
int fd;
#endif
- static const char base[] = "/tmp/.X11-unix/X";
- char file[sizeof(base) + 20];
+ static const char unix_base[] = "/tmp/.X11-unix/X";
+ const char *base = unix_base;
+ char file[PATH_MAX + 1];
int filelen;
if(*host)
{
+#ifdef HAVE_LAUNCHD
+ if(strncmp(host, "/tmp/launch", 11) == 0) {
+ base = host;
+ } else {
+#endif
+
#ifdef DNETCONN
/* DECnet displays have two colons, so _xcb_parse_display will have
left one at the end. However, an IPv6 address can end with *two*
@@ -164,10 +179,18 @@ static int _xcb_open(char *host, char *protocol, const int display)
unsigned short port = X_TCP_PORT + display;
return _xcb_open_tcp(host, protocol, port);
}
+#ifdef HAVE_LAUNCHD
+ }
+#endif
}
/* display specifies Unix socket */
- filelen = snprintf(file, sizeof(file), "%s%d", base, display);
+#ifdef HAVE_LAUNCHD
+ if(base == host)
+ filelen = snprintf(file, sizeof(file), "%s:%d", base, display);
+ else
+#endif
+ filelen = snprintf(file, sizeof(file), "%s%d", base, display);
if(filelen < 0)
return -1;
/* snprintf may truncate the file */
@@ -363,13 +386,6 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname,
int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp);
-#ifdef HAVE_LAUNCHD
- if(!displayname)
- displayname = getenv("DISPLAY");
- if(displayname && strlen(displayname)>11 && !strncmp(displayname, "/tmp/launch", 11))
- fd = _xcb_open_unix(NULL, displayname);
- else
-#endif
if(!parsed)
return (xcb_connection_t *) &error_connection;
else
diff --git a/xorg-server/Xext/panoramiX.c b/xorg-server/Xext/panoramiX.c
index 96eb8f9e1..d5965c2d0 100644
--- a/xorg-server/Xext/panoramiX.c
+++ b/xorg-server/Xext/panoramiX.c
@@ -476,7 +476,8 @@ void PanoramiXExtensionInit(int argc, char *argv[])
panoramiXdataPtr = (PanoramiXData *)
xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData));
- BREAK_IF(!panoramiXdataPtr);
+ if (!panoramiXdataPtr)
+ break;
if (!dixRequestPrivate(PanoramiXGCKey, sizeof(PanoramiXGCRec))) {
noPanoramiXExtension = TRUE;
diff --git a/xorg-server/Xext/panoramiX.h b/xorg-server/Xext/panoramiX.h
index 463a99441..35de17951 100644
--- a/xorg-server/Xext/panoramiX.h
+++ b/xorg-server/Xext/panoramiX.h
@@ -80,19 +80,6 @@ typedef struct {
#define FOR_NSCREENS_BACKWARD(j) for(j = PanoramiXNumScreens - 1; j >= 0; j--)
#define FOR_NSCREENS(j) FOR_NSCREENS_FORWARD(j)
-#define BREAK_IF(a) if ((a)) break
-#define IF_RETURN(a,b) if ((a)) return (b)
-
-#define FORCE_ROOT(a) { \
- int _j; \
- for (_j = PanoramiXNumScreens - 1; _j; _j--) \
- if ((a).root == WindowTable[_j]->drawable.id) \
- break; \
- (a).rootX += panoramiXdataPtr[_j].x; \
- (a).rootY += panoramiXdataPtr[_j].y; \
- (a).root = WindowTable[0]->drawable.id; \
-}
-
#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)
#endif /* _PANORAMIX_H_ */
diff --git a/xorg-server/Xext/panoramiXprocs.c b/xorg-server/Xext/panoramiXprocs.c
index 6834efb71..6635db905 100644
--- a/xorg-server/Xext/panoramiXprocs.c
+++ b/xorg-server/Xext/panoramiXprocs.c
@@ -1728,7 +1728,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
- IF_RETURN((narcs % sizeof(xArc)), BadLength);
+ if (narcs % sizeof(xArc)) return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0) {
origArcs = xalloc(narcs * sizeof(xArc));
diff --git a/xorg-server/Xext/shape.c b/xorg-server/Xext/shape.c
index 85cc9b932..3a7dad5d7 100644
--- a/xorg-server/Xext/shape.c
+++ b/xorg-server/Xext/shape.c
@@ -367,7 +367,7 @@ ProcPanoramiXShapeRectangles(
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
result = ProcShapeRectangles (client);
- BREAK_IF(result != Success);
+ if (result != Success) break;
}
return (result);
}
@@ -476,7 +476,7 @@ ProcPanoramiXShapeMask(
if(pmap)
stuff->src = pmap->info[j].id;
result = ProcShapeMask (client);
- BREAK_IF(result != Success);
+ if (result != Success) break;
}
return (result);
}
@@ -602,7 +602,7 @@ ProcPanoramiXShapeCombine(
stuff->dest = win->info[j].id;
stuff->src = win2->info[j].id;
result = ProcShapeCombine (client);
- BREAK_IF(result != Success);
+ if (result != Success) break;
}
return (result);
}
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 1d0d5b280..bfe6a8c42 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -5358,7 +5358,6 @@ ProcGrabButton(ClientPtr client)
rc = dixLookupResourceByType((pointer *)&cursor, stuff->cursor, RT_CURSOR,
client, DixUseAccess);
if (rc != Success)
- if (!cursor)
{
client->errorValue = stuff->cursor;
return (rc == BadValue) ? BadCursor : rc;
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index 54cd8a919..923dbe99a 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -205,9 +205,7 @@ int main(int argc, char *argv[], char *envp[])
ScreenSaverBlanking = defaultScreenSaverBlanking;
ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
#ifdef DPMSExtension
- DPMSStandbyTime = DEFAULT_SCREEN_SAVER_TIME;
- DPMSSuspendTime = DEFAULT_SCREEN_SAVER_TIME;
- DPMSOffTime = DEFAULT_SCREEN_SAVER_TIME;
+ DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
DPMSEnabled = TRUE;
DPMSPowerLevel = 0;
#endif
diff --git a/xorg-server/exa/exa_unaccel.c b/xorg-server/exa/exa_unaccel.c
index 6345f6b59..f6d74f11b 100644
--- a/xorg-server/exa/exa_unaccel.c
+++ b/xorg-server/exa/exa_unaccel.c
@@ -462,9 +462,11 @@ ExaSrcValidate(DrawablePtr pDrawable,
REGION_UNION(pScreen, dst, dst, &reg);
REGION_UNINIT(pScreen, &reg);
- swap(pExaScr, pScreen, SourceValidate);
- pScreen->SourceValidate(pDrawable, x, y, width, height);
- swap(pExaScr, pScreen, SourceValidate);
+ if (pExaScr->SavedSourceValidate) {
+ swap(pExaScr, pScreen, SourceValidate);
+ pScreen->SourceValidate(pDrawable, x, y, width, height);
+ swap(pExaScr, pScreen, SourceValidate);
+ }
}
static Bool
diff --git a/xorg-server/hw/xfree86/common/xf86RandR.c b/xorg-server/hw/xfree86/common/xf86RandR.c
index 02dcc34b4..d4beb2ce2 100644
--- a/xorg-server/hw/xfree86/common/xf86RandR.c
+++ b/xorg-server/hw/xfree86/common/xf86RandR.c
@@ -163,7 +163,7 @@ xf86RandRSetMode (ScreenPtr pScreen,
WindowPtr pRoot = WindowTable[pScreen->myNum];
Bool ret = TRUE;
- if (pRoot)
+ if (pRoot && scrp->vtSema)
(*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
if (useVirtual)
{
@@ -229,7 +229,7 @@ xf86RandRSetMode (ScreenPtr pScreen,
*/
xf86SetViewport (pScreen, pScreen->width, pScreen->height);
xf86SetViewport (pScreen, 0, 0);
- if (pRoot)
+ if (pRoot && scrp->vtSema)
(*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
return ret;
}
diff --git a/xorg-server/mi/midispcur.c b/xorg-server/mi/midispcur.c
index 3fb7e02b5..904163091 100644
--- a/xorg-server/mi/midispcur.c
+++ b/xorg-server/mi/midispcur.c
@@ -59,9 +59,9 @@ static DevPrivateKey miDCScreenKey = &miDCScreenKeyIndex;
static Bool miDCCloseScreen(int index, ScreenPtr pScreen);
-/* per device private data */
-static int miDCSpriteKeyIndex;
-static DevPrivateKey miDCSpriteKey = &miDCSpriteKeyIndex;
+/* per device per-screen private data */
+static int miDCSpriteKeyIndex[MAXSCREENS];
+static DevPrivateKey miDCSpriteKey = miDCSpriteKeyIndex;
typedef struct {
GCPtr pSourceGC, pMaskGC;
@@ -75,10 +75,10 @@ typedef struct {
#endif
} miDCBufferRec, *miDCBufferPtr;
-#define MIDCBUFFER(dev) \
+#define MIDCBUFFER(dev, screen) \
((DevHasCursor(dev)) ? \
- (miDCBufferPtr)dixLookupPrivate(&dev->devPrivates, miDCSpriteKey) : \
- (miDCBufferPtr)dixLookupPrivate(&dev->u.master->devPrivates, miDCSpriteKey))
+ (miDCBufferPtr)dixLookupPrivate(&dev->devPrivates, miDCSpriteKey + (screen)->myNum) : \
+ (miDCBufferPtr)dixLookupPrivate(&dev->u.master->devPrivates, miDCSpriteKey + (screen)->myNum))
/*
* The core pointer buffer will point to the index of the virtual core pointer
@@ -158,10 +158,6 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
return TRUE;
}
-#define tossGC(gc) (gc ? FreeGC (gc, (GContext) 0) : 0)
-#define tossPix(pix) (pix ? (*pScreen->DestroyPixmap) (pix) : TRUE)
-#define tossPict(pict) (pict ? FreePicture (pict, 0) : 0)
-
static Bool
miDCCloseScreen (int index, ScreenPtr pScreen)
{
@@ -183,7 +179,6 @@ miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
}
#ifdef ARGB_CURSOR
-#define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win))
static VisualPtr
miDCGetWindowVisual (WindowPtr pWin)
@@ -415,12 +410,8 @@ miDCPutBits (
(*maskGC->ops->PushPixels) (maskGC, pPriv->maskBits, pDrawable, w, h, x, y);
}
-#define EnsureGC(gc,win) (gc || miDCMakeGC(&gc, win))
-
static GCPtr
-miDCMakeGC(
- GCPtr *ppGC,
- WindowPtr pWin)
+miDCMakeGC(WindowPtr pWin)
{
GCPtr pGC;
int status;
@@ -431,7 +422,6 @@ miDCMakeGC(
pGC = CreateGC((DrawablePtr)pWin,
GCSubwindowMode|GCGraphicsExposures, gcvals, &status,
(XID)0, serverClient);
- *ppGC = pGC;
return pGC;
}
@@ -456,22 +446,11 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
pWin = WindowTable[pScreen->myNum];
- pBuffer = MIDCBUFFER(pDev);
+ pBuffer = MIDCBUFFER(pDev, pScreen);
#ifdef ARGB_CURSOR
if (pPriv->pPicture)
{
- /* see comment in miDCPutUpCursor */
- if (pBuffer->pRootPicture &&
- pBuffer->pRootPicture->pDrawable &&
- pBuffer->pRootPicture->pDrawable->pScreen != pScreen)
- {
- tossPict(pBuffer->pRootPicture);
- pBuffer->pRootPicture = NULL;
- }
-
- if (!EnsurePicture(pBuffer->pRootPicture, &pWin->drawable, pWin))
- return FALSE;
CompositePicture (PictOpOver,
pPriv->pPicture,
NULL,
@@ -484,33 +463,6 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
else
#endif
{
- /**
- * XXX: Before MPX, the sourceGC and maskGC were attached to the
- * screen, and would switch as the screen switches. With mpx we have
- * the GC's attached to the device now, so each time we switch screen
- * we need to make sure the GC's are allocated on the new screen.
- * This is ... not optimal. (whot)
- */
- if (pBuffer->pSourceGC && pScreen != pBuffer->pSourceGC->pScreen)
- {
- tossGC(pBuffer->pSourceGC);
- pBuffer->pSourceGC = NULL;
- }
-
- if (pBuffer->pMaskGC && pScreen != pBuffer->pMaskGC->pScreen)
- {
- tossGC(pBuffer->pMaskGC);
- pBuffer->pMaskGC = NULL;
- }
-
- if (!EnsureGC(pBuffer->pSourceGC, pWin))
- return FALSE;
- if (!EnsureGC(pBuffer->pMaskGC, pWin))
- {
- FreeGC (pBuffer->pSourceGC, (GContext) 0);
- pBuffer->pSourceGC = 0;
- return FALSE;
- }
miDCPutBits ((DrawablePtr)pWin, pPriv,
pBuffer->pSourceGC, pBuffer->pMaskGC,
x, y, pCursor->bits->width, pCursor->bits->height,
@@ -531,7 +483,7 @@ miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev);
+ pBuffer = MIDCBUFFER(pDev, pScreen);
pSave = pBuffer->pSave;
pWin = WindowTable[pScreen->myNum];
@@ -544,14 +496,7 @@ miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
if (!pSave)
return FALSE;
}
- /* see comment in miDCPutUpCursor */
- if (pBuffer->pSaveGC && pBuffer->pSaveGC->pScreen != pScreen)
- {
- tossGC(pBuffer->pSaveGC);
- pBuffer->pSaveGC = NULL;
- }
- if (!EnsureGC(pBuffer->pSaveGC, pWin))
- return FALSE;
+
pGC = pBuffer->pSaveGC;
if (pSave->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pSave, pGC);
@@ -572,20 +517,13 @@ miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev);
+ pBuffer = MIDCBUFFER(pDev, pScreen);
pSave = pBuffer->pSave;
pWin = WindowTable[pScreen->myNum];
if (!pSave)
return FALSE;
- /* see comment in miDCPutUpCursor */
- if (pBuffer->pRestoreGC && pBuffer->pRestoreGC->pScreen != pScreen)
- {
- tossGC(pBuffer->pRestoreGC);
- pBuffer->pRestoreGC = NULL;
- }
- if (!EnsureGC(pBuffer->pRestoreGC, pWin))
- return FALSE;
+
pGC = pBuffer->pRestoreGC;
if (pWin->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pWin, pGC);
@@ -607,7 +545,7 @@ miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev);
+ pBuffer = MIDCBUFFER(pDev, pScreen);
pSave = pBuffer->pSave;
pWin = WindowTable[pScreen->myNum];
@@ -616,14 +554,7 @@ miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen,
*/
if (!pSave)
return FALSE;
- /* see comment in miDCPutUpCursor */
- if (pBuffer->pRestoreGC && pBuffer->pRestoreGC->pScreen != pScreen)
- {
- tossGC(pBuffer->pRestoreGC);
- pBuffer->pRestoreGC = NULL;
- }
- if (!EnsureGC(pBuffer->pRestoreGC, pWin))
- return FALSE;
+
pGC = pBuffer->pRestoreGC;
if (pWin->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pWin, pGC);
@@ -662,14 +593,7 @@ miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen,
(*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC,
0, sourcey, -dx, copyh, x + dx, desty);
}
- /* see comment in miDCPutUpCursor */
- if (pBuffer->pSaveGC && pBuffer->pSaveGC->pScreen != pScreen)
- {
- tossGC(pBuffer->pSaveGC);
- pBuffer->pSaveGC = NULL;
- }
- if (!EnsureGC(pBuffer->pSaveGC, pWin))
- return FALSE;
+
pGC = pBuffer->pSaveGC;
if (pSave->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pSave, pGC);
@@ -766,7 +690,7 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
pWin = WindowTable[pScreen->myNum];
- pBuffer = MIDCBUFFER(pDev);
+ pBuffer = MIDCBUFFER(pDev, pScreen);
pTemp = pBuffer->pTemp;
if (!pTemp ||
@@ -809,17 +733,9 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
#ifdef ARGB_CURSOR
if (pPriv->pPicture)
{
- /* see comment in miDCPutUpCursor */
- if (pBuffer->pTempPicture &&
- pBuffer->pTempPicture->pDrawable &&
- pBuffer->pTempPicture->pDrawable->pScreen != pScreen)
- {
- tossPict(pBuffer->pTempPicture);
- pBuffer->pTempPicture = NULL;
- }
+ if (!pBuffer->pTempPicture)
+ miDCMakePicture(&pBuffer->pTempPicture, &pTemp->drawable, pWin);
- if (!EnsurePicture(pBuffer->pTempPicture, &pTemp->drawable, pWin))
- return FALSE;
CompositePicture (PictOpOver,
pPriv->pPicture,
NULL,
@@ -832,38 +748,12 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
else
#endif
{
- if (!pBuffer->pPixSourceGC)
- {
- pBuffer->pPixSourceGC = CreateGC ((DrawablePtr)pTemp,
- GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pBuffer->pPixSourceGC)
- return FALSE;
- }
- if (!pBuffer->pPixMaskGC)
- {
- pBuffer->pPixMaskGC = CreateGC ((DrawablePtr)pTemp,
- GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pBuffer->pPixMaskGC)
- return FALSE;
- }
miDCPutBits ((DrawablePtr)pTemp, pPriv,
pBuffer->pPixSourceGC, pBuffer->pPixMaskGC,
dx, dy, pCursor->bits->width, pCursor->bits->height,
source, mask);
}
- /* see comment in miDCPutUpCursor */
- if (pBuffer->pRestoreGC && pBuffer->pRestoreGC->pScreen != pScreen)
- {
- tossGC(pBuffer->pRestoreGC);
- pBuffer->pRestoreGC = NULL;
- }
- /*
- * copy the temporary pixmap onto the screen
- */
-
- if (!EnsureGC(pBuffer->pRestoreGC, pWin))
- return FALSE;
pGC = pBuffer->pRestoreGC;
if (pWin->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pWin, pGC);
@@ -877,51 +767,108 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
static Bool
miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- miDCBufferPtr pBuffer;
-
- pBuffer = xalloc(sizeof(miDCBufferRec));
- dixSetPrivate(&pDev->devPrivates, miDCSpriteKey, pBuffer);
-
- pBuffer->pSourceGC =
- pBuffer->pMaskGC =
- pBuffer->pSaveGC =
- pBuffer->pRestoreGC =
- pBuffer->pMoveGC =
- pBuffer->pPixSourceGC =
- pBuffer->pPixMaskGC = NULL;
+ miDCBufferPtr pBuffer;
+ WindowPtr pWin;
+ XID gcval = FALSE;
+ int status;
+ int i;
+
+ if (!DevHasCursor(pDev))
+ return TRUE;
+
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+
+ pBuffer = xalloc(sizeof(miDCBufferRec));
+ if (!pBuffer)
+ goto failure;
+
+ dixSetPrivate(&pDev->devPrivates, miDCSpriteKey + pScreen->myNum, pBuffer);
+ pWin = WindowTable[pScreen->myNum];
+
+ pBuffer->pSourceGC = miDCMakeGC(pWin);
+ if (!pBuffer->pSourceGC)
+ goto failure;
+
+ pBuffer->pMaskGC = miDCMakeGC(pWin);
+ if (!pBuffer->pMaskGC)
+ goto failure;
+
+ pBuffer->pSaveGC = miDCMakeGC(pWin);
+ if (!pBuffer->pSaveGC)
+ goto failure;
+
+ pBuffer->pRestoreGC = miDCMakeGC(pWin);
+ if (!pBuffer->pRestoreGC)
+ goto failure;
+
+ pBuffer->pMoveGC = CreateGC ((DrawablePtr)pWin,
+ GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
+ if (!pBuffer->pMoveGC)
+ goto failure;
+
+ pBuffer->pPixSourceGC = CreateGC ((DrawablePtr)pWin,
+ GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
+ if (!pBuffer->pPixSourceGC)
+ goto failure;
+
+ pBuffer->pPixMaskGC = CreateGC ((DrawablePtr)pWin,
+ GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
+ if (!pBuffer->pPixMaskGC)
+ goto failure;
+
#ifdef ARGB_CURSOR
- pBuffer->pRootPicture = NULL;
- pBuffer->pTempPicture = NULL;
+ miDCMakePicture(&pBuffer->pRootPicture, &pWin->drawable, pWin);
+ if (!pBuffer->pRootPicture)
+ goto failure;
+
+ pBuffer->pTempPicture = NULL;
#endif
- pBuffer->pSave = pBuffer->pTemp = NULL;
+
+ // these get (re)allocated lazily depending on the cursor size
+ pBuffer->pSave = pBuffer->pTemp = NULL;
+ }
return TRUE;
+
+failure:
+
+ miDCDeviceCleanup(pDev, pScreen);
+
+ return FALSE;
}
static void
miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
miDCBufferPtr pBuffer;
+ int i;
if (DevHasCursor(pDev))
{
- pBuffer = MIDCBUFFER(pDev);
- tossGC (pBuffer->pSourceGC);
- tossGC (pBuffer->pMaskGC);
- tossGC (pBuffer->pSaveGC);
- tossGC (pBuffer->pRestoreGC);
- tossGC (pBuffer->pMoveGC);
- tossGC (pBuffer->pPixSourceGC);
- tossGC (pBuffer->pPixMaskGC);
- tossPix (pBuffer->pSave);
- tossPix (pBuffer->pTemp);
-#ifdef ARGB_CURSOR
-#if 0 /* This has been free()d before */
- tossPict (pScreenPriv->pRootPicture);
-#endif
- tossPict (pBuffer->pTempPicture);
-#endif
- xfree(pBuffer);
- dixSetPrivate(&pDev->devPrivates, miDCSpriteKey, NULL);
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+
+ pBuffer = MIDCBUFFER(pDev, pScreen);
+
+ if (pBuffer)
+ {
+ if (pBuffer->pSourceGC) FreeGC(pBuffer->pSourceGC, (GContext) 0);
+ if (pBuffer->pMaskGC) FreeGC(pBuffer->pMaskGC, (GContext) 0);
+ if (pBuffer->pSaveGC) FreeGC(pBuffer->pSaveGC, (GContext) 0);
+ if (pBuffer->pRestoreGC) FreeGC(pBuffer->pRestoreGC, (GContext) 0);
+ if (pBuffer->pMoveGC) FreeGC(pBuffer->pMoveGC, (GContext) 0);
+ if (pBuffer->pPixSourceGC) FreeGC(pBuffer->pPixSourceGC, (GContext) 0);
+ if (pBuffer->pPixMaskGC) FreeGC(pBuffer->pPixMaskGC, (GContext) 0);
+
+ if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave);
+ if (pBuffer->pTemp) (*pScreen->DestroyPixmap)(pBuffer->pTemp);
+
+ xfree(pBuffer);
+ dixSetPrivate(&pDev->devPrivates, miDCSpriteKey + pScreen->myNum, NULL);
+ }
+ }
}
}
diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c
index 3d4b2ba6f..778e77734 100644
--- a/xorg-server/mi/miinitext.c
+++ b/xorg-server/mi/miinitext.c
@@ -540,8 +540,7 @@ InitExtensions(int argc, char *argv[])
for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
ext = &ExtensionModuleList[i];
if (ext->initFunc != NULL &&
- (ext->disablePtr == NULL ||
- (ext->disablePtr != NULL && !*ext->disablePtr))) {
+ (ext->disablePtr == NULL || !*ext->disablePtr)) {
(ext->initFunc)();
}
}