summaryrefslogtreecommitdiff
path: root/dbe/midbe.c
diff options
context:
space:
mode:
Diffstat (limited to 'dbe/midbe.c')
-rw-r--r--dbe/midbe.c524
1 files changed, 233 insertions, 291 deletions
diff --git a/dbe/midbe.c b/dbe/midbe.c
index b43ac1b3d..d810d992e 100644
--- a/dbe/midbe.c
+++ b/dbe/midbe.c
@@ -30,7 +30,6 @@
*
*****************************************************************************/
-
/* INCLUDES */
#ifdef HAVE_DIX_CONFIG_H
@@ -59,8 +58,8 @@
#include <stdio.h>
static DevPrivateKeyRec miDbeWindowPrivPrivKeyRec;
-#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec)
+#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec)
/******************************************************************************
*
@@ -79,41 +78,36 @@ static DevPrivateKeyRec miDbeWindowPrivPrivKeyRec;
*****************************************************************************/
static Bool
-miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo)
+miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo * pScrVisInfo)
{
- register int i, j, k;
- register int count;
- DepthPtr pDepth;
- XdbeVisualInfo *visInfo;
-
+ register int i, j, k;
+ register int count;
+ DepthPtr pDepth;
+ XdbeVisualInfo *visInfo;
/* Determine number of visuals for this screen. */
- for (i = 0, count = 0; i < pScreen->numDepths; i++)
- {
+ for (i = 0, count = 0; i < pScreen->numDepths; i++) {
count += pScreen->allowedDepths[i].numVids;
}
/* Allocate an array of XdbeVisualInfo items. */
- if (!(visInfo = (XdbeVisualInfo *)malloc(count * sizeof(XdbeVisualInfo))))
- {
- return FALSE; /* memory alloc failure */
+ if (!(visInfo = (XdbeVisualInfo *) malloc(count * sizeof(XdbeVisualInfo)))) {
+ return FALSE; /* memory alloc failure */
}
- for (i = 0, k = 0; i < pScreen->numDepths; i++)
- {
+ for (i = 0, k = 0; i < pScreen->numDepths; i++) {
/* For each depth of this screen, get visual information. */
pDepth = &pScreen->allowedDepths[i];
- for (j = 0; j < pDepth->numVids; j++)
- {
+ for (j = 0; j < pDepth->numVids; j++) {
/* For each visual for this depth of this screen, get visual ID
* and visual depth. Since this is MI code, we will always return
* the same performance level for all visuals (0). A higher
* performance level value indicates higher performance.
*/
- visInfo[k].visual = pDepth->vids[j];
- visInfo[k].depth = pDepth->depth;
+ visInfo[k].visual = pDepth->vids[j];
+ visInfo[k].depth = pDepth->depth;
visInfo[k].perflevel = 0;
k++;
}
@@ -122,13 +116,12 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo)
/* Record the number of visuals and point visual_depth to
* the array of visual info.
*/
- pScrVisInfo->count = count;
+ pScrVisInfo->count = count;
pScrVisInfo->visinfo = visInfo;
- return TRUE; /* success */
-
-} /* miDbeGetVisualInfo() */
+ return TRUE; /* success */
+} /* miDbeGetVisualInfo() */
/******************************************************************************
*
@@ -143,20 +136,18 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo)
static int
miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
{
- ScreenPtr pScreen;
- DbeWindowPrivPtr pDbeWindowPriv;
- MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
- DbeScreenPrivPtr pDbeScreenPriv;
- GCPtr pGC;
- xRectangle clearRect;
- int rc;
-
+ ScreenPtr pScreen;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ GCPtr pGC;
+ xRectangle clearRect;
+ int rc;
pScreen = pWin->drawable.pScreen;
pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
- if (pDbeWindowPriv->nBufferIDs == 0)
- {
+ if (pDbeWindowPriv->nBufferIDs == 0) {
/* There is no buffer associated with the window.
* We have to create the window priv priv. Remember, the window
* priv was created at the DIX level, so all we need to do is
@@ -171,32 +162,29 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
/* Get a front pixmap. */
if (!(pDbeWindowPrivPriv->pFrontBuffer =
- (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width,
- pDbeWindowPriv->height,
- pWin->drawable.depth, 0)))
- {
+ (*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
+ pDbeWindowPriv->height,
+ pWin->drawable.depth, 0))) {
return BadAlloc;
}
/* Get a back pixmap. */
if (!(pDbeWindowPrivPriv->pBackBuffer =
- (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width,
- pDbeWindowPriv->height,
- pWin->drawable.depth, 0)))
- {
- (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer);
+ (*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
+ pDbeWindowPriv->height,
+ pWin->drawable.depth, 0))) {
+ (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
return BadAlloc;
}
- /* Security creation/labeling check. */
- rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId,
- dbeDrawableResType, pDbeWindowPrivPriv->pBackBuffer,
- RT_WINDOW, pWin, DixCreateAccess);
+ /* Security creation/labeling check. */
+ rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId,
+ dbeDrawableResType, pDbeWindowPrivPriv->pBackBuffer,
+ RT_WINDOW, pWin, DixCreateAccess);
/* Make the back pixmap a DBE drawable resource. */
if (rc != Success || !AddResource(bufId, dbeDrawableResType,
- pDbeWindowPrivPriv->pBackBuffer))
- {
+ pDbeWindowPrivPriv->pBackBuffer)) {
/* free the buffer and the drawable resource */
FreeResource(bufId, RT_NONE);
return (rc == Success) ? BadAlloc : rc;
@@ -204,22 +192,19 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
/* Clear the back buffer. */
pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
- if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
- {
- ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC);
+ if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
+ ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
clearRect.x = clearRect.y = 0;
- clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
+ clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
- (*pGC->ops->PolyFillRect)(
- (DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC, 1,
- &clearRect);
+ (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv->
+ pBackBuffer, pGC, 1, &clearRect);
}
FreeScratchGC(pGC);
- } /* if no buffer associated with the window */
+ } /* if no buffer associated with the window */
- else
- {
+ else {
/* A buffer is already associated with the window.
* Place the new buffer ID information at the head of the ID list.
*/
@@ -227,8 +212,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
/* Associate the new ID with an existing pixmap. */
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
if (!AddResource(bufId, dbeDrawableResType,
- (pointer)pDbeWindowPrivPriv->pBackBuffer))
- {
+ (pointer) pDbeWindowPrivPriv->pBackBuffer)) {
return BadAlloc;
}
@@ -236,8 +220,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
return Success;
-} /* miDbeAllocBackBufferName() */
-
+} /* miDbeAllocBackBufferName() */
/******************************************************************************
*
@@ -253,18 +236,16 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
static void
miDbeAliasBuffers(DbeWindowPrivPtr pDbeWindowPriv)
{
- int i;
- MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv =
- MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
+ int i;
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv =
+ MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
- for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++)
- {
+ for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) {
ChangeResourceValue(pDbeWindowPriv->IDs[i], dbeDrawableResType,
- (pointer)pDbeWindowPrivPriv->pBackBuffer);
+ (pointer) pDbeWindowPrivPriv->pBackBuffer);
}
-} /* miDbeAliasBuffers() */
-
+} /* miDbeAliasBuffers() */
/******************************************************************************
*
@@ -279,16 +260,15 @@ miDbeAliasBuffers(DbeWindowPrivPtr pDbeWindowPriv)
static int
miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
{
- DbeScreenPrivPtr pDbeScreenPriv;
- GCPtr pGC;
- WindowPtr pWin;
- MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
- PixmapPtr pTmpBuffer;
- xRectangle clearRect;
-
-
- pWin = swapInfo[0].pWindow;
- pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
+ DbeScreenPrivPtr pDbeScreenPriv;
+ GCPtr pGC;
+ WindowPtr pWin;
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
+ PixmapPtr pTmpBuffer;
+ xRectangle clearRect;
+
+ pWin = swapInfo[0].pWindow;
+ pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin);
pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
@@ -298,24 +278,23 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
**********************************************************************
*/
- switch(swapInfo[0].swapAction)
- {
- case XdbeUndefined:
- break;
+ switch (swapInfo[0].swapAction) {
+ case XdbeUndefined:
+ break;
- case XdbeBackground:
- break;
+ case XdbeBackground:
+ break;
- case XdbeUntouched:
- ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer, pGC);
- (*pGC->ops->CopyArea)((DrawablePtr)pWin,
- (DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer,
- pGC, 0, 0, pWin->drawable.width,
- pWin->drawable.height, 0, 0);
- break;
+ case XdbeUntouched:
+ ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pFrontBuffer, pGC);
+ (*pGC->ops->CopyArea) ((DrawablePtr) pWin,
+ (DrawablePtr) pDbeWindowPrivPriv->pFrontBuffer,
+ pGC, 0, 0, pWin->drawable.width,
+ pWin->drawable.height, 0, 0);
+ break;
- case XdbeCopied:
- break;
+ case XdbeCopied:
+ break;
}
@@ -325,11 +304,10 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
**********************************************************************
*/
- ValidateGC((DrawablePtr)pWin, pGC);
- (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
- (DrawablePtr)pWin, pGC, 0, 0,
- pWin->drawable.width, pWin->drawable.height,
- 0, 0);
+ ValidateGC((DrawablePtr) pWin, pGC);
+ (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer,
+ (DrawablePtr) pWin, pGC, 0, 0,
+ pWin->drawable.width, pWin->drawable.height, 0, 0);
/*
**********************************************************************
@@ -337,40 +315,34 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
**********************************************************************
*/
- switch(swapInfo[0].swapAction)
- {
- case XdbeUndefined:
- break;
-
- case XdbeBackground:
- if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
- {
- ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC);
- clearRect.x = 0;
- clearRect.y = 0;
- clearRect.width =
- pDbeWindowPrivPriv->pBackBuffer->drawable.width;
- clearRect.height =
- pDbeWindowPrivPriv->pBackBuffer->drawable.height;
- (*pGC->ops->PolyFillRect)(
- (DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
- pGC, 1, &clearRect);
- }
- break;
-
- case XdbeUntouched:
- /* Swap pixmap pointers. */
- pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer;
- pDbeWindowPrivPriv->pBackBuffer =
- pDbeWindowPrivPriv->pFrontBuffer;
- pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer;
-
- miDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv);
-
- break;
-
- case XdbeCopied:
- break;
+ switch (swapInfo[0].swapAction) {
+ case XdbeUndefined:
+ break;
+
+ case XdbeBackground:
+ if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
+ ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
+ clearRect.x = 0;
+ clearRect.y = 0;
+ clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
+ clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
+ (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv->
+ pBackBuffer, pGC, 1, &clearRect);
+ }
+ break;
+
+ case XdbeUntouched:
+ /* Swap pixmap pointers. */
+ pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer;
+ pDbeWindowPrivPriv->pBackBuffer = pDbeWindowPrivPriv->pFrontBuffer;
+ pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer;
+
+ miDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv);
+
+ break;
+
+ case XdbeCopied:
+ break;
}
@@ -379,23 +351,21 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
* swapped.
*/
- if (*pNumWindows > 1)
- {
+ if (*pNumWindows > 1) {
/* We were told to swap more than one window, but we only swapped the
* first one. Remove the first window in the list by moving the last
* window to the beginning.
*/
- swapInfo[0].pWindow = swapInfo[*pNumWindows - 1].pWindow;
+ swapInfo[0].pWindow = swapInfo[*pNumWindows - 1].pWindow;
swapInfo[0].swapAction = swapInfo[*pNumWindows - 1].swapAction;
/* Clear the last window information just to be safe. */
- swapInfo[*pNumWindows - 1].pWindow = (WindowPtr)NULL;
+ swapInfo[*pNumWindows - 1].pWindow = (WindowPtr) NULL;
swapInfo[*pNumWindows - 1].swapAction = 0;
}
- else
- {
+ else {
/* Clear the window information just to be safe. */
- swapInfo[0].pWindow = (WindowPtr)NULL;
+ swapInfo[0].pWindow = (WindowPtr) NULL;
swapInfo[0].swapAction = 0;
}
@@ -405,8 +375,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
return Success;
-} /* miSwapBuffers() */
-
+} /* miSwapBuffers() */
/******************************************************************************
*
@@ -458,18 +427,15 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
static void
miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
{
- MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
-
- if (pDbeWindowPriv->nBufferIDs != 0)
- {
+ if (pDbeWindowPriv->nBufferIDs != 0) {
/* We still have at least one more buffer ID associated with this
* window.
*/
return;
}
-
/* We have no more buffer IDs associated with this window. We need to
* free some stuff.
*/
@@ -477,19 +443,16 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
/* Destroy the front and back pixmaps. */
- if (pDbeWindowPrivPriv->pFrontBuffer)
- {
- (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
- pDbeWindowPrivPriv->pFrontBuffer);
+ if (pDbeWindowPrivPriv->pFrontBuffer) {
+ (*pDbeWindowPriv->pWindow->drawable.pScreen->
+ DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
}
- if (pDbeWindowPrivPriv->pBackBuffer)
- {
- (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
- pDbeWindowPrivPriv->pBackBuffer);
+ if (pDbeWindowPrivPriv->pBackBuffer) {
+ (*pDbeWindowPriv->pWindow->drawable.pScreen->
+ DestroyPixmap) (pDbeWindowPrivPriv->pBackBuffer);
}
-} /* miDbeWinPrivDelete() */
-
+} /* miDbeWinPrivDelete() */
/******************************************************************************
*
@@ -505,30 +468,29 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
static Bool
miDbePositionWindow(WindowPtr pWin, int x, int y)
{
- ScreenPtr pScreen;
- DbeScreenPrivPtr pDbeScreenPriv;
- DbeWindowPrivPtr pDbeWindowPriv;
- int width, height;
- int dx, dy, dw, dh;
- int sourcex, sourcey;
- int destx, desty;
- int savewidth, saveheight;
- PixmapPtr pFrontBuffer;
- PixmapPtr pBackBuffer;
- Bool clear;
- GCPtr pGC;
- xRectangle clearRect;
- Bool ret;
-
+ ScreenPtr pScreen;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ int width, height;
+ int dx, dy, dw, dh;
+ int sourcex, sourcey;
+ int destx, desty;
+ int savewidth, saveheight;
+ PixmapPtr pFrontBuffer;
+ PixmapPtr pBackBuffer;
+ Bool clear;
+ GCPtr pGC;
+ xRectangle clearRect;
+ Bool ret;
/*
**************************************************************************
** 1. Unwrap the member routine.
**************************************************************************
*/
-
- pScreen = pWin->drawable.pScreen;
- pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ pScreen = pWin->drawable.pScreen;
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
/*
@@ -538,14 +500,14 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
** In this case we do not need to do anything.
**************************************************************************
*/
-
+
/*
**************************************************************************
** 3. Call the member routine, saving its result if necessary.
**************************************************************************
*/
-
- ret = (*pScreen->PositionWindow)(pWin, x, y);
+
+ ret = (*pScreen->PositionWindow) (pWin, x, y);
/*
**************************************************************************
@@ -562,108 +524,95 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
** 5. Do any work necessary after the member routine has been called.
**************************************************************************
*/
-
- if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
- {
- return ret;
+
+ if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
+ return ret;
}
- if (pDbeWindowPriv->width == pWin->drawable.width &&
- pDbeWindowPriv->height == pWin->drawable.height)
- {
- return ret;
+ if (pDbeWindowPriv->width == pWin->drawable.width &&
+ pDbeWindowPriv->height == pWin->drawable.height) {
+ return ret;
}
- width = pWin->drawable.width;
+ width = pWin->drawable.width;
height = pWin->drawable.height;
dx = pWin->drawable.x - pDbeWindowPriv->x;
dy = pWin->drawable.y - pDbeWindowPriv->y;
- dw = width - pDbeWindowPriv->width;
+ dw = width - pDbeWindowPriv->width;
dh = height - pDbeWindowPriv->height;
- GravityTranslate (0, 0, -dx, -dy, dw, dh, pWin->bitGravity, &destx, &desty);
+ GravityTranslate(0, 0, -dx, -dy, dw, dh, pWin->bitGravity, &destx, &desty);
- clear = ((pDbeWindowPriv->width < (unsigned short)width ) ||
- (pDbeWindowPriv->height < (unsigned short)height) ||
+ clear = ((pDbeWindowPriv->width < (unsigned short) width) ||
+ (pDbeWindowPriv->height < (unsigned short) height) ||
(pWin->bitGravity == ForgetGravity));
sourcex = 0;
sourcey = 0;
- savewidth = pDbeWindowPriv->width;
+ savewidth = pDbeWindowPriv->width;
saveheight = pDbeWindowPriv->height;
/* Clip rectangle to source and destination. */
- if (destx < 0)
- {
- savewidth += destx;
- sourcex -= destx;
- destx = 0;
+ if (destx < 0) {
+ savewidth += destx;
+ sourcex -= destx;
+ destx = 0;
}
- if (destx + savewidth > width)
- {
- savewidth = width - destx;
+ if (destx + savewidth > width) {
+ savewidth = width - destx;
}
- if (desty < 0)
- {
- saveheight += desty;
- sourcey -= desty;
- desty = 0;
+ if (desty < 0) {
+ saveheight += desty;
+ sourcey -= desty;
+ desty = 0;
}
- if (desty + saveheight > height)
- {
- saveheight = height - desty;
+ if (desty + saveheight > height) {
+ saveheight = height - desty;
}
- pDbeWindowPriv->width = width;
+ pDbeWindowPriv->width = width;
pDbeWindowPriv->height = height;
pDbeWindowPriv->x = pWin->drawable.x;
pDbeWindowPriv->y = pWin->drawable.y;
- pGC = GetScratchGC (pWin->drawable.depth, pScreen);
-
- if (clear)
- {
- if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
- {
- clearRect.x = 0;
- clearRect.y = 0;
- clearRect.width = width;
- clearRect.height = height;
- }
- else
- {
- clear = FALSE;
- }
+ pGC = GetScratchGC(pWin->drawable.depth, pScreen);
+
+ if (clear) {
+ if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
+ clearRect.x = 0;
+ clearRect.y = 0;
+ clearRect.width = width;
+ clearRect.height = height;
+ }
+ else {
+ clear = FALSE;
+ }
}
/* Create DBE buffer pixmaps equal to size of resized window. */
- pFrontBuffer = (*pScreen->CreatePixmap)(pScreen, width, height,
- pWin->drawable.depth, 0);
+ pFrontBuffer = (*pScreen->CreatePixmap) (pScreen, width, height,
+ pWin->drawable.depth, 0);
- pBackBuffer = (*pScreen->CreatePixmap)(pScreen, width, height,
- pWin->drawable.depth, 0);
+ pBackBuffer = (*pScreen->CreatePixmap) (pScreen, width, height,
+ pWin->drawable.depth, 0);
- if (!pFrontBuffer || !pBackBuffer)
- {
+ if (!pFrontBuffer || !pBackBuffer) {
/* We failed at creating 1 or 2 of the pixmaps. */
- if (pFrontBuffer)
- {
- (*pScreen->DestroyPixmap)(pFrontBuffer);
+ if (pFrontBuffer) {
+ (*pScreen->DestroyPixmap) (pFrontBuffer);
}
- if (pBackBuffer)
- {
- (*pScreen->DestroyPixmap)(pBackBuffer);
+ if (pBackBuffer) {
+ (*pScreen->DestroyPixmap) (pBackBuffer);
}
/* Destroy all buffers for this window. */
- while (pDbeWindowPriv)
- {
+ while (pDbeWindowPriv) {
/* DbeWindowPrivDelete() will free the window private if there no
* more buffer IDs associated with this window.
*/
@@ -675,57 +624,53 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
return FALSE;
}
- else
- {
+ else {
/* Clear out the new DBE buffer pixmaps. */
- MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
-
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
- /* I suppose this could avoid quite a bit of work if
- * it computed the minimal area required.
- */
- ValidateGC(&pFrontBuffer->drawable, pGC);
- if (clear)
- {
- (*pGC->ops->PolyFillRect)((DrawablePtr)pFrontBuffer, pGC, 1,
- &clearRect);
- }
- /* Copy the contents of the old front pixmap to the new one. */
- if (pWin->bitGravity != ForgetGravity)
- {
- (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer,
- (DrawablePtr)pFrontBuffer, pGC, sourcex,
- sourcey, savewidth, saveheight, destx, desty);
+ /* I suppose this could avoid quite a bit of work if
+ * it computed the minimal area required.
+ */
+ ValidateGC(&pFrontBuffer->drawable, pGC);
+ if (clear) {
+ (*pGC->ops->PolyFillRect) ((DrawablePtr) pFrontBuffer, pGC, 1,
+ &clearRect);
+ }
+ /* Copy the contents of the old front pixmap to the new one. */
+ if (pWin->bitGravity != ForgetGravity) {
+ (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->
+ pFrontBuffer, (DrawablePtr) pFrontBuffer,
+ pGC, sourcex, sourcey, savewidth, saveheight,
+ destx, desty);
}
- ValidateGC(&pBackBuffer->drawable, pGC);
- if (clear)
- {
- (*pGC->ops->PolyFillRect)((DrawablePtr)pBackBuffer , pGC, 1,
- &clearRect);
- }
- /* Copy the contents of the old back pixmap to the new one. */
- if (pWin->bitGravity != ForgetGravity)
- {
- (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
- (DrawablePtr)pBackBuffer, pGC, sourcex,
- sourcey, savewidth, saveheight, destx, desty);
- }
+ ValidateGC(&pBackBuffer->drawable, pGC);
+ if (clear) {
+ (*pGC->ops->PolyFillRect) ((DrawablePtr) pBackBuffer, pGC, 1,
+ &clearRect);
+ }
+ /* Copy the contents of the old back pixmap to the new one. */
+ if (pWin->bitGravity != ForgetGravity) {
+ (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->
+ pBackBuffer, (DrawablePtr) pBackBuffer, pGC,
+ sourcex, sourcey, savewidth, saveheight,
+ destx, desty);
+ }
/* Destroy the old pixmaps, and point the DBE window priv to the new
* pixmaps.
*/
- (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer);
- (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pBackBuffer);
+ (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
+ (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pBackBuffer);
pDbeWindowPrivPriv->pFrontBuffer = pFrontBuffer;
- pDbeWindowPrivPriv->pBackBuffer = pBackBuffer;
+ pDbeWindowPrivPriv->pBackBuffer = pBackBuffer;
- /* Make sure all XID are associated with the new back pixmap. */
+ /* Make sure all XID are associated with the new back pixmap. */
miDbeAliasBuffers(pDbeWindowPriv);
FreeScratchGC(pGC);
@@ -733,8 +678,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
return ret;
-} /* miDbePositionWindow() */
-
+} /* miDbePositionWindow() */
/******************************************************************************
*
@@ -751,16 +695,14 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
static void
miDbeResetProc(ScreenPtr pScreen)
{
- DbeScreenPrivPtr pDbeScreenPriv;
-
+ DbeScreenPrivPtr pDbeScreenPriv;
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
/* Unwrap wrappers */
pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
-} /* miDbeResetProc() */
-
+} /* miDbeResetProc() */
/******************************************************************************
*
@@ -776,22 +718,22 @@ Bool
miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
{
if (!dixRegisterPrivateKey(&miDbeWindowPrivPrivKeyRec, PRIVATE_DBE_WINDOW,
- sizeof(MiDbeWindowPrivPrivRec)))
+ sizeof(MiDbeWindowPrivPrivRec)))
return FALSE;
/* Wrap functions. */
pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
- pScreen->PositionWindow = miDbePositionWindow;
+ pScreen->PositionWindow = miDbePositionWindow;
/* Initialize the per-screen DBE function pointers. */
- pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo;
- pDbeScreenPriv->AllocBackBufferName = miDbeAllocBackBufferName;
- pDbeScreenPriv->SwapBuffers = miDbeSwapBuffers;
- pDbeScreenPriv->BeginIdiom = 0;
- pDbeScreenPriv->EndIdiom = 0;
- pDbeScreenPriv->ResetProc = miDbeResetProc;
- pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete;
+ pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo;
+ pDbeScreenPriv->AllocBackBufferName = miDbeAllocBackBufferName;
+ pDbeScreenPriv->SwapBuffers = miDbeSwapBuffers;
+ pDbeScreenPriv->BeginIdiom = 0;
+ pDbeScreenPriv->EndIdiom = 0;
+ pDbeScreenPriv->ResetProc = miDbeResetProc;
+ pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete;
return TRUE;
-} /* miDbeInit() */
+} /* miDbeInit() */