Commit 7a0b401b authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Window.c: reformat/add braces for readability

parent 2769cbb9
...@@ -257,7 +257,10 @@ WindowPtr nxagentWindowPtr(Window window) ...@@ -257,7 +257,10 @@ WindowPtr nxagentWindowPtr(Window window)
{ {
WalkTree(screenInfo.screens[i], nxagentFindWindowMatch, (void *) &match); WalkTree(screenInfo.screens[i], nxagentFindWindowMatch, (void *) &match);
if (match.pWin) break; if (match.pWin)
{
break;
}
} }
return match.pWin; return match.pWin;
...@@ -285,11 +288,13 @@ Bool nxagentCreateWindow(WindowPtr pWin) ...@@ -285,11 +288,13 @@ Bool nxagentCreateWindow(WindowPtr pWin)
fprintf(stderr, "nxagentCreateWindow: nxagentSplashCount [%d]\n", nxagentSplashCount); fprintf(stderr, "nxagentCreateWindow: nxagentSplashCount [%d]\n", nxagentSplashCount);
#endif #endif
if (pWin->drawable.class == InputOnly) { if (pWin->drawable.class == InputOnly)
{
mask = CWEventMask; mask = CWEventMask;
visual = CopyFromParent; visual = CopyFromParent;
} }
else { else
{
mask = CWEventMask | CWBackingStore; mask = CWEventMask | CWBackingStore;
if (pWin->optional) if (pWin->optional)
...@@ -315,26 +320,36 @@ Bool nxagentCreateWindow(WindowPtr pWin) ...@@ -315,26 +320,36 @@ Bool nxagentCreateWindow(WindowPtr pWin)
attributes.save_under = False; attributes.save_under = False;
} }
if (pWin->parent) { if (pWin->parent)
if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent)) { {
if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent))
{
visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
mask |= CWColormap; mask |= CWColormap;
if (pWin->optional->colormap) { if (pWin->optional->colormap)
{
pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
attributes.colormap = nxagentColormap(pCmap); attributes.colormap = nxagentColormap(pCmap);
} }
else else
{
attributes.colormap = nxagentDefaultVisualColormap(visual); attributes.colormap = nxagentDefaultVisualColormap(visual);
} }
}
else if (pWin->optional) else if (pWin->optional)
{
visual = CopyFromParent; visual = CopyFromParent;
else { }
else
{
visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
mask |= CWColormap; mask |= CWColormap;
attributes.colormap = nxagentDefaultVisualColormap(visual); attributes.colormap = nxagentDefaultVisualColormap(visual);
} }
} }
else { /* root windows have their own colormaps at creation time */ else
{
/* root windows have their own colormaps at creation time */
visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
mask |= CWColormap; mask |= CWColormap;
...@@ -473,11 +488,15 @@ Bool nxagentCreateWindow(WindowPtr pWin) ...@@ -473,11 +488,15 @@ Bool nxagentCreateWindow(WindowPtr pWin)
Atom prop = MakeAtom("NX_REAL_WINDOW", strlen("NX_REAL_WINDOW"), True); Atom prop = MakeAtom("NX_REAL_WINDOW", strlen("NX_REAL_WINDOW"), True);
if (ChangeWindowProperty(pWin, prop, XA_WINDOW, 32, PropModeReplace, 1, nxagentWindowPriv(pWin), 1) != Success) if (ChangeWindowProperty(pWin, prop, XA_WINDOW, 32, PropModeReplace, 1, nxagentWindowPriv(pWin), 1) != Success)
{
fprintf(stderr, "nxagentCreateWindow: Adding NX_REAL_WINDOW failed.\n"); fprintf(stderr, "nxagentCreateWindow: Adding NX_REAL_WINDOW failed.\n");
#ifdef DEBUG }
#ifdef DEBUG
else else
{
fprintf(stderr, "nxagentCreateWindow: Added NX_REAL_WINDOW for Window ID [%x].\n", nxagentWindowPriv(pWin)->window); fprintf(stderr, "nxagentCreateWindow: Added NX_REAL_WINDOW for Window ID [%x].\n", nxagentWindowPriv(pWin)->window);
#endif }
#endif
} }
nxagentWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin); nxagentWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
...@@ -537,11 +556,15 @@ void nxagentSetVersionProperty(WindowPtr pWin) ...@@ -537,11 +556,15 @@ void nxagentSetVersionProperty(WindowPtr pWin)
Atom prop = MakeAtom(name, strlen(name), True); Atom prop = MakeAtom(name, strlen(name), True);
if (ChangeWindowProperty(pWin, prop, XA_STRING, 8, PropModeReplace, strlen(NX_VERSION_CURRENT_STRING), NX_VERSION_CURRENT_STRING, True) != Success) if (ChangeWindowProperty(pWin, prop, XA_STRING, 8, PropModeReplace, strlen(NX_VERSION_CURRENT_STRING), NX_VERSION_CURRENT_STRING, True) != Success)
{
fprintf(stderr, "%s: Adding property [%s], value [%s] failed.\n", __func__, name, NX_VERSION_CURRENT_STRING); fprintf(stderr, "%s: Adding property [%s], value [%s] failed.\n", __func__, name, NX_VERSION_CURRENT_STRING);
#ifdef DEBUG }
#ifdef DEBUG
else else
{
fprintf(stderr, "%s: Added property [%s], value [%s] for root window [%x].\n", __func__, name, NX_VERSION_CURRENT_STRING, pWin); fprintf(stderr, "%s: Added property [%s], value [%s] for root window [%x].\n", __func__, name, NX_VERSION_CURRENT_STRING, pWin);
#endif }
#endif
} }
Bool nxagentSomeWindowsAreMapped(void) Bool nxagentSomeWindowsAreMapped(void)
...@@ -1907,8 +1930,10 @@ Bool nxagentRealizeWindow(WindowPtr pWin) ...@@ -1907,8 +1930,10 @@ Bool nxagentRealizeWindow(WindowPtr pWin)
wmState.state = 1; /* NormalState */ wmState.state = 1; /* NormalState */
wmState.icon = None; wmState.icon = None;
if (ChangeWindowProperty(pWin, prop, prop, 32, 0, 2, &wmState, 1) != Success) if (ChangeWindowProperty(pWin, prop, prop, 32, 0, 2, &wmState, 1) != Success)
{
fprintf(stderr, "nxagentRealizeWindow: Adding WM_STATE fail.\n"); fprintf(stderr, "nxagentRealizeWindow: Adding WM_STATE fail.\n");
} }
}
#ifdef SHAPE #ifdef SHAPE
...@@ -1963,8 +1988,10 @@ Bool nxagentUnrealizeWindow(WindowPtr pWin) ...@@ -1963,8 +1988,10 @@ Bool nxagentUnrealizeWindow(WindowPtr pWin)
wmState.state = 3; /* WithdrawnState */ wmState.state = 3; /* WithdrawnState */
wmState.icon = None; wmState.icon = None;
if (ChangeWindowProperty(pWin, prop, prop, 32, 0, 2, &wmState, 1) != Success) if (ChangeWindowProperty(pWin, prop, prop, 32, 0, 2, &wmState, 1) != Success)
{
fprintf(stderr, "nxagentUnRealizeWindow: Changing WM_STATE failed.\n"); fprintf(stderr, "nxagentUnRealizeWindow: Changing WM_STATE failed.\n");
} }
}
XUnmapWindow(nxagentDisplay, nxagentWindow(pWin)); XUnmapWindow(nxagentDisplay, nxagentWindow(pWin));
...@@ -2301,9 +2328,15 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2) ...@@ -2301,9 +2328,15 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2)
BoxPtr pBox1, pBox2; BoxPtr pBox1, pBox2;
unsigned int n1, n2; unsigned int n1, n2;
if (pReg1 == pReg2) return True; if (pReg1 == pReg2)
{
return True;
}
if (pReg1 == NullRegion || pReg2 == NullRegion) return False; if (pReg1 == NullRegion || pReg2 == NullRegion)
{
return False;
}
pBox1 = RegionRects(pReg1); pBox1 = RegionRects(pReg1);
n1 = RegionNumRects(pReg1); n1 = RegionNumRects(pReg1);
...@@ -2311,11 +2344,20 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2) ...@@ -2311,11 +2344,20 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2)
pBox2 = RegionRects(pReg2); pBox2 = RegionRects(pReg2);
n2 = RegionNumRects(pReg2); n2 = RegionNumRects(pReg2);
if (n1 != n2) return False; if (n1 != n2)
{
return False;
}
if (pBox1 == pBox2) return True; if (pBox1 == pBox2)
{
return True;
}
if (memcmp(pBox1, pBox2, n1 * sizeof(BoxRec))) return False; if (memcmp(pBox1, pBox2, n1 * sizeof(BoxRec)))
{
return False;
}
return True; return True;
} }
...@@ -2697,11 +2739,15 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) ...@@ -2697,11 +2739,15 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2)
Atom prop = MakeAtom("NX_REAL_WINDOW", strlen("NX_REAL_WINDOW"), True); Atom prop = MakeAtom("NX_REAL_WINDOW", strlen("NX_REAL_WINDOW"), True);
if (DeleteProperty(pWin, prop) != Success) if (DeleteProperty(pWin, prop) != Success)
{
fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW failed.\n"); fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW failed.\n");
#ifdef DEBUG }
#ifdef DEBUG
else else
{
fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW from Window ID [%x].\n", nxagentWindowPriv(pWin)->window); fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW from Window ID [%x].\n", nxagentWindowPriv(pWin)->window);
#endif }
#endif
} }
nxagentWindow(pWin) = None; nxagentWindow(pWin) = None;
...@@ -2899,17 +2945,21 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -2899,17 +2945,21 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
ColormapPtr pCmap; ColormapPtr pCmap;
if (!pWin || !*pBool) if (!pWin || !*pBool)
{
return; return;
}
#ifdef NXAGENT_RECONNECT_WINDOW_DEBUG #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG
fprintf(stderr, "nxagentReconnectWindow: %p - ID %lx\n", pWin, nxagentWindow(pWin)); fprintf(stderr, "nxagentReconnectWindow: %p - ID %lx\n", pWin, nxagentWindow(pWin));
#endif #endif
if (pWin->drawable.class == InputOnly) { if (pWin->drawable.class == InputOnly)
{
mask = CWEventMask; mask = CWEventMask;
visual = CopyFromParent; visual = CopyFromParent;
} }
else { else
{
mask = CWEventMask | CWBackingStore; mask = CWEventMask | CWBackingStore;
attributes.backing_store = NotUseful; attributes.backing_store = NotUseful;
...@@ -2930,21 +2980,30 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -2930,21 +2980,30 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
attributes.save_under = pWin->saveUnder; attributes.save_under = pWin->saveUnder;
} }
if (pWin->parent) { if (pWin->parent)
if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent)) { {
if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent))
{
visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
mask |= CWColormap; mask |= CWColormap;
if (pWin->optional->colormap) { if (pWin->optional->colormap)
{
pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
attributes.colormap = nxagentColormap(pCmap); attributes.colormap = nxagentColormap(pCmap);
} }
else else
{
attributes.colormap = nxagentDefaultVisualColormap(visual); attributes.colormap = nxagentDefaultVisualColormap(visual);
} }
}
else else
{
visual = CopyFromParent; visual = CopyFromParent;
} }
else { /* root windows have their own colormaps at creation time */ }
else
{
/* root windows have their own colormaps at creation time */
visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
mask |= CWColormap; mask |= CWColormap;
...@@ -3138,11 +3197,15 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3138,11 +3197,15 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
Atom prop = MakeAtom("NX_REAL_WINDOW", strlen("NX_REAL_WINDOW"), True); Atom prop = MakeAtom("NX_REAL_WINDOW", strlen("NX_REAL_WINDOW"), True);
if (ChangeWindowProperty(pWin, prop, XA_WINDOW, 32, PropModeReplace, 1, nxagentWindowPriv(pWin), 1) != Success) if (ChangeWindowProperty(pWin, prop, XA_WINDOW, 32, PropModeReplace, 1, nxagentWindowPriv(pWin), 1) != Success)
{
fprintf(stderr, "nxagentReconnectWindow: Updating NX_REAL_WINDOW failed.\n"); fprintf(stderr, "nxagentReconnectWindow: Updating NX_REAL_WINDOW failed.\n");
#ifdef DEBUG }
#ifdef DEBUG
else else
{
fprintf(stderr, "nxagentReconnectWindow: Updated NX_REAL_WINDOW for Window ID [%x].\n", nxagentWindowPriv(pWin)->window); fprintf(stderr, "nxagentReconnectWindow: Updated NX_REAL_WINDOW for Window ID [%x].\n", nxagentWindowPriv(pWin)->window);
#endif }
#endif
} }
if (nxagentDrawableStatus((DrawablePtr) pWin) == NotSynchronized) if (nxagentDrawableStatus((DrawablePtr) pWin) == NotSynchronized)
...@@ -3159,7 +3222,9 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat ...@@ -3159,7 +3222,9 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat
ScreenPtr pScreen; ScreenPtr pScreen;
if (!pWin || !*pBool || !(pCursor = wCursor(pWin))) if (!pWin || !*pBool || !(pCursor = wCursor(pWin)))
{
return; return;
}
pScreen = pWin -> drawable.pScreen; pScreen = pWin -> drawable.pScreen;
...@@ -3216,16 +3281,19 @@ static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buff ...@@ -3216,16 +3281,19 @@ static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buff
#endif #endif
if (pWin -> drawable.class == InputOnly) if (pWin -> drawable.class == InputOnly)
{
mask = CWWinGravity | CWEventMask | CWDontPropagate | CWOverrideRedirect | CWCursor; mask = CWWinGravity | CWEventMask | CWDontPropagate | CWOverrideRedirect | CWCursor;
}
else else
{
mask = CWBackPixmap | CWBackPixel | CWBorderPixmap | CWBorderPixel | mask = CWBackPixmap | CWBackPixel | CWBorderPixmap | CWBorderPixel |
CWBitGravity | CWWinGravity | CWBackingStore | CWBackingPlanes | CWBitGravity | CWWinGravity | CWBackingStore | CWBackingPlanes |
CWBackingPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask | CWBackingPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask |
CWDontPropagate | CWColormap | CWCursor; CWDontPropagate | CWColormap | CWCursor;
}
nxagentChangeWindowAttributes(pWin, mask); nxagentChangeWindowAttributes(pWin, mask);
#ifdef SHAPE #ifdef SHAPE
if (nxagentWindowPriv(pWin) -> boundingShape) if (nxagentWindowPriv(pWin) -> boundingShape)
{ {
RegionDestroy( RegionDestroy(
...@@ -3240,7 +3308,7 @@ static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buff ...@@ -3240,7 +3308,7 @@ static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buff
nxagentWindowPriv(pWin) -> clipShape = NULL; nxagentWindowPriv(pWin) -> clipShape = NULL;
} }
nxagentShapeWindow(pWin); nxagentShapeWindow(pWin);
#endif #endif
if (pWin != screenInfo.screens[0]->root) if (pWin != screenInfo.screens[0]->root)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment