composite: more C99 declaration

Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
This commit is contained in:
SuperDuperDeou
2025-07-27 19:34:54 +02:00
committed by Enrico Weigelt
parent 80e6e7693b
commit 641b8a51cb
5 changed files with 28 additions and 43 deletions

View File

@@ -266,14 +266,14 @@ 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;
if (!cw)
return;
for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next) {
for (CompClientWindowPtr *prev = &cw->clients, ccw;
(ccw = *prev); prev = &ccw->next) {
if (ccw->id == id) {
*prev = ccw->next;
if (ccw->update == CompositeRedirectManual)
@@ -325,14 +325,13 @@ int
compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
{
CompWindowPtr cw = GetCompWindow(pWin);
CompClientWindowPtr ccw;
BUG_RETURN_VAL(!pClient, BadValue);
if (!cw)
return BadValue;
for (ccw = cw->clients; ccw; ccw = ccw->next)
for (CompClientWindowPtr ccw = cw->clients; ccw; ccw = ccw->next)
if (ccw->update == update && dixClientIdForXID(ccw->id) == pClient->index) {
FreeResource(ccw->id, X11_RESTYPE_NONE);
return Success;
@@ -348,7 +347,6 @@ int
compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
{
CompSubwindowsPtr csw = GetCompSubwindows(pWin);
WindowPtr pChild;
/*
* Only one Manual update is allowed
@@ -383,12 +381,12 @@ compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
/*
* Redirect all existing windows
*/
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib) {
for (WindowPtr 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);
for (WindowPtr pSib = pChild->nextSib; pSib; pSib = pSib->nextSib)
(void) compUnredirectWindow(pClient, pSib, update);
if (!csw->clients) {
free(csw);
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
@@ -424,12 +422,11 @@ void
compFreeClientSubwindows(WindowPtr pWin, XID id)
{
CompSubwindowsPtr csw = GetCompSubwindows(pWin);
CompClientWindowPtr ccw, *prev;
WindowPtr pChild;
if (!csw)
return;
for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next) {
for (CompClientWindowPtr *prev = &csw->clients, ccw;
(ccw = *prev); prev = &ccw->next) {
if (ccw->id == id) {
ClientPtr pClient = dixClientForXID(id);
@@ -450,7 +447,8 @@ compFreeClientSubwindows(WindowPtr pWin, XID id)
/*
* Unredirect all existing subwindows
*/
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
for (WindowPtr pChild = pWin->lastChild;
pChild; pChild = pChild->prevSib)
(void) compUnredirectWindow(pClient, pChild, ccw->update);
free(ccw);
@@ -475,11 +473,10 @@ int
compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
{
CompSubwindowsPtr csw = GetCompSubwindows(pWin);
CompClientWindowPtr ccw;
if (!csw)
return BadValue;
for (ccw = csw->clients; ccw; ccw = ccw->next)
for (CompClientWindowPtr ccw = csw->clients; ccw; ccw = ccw->next)
if (ccw->update == update && dixClientIdForXID(ccw->id) == pClient->index) {
FreeResource(ccw->id, X11_RESTYPE_NONE);
return Success;
@@ -495,11 +492,10 @@ int
compRedirectOneSubwindow(WindowPtr pParent, WindowPtr pWin)
{
CompSubwindowsPtr csw = GetCompSubwindows(pParent);
CompClientWindowPtr ccw;
if (!csw)
return Success;
for (ccw = csw->clients; ccw; ccw = ccw->next) {
for (CompClientWindowPtr ccw = csw->clients; ccw; ccw = ccw->next) {
int ret = compRedirectWindow(dixClientForXID(ccw->id),
pWin, ccw->update);
if (ret != Success)
@@ -516,11 +512,10 @@ int
compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin)
{
CompSubwindowsPtr csw = GetCompSubwindows(pParent);
CompClientWindowPtr ccw;
if (!csw)
return Success;
for (ccw = csw->clients; ccw; ccw = ccw->next) {
for (CompClientWindowPtr ccw = csw->clients; ccw; ccw = ccw->next) {
int ret = compUnredirectWindow(dixClientForXID(ccw->id),
pWin, ccw->update);
if (ret != Success)

View File

@@ -400,18 +400,16 @@ GetCompositeWindowBytes(void *value, XID id, ResourceSizePtr size)
void
CompositeExtensionInit(void)
{
ExtensionEntry *extEntry;
/* Assume initialization is going to fail */
noCompositeExtension = TRUE;
for (unsigned int walkScreenIdx = 0; walkScreenIdx < screenInfo.numScreens; walkScreenIdx++) {
ScreenPtr walkScreen = screenInfo.screens[walkScreenIdx];
VisualPtr vis;
/* Composite on 8bpp pseudocolor root windows appears to fail, so
* just disable it on anything pseudocolor for safety.
*/
VisualPtr vis;
for (vis = walkScreen->visuals; vis->vid != walkScreen->rootVisual; vis++);
if ((vis->class | DynamicClass) == PseudoColor)
return;
@@ -451,7 +449,7 @@ CompositeExtensionInit(void)
return;
}
extEntry = AddExtension(COMPOSITE_NAME, 0, 0,
ExtensionEntry *extEntry = AddExtension(COMPOSITE_NAME, 0, 0,
ProcCompositeDispatch,
ProcCompositeDispatch,
NULL, StandardMinorOpcode);

View File

@@ -93,9 +93,8 @@ compInstallColormap(ColormapPtr pColormap)
VisualPtr pVisual = pColormap->pVisual;
ScreenPtr pScreen = pColormap->pScreen;
CompScreenPtr cs = GetCompScreen(pScreen);
int a;
for (a = 0; a < cs->numAlternateVisuals; a++)
for (int a = 0; a < cs->numAlternateVisuals; a++)
if (pVisual->vid == cs->alternateVisuals[a])
return;
pScreen->InstallColormap = cs->InstallColormap;
@@ -160,9 +159,7 @@ compSourceValidate(DrawablePtr pDrawable,
static DepthPtr
compFindVisuallessDepth(ScreenPtr pScreen, int d)
{
int i;
for (i = 0; i < pScreen->numDepths; i++) {
for (int i = 0; i < pScreen->numDepths; i++) {
DepthPtr depth = &pScreen->allowedDepths[i];
if (depth->depth == d) {
@@ -299,12 +296,12 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
static Bool
compAddAlternateVisuals(ScreenPtr pScreen, CompScreenPtr cs)
{
int alt, ret = 0;
int ret = 0;
for (alt = 0; alt < ARRAY_SIZE(altVisuals); alt++)
for (int alt = 0; alt < ARRAY_SIZE(altVisuals); alt++)
ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt);
return ! !ret;
return ret;
}
Bool

View File

@@ -59,9 +59,9 @@ compFreeOverlayClient(CompOverlayClientPtr pOcToDel)
{
ScreenPtr pScreen = pOcToDel->pScreen;
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr *pPrev, pOc;
for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext) {
for (CompOverlayClientPtr *pPrev = &cs->pOverlayClients, pOc;
(pOc = *pPrev); pPrev = &pOc->pNext) {
if (pOc == pOcToDel) {
*pPrev = pOc->pNext;
free(pOc);
@@ -81,9 +81,9 @@ CompOverlayClientPtr
compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
{
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext)
for (CompOverlayClientPtr pOc = cs->pOverlayClients;
pOc != NULL; pOc = pOc->pNext)
if (pOc->pClient == pClient)
return pOc;

View File

@@ -320,9 +320,8 @@ Bool
compIsAlternateVisual(ScreenPtr pScreen, XID visual)
{
CompScreenPtr cs = GetCompScreen(pScreen);
int i;
for (i = 0; cs && i < cs->numAlternateVisuals; i++)
for (int i = 0; cs && i < cs->numAlternateVisuals; i++)
if (cs->alternateVisuals[i] == visual)
return TRUE;
return FALSE;
@@ -333,9 +332,8 @@ CompositeIsImplicitRedirectException(ScreenPtr pScreen,
XID parentVisual, XID winVisual)
{
CompScreenPtr cs = GetCompScreen(pScreen);
int i;
for (i = 0; i < cs->numImplicitRedirectExceptions; i++)
for (int i = 0; i < cs->numImplicitRedirectExceptions; i++)
if (cs->implicitRedirectExceptions[i].parentVisual == parentVisual &&
cs->implicitRedirectExceptions[i].winVisual == winVisual)
return TRUE;
@@ -564,14 +562,13 @@ compCreateWindow(WindowPtr pWin)
ret = (*pScreen->CreateWindow) (pWin);
if (pWin->parent && ret) {
CompSubwindowsPtr csw = GetCompSubwindows(pWin->parent);
CompClientWindowPtr ccw;
PixmapPtr parent_pixmap = (*pScreen->GetWindowPixmap)(pWin->parent);
PixmapPtr window_pixmap = (*pScreen->GetWindowPixmap)(pWin);
if (window_pixmap != parent_pixmap)
(*pScreen->SetWindowPixmap) (pWin, parent_pixmap);
if (csw)
for (ccw = csw->clients; ccw; ccw = ccw->next)
for (CompClientWindowPtr ccw = csw->clients; ccw; ccw = ccw->next)
compRedirectWindow(dixClientForXID(ccw->id),
pWin, ccw->update);
if (compImplicitRedirect(pWin, pWin->parent))
@@ -726,12 +723,10 @@ compPaintWindowToParent(WindowPtr pWin)
void
compPaintChildrenToWindow(WindowPtr pWin)
{
WindowPtr pChild;
if (!pWin->damagedDescendants)
return;
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
for (WindowPtr pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
compPaintWindowToParent(pChild);
pWin->damagedDescendants = FALSE;