summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-05-24 09:15:32 -0700
committerJamey Sharp <jamey@minilop.net>2010-05-25 09:05:37 -0700
commitbf78e11839f8278020b604672ff7c3d194232be9 (patch)
treeb686e2e25bd2daff8af0fe89581a8b1a406061c5 /mi
parentbf9b64eefbadbf299d3b841c1890bfcaef5aab1b (diff)
midispcur: Construct Picture objects lazily in case Render is disabled.
Reverts part of the effects of 518f3b189b6c8aa28b62837d14309fd06163ccbb, "mi: don't thrash resources when displaying the software cursor across screens". The per-screen cache is preserved, and the GCs are still allocated eagerly, but now it doesn't construct pRootPicture until somebody attempts to draw an ARGB cursor. I noticed crashes in Xnest, which doesn't support the RENDER extension, but I suspect other DDXes that support disabling that extension would have had issues as well. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Pierre-Loup A. Griffais <pgriffais@nvidia.com>
Diffstat (limited to 'mi')
-rw-r--r--mi/midispcur.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/mi/midispcur.c b/mi/midispcur.c
index 16495e45f..f2b22293d 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -141,6 +141,7 @@ miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
}
#ifdef ARGB_CURSOR
+#define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win))
static VisualPtr
miDCGetWindowVisual (WindowPtr pWin)
@@ -413,6 +414,8 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
#ifdef ARGB_CURSOR
if (pPriv->pPicture)
{
+ if (!EnsurePicture(pBuffer->pRootPicture, &pWin->drawable, pWin))
+ return FALSE;
CompositePicture (PictOpOver,
pPriv->pPicture,
NULL,
@@ -695,9 +698,8 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
#ifdef ARGB_CURSOR
if (pPriv->pPicture)
{
- if (!pBuffer->pTempPicture)
- miDCMakePicture(&pBuffer->pTempPicture, &pTemp->drawable, pWin);
-
+ if (!EnsurePicture(pBuffer->pTempPicture, &pTemp->drawable, pWin))
+ return FALSE;
CompositePicture (PictOpOver,
pPriv->pPicture,
NULL,
@@ -781,10 +783,7 @@ miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
goto failure;
#ifdef ARGB_CURSOR
- miDCMakePicture(&pBuffer->pRootPicture, &pWin->drawable, pWin);
- if (!pBuffer->pRootPicture)
- goto failure;
-
+ pBuffer->pRootPicture = NULL;
pBuffer->pTempPicture = NULL;
#endif