From e72e2375ffcb7625d2c322d4d58965d06a630c8e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 23:40:03 +0200 Subject: Cursor.c: scope improvements --- nx-X11/programs/Xserver/hw/nxagent/Cursor.c | 55 +++++++++++++---------------- 1 file changed, 24 insertions(+), 31 deletions(-) (limited to 'nx-X11/programs/Xserver') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Cursor.c b/nx-X11/programs/Xserver/hw/nxagent/Cursor.c index 34672fef5..5346efd90 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Cursor.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Cursor.c @@ -93,11 +93,8 @@ extern CursorPtr GetSpriteCursor(void); void nxagentConstrainCursor(ScreenPtr pScreen, BoxPtr pBox) { #ifdef TEST - - int width, height; - - width = nxagentOption(RootWidth); - height = nxagentOption(RootHeight); + int width = nxagentOption(RootWidth); + int height = nxagentOption(RootHeight); if (pBox->x1 <= 0 && pBox->y1 <= 0 && pBox->x2 >= width && pBox->y2 >= height) @@ -150,18 +147,14 @@ Bool nxagentRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) fprintf(stderr, "nxagentRealizeCursor: Called for cursor at [%p].\n", (void *) pCursor); #endif - unsigned long valuemask = GCFunction | - GCPlaneMask | - GCForeground | - GCBackground | - GCClipMask; + unsigned long valuemask = GCFunction | GCPlaneMask | GCForeground | GCBackground | GCClipMask; XGCValues values = { - .function = GXcopy, - .plane_mask = AllPlanes, - .foreground = 1L, - .background = 0L, - .clip_mask = None + .function = GXcopy, + .plane_mask = AllPlanes, + .foreground = 1L, + .background = 0L, + .clip_mask = None, }; XChangeGC(nxagentDisplay, nxagentBitmapGC, valuemask, &values); @@ -221,15 +214,15 @@ Bool nxagentRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) SAFE_XFree(image); XColor fg_color = { - .red = pCursor->foreRed, - .green = pCursor->foreGreen, - .blue = pCursor->foreBlue + .red = pCursor->foreRed, + .green = pCursor->foreGreen, + .blue = pCursor->foreBlue, }; XColor bg_color = { - .red = pCursor->backRed, - .green = pCursor->backGreen, - .blue = pCursor->backBlue + .red = pCursor->backRed, + .green = pCursor->backGreen, + .blue = pCursor->backBlue, }; pCursor->devPriv[pScreen->myNum] = (void *) malloc(sizeof(nxagentPrivCursor)); @@ -275,15 +268,15 @@ void nxagentRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed) { XColor fg_color = { - .red = pCursor->foreRed, - .green = pCursor->foreGreen, - .blue = pCursor->foreBlue + .red = pCursor->foreRed, + .green = pCursor->foreGreen, + .blue = pCursor->foreBlue, }; XColor bg_color = { - .red = pCursor->backRed, - .green = pCursor->backGreen, - .blue = pCursor->backBlue + .red = pCursor->backRed, + .green = pCursor->backGreen, + .blue = pCursor->backBlue, }; XRecolorCursor(nxagentDisplay, @@ -404,7 +397,7 @@ Bool nxagentReconnectAllCursor(void *p0) fprintf(stderr, "nxagentReconnectAllCursor\n"); #endif - for (int i = 0, r = 1; i < MAXCLIENTS; r = 1, i++) + for (int i = 0; i < MAXCLIENTS; r = 1, i++) { if (clients[i]) { @@ -514,7 +507,7 @@ Bool nxagentDisconnectAllCursor(void) fprintf(stderr, "nxagentDisconnectAllCursor: Going to iterate through cursor resources.\n"); #endif - for (int i = 0, r = 1; i < MAXCLIENTS; r = 1, i++) + for (int i = 0; i < MAXCLIENTS; r = 1, i++) { if (clients[i]) { @@ -558,9 +551,9 @@ void nxagentListCursor(void *p0, void *p1, void *p2) void nxagentListCursors(void) { - Bool r; + Bool r = True; - for (int i = 0, r = 1; i < MAXCLIENTS; r = 1, i++) + for (int i = 0; i < MAXCLIENTS; r = 1, i++) { if (clients[i]) { -- cgit v1.2.3