summaryrefslogtreecommitdiff
path: root/composite
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-21 12:55:09 -0700
committerKeith Packard <keithp@keithp.com>2012-03-21 13:54:42 -0700
commit9838b7032ea9792bec21af424c53c07078636d21 (patch)
treeb72d0827dac50f0f3b8eab29b3b7639546d735d7 /composite
parent75199129c603fc8567185ac31866c9518193cb78 (diff)
Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'composite')
-rw-r--r--composite/compalloc.c754
-rw-r--r--composite/compext.c699
-rw-r--r--composite/compinit.c243
-rw-r--r--composite/compint.h195
-rw-r--r--composite/compositeext.h4
-rw-r--r--composite/compoverlay.c93
-rw-r--r--composite/compwindow.c800
7 files changed, 1366 insertions, 1422 deletions
diff --git a/composite/compalloc.c b/composite/compalloc.c
index 9857a92b2..15a6cd24f 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -48,23 +48,20 @@
#include "compint.h"
static void
-compScreenUpdate (ScreenPtr pScreen)
+compScreenUpdate(ScreenPtr pScreen)
{
- compCheckTree (pScreen);
- compPaintChildrenToWindow (pScreen->root);
+ compCheckTree(pScreen);
+ compPaintChildrenToWindow(pScreen->root);
}
static void
-compBlockHandler (int i,
- pointer blockData,
- pointer pTimeout,
- pointer pReadmask)
+compBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
{
- ScreenPtr pScreen = screenInfo.screens[i];
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = screenInfo.screens[i];
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->BlockHandler = cs->BlockHandler;
- compScreenUpdate (pScreen);
+ compScreenUpdate(pScreen);
(*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
/* Next damage will restore the block handler */
@@ -72,12 +69,12 @@ compBlockHandler (int i,
}
static void
-compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
+compReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
- WindowPtr pWin = (WindowPtr) closure;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- CompWindowPtr cw = GetCompWindow (pWin);
+ WindowPtr pWin = (WindowPtr) closure;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompWindowPtr cw = GetCompWindow(pWin);
if (!cs->BlockHandler) {
cs->BlockHandler = pScreen->BlockHandler;
@@ -88,34 +85,33 @@ compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
/* Mark the ancestors */
pWin = pWin->parent;
while (pWin) {
- if (pWin->damagedDescendants)
- break;
- pWin->damagedDescendants = TRUE;
- pWin = pWin->parent;
+ if (pWin->damagedDescendants)
+ break;
+ pWin->damagedDescendants = TRUE;
+ pWin = pWin->parent;
}
}
static void
-compDestroyDamage (DamagePtr pDamage, void *closure)
+compDestroyDamage(DamagePtr pDamage, void *closure)
{
- WindowPtr pWin = (WindowPtr) closure;
- CompWindowPtr cw = GetCompWindow (pWin);
+ WindowPtr pWin = (WindowPtr) closure;
+ CompWindowPtr cw = GetCompWindow(pWin);
cw->damage = 0;
}
static Bool
-compMarkWindows(WindowPtr pWin,
- WindowPtr *ppLayerWin)
+compMarkWindows(WindowPtr pWin, WindowPtr *ppLayerWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
WindowPtr pLayerWin = pWin;
if (!pWin->viewable)
- return FALSE;
+ return FALSE;
- (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin);
- (*pScreen->MarkWindow)(pLayerWin->parent);
+ (*pScreen->MarkOverlappedWindows) (pWin, pWin, &pLayerWin);
+ (*pScreen->MarkWindow) (pLayerWin->parent);
*ppLayerWin = pLayerWin;
@@ -127,143 +123,134 @@ compHandleMarkedWindows(WindowPtr pWin, WindowPtr pLayerWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTOther);
- (*pScreen->HandleExposures)(pLayerWin->parent);
+ (*pScreen->ValidateTree) (pLayerWin->parent, pLayerWin, VTOther);
+ (*pScreen->HandleExposures) (pLayerWin->parent);
if (pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTOther);
+ (*pScreen->PostValidateTree) (pLayerWin->parent, pLayerWin, VTOther);
}
/*
* Redirect one window for one client
*/
int
-compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
+compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- CompClientWindowPtr ccw;
- CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
- WindowPtr pLayerWin;
- Bool anyMarked = FALSE;
-
+ CompWindowPtr cw = GetCompWindow(pWin);
+ CompClientWindowPtr ccw;
+ CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
+ WindowPtr pLayerWin;
+ Bool anyMarked = FALSE;
+
if (pWin == cs->pOverlayWin) {
- return Success;
+ return Success;
}
if (!pWin->parent)
- return BadMatch;
+ return BadMatch;
/*
* Only one Manual update is allowed
*/
if (cw && update == CompositeRedirectManual)
- for (ccw = cw->clients; ccw; ccw = ccw->next)
- if (ccw->update == CompositeRedirectManual)
- return BadAccess;
-
+ for (ccw = cw->clients; ccw; ccw = ccw->next)
+ if (ccw->update == CompositeRedirectManual)
+ return BadAccess;
+
/*
* Allocate per-client per-window structure
* The client *could* allocate multiple, but while supported,
* it is not expected to be common
*/
- ccw = malloc(sizeof (CompClientWindowRec));
+ ccw = malloc(sizeof(CompClientWindowRec));
if (!ccw)
- return BadAlloc;
- ccw->id = FakeClientID (pClient->index);
+ return BadAlloc;
+ ccw->id = FakeClientID(pClient->index);
ccw->update = update;
/*
* Now make sure there's a per-window structure to hang this from
*/
- if (!cw)
- {
- cw = malloc(sizeof (CompWindowRec));
- if (!cw)
- {
- free(ccw);
- return BadAlloc;
- }
- cw->damage = DamageCreate (compReportDamage,
- compDestroyDamage,
- DamageReportNonEmpty,
- FALSE,
- pWin->drawable.pScreen,
- pWin);
- if (!cw->damage)
- {
- free(ccw);
- free(cw);
- return BadAlloc;
- }
-
- anyMarked = compMarkWindows (pWin, &pLayerWin);
-
- RegionNull(&cw->borderClip);
- cw->update = CompositeRedirectAutomatic;
- cw->clients = 0;
- cw->oldx = COMP_ORIGIN_INVALID;
- cw->oldy = COMP_ORIGIN_INVALID;
- cw->damageRegistered = FALSE;
- cw->damaged = FALSE;
- cw->pOldPixmap = NullPixmap;
- dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
+ if (!cw) {
+ cw = malloc(sizeof(CompWindowRec));
+ if (!cw) {
+ free(ccw);
+ return BadAlloc;
+ }
+ cw->damage = DamageCreate(compReportDamage,
+ compDestroyDamage,
+ DamageReportNonEmpty,
+ FALSE, pWin->drawable.pScreen, pWin);
+ if (!cw->damage) {
+ free(ccw);
+ free(cw);
+ return BadAlloc;
+ }
+
+ anyMarked = compMarkWindows(pWin, &pLayerWin);
+
+ RegionNull(&cw->borderClip);
+ cw->update = CompositeRedirectAutomatic;
+ cw->clients = 0;
+ cw->oldx = COMP_ORIGIN_INVALID;
+ cw->oldy = COMP_ORIGIN_INVALID;
+ cw->damageRegistered = FALSE;
+ cw->damaged = FALSE;
+ cw->pOldPixmap = NullPixmap;
+ dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
}
ccw->next = cw->clients;
cw->clients = ccw;
- if (!AddResource (ccw->id, CompositeClientWindowType, pWin))
- return BadAlloc;
- if (ccw->update == CompositeRedirectManual)
- {
- if (!anyMarked)
- anyMarked = compMarkWindows (pWin, &pLayerWin);
-
- if (cw->damageRegistered)
- {
- DamageUnregister (&pWin->drawable, cw->damage);
- cw->damageRegistered = FALSE;
- }
- cw->update = CompositeRedirectManual;
+ if (!AddResource(ccw->id, CompositeClientWindowType, pWin))
+ return BadAlloc;
+ if (ccw->update == CompositeRedirectManual) {
+ if (!anyMarked)
+ anyMarked = compMarkWindows(pWin, &pLayerWin);
+
+ if (cw->damageRegistered) {
+ DamageUnregister(&pWin->drawable, cw->damage);
+ cw->damageRegistered = FALSE;
+ }
+ cw->update = CompositeRedirectManual;
}
else if (cw->update == CompositeRedirectAutomatic && !cw->damageRegistered) {
- if (!anyMarked)
- anyMarked = compMarkWindows (pWin, &pLayerWin);
+ if (!anyMarked)
+ anyMarked = compMarkWindows(pWin, &pLayerWin);
}
- if (!compCheckRedirect (pWin))
- {
- FreeResource (ccw->id, RT_NONE);
- return BadAlloc;
+ if (!compCheckRedirect(pWin)) {
+ FreeResource(ccw->id, RT_NONE);
+ return BadAlloc;
}
if (anyMarked)
- compHandleMarkedWindows (pWin, pLayerWin);
-
+ compHandleMarkedWindows(pWin, pLayerWin);
+
return Success;
}
void
-compRestoreWindow (WindowPtr pWin, PixmapPtr pPixmap)
+compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
WindowPtr pParent = pWin->parent;
if (pParent->drawable.depth == pWin->drawable.depth) {
- GCPtr pGC = GetScratchGC (pWin->drawable.depth, pScreen);
- int bw = (int) pWin->borderWidth;
- int x = bw;
- int y = bw;
- int w = pWin->drawable.width;
- int h = pWin->drawable.height;
-
- if (pGC) {
- ChangeGCVal val;
- val.val = IncludeInferiors;
- ChangeGC (NullClient, pGC, GCSubwindowMode, &val);
- ValidateGC(&pWin->drawable, pGC);
- (*pGC->ops->CopyArea) (&pPixmap->drawable,
- &pWin->drawable,
- pGC,
- x, y, w, h, 0, 0);
- FreeScratchGC (pGC);
- }
+ GCPtr pGC = GetScratchGC(pWin->drawable.depth, pScreen);
+ int bw = (int) pWin->borderWidth;
+ int x = bw;
+ int y = bw;
+ int w = pWin->drawable.width;
+ int h = pWin->drawable.height;
+
+ if (pGC) {
+ ChangeGCVal val;
+
+ val.val = IncludeInferiors;
+ ChangeGC(NullClient, pGC, GCSubwindowMode, &val);
+ ValidateGC(&pWin->drawable, pGC);
+ (*pGC->ops->CopyArea) (&pPixmap->drawable,
+ &pWin->drawable, pGC, x, y, w, h, 0, 0);
+ FreeScratchGC(pGC);
+ }
}
}
@@ -272,62 +259,58 @@ compRestoreWindow (WindowPtr pWin, PixmapPtr pPixmap)
* redirect and the per-window pointer as appropriate
*/
void
-compFreeClientWindow (WindowPtr pWin, XID id)
+compFreeClientWindow(WindowPtr pWin, XID id)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompWindowPtr cw = GetCompWindow (pWin);
- CompClientWindowPtr ccw, *prev;
- Bool anyMarked = FALSE;
- WindowPtr pLayerWin;
- PixmapPtr pPixmap = NULL;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ CompClientWindowPtr ccw, *prev;
+ Bool anyMarked = FALSE;
+ WindowPtr pLayerWin;
+ PixmapPtr pPixmap = NULL;
if (!cw)
- return;
- for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next)
- {
- if (ccw->id == id)
- {
- *prev = ccw->next;
- if (ccw->update == CompositeRedirectManual)
- cw->update = CompositeRedirectAutomatic;
- free(ccw);
- break;
- }
+ return;
+ for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next) {
+ if (ccw->id == id) {
+ *prev = ccw->next;
+ if (ccw->update == CompositeRedirectManual)
+ cw->update = CompositeRedirectAutomatic;
+ free(ccw);
+ break;
+ }
}
- if (!cw->clients)
- {
- anyMarked = compMarkWindows (pWin, &pLayerWin);
-
- if (pWin->redirectDraw != RedirectDrawNone) {
- pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- compSetParentPixmap (pWin);
- }
-
- if (cw->damage)
- DamageDestroy (cw->damage);
-
- RegionUninit(&cw->borderClip);
-
- dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL);
- free(cw);
+ if (!cw->clients) {
+ anyMarked = compMarkWindows(pWin, &pLayerWin);
+
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ compSetParentPixmap(pWin);
+ }
+
+ if (cw->damage)
+ DamageDestroy(cw->damage);
+
+ RegionUninit(&cw->borderClip);
+
+ dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL);
+ free(cw);
}
else if (cw->update == CompositeRedirectAutomatic &&
- !cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone)
- {
- anyMarked = compMarkWindows (pWin, &pLayerWin);
-
- DamageRegister (&pWin->drawable, cw->damage);
- cw->damageRegistered = TRUE;
- pWin->redirectDraw = RedirectDrawAutomatic;
- DamageDamageRegion(&pWin->drawable, &pWin->borderSize);
+ !cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone) {
+ anyMarked = compMarkWindows(pWin, &pLayerWin);
+
+ DamageRegister(&pWin->drawable, cw->damage);
+ cw->damageRegistered = TRUE;
+ pWin->redirectDraw = RedirectDrawAutomatic;
+ DamageDamageRegion(&pWin->drawable, &pWin->borderSize);
}
if (anyMarked)
- compHandleMarkedWindows (pWin, pLayerWin);
+ compHandleMarkedWindows(pWin, pLayerWin);
if (pPixmap) {
- compRestoreWindow (pWin, pPixmap);
- (*pScreen->DestroyPixmap) (pPixmap);
+ compRestoreWindow(pWin, pPixmap);
+ (*pScreen->DestroyPixmap) (pPixmap);
}
}
@@ -336,101 +319,95 @@ compFreeClientWindow (WindowPtr pWin, XID id)
*/
int
-compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
+compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- CompClientWindowPtr ccw;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ CompClientWindowPtr ccw;
if (!cw)
- return BadValue;
+ return BadValue;
for (ccw = cw->clients; ccw; ccw = ccw->next)
- if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
- {
- FreeResource (ccw->id, RT_NONE);
- return Success;
- }
+ if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
+ FreeResource(ccw->id, RT_NONE);
+ return Success;
+ }
return BadValue;
}
-
+
/*
* Redirect all subwindows for one client
*/
int
-compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
+compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
{
- CompSubwindowsPtr csw = GetCompSubwindows (pWin);
- CompClientWindowPtr ccw;
- WindowPtr pChild;
+ CompSubwindowsPtr csw = GetCompSubwindows(pWin);
+ CompClientWindowPtr ccw;
+ WindowPtr pChild;
/*
* Only one Manual update is allowed
*/
if (csw && update == CompositeRedirectManual)
- for (ccw = csw->clients; ccw; ccw = ccw->next)
- if (ccw->update == CompositeRedirectManual)
- return BadAccess;
+ for (ccw = csw->clients; ccw; ccw = ccw->next)
+ if (ccw->update == CompositeRedirectManual)
+ return BadAccess;
/*
* Allocate per-client per-window structure
* The client *could* allocate multiple, but while supported,
* it is not expected to be common
*/
- ccw = malloc(sizeof (CompClientWindowRec));
+ ccw = malloc(sizeof(CompClientWindowRec));
if (!ccw)
- return BadAlloc;
- ccw->id = FakeClientID (pClient->index);
+ return BadAlloc;
+ ccw->id = FakeClientID(pClient->index);
ccw->update = update;
/*
* Now make sure there's a per-window structure to hang this from
*/
- if (!csw)
- {
- csw = malloc(sizeof (CompSubwindowsRec));
- if (!csw)
- {
- free(ccw);
- return BadAlloc;
- }
- csw->update = CompositeRedirectAutomatic;
- csw->clients = 0;
- dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, csw);
+ if (!csw) {
+ csw = malloc(sizeof(CompSubwindowsRec));
+ if (!csw) {
+ free(ccw);
+ return BadAlloc;
+ }
+ csw->update = CompositeRedirectAutomatic;
+ csw->clients = 0;
+ dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, csw);
}
/*
* Redirect all existing windows
*/
- for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
- {
- int ret = compRedirectWindow (pClient, pChild, update);
- if (ret != Success)
- {
- for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib)
- (void) compUnredirectWindow (pClient, pChild, update);
- if (!csw->clients)
- {
- free(csw);
- dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
- }
- free(ccw);
- return ret;
- }
+ for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib) {
+ int ret = compRedirectWindow(pClient, pChild, update);
+
+ if (ret != Success) {
+ for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib)
+ (void) compUnredirectWindow(pClient, pChild, update);
+ if (!csw->clients) {
+ free(csw);
+ dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
+ }
+ free(ccw);
+ return ret;
+ }
}
/*
* Hook into subwindows list
*/
ccw->next = csw->clients;
csw->clients = ccw;
- if (!AddResource (ccw->id, CompositeClientSubwindowsType, pWin))
- return BadAlloc;
- if (ccw->update == CompositeRedirectManual)
- {
- csw->update = CompositeRedirectManual;
- /*
- * tell damage extension that damage events for this client are
- * critical output
- */
- DamageExtSetCritical (pClient, TRUE);
- pWin->inhibitBGPaint = TRUE;
+ if (!AddResource(ccw->id, CompositeClientSubwindowsType, pWin))
+ return BadAlloc;
+ if (ccw->update == CompositeRedirectManual) {
+ csw->update = CompositeRedirectManual;
+ /*
+ * tell damage extension that damage events for this client are
+ * critical output
+ */
+ DamageExtSetCritical(pClient, TRUE);
+ pWin->inhibitBGPaint = TRUE;
}
return Success;
}
@@ -440,52 +417,49 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
* which frees one redirect per subwindow
*/
void
-compFreeClientSubwindows (WindowPtr pWin, XID id)
+compFreeClientSubwindows(WindowPtr pWin, XID id)
{
- CompSubwindowsPtr csw = GetCompSubwindows (pWin);
- CompClientWindowPtr ccw, *prev;
- WindowPtr pChild;
+ CompSubwindowsPtr csw = GetCompSubwindows(pWin);
+ CompClientWindowPtr ccw, *prev;
+ WindowPtr pChild;
if (!csw)
- return;
- for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next)
- {
- if (ccw->id == id)
- {
- ClientPtr pClient = clients[CLIENT_ID(id)];
-
- *prev = ccw->next;
- if (ccw->update == CompositeRedirectManual)
- {
- /*
- * tell damage extension that damage events for this client are
- * critical output
- */
- DamageExtSetCritical (pClient, FALSE);
- csw->update = CompositeRedirectAutomatic;
- pWin->inhibitBGPaint = FALSE;
- if (pWin->mapped)
- (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, TRUE);
- }
-
- /*
- * Unredirect all existing subwindows
- */
- for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
- (void) compUnredirectWindow (pClient, pChild, ccw->update);
-
- free(ccw);
- break;
- }
+ return;
+ for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next) {
+ if (ccw->id == id) {
+ ClientPtr pClient = clients[CLIENT_ID(id)];
+
+ *prev = ccw->next;
+ if (ccw->update == CompositeRedirectManual) {
+ /*
+ * tell damage extension that damage events for this client are
+ * critical output
+ */
+ DamageExtSetCritical(pClient, FALSE);
+ csw->update = CompositeRedirectAutomatic;
+ pWin->inhibitBGPaint = FALSE;
+ if (pWin->mapped)
+ (*pWin->drawable.pScreen->ClearToBackground) (pWin, 0, 0, 0,
+ 0, TRUE);
+ }
+
+ /*
+ * Unredirect all existing subwindows
+ */
+ for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
+ (void) compUnredirectWindow(pClient, pChild, ccw->update);
+
+ free(ccw);
+ break;
+ }
}
/*
* Check if all of the per-client records are gone
*/
- if (!csw->clients)
- {
- dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
- free(csw);
+ if (!csw->clients) {
+ dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
+ free(csw);
}
}
@@ -494,19 +468,18 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
*/
int
-compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
+compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
{
- CompSubwindowsPtr csw = GetCompSubwindows (pWin);
- CompClientWindowPtr ccw;
-
+ CompSubwindowsPtr csw = GetCompSubwindows(pWin);
+ CompClientWindowPtr ccw;
+
if (!csw)
- return BadValue;
+ return BadValue;
for (ccw = csw->clients; ccw; ccw = ccw->next)
- if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
- {
- FreeResource (ccw->id, RT_NONE);
- return Success;
- }
+ if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
+ FreeResource(ccw->id, RT_NONE);
+ return Success;
+ }
return BadValue;
}
@@ -515,19 +488,19 @@ compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
*/
int
-compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
+compRedirectOneSubwindow(WindowPtr pParent, WindowPtr pWin)
{
- CompSubwindowsPtr csw = GetCompSubwindows (pParent);
- CompClientWindowPtr ccw;
+ CompSubwindowsPtr csw = GetCompSubwindows(pParent);
+ CompClientWindowPtr ccw;
if (!csw)
- return Success;
- for (ccw = csw->clients; ccw; ccw = ccw->next)
- {
- int ret = compRedirectWindow (clients[CLIENT_ID(ccw->id)],
- pWin, ccw->update);
- if (ret != Success)
- return ret;
+ return Success;
+ for (ccw = csw->clients; ccw; ccw = ccw->next) {
+ int ret = compRedirectWindow(clients[CLIENT_ID(ccw->id)],
+ pWin, ccw->update);
+
+ if (ret != Success)
+ return ret;
}
return Success;
}
@@ -537,122 +510,116 @@ compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
*/
int
-compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
+compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin)
{
- CompSubwindowsPtr csw = GetCompSubwindows (pParent);
- CompClientWindowPtr ccw;
+ CompSubwindowsPtr csw = GetCompSubwindows(pParent);
+ CompClientWindowPtr ccw;
if (!csw)
- return Success;
- for (ccw = csw->clients; ccw; ccw = ccw->next)
- {
- int ret = compUnredirectWindow (clients[CLIENT_ID(ccw->id)],
- pWin, ccw->update);
- if (ret != Success)
- return ret;
+ return Success;
+ for (ccw = csw->clients; ccw; ccw = ccw->next) {
+ int ret = compUnredirectWindow(clients[CLIENT_ID(ccw->id)],
+ pWin, ccw->update);
+
+ if (ret != Success)
+ return ret;
}
return Success;
}
static PixmapPtr
-compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
+compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- WindowPtr pParent = pWin->parent;
- PixmapPtr pPixmap;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ WindowPtr pParent = pWin->parent;
+ PixmapPtr pPixmap;
pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth,
- CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
+ CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
if (!pPixmap)
- return 0;
-
+ return 0;
+
pPixmap->screen_x = x;
pPixmap->screen_y = y;
- if (pParent->drawable.depth == pWin->drawable.depth)
- {
- GCPtr pGC = GetScratchGC (pWin->drawable.depth, pScreen);
-
- if (pGC)
- {
- ChangeGCVal val;
- val.val = IncludeInferiors;
- ChangeGC (NullClient, pGC, GCSubwindowMode, &val);
- ValidateGC(&pPixmap->drawable, pGC);
- (*pGC->ops->CopyArea) (&pParent->drawable,
- &pPixmap->drawable,
- pGC,
- x - pParent->drawable.x,
- y - pParent->drawable.y,
- w, h, 0, 0);
- FreeScratchGC (pGC);
- }
+ if (pParent->drawable.depth == pWin->drawable.depth) {
+ GCPtr pGC = GetScratchGC(pWin->drawable.depth, pScreen);
+
+ if (pGC) {
+ ChangeGCVal val;
+
+ val.val = IncludeInferiors;
+ ChangeGC(NullClient, pGC, GCSubwindowMode, &val);
+ ValidateGC(&pPixmap->drawable, pGC);
+ (*pGC->ops->CopyArea) (&pParent->drawable,
+ &pPixmap->drawable,
+ pGC,
+ x - pParent->drawable.x,
+ y - pParent->drawable.y, w, h, 0, 0);
+ FreeScratchGC(pGC);
+ }
}
- else
- {
- PictFormatPtr pSrcFormat = compWindowFormat (pParent);
- PictFormatPtr pDstFormat = compWindowFormat (pWin);
- XID inferiors = IncludeInferiors;
- int error;
-
- PicturePtr pSrcPicture = CreatePicture (None,
- &pParent->drawable,
- pSrcFormat,
- CPSubwindowMode,
- &inferiors,
- serverClient, &error);
-
- PicturePtr pDstPicture = CreatePicture (None,
- &pPixmap->drawable,
- pDstFormat,
- 0, 0,
- serverClient, &error);
-
- if (pSrcPicture && pDstPicture)
- {
- CompositePicture (PictOpSrc,
- pSrcPicture,
- NULL,
- pDstPicture,
- x - pParent->drawable.x,
- y - pParent->drawable.y,
- 0, 0, 0, 0, w, h);
- }
- if (pSrcPicture)
- FreePicture (pSrcPicture, 0);
- if (pDstPicture)
- FreePicture (pDstPicture, 0);
+ else {
+ PictFormatPtr pSrcFormat = compWindowFormat(pParent);
+ PictFormatPtr pDstFormat = compWindowFormat(pWin);
+ XID inferiors = IncludeInferiors;
+ int error;
+
+ PicturePtr pSrcPicture = CreatePicture(None,
+ &pParent->drawable,
+ pSrcFormat,
+ CPSubwindowMode,
+ &inferiors,
+ serverClient, &error);
+
+ PicturePtr pDstPicture = CreatePicture(None,
+ &pPixmap->drawable,
+ pDstFormat,
+ 0, 0,
+ serverClient, &error);
+
+ if (pSrcPicture && pDstPicture) {
+ CompositePicture(PictOpSrc,
+ pSrcPicture,
+ NULL,
+ pDstPicture,
+ x - pParent->drawable.x,
+ y - pParent->drawable.y, 0, 0, 0, 0, w, h);
+ }
+ if (pSrcPicture)
+ FreePicture(pSrcPicture, 0);
+ if (pDstPicture)
+ FreePicture(pDstPicture, 0);
}
return pPixmap;
}
Bool
-compAllocPixmap (WindowPtr pWin)
+compAllocPixmap(WindowPtr pWin)
{
- int bw = (int) pWin->borderWidth;
- int x = pWin->drawable.x - bw;
- int y = pWin->drawable.y - bw;
- int w = pWin->drawable.width + (bw << 1);
- int h = pWin->drawable.height + (bw << 1);
- PixmapPtr pPixmap = compNewPixmap (pWin, x, y, w, h);
- CompWindowPtr cw = GetCompWindow (pWin);
+ int bw = (int) pWin->borderWidth;
+ int x = pWin->drawable.x - bw;
+ int y = pWin->drawable.y - bw;
+ int w = pWin->drawable.width + (bw << 1);
+ int h = pWin->drawable.height + (bw << 1);
+ PixmapPtr pPixmap = compNewPixmap(pWin, x, y, w, h);
+ CompWindowPtr cw = GetCompWindow(pWin);
if (!pPixmap)
- return FALSE;
+ return FALSE;
if (cw->update == CompositeRedirectAutomatic)
- pWin->redirectDraw = RedirectDrawAutomatic;
+ pWin->redirectDraw = RedirectDrawAutomatic;
else
- pWin->redirectDraw = RedirectDrawManual;
+ pWin->redirectDraw = RedirectDrawManual;
- compSetPixmap (pWin, pPixmap);
+ compSetPixmap(pWin, pPixmap);
cw->oldx = COMP_ORIGIN_INVALID;
cw->oldy = COMP_ORIGIN_INVALID;
cw->damageRegistered = FALSE;
- if (cw->update == CompositeRedirectAutomatic)
- {
- DamageRegister (&pWin->drawable, cw->damage);
- cw->damageRegistered = TRUE;
+ if (cw->update == CompositeRedirectAutomatic) {
+ DamageRegister(&pWin->drawable, cw->damage);
+ cw->damageRegistered = TRUE;
}
/* Make sure our borderClip is up to date */
@@ -665,17 +632,16 @@ compAllocPixmap (WindowPtr pWin)
}
void
-compSetParentPixmap (WindowPtr pWin)
+compSetParentPixmap(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pParentPixmap;
- CompWindowPtr cw = GetCompWindow (pWin);
-
- if (cw->damageRegistered)
- {
- DamageUnregister (&pWin->drawable, cw->damage);
- cw->damageRegistered = FALSE;
- DamageEmpty (cw->damage);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PixmapPtr pParentPixmap;
+ CompWindowPtr cw = GetCompWindow(pWin);
+
+ if (cw->damageRegistered) {
+ DamageUnregister(&pWin->drawable, cw->damage);
+ cw->damageRegistered = FALSE;
+ DamageEmpty(cw->damage);
}
/*
* Move the parent-constrained border clip region back into
@@ -686,7 +652,7 @@ compSetParentPixmap (WindowPtr pWin)
RegionCopy(&pWin->borderClip, &cw->borderClip);
pParentPixmap = (*pScreen->GetWindowPixmap) (pWin->parent);
pWin->redirectDraw = RedirectDrawNone;
- compSetPixmap (pWin, pParentPixmap);
+ compSetPixmap(pWin, pParentPixmap);
}
/*
@@ -695,35 +661,33 @@ compSetParentPixmap (WindowPtr pWin)
* old pixmap in cw->pOldPixmap so bits can be recovered
*/
Bool
-compReallocPixmap (WindowPtr pWin, int draw_x, int draw_y,
- unsigned int w, unsigned int h, int bw)
+compReallocPixmap(WindowPtr pWin, int draw_x, int draw_y,
+ unsigned int w, unsigned int h, int bw)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pOld = (*pScreen->GetWindowPixmap) (pWin);
- PixmapPtr pNew;
- CompWindowPtr cw = GetCompWindow (pWin);
- int pix_x, pix_y;
- int pix_w, pix_h;
-
- assert (cw && pWin->redirectDraw != RedirectDrawNone);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PixmapPtr pOld = (*pScreen->GetWindowPixmap) (pWin);
+ PixmapPtr pNew;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ int pix_x, pix_y;
+ int pix_w, pix_h;
+
+ assert(cw && pWin->redirectDraw != RedirectDrawNone);
cw->oldx = pOld->screen_x;
cw->oldy = pOld->screen_y;
pix_x = draw_x - bw;
pix_y = draw_y - bw;
pix_w = w + (bw << 1);
pix_h = h + (bw << 1);
- if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height)
- {
- pNew = compNewPixmap (pWin, pix_x, pix_y, pix_w, pix_h);
- if (!pNew)
- return FALSE;
- cw->pOldPixmap = pOld;
- compSetPixmap (pWin, pNew);
+ if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height) {
+ pNew = compNewPixmap(pWin, pix_x, pix_y, pix_w, pix_h);
+ if (!pNew)
+ return FALSE;
+ cw->pOldPixmap = pOld;
+ compSetPixmap(pWin, pNew);
}
- else
- {
- pNew = pOld;
- cw->pOldPixmap = 0;
+ else {
+ pNew = pOld;
+ cw->pOldPixmap = 0;
}
pNew->screen_x = pix_x;
pNew->screen_y = pix_y;
diff --git a/composite/compext.c b/composite/compext.c
index 722587a43..940eed1fc 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -49,66 +49,66 @@
#include "xace.h"
#include "protocol-versions.h"
-static CARD8 CompositeReqCode;
+static CARD8 CompositeReqCode;
static DevPrivateKeyRec CompositeClientPrivateKeyRec;
+
#define CompositeClientPrivateKey (&CompositeClientPrivateKeyRec)
-RESTYPE CompositeClientWindowType;
-RESTYPE CompositeClientSubwindowsType;
-RESTYPE CompositeClientOverlayType;
+RESTYPE CompositeClientWindowType;
+RESTYPE CompositeClientSubwindowsType;
+RESTYPE CompositeClientOverlayType;
typedef struct _CompositeClient {
- int major_version;
- int minor_version;
+ int major_version;
+ int minor_version;
} CompositeClientRec, *CompositeClientPtr;
#define GetCompositeClient(pClient) ((CompositeClientPtr) \
dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey))
static void
-CompositeClientCallback (CallbackListPtr *list,
- pointer closure,
- pointer data)
+CompositeClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- CompositeClientPtr pCompositeClient = GetCompositeClient (pClient);
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ CompositeClientPtr pCompositeClient = GetCompositeClient(pClient);
pCompositeClient->major_version = 0;
pCompositeClient->minor_version = 0;
}
static int
-FreeCompositeClientWindow (pointer value, XID ccwid)
+FreeCompositeClientWindow(pointer value, XID ccwid)
{
- WindowPtr pWin = value;
+ WindowPtr pWin = value;
- compFreeClientWindow (pWin, ccwid);
+ compFreeClientWindow(pWin, ccwid);
return Success;
}
static int
-FreeCompositeClientSubwindows (pointer value, XID ccwid)
+FreeCompositeClientSubwindows(pointer value, XID ccwid)
{
- WindowPtr pWin = value;
+ WindowPtr pWin = value;
- compFreeClientSubwindows (pWin, ccwid);
+ compFreeClientSubwindows(pWin, ccwid);
return Success;
}
static int
-FreeCompositeClientOverlay (pointer value, XID ccwid)
+FreeCompositeClientOverlay(pointer value, XID ccwid)
{
CompOverlayClientPtr pOc = (CompOverlayClientPtr) value;
- compFreeOverlayClient (pOc);
+ compFreeOverlayClient(pOc);
return Success;
}
static int
-ProcCompositeQueryVersion (ClientPtr client)
+ProcCompositeQueryVersion(ClientPtr client)
{
- CompositeClientPtr pCompositeClient = GetCompositeClient (client);
+ CompositeClientPtr pCompositeClient = GetCompositeClient(client);
xCompositeQueryVersionReply rep;
+
REQUEST(xCompositeQueryVersionReq);
REQUEST_SIZE_MATCH(xCompositeQueryVersionReq);
@@ -116,21 +116,22 @@ ProcCompositeQueryVersion (ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) {
- rep.majorVersion = stuff->majorVersion;
- rep.minorVersion = stuff->minorVersion;
- } else {
- rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION;
+ rep.majorVersion = stuff->majorVersion;
+ rep.minorVersion = stuff->minorVersion;
+ }
+ else {
+ rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION;
rep.minorVersion = SERVER_COMPOSITE_MINOR_VERSION;
}
pCompositeClient->major_version = rep.majorVersion;
pCompositeClient->minor_version = rep.minorVersion;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.majorVersion);
- swapl(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.majorVersion);
+ swapl(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xCompositeQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xCompositeQueryVersionReply), (char *) &rep);
return Success;
}
@@ -146,129 +147,134 @@ ProcCompositeQueryVersion (ClientPtr client)
} while (0)
static int
-ProcCompositeRedirectWindow (ClientPtr client)
+ProcCompositeRedirectWindow(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xCompositeRedirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
VERIFY_WINDOW(pWin, stuff->window, client,
- DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+ DixSetAttrAccess | DixManageAccess | DixBlendAccess);
- return compRedirectWindow (client, pWin, stuff->update);
+ return compRedirectWindow(client, pWin, stuff->update);
}
static int
-ProcCompositeRedirectSubwindows (ClientPtr client)
+ProcCompositeRedirectSubwindows(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xCompositeRedirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
VERIFY_WINDOW(pWin, stuff->window, client,
- DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+ DixSetAttrAccess | DixManageAccess | DixBlendAccess);
- return compRedirectSubwindows (client, pWin, stuff->update);
+ return compRedirectSubwindows(client, pWin, stuff->update);
}
static int
-ProcCompositeUnredirectWindow (ClientPtr client)
+ProcCompositeUnredirectWindow(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xCompositeUnredirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
VERIFY_WINDOW(pWin, stuff->window, client,
- DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+ DixSetAttrAccess | DixManageAccess | DixBlendAccess);
- return compUnredirectWindow (client, pWin, stuff->update);
+ return compUnredirectWindow(client, pWin, stuff->update);
}
static int
-ProcCompositeUnredirectSubwindows (ClientPtr client)
+ProcCompositeUnredirectSubwindows(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xCompositeUnredirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
VERIFY_WINDOW(pWin, stuff->window, client,
- DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+ DixSetAttrAccess | DixManageAccess | DixBlendAccess);
- return compUnredirectSubwindows (client, pWin, stuff->update);
+ return compUnredirectSubwindows(client, pWin, stuff->update);
}
static int
-ProcCompositeCreateRegionFromBorderClip (ClientPtr client)
+ProcCompositeCreateRegionFromBorderClip(ClientPtr client)
{
- WindowPtr pWin;
- CompWindowPtr cw;
- RegionPtr pBorderClip, pRegion;
+ WindowPtr pWin;
+ CompWindowPtr cw;
+ RegionPtr pBorderClip, pRegion;
+
REQUEST(xCompositeCreateRegionFromBorderClipReq);
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
- LEGAL_NEW_RESOURCE (stuff->region, client);
-
- cw = GetCompWindow (pWin);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
+
+ cw = GetCompWindow(pWin);
if (cw)
- pBorderClip = &cw->borderClip;
+ pBorderClip = &cw->borderClip;
else
- pBorderClip = &pWin->borderClip;
- pRegion = XFixesRegionCopy (pBorderClip);
+ pBorderClip = &pWin->borderClip;
+ pRegion = XFixesRegionCopy(pBorderClip);
if (!pRegion)
- return BadAlloc;
+ return BadAlloc;
RegionTranslate(pRegion, -pWin->drawable.x, -pWin->drawable.y);
-
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
+
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
return Success;
}
static int
-ProcCompositeNameWindowPixmap (ClientPtr client)
+ProcCompositeNameWindowPixmap(ClientPtr client)
{
- WindowPtr pWin;
- CompWindowPtr cw;
- PixmapPtr pPixmap;
+ WindowPtr pWin;
+ CompWindowPtr cw;
+ PixmapPtr pPixmap;
int rc;
+
REQUEST(xCompositeNameWindowPixmapReq);
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
if (!pWin->viewable)
- return BadMatch;
+ return BadMatch;
- LEGAL_NEW_RESOURCE (stuff->pixmap, client);
-
- cw = GetCompWindow (pWin);
+ LEGAL_NEW_RESOURCE(stuff->pixmap, client);
+
+ cw = GetCompWindow(pWin);
if (!cw)
- return BadMatch;
+ return BadMatch;
pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
if (!pPixmap)
- return BadMatch;
+ return BadMatch;
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
- pPixmap, RT_WINDOW, pWin, DixCreateAccess);
+ pPixmap, RT_WINDOW, pWin, DixCreateAccess);
if (rc != Success)
- return rc;
+ return rc;
++pPixmap->refcnt;
- if (!AddResource (stuff->pixmap, RT_PIXMAP, (pointer) pPixmap))
- return BadAlloc;
+ if (!AddResource(stuff->pixmap, RT_PIXMAP, (pointer) pPixmap))
+ return BadAlloc;
return Success;
}
-
static int
-ProcCompositeGetOverlayWindow (ClientPtr client)
+ProcCompositeGetOverlayWindow(ClientPtr client)
{
- REQUEST(xCompositeGetOverlayWindowReq);
+ REQUEST(xCompositeGetOverlayWindowReq);
xCompositeGetOverlayWindowReply rep;
WindowPtr pWin;
ScreenPtr pScreen;
@@ -286,25 +292,23 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
*/
pOc = compCreateOverlayClient(pScreen, client);
if (pOc == NULL)
- return BadAlloc;
+ return BadAlloc;
/*
* Make sure the overlay window exists
*/
cs = GetCompScreen(pScreen);
if (cs->pOverlayWin == NULL)
- if (!compCreateOverlayWindow(pScreen))
- {
- FreeResource (pOc->resource, RT_NONE);
- return BadAlloc;
- }
+ if (!compCreateOverlayWindow(pScreen)) {
+ FreeResource(pOc->resource, RT_NONE);
+ return BadAlloc;
+ }
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
- RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
- if (rc != Success)
- {
- FreeResource (pOc->resource, RT_NONE);
- return rc;
+ RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
+ if (rc != Success) {
+ FreeResource(pOc->resource, RT_NONE);
+ return rc;
}
rep.type = X_Reply;
@@ -312,21 +316,21 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
rep.length = 0;
rep.overlayWin = cs->pOverlayWin->drawable.id;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.overlayWin);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.overlayWin);
}
- (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply, (char *)&rep);
+ (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply,
+ (char *) &rep);
return Success;
}
static int
-ProcCompositeReleaseOverlayWindow (ClientPtr client)
+ProcCompositeReleaseOverlayWindow(ClientPtr client)
{
- REQUEST(xCompositeReleaseOverlayWindowReq);
+ REQUEST(xCompositeReleaseOverlayWindowReq);
WindowPtr pWin;
ScreenPtr pScreen;
CompOverlayClientPtr pOc;
@@ -339,41 +343,39 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client)
* Has client queried a reference to the overlay window
* on this screen? If not, generate an error.
*/
- pOc = compFindOverlayClient (pWin->drawable.pScreen, client);
+ pOc = compFindOverlayClient(pWin->drawable.pScreen, client);
if (pOc == NULL)
- return BadMatch;
+ return BadMatch;
/* The delete function will free the client structure */
- FreeResource (pOc->resource, RT_NONE);
+ FreeResource(pOc->resource, RT_NONE);
return Success;
}
-static int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
- ProcCompositeQueryVersion,
- ProcCompositeRedirectWindow,
- ProcCompositeRedirectSubwindows,
- ProcCompositeUnredirectWindow,
- ProcCompositeUnredirectSubwindows,
- ProcCompositeCreateRegionFromBorderClip,
- ProcCompositeNameWindowPixmap,
- ProcCompositeGetOverlayWindow,
- ProcCompositeReleaseOverlayWindow,
-};
+static int (*ProcCompositeVector[CompositeNumberRequests]) (ClientPtr) = {
+ProcCompositeQueryVersion,
+ ProcCompositeRedirectWindow,
+ ProcCompositeRedirectSubwindows,
+ ProcCompositeUnredirectWindow,
+ ProcCompositeUnredirectSubwindows,
+ ProcCompositeCreateRegionFromBorderClip,
+ ProcCompositeNameWindowPixmap,
+ ProcCompositeGetOverlayWindow, ProcCompositeReleaseOverlayWindow,};
static int
-ProcCompositeDispatch (ClientPtr client)
+ProcCompositeDispatch(ClientPtr client)
{
REQUEST(xReq);
-
+
if (stuff->data < CompositeNumberRequests)
- return (*ProcCompositeVector[stuff->data]) (client);
+ return (*ProcCompositeVector[stuff->data]) (client);
else
- return BadRequest;
+ return BadRequest;
}
static int
-SProcCompositeQueryVersion (ClientPtr client)
+SProcCompositeQueryVersion(ClientPtr client)
{
REQUEST(xCompositeQueryVersionReq);
@@ -385,7 +387,7 @@ SProcCompositeQueryVersion (ClientPtr client)
}
static int
-SProcCompositeRedirectWindow (ClientPtr client)
+SProcCompositeRedirectWindow(ClientPtr client)
{
REQUEST(xCompositeRedirectWindowReq);
@@ -396,7 +398,7 @@ SProcCompositeRedirectWindow (ClientPtr client)
}
static int
-SProcCompositeRedirectSubwindows (ClientPtr client)
+SProcCompositeRedirectSubwindows(ClientPtr client)
{
REQUEST(xCompositeRedirectSubwindowsReq);
@@ -407,7 +409,7 @@ SProcCompositeRedirectSubwindows (ClientPtr client)
}
static int
-SProcCompositeUnredirectWindow (ClientPtr client)
+SProcCompositeUnredirectWindow(ClientPtr client)
{
REQUEST(xCompositeUnredirectWindowReq);
@@ -418,7 +420,7 @@ SProcCompositeUnredirectWindow (ClientPtr client)
}
static int
-SProcCompositeUnredirectSubwindows (ClientPtr client)
+SProcCompositeUnredirectSubwindows(ClientPtr client)
{
REQUEST(xCompositeUnredirectSubwindowsReq);
@@ -429,7 +431,7 @@ SProcCompositeUnredirectSubwindows (ClientPtr client)
}
static int
-SProcCompositeCreateRegionFromBorderClip (ClientPtr client)
+SProcCompositeCreateRegionFromBorderClip(ClientPtr client)
{
REQUEST(xCompositeCreateRegionFromBorderClipReq);
@@ -441,7 +443,7 @@ SProcCompositeCreateRegionFromBorderClip (ClientPtr client)
}
static int
-SProcCompositeNameWindowPixmap (ClientPtr client)
+SProcCompositeNameWindowPixmap(ClientPtr client)
{
REQUEST(xCompositeNameWindowPixmapReq);
@@ -453,7 +455,7 @@ SProcCompositeNameWindowPixmap (ClientPtr client)
}
static int
-SProcCompositeGetOverlayWindow (ClientPtr client)
+SProcCompositeGetOverlayWindow(ClientPtr client)
{
REQUEST(xCompositeGetOverlayWindowReq);
@@ -464,7 +466,7 @@ SProcCompositeGetOverlayWindow (ClientPtr client)
}
static int
-SProcCompositeReleaseOverlayWindow (ClientPtr client)
+SProcCompositeReleaseOverlayWindow(ClientPtr client)
{
REQUEST(xCompositeReleaseOverlayWindowReq);
@@ -474,92 +476,89 @@ SProcCompositeReleaseOverlayWindow (ClientPtr client)
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
}
-static int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
- SProcCompositeQueryVersion,
- SProcCompositeRedirectWindow,
- SProcCompositeRedirectSubwindows,
- SProcCompositeUnredirectWindow,
- SProcCompositeUnredirectSubwindows,
- SProcCompositeCreateRegionFromBorderClip,
- SProcCompositeNameWindowPixmap,
- SProcCompositeGetOverlayWindow,
- SProcCompositeReleaseOverlayWindow,
-};
+static int (*SProcCompositeVector[CompositeNumberRequests]) (ClientPtr) = {
+SProcCompositeQueryVersion,
+ SProcCompositeRedirectWindow,
+ SProcCompositeRedirectSubwindows,
+ SProcCompositeUnredirectWindow,
+ SProcCompositeUnredirectSubwindows,
+ SProcCompositeCreateRegionFromBorderClip,
+ SProcCompositeNameWindowPixmap,
+ SProcCompositeGetOverlayWindow, SProcCompositeReleaseOverlayWindow,};
static int
-SProcCompositeDispatch (ClientPtr client)
+SProcCompositeDispatch(ClientPtr client)
{
REQUEST(xReq);
-
+
if (stuff->data < CompositeNumberRequests)
- return (*SProcCompositeVector[stuff->data]) (client);
+ return (*SProcCompositeVector[stuff->data]) (client);
else
- return BadRequest;
+ return BadRequest;
}
void
-CompositeExtensionInit (void)
+CompositeExtensionInit(void)
{
- ExtensionEntry *extEntry;
- int s;
+ ExtensionEntry *extEntry;
+ int s;
/* Assume initialization is going to fail */
noCompositeExtension = TRUE;
for (s = 0; s < screenInfo.numScreens; s++) {
- ScreenPtr pScreen = screenInfo.screens[s];
- VisualPtr vis;
-
- /* Composite on 8bpp pseudocolor root windows appears to fail, so
- * just disable it on anything pseudocolor for safety.
- */
- for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++)
- ;
- if ((vis->class | DynamicClass) == PseudoColor)
- return;
-
- /* Ensure that Render is initialized, which is required for automatic
- * compositing.
- */
- if (GetPictureScreenIfSet(pScreen) == NULL)
- return;
+ ScreenPtr pScreen = screenInfo.screens[s];
+ VisualPtr vis;
+
+ /* Composite on 8bpp pseudocolor root windows appears to fail, so
+ * just disable it on anything pseudocolor for safety.
+ */
+ for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++);
+ if ((vis->class | DynamicClass) == PseudoColor)
+ return;
+
+ /* Ensure that Render is initialized, which is required for automatic
+ * compositing.
+ */
+ if (GetPictureScreenIfSet(pScreen) == NULL)
+ return;
}
CompositeClientWindowType = CreateNewResourceType
- (FreeCompositeClientWindow, "CompositeClientWindow");
+ (FreeCompositeClientWindow, "CompositeClientWindow");
if (!CompositeClientWindowType)
- return;
+ return;
CompositeClientSubwindowsType = CreateNewResourceType
- (FreeCompositeClientSubwindows, "CompositeClientSubwindows");
+ (FreeCompositeClientSubwindows, "CompositeClientSubwindows");
if (!CompositeClientSubwindowsType)
- return;
+ return;
CompositeClientOverlayType = CreateNewResourceType
- (FreeCompositeClientOverlay, "CompositeClientOverlay");
+ (FreeCompositeClientOverlay, "CompositeClientOverlay");
if (!CompositeClientOverlayType)
- return;
+ return;
if (!dixRegisterPrivateKey(&CompositeClientPrivateKeyRec, PRIVATE_CLIENT,
- sizeof(CompositeClientRec)))
- return;
+ sizeof(CompositeClientRec)))
+ return;
- if (!AddCallback (&ClientStateCallback, CompositeClientCallback, 0))
- return;
+ if (!AddCallback(&ClientStateCallback, CompositeClientCallback, 0))
+ return;
for (s = 0; s < screenInfo.numScreens; s++)
- if (!compScreenInit (screenInfo.screens[s]))
- return;
+ if (!compScreenInit(screenInfo.screens[s]))
+ return;
- extEntry = AddExtension (COMPOSITE_NAME, 0, 0,
- ProcCompositeDispatch, SProcCompositeDispatch,
- NULL, StandardMinorOpcode);
+ extEntry = AddExtension(COMPOSITE_NAME, 0, 0,
+ ProcCompositeDispatch, SProcCompositeDispatch,
+ NULL, StandardMinorOpcode);
if (!extEntry)
- return;
+ return;
CompositeReqCode = (CARD8) extEntry->base;
- miRegisterRedirectBorderClipProc (compSetRedirectBorderClip,
- compGetRedirectBorderClip);
+ miRegisterRedirectBorderClipProc(compSetRedirectBorderClip,
+ compGetRedirectBorderClip);
/* Initialization succeeded */
noCompositeExtension = FALSE;
@@ -571,175 +570,178 @@ CompositeExtensionInit (void)
int (*PanoramiXSaveCompositeVector[CompositeNumberRequests]) (ClientPtr);
static int
-PanoramiXCompositeRedirectWindow (ClientPtr client)
+PanoramiXCompositeRedirectWindow(ClientPtr client)
{
PanoramiXRes *win;
int rc = 0, j;
+
REQUEST(xCompositeRedirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
FOR_NSCREENS_FORWARD(j) {
- stuff->window = win->info[j].id;
- rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
- if (rc != Success) break;
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success)
+ break;
}
return rc;
}
static int
-PanoramiXCompositeRedirectSubwindows (ClientPtr client)
+PanoramiXCompositeRedirectSubwindows(ClientPtr client)
{
PanoramiXRes *win;
int rc = 0, j;
+
REQUEST(xCompositeRedirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
FOR_NSCREENS_FORWARD(j) {
- stuff->window = win->info[j].id;
- rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
- if (rc != Success) break;
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success)
+ break;
}
return rc;
}
static int
-PanoramiXCompositeUnredirectWindow (ClientPtr client)
+PanoramiXCompositeUnredirectWindow(ClientPtr client)
{
PanoramiXRes *win;
int rc = 0, j;
+
REQUEST(xCompositeUnredirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
FOR_NSCREENS_FORWARD(j) {
- stuff->window = win->info[j].id;
- rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
- if (rc != Success) break;
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success)
+ break;
}
return rc;
}
static int
-PanoramiXCompositeUnredirectSubwindows (ClientPtr client)
+PanoramiXCompositeUnredirectSubwindows(ClientPtr client)
{
PanoramiXRes *win;
int rc = 0, j;
+
REQUEST(xCompositeUnredirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
FOR_NSCREENS_FORWARD(j) {
- stuff->window = win->info[j].id;
- rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
- if (rc != Success) break;
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success)
+ break;
}
return rc;
}
static int
-PanoramiXCompositeNameWindowPixmap (ClientPtr client)
+PanoramiXCompositeNameWindowPixmap(ClientPtr client)
{
- WindowPtr pWin;
- CompWindowPtr cw;
- PixmapPtr pPixmap;
+ WindowPtr pWin;
+ CompWindowPtr cw;
+ PixmapPtr pPixmap;
int rc;
PanoramiXRes *win, *newPix;
int i;
+
REQUEST(xCompositeNameWindowPixmapReq);
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
- LEGAL_NEW_RESOURCE (stuff->pixmap, client);
+ LEGAL_NEW_RESOURCE(stuff->pixmap, client);
- if(!(newPix = malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPix = malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPix->type = XRT_PIXMAP;
newPix->u.pix.shared = FALSE;
panoramix_setup_ids(newPix, client, stuff->pixmap);
FOR_NSCREENS(i) {
- rc = dixLookupResourceByType ((void **) &pWin, win->info[i].id,
- RT_WINDOW, client, DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- free (newPix);
- return rc;
- }
-
- if (!pWin->viewable)
- {
- free (newPix);
- return BadMatch;
- }
-
- cw = GetCompWindow (pWin);
- if (!cw)
- {
- free (newPix);
- return BadMatch;
- }
-
- pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
- if (!pPixmap)
- {
- free (newPix);
- return BadMatch;
- }
-
- if (!AddResource (newPix->info[i].id, RT_PIXMAP,
- (pointer) pPixmap))
- return BadAlloc;
-
- ++pPixmap->refcnt;
+ rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
+ RT_WINDOW, client, DixGetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->window;
+ free(newPix);
+ return rc;
+ }
+
+ if (!pWin->viewable) {
+ free(newPix);
+ return BadMatch;
+ }
+
+ cw = GetCompWindow(pWin);
+ if (!cw) {
+ free(newPix);
+ return BadMatch;
+ }
+
+ pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
+ if (!pPixmap) {
+ free(newPix);
+ return BadMatch;
+ }
+
+ if (!AddResource(newPix->info[i].id, RT_PIXMAP, (pointer) pPixmap))
+ return BadAlloc;
+
+ ++pPixmap->refcnt;
}
- if (!AddResource (stuff->pixmap, XRT_PIXMAP, (pointer) newPix))
- return BadAlloc;
+ if (!AddResource(stuff->pixmap, XRT_PIXMAP, (pointer) newPix))
+ return BadAlloc;
return Success;
}
-
static int
-PanoramiXCompositeGetOverlayWindow (ClientPtr client)
+PanoramiXCompositeGetOverlayWindow(ClientPtr client)
{
REQUEST(xCompositeGetOverlayWindowReq);
xCompositeGetOverlayWindowReply rep;
@@ -753,70 +755,65 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
cs = GetCompScreen(screenInfo.screens[0]);
- if (!cs->pOverlayWin)
- {
- if(!(overlayWin = malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!cs->pOverlayWin) {
+ if (!(overlayWin = malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
- overlayWin->type = XRT_WINDOW;
- overlayWin->u.win.root = FALSE;
+ overlayWin->type = XRT_WINDOW;
+ overlayWin->u.win.root = FALSE;
}
FOR_NSCREENS_BACKWARD(i) {
- rc = dixLookupResourceByType((pointer *)&pWin, win->info[i].id,
- RT_WINDOW, client, DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- return rc;
- }
- pScreen = pWin->drawable.pScreen;
-
- /*
- * Create an OverlayClient structure to mark this client's
- * interest in the overlay window
- */
- pOc = compCreateOverlayClient(pScreen, client);
- if (pOc == NULL)
- return BadAlloc;
-
- /*
- * Make sure the overlay window exists
- */
- cs = GetCompScreen(pScreen);
- if (cs->pOverlayWin == NULL)
- if (!compCreateOverlayWindow(pScreen))
- {
- FreeResource (pOc->resource, RT_NONE);
- return BadAlloc;
- }
-
- rc = XaceHook(XACE_RESOURCE_ACCESS, client,
- cs->pOverlayWin->drawable.id,
- RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
- DixGetAttrAccess);
- if (rc != Success)
- {
- FreeResource (pOc->resource, RT_NONE);
- return rc;
- }
+ rc = dixLookupResourceByType((pointer *) &pWin, win->info[i].id,
+ RT_WINDOW, client, DixGetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+ pScreen = pWin->drawable.pScreen;
+
+ /*
+ * Create an OverlayClient structure to mark this client's
+ * interest in the overlay window
+ */
+ pOc = compCreateOverlayClient(pScreen, client);
+ if (pOc == NULL)
+ return BadAlloc;
+
+ /*
+ * Make sure the overlay window exists
+ */
+ cs = GetCompScreen(pScreen);
+ if (cs->pOverlayWin == NULL)
+ if (!compCreateOverlayWindow(pScreen)) {
+ FreeResource(pOc->resource, RT_NONE);
+ return BadAlloc;
+ }
+
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client,
+ cs->pOverlayWin->drawable.id,
+ RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
+ DixGetAttrAccess);
+ if (rc != Success) {
+ FreeResource(pOc->resource, RT_NONE);
+ return rc;
+ }
}
- if (overlayWin)
- {
- FOR_NSCREENS(i) {
- cs = GetCompScreen(screenInfo.screens[i]);
- overlayWin->info[i].id = cs->pOverlayWin->drawable.id;
- }
+ if (overlayWin) {
+ FOR_NSCREENS(i) {
+ cs = GetCompScreen(screenInfo.screens[i]);
+ overlayWin->info[i].id = cs->pOverlayWin->drawable.id;
+ }
- AddResource(overlayWin->info[0].id, XRT_WINDOW, overlayWin);
+ AddResource(overlayWin->info[0].id, XRT_WINDOW, overlayWin);
}
cs = GetCompScreen(screenInfo.screens[0]);
@@ -826,19 +823,19 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
rep.length = 0;
rep.overlayWin = cs->pOverlayWin->drawable.id;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.overlayWin);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.overlayWin);
}
- (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply, (char *)&rep);
+ (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply,
+ (char *) &rep);
return Success;
}
static int
-PanoramiXCompositeReleaseOverlayWindow (ClientPtr client)
+PanoramiXCompositeReleaseOverlayWindow(ClientPtr client)
{
REQUEST(xCompositeReleaseOverlayWindowReq);
WindowPtr pWin;
@@ -849,69 +846,69 @@ PanoramiXCompositeReleaseOverlayWindow (ClientPtr client)
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
FOR_NSCREENS_BACKWARD(i) {
- if ((rc = dixLookupResourceByType((void **)&pWin, win->info[i].id,
- XRT_WINDOW, client,
- DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
- }
- pScreen = pWin->drawable.pScreen;
-
- /*
- * Has client queried a reference to the overlay window
- * on this screen? If not, generate an error.
- */
- pOc = compFindOverlayClient (pWin->drawable.pScreen, client);
- if (pOc == NULL)
- return BadMatch;
-
- /* The delete function will free the client structure */
- FreeResource (pOc->resource, RT_NONE);
+ if ((rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
+ XRT_WINDOW, client,
+ DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+ pScreen = pWin->drawable.pScreen;
+
+ /*
+ * Has client queried a reference to the overlay window
+ * on this screen? If not, generate an error.
+ */
+ pOc = compFindOverlayClient(pWin->drawable.pScreen, client);
+ if (pOc == NULL)
+ return BadMatch;
+
+ /* The delete function will free the client structure */
+ FreeResource(pOc->resource, RT_NONE);
}
return Success;
}
void
-PanoramiXCompositeInit (void)
+PanoramiXCompositeInit(void)
{
int i;
for (i = 0; i < CompositeNumberRequests; i++)
- PanoramiXSaveCompositeVector[i] = ProcCompositeVector[i];
+ PanoramiXSaveCompositeVector[i] = ProcCompositeVector[i];
/*
* Stuff in Xinerama aware request processing hooks
*/
ProcCompositeVector[X_CompositeRedirectWindow] =
- PanoramiXCompositeRedirectWindow;
+ PanoramiXCompositeRedirectWindow;
ProcCompositeVector[X_CompositeRedirectSubwindows] =
- PanoramiXCompositeRedirectSubwindows;
+ PanoramiXCompositeRedirectSubwindows;
ProcCompositeVector[X_CompositeUnredirectWindow] =
- PanoramiXCompositeUnredirectWindow;
+ PanoramiXCompositeUnredirectWindow;
ProcCompositeVector[X_CompositeUnredirectSubwindows] =
- PanoramiXCompositeUnredirectSubwindows;
+ PanoramiXCompositeUnredirectSubwindows;
ProcCompositeVector[X_CompositeNameWindowPixmap] =
- PanoramiXCompositeNameWindowPixmap;
+ PanoramiXCompositeNameWindowPixmap;
ProcCompositeVector[X_CompositeGetOverlayWindow] =
- PanoramiXCompositeGetOverlayWindow;
+ PanoramiXCompositeGetOverlayWindow;
ProcCompositeVector[X_CompositeReleaseOverlayWindow] =
- PanoramiXCompositeReleaseOverlayWindow;
+ PanoramiXCompositeReleaseOverlayWindow;
}
void
-PanoramiXCompositeReset (void)
+PanoramiXCompositeReset(void)
{
int i;
for (i = 0; i < CompositeNumberRequests; i++)
- ProcCompositeVector[i] = PanoramiXSaveCompositeVector[i];
+ ProcCompositeVector[i] = PanoramiXSaveCompositeVector[i];
}
#endif
diff --git a/composite/compinit.c b/composite/compinit.c
index 90ee66c88..eaa125681 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -53,10 +53,10 @@ DevPrivateKeyRec CompWindowPrivateKeyRec;
DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
static Bool
-compCloseScreen (int index, ScreenPtr pScreen)
+compCloseScreen(int index, ScreenPtr pScreen)
{
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret;
free(cs->alternateVisuals);
@@ -68,7 +68,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
pScreen->MoveWindow = cs->MoveWindow;
pScreen->ResizeWindow = cs->ResizeWindow;
pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
-
+
pScreen->ClipNotify = cs->ClipNotify;
pScreen->UnrealizeWindow = cs->UnrealizeWindow;
pScreen->RealizeWindow = cs->RealizeWindow;
@@ -88,16 +88,16 @@ compCloseScreen (int index, ScreenPtr pScreen)
}
static void
-compInstallColormap (ColormapPtr pColormap)
+compInstallColormap(ColormapPtr pColormap)
{
- VisualPtr pVisual = pColormap->pVisual;
- ScreenPtr pScreen = pColormap->pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- int a;
+ VisualPtr pVisual = pColormap->pVisual;
+ ScreenPtr pScreen = pColormap->pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ int a;
for (a = 0; a < cs->numAlternateVisuals; a++)
- if (pVisual->vid == cs->alternateVisuals[a])
- return;
+ if (pVisual->vid == cs->alternateVisuals[a])
+ return;
pScreen->InstallColormap = cs->InstallColormap;
(*pScreen->InstallColormap) (pColormap);
cs->InstallColormap = pScreen->InstallColormap;
@@ -109,22 +109,23 @@ static Bool
compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ CompScreenPtr cs = GetCompScreen(pScreen);
Bool ret;
pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
ret = pScreen->ChangeWindowAttributes(pWin, mask);
if (ret && (mask & CWBackingStore) &&
- pScreen->backingStoreSupport != NotUseful) {
- if (pWin->backingStore != NotUseful) {
- compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
- pWin->backStorage = (pointer) (intptr_t) 1;
- } else {
- compUnredirectWindow(serverClient, pWin,
- CompositeRedirectAutomatic);
- pWin->backStorage = NULL;
- }
+ pScreen->backingStoreSupport != NotUseful) {
+ if (pWin->backingStore != NotUseful) {
+ compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
+ pWin->backStorage = (pointer) (intptr_t) 1;
+ }
+ else {
+ compUnredirectWindow(serverClient, pWin,
+ CompositeRedirectAutomatic);
+ pWin->backStorage = NULL;
+ }
}
pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
@@ -133,38 +134,36 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
}
static void
-compGetImage (DrawablePtr pDrawable,
- int sx, int sy,
- int w, int h,
- unsigned int format,
- unsigned long planemask,
- char *pdstLine)
+compGetImage(DrawablePtr pDrawable,
+ int sx, int sy,
+ int w, int h,
+ unsigned int format, unsigned long planemask, char *pdstLine)
{
ScreenPtr pScreen = pDrawable->pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->GetImage = cs->GetImage;
if (pDrawable->type == DRAWABLE_WINDOW)
- compPaintChildrenToWindow ((WindowPtr) pDrawable);
+ compPaintChildrenToWindow((WindowPtr) pDrawable);
(*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine);
cs->GetImage = pScreen->GetImage;
pScreen->GetImage = compGetImage;
}
-static void compSourceValidate(DrawablePtr pDrawable,
- int x, int y,
- int width, int height,
- unsigned int subWindowMode)
+static void
+compSourceValidate(DrawablePtr pDrawable,
+ int x, int y,
+ int width, int height, unsigned int subWindowMode)
{
ScreenPtr pScreen = pDrawable->pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->SourceValidate = cs->SourceValidate;
if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors)
- compPaintChildrenToWindow ((WindowPtr) pDrawable);
+ compPaintChildrenToWindow((WindowPtr) pDrawable);
if (pScreen->SourceValidate)
- (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
- subWindowMode);
+ (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
+ subWindowMode);
cs->SourceValidate = pScreen->SourceValidate;
pScreen->SourceValidate = compSourceValidate;
}
@@ -174,25 +173,24 @@ static void compSourceValidate(DrawablePtr pDrawable,
*/
static DepthPtr
-compFindVisuallessDepth (ScreenPtr pScreen, int d)
+compFindVisuallessDepth(ScreenPtr pScreen, int d)
{
- int i;
-
- for (i = 0; i < pScreen->numDepths; i++)
- {
- DepthPtr depth = &pScreen->allowedDepths[i];
- if (depth->depth == d)
- {
- /*
- * Make sure it doesn't have visuals already
- */
- if (depth->numVids)
- return 0;
- /*
- * looks fine
- */
- return depth;
- }
+ int i;
+
+ for (i = 0; i < pScreen->numDepths; i++) {
+ DepthPtr depth = &pScreen->allowedDepths[i];
+
+ if (depth->depth == d) {
+ /*
+ * Make sure it doesn't have visuals already
+ */
+ if (depth->numVids)
+ return 0;
+ /*
+ * looks fine
+ */
+ return depth;
+ }
}
/*
* If there isn't one, then it's gonna be hard to have
@@ -205,14 +203,14 @@ compFindVisuallessDepth (ScreenPtr pScreen, int d)
* Add a list of visual IDs to the list of visuals to implicitly redirect.
*/
static Bool
-compRegisterAlternateVisuals (CompScreenPtr cs, VisualID *vids, int nVisuals)
+compRegisterAlternateVisuals(CompScreenPtr cs, VisualID * vids, int nVisuals)
{
VisualID *p;
p = realloc(cs->alternateVisuals,
- sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
- if(p == NULL)
- return FALSE;
+ sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
+ if (p == NULL)
+ return FALSE;
memcpy(&p[cs->numAlternateVisuals], vids, sizeof(VisualID) * nVisuals);
@@ -222,36 +220,38 @@ compRegisterAlternateVisuals (CompScreenPtr cs, VisualID *vids, int nVisuals)
return TRUE;
}
-Bool CompositeRegisterAlternateVisuals (ScreenPtr pScreen, VisualID *vids,
- int nVisuals)
+Bool
+CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids,
+ int nVisuals)
{
- CompScreenPtr cs = GetCompScreen (pScreen);
+ CompScreenPtr cs = GetCompScreen(pScreen);
+
return compRegisterAlternateVisuals(cs, vids, nVisuals);
}
typedef struct _alternateVisual {
- int depth;
- CARD32 format;
+ int depth;
+ CARD32 format;
} CompAlternateVisual;
-static CompAlternateVisual altVisuals[] = {
+static CompAlternateVisual altVisuals[] = {
#if COMP_INCLUDE_RGB24_VISUAL
- { 24, PICT_r8g8b8 },
+ {24, PICT_r8g8b8},
#endif
- { 32, PICT_a8r8g8b8 },
+ {32, PICT_a8r8g8b8},
};
static const int NUM_COMP_ALTERNATE_VISUALS = sizeof(altVisuals) /
- sizeof(CompAlternateVisual);
+ sizeof(CompAlternateVisual);
static Bool
compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
- CompAlternateVisual *alt)
+ CompAlternateVisual * alt)
{
- VisualPtr visual;
- DepthPtr depth;
- PictFormatPtr pPictFormat;
- unsigned long alphaMask;
+ VisualPtr visual;
+ DepthPtr depth;
+ PictFormatPtr pPictFormat;
+ unsigned long alphaMask;
/*
* The ARGB32 visual is always available. Other alternate depth visuals
@@ -259,51 +259,53 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
* There's no deep reason for this.
*/
if (alt->depth >= pScreen->rootDepth && alt->depth != 32)
- return FALSE;
+ return FALSE;
- depth = compFindVisuallessDepth (pScreen, alt->depth);
+ depth = compFindVisuallessDepth(pScreen, alt->depth);
if (!depth)
- /* alt->depth doesn't exist or already has alternate visuals. */
- return TRUE;
+ /* alt->depth doesn't exist or already has alternate visuals. */
+ return TRUE;
- pPictFormat = PictureMatchFormat (pScreen, alt->depth, alt->format);
+ pPictFormat = PictureMatchFormat(pScreen, alt->depth, alt->format);
if (!pPictFormat)
- return FALSE;
+ return FALSE;
if (ResizeVisualArray(pScreen, 1, depth) == FALSE) {
return FALSE;
}
- visual = pScreen->visuals + (pScreen->numVisuals - 1); /* the new one */
+ visual = pScreen->visuals + (pScreen->numVisuals - 1); /* the new one */
/* Initialize the visual */
visual->bitsPerRGBValue = 8;
if (PICT_FORMAT_TYPE(alt->format) == PICT_TYPE_COLOR) {
- visual->class = PseudoColor;
- visual->nplanes = PICT_FORMAT_BPP(alt->format);
- visual->ColormapEntries = 1 << visual->nplanes;
- } else {
- DirectFormatRec *direct = &pPictFormat->direct;
- visual->class = TrueColor;
- visual->redMask = ((unsigned long)direct->redMask) << direct->red;
- visual->greenMask = ((unsigned long)direct->greenMask) << direct->green;
- visual->blueMask = ((unsigned long)direct->blueMask) << direct->blue;
- alphaMask = ((unsigned long)direct->alphaMask) << direct->alpha;
- visual->offsetRed = direct->red;
- visual->offsetGreen = direct->green;
- visual->offsetBlue = direct->blue;
- /*
- * Include A bits in this (unlike GLX which includes only RGB)
- * This lets DIX compute suitable masks for colormap allocations
- */
- visual->nplanes = Ones (visual->redMask |
- visual->greenMask |
- visual->blueMask |
- alphaMask);
- /* find widest component */
- visual->ColormapEntries = (1 << max (Ones (visual->redMask),
- max (Ones (visual->greenMask),
- Ones (visual->blueMask))));
+ visual->class = PseudoColor;
+ visual->nplanes = PICT_FORMAT_BPP(alt->format);
+ visual->ColormapEntries = 1 << visual->nplanes;
+ }
+ else {
+ DirectFormatRec *direct = &pPictFormat->direct;
+
+ visual->class = TrueColor;
+ visual->redMask = ((unsigned long) direct->redMask) << direct->red;
+ visual->greenMask =
+ ((unsigned long) direct->greenMask) << direct->green;
+ visual->blueMask = ((unsigned long) direct->blueMask) << direct->blue;
+ alphaMask = ((unsigned long) direct->alphaMask) << direct->alpha;
+ visual->offsetRed = direct->red;
+ visual->offsetGreen = direct->green;
+ visual->offsetBlue = direct->blue;
+ /*
+ * Include A bits in this (unlike GLX which includes only RGB)
+ * This lets DIX compute suitable masks for colormap allocations
+ */
+ visual->nplanes = Ones(visual->redMask |
+ visual->greenMask |
+ visual->blueMask | alphaMask);
+ /* find widest component */
+ visual->ColormapEntries = (1 << max(Ones(visual->redMask),
+ max(Ones(visual->greenMask),
+ Ones(visual->blueMask))));
}
/* remember the visual ID to detect auto-update windows */
@@ -313,33 +315,33 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
}
static Bool
-compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs)
+compAddAlternateVisuals(ScreenPtr pScreen, CompScreenPtr cs)
{
int alt, ret = 0;
for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++)
- ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt);
+ ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt);
- return !!ret;
+ return ! !ret;
}
Bool
-compScreenInit (ScreenPtr pScreen)
+compScreenInit(ScreenPtr pScreen)
{
- CompScreenPtr cs;
+ CompScreenPtr cs;
if (!dixRegisterPrivateKey(&CompScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&CompWindowPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&CompSubwindowsPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
+ return FALSE;
- if (GetCompScreen (pScreen))
- return TRUE;
- cs = (CompScreenPtr) malloc(sizeof (CompScreenRec));
+ if (GetCompScreen(pScreen))
+ return TRUE;
+ cs = (CompScreenPtr) malloc(sizeof(CompScreenRec));
if (!cs)
- return FALSE;
+ return FALSE;
cs->overlayWid = FakeClientID(0);
cs->pOverlayWin = NULL;
@@ -348,10 +350,9 @@ compScreenInit (ScreenPtr pScreen)
cs->numAlternateVisuals = 0;
cs->alternateVisuals = NULL;
- if (!compAddAlternateVisuals (pScreen, cs))
- {
- free(cs);
- return FALSE;
+ if (!compAddAlternateVisuals(pScreen, cs)) {
+ free(cs);
+ return FALSE;
}
cs->PositionWindow = pScreen->PositionWindow;
diff --git a/composite/compint.h b/composite/compint.h
index bb5335d70..6c4272e5b 100644
--- a/composite/compint.h
+++ b/composite/compint.h
@@ -80,29 +80,29 @@
*/
typedef struct _CompClientWindow {
- struct _CompClientWindow *next;
- XID id;
- int update;
-} CompClientWindowRec, *CompClientWindowPtr;
+ struct _CompClientWindow *next;
+ XID id;
+ int update;
+} CompClientWindowRec, *CompClientWindowPtr;
typedef struct _CompWindow {
- RegionRec borderClip;
- DamagePtr damage; /* for automatic update mode */
- Bool damageRegistered;
- Bool damaged;
- int update;
- CompClientWindowPtr clients;
- int oldx;
- int oldy;
- PixmapPtr pOldPixmap;
- int borderClipX, borderClipY;
+ RegionRec borderClip;
+ DamagePtr damage; /* for automatic update mode */
+ Bool damageRegistered;
+ Bool damaged;
+ int update;
+ CompClientWindowPtr clients;
+ int oldx;
+ int oldy;
+ PixmapPtr pOldPixmap;
+ int borderClipX, borderClipY;
} CompWindowRec, *CompWindowPtr;
#define COMP_ORIGIN_INVALID 0x80000000
typedef struct _CompSubwindows {
- int update;
- CompClientWindowPtr clients;
+ int update;
+ CompClientWindowPtr clients;
} CompSubwindowsRec, *CompSubwindowsPtr;
#ifndef COMP_INCLUDE_RGB24_VISUAL
@@ -112,64 +112,67 @@ typedef struct _CompSubwindows {
typedef struct _CompOverlayClientRec *CompOverlayClientPtr;
typedef struct _CompOverlayClientRec {
- CompOverlayClientPtr pNext;
- ClientPtr pClient;
- ScreenPtr pScreen;
- XID resource;
+ CompOverlayClientPtr pNext;
+ ClientPtr pClient;
+ ScreenPtr pScreen;
+ XID resource;
} CompOverlayClientRec;
typedef struct _CompScreen {
- PositionWindowProcPtr PositionWindow;
- CopyWindowProcPtr CopyWindow;
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- ClipNotifyProcPtr ClipNotify;
+ PositionWindowProcPtr PositionWindow;
+ CopyWindowProcPtr CopyWindow;
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ ClipNotifyProcPtr ClipNotify;
/*
* Called from ConfigureWindow, these
* three track changes to the offscreen storage
* geometry
*/
- ConfigNotifyProcPtr ConfigNotify;
- MoveWindowProcPtr MoveWindow;
- ResizeWindowProcPtr ResizeWindow;
- ChangeBorderWidthProcPtr ChangeBorderWidth;
+ ConfigNotifyProcPtr ConfigNotify;
+ MoveWindowProcPtr MoveWindow;
+ ResizeWindowProcPtr ResizeWindow;
+ ChangeBorderWidthProcPtr ChangeBorderWidth;
/*
* Reparenting has an effect on Subwindows redirect
*/
- ReparentWindowProcPtr ReparentWindow;
-
+ ReparentWindowProcPtr ReparentWindow;
+
/*
* Colormaps for new visuals better not get installed
*/
- InstallColormapProcPtr InstallColormap;
+ InstallColormapProcPtr InstallColormap;
/*
* Fake backing store via automatic redirection
*/
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- ScreenBlockHandlerProcPtr BlockHandler;
- CloseScreenProcPtr CloseScreen;
- int numAlternateVisuals;
- VisualID *alternateVisuals;
-
- WindowPtr pOverlayWin;
- Window overlayWid;
- CompOverlayClientPtr pOverlayClients;
-
- GetImageProcPtr GetImage;
- SourceValidateProcPtr SourceValidate;
+ ScreenBlockHandlerProcPtr BlockHandler;
+ CloseScreenProcPtr CloseScreen;
+ int numAlternateVisuals;
+ VisualID *alternateVisuals;
+
+ WindowPtr pOverlayWin;
+ Window overlayWid;
+ CompOverlayClientPtr pOverlayClients;
+
+ GetImageProcPtr GetImage;
+ SourceValidateProcPtr SourceValidate;
} CompScreenRec, *CompScreenPtr;
extern DevPrivateKeyRec CompScreenPrivateKeyRec;
+
#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)
extern DevPrivateKeyRec CompWindowPrivateKeyRec;
+
#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)
extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
+
#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
#define GetCompScreen(s) ((CompScreenPtr) \
@@ -179,83 +182,84 @@ extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
#define GetCompSubwindows(w) ((CompSubwindowsPtr) \
dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey))
-extern RESTYPE CompositeClientWindowType;
-extern RESTYPE CompositeClientSubwindowsType;
-extern RESTYPE CompositeClientOverlayType;
+extern RESTYPE CompositeClientWindowType;
+extern RESTYPE CompositeClientSubwindowsType;
+extern RESTYPE CompositeClientOverlayType;
/*
* compalloc.c
*/
Bool
-compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
+ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update);
void
-compFreeClientWindow (WindowPtr pWin, XID id);
+ compFreeClientWindow(WindowPtr pWin, XID id);
int
-compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
+ compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update);
int
-compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update);
+ compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
void
-compFreeClientSubwindows (WindowPtr pWin, XID id);
+ compFreeClientSubwindows(WindowPtr pWin, XID id);
int
-compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update);
+ compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
int
-compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin);
+ compRedirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
int
-compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin);
+ compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
Bool
-compAllocPixmap (WindowPtr pWin);
+ compAllocPixmap(WindowPtr pWin);
void
-compSetParentPixmap (WindowPtr pWin);
+ compSetParentPixmap(WindowPtr pWin);
void
-compRestoreWindow (WindowPtr pWin, PixmapPtr pPixmap);
+ compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap);
Bool
-compReallocPixmap (WindowPtr pWin, int x, int y,
- unsigned int w, unsigned int h, int bw);
+
+compReallocPixmap(WindowPtr pWin, int x, int y,
+ unsigned int w, unsigned int h, int bw);
/*
* compext.c
*/
void
-CompositeExtensionInit (void);
+ CompositeExtensionInit(void);
/*
* compinit.c
*/
Bool
-compScreenInit (ScreenPtr pScreen);
+ compScreenInit(ScreenPtr pScreen);
/*
* compoverlay.c
*/
void
-compFreeOverlayClient (CompOverlayClientPtr pOcToDel);
+ compFreeOverlayClient(CompOverlayClientPtr pOcToDel);
CompOverlayClientPtr
-compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient);
-
+compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
+
CompOverlayClientPtr
-compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient);
+compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
Bool
-compCreateOverlayWindow (ScreenPtr pScreen);
+ compCreateOverlayWindow(ScreenPtr pScreen);
void
-compDestroyOverlayWindow (ScreenPtr pScreen);
+ compDestroyOverlayWindow(ScreenPtr pScreen);
/*
* compwindow.c
@@ -263,74 +267,75 @@ compDestroyOverlayWindow (ScreenPtr pScreen);
#ifdef COMPOSITE_DEBUG
void
-compCheckTree (ScreenPtr pScreen);
+ compCheckTree(ScreenPtr pScreen);
#else
#define compCheckTree(s)
#endif
-PictFormatPtr
-compWindowFormat (WindowPtr pWin);
+PictFormatPtr compWindowFormat(WindowPtr pWin);
void
-compSetPixmap (WindowPtr pWin, PixmapPtr pPixmap);
+ compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap);
Bool
-compCheckRedirect (WindowPtr pWin);
+ compCheckRedirect(WindowPtr pWin);
Bool
-compPositionWindow (WindowPtr pWin, int x, int y);
+ compPositionWindow(WindowPtr pWin, int x, int y);
Bool
-compRealizeWindow (WindowPtr pWin);
+ compRealizeWindow(WindowPtr pWin);
Bool
-compUnrealizeWindow (WindowPtr pWin);
+ compUnrealizeWindow(WindowPtr pWin);
void
-compClipNotify (WindowPtr pWin, int dx, int dy);
+ compClipNotify(WindowPtr pWin, int dx, int dy);
void
-compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
+ compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
void
-compResizeWindow (WindowPtr pWin, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib);
+
+compResizeWindow(WindowPtr pWin, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib);
void
-compChangeBorderWidth (WindowPtr pWin, unsigned int border_width);
+ compChangeBorderWidth(WindowPtr pWin, unsigned int border_width);
void
-compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent);
+ compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent);
Bool
-compCreateWindow (WindowPtr pWin);
+ compCreateWindow(WindowPtr pWin);
Bool
-compDestroyWindow (WindowPtr pWin);
+ compDestroyWindow(WindowPtr pWin);
void
-compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion);
+ compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion);
RegionPtr
-compGetRedirectBorderClip (WindowPtr pWin);
+ compGetRedirectBorderClip(WindowPtr pWin);
void
-compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+ compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
void
-compPaintChildrenToWindow (WindowPtr pWin);
+ compPaintChildrenToWindow(WindowPtr pWin);
WindowPtr
-CompositeRealChildHead (WindowPtr pWin);
+ CompositeRealChildHead(WindowPtr pWin);
int
-DeleteWindowNoInputDevices(pointer value, XID wid);
+ DeleteWindowNoInputDevices(pointer value, XID wid);
int
+
compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
- int bw, WindowPtr pSib);
+ int bw, WindowPtr pSib);
-void PanoramiXCompositeInit (void);
-void PanoramiXCompositeReset (void);
+void PanoramiXCompositeInit(void);
+void PanoramiXCompositeReset(void);
-#endif /* _COMPINT_H_ */
+#endif /* _COMPINT_H_ */
diff --git a/composite/compositeext.h b/composite/compositeext.h
index b20bab158..600604d8d 100644
--- a/composite/compositeext.h
+++ b/composite/compositeext.h
@@ -32,7 +32,7 @@
#include "scrnintstr.h"
extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen,
- VisualID *vids,
+ VisualID * vids,
int nVisuals);
-#endif /* _COMPOSITEEXT_H_ */
+#endif /* _COMPOSITEEXT_H_ */
diff --git a/composite/compoverlay.c b/composite/compoverlay.c
index 047f069ff..d3cfaf06f 100644
--- a/composite/compoverlay.c
+++ b/composite/compoverlay.c
@@ -56,54 +56,53 @@
* Delete the given overlay client list element from its screen list.
*/
void
-compFreeOverlayClient (CompOverlayClientPtr pOcToDel)
+compFreeOverlayClient(CompOverlayClientPtr pOcToDel)
{
- ScreenPtr pScreen = pOcToDel->pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- CompOverlayClientPtr *pPrev, pOc;
-
- for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext)
- {
- if (pOc == pOcToDel) {
- *pPrev = pOc->pNext;
- free(pOc);
- break;
- }
+ ScreenPtr pScreen = pOcToDel->pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompOverlayClientPtr *pPrev, pOc;
+
+ for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext) {
+ if (pOc == pOcToDel) {
+ *pPrev = pOc->pNext;
+ free(pOc);
+ break;
+ }
}
-
+
/* Destroy overlay window when there are no more clients using it */
if (cs->pOverlayClients == NULL)
- compDestroyOverlayWindow (pScreen);
+ compDestroyOverlayWindow(pScreen);
}
/*
* Return the client's first overlay client rec from the given screen
*/
CompOverlayClientPtr
-compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
+compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
{
- CompScreenPtr cs = GetCompScreen(pScreen);
- CompOverlayClientPtr pOc;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompOverlayClientPtr pOc;
for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext)
- if (pOc->pClient == pClient)
- return pOc;
+ if (pOc->pClient == pClient)
+ return pOc;
- return NULL;
+ return NULL;
}
/*
* Create an overlay client object for the given client
*/
CompOverlayClientPtr
-compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
+compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
{
- CompScreenPtr cs = GetCompScreen(pScreen);
+ CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
if (pOc == NULL)
- return NULL;
+ return NULL;
pOc->pClient = pClient;
pOc->pScreen = pScreen;
@@ -115,8 +114,8 @@ compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
* Create a resource for this element so it can be deleted
* when the client goes away.
*/
- if (!AddResource (pOc->resource, CompositeClientOverlayType, (pointer) pOc))
- return NULL;
+ if (!AddResource(pOc->resource, CompositeClientOverlayType, (pointer) pOc))
+ return NULL;
return pOc;
}
@@ -125,34 +124,33 @@ compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
* Create the overlay window and map it
*/
Bool
-compCreateOverlayWindow (ScreenPtr pScreen)
+compCreateOverlayWindow(ScreenPtr pScreen)
{
- CompScreenPtr cs = GetCompScreen(pScreen);
- WindowPtr pRoot = pScreen->root;
- WindowPtr pWin;
- XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */
- int result;
- int w = pScreen->width;
- int h = pScreen->height;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ WindowPtr pRoot = pScreen->root;
+ WindowPtr pWin;
+ XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */
+ int result;
+ int w = pScreen->width;
+ int h = pScreen->height;
#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- {
- w = PanoramiXPixWidth;
- h = PanoramiXPixHeight;
+ if (!noPanoramiXExtension) {
+ w = PanoramiXPixWidth;
+ h = PanoramiXPixHeight;
}
#endif
- pWin = cs->pOverlayWin =
- CreateWindow (cs->overlayWid, pRoot, 0, 0, w, h, 0,
- InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
- pRoot->drawable.depth,
- serverClient, pScreen->rootVisual, &result);
+ pWin = cs->pOverlayWin =
+ CreateWindow(cs->overlayWid, pRoot, 0, 0, w, h, 0,
+ InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
+ pRoot->drawable.depth,
+ serverClient, pScreen->rootVisual, &result);
if (pWin == NULL)
- return FALSE;
+ return FALSE;
- if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin))
- return FALSE;
+ if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer) pWin))
+ return FALSE;
MapWindow(pWin, serverClient);
@@ -163,11 +161,10 @@ compCreateOverlayWindow (ScreenPtr pScreen)
* Destroy the overlay window
*/
void
-compDestroyOverlayWindow (ScreenPtr pScreen)
+compDestroyOverlayWindow(ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
cs->pOverlayWin = NullWindow;
- FreeResource (cs->overlayWid, RT_NONE);
+ FreeResource(cs->overlayWid, RT_NONE);
}
-
diff --git a/composite/compwindow.c b/composite/compwindow.c
index d2a866d6f..6eb624b11 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -53,129 +53,130 @@
#ifdef COMPOSITE_DEBUG
static int
-compCheckWindow (WindowPtr pWin, pointer data)
+compCheckWindow(WindowPtr pWin, pointer data)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin);
- PixmapPtr pParentPixmap = pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0;
- PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
-
- if (!pWin->parent)
- {
- assert (pWin->redirectDraw == RedirectDrawNone);
- assert (pWinPixmap == pScreenPixmap);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ PixmapPtr pParentPixmap =
+ pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0;
+ PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+
+ if (!pWin->parent) {
+ assert(pWin->redirectDraw == RedirectDrawNone);
+ assert(pWinPixmap == pScreenPixmap);
}
- else if (pWin->redirectDraw != RedirectDrawNone)
- {
- assert (pWinPixmap != pParentPixmap);
- assert (pWinPixmap != pScreenPixmap);
+ else if (pWin->redirectDraw != RedirectDrawNone) {
+ assert(pWinPixmap != pParentPixmap);
+ assert(pWinPixmap != pScreenPixmap);
}
- else
- {
- assert (pWinPixmap == pParentPixmap);
+ else {
+ assert(pWinPixmap == pParentPixmap);
}
- assert (0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
- assert (0 < pScreenPixmap->refcnt && pScreenPixmap->refcnt < 3);
+ assert(0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
+ assert(0 < pScreenPixmap->refcnt && pScreenPixmap->refcnt < 3);
if (pParentPixmap)
- assert (0 <= pParentPixmap->refcnt && pParentPixmap->refcnt < 3);
+ assert(0 <= pParentPixmap->refcnt && pParentPixmap->refcnt < 3);
return WT_WALKCHILDREN;
}
void
-compCheckTree (ScreenPtr pScreen)
+compCheckTree(ScreenPtr pScreen)
{
- WalkTree (pScreen, compCheckWindow, 0);
+ WalkTree(pScreen, compCheckWindow, 0);
}
#endif
typedef struct _compPixmapVisit {
- WindowPtr pWindow;
- PixmapPtr pPixmap;
+ WindowPtr pWindow;
+ PixmapPtr pPixmap;
} CompPixmapVisitRec, *CompPixmapVisitPtr;
static Bool
-compRepaintBorder (ClientPtr pClient, pointer closure)
+compRepaintBorder(ClientPtr pClient, pointer closure)
{
WindowPtr pWindow;
- int rc = dixLookupWindow(&pWindow, (XID)(intptr_t)closure, pClient, DixWriteAccess);
+ int rc =
+ dixLookupWindow(&pWindow, (XID) (intptr_t) closure, pClient,
+ DixWriteAccess);
if (rc == Success) {
- RegionRec exposed;
+ RegionRec exposed;
- RegionNull(&exposed);
- RegionSubtract(&exposed, &pWindow->borderClip, &pWindow->winSize);
- miPaintWindow(pWindow, &exposed, PW_BORDER);
- RegionUninit(&exposed);
+ RegionNull(&exposed);
+ RegionSubtract(&exposed, &pWindow->borderClip, &pWindow->winSize);
+ miPaintWindow(pWindow, &exposed, PW_BORDER);
+ RegionUninit(&exposed);
}
return TRUE;
}
static int
-compSetPixmapVisitWindow (WindowPtr pWindow, pointer data)
+compSetPixmapVisitWindow(WindowPtr pWindow, pointer data)
{
- CompPixmapVisitPtr pVisit = (CompPixmapVisitPtr) data;
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ CompPixmapVisitPtr pVisit = (CompPixmapVisitPtr) data;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
if (pWindow != pVisit->pWindow && pWindow->redirectDraw != RedirectDrawNone)
- return WT_DONTWALKCHILDREN;
+ return WT_DONTWALKCHILDREN;
(*pScreen->SetWindowPixmap) (pWindow, pVisit->pPixmap);
/*
* Recompute winSize and borderSize. This is duplicate effort
* when resizing pixmaps, but necessary when changing redirection.
* Might be nice to fix this.
*/
- SetWinSize (pWindow);
- SetBorderSize (pWindow);
- if (HasBorder (pWindow))
- QueueWorkProc (compRepaintBorder, serverClient,
- (pointer)(intptr_t) pWindow->drawable.id);
+ SetWinSize(pWindow);
+ SetBorderSize(pWindow);
+ if (HasBorder(pWindow))
+ QueueWorkProc(compRepaintBorder, serverClient,
+ (pointer) (intptr_t) pWindow->drawable.id);
return WT_WALKCHILDREN;
}
void
-compSetPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
+compSetPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
{
- CompPixmapVisitRec visitRec;
+ CompPixmapVisitRec visitRec;
visitRec.pWindow = pWindow;
visitRec.pPixmap = pPixmap;
- TraverseTree (pWindow, compSetPixmapVisitWindow, (pointer) &visitRec);
- compCheckTree (pWindow->drawable.pScreen);
+ TraverseTree(pWindow, compSetPixmapVisitWindow, (pointer) &visitRec);
+ compCheckTree(pWindow->drawable.pScreen);
}
Bool
-compCheckRedirect (WindowPtr pWin)
+compCheckRedirect(WindowPtr pWin)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
- Bool should;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
+ Bool should;
should = pWin->realized && (pWin->drawable.class != InputOnly) &&
- (cw != NULL) && (pWin->parent != NULL);
+ (cw != NULL) && (pWin->parent != NULL);
/* Never redirect the overlay window */
if (cs->pOverlayWin != NULL) {
- if (pWin == cs->pOverlayWin) {
- should = FALSE;
- }
+ if (pWin == cs->pOverlayWin) {
+ should = FALSE;
+ }
}
- if (should != (pWin->redirectDraw != RedirectDrawNone))
- {
- if (should)
- return compAllocPixmap (pWin);
- else {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- compSetParentPixmap (pWin);
- compRestoreWindow (pWin, pPixmap);
- (*pScreen->DestroyPixmap) (pPixmap);
- }
- } else if (should) {
- if (cw->update == CompositeRedirectAutomatic)
- pWin->redirectDraw = RedirectDrawAutomatic;
- else
- pWin->redirectDraw = RedirectDrawManual;
+ if (should != (pWin->redirectDraw != RedirectDrawNone)) {
+ if (should)
+ return compAllocPixmap(pWin);
+ else {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+
+ compSetParentPixmap(pWin);
+ compRestoreWindow(pWin, pPixmap);
+ (*pScreen->DestroyPixmap) (pPixmap);
+ }
+ }
+ else if (should) {
+ if (cw->update == CompositeRedirectAutomatic)
+ pWin->redirectDraw = RedirectDrawAutomatic;
+ else
+ pWin->redirectDraw = RedirectDrawManual;
}
return TRUE;
}
@@ -183,110 +184,106 @@ compCheckRedirect (WindowPtr pWin)
static int
updateOverlayWindow(ScreenPtr pScreen)
{
- CompScreenPtr cs;
- WindowPtr pWin; /* overlay window */
- XID vlist[2];
- int w = pScreen->width;
- int h = pScreen->height;
+ CompScreenPtr cs;
+ WindowPtr pWin; /* overlay window */
+ XID vlist[2];
+ int w = pScreen->width;
+ int h = pScreen->height;
#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- {
- w = PanoramiXPixWidth;
- h = PanoramiXPixHeight;
- }
+ if (!noPanoramiXExtension) {
+ w = PanoramiXPixWidth;
+ h = PanoramiXPixHeight;
+ }
#endif
- cs = GetCompScreen(pScreen);
- if ((pWin = cs->pOverlayWin) != NULL) {
- if ((pWin->drawable.width == w) &&
- (pWin->drawable.height == h))
- return Success;
+ cs = GetCompScreen(pScreen);
+ if ((pWin = cs->pOverlayWin) != NULL) {
+ if ((pWin->drawable.width == w) && (pWin->drawable.height == h))
+ return Success;
- /* Let's resize the overlay window. */
- vlist[0] = w;
- vlist[1] = h;
- return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
- }
+ /* Let's resize the overlay window. */
+ vlist[0] = w;
+ vlist[1] = h;
+ return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
+ }
- /* Let's be on the safe side and not assume an overlay window is always allocated. */
- return Success;
+ /* Let's be on the safe side and not assume an overlay window is always allocated. */
+ return Success;
}
Bool
-compPositionWindow (WindowPtr pWin, int x, int y)
+compPositionWindow(WindowPtr pWin, int x, int y)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = TRUE;
pScreen->PositionWindow = cs->PositionWindow;
/*
* "Shouldn't need this as all possible places should be wrapped
*
- compCheckRedirect (pWin);
+ compCheckRedirect (pWin);
*/
#ifdef COMPOSITE_DEBUG
if ((pWin->redirectDraw != RedirectDrawNone) !=
- (pWin->viewable && (GetCompWindow(pWin) != NULL)))
- OsAbort ();
+ (pWin->viewable && (GetCompWindow(pWin) != NULL)))
+ OsAbort();
#endif
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- int bw = wBorderWidth (pWin);
- int nx = pWin->drawable.x - bw;
- int ny = pWin->drawable.y - bw;
-
- if (pPixmap->screen_x != nx || pPixmap->screen_y != ny)
- {
- pPixmap->screen_x = nx;
- pPixmap->screen_y = ny;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ int bw = wBorderWidth(pWin);
+ int nx = pWin->drawable.x - bw;
+ int ny = pWin->drawable.y - bw;
+
+ if (pPixmap->screen_x != nx || pPixmap->screen_y != ny) {
+ pPixmap->screen_x = nx;
+ pPixmap->screen_y = ny;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
}
if (!(*pScreen->PositionWindow) (pWin, x, y))
- ret = FALSE;
+ ret = FALSE;
cs->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = compPositionWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
if (updateOverlayWindow(pScreen) != Success)
- ret = FALSE;
+ ret = FALSE;
return ret;
}
Bool
-compRealizeWindow (WindowPtr pWin)
+compRealizeWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = TRUE;
pScreen->RealizeWindow = cs->RealizeWindow;
- compCheckRedirect (pWin);
+ compCheckRedirect(pWin);
if (!(*pScreen->RealizeWindow) (pWin))
- ret = FALSE;
+ ret = FALSE;
cs->RealizeWindow = pScreen->RealizeWindow;
pScreen->RealizeWindow = compRealizeWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
return ret;
}
Bool
-compUnrealizeWindow (WindowPtr pWin)
+compUnrealizeWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = TRUE;
pScreen->UnrealizeWindow = cs->UnrealizeWindow;
- compCheckRedirect (pWin);
+ compCheckRedirect(pWin);
if (!(*pScreen->UnrealizeWindow) (pWin))
- ret = FALSE;
+ ret = FALSE;
cs->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreen->UnrealizeWindow = compUnrealizeWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
return ret;
}
@@ -296,30 +293,27 @@ compUnrealizeWindow (WindowPtr pWin)
*/
void
-compClipNotify (WindowPtr pWin, int dx, int dy)
+compClipNotify(WindowPtr pWin, int dx, int dy)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- CompWindowPtr cw = GetCompWindow (pWin);
-
- if (cw)
- {
- if (cw->borderClipX != pWin->drawable.x ||
- cw->borderClipY != pWin->drawable.y)
- {
- RegionTranslate(&cw->borderClip,
- pWin->drawable.x - cw->borderClipX,
- pWin->drawable.y - cw->borderClipY);
- cw->borderClipX = pWin->drawable.x;
- cw->borderClipY = pWin->drawable.y;
- }
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompWindowPtr cw = GetCompWindow(pWin);
+
+ if (cw) {
+ if (cw->borderClipX != pWin->drawable.x ||
+ cw->borderClipY != pWin->drawable.y) {
+ RegionTranslate(&cw->borderClip,
+ pWin->drawable.x - cw->borderClipX,
+ pWin->drawable.y - cw->borderClipY);
+ cw->borderClipX = pWin->drawable.x;
+ cw->borderClipY = pWin->drawable.y;
+ }
}
- if (cs->ClipNotify)
- {
- pScreen->ClipNotify = cs->ClipNotify;
- (*pScreen->ClipNotify) (pWin, dx, dy);
- cs->ClipNotify = pScreen->ClipNotify;
- pScreen->ClipNotify = compClipNotify;
+ if (cs->ClipNotify) {
+ pScreen->ClipNotify = cs->ClipNotify;
+ (*pScreen->ClipNotify) (pWin, dx, dy);
+ cs->ClipNotify = pScreen->ClipNotify;
+ pScreen->ClipNotify = compClipNotify;
}
}
@@ -329,53 +323,53 @@ compClipNotify (WindowPtr pWin, int dx, int dy)
*/
static Bool
-compIsAlternateVisual (ScreenPtr pScreen,
- XID visual)
+compIsAlternateVisual(ScreenPtr pScreen, XID visual)
{
- CompScreenPtr cs = GetCompScreen (pScreen);
- int i;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ int i;
for (i = 0; i < cs->numAlternateVisuals; i++)
- if (cs->alternateVisuals[i] == visual)
- return TRUE;
+ if (cs->alternateVisuals[i] == visual)
+ return TRUE;
return FALSE;
}
static Bool
-compImplicitRedirect (WindowPtr pWin, WindowPtr pParent)
+compImplicitRedirect(WindowPtr pWin, WindowPtr pParent)
{
- if (pParent)
- {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XID winVisual = wVisual (pWin);
- XID parentVisual = wVisual (pParent);
-
- if (winVisual != parentVisual &&
- (compIsAlternateVisual (pScreen, winVisual) ||
- compIsAlternateVisual (pScreen, parentVisual)))
- return TRUE;
+ if (pParent) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XID winVisual = wVisual(pWin);
+ XID parentVisual = wVisual(pParent);
+
+ if (winVisual != parentVisual &&
+ (compIsAlternateVisual(pScreen, winVisual) ||
+ compIsAlternateVisual(pScreen, parentVisual)))
+ return TRUE;
}
return FALSE;
}
-static void compFreeOldPixmap(WindowPtr pWin)
+static void
+compFreeOldPixmap(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- CompWindowPtr cw = GetCompWindow (pWin);
- if (cw->pOldPixmap)
- {
- (*pScreen->DestroyPixmap) (cw->pOldPixmap);
- cw->pOldPixmap = NullPixmap;
- }
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ CompWindowPtr cw = GetCompWindow(pWin);
+
+ if (cw->pOldPixmap) {
+ (*pScreen->DestroyPixmap) (cw->pOldPixmap);
+ cw->pOldPixmap = NullPixmap;
+ }
}
}
+
void
-compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
+compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->MoveWindow = cs->MoveWindow;
(*pScreen->MoveWindow) (pWin, x, y, pSib, kind);
@@ -383,15 +377,15 @@ compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
pScreen->MoveWindow = compMoveWindow;
compFreeOldPixmap(pWin);
- compCheckTree (pScreen);
+ compCheckTree(pScreen);
}
void
-compResizeWindow (WindowPtr pWin, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib)
+compResizeWindow(WindowPtr pWin, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->ResizeWindow = cs->ResizeWindow;
(*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib);
@@ -399,14 +393,14 @@ compResizeWindow (WindowPtr pWin, int x, int y,
pScreen->ResizeWindow = compResizeWindow;
compFreeOldPixmap(pWin);
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
void
-compChangeBorderWidth (WindowPtr pWin, unsigned int bw)
+compChangeBorderWidth(WindowPtr pWin, unsigned int bw)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
(*pScreen->ChangeBorderWidth) (pWin, bw);
@@ -414,189 +408,183 @@ compChangeBorderWidth (WindowPtr pWin, unsigned int bw)
pScreen->ChangeBorderWidth = compChangeBorderWidth;
compFreeOldPixmap(pWin);
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
void
-compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent)
+compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->ReparentWindow = cs->ReparentWindow;
/*
* Remove any implicit redirect due to synthesized visual
*/
- if (compImplicitRedirect (pWin, pPriorParent))
- compUnredirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
+ if (compImplicitRedirect(pWin, pPriorParent))
+ compUnredirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
/*
* Handle subwindows redirection
*/
- compUnredirectOneSubwindow (pPriorParent, pWin);
- compRedirectOneSubwindow (pWin->parent, pWin);
+ compUnredirectOneSubwindow(pPriorParent, pWin);
+ compRedirectOneSubwindow(pWin->parent, pWin);
/*
* Add any implict redirect due to synthesized visual
*/
- if (compImplicitRedirect (pWin, pWin->parent))
- compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
+ if (compImplicitRedirect(pWin, pWin->parent))
+ compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
/*
* Allocate any necessary redirect pixmap
* (this actually should never be true; pWin is always unmapped)
*/
- compCheckRedirect (pWin);
+ compCheckRedirect(pWin);
/*
* Reset pixmap pointers as appropriate
*/
if (pWin->parent && pWin->redirectDraw == RedirectDrawNone)
- compSetPixmap (pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
+ compSetPixmap(pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
/*
* Call down to next function
*/
if (pScreen->ReparentWindow)
- (*pScreen->ReparentWindow) (pWin, pPriorParent);
+ (*pScreen->ReparentWindow) (pWin, pPriorParent);
cs->ReparentWindow = pScreen->ReparentWindow;
pScreen->ReparentWindow = compReparentWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
void
-compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- int dx = 0, dy = 0;
-
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- CompWindowPtr cw = GetCompWindow (pWin);
-
- assert (cw->oldx != COMP_ORIGIN_INVALID);
- assert (cw->oldy != COMP_ORIGIN_INVALID);
- if (cw->pOldPixmap)
- {
- /*
- * Ok, the old bits are available in pOldPixmap and
- * need to be copied to pNewPixmap.
- */
- RegionRec rgnDst;
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- GCPtr pGC;
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- RegionTranslate(prgnSrc, -dx, -dy);
-
- RegionNull(&rgnDst);
-
- RegionIntersect(&rgnDst,
- &pWin->borderClip, prgnSrc);
-
- RegionTranslate(&rgnDst,
- -pPixmap->screen_x, -pPixmap->screen_y);
-
- dx = dx + pPixmap->screen_x - cw->oldx;
- dy = dy + pPixmap->screen_y - cw->oldy;
- pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
- if (pGC)
- {
- BoxPtr pBox = RegionRects (&rgnDst);
- int nBox = RegionNumRects (&rgnDst);
-
- ValidateGC(&pPixmap->drawable, pGC);
- while (nBox--)
- {
- (void) (*pGC->ops->CopyArea) (&cw->pOldPixmap->drawable,
- &pPixmap->drawable,
- pGC,
- pBox->x1 + dx, pBox->y1 + dy,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1,
- pBox->x1, pBox->y1);
- pBox++;
- }
- FreeScratchGC (pGC);
- }
- return;
- }
- dx = pPixmap->screen_x - cw->oldx;
- dy = pPixmap->screen_y - cw->oldy;
- ptOldOrg.x += dx;
- ptOldOrg.y += dy;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ int dx = 0, dy = 0;
+
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ CompWindowPtr cw = GetCompWindow(pWin);
+
+ assert(cw->oldx != COMP_ORIGIN_INVALID);
+ assert(cw->oldy != COMP_ORIGIN_INVALID);
+ if (cw->pOldPixmap) {
+ /*
+ * Ok, the old bits are available in pOldPixmap and
+ * need to be copied to pNewPixmap.
+ */
+ RegionRec rgnDst;
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ GCPtr pGC;
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ RegionTranslate(prgnSrc, -dx, -dy);
+
+ RegionNull(&rgnDst);
+
+ RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
+
+ RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y);
+
+ dx = dx + pPixmap->screen_x - cw->oldx;
+ dy = dy + pPixmap->screen_y - cw->oldy;
+ pGC = GetScratchGC(pPixmap->drawable.depth, pScreen);
+ if (pGC) {
+ BoxPtr pBox = RegionRects(&rgnDst);
+ int nBox = RegionNumRects(&rgnDst);
+
+ ValidateGC(&pPixmap->drawable, pGC);
+ while (nBox--) {
+ (void) (*pGC->ops->CopyArea) (&cw->pOldPixmap->drawable,
+ &pPixmap->drawable,
+ pGC,
+ pBox->x1 + dx, pBox->y1 + dy,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1,
+ pBox->x1, pBox->y1);
+ pBox++;
+ }
+ FreeScratchGC(pGC);
+ }
+ return;
+ }
+ dx = pPixmap->screen_x - cw->oldx;
+ dy = pPixmap->screen_y - cw->oldy;
+ ptOldOrg.x += dx;
+ ptOldOrg.y += dy;
}
pScreen->CopyWindow = cs->CopyWindow;
- if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y)
- {
- if (dx || dy)
- RegionTranslate(prgnSrc, dx, dy);
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- if (dx || dy)
- RegionTranslate(prgnSrc, -dx, -dy);
+ if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y) {
+ if (dx || dy)
+ RegionTranslate(prgnSrc, dx, dy);
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ if (dx || dy)
+ RegionTranslate(prgnSrc, -dx, -dy);
}
- else
- {
- ptOldOrg.x -= dx;
- ptOldOrg.y -= dy;
- RegionTranslate(prgnSrc,
- pWin->drawable.x - ptOldOrg.x,
- pWin->drawable.y - ptOldOrg.y);
- DamageDamageRegion(&pWin->drawable, prgnSrc);
+ else {
+ ptOldOrg.x -= dx;
+ ptOldOrg.y -= dy;
+ RegionTranslate(prgnSrc,
+ pWin->drawable.x - ptOldOrg.x,
+ pWin->drawable.y - ptOldOrg.y);
+ DamageDamageRegion(&pWin->drawable, prgnSrc);
}
cs->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = compCopyWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
Bool
-compCreateWindow (WindowPtr pWin)
+compCreateWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret;
pScreen->CreateWindow = cs->CreateWindow;
ret = (*pScreen->CreateWindow) (pWin);
- if (pWin->parent && ret)
- {
- CompSubwindowsPtr csw = GetCompSubwindows (pWin->parent);
- CompClientWindowPtr ccw;
-
- (*pScreen->SetWindowPixmap) (pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
- if (csw)
- for (ccw = csw->clients; ccw; ccw = ccw->next)
- compRedirectWindow (clients[CLIENT_ID(ccw->id)],
- pWin, ccw->update);
- if (compImplicitRedirect (pWin, pWin->parent))
- compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
+ if (pWin->parent && ret) {
+ CompSubwindowsPtr csw = GetCompSubwindows(pWin->parent);
+ CompClientWindowPtr ccw;
+
+ (*pScreen->SetWindowPixmap) (pWin,
+ (*pScreen->GetWindowPixmap) (pWin->
+ parent));
+ if (csw)
+ for (ccw = csw->clients; ccw; ccw = ccw->next)
+ compRedirectWindow(clients[CLIENT_ID(ccw->id)],
+ pWin, ccw->update);
+ if (compImplicitRedirect(pWin, pWin->parent))
+ compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
}
cs->CreateWindow = pScreen->CreateWindow;
pScreen->CreateWindow = compCreateWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
return ret;
}
Bool
-compDestroyWindow (WindowPtr pWin)
+compDestroyWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- CompWindowPtr cw;
- CompSubwindowsPtr csw;
- Bool ret;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompWindowPtr cw;
+ CompSubwindowsPtr csw;
+ Bool ret;
pScreen->DestroyWindow = cs->DestroyWindow;
- while ((cw = GetCompWindow (pWin)))
- FreeResource (cw->clients->id, RT_NONE);
- while ((csw = GetCompSubwindows (pWin)))
- FreeResource (csw->clients->id, RT_NONE);
+ while ((cw = GetCompWindow(pWin)))
+ FreeResource(cw->clients->id, RT_NONE);
+ while ((csw = GetCompSubwindows(pWin)))
+ FreeResource(csw->clients->id, RT_NONE);
if (pWin->redirectDraw != RedirectDrawNone) {
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- compSetParentPixmap (pWin);
- (*pScreen->DestroyPixmap) (pPixmap);
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+
+ compSetParentPixmap(pWin);
+ (*pScreen->DestroyPixmap) (pPixmap);
}
ret = (*pScreen->DestroyWindow) (pWin);
cs->DestroyWindow = pScreen->DestroyWindow;
@@ -606,18 +594,18 @@ compDestroyWindow (WindowPtr pWin)
}
void
-compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion)
+compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- RegionRec damage;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ RegionRec damage;
RegionNull(&damage);
/*
* Align old border clip with new border clip
*/
RegionTranslate(&cw->borderClip,
- pWin->drawable.x - cw->borderClipX,
- pWin->drawable.y - cw->borderClipY);
+ pWin->drawable.x - cw->borderClipX,
+ pWin->drawable.y - cw->borderClipY);
/*
* Compute newly visible portion of window for repaint
*/
@@ -636,64 +624,63 @@ compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion)
}
RegionPtr
-compGetRedirectBorderClip (WindowPtr pWin)
+compGetRedirectBorderClip(WindowPtr pWin)
{
- CompWindowPtr cw = GetCompWindow (pWin);
+ CompWindowPtr cw = GetCompWindow(pWin);
return &cw->borderClip;
}
static VisualPtr
-compGetWindowVisual (WindowPtr pWin)
+compGetWindowVisual(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- VisualID vid = wVisual (pWin);
- int i;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ VisualID vid = wVisual(pWin);
+ int i;
for (i = 0; i < pScreen->numVisuals; i++)
- if (pScreen->visuals[i].vid == vid)
- return &pScreen->visuals[i];
+ if (pScreen->visuals[i].vid == vid)
+ return &pScreen->visuals[i];
return 0;
}
PictFormatPtr
-compWindowFormat (WindowPtr pWin)
+compWindowFormat(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- return PictureMatchVisual (pScreen, pWin->drawable.depth,
- compGetWindowVisual (pWin));
+ return PictureMatchVisual(pScreen, pWin->drawable.depth,
+ compGetWindowVisual(pWin));
}
static void
-compWindowUpdateAutomatic (WindowPtr pWin)
+compWindowUpdateAutomatic(WindowPtr pWin)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- ScreenPtr pScreen = pWin->drawable.pScreen;
- WindowPtr pParent = pWin->parent;
- PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin);
- PictFormatPtr pSrcFormat = compWindowFormat (pWin);
- PictFormatPtr pDstFormat = compWindowFormat (pWin->parent);
- int error;
- RegionPtr pRegion = DamageRegion (cw->damage);
- PicturePtr pSrcPicture = CreatePicture (0, &pSrcPixmap->drawable,
- pSrcFormat,
- 0, 0,
- serverClient,
- &error);
- XID subwindowMode = IncludeInferiors;
- PicturePtr pDstPicture = CreatePicture (0, &pParent->drawable,
- pDstFormat,
- CPSubwindowMode,
- &subwindowMode,
- serverClient,
- &error);
+ CompWindowPtr cw = GetCompWindow(pWin);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ WindowPtr pParent = pWin->parent;
+ PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ PictFormatPtr pSrcFormat = compWindowFormat(pWin);
+ PictFormatPtr pDstFormat = compWindowFormat(pWin->parent);
+ int error;
+ RegionPtr pRegion = DamageRegion(cw->damage);
+ PicturePtr pSrcPicture = CreatePicture(0, &pSrcPixmap->drawable,
+ pSrcFormat,
+ 0, 0,
+ serverClient,
+ &error);
+ XID subwindowMode = IncludeInferiors;
+ PicturePtr pDstPicture = CreatePicture(0, &pParent->drawable,
+ pDstFormat,
+ CPSubwindowMode,
+ &subwindowMode,
+ serverClient,
+ &error);
/*
* First move the region from window to screen coordinates
*/
- RegionTranslate(pRegion,
- pWin->drawable.x, pWin->drawable.y);
+ RegionTranslate(pRegion, pWin->drawable.x, pWin->drawable.y);
/*
* Clip against the "real" border clip
@@ -703,130 +690,123 @@ compWindowUpdateAutomatic (WindowPtr pWin)
/*
* Now translate from screen to dest coordinates
*/
- RegionTranslate(pRegion,
- -pParent->drawable.x, -pParent->drawable.y);
+ RegionTranslate(pRegion, -pParent->drawable.x, -pParent->drawable.y);
/*
* Clip the picture
*/
- SetPictureClipRegion (pDstPicture, 0, 0, pRegion);
+ SetPictureClipRegion(pDstPicture, 0, 0, pRegion);
/*
* And paint
*/
- CompositePicture (PictOpSrc,
- pSrcPicture,
- 0,
- pDstPicture,
- 0, 0, /* src_x, src_y */
- 0, 0, /* msk_x, msk_y */
- pSrcPixmap->screen_x - pParent->drawable.x,
- pSrcPixmap->screen_y - pParent->drawable.y,
- pSrcPixmap->drawable.width,
- pSrcPixmap->drawable.height);
- FreePicture (pSrcPicture, 0);
- FreePicture (pDstPicture, 0);
+ CompositePicture(PictOpSrc, pSrcPicture, 0, pDstPicture, 0, 0, /* src_x, src_y */
+ 0, 0, /* msk_x, msk_y */
+ pSrcPixmap->screen_x - pParent->drawable.x,
+ pSrcPixmap->screen_y - pParent->drawable.y,
+ pSrcPixmap->drawable.width, pSrcPixmap->drawable.height);
+ FreePicture(pSrcPicture, 0);
+ FreePicture(pDstPicture, 0);
/*
* Empty the damage region. This has the nice effect of
* rendering the translations above harmless
*/
- DamageEmpty (cw->damage);
+ DamageEmpty(cw->damage);
}
static void
-compPaintWindowToParent (WindowPtr pWin)
+compPaintWindowToParent(WindowPtr pWin)
{
- compPaintChildrenToWindow (pWin);
+ compPaintChildrenToWindow(pWin);
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- CompWindowPtr cw = GetCompWindow(pWin);
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ CompWindowPtr cw = GetCompWindow(pWin);
- if (cw->damaged)
- {
- compWindowUpdateAutomatic (pWin);
- cw->damaged = FALSE;
- }
+ if (cw->damaged) {
+ compWindowUpdateAutomatic(pWin);
+ cw->damaged = FALSE;
+ }
}
}
void
-compPaintChildrenToWindow (WindowPtr pWin)
+compPaintChildrenToWindow(WindowPtr pWin)
{
WindowPtr pChild;
if (!pWin->damagedDescendants)
- return;
+ return;
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
- compPaintWindowToParent (pChild);
+ compPaintWindowToParent(pChild);
pWin->damagedDescendants = FALSE;
}
WindowPtr
-CompositeRealChildHead (WindowPtr pWin)
+CompositeRealChildHead(WindowPtr pWin)
{
WindowPtr pChild, pChildBefore;
CompScreenPtr cs;
if (!pWin->parent &&
- (screenIsSaved == SCREEN_SAVER_ON) &&
- (HasSaverWindow (pWin->drawable.pScreen))) {
+ (screenIsSaved == SCREEN_SAVER_ON) &&
+ (HasSaverWindow(pWin->drawable.pScreen))) {
- /* First child is the screen saver; see if next child is the overlay */
- pChildBefore = pWin->firstChild;
- pChild = pChildBefore->nextSib;
+ /* First child is the screen saver; see if next child is the overlay */
+ pChildBefore = pWin->firstChild;
+ pChild = pChildBefore->nextSib;
- } else {
- pChildBefore = NullWindow;
- pChild = pWin->firstChild;
+ }
+ else {
+ pChildBefore = NullWindow;
+ pChild = pWin->firstChild;
}
if (!pChild) {
- return NullWindow;
+ return NullWindow;
}
cs = GetCompScreen(pWin->drawable.pScreen);
if (pChild == cs->pOverlayWin) {
- return pChild;
- } else {
- return pChildBefore;
+ return pChild;
+ }
+ else {
+ return pChildBefore;
}
}
int
compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
- int bw, WindowPtr pSib)
+ int bw, WindowPtr pSib)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = 0;
- WindowPtr pParent = pWin->parent;
- int draw_x, draw_y;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = 0;
+ WindowPtr pParent = pWin->parent;
+ int draw_x, draw_y;
Bool alloc_ret;
- if (cs->ConfigNotify)
- {
- pScreen->ConfigNotify = cs->ConfigNotify;
- ret = (*pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
- cs->ConfigNotify = pScreen->ConfigNotify;
- pScreen->ConfigNotify = compConfigNotify;
+ if (cs->ConfigNotify) {
+ pScreen->ConfigNotify = cs->ConfigNotify;
+ ret = (*pScreen->ConfigNotify) (pWin, x, y, w, h, bw, pSib);
+ cs->ConfigNotify = pScreen->ConfigNotify;
+ pScreen->ConfigNotify = compConfigNotify;
- if (ret)
- return ret;
+ if (ret)
+ return ret;
}
if (pWin->redirectDraw == RedirectDrawNone)
- return Success;
+ return Success;
- compCheckTree (pScreen);
+ compCheckTree(pScreen);
draw_x = pParent->drawable.x + x + bw;
draw_y = pParent->drawable.y + y + bw;
- alloc_ret = compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
+ alloc_ret = compReallocPixmap(pWin, draw_x, draw_y, w, h, bw);
if (alloc_ret == FALSE)
- return BadAlloc;
+ return BadAlloc;
return Success;
}