From 8bb7d2cd1aa8a0108c5ef66758bc337de239aa11 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 30 Dec 2020 22:19:50 +0100 Subject: nxagent: make Desktop, Rootless and Binder options Booleans (again) They have been changed to tri-state variables (1, 0 and UNDEFINED) between nxagent 1.5.0-90 and -93, for no obvious reason. --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 35 +++++-------------------- nx-X11/programs/Xserver/hw/nxagent/Composite.c | 4 +-- nx-X11/programs/Xserver/hw/nxagent/Cursor.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Events.c | 12 ++++----- nx-X11/programs/Xserver/hw/nxagent/Extensions.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 4 +-- nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Options.c | 6 ++--- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 8 +++--- nx-X11/programs/Xserver/hw/nxagent/Window.c | 12 ++++----- 11 files changed, 33 insertions(+), 56 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index 76669e39e..52aa055fc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -801,14 +801,9 @@ int ddxProcessArgument(int argc, char *argv[], int i) if (!strcmp(argv[i], "-R")) { - if (nxagentOption(Binder) == UNDEFINED || - nxagentOption(Desktop) == UNDEFINED || - nxagentOption(Rootless) == UNDEFINED) - { - nxagentChangeOption(Binder, False); - nxagentChangeOption(Desktop, False); - nxagentChangeOption(Rootless, True); - } + nxagentChangeOption(Binder, False); + nxagentChangeOption(Desktop, False); + nxagentChangeOption(Rootless, True); return 1; } @@ -1749,13 +1744,14 @@ N/A #endif - if ((nxagentOption(Rootless) == True) && nxagentOption(Fullscreen)) + if (nxagentOption(Rootless) && nxagentOption(Fullscreen)) { #ifdef TEST fprintf(stderr, "WARNING: Ignoring fullscreen option for rootless session.\n"); #endif nxagentChangeOption(Fullscreen, False); + nxagentChangeOption(AllScreens, False); } /* @@ -1970,25 +1966,6 @@ N/A nxagentSetCoalescence(); - /* - * Set the other defaults. - */ - - if (nxagentOption(Binder) == UNDEFINED) - { - nxagentChangeOption(Binder, False); - } - - if (nxagentOption(Rootless) == UNDEFINED) - { - nxagentChangeOption(Rootless, False); - } - - if (nxagentOption(Desktop) == UNDEFINED) - { - nxagentChangeOption(Desktop, True); - } - /* * The enableBackingStore flag is defined * in window.c in the dix. @@ -2029,7 +2006,7 @@ FIXME: In rootless mode the backing-store support is not functional yet. nxagentAlphaEnabled = False; } - if ((nxagentOption(Rootless) == True) && nxagentOption(Xdmcp)) + if (nxagentOption(Rootless) && nxagentOption(Xdmcp)) { FatalError("PANIC! Cannot start a XDMCP session in rootless mode.\n"); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Composite.c b/nx-X11/programs/Xserver/hw/nxagent/Composite.c index 45799051c..745696219 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Composite.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Composite.c @@ -115,7 +115,7 @@ void nxagentCompositeExtensionInit(void) void nxagentRedirectDefaultWindows(void) { - if (nxagentOption(Rootless) == 1 || + if (nxagentOption(Rootless) || nxagentCompositeEnable == 0) { #ifdef TEST @@ -154,7 +154,7 @@ void nxagentRedirectDefaultWindows(void) void nxagentRedirectWindow(WindowPtr pWin) { - if (nxagentOption(Rootless) == 0 || + if (!nxagentOption(Rootless) || nxagentCompositeEnable == 0) { #ifdef TEST diff --git a/nx-X11/programs/Xserver/hw/nxagent/Cursor.c b/nx-X11/programs/Xserver/hw/nxagent/Cursor.c index 05c78e0ad..dcee721a2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Cursor.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Cursor.c @@ -127,7 +127,7 @@ Bool nxagentDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor) Cursor cursor = (pCursor != rootCursor) ? nxagentCursor(pCursor, pScreen): None; - if (nxagentOption(Rootless) == False) + if (!nxagentOption(Rootless)) { XDefineCursor(nxagentDisplay, nxagentInputWindows[pScreen -> myNum], diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 9d58e814b..5eef6c0a4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -1851,7 +1851,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already { int value = X.xvisibility.state; - if (nxagentOption(Rootless) == 1) + if (nxagentOption(Rootless)) { TraverseTree(pWin, nxagentChangeVisibilityPrivate, &value); } @@ -2003,7 +2003,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already fprintf(stderr, "%s: Going to handle new UnmapNotify event.\n", __func__); #endif - if (nxagentOption(Rootless) == 1) + if (nxagentOption(Rootless)) { WindowPtr pWin; @@ -2019,7 +2019,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already } } - if (nxagentUseNXTrans == 1 && nxagentOption(Rootless) == 0 && + if (nxagentUseNXTrans == 1 && !nxagentOption(Rootless) && !nxagentOption(Nested) && X.xmap.window != nxagentIconWindow) { @@ -2034,7 +2034,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already fprintf(stderr, "%s: Going to handle new MapNotify event.\n", __func__); #endif - if (nxagentOption(Rootless) == 1) + if (nxagentOption(Rootless)) { WindowPtr pWin; @@ -3152,7 +3152,7 @@ int nxagentHandleConfigureNotify(XEvent* X) fprintf(stderr, "%s: DefaultRootWindow(DISPLAY) [0x%lx]\n", __func__, DefaultRootWindow(nxagentDisplay)); #endif - if (nxagentOption(Rootless) == True) + if (nxagentOption(Rootless)) { int sendEventAnyway = 0; @@ -3272,7 +3272,7 @@ int nxagentHandleConfigureNotify(XEvent* X) return 1; } } - else /* (nxagentOption(Rootless) == True) */ + else /* (nxagentOption(Rootless)) */ { /* * Save the position of the agent default window. Don't save the diff --git a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c index 77f2d6b38..9ca7711b2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c @@ -417,7 +417,7 @@ void nxagentRandRSetWindowsSize(int width, int height) XResizeWindow(nxagentDisplay, nxagentDefaultWindows[0], width, height); - if (nxagentOption(Rootless) == 0) + if (!nxagentOption(Rootless)) { XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, width, height); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index ff50c9965..84414c11f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -189,7 +189,7 @@ ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, * } */ - if (nxagentOption(Rootless) == 1) + if (nxagentOption(Rootless)) { /* * from nxagent-1.5.0-20 changelog: @@ -238,7 +238,7 @@ DeactivatePointerGrab(register DeviceIntPtr mouse) * by the agent (for example if the focus had left the window), so * that agent could be unable to update the mouse button state. */ - if (nxagentOption(Rootless) == 1) + if (nxagentOption(Rootless)) { XUngrabPointer(nxagentDisplay, CurrentTime); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index 11e66720f..97665d22e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -193,7 +193,7 @@ ProcChangeProperty(ClientPtr client) return err; else { - if (nxagentOption(Rootless) == 1) + if (nxagentOption(Rootless)) { nxagentExportProperty(pWin, stuff->property, stuff->type, (int) format, (int) mode, len, (void *) &stuff[1]); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.c b/nx-X11/programs/Xserver/hw/nxagent/Options.c index c9b07db97..afc6899e3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.c @@ -59,9 +59,9 @@ void nxagentInitOptions(void) { nxagentOptions.LinkType = UNDEFINED; - nxagentOptions.Desktop = UNDEFINED; + nxagentOptions.Desktop = True; nxagentOptions.Persistent = True; - nxagentOptions.Rootless = UNDEFINED; + nxagentOptions.Rootless = False; nxagentOptions.Shadow = False; nxagentOptions.Fullscreen = False; nxagentOptions.AllScreens = False; @@ -121,7 +121,7 @@ void nxagentInitOptions(void) nxagentOptions.UseDamage = True; - nxagentOptions.Binder = UNDEFINED; + nxagentOptions.Binder = False; nxagentOptions.BinderOptions = NULL; nxagentOptions.Xdmcp = False; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index ffdab066a..9807a8e3b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -630,7 +630,7 @@ Bool nxagentReconnectSession(void) nxagentRedirectDefaultWindows(); - if (nxagentResizeDesktopAtStartup || nxagentOption(Rootless) == True || nxagentOption(Xinerama)) + if (nxagentResizeDesktopAtStartup || nxagentOption(Rootless) || nxagentOption(Xinerama)) { nxagentChangeScreenConfig(0, nxagentOption(RootWidth), nxagentOption(RootHeight), True); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index e0e86b2ce..85114c95a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -948,7 +948,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) * the screen if we are either in rootless or in fullscreen mode. */ - if (nxagentOption(Rootless) == False && !nxagentWMIsRunning) + if (!nxagentOption(Rootless) && !nxagentWMIsRunning) { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Forcing fullscreen mode with no window manager running.\n"); @@ -1732,7 +1732,7 @@ N/A pScreen->myNum, nxagentDefaultWindows[pScreen->myNum]); #endif - if (nxagentOption(Rootless) == 0) + if (!nxagentOption(Rootless)) { XSetWindowAttributes inpattributes = {.event_mask = PointerMotionMask}; @@ -1953,7 +1953,7 @@ N/A /* FIXME: This doing the same thing in both cases. The comments do not seem accurate (anymore?) */ - if (nxagentOption(Rootless) == False) + if (!nxagentOption(Rootless)) { /* * Set the WM_DELETE_WINDOW protocol for the main agent @@ -2377,7 +2377,7 @@ FIXME: We should try to restore the previously XResizeWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], width, height); } - if (nxagentOption(Rootless) == 0) + if (!nxagentOption(Rootless)) { #ifdef DEBUG fprintf(stderr, "%s: resizing InputWindow to [%d]x[%d]\n", __func__, width, height); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 592d76dfd..be310ec67 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -378,7 +378,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) nxagentWindowPriv(pWin) -> corruptedTimestamp = 0; nxagentWindowPriv(pWin) -> splitResource = NULL; - if (nxagentOption(Rootless) == 1) + if (nxagentOption(Rootless)) { nxagentWindowPriv(pWin) -> isMapped = 0; @@ -700,7 +700,7 @@ void nxagentRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib) void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn) { - if (nxagentOption(Rootless) == 1) + if (nxagentOption(Rootless)) { return; } @@ -1259,7 +1259,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) return; } - if (nxagentOption(Rootless) == 1 && + if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin) == 1) { mask &= ~(CWSibling | CWStackMode); @@ -2527,7 +2527,7 @@ void nxagentMapDefaultWindows(void) */ MapWindow(pWin, serverClient); - if (nxagentOption(Rootless) == 0) + if (!nxagentOption(Rootless)) { /* * Show the NX splash screen. @@ -2760,7 +2760,7 @@ Bool nxagentReconnectAllWindows(void *p0) * raised. */ - if (nxagentOption(Rootless) == 0) + if (!nxagentOption(Rootless)) { for (int i = 0; i < screenInfo.numScreens; i++) { @@ -3274,7 +3274,7 @@ XXX: This would break Motif menus. XIconifyWindow(nxagentDisplay, nxagentWindow(pWin), pWin -> drawable.pScreen -> myNum); } } - else if (nxagentOption(Rootless) == 0) + else if (!nxagentOption(Rootless)) { /* * Map the root window. -- cgit v1.2.3