aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/composite
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/composite')
-rw-r--r--xorg-server/composite/compalloc.c754
-rw-r--r--xorg-server/composite/compext.c699
-rw-r--r--xorg-server/composite/compinit.c831
-rw-r--r--xorg-server/composite/compint.h195
-rw-r--r--xorg-server/composite/compoverlay.c351
-rw-r--r--xorg-server/composite/compwindow.c800
6 files changed, 1787 insertions, 1843 deletions
diff --git a/xorg-server/composite/compalloc.c b/xorg-server/composite/compalloc.c
index 5b53e6931..e85ade0f0 100644
--- a/xorg-server/composite/compalloc.c
+++ b/xorg-server/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 = calloc (1,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 = calloc(1,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/xorg-server/composite/compext.c b/xorg-server/composite/compext.c
index 722587a43..940eed1fc 100644
--- a/xorg-server/composite/compext.c
+++ b/xorg-server/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/xorg-server/composite/compinit.c b/xorg-server/composite/compinit.c
index 291b759be..eaa125681 100644
--- a/xorg-server/composite/compinit.c
+++ b/xorg-server/composite/compinit.c
@@ -1,415 +1,416 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Copyright © 2003 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "compint.h"
-#include "compositeext.h"
-
-DevPrivateKeyRec CompScreenPrivateKeyRec;
-DevPrivateKeyRec CompWindowPrivateKeyRec;
-DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
-
-static Bool
-compCloseScreen (int index, ScreenPtr pScreen)
-{
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret;
-
- free(cs->alternateVisuals);
-
- pScreen->CloseScreen = cs->CloseScreen;
- pScreen->InstallColormap = cs->InstallColormap;
- pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
- pScreen->ReparentWindow = cs->ReparentWindow;
- pScreen->ConfigNotify = cs->ConfigNotify;
- pScreen->MoveWindow = cs->MoveWindow;
- pScreen->ResizeWindow = cs->ResizeWindow;
- pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
-
- pScreen->ClipNotify = cs->ClipNotify;
- pScreen->UnrealizeWindow = cs->UnrealizeWindow;
- pScreen->RealizeWindow = cs->RealizeWindow;
- pScreen->DestroyWindow = cs->DestroyWindow;
- pScreen->CreateWindow = cs->CreateWindow;
- pScreen->CopyWindow = cs->CopyWindow;
- pScreen->PositionWindow = cs->PositionWindow;
-
- pScreen->GetImage = cs->GetImage;
- pScreen->SourceValidate = cs->SourceValidate;
-
- free(cs);
- dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
- ret = (*pScreen->CloseScreen) (index, pScreen);
-
- return ret;
-}
-
-static void
-compInstallColormap (ColormapPtr pColormap)
-{
- 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;
- pScreen->InstallColormap = cs->InstallColormap;
- (*pScreen->InstallColormap) (pColormap);
- cs->InstallColormap = pScreen->InstallColormap;
- pScreen->InstallColormap = compInstallColormap;
-}
-
-/* Fake backing store via automatic redirection */
-static Bool
-compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
-{
- ScreenPtr pScreen = pWin->drawable.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->ChangeWindowAttributes = compChangeWindowAttributes;
-
- return ret;
-}
-
-static void
-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);
-
- pScreen->GetImage = cs->GetImage;
- if (pDrawable->type == DRAWABLE_WINDOW)
- 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)
-{
- ScreenPtr pScreen = pDrawable->pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
-
- pScreen->SourceValidate = cs->SourceValidate;
- if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors)
- compPaintChildrenToWindow ((WindowPtr) pDrawable);
- if (pScreen->SourceValidate)
- (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
- subWindowMode);
- cs->SourceValidate = pScreen->SourceValidate;
- pScreen->SourceValidate = compSourceValidate;
-}
-
-/*
- * Add alternate visuals -- always expose an ARGB32 and RGB24 visual
- */
-
-static DepthPtr
-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;
- }
- }
- /*
- * If there isn't one, then it's gonna be hard to have
- * an associated visual
- */
- return 0;
-}
-
-/*
- * Add a list of visual IDs to the list of visuals to implicitly redirect.
- */
-static Bool
-compRegisterAlternateVisuals (CompScreenPtr cs, VisualID *vids, int nVisuals)
-{
- VisualID *p;
-
- p = realloc(cs->alternateVisuals,
- sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
- if(p == NULL)
- return FALSE;
-
- memcpy(&p[cs->numAlternateVisuals], vids, sizeof(VisualID) * nVisuals);
-
- cs->alternateVisuals = p;
- cs->numAlternateVisuals += nVisuals;
-
- return TRUE;
-}
-
-Bool CompositeRegisterAlternateVisuals (ScreenPtr pScreen, VisualID *vids,
- int nVisuals)
-{
- CompScreenPtr cs = GetCompScreen (pScreen);
- return compRegisterAlternateVisuals(cs, vids, nVisuals);
-}
-
-typedef struct _alternateVisual {
- int depth;
- CARD32 format;
-} CompAlternateVisual;
-
-static CompAlternateVisual altVisuals[] = {
-#if COMP_INCLUDE_RGB24_VISUAL
- { 24, PICT_r8g8b8 },
-#endif
- { 32, PICT_a8r8g8b8 },
-};
-
-static const int NUM_COMP_ALTERNATE_VISUALS = sizeof(altVisuals) /
- sizeof(CompAlternateVisual);
-
-static Bool
-compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
- CompAlternateVisual *alt)
-{
- VisualPtr visual;
- DepthPtr depth;
- PictFormatPtr pPictFormat;
- unsigned long alphaMask;
-
- /*
- * The ARGB32 visual is always available. Other alternate depth visuals
- * are only provided if their depth is less than the root window depth.
- * There's no deep reason for this.
- */
- if (alt->depth >= pScreen->rootDepth && alt->depth != 32)
- return FALSE;
-
- depth = compFindVisuallessDepth (pScreen, alt->depth);
- if (!depth)
- /* alt->depth doesn't exist or already has alternate visuals. */
- return TRUE;
-
- pPictFormat = PictureMatchFormat (pScreen, alt->depth, alt->format);
- if (!pPictFormat)
- return FALSE;
-
- if (ResizeVisualArray(pScreen, 1, depth) == FALSE) {
- return FALSE;
- }
-
- 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))));
- }
-
- /* remember the visual ID to detect auto-update windows */
- compRegisterAlternateVisuals(cs, &visual->vid, 1);
-
- return TRUE;
-}
-
-static Bool
-compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs)
-{
- int alt, ret = 0;
-
- for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++)
- ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt);
-
- return !!ret;
-}
-
-Bool
-compScreenInit (ScreenPtr pScreen)
-{
- CompScreenPtr cs;
-
- if (!dixRegisterPrivateKey(&CompScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
- if (!dixRegisterPrivateKey(&CompWindowPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
- if (!dixRegisterPrivateKey(&CompSubwindowsPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
-
- if (GetCompScreen (pScreen))
- return TRUE;
- cs = (CompScreenPtr) malloc(sizeof (CompScreenRec));
- if (!cs)
- return FALSE;
-
- cs->overlayWid = FakeClientID(0);
- cs->pOverlayWin = NULL;
- cs->pOverlayClients = NULL;
-
- cs->numAlternateVisuals = 0;
- cs->alternateVisuals = NULL;
-
- if (!compAddAlternateVisuals (pScreen, cs))
- {
- free(cs);
- return FALSE;
- }
-
- cs->PositionWindow = pScreen->PositionWindow;
- pScreen->PositionWindow = compPositionWindow;
-
- cs->CopyWindow = pScreen->CopyWindow;
- pScreen->CopyWindow = compCopyWindow;
-
- cs->CreateWindow = pScreen->CreateWindow;
- pScreen->CreateWindow = compCreateWindow;
-
- cs->DestroyWindow = pScreen->DestroyWindow;
- pScreen->DestroyWindow = compDestroyWindow;
-
- cs->RealizeWindow = pScreen->RealizeWindow;
- pScreen->RealizeWindow = compRealizeWindow;
-
- cs->UnrealizeWindow = pScreen->UnrealizeWindow;
- pScreen->UnrealizeWindow = compUnrealizeWindow;
-
- cs->ClipNotify = pScreen->ClipNotify;
- pScreen->ClipNotify = compClipNotify;
-
- cs->ConfigNotify = pScreen->ConfigNotify;
- pScreen->ConfigNotify = compConfigNotify;
-
- cs->MoveWindow = pScreen->MoveWindow;
- pScreen->MoveWindow = compMoveWindow;
-
- cs->ResizeWindow = pScreen->ResizeWindow;
- pScreen->ResizeWindow = compResizeWindow;
-
- cs->ChangeBorderWidth = pScreen->ChangeBorderWidth;
- pScreen->ChangeBorderWidth = compChangeBorderWidth;
-
- cs->ReparentWindow = pScreen->ReparentWindow;
- pScreen->ReparentWindow = compReparentWindow;
-
- cs->InstallColormap = pScreen->InstallColormap;
- pScreen->InstallColormap = compInstallColormap;
-
- cs->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
- pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
-
- cs->BlockHandler = NULL;
-
- cs->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = compCloseScreen;
-
- cs->GetImage = pScreen->GetImage;
- pScreen->GetImage = compGetImage;
-
- cs->SourceValidate = pScreen->SourceValidate;
- pScreen->SourceValidate = compSourceValidate;
-
- dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs);
-
- RegisterRealChildHeadProc(CompositeRealChildHead);
-
- return TRUE;
-}
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "compint.h"
+#include "compositeext.h"
+
+DevPrivateKeyRec CompScreenPrivateKeyRec;
+DevPrivateKeyRec CompWindowPrivateKeyRec;
+DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
+
+static Bool
+compCloseScreen(int index, ScreenPtr pScreen)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret;
+
+ free(cs->alternateVisuals);
+
+ pScreen->CloseScreen = cs->CloseScreen;
+ pScreen->InstallColormap = cs->InstallColormap;
+ pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
+ pScreen->ReparentWindow = cs->ReparentWindow;
+ pScreen->ConfigNotify = cs->ConfigNotify;
+ pScreen->MoveWindow = cs->MoveWindow;
+ pScreen->ResizeWindow = cs->ResizeWindow;
+ pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
+
+ pScreen->ClipNotify = cs->ClipNotify;
+ pScreen->UnrealizeWindow = cs->UnrealizeWindow;
+ pScreen->RealizeWindow = cs->RealizeWindow;
+ pScreen->DestroyWindow = cs->DestroyWindow;
+ pScreen->CreateWindow = cs->CreateWindow;
+ pScreen->CopyWindow = cs->CopyWindow;
+ pScreen->PositionWindow = cs->PositionWindow;
+
+ pScreen->GetImage = cs->GetImage;
+ pScreen->SourceValidate = cs->SourceValidate;
+
+ free(cs);
+ dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
+ ret = (*pScreen->CloseScreen) (index, pScreen);
+
+ return ret;
+}
+
+static void
+compInstallColormap(ColormapPtr pColormap)
+{
+ 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;
+ pScreen->InstallColormap = cs->InstallColormap;
+ (*pScreen->InstallColormap) (pColormap);
+ cs->InstallColormap = pScreen->InstallColormap;
+ pScreen->InstallColormap = compInstallColormap;
+}
+
+/* Fake backing store via automatic redirection */
+static Bool
+compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+{
+ ScreenPtr pScreen = pWin->drawable.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->ChangeWindowAttributes = compChangeWindowAttributes;
+
+ return ret;
+}
+
+static void
+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);
+
+ pScreen->GetImage = cs->GetImage;
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ 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)
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+
+ pScreen->SourceValidate = cs->SourceValidate;
+ if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors)
+ compPaintChildrenToWindow((WindowPtr) pDrawable);
+ if (pScreen->SourceValidate)
+ (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
+ subWindowMode);
+ cs->SourceValidate = pScreen->SourceValidate;
+ pScreen->SourceValidate = compSourceValidate;
+}
+
+/*
+ * Add alternate visuals -- always expose an ARGB32 and RGB24 visual
+ */
+
+static DepthPtr
+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;
+ }
+ }
+ /*
+ * If there isn't one, then it's gonna be hard to have
+ * an associated visual
+ */
+ return 0;
+}
+
+/*
+ * Add a list of visual IDs to the list of visuals to implicitly redirect.
+ */
+static Bool
+compRegisterAlternateVisuals(CompScreenPtr cs, VisualID * vids, int nVisuals)
+{
+ VisualID *p;
+
+ p = realloc(cs->alternateVisuals,
+ sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
+ if (p == NULL)
+ return FALSE;
+
+ memcpy(&p[cs->numAlternateVisuals], vids, sizeof(VisualID) * nVisuals);
+
+ cs->alternateVisuals = p;
+ cs->numAlternateVisuals += nVisuals;
+
+ return TRUE;
+}
+
+Bool
+CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids,
+ int nVisuals)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+
+ return compRegisterAlternateVisuals(cs, vids, nVisuals);
+}
+
+typedef struct _alternateVisual {
+ int depth;
+ CARD32 format;
+} CompAlternateVisual;
+
+static CompAlternateVisual altVisuals[] = {
+#if COMP_INCLUDE_RGB24_VISUAL
+ {24, PICT_r8g8b8},
+#endif
+ {32, PICT_a8r8g8b8},
+};
+
+static const int NUM_COMP_ALTERNATE_VISUALS = sizeof(altVisuals) /
+ sizeof(CompAlternateVisual);
+
+static Bool
+compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
+ CompAlternateVisual * alt)
+{
+ VisualPtr visual;
+ DepthPtr depth;
+ PictFormatPtr pPictFormat;
+ unsigned long alphaMask;
+
+ /*
+ * The ARGB32 visual is always available. Other alternate depth visuals
+ * are only provided if their depth is less than the root window depth.
+ * There's no deep reason for this.
+ */
+ if (alt->depth >= pScreen->rootDepth && alt->depth != 32)
+ return FALSE;
+
+ depth = compFindVisuallessDepth(pScreen, alt->depth);
+ if (!depth)
+ /* alt->depth doesn't exist or already has alternate visuals. */
+ return TRUE;
+
+ pPictFormat = PictureMatchFormat(pScreen, alt->depth, alt->format);
+ if (!pPictFormat)
+ return FALSE;
+
+ if (ResizeVisualArray(pScreen, 1, depth) == FALSE) {
+ return FALSE;
+ }
+
+ 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))));
+ }
+
+ /* remember the visual ID to detect auto-update windows */
+ compRegisterAlternateVisuals(cs, &visual->vid, 1);
+
+ return TRUE;
+}
+
+static Bool
+compAddAlternateVisuals(ScreenPtr pScreen, CompScreenPtr cs)
+{
+ int alt, ret = 0;
+
+ for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++)
+ ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt);
+
+ return ! !ret;
+}
+
+Bool
+compScreenInit(ScreenPtr pScreen)
+{
+ CompScreenPtr cs;
+
+ if (!dixRegisterPrivateKey(&CompScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&CompWindowPrivateKeyRec, PRIVATE_WINDOW, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&CompSubwindowsPrivateKeyRec, PRIVATE_WINDOW, 0))
+ return FALSE;
+
+ if (GetCompScreen(pScreen))
+ return TRUE;
+ cs = (CompScreenPtr) malloc(sizeof(CompScreenRec));
+ if (!cs)
+ return FALSE;
+
+ cs->overlayWid = FakeClientID(0);
+ cs->pOverlayWin = NULL;
+ cs->pOverlayClients = NULL;
+
+ cs->numAlternateVisuals = 0;
+ cs->alternateVisuals = NULL;
+
+ if (!compAddAlternateVisuals(pScreen, cs)) {
+ free(cs);
+ return FALSE;
+ }
+
+ cs->PositionWindow = pScreen->PositionWindow;
+ pScreen->PositionWindow = compPositionWindow;
+
+ cs->CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = compCopyWindow;
+
+ cs->CreateWindow = pScreen->CreateWindow;
+ pScreen->CreateWindow = compCreateWindow;
+
+ cs->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = compDestroyWindow;
+
+ cs->RealizeWindow = pScreen->RealizeWindow;
+ pScreen->RealizeWindow = compRealizeWindow;
+
+ cs->UnrealizeWindow = pScreen->UnrealizeWindow;
+ pScreen->UnrealizeWindow = compUnrealizeWindow;
+
+ cs->ClipNotify = pScreen->ClipNotify;
+ pScreen->ClipNotify = compClipNotify;
+
+ cs->ConfigNotify = pScreen->ConfigNotify;
+ pScreen->ConfigNotify = compConfigNotify;
+
+ cs->MoveWindow = pScreen->MoveWindow;
+ pScreen->MoveWindow = compMoveWindow;
+
+ cs->ResizeWindow = pScreen->ResizeWindow;
+ pScreen->ResizeWindow = compResizeWindow;
+
+ cs->ChangeBorderWidth = pScreen->ChangeBorderWidth;
+ pScreen->ChangeBorderWidth = compChangeBorderWidth;
+
+ cs->ReparentWindow = pScreen->ReparentWindow;
+ pScreen->ReparentWindow = compReparentWindow;
+
+ cs->InstallColormap = pScreen->InstallColormap;
+ pScreen->InstallColormap = compInstallColormap;
+
+ cs->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
+ pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
+
+ cs->BlockHandler = NULL;
+
+ cs->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = compCloseScreen;
+
+ cs->GetImage = pScreen->GetImage;
+ pScreen->GetImage = compGetImage;
+
+ cs->SourceValidate = pScreen->SourceValidate;
+ pScreen->SourceValidate = compSourceValidate;
+
+ dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs);
+
+ RegisterRealChildHeadProc(CompositeRealChildHead);
+
+ return TRUE;
+}
diff --git a/xorg-server/composite/compint.h b/xorg-server/composite/compint.h
index bb5335d70..6c4272e5b 100644
--- a/xorg-server/composite/compint.h
+++ b/xorg-server/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/xorg-server/composite/compoverlay.c b/xorg-server/composite/compoverlay.c
index 6ac05e8ad..3eafc2031 100644
--- a/xorg-server/composite/compoverlay.c
+++ b/xorg-server/composite/compoverlay.c
@@ -1,177 +1,174 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Copyright © 2003 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifdef CreateWindow
-#undef CreateWindow
-#endif
-
-#include "compint.h"
-#include "xace.h"
-
-#ifdef PANORAMIX
-#include "panoramiXsrv.h"
-#endif
-
-/*
- * Delete the given overlay client list element from its screen list.
- */
-void
-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;
- }
- }
-
- /* Destroy overlay window when there are no more clients using it */
- if (cs->pOverlayClients == NULL)
- compDestroyOverlayWindow (pScreen);
-}
-
-/*
- * Return the client's first overlay client rec from the given screen
- */
-CompOverlayClientPtr
-compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
-{
- CompScreenPtr cs = GetCompScreen(pScreen);
- CompOverlayClientPtr pOc;
-
- for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext)
- if (pOc->pClient == pClient)
- return pOc;
-
- return NULL;
-}
-
-/*
- * Create an overlay client object for the given client
- */
-CompOverlayClientPtr
-compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
-{
- CompScreenPtr cs = GetCompScreen(pScreen);
- CompOverlayClientPtr pOc;
-
- pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
- if (pOc == NULL)
- return NULL;
-
- pOc->pClient = pClient;
- pOc->pScreen = pScreen;
- pOc->resource = FakeClientID(pClient->index);
- pOc->pNext = cs->pOverlayClients;
- cs->pOverlayClients = pOc;
-
- /*
- * 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;
-
- return pOc;
-}
-
-/*
- * Create the overlay window and map it
- */
-Bool
-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;
-
-#ifdef PANORAMIX
- 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);
- if (pWin == NULL)
- return FALSE;
-
- if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin))
- return FALSE;
-
- MapWindow(pWin, serverClient);
-
- return TRUE;
-}
-
-/*
- * Destroy the overlay window
- */
-void
-compDestroyOverlayWindow (ScreenPtr pScreen)
-{
- CompScreenPtr cs = GetCompScreen(pScreen);
-
- cs->pOverlayWin = NullWindow;
- FreeResource (cs->overlayWid, RT_NONE);
-}
-
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef CreateWindow
+#undef CreateWindow
+#endif
+
+#include "compint.h"
+#include "xace.h"
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
+/*
+ * Delete the given overlay client list element from its screen list.
+ */
+void
+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;
+ }
+ }
+
+ /* Destroy overlay window when there are no more clients using it */
+ if (cs->pOverlayClients == NULL)
+ compDestroyOverlayWindow(pScreen);
+}
+
+/*
+ * Return the client's first overlay client rec from the given screen
+ */
+CompOverlayClientPtr
+compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompOverlayClientPtr pOc;
+
+ for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext)
+ if (pOc->pClient == pClient)
+ return pOc;
+
+ return NULL;
+}
+
+/*
+ * Create an overlay client object for the given client
+ */
+CompOverlayClientPtr
+compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompOverlayClientPtr pOc;
+
+ pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
+ if (pOc == NULL)
+ return NULL;
+
+ pOc->pClient = pClient;
+ pOc->pScreen = pScreen;
+ pOc->resource = FakeClientID(pClient->index);
+ pOc->pNext = cs->pOverlayClients;
+ cs->pOverlayClients = pOc;
+
+ /*
+ * 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;
+
+ return pOc;
+}
+
+/*
+ * Create the overlay window and map it
+ */
+Bool
+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;
+
+#ifdef PANORAMIX
+ 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);
+ if (pWin == NULL)
+ return FALSE;
+
+ if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer) pWin))
+ return FALSE;
+
+ MapWindow(pWin, serverClient);
+
+ return TRUE;
+}
+
+/*
+ * Destroy the overlay window
+ */
+void
+compDestroyOverlayWindow(ScreenPtr pScreen)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+
+ cs->pOverlayWin = NullWindow;
+ FreeResource(cs->overlayWid, RT_NONE);
+}
diff --git a/xorg-server/composite/compwindow.c b/xorg-server/composite/compwindow.c
index d2a866d6f..6eb624b11 100644
--- a/xorg-server/composite/compwindow.c
+++ b/xorg-server/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;
}