Commit 1fb32cf7 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Window.c: scope improvements

parent 7a0b401b
...@@ -587,7 +587,6 @@ Bool nxagentSomeWindowsAreMapped(void) ...@@ -587,7 +587,6 @@ Bool nxagentSomeWindowsAreMapped(void)
Bool nxagentDestroyWindow(WindowPtr pWin) Bool nxagentDestroyWindow(WindowPtr pWin)
{ {
int i;
int j; int j;
nxagentPrivWindowPtr pWindowPriv; nxagentPrivWindowPtr pWindowPriv;
...@@ -601,7 +600,7 @@ Bool nxagentDestroyWindow(WindowPtr pWin) ...@@ -601,7 +600,7 @@ Bool nxagentDestroyWindow(WindowPtr pWin)
for (j = 0; j < nxagentExposeQueue.length; j++) for (j = 0; j < nxagentExposeQueue.length; j++)
{ {
i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE;
if (nxagentExposeQueue.exposures[i].pWindow == pWin) if (nxagentExposeQueue.exposures[i].pWindow == pWin)
{ {
...@@ -1295,7 +1294,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) ...@@ -1295,7 +1294,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
unsigned int valuemask; unsigned int valuemask;
XWindowChanges values; XWindowChanges values;
int offX, offY; int offX, offY;
int i, j; int j;
offX = nxagentWindowPriv(pWin)->x - pWin->origin.x; offX = nxagentWindowPriv(pWin)->x - pWin->origin.x;
offY = nxagentWindowPriv(pWin)->y - pWin->origin.y; offY = nxagentWindowPriv(pWin)->y - pWin->origin.y;
...@@ -1397,7 +1396,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) ...@@ -1397,7 +1396,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
for (j = 0; j < nxagentExposeQueue.length; j++) for (j = 0; j < nxagentExposeQueue.length; j++)
{ {
i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE;
if (nxagentExposeQueue.exposures[i].pWindow == pWin && if (nxagentExposeQueue.exposures[i].pWindow == pWin &&
nxagentExposeQueue.exposures[i].remoteRegion != NullRegion) nxagentExposeQueue.exposures[i].remoteRegion != NullRegion)
...@@ -2034,15 +2033,12 @@ void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) ...@@ -2034,15 +2033,12 @@ void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
{ {
int i;
RegionRec temp; RegionRec temp;
if (pWin -> realized) if (pWin -> realized)
{ {
BoxPtr pBox; int i;
BoxPtr pBox = RegionRects(pRegion);
pBox = RegionRects(pRegion);
for (i = 0; i < RegionNumRects(pRegion); i++) for (i = 0; i < RegionNumRects(pRegion); i++)
{ {
...@@ -2229,9 +2225,7 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo ...@@ -2229,9 +2225,7 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo
if (nxagentExposeQueue.length < EXPOSED_SIZE) if (nxagentExposeQueue.length < EXPOSED_SIZE)
{ {
int index; int index = (nxagentExposeQueue.start + nxagentExposeQueue.length) % EXPOSED_SIZE;
index = (nxagentExposeQueue.start + nxagentExposeQueue.length) % EXPOSED_SIZE;
nxagentExposeQueue.exposures[index].pWindow = pWin; nxagentExposeQueue.exposures[index].pWindow = pWin;
...@@ -2503,12 +2497,12 @@ void nxagentShapeWindow(WindowPtr pWin) ...@@ -2503,12 +2497,12 @@ void nxagentShapeWindow(WindowPtr pWin)
static int nxagentForceExposure(WindowPtr pWin, void * ptr) static int nxagentForceExposure(WindowPtr pWin, void * ptr)
{ {
RegionPtr exposedRgn;
BoxRec Box;
WindowPtr pRoot = pWin->drawable.pScreen->root;
if (pWin -> drawable.class != InputOnly) if (pWin -> drawable.class != InputOnly)
{ {
BoxRec Box;
RegionPtr exposedRgn;
WindowPtr pRoot = pWin->drawable.pScreen->root;
Box.x1 = pWin->drawable.x; Box.x1 = pWin->drawable.x;
Box.y1 = pWin->drawable.y; Box.y1 = pWin->drawable.y;
Box.x2 = Box.x1 + pWin->drawable.width; Box.x2 = Box.x1 + pWin->drawable.width;
...@@ -2537,10 +2531,10 @@ void nxagentRefreshWindows(WindowPtr pWin) ...@@ -2537,10 +2531,10 @@ void nxagentRefreshWindows(WindowPtr pWin)
void nxagentUnmapWindows(void) void nxagentUnmapWindows(void)
{ {
int i;
if (nxagentOption(Fullscreen) == 1) if (nxagentOption(Fullscreen) == 1)
{ {
int i;
for (i = 0; i < screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++)
{ {
if (nxagentDefaultWindows[i]) if (nxagentDefaultWindows[i])
...@@ -2666,7 +2660,6 @@ Bool nxagentDisconnectAllWindows(void) ...@@ -2666,7 +2660,6 @@ Bool nxagentDisconnectAllWindows(void)
{ {
Bool succeeded = True; Bool succeeded = True;
int i; int i;
WindowPtr pWin;
#if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG) #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG)
fprintf(stderr, "nxagentDisconnectAllWindows\n"); fprintf(stderr, "nxagentDisconnectAllWindows\n");
...@@ -2674,7 +2667,7 @@ Bool nxagentDisconnectAllWindows(void) ...@@ -2674,7 +2667,7 @@ Bool nxagentDisconnectAllWindows(void)
for (i = 0; i < screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++)
{ {
pWin = screenInfo.screens[i]->root; WindowPtr pWin = screenInfo.screens[i]->root;
nxagentTraverseWindow( pWin, nxagentDisconnectWindow, &succeeded); nxagentTraverseWindow( pWin, nxagentDisconnectWindow, &succeeded);
nxagentDefaultWindows[i] = None; nxagentDefaultWindows[i] = None;
} }
...@@ -2924,12 +2917,10 @@ static Bool nxagentLoopOverWindows(void (*pF)(void *, XID, void *)) ...@@ -2924,12 +2917,10 @@ static Bool nxagentLoopOverWindows(void (*pF)(void *, XID, void *))
{ {
int i; int i;
Bool windowSuccess = True; Bool windowSuccess = True;
WindowPtr pWin;
for (i = 0; i < screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++)
{ {
pWin = screenInfo.screens[i]->root; nxagentTraverseWindow(screenInfo.screens[i]->root, pF, &windowSuccess);
nxagentTraverseWindow(pWin, pF, &windowSuccess);
} }
return windowSuccess; return windowSuccess;
...@@ -3110,9 +3101,8 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3110,9 +3101,8 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
Atom type; Atom type;
int format; int format;
unsigned long nItems, bytesLeft; unsigned long nItems, bytesLeft;
XSizeHints *props, hints; XSizeHints hints = {0};
unsigned char *data = NULL; unsigned char *data = NULL;
#ifdef _XSERVER64 #ifdef _XSERVER64
unsigned char *data64 = NULL; unsigned char *data64 = NULL;
...@@ -3120,8 +3110,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3120,8 +3110,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
#endif #endif
hints.flags = 0;
ret = GetWindowProperty(pWin, ret = GetWindowProperty(pWin,
XA_WM_NORMAL_HINTS, XA_WM_NORMAL_HINTS,
0, sizeof(XSizeHints), 0, sizeof(XSizeHints),
...@@ -3138,13 +3126,13 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3138,13 +3126,13 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
bytesLeft == 0 && bytesLeft == 0 &&
type == XA_WM_SIZE_HINTS) type == XA_WM_SIZE_HINTS)
{ {
XSizeHints *props;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentReconnectWindow: setting WMSizeHints on window %p [%lx - %lx].\n", fprintf(stderr, "nxagentReconnectWindow: setting WMSizeHints on window %p [%lx - %lx].\n",
(void*)pWin, pWin -> drawable.id, nxagentWindow(pWin)); (void*)pWin, pWin -> drawable.id, nxagentWindow(pWin));
#endif #endif
#ifdef _XSERVER64 #ifdef _XSERVER64
data64 = (unsigned char *) malloc(sizeof(XSizeHints) + 4); data64 = (unsigned char *) malloc(sizeof(XSizeHints) + 4);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
...@@ -3527,7 +3515,6 @@ void nxagentFlushConfigureWindow(void) ...@@ -3527,7 +3515,6 @@ void nxagentFlushConfigureWindow(void)
{ {
ConfiguredWindowStruct *index; ConfiguredWindowStruct *index;
XWindowChanges changes; XWindowChanges changes;
int i;
int j; int j;
index = nxagentConfiguredWindowList; index = nxagentConfiguredWindowList;
...@@ -3544,8 +3531,6 @@ void nxagentFlushConfigureWindow(void) ...@@ -3544,8 +3531,6 @@ void nxagentFlushConfigureWindow(void)
while (index) while (index)
{ {
ConfiguredWindowStruct *tmp;
WindowPtr pWin = index -> pWin; WindowPtr pWin = index -> pWin;
unsigned int valuemask = index -> valuemask; unsigned int valuemask = index -> valuemask;
...@@ -3554,23 +3539,24 @@ void nxagentFlushConfigureWindow(void) ...@@ -3554,23 +3539,24 @@ void nxagentFlushConfigureWindow(void)
nxagentConfigureWindow(pWin, valuemask); nxagentConfigureWindow(pWin, valuemask);
} }
tmp = index;
if (index == nxagentConfiguredWindowList) if (index == nxagentConfiguredWindowList)
{ {
free(tmp); free(index);
break; break;
} }
else
index = index -> prev; {
free(tmp); ConfiguredWindowStruct *tmp = index;
} index = index -> prev;
free(tmp);
}
}
nxagentConfiguredWindowList = NULL; nxagentConfiguredWindowList = NULL;
for (j = 0; j < nxagentExposeQueue.length; j++) for (j = 0; j < nxagentExposeQueue.length; j++)
{ {
i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE;
if (nxagentExposeQueue.exposures[i].synchronize == 1) if (nxagentExposeQueue.exposures[i].synchronize == 1)
{ {
...@@ -3929,7 +3915,6 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW ...@@ -3929,7 +3915,6 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW
int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) int nxagentRemoveItemBSPixmapList(unsigned long pixmapId)
{ {
int i; int i;
int j;
if (pixmapId == 0 || nxagentBSPixmapList[0] == NULL) if (pixmapId == 0 || nxagentBSPixmapList[0] == NULL)
{ {
...@@ -3946,6 +3931,8 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) ...@@ -3946,6 +3931,8 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId)
if (i < BSPIXMAPLIMIT - 1) if (i < BSPIXMAPLIMIT - 1)
{ {
int j;
for (j = i; j < BSPIXMAPLIMIT -1; j++) for (j = i; j < BSPIXMAPLIMIT -1; j++)
{ {
nxagentBSPixmapList[j] = nxagentBSPixmapList[j + 1]; nxagentBSPixmapList[j] = nxagentBSPixmapList[j + 1];
......
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