From d7d205c0d83844cb23e75d09c2b683f15fff72a9 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 10 Aug 2019 23:42:45 +0200 Subject: nxagent: fix main window being garbled without inner windows Fixes ArcticaProject/nx-libs#733 --- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 0851daf97..f2b10fe45 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -255,8 +255,6 @@ InitRootWindow(WindowPtr pWin) else pWin->background.pixel = pScreen->whitePixel; backFlag |= CWBackPixel; - - MakeRootTile(pWin); #else if (!blackRoot && !whiteRoot) { MakeRootTile(pWin); -- cgit v1.2.3 From c610d706b44a48fbae633ead3e241ce57c31ccc6 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 10 Aug 2019 23:56:22 +0200 Subject: NXwindow.c: simplify window background code --- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index f2b10fe45..f67295c43 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -249,18 +249,14 @@ InitRootWindow(WindowPtr pWin) pWin->optional->cursor = rootCursor; rootCursor->refcnt++; -#ifdef NXAGENT_SPLASH - if (blackRoot) - pWin->background.pixel = pScreen->blackPixel; - else - pWin->background.pixel = pScreen->whitePixel; - backFlag |= CWBackPixel; -#else +#ifndef NXAGENT_SPLASH if (!blackRoot && !whiteRoot) { MakeRootTile(pWin); backFlag |= CWBackPixmap; } - else { + else +#else + { if (blackRoot) pWin->background.pixel = pScreen->blackPixel; else -- cgit v1.2.3 From a539aaa6aaa7a29023ef4c3d116fc2e1a11c82c1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 11 Aug 2019 00:21:44 +0200 Subject: dix: add whiteroot flag Before there was no way of getting a white background despite having the approriate code. Backport of this commit: commit cb0a565d2b2cf8823abbd77b4426cc2237731dc1 Author: Daniel Stone Date: Fri Aug 18 17:04:48 2006 +0300 dix: add whiteroot flag Add a -wr option to use a white root window, and use a BackPixel rather than BackPixmap for both white and black root windows. Fixes ArcticaProject/nx-libs#832 --- nx-X11/programs/Xserver/hw/nxagent/Init.c | 3 ++- nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 | 6 ++++-- nx-X11/programs/Xserver/os/utils.c | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index 1e24a618e..2a0bceaf5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -413,7 +413,8 @@ FIXME: These variables, if not removed at all because have probably * background. */ - blackRoot = TRUE; + if (!whiteRoot) + blackRoot = TRUE; nxagentInitKeystrokes(False); diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index 6804032a2..34ac7d7d0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 +++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 @@ -142,8 +142,10 @@ to authenticate access. See also the \fIxdm\fP(1) and disables backing store support on all screens. .TP 8 .B \-br -sets the default root window to solid black instead of the standard root weave -pattern. +sets the default root window to solid black (default). +.TP 8 +.B \-wr +sets the default root window to solid white. .TP 8 .B \-c turns off key-click. diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c index 5634bb621..4d81ff927 100644 --- a/nx-X11/programs/Xserver/os/utils.c +++ b/nx-X11/programs/Xserver/os/utils.c @@ -634,6 +634,7 @@ void UseMsg(void) ErrorF("v video blanking for screen-saver\n"); ErrorF("-v screen-saver without video blanking\n"); ErrorF("-wm WhenMapped default backing-store\n"); + ErrorF("-wr create root window with white background\n"); ErrorF("-maxbigreqsize set maximal bigrequest size \n"); #ifdef PANORAMIX ErrorF("+xinerama Enable XINERAMA (PanoramiX) extension\n"); @@ -996,6 +997,8 @@ ProcessCommandLine(int argc, char *argv[]) defaultScreenSaverBlanking = DontPreferBlanking; else if ( strcmp( argv[i], "-wm") == 0) defaultBackingStore = WhenMapped; + else if ( strcmp( argv[i], "-wr") == 0) + whiteRoot = TRUE; else if ( strcmp( argv[i], "-maxbigreqsize") == 0) { if(++i < argc) { long reqSizeArg = atol(argv[i]); -- cgit v1.2.3 From 470e0bd4d998e9c84e6f58736c7eb510c6223efd 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/NXwindow.c | 5 ++++- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 15 ++++++--------- nx-X11/programs/Xserver/hw/nxagent/Window.c | 17 ++++++++++------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index f67295c43..3cd8d0ce9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -138,11 +138,14 @@ extern void nxagentSetVersionProperty(WindowPtr pWin); void nxagentClearSplash(WindowPtr pW) { + if (!pW) + return; + ScreenPtr pScreen = pW->drawable.pScreen; if (pW->backgroundState == BackgroundPixmap) { - (*pScreen->DestroyPixmap)(pW->background.pixmap); + (*pScreen->DestroyPixmap)(pW->background.pixmap); } pW->backgroundState = BackgroundPixel; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index bc86fed36..e2e88674b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -85,6 +85,12 @@ int nxagentShowSplashWindow(Window parentWindow) XSetWindowAttributes attributes; GC gc; + /* + * Show splash window only when running as X2Go Agent + */ + if(!nxagentX2go) + return False; + #ifdef TEST fprintf(stderr, "nxagentShowSplashWindow: Got called.\n"); #endif @@ -175,15 +181,6 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) XPoint rect[4]; int w, h, c, w2, h2; - /* - * Show only X2GO Logo when running as X2Go Agent - */ - if(! nxagentX2go) - { - nxagentPixmapLogo = 0L; - return; - } - #ifdef DEBUG fprintf(stderr, "nxagentPaintLogo: Got called.\n"); #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 1095d0797..c666f9ad4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -669,15 +669,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 3c92d88973f18ff89b9d039ff51370650a2d0ef4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 11 Aug 2019 01:51:37 +0200 Subject: Splash.c: drop return code of nxagentShowSplashWindow nobody was checking it. --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 6 ++---- nx-X11/programs/Xserver/hw/nxagent/Splash.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index e2e88674b..387c859ae 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -78,7 +78,7 @@ extern Atom nxagentWMStart; extern Atom serverCutProperty; -int nxagentShowSplashWindow(Window parentWindow) +void nxagentShowSplashWindow(Window parentWindow) { XWindowAttributes getAttributes; XWindowChanges values; @@ -89,7 +89,7 @@ int nxagentShowSplashWindow(Window parentWindow) * Show splash window only when running as X2Go Agent */ if(!nxagentX2go) - return False; + return; #ifdef TEST fprintf(stderr, "nxagentShowSplashWindow: Got called.\n"); @@ -172,8 +172,6 @@ int nxagentShowSplashWindow(Window parentWindow) GetTimeInMillis() - startTime); } #endif - - return True; } void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.h b/nx-X11/programs/Xserver/hw/nxagent/Splash.h index 444f1eed0..2057390fc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.h @@ -47,7 +47,7 @@ extern Window nxagentSplashWindow; extern int nxagentWMPassed; -extern int nxagentShowSplashWindow(Window); +extern void nxagentShowSplashWindow(Window); extern void nxagentRemoveSplashWindow(WindowPtr pWin); -- cgit v1.2.3 From 612cbcc4348f2400c1c0b52e33cb9fe2c760d3fc Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 11 Aug 2019 01:59:42 +0200 Subject: Splash.c: code cleanup --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 44 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 387c859ae..e983048eb 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -64,7 +64,7 @@ int nxagentLogoRed; int nxagentLogoBlack; int nxagentLogoGray; -void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height); +static void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height); /* * From Screen.c. @@ -92,14 +92,14 @@ void nxagentShowSplashWindow(Window parentWindow) return; #ifdef TEST - fprintf(stderr, "nxagentShowSplashWindow: Got called.\n"); + fprintf(stderr, "%s: Got called.\n", __func__); #endif #ifdef NXAGENT_TIMESTAMP { extern unsigned long startTime; - fprintf(stderr, "nxagentShowSplashWindow: Initializing splash start at [%d] milliseconds.\n", + fprintf(stderr, "%s: Initializing splash start at [%d] milliseconds.\n", __func__, GetTimeInMillis() - startTime); } #endif @@ -139,7 +139,7 @@ void nxagentShowSplashWindow(Window parentWindow) getAttributes.height = nxagentOption(RootHeight); #ifdef TEST - fprintf(stderr, "nxagentShowSplashWindow: Going to create new splash window.\n"); + fprintf(stderr, "%s: Going to create new splash window.\n", __func__); #endif nxagentSplashWindow = @@ -152,7 +152,7 @@ void nxagentShowSplashWindow(Window parentWindow) BlackPixel (nxagentDisplay, 0)); #ifdef TEST - fprintf(stderr, "nxagentShowSplashWindow: Created new splash window with id [%ld].\n", + fprintf(stderr, "%s: Created new splash window with id [%ld].\n", __func__, nxagentSplashWindow); #endif @@ -168,7 +168,7 @@ void nxagentShowSplashWindow(Window parentWindow) #ifdef NXAGENT_TIMESTAMP { extern unsigned long startTime; - fprintf(stderr, "nxagentShowSplashWindow: Splash ends [%d] milliseconds.\n", + fprintf(stderr, "%s: Splash ends [%d] milliseconds.\n", __func__, GetTimeInMillis() - startTime); } #endif @@ -176,26 +176,25 @@ void nxagentShowSplashWindow(Window parentWindow) void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) { - XPoint rect[4]; - int w, h, c, w2, h2; - #ifdef DEBUG - fprintf(stderr, "nxagentPaintLogo: Got called.\n"); + fprintf(stderr, "%s: Got called.\n", __func__); #endif #ifdef NXAGENT_LOGO_DEBUG - fprintf(stderr, "nxagentPaintLogo: begin\n"); - fprintf(stderr, "nxagentPaintLogo: gen params are: w=%d h=%d d=%d r=%x w=%x b=%x\n",width, height, + fprintf(stderr, "%s: begin\n", __func__); + fprintf(stderr, "%s: gen params are: w=%d h=%d d=%d r=%x w=%x b=%x\n", __func__, + width, height, nxagentLogoDepth, nxagentLogoRed, nxagentLogoWhite, nxagentLogoBlack); #endif - w = width/scale; - h = height/scale; + int w = width/scale; + int h = height/scale; - w2 = w/2; - h2 = h/2; + int w2 = w/2; + int h2 = h/2; + int c; if (height > width) { c = w/30; @@ -205,6 +204,7 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) c = w/48; } + XPoint rect[4]; rect[0].x = 0; rect[0].y = 0; rect[1].x = 0; rect[1].y = h; rect[2].x = w; rect[2].y = h; @@ -225,7 +225,7 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); #ifdef NXAGENT_LOGO_DEBUG - fprintf(stderr, "filled first poly\n"); + fprintf(stderr, "%s: filled first poly\n", __func__); #endif XSetForeground(nxagentDisplay, gc, nxagentLogoRed); @@ -374,16 +374,17 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); #ifdef NXAGENT_LOGO_DEBUG - fprintf(stderr, "nxagentPaintLogo: end\n"); + fprintf(stderr, "%s: end\n", __func__); #endif } void nxagentRemoveSplashWindow(WindowPtr pWin) { - if (nxagentReconnectTrap) return; + if (nxagentReconnectTrap) + return; #ifdef TEST - fprintf(stderr, "nxagentRemoveSplashWindow: Destroying the splash window.\n"); + fprintf(stderr, "%s: Destroying the splash window.\n", __func__); #endif if (!nxagentWMPassed) @@ -402,7 +403,7 @@ void nxagentRemoveSplashWindow(WindowPtr pWin) nxagentRefreshWindows(screenInfo.screens[0]->root); #ifdef TEST - fprintf(stderr, "nxagentRemoveSplashWindow: setting the ownership of %s (%d) on window 0x%lx\n", + fprintf(stderr, "%s: setting the ownership of %s (%d) on window 0x%lx\n", __func__ "NX_CUT_BUFFER_SERVER", (int)serverCutProperty, nxagentWindow(screenInfo.screens[0]->root)); #endif @@ -413,7 +414,6 @@ void nxagentRemoveSplashWindow(WindowPtr pWin) if (nxagentPixmapLogo) { XFreePixmap(nxagentDisplay, nxagentPixmapLogo); - nxagentPixmapLogo = (Pixmap) 0; } } -- cgit v1.2.3 From be508a447be199b24a3bb856adb64a6fbd016e9e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 15 Aug 2019 22:04:07 +0200 Subject: Splash.c: nxagentRemoveSplashWindow: drop unused parameter --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 4 ++-- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Splash.h | 3 +-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 339994e6c..7020a679e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -380,7 +380,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio if (!nxagentWMPassed && (nxagentWMtimeout < currentDispatch)) { - nxagentRemoveSplashWindow(NULL); + nxagentRemoveSplashWindow(); } nxagentClients = nClients; @@ -590,7 +590,7 @@ ProcReparentWindow(register ClientPtr client) if (!nxagentWMPassed) { - nxagentRemoveSplashWindow(pWin); + nxagentRemoveSplashWindow(); } pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index b78c01e30..c56d74236 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -681,7 +681,7 @@ Bool nxagentReconnectSession(void) #endif saveAgentState("RUNNING"); - nxagentRemoveSplashWindow(NULL); + nxagentRemoveSplashWindow(); /* * We let the proxy flush the link on our behalf diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 5cdb50f90..2355e5b61 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -3122,7 +3122,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr { if (!nxagentWMPassed) { - nxagentRemoveSplashWindow(NULL); + nxagentRemoveSplashWindow(); } NXShadowExportChanges(&numRects, &ptBox); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index e983048eb..74322648a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -378,7 +378,7 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) #endif } -void nxagentRemoveSplashWindow(WindowPtr pWin) +void nxagentRemoveSplashWindow(void) { if (nxagentReconnectTrap) return; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.h b/nx-X11/programs/Xserver/hw/nxagent/Splash.h index 2057390fc..52adbc340 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.h @@ -48,7 +48,6 @@ extern Window nxagentSplashWindow; extern int nxagentWMPassed; extern void nxagentShowSplashWindow(Window); - -extern void nxagentRemoveSplashWindow(WindowPtr pWin); +extern void nxagentRemoveSplashWindow(); #endif /* __Splash_H__ */ -- cgit v1.2.3 From 8fcaafab426686f1e67d4535b391534d210f482c 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/dix/window.c | 2 - nx-X11/programs/Xserver/hw/nxagent/Events.c | 15 ----- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 86 ++------------------------- nx-X11/programs/Xserver/hw/nxagent/Window.c | 51 ---------------- 4 files changed, 4 insertions(+), 150 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index 79045767f..ee146d783 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -305,7 +305,6 @@ SetWindowToDefaults(register WindowPtr pWin) #endif } -#ifndef NXAGENT_SERVER static void MakeRootTile(WindowPtr pWin) { @@ -348,7 +347,6 @@ MakeRootTile(WindowPtr pWin) FreeScratchGC(pGC); } -#endif /* NXAGENT_SERVER */ WindowPtr AllocateWindow(ScreenPtr pScreen) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 3e62d9097..fda84cf9b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -124,7 +124,6 @@ extern Bool nxagentOnce; extern WindowPtr nxagentRootTileWindow; -extern int nxagentSplashCount; extern int nxagentLastClipboardClient; @@ -2453,20 +2452,6 @@ FIXME: This can be maybe optimized by consuming the } } - if (nxagentRootTileWindow != NULL) - { - if (nxagentWindowPriv(nxagentRootTileWindow) -> window == nxagentWindowPriv(pWin) -> window && - nxagentSplashCount == 1 && X -> xexpose.count == 0) - { - #ifdef DEBUG - fprintf(stderr, "nxagentHandleExposeEvent: Clearing root tile window id [%u].\n", - nxagentWindowPriv(nxagentRootTileWindow) -> window); - #endif - - XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow) -> window); - } - } - RegionUninit(&sum); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 3cd8d0ce9..3dcb552e5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -114,10 +114,6 @@ Equipment Corporation. #include "Drawable.h" #include "Colormap.h" -/* prototypes (only MakeRootTile() required here) */ - -static void MakeRootTile(WindowPtr pWin); - #include "../../dix/window.c" extern Bool nxagentWMIsRunning; @@ -132,72 +128,8 @@ extern Bool nxagentScreenTrap; #undef TEST #undef DEBUG -WindowPtr nxagentRootTileWindow; - extern void nxagentSetVersionProperty(WindowPtr pWin); -void nxagentClearSplash(WindowPtr pW) -{ - if (!pW) - return; - - ScreenPtr pScreen = pW->drawable.pScreen; - - if (pW->backgroundState == BackgroundPixmap) - { - (*pScreen->DestroyPixmap)(pW->background.pixmap); - } - - pW->backgroundState = BackgroundPixel; - pW->background.pixel = nxagentLogoBlack; - - (*pScreen->ChangeWindowAttributes)(pW, CWBackPixmap|CWBackPixel); -} - -static void -MakeRootTile(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - GCPtr pGC; - unsigned char back[128]; - int len = BitmapBytePad(sizeof(long)); - register unsigned char *from, *to; - register int i, j; - - pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4, - pScreen->rootDepth, 0); - - pWin->backgroundState = BackgroundPixmap; - pGC = GetScratchGC(pScreen->rootDepth, pScreen); - if (!pWin->background.pixmap || !pGC) - FatalError("could not create root tile"); - - { - CARD32 attributes[2]; - - attributes[0] = pScreen->whitePixel; - attributes[1] = pScreen->blackPixel; - - (void)ChangeGC(pGC, GCForeground | GCBackground, attributes); - } - - ValidateGC((DrawablePtr)pWin->background.pixmap, pGC); - - from = (screenInfo.bitmapBitOrder == LSBFirst) ? _back_lsb : _back_msb; - to = back; - - for (i = 4; i > 0; i--, from++) - for (j = len; j > 0; j--) - *to++ = *from; - - (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, pGC, 1, - 0, 0, len, 4, 0, XYBitmap, (char *)back); - - FreeScratchGC(pGC); - - nxagentRootTileWindow = pWin; -} - void InitRootWindow(WindowPtr pWin) { @@ -252,21 +184,11 @@ InitRootWindow(WindowPtr pWin) pWin->optional->cursor = rootCursor; rootCursor->refcnt++; -#ifndef NXAGENT_SPLASH - if (!blackRoot && !whiteRoot) { - MakeRootTile(pWin); - backFlag |= CWBackPixmap; - } + if (blackRoot) + pWin->background.pixel = pScreen->blackPixel; else -#else - { - if (blackRoot) - pWin->background.pixel = pScreen->blackPixel; - else - pWin->background.pixel = pScreen->whitePixel; - backFlag |= CWBackPixel; - } -#endif + pWin->background.pixel = pScreen->whitePixel; + backFlag |= CWBackPixel; pWin->backingStore = defaultBackingStore; pWin->forcedBS = (defaultBackingStore != NotUseful); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index c666f9ad4..6b186ab27 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -118,12 +118,6 @@ extern WindowPtr nxagentRootTileWindow; extern Bool nxagentReportPrivateWindowIds; -/* - * Also referenced in Events.c. - */ - -int nxagentSplashCount = 0; - #define RECTLIMIT 25 #define BSPIXMAPLIMIT 128 @@ -155,12 +149,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. */ @@ -268,16 +256,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; @@ -487,14 +465,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); @@ -662,27 +632,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 afebb8211b6f6d47e8a17d21f64ec3ffc8ea82e3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 15 Aug 2019 22:10:45 +0200 Subject: Splash.c: remove global variables for colors Make them defines. Also determine the screen depth dynamically. --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 16 ---------------- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 16 ++++++++-------- nx-X11/programs/Xserver/hw/nxagent/Splash.h | 6 ------ 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 127874962..4bce82783 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -1386,15 +1386,6 @@ FIXME: Use of nxagentParentWindow is strongly deprecated. nxagentChangeOption(BorderWidth, 1); } - nxagentLogoDepth = DefaultDepth(nxagentDisplay, - DefaultScreen(nxagentDisplay) - ); - - nxagentLogoBlack = 0x000000; - nxagentLogoRed = 0xff0000; - nxagentLogoWhite = 0xffffff; - nxagentLogoGray = 0x222222; - #ifdef WATCH fprintf(stderr, "nxagentOpenDisplay: Watchpoint 5.1.\n"); @@ -2860,13 +2851,6 @@ Bool nxagentReconnectDisplay(void *p0) nxagentConfineWindow); #endif - nxagentLogoDepth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); - - nxagentLogoBlack = 0x000000; - nxagentLogoRed = 0xff0000; - nxagentLogoWhite = 0xffffff; - nxagentLogoGray = 0x222222; - useXpmIcon = nxagentMakeIcon(nxagentDisplay, &nxagentIconPixmap, &nxagentIconShape); /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 74322648a..91f599cc6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -58,11 +58,10 @@ * Colors used to paint the splash screen. */ -int nxagentLogoDepth; -int nxagentLogoWhite; -int nxagentLogoRed; -int nxagentLogoBlack; -int nxagentLogoGray; +#define nxagentLogoWhite 0xffffff +#define nxagentLogoRed 0xff0000 +#define nxagentLogoBlack 0x000000 +#define nxagentLogoGray 0x222222 static void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height); @@ -176,6 +175,8 @@ void nxagentShowSplashWindow(Window parentWindow) void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) { + int depth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); + #ifdef DEBUG fprintf(stderr, "%s: Got called.\n", __func__); #endif @@ -183,9 +184,8 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) #ifdef NXAGENT_LOGO_DEBUG fprintf(stderr, "%s: begin\n", __func__); fprintf(stderr, "%s: gen params are: w=%d h=%d d=%d r=%x w=%x b=%x\n", __func__, - width, height, - nxagentLogoDepth, nxagentLogoRed, - nxagentLogoWhite, nxagentLogoBlack); + width, height, depth, + nxagentLogoRed, nxagentLogoWhite, nxagentLogoBlack); #endif int w = width/scale; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.h b/nx-X11/programs/Xserver/hw/nxagent/Splash.h index 52adbc340..5f7547e57 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.h @@ -37,12 +37,6 @@ extern int XdmcpTimeOutRtx; extern int XdmcpStartTime; extern int nxagentXdmcpUp; -extern int nxagentLogoDepth; -extern int nxagentLogoWhite; -extern int nxagentLogoRed; -extern int nxagentLogoBlack; -extern int nxagentLogoGray; - extern Window nxagentSplashWindow; extern int nxagentWMPassed; -- cgit v1.2.3 From 074821a84041de09abb8b2aac5ec6559bb546d0c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 15 Aug 2019 22:33:35 +0200 Subject: Splash.c: make Splash logo work with white background (-wr) mode, too --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 53 +++++++++++++++++------------ 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 91f599cc6..2945717c4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -58,10 +58,10 @@ * Colors used to paint the splash screen. */ -#define nxagentLogoWhite 0xffffff -#define nxagentLogoRed 0xff0000 -#define nxagentLogoBlack 0x000000 -#define nxagentLogoGray 0x222222 +#define nxagentLogoWhite 0xffffff +#define nxagentLogoBlack 0x000000 +#define nxagentLogoDarkGray 0x222222 +#define nxagentLogoLightGray 0xbbbbbb static void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height); @@ -183,9 +183,9 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) #ifdef NXAGENT_LOGO_DEBUG fprintf(stderr, "%s: begin\n", __func__); - fprintf(stderr, "%s: gen params are: w=%d h=%d d=%d r=%x w=%x b=%x\n", __func__, + fprintf(stderr, "%s: gen params are: w=%d h=%d d=%d w=%x b=%x g1=%x g2=%x \n", __func__, width, height, depth, - nxagentLogoRed, nxagentLogoWhite, nxagentLogoBlack); + nxagentLogoWhite, nxagentLogoBlack, nxagentLogoDarkGray, nxagentLogoLightGray); #endif int w = width/scale; @@ -204,43 +204,52 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) c = w/48; } - XPoint rect[4]; - rect[0].x = 0; rect[0].y = 0; - rect[1].x = 0; rect[1].y = h; - rect[2].x = w; rect[2].y = h; - rect[3].x = w; rect[3].y = 0; - XSetFunction(nxagentDisplay, gc, GXcopy); XSetFillStyle(nxagentDisplay, gc, FillSolid); - XSetForeground(nxagentDisplay, gc, nxagentLogoBlack); - XSetBackground(nxagentDisplay, gc, nxagentLogoRed); - - nxagentPixmapLogo = XCreatePixmap(nxagentDisplay, win, width, height, nxagentLogoDepth); + nxagentPixmapLogo = XCreatePixmap(nxagentDisplay, win, width, height, depth); if (!nxagentPixmapLogo) { return; } + if (blackRoot) + { + XSetForeground(nxagentDisplay, gc, nxagentLogoBlack); + XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); + } + else + { + XSetForeground(nxagentDisplay, gc, nxagentLogoWhite); + XSetBackground(nxagentDisplay, gc, nxagentLogoBlack); + } + + XPoint rect[4]; + rect[0].x = 0; rect[0].y = 0; + rect[1].x = 0; rect[1].y = h; + rect[2].x = w; rect[2].y = h; + rect[3].x = w; rect[3].y = 0; + + /* paint background */ XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); #ifdef NXAGENT_LOGO_DEBUG fprintf(stderr, "%s: filled first poly\n", __func__); #endif - XSetForeground(nxagentDisplay, gc, nxagentLogoRed); - XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); - /* * Draw X2GO Logo */ + if (blackRoot) + XSetForeground(nxagentDisplay, gc, nxagentLogoDarkGray); + else + XSetForeground(nxagentDisplay, gc, nxagentLogoLightGray); + /* - * Begin 'X'. + * Start 'X'. */ - XSetForeground(nxagentDisplay, gc, nxagentLogoGray); - XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); rect[0].x = w2-7*c; rect[0].y = h2-5*c; rect[1].x = w2-8*c; rect[1].y = h2-5*c; rect[2].x = w2-4*c; rect[2].y = h2+3*c; -- cgit v1.2.3 From 798a053b4aa567892466306c1be3d6697a2acfe4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 16 Aug 2019 12:38:53 +0200 Subject: Splash.c: move some variables to Splash.c They belong there... --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 -- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 2355e5b61..e27d37056 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -147,8 +147,6 @@ Window nxagentScreenSaverWindows[MAXSCREENS]; #ifdef NXAGENT_ONSTART Atom nxagentWMStart; -Window nxagentSplashWindow = None; -Pixmap nxagentPixmapLogo; #endif ScreenPtr nxagentDefaultScreen = NULL; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 2945717c4..28c5599af 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -63,6 +63,9 @@ #define nxagentLogoDarkGray 0x222222 #define nxagentLogoLightGray 0xbbbbbb +Pixmap nxagentPixmapLogo; +Window nxagentSplashWindow = None; + static void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height); /* -- cgit v1.2.3 From 24f392c4a7f7f1a838f67eb7ea8fd947fe233f30 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 16 Aug 2019 12:46:21 +0200 Subject: nxagent: rename nxagentWMStart to nxagentReadyAtom This better reflects its purpose: Tell listeners we are ready. --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 4 ++-- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index e27d37056..b089ef303 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -146,7 +146,7 @@ Window nxagentInputWindows[MAXSCREENS]; Window nxagentScreenSaverWindows[MAXSCREENS]; #ifdef NXAGENT_ONSTART -Atom nxagentWMStart; +Atom nxagentReadyAtom; #endif ScreenPtr nxagentDefaultScreen = NULL; @@ -932,7 +932,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, nxagentQueryAtoms(pScreen); #ifdef NXAGENT_ONSTART - nxagentWMStart = nxagentAtoms[3]; /* WM_NX_READY */ + nxagentReadyAtom = nxagentAtoms[3]; /* WM_NX_READY */ #endif /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 28c5599af..c3f6f101e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -72,7 +72,7 @@ static void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height * From Screen.c. */ -extern Atom nxagentWMStart; +extern Atom nxagentReadyAtom; /* * From Clipboard.c. @@ -106,7 +106,7 @@ void nxagentShowSplashWindow(Window parentWindow) } #endif - XSetSelectionOwner(nxagentDisplay, nxagentWMStart, None, CurrentTime); + XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom, None, CurrentTime); nxagentWMPassed = False; @@ -401,7 +401,7 @@ void nxagentRemoveSplashWindow(void) if (!nxagentWMPassed) { - XSetSelectionOwner(nxagentDisplay, nxagentWMStart, + XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom, nxagentDefaultWindows[0], CurrentTime); nxagentWMPassed = True; -- cgit v1.2.3 From 2228513a66870198af2e0c792660c8f6f27e6edf 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/Imakefile | 1 - nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index 5a3a999f4..b3450440e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -240,7 +240,6 @@ DEFINES = \ -DNXAGENT_VISIBILITY \ -DNXAGENT_WAKEUP=1000 \ -DNXAGENT_ONSTART \ - -DNXAGENT_SPLASH \ -DNXAGENT_ARTSD \ -DNXAGENT_RANDR_MODE_PREFIX \ -UNX_DEBUG_INPUT \ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 6b186ab27..192feec40 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -1438,7 +1438,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 @@ -1464,7 +1463,6 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) * } * } */ - #endif /* NXAGENT_SPLASH */ if (mask & CW_RootlessRestack) { -- cgit v1.2.3 From b04b58badd9007cc92cb9fc68ecb85c3e3388e25 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 16 Aug 2019 12:55:28 +0200 Subject: nxagent: add NXAGENT_ONSTART where missing There were some locations referenceing a variable that was only availabe with NXAGENT_ONSTART set --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 2 ++ nx-X11/programs/Xserver/hw/nxagent/Splash.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 7020a679e..c49cae51e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -141,7 +141,9 @@ void nxagentWaitDisplay(void); void nxagentListRemoteFonts(const char *, int); +#ifdef NXAGENT_ONSTART unsigned int nxagentWMtimeout = 0; +#endif Bool nxagentWMPassed = False; /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index c3f6f101e..6fa092a7d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -72,7 +72,9 @@ static void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height * From Screen.c. */ +#ifdef NXAGENT_ONSTART extern Atom nxagentReadyAtom; +#endif /* * From Clipboard.c. @@ -106,7 +108,9 @@ void nxagentShowSplashWindow(Window parentWindow) } #endif + #ifdef NXAGENT_ONSTART XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom, None, CurrentTime); + #endif nxagentWMPassed = False; @@ -401,8 +405,10 @@ void nxagentRemoveSplashWindow(void) if (!nxagentWMPassed) { + #ifdef NXAGENT_ONSTART XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom, nxagentDefaultWindows[0], CurrentTime); + #endif nxagentWMPassed = True; } -- cgit v1.2.3 From ab80152370da820cb42f22a500c1342bbb3ca3c8 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 16 Aug 2019 13:02:01 +0200 Subject: nxagent: move nxagentWMPassed to Splash.c It is only relevant there. --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 10 +++------- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 5 +---- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 4 ++++ nx-X11/programs/Xserver/hw/nxagent/Splash.h | 2 -- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index c49cae51e..0ad26b0bb 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -144,7 +144,6 @@ void nxagentListRemoteFonts(const char *, int); #ifdef NXAGENT_ONSTART unsigned int nxagentWMtimeout = 0; #endif -Bool nxagentWMPassed = False; /* * Timeouts based on screen saver time. @@ -380,9 +379,9 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio * that the agent is ready. */ - if (!nxagentWMPassed && (nxagentWMtimeout < currentDispatch)) + if (nxagentWMtimeout < currentDispatch) { - nxagentRemoveSplashWindow(); + nxagentRemoveSplashWindow(); } nxagentClients = nClients; @@ -590,10 +589,7 @@ ProcReparentWindow(register ClientPtr client) if (!pWin) return(BadWindow); - if (!nxagentWMPassed) - { - nxagentRemoveSplashWindow(); - } + nxagentRemoveSplashWindow(); pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, DixWriteAccess); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index b089ef303..93110f782 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -3118,10 +3118,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr if (result == 1) { - if (!nxagentWMPassed) - { - nxagentRemoveSplashWindow(); - } + nxagentRemoveSplashWindow(); NXShadowExportChanges(&numRects, &ptBox); pBox = (BoxRec *)ptBox; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 6fa092a7d..8f3bc1ede 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -65,6 +65,7 @@ Pixmap nxagentPixmapLogo; Window nxagentSplashWindow = None; +Bool nxagentWMPassed = False; static void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height); @@ -396,6 +397,9 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) void nxagentRemoveSplashWindow(void) { + if (nxagentWMPassed) + return; + if (nxagentReconnectTrap) return; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.h b/nx-X11/programs/Xserver/hw/nxagent/Splash.h index 5f7547e57..a43801469 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.h @@ -39,8 +39,6 @@ extern int nxagentXdmcpUp; extern Window nxagentSplashWindow; -extern int nxagentWMPassed; - extern void nxagentShowSplashWindow(Window); extern void nxagentRemoveSplashWindow(); -- cgit v1.2.3 From c34d1b2011236c7b69dac09b78cdfb972e20ef6a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 16 Aug 2019 13:08:42 +0200 Subject: NXdispatch.c: drop currentDispatch variable was only used once --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 0ad26b0bb..da7a55b69 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -244,8 +244,6 @@ Dispatch(void) register HWEventQueuePtr* icheck = checkForInput; long start_tick; - unsigned long currentDispatch = 0; - nextFreeClientID = 1; InitSelections(); nClients = 0; @@ -371,18 +369,15 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio #ifdef NXAGENT_ONSTART - currentDispatch = GetTimeInMillis(); - - /* - * If the timeout is expired set the - * selection informing the NX client - * that the agent is ready. - */ + /* + * If the timeout is expired set the selection informing the + * NX client that the agent is ready. + */ - if (nxagentWMtimeout < currentDispatch) - { - nxagentRemoveSplashWindow(); - } + if (nxagentWMtimeout < GetTimeInMillis()) + { + nxagentRemoveSplashWindow(); + } nxagentClients = nClients; -- cgit v1.2.3 From 3563959c011c00dcbd9dace4d882b222aa31b27f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 16 Aug 2019 13:11:38 +0200 Subject: NXdispatch.c: move nxagentWMtimeout into the function it is only used there, no need for a global variable --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index da7a55b69..10616834e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -141,10 +141,6 @@ void nxagentWaitDisplay(void); void nxagentListRemoteFonts(const char *, int); -#ifdef NXAGENT_ONSTART -unsigned int nxagentWMtimeout = 0; -#endif - /* * Timeouts based on screen saver time. */ @@ -264,12 +260,11 @@ Dispatch(void) #ifdef NXAGENT_ONSTART /* - * Set NX_WM property (used by NX client to identify - * the agent's window) three seconds since the first - * client connects. + * Set NX_WM property (used by NX client to identify the agent's + * window) three seconds since the first client connects. */ - nxagentWMtimeout = GetTimeInMillis() + 3000; + unsigned int nxagentWMtimeout = GetTimeInMillis() + 3000; #endif -- cgit v1.2.3