From acb861df40951de59db0ff7ca8c5a3acc9f5292d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 30 Dec 2020 21:21:19 +0100 Subject: nxagent: make nxagentOption Shadow a Boolean and add the missing init code. --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 14 +++++++------- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 6 +++--- nx-X11/programs/Xserver/hw/nxagent/Events.c | 14 +++++++------- nx-X11/programs/Xserver/hw/nxagent/Image.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Options.c | 1 + nx-X11/programs/Xserver/hw/nxagent/Pixels.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Window.c | 8 ++++---- 9 files changed, 26 insertions(+), 25 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 3505c9319..76669e39e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -507,7 +507,7 @@ int ddxProcessArgument(int argc, char *argv[], int i) sscanf(argv[i], "%i", &level) == 1 && level >= 0 && level <= 2) { - if (nxagentOption(Shadow) == 0) + if (!nxagentOption(Shadow)) { nxagentChangeOption(DeferLevel, level); @@ -830,7 +830,7 @@ int ddxProcessArgument(int argc, char *argv[], int i) if (!strcmp(argv[i], "-S")) { - nxagentChangeOption(Shadow, 1); + nxagentChangeOption(Shadow, True); nxagentChangeOption(DeferLevel, 0); nxagentChangeOption(Persistent, False); return 1; @@ -1749,7 +1749,7 @@ N/A #endif - if ((nxagentOption(Rootless) == 1) && nxagentOption(Fullscreen)) + if ((nxagentOption(Rootless) == True) && nxagentOption(Fullscreen)) { #ifdef TEST fprintf(stderr, "WARNING: Ignoring fullscreen option for rootless session.\n"); @@ -2029,7 +2029,7 @@ FIXME: In rootless mode the backing-store support is not functional yet. nxagentAlphaEnabled = False; } - if ((nxagentOption(Rootless) == 1) && nxagentOption(Xdmcp)) + if ((nxagentOption(Rootless) == True) && nxagentOption(Xdmcp)) { FatalError("PANIC! Cannot start a XDMCP session in rootless mode.\n"); } @@ -2353,7 +2353,7 @@ void nxagentSetDeferLevel(void) * Set the defer timeout. */ - if (nxagentOption(Shadow) == 1) + if (nxagentOption(Shadow)) { #ifdef TEST fprintf(stderr, "nxagentSetDeferLevel: Ignoring defer timeout parameter in shadow mode.\n"); @@ -2368,7 +2368,7 @@ void nxagentSetDeferLevel(void) * Set the defer level. */ - if (nxagentOption(Shadow) == 1) + if (nxagentOption(Shadow)) { #ifdef TEST fprintf(stderr, "nxagentSetDeferLevel: Ignoring defer parameter in shadow mode.\n"); @@ -2472,7 +2472,7 @@ void nxagentSetScheduler(void) * The smart scheduler is the default. */ - if (nxagentOption(Shadow) == 1) + if (nxagentOption(Shadow)) { #ifdef TEST fprintf(stderr, "nxagentSetScheduler: Using the dumb scheduler in shadow mode.\n"); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index bdbf4fcf8..4d643a97e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -799,7 +799,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned if (owner != NULL) { - if (nxagentOption(Shadow) == 1 && + if (nxagentOption(Shadow) && (nxagentOption(XRatio) != DONT_SCALE || nxagentOption(YRatio) != DONT_SCALE)) { @@ -852,7 +852,7 @@ nxagentSynchronizeRegionStop: success = 1; - if (nxagentOption(Shadow) == 0) + if (!nxagentOption(Shadow)) { if (nxagentSynchronization.abort == 1) { @@ -921,7 +921,7 @@ nxagentSynchronizeRegionStop: int w = RegionRects(&collectedUpdates)[i].x2 - RegionRects(&collectedUpdates)[i].x1; int h = RegionRects(&collectedUpdates)[i].y2 - RegionRects(&collectedUpdates)[i].y1; - if (nxagentOption(Shadow) == 1 && + if (nxagentOption(Shadow) && (nxagentOption(XRatio) != DONT_SCALE || nxagentOption(YRatio) != DONT_SCALE)) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 88375cbe1..9d58e814b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -1043,7 +1043,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) } case doSwitchResizeMode: { - if (nxagentOption(Shadow) == 0) + if (!nxagentOption(Shadow)) { if (nxagentNoDialogIsRunning) { @@ -1097,7 +1097,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) nxagentRemoveDuplicatedKeys(&X); } - if (!nxagentOption(ViewOnly) && nxagentOption(Shadow) == 1 && result == doNothing) + if (!nxagentOption(ViewOnly) && nxagentOption(Shadow) && result == doNothing) { X.xkey.keycode = nxagentConvertKeycode(X.xkey.keycode); @@ -1492,7 +1492,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already NXShadowEvent(nxagentDisplay, X); } - if (nxagentOption(Shadow) == 0) + if (!nxagentOption(Shadow)) { nxagentInputEvent = 1; } @@ -3369,7 +3369,7 @@ int nxagentHandleConfigureNotify(XEvent* X) nxagentChangeOption(Y, newY); } - if (nxagentOption(Shadow) == 1 && nxagentOption(DesktopResize) && + if (nxagentOption(Shadow) && nxagentOption(DesktopResize) && (nxagentOption(Width) != X -> xconfigure.width || nxagentOption(Height) != X -> xconfigure.height)) { @@ -3397,7 +3397,7 @@ int nxagentHandleConfigureNotify(XEvent* X) /* if in shadowing mode or if neither size nor position have changed we do not need to adjust RandR */ /* FIXME: Comment makes no sense */ - if (nxagentOption(Shadow) == 1 || + if (nxagentOption(Shadow) || (nxagentOption(Width) == nxagentOption(RootWidth) && nxagentOption(Height) == nxagentOption(RootHeight) && nxagentOption(X) == nxagentOption(RootX) && @@ -4323,7 +4323,7 @@ int nxagentUserInput(void *p) * eventually change the nxagentInputEvent status. */ - if (nxagentOption(Shadow) == 1 && + if (nxagentOption(Shadow) && nxagentPendingEvents(nxagentDisplay) > 0) { nxagentDispatchEvents(NULL); @@ -4342,7 +4342,7 @@ int nxagentUserInput(void *p) * browser's page), in order to update the screen smoothly. */ - if (nxagentOption(Shadow) == 1) + if (nxagentOption(Shadow)) { return result; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c index 946cb7bf8..79d8c365f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c @@ -925,7 +925,7 @@ void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int bytesPerLine = nxagentImagePad(w, format, leftPad, depth); - if (nxagentOption(Shadow) == 1 && format == ZPixmap && + if (nxagentOption(Shadow) && format == ZPixmap && (nxagentOption(XRatio) != DONT_SCALE || nxagentOption(YRatio) != DONT_SCALE) && pDrawable == (DrawablePtr) nxagentShadowPixmapPtr) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 14d811877..c9c9bb33b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -776,7 +776,7 @@ XkbError: XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls); } - if (nxagentOption(Shadow) == 1 && pDev && pDev->key) + if (nxagentOption(Shadow) && pDev && pDev->key) { NXShadowInitKeymap(&(pDev->key->curKeySyms)); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index bbc30ee01..6573ac0b9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -575,7 +575,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio fprintf(stderr, "Session: Session terminated at '%s'.\n", GetTimeAsString()); } - if (nxagentOption(Shadow) == 1) + if (nxagentOption(Shadow)) { NXShadowDestroy(); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.c b/nx-X11/programs/Xserver/hw/nxagent/Options.c index dd474e3dd..c9b07db97 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.c @@ -62,6 +62,7 @@ void nxagentInitOptions(void) nxagentOptions.Desktop = UNDEFINED; nxagentOptions.Persistent = True; nxagentOptions.Rootless = UNDEFINED; + nxagentOptions.Shadow = False; nxagentOptions.Fullscreen = False; nxagentOptions.AllScreens = False; nxagentOptions.NoRootlessExit = False; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixels.h b/nx-X11/programs/Xserver/hw/nxagent/Pixels.h index 316d147ac..07f57621e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixels.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixels.h @@ -97,7 +97,7 @@ while (0) nxagentUserInput(NULL) == 1) #define canBreakOnTimeout(mask) \ - (((mask) != NEVER_BREAK) && nxagentOption(Shadow) == 0) + (((mask) != NEVER_BREAK) && !nxagentOption(Shadow)) /* * Macros defining the conditions to diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index f1c21e12c..592d76dfd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -903,7 +903,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) if (nxagentOption(DesktopResize)) { - if (nxagentOption(Shadow) == 0) + if (!nxagentOption(Shadow)) { nxagentChangeScreenConfig(0, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)), HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)), True); @@ -957,7 +957,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) nxagentChangeOption(RootWidth, nxagentOption(SavedRootWidth)); nxagentChangeOption(RootHeight, nxagentOption(SavedRootHeight)); - if (nxagentOption(Shadow) == 0) + if (!nxagentOption(Shadow)) { nxagentChangeScreenConfig(0, nxagentOption(RootWidth), nxagentOption(RootHeight), True); @@ -998,7 +998,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) nxagentChangeOption(Width, nxagentOption(SavedWidth)); nxagentChangeOption(Height, nxagentOption(SavedHeight)); - if (nxagentOption(Shadow) == 1 && nxagentOption(DesktopResize)) + if (nxagentOption(Shadow) && nxagentOption(DesktopResize)) { nxagentShadowAdaptToRatio(); } @@ -2547,7 +2547,7 @@ void nxagentMapDefaultWindows(void) * Windows client. */ - if (nxagentOption(Shadow) == 0 || !nxagentWMIsRunning) + if (!nxagentOption(Shadow) || !nxagentWMIsRunning) { #ifdef TEST fprintf(stderr, "nxagentMapDefaultWindows: Mapping default window id [%ld].\n", -- cgit v1.2.3