From d0a6c98cb2465203e852f466127442cd79dc2662 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 22 Jul 2019 21:32:58 +0200 Subject: Window.c: use SAFE_free and SAFE_XFree --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 40 ++++++++++++----------------- 1 file changed, 16 insertions(+), 24 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Window.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 7d390872e..357c6efbd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -63,6 +63,7 @@ #include "Init.h" #include "Composite.h" #include "Events.h" +#include "Utils.h" #include #include "compext/Compext.h" @@ -1482,10 +1483,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) fprintf(stderr, "nxagentConfigureWindow: Failed QueryTree request.\n "); } - if (children_return) - { - XFree(children_return); - } + SAFE_XFree(children_return); } #endif } @@ -3183,7 +3181,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer &hints); #ifdef _XSERVER64 - free(data64); + SAFE_free(data64); #endif } } @@ -3430,7 +3428,7 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) XDestroyImage(image); } - free(data); + SAFE_free(data); } else { @@ -3519,14 +3517,14 @@ void nxagentFlushConfigureWindow(void) if (index == nxagentConfiguredWindowList) { - free(index); + SAFE_free(index); break; } else { ConfiguredWindowStruct *tmp = index; index = index -> prev; - free(tmp); + SAFE_free(tmp); } } @@ -3676,16 +3674,14 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) { if (index -> prev == NULL && index -> next == NULL) { - free(nxagentConfiguredWindowList); - nxagentConfiguredWindowList = NULL; - + SAFE_free(nxagentConfiguredWindowList); return; } else if (index -> prev == NULL) { tmp = nxagentConfiguredWindowList; index = nxagentConfiguredWindowList = tmp -> next; - free(tmp); + SAFE_free(tmp); nxagentConfiguredWindowList -> prev = NULL; continue; @@ -3694,7 +3690,7 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) { tmp = index; index = index -> prev; - free(tmp); + SAFE_free(tmp); index -> next = NULL; return; @@ -3705,7 +3701,7 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) index = index -> next; previous -> next = index; index -> prev = previous; - free(tmp); + SAFE_free(tmp); continue; } @@ -3747,16 +3743,14 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) { if (index -> prev == NULL && index -> next == NULL) { - free(nxagentStaticResizedWindowList); - nxagentStaticResizedWindowList = NULL; - + SAFE_free(nxagentStaticResizedWindowList); return; } else if (index -> prev == NULL) { tmp = nxagentStaticResizedWindowList; index = nxagentStaticResizedWindowList = tmp -> next; - free(tmp); + SAFE_free(tmp); nxagentStaticResizedWindowList -> prev = NULL; continue; @@ -3765,7 +3759,7 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) { tmp = index; index = index -> prev; - free(tmp); + SAFE_free(tmp); index -> next = NULL; return; @@ -3776,7 +3770,7 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) index = index -> next; previous -> next = index; index -> prev = previous; - free(tmp); + SAFE_free(tmp); continue; } @@ -3909,8 +3903,7 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) if ((nxagentBSPixmapList[i] != NULL) && (nxagentBSPixmapList[i] -> storingPixmapId == pixmapId)) { - free(nxagentBSPixmapList[i]); - nxagentBSPixmapList[i] = NULL; + SAFE_free(nxagentBSPixmapList[i]); if (i < BSPIXMAPLIMIT - 1) { @@ -3948,8 +3941,7 @@ int nxagentEmptyBSPixmapList(void) { for (int i = 0; i < BSPIXMAPLIMIT; i++) { - free(nxagentBSPixmapList[i]); - nxagentBSPixmapList[i] = NULL; + SAFE_free(nxagentBSPixmapList[i]); } return 1; -- cgit v1.2.3 From 17495dd6aedd27fb8a083fc841a7f297e6a8da8f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 5 May 2018 18:56:35 +0200 Subject: nxagent: simplify nxagentWaitEvents() no more need to pass down a struct, we now only pass the milliseconds and let the function do the rest. --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Window.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 357c6efbd..fc59973bd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -850,7 +850,6 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) * Change to fullscreen mode. */ - struct timeval timeout; int i; XEvent e; @@ -875,10 +874,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) XSync(nxagentDisplay, 0); - timeout.tv_sec = 0; - timeout.tv_usec = 50 * 1000; - - nxagentWaitEvents(nxagentDisplay, &timeout); + nxagentWaitEvents(nxagentDisplay, 50); } if (i < 100) -- cgit v1.2.3 From 9cd602b271cc846d654f7f5d9a455368e9ca2612 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 11 Aug 2019 01:47:16 +0200 Subject: Splash.c: do not wait in nxagent mode The splash window is only shown in x2go mode. In nxagent mode the splash window was also shown, but empty (and thus invisible). And the code waited for the splash window to disappear. Fix this by skipping _all_ the splash stuff in nxagent mode. --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Window.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index fc59973bd..86ae1d607 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -670,15 +670,18 @@ Bool nxagentDestroyWindow(WindowPtr pWin) nxagentSplashCount); #endif - if (nxagentSplashCount == 1) + if (nxagentRootTileWindow) { - XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow) -> window); - } + if (nxagentSplashCount == 1) + { + XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow) -> window); + } - if (pWin == nxagentRootTileWindow) - { - nxagentWindowPriv(nxagentRootTileWindow)->window = None; - nxagentRootTileWindow = None; + if (pWin == nxagentRootTileWindow) + { + nxagentWindowPriv(nxagentRootTileWindow)->window = None; + nxagentRootTileWindow = None; + } } pWindowPriv->window = None; -- cgit v1.2.3 From e12983a677c84794f5ff34e5b14c3feb78878a9c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 15 Aug 2019 22:06:14 +0200 Subject: nxagent: drop nxagentRootTileWindow We either use a solid black or a white background and no backround pixmap. So nxagentRootTileWindow is always empty and we can drop all stuff around it. remove nxagentSplashCount, too, since it is no longer checked anywhere. --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 51 ----------------------------- 1 file changed, 51 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Window.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 86ae1d607..fe6efb52c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -119,12 +119,6 @@ extern WindowPtr nxagentRootTileWindow; extern Bool nxagentReportPrivateWindowIds; -/* - * Also referenced in Events.c. - */ - -int nxagentSplashCount = 0; - #define RECTLIMIT 25 #define BSPIXMAPLIMIT 128 @@ -156,12 +150,6 @@ Bool nxagentIsIconic(WindowPtr); int GetWindowProperty(WindowPtr, Atom, long, long, Bool, Atom, Atom*, int*, unsigned long*, unsigned long*, unsigned char**); -/* - * From NXwindow.c. - */ - -void nxagentClearSplash(WindowPtr pWin); - /* * Other local functions. */ @@ -269,16 +257,6 @@ Bool nxagentCreateWindow(WindowPtr pWin) return True; } - nxagentSplashCount++; - - if (nxagentSplashCount == 2) - { - nxagentClearSplash(nxagentRootTileWindow); - } - #ifdef NXAGENT_LOGO_DEBUG - fprintf(stderr, "nxagentCreateWindow: nxagentSplashCount [%d]\n", nxagentSplashCount); - #endif - if (pWin->drawable.class == InputOnly) { mask = CWEventMask; @@ -488,14 +466,6 @@ Bool nxagentCreateWindow(WindowPtr pWin) nxagentWindowPriv(pWin)->siblingAbove = None; nxagentWindowPriv(pWin)->pPicture = NULL; - if (nxagentRootTileWindow) - { - if (nxagentWindowPriv(pWin)->window != nxagentWindowPriv(nxagentRootTileWindow)->window) - { - XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow)->window); - } - } - if (pWin->nextSib) { nxagentWindowPriv(pWin->nextSib)->siblingAbove = nxagentWindow(pWin); @@ -663,27 +633,6 @@ Bool nxagentDestroyWindow(WindowPtr pWin) nxagentRootlessDelTopLevelWindow(pWin); } - nxagentSplashCount--; - - #ifdef DEBUG - fprintf(stderr, "nxagentDestroyWindow: The splash counter is now [%d].\n", - nxagentSplashCount); - #endif - - if (nxagentRootTileWindow) - { - if (nxagentSplashCount == 1) - { - XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow) -> window); - } - - if (pWin == nxagentRootTileWindow) - { - nxagentWindowPriv(nxagentRootTileWindow)->window = None; - nxagentRootTileWindow = None; - } - } - pWindowPriv->window = None; if (pWin -> optional) -- cgit v1.2.3 From 0f5e873dc312a6f2c88989d5379d3c4f442ef34d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 16 Aug 2019 12:54:10 +0200 Subject: nxagent: drop NXAGENT_SPLASH There was only one (commented) section using it. --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Window.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index fe6efb52c..59b33b6be 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -1436,7 +1436,6 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) #endif } - #ifdef NXAGENT_SPLASH /* * This should bring again the splash window * on top, so why the else clause? Is this @@ -1462,7 +1461,6 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) * } * } */ - #endif /* NXAGENT_SPLASH */ if (mask & CW_RootlessRestack) { -- cgit v1.2.3