aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/mi
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-04-22 08:57:22 +0000
committermarha <marha@users.sourceforge.net>2010-04-22 08:57:22 +0000
commitd2bf55b405ea8f980984aab4be7d4b878c9e6981 (patch)
tree676ad441e287f6de1950260c3d2ef0b720f69bad /xorg-server/mi
parenta46e26df6103fb0e6e00d8d11d58c3f7a358208c (diff)
downloadvcxsrv-d2bf55b405ea8f980984aab4be7d4b878c9e6981.tar.gz
vcxsrv-d2bf55b405ea8f980984aab4be7d4b878c9e6981.tar.bz2
vcxsrv-d2bf55b405ea8f980984aab4be7d4b878c9e6981.zip
git update 22/4/2010
Diffstat (limited to 'xorg-server/mi')
-rw-r--r--xorg-server/mi/midispcur.c270
-rw-r--r--xorg-server/mi/miinitext.c23
-rw-r--r--xorg-server/mi/mipointer.c6
3 files changed, 162 insertions, 137 deletions
diff --git a/xorg-server/mi/midispcur.c b/xorg-server/mi/midispcur.c
index 3a31b74d5..3fb7e02b5 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 per-screen private data */
-static int miDCSpriteKeyIndex[MAXSCREENS];
-static DevPrivateKey miDCSpriteKey = miDCSpriteKeyIndex;
+/* per device private data */
+static int miDCSpriteKeyIndex;
+static DevPrivateKey miDCSpriteKey = &miDCSpriteKeyIndex;
typedef struct {
GCPtr pSourceGC, pMaskGC;
@@ -75,10 +75,10 @@ typedef struct {
#endif
} miDCBufferRec, *miDCBufferPtr;
-#define MIDCBUFFER(dev, screen) \
+#define MIDCBUFFER(dev) \
((DevHasCursor(dev)) ? \
- (miDCBufferPtr)dixLookupPrivate(&dev->devPrivates, miDCSpriteKey + (screen)->myNum) : \
- (miDCBufferPtr)dixLookupPrivate(&dev->u.master->devPrivates, miDCSpriteKey + (screen)->myNum))
+ (miDCBufferPtr)dixLookupPrivate(&dev->devPrivates, miDCSpriteKey) : \
+ (miDCBufferPtr)dixLookupPrivate(&dev->u.master->devPrivates, miDCSpriteKey))
/*
* The core pointer buffer will point to the index of the virtual core pointer
@@ -158,6 +158,10 @@ 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)
{
@@ -179,6 +183,7 @@ miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
}
#ifdef ARGB_CURSOR
+#define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win))
static VisualPtr
miDCGetWindowVisual (WindowPtr pWin)
@@ -410,8 +415,12 @@ miDCPutBits (
(*maskGC->ops->PushPixels) (maskGC, pPriv->maskBits, pDrawable, w, h, x, y);
}
+#define EnsureGC(gc,win) (gc || miDCMakeGC(&gc, win))
+
static GCPtr
-miDCMakeGC(WindowPtr pWin)
+miDCMakeGC(
+ GCPtr *ppGC,
+ WindowPtr pWin)
{
GCPtr pGC;
int status;
@@ -422,6 +431,7 @@ miDCMakeGC(WindowPtr pWin)
pGC = CreateGC((DrawablePtr)pWin,
GCSubwindowMode|GCGraphicsExposures, gcvals, &status,
(XID)0, serverClient);
+ *ppGC = pGC;
return pGC;
}
@@ -446,11 +456,22 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
pWin = WindowTable[pScreen->myNum];
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = MIDCBUFFER(pDev);
#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,
@@ -463,6 +484,33 @@ 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,
@@ -483,7 +531,7 @@ miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = MIDCBUFFER(pDev);
pSave = pBuffer->pSave;
pWin = WindowTable[pScreen->myNum];
@@ -496,7 +544,14 @@ 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);
@@ -517,13 +572,20 @@ miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = MIDCBUFFER(pDev);
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);
@@ -545,7 +607,7 @@ miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = MIDCBUFFER(pDev);
pSave = pBuffer->pSave;
pWin = WindowTable[pScreen->myNum];
@@ -554,7 +616,14 @@ 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);
@@ -593,7 +662,14 @@ 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);
@@ -690,7 +766,7 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
pWin = WindowTable[pScreen->myNum];
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = MIDCBUFFER(pDev);
pTemp = pBuffer->pTemp;
if (!pTemp ||
@@ -733,9 +809,17 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
#ifdef ARGB_CURSOR
if (pPriv->pPicture)
{
- if (!pBuffer->pTempPicture)
- miDCMakePicture(&pBuffer->pTempPicture, &pTemp->drawable, pWin);
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pTempPicture &&
+ pBuffer->pTempPicture->pDrawable &&
+ pBuffer->pTempPicture->pDrawable->pScreen != pScreen)
+ {
+ tossPict(pBuffer->pTempPicture);
+ pBuffer->pTempPicture = NULL;
+ }
+ if (!EnsurePicture(pBuffer->pTempPicture, &pTemp->drawable, pWin))
+ return FALSE;
CompositePicture (PictOpOver,
pPriv->pPicture,
NULL,
@@ -748,12 +832,38 @@ 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);
@@ -767,113 +877,51 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
static Bool
miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- 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;
-
+ 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;
#ifdef ARGB_CURSOR
- miDCMakePicture(&pBuffer->pRootPicture, &pWin->drawable, pWin);
- if (!pBuffer->pRootPicture)
- goto failure;
-
- pBuffer->pTempPicture = NULL;
+ pBuffer->pRootPicture = NULL;
+ pBuffer->pTempPicture = NULL;
#endif
-
- // these get (re)allocated lazily depending on the cursor size
- pBuffer->pSave = pBuffer->pTemp = NULL;
- }
+ 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))
{
- 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);
-
+ 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 (pBuffer->pRootPicture) FreePicture(pBuffer->pRootPicture, 0);
- if (pBuffer->pTempPicture) FreePicture(pBuffer->pTempPicture, 0);
+#if 0 /* This has been free()d before */
+ tossPict (pScreenPriv->pRootPicture);
+#endif
+ tossPict (pBuffer->pTempPicture);
#endif
-
- if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave);
- if (pBuffer->pTemp) (*pScreen->DestroyPixmap)(pBuffer->pTemp);
-
- xfree(pBuffer);
- dixSetPrivate(&pDev->devPrivates, miDCSpriteKey + pScreen->myNum, NULL);
- }
- }
+ xfree(pBuffer);
+ dixSetPrivate(&pDev->devPrivates, miDCSpriteKey, NULL);
}
}
diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c
index 692be86f4..844863a59 100644
--- a/xorg-server/mi/miinitext.c
+++ b/xorg-server/mi/miinitext.c
@@ -55,7 +55,6 @@ SOFTWARE.
#ifdef HAVE_DMX_CONFIG_H
#include <dmx-config.h>
-#undef MULTIBUFFER
#undef XV
#undef DBE
#undef XF86VIDMODE
@@ -116,15 +115,10 @@ extern Bool noScreenSaverExtension;
#ifdef MITSHM
extern Bool noMITShmExtension;
#endif
-#ifdef MULTIBUFFER
-extern Bool noMultibufferExtension;
-#endif
#ifdef RANDR
extern Bool noRRExtension;
#endif
-#ifdef RENDER
extern Bool noRenderExtension;
-#endif
#ifdef XCSECURITY
extern Bool noSecurityExtension;
#endif
@@ -195,9 +189,6 @@ typedef void (*InitExtension)(INITARGS);
#ifdef MITSHM
extern void ShmExtensionInit(INITARGS);
#endif
-#ifdef MULTIBUFFER
-extern void MultibufferExtensionInit(INITARGS);
-#endif
#ifdef PANORAMIX
extern void PanoramiXExtensionInit(INITARGS);
#endif
@@ -252,9 +243,7 @@ extern void XFree86DRIExtensionInit(INITARGS);
#ifdef DPMSExtension
extern void DPMSExtensionInit(INITARGS);
#endif
-#ifdef RENDER
extern void RenderExtensionInit(INITARGS);
-#endif
#ifdef RANDR
extern void RRExtensionInit(INITARGS);
#endif
@@ -308,15 +297,10 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef MITSHM
{ SHMNAME, &noMITShmExtension },
#endif
-#ifdef MULTIBUFFER
- { "Multi-Buffering", &noMultibufferExtension },
-#endif
#ifdef RANDR
{ "RANDR", &noRRExtension },
#endif
-#ifdef RENDER
{ "RENDER", &noRenderExtension },
-#endif
#ifdef XCSECURITY
{ "SECURITY", &noSecurityExtension },
#endif
@@ -416,9 +400,6 @@ InitExtensions(int argc, char *argv[])
#ifdef MITSHM
if (!noMITShmExtension) ShmExtensionInit();
#endif
-#ifdef MULTIBUFFER
- if (!noMultibufferExtension) MultibufferExtensionInit();
-#endif
XInputExtensionInit();
#ifdef XTEST
if (!noTestExtensions) XTestExtensionInit();
@@ -469,9 +450,7 @@ InitExtensions(int argc, char *argv[])
/* must be before Render to layer DisplayCursor correctly */
if (!noXFixesExtension) XFixesExtensionInit();
#endif
-#ifdef RENDER
if (!noRenderExtension) RenderExtensionInit();
-#endif
#ifdef RANDR
if (!noRRExtension) RRExtensionInit();
#endif
@@ -524,9 +503,7 @@ static ExtensionModule staticExtensions[] = {
#ifdef XF86BIGFONT
{ XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension, NULL, NULL },
#endif
-#ifdef RENDER
{ RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL },
-#endif
#ifdef RANDR
{ RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL },
#endif
diff --git a/xorg-server/mi/mipointer.c b/xorg-server/mi/mipointer.c
index e1f63be4e..1b33f82d5 100644
--- a/xorg-server/mi/mipointer.c
+++ b/xorg-server/mi/mipointer.c
@@ -497,14 +497,14 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
miPointerPtr pPointer;
+ if (!pDev || !pDev->coreEvents)
+ return;
+
pPointer = MIPOINTER(pDev);
pScreen = pPointer->pScreen;
if (!pScreen)
return; /* called before ready */
- if (!pDev || !pDev->coreEvents)
- return;
-
if (*x < 0 || *x >= pScreen->width || *y < 0 || *y >= pScreen->height)
{
pScreenPriv = GetScreenPrivate (pScreen);