Commit de5eb54c authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

nxagent: make Fullscreen and AllScreens Booleans

There's no need/sense in having a tri-state with the third state being UNDEFINED.
parent d545afdf
...@@ -589,7 +589,7 @@ int ddxProcessArgument(int argc, char *argv[], int i) ...@@ -589,7 +589,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
} }
} }
if (nxagentUserGeometry.flag || (nxagentOption(Fullscreen) == 1)) if (nxagentUserGeometry.flag || (nxagentOption(Fullscreen)))
{ {
return 2; return 2;
} }
...@@ -1749,7 +1749,7 @@ N/A ...@@ -1749,7 +1749,7 @@ N/A
#endif #endif
if ((nxagentOption(Rootless) == 1) && nxagentOption(Fullscreen) == 1) if ((nxagentOption(Rootless) == 1) && nxagentOption(Fullscreen))
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "WARNING: Ignoring fullscreen option for rootless session.\n"); fprintf(stderr, "WARNING: Ignoring fullscreen option for rootless session.\n");
...@@ -1974,16 +1974,6 @@ N/A ...@@ -1974,16 +1974,6 @@ N/A
* Set the other defaults. * Set the other defaults.
*/ */
if (nxagentOption(Fullscreen) == UNDEFINED)
{
nxagentChangeOption(Fullscreen, False);
}
if (nxagentOption(AllScreens) == UNDEFINED)
{
nxagentChangeOption(AllScreens, False);
}
if (nxagentOption(Binder) == UNDEFINED) if (nxagentOption(Binder) == UNDEFINED)
{ {
nxagentChangeOption(Binder, False); nxagentChangeOption(Binder, False);
......
...@@ -575,7 +575,7 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen) ...@@ -575,7 +575,7 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen)
nxagentLaunchDialog(DIALOG_DISABLE_DESKTOP_RESIZE_MODE); nxagentLaunchDialog(DIALOG_DISABLE_DESKTOP_RESIZE_MODE);
if (nxagentOption(Fullscreen) == 0) if (!nxagentOption(Fullscreen))
{ {
nxagentSetWMNormalHintsMaxsize(pScreen, nxagentSetWMNormalHintsMaxsize(pScreen,
nxagentOption(RootWidth), nxagentOption(RootWidth),
...@@ -1724,7 +1724,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -1724,7 +1724,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
nxagentScreenTrap = False; nxagentScreenTrap = False;
} }
if (nxagentOption(Fullscreen) == 1 && if (nxagentOption(Fullscreen) &&
X.xcrossing.window == nxagentFullscreenWindow && X.xcrossing.window == nxagentFullscreenWindow &&
X.xcrossing.detail != NotifyInferior) X.xcrossing.detail != NotifyInferior)
{ {
...@@ -2057,7 +2057,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -2057,7 +2057,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
} }
} }
if (nxagentOption(AllScreens) == 1) if (nxagentOption(AllScreens))
{ {
if (X.xmap.window == nxagentIconWindow) if (X.xmap.window == nxagentIconWindow)
{ {
...@@ -2066,7 +2066,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -2066,7 +2066,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
} }
} }
if (nxagentOption(Fullscreen) == 1) if (nxagentOption(Fullscreen))
{ {
nxagentVisibility = VisibilityUnobscured; nxagentVisibility = VisibilityUnobscured;
nxagentVisibilityStop = False; nxagentVisibilityStop = False;
...@@ -2185,7 +2185,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -2185,7 +2185,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
if (switchFullscreen) if (switchFullscreen)
{ {
if (nxagentOption(AllScreens) == 1 && nxagentOption(Fullscreen) == 1) if (nxagentOption(AllScreens) && nxagentOption(Fullscreen))
{ {
nxagentSwitchAllScreens(pScreen, 0); nxagentSwitchAllScreens(pScreen, 0);
} }
...@@ -2197,7 +2197,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -2197,7 +2197,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
if (switchAllScreens) if (switchAllScreens)
{ {
if (nxagentOption(AllScreens) == 0 && nxagentOption(Fullscreen) == 1) if (!nxagentOption(AllScreens) && nxagentOption(Fullscreen))
{ {
nxagentSwitchFullscreen(pScreen, False); nxagentSwitchFullscreen(pScreen, False);
} }
...@@ -3291,7 +3291,7 @@ int nxagentHandleConfigureNotify(XEvent* X) ...@@ -3291,7 +3291,7 @@ int nxagentHandleConfigureNotify(XEvent* X)
if (X -> xconfigure.window == nxagentDefaultWindows[pScreen -> myNum]) if (X -> xconfigure.window == nxagentDefaultWindows[pScreen -> myNum])
{ {
if (nxagentOption(AllScreens) == 0) if (!nxagentOption(AllScreens))
{ {
/* /*
* - WITHOUT window manager any position change is relevant * - WITHOUT window manager any position change is relevant
...@@ -3409,7 +3409,7 @@ int nxagentHandleConfigureNotify(XEvent* X) ...@@ -3409,7 +3409,7 @@ int nxagentHandleConfigureNotify(XEvent* X)
XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0,
X -> xconfigure.width, X -> xconfigure.height); X -> xconfigure.width, X -> xconfigure.height);
if (nxagentOption(Fullscreen) == 0) if (!nxagentOption(Fullscreen))
{ {
/* FIXME: has already been done some lines above */ /* FIXME: has already been done some lines above */
nxagentMoveViewport(pScreen, 0, 0); nxagentMoveViewport(pScreen, 0, 0);
...@@ -3592,7 +3592,7 @@ int nxagentHandleReparentNotify(XEvent* X) ...@@ -3592,7 +3592,7 @@ int nxagentHandleReparentNotify(XEvent* X)
return 1; return 1;
} }
else if (nxagentWMIsRunning && nxagentOption(Fullscreen) == 0 && else if (nxagentWMIsRunning && !nxagentOption(Fullscreen) &&
nxagentOption(WMBorderWidth) == -1) nxagentOption(WMBorderWidth) == -1)
{ {
/* /*
......
...@@ -393,7 +393,7 @@ void nxagentRandRSetWindowsSize(int width, int height) ...@@ -393,7 +393,7 @@ void nxagentRandRSetWindowsSize(int width, int height)
{ {
if (width == 0) if (width == 0)
{ {
if (nxagentOption(Fullscreen) == 1) if (nxagentOption(Fullscreen))
{ {
width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
} }
...@@ -405,7 +405,7 @@ void nxagentRandRSetWindowsSize(int width, int height) ...@@ -405,7 +405,7 @@ void nxagentRandRSetWindowsSize(int width, int height)
if (height == 0) if (height == 0)
{ {
if (nxagentOption(Fullscreen) == 1) if (nxagentOption(Fullscreen))
{ {
height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
} }
...@@ -430,7 +430,7 @@ int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, ...@@ -430,7 +430,7 @@ int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
UpdateCurrentTime(); UpdateCurrentTime();
if (nxagentOption(DesktopResize) == 1 && if (nxagentOption(DesktopResize) == 1 &&
(nxagentOption(Fullscreen) == 1 || (nxagentOption(Fullscreen) ||
width > WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) || width > WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) ||
height > HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)))) height > HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))))
{ {
...@@ -441,8 +441,8 @@ int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, ...@@ -441,8 +441,8 @@ int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
} }
} }
if (nxagentOption(DesktopResize) == 1 && nxagentOption(Fullscreen) == 0 && if (nxagentOption(DesktopResize) == 1 && !nxagentOption(Fullscreen) &&
nxagentOption(AllScreens) == 0) !nxagentOption(AllScreens))
{ {
nxagentChangeOption(Width, width); nxagentChangeOption(Width, width);
nxagentChangeOption(Height, height); nxagentChangeOption(Height, height);
...@@ -451,7 +451,7 @@ int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, ...@@ -451,7 +451,7 @@ int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
int result = nxagentResizeScreen(pScreen, width, height, mmWidth, mmHeight, True); int result = nxagentResizeScreen(pScreen, width, height, mmWidth, mmHeight, True);
if (result == 1 && nxagentOption(DesktopResize) == 1 && if (result == 1 && nxagentOption(DesktopResize) == 1 &&
nxagentOption(Fullscreen) == 0 && nxagentOption(AllScreens) == 0) !nxagentOption(Fullscreen) && !nxagentOption(AllScreens))
{ {
nxagentRandRSetWindowsSize(width, height); nxagentRandRSetWindowsSize(width, height);
nxagentSetWMNormalHints(pScreen -> myNum, nxagentOption(Width), nxagentOption(Height)); nxagentSetWMNormalHints(pScreen -> myNum, nxagentOption(Width), nxagentOption(Height));
......
...@@ -62,7 +62,8 @@ void nxagentInitOptions(void) ...@@ -62,7 +62,8 @@ void nxagentInitOptions(void)
nxagentOptions.Desktop = UNDEFINED; nxagentOptions.Desktop = UNDEFINED;
nxagentOptions.Persistent = 1; nxagentOptions.Persistent = 1;
nxagentOptions.Rootless = UNDEFINED; nxagentOptions.Rootless = UNDEFINED;
nxagentOptions.Fullscreen = UNDEFINED; nxagentOptions.Fullscreen = False;
nxagentOptions.AllScreens = False;
nxagentOptions.NoRootlessExit = False; nxagentOptions.NoRootlessExit = False;
nxagentOptions.X = 0; nxagentOptions.X = 0;
......
...@@ -800,6 +800,9 @@ void nxagentPrintAgentGeometry(char *hdrMessage, char *prefix) ...@@ -800,6 +800,9 @@ void nxagentPrintAgentGeometry(char *hdrMessage, char *prefix)
fprintf(stderr, "%s | Fullscreen is %s.\n", prefix, fprintf(stderr, "%s | Fullscreen is %s.\n", prefix,
nxagentOption(Fullscreen) ? "ON" : "OFF"); nxagentOption(Fullscreen) ? "ON" : "OFF");
fprintf(stderr, "%s | AllScreens is %s.\n", prefix,
nxagentOption(AllScreens) ? "ON" : "OFF");
fprintf(stderr, "%s | Desktop resize mode is %s.\n", prefix, fprintf(stderr, "%s | Desktop resize mode is %s.\n", prefix,
nxagentOption(DesktopResize) ? "ON" : "OFF"); nxagentOption(DesktopResize) ? "ON" : "OFF");
...@@ -1664,13 +1667,13 @@ N/A ...@@ -1664,13 +1667,13 @@ N/A
.colormap = nxagentDefaultVisualColormap(nxagentDefaultVisual(pScreen)) .colormap = nxagentDefaultVisualColormap(nxagentDefaultVisual(pScreen))
}; };
if (nxagentOption(AllScreens) == 1) if (nxagentOption(AllScreens))
{ {
valuemask |= CWOverrideRedirect; valuemask |= CWOverrideRedirect;
attributes.override_redirect = True; attributes.override_redirect = True;
} }
if (nxagentOption(Fullscreen) == 1) if (nxagentOption(Fullscreen))
{ {
if (nxagentReconnectTrap) if (nxagentReconnectTrap)
{ {
...@@ -1833,7 +1836,7 @@ N/A ...@@ -1833,7 +1836,7 @@ N/A
sizeHints->width = nxagentOption(RootWidth); sizeHints->width = nxagentOption(RootWidth);
sizeHints->height = nxagentOption(RootHeight); sizeHints->height = nxagentOption(RootHeight);
if (nxagentOption(DesktopResize) == 1 || nxagentOption(Fullscreen) == 1) if (nxagentOption(DesktopResize) == 1 || nxagentOption(Fullscreen))
{ {
sizeHints->max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints->max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
sizeHints->max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints->max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
...@@ -2362,7 +2365,7 @@ FIXME: We should try to restore the previously ...@@ -2362,7 +2365,7 @@ FIXME: We should try to restore the previously
* Change agent window size and size hints. * Change agent window size and size hints.
*/ */
if ((nxagentOption(Fullscreen) == 0 && nxagentOption(AllScreens) == 0)) if (!(nxagentOption(Fullscreen) || nxagentOption(AllScreens)))
{ {
nxagentSetWMNormalHints(pScreen->myNum, width, height); nxagentSetWMNormalHints(pScreen->myNum, width, height);
...@@ -2566,7 +2569,7 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin) ...@@ -2566,7 +2569,7 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
return -1; return -1;
} }
if (nxagentOption(Fullscreen) == 1) if (nxagentOption(Fullscreen))
{ {
nxagentShadowSetRatio(WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) * 1.0 / nxagentShadowWidth, nxagentShadowSetRatio(WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) * 1.0 / nxagentShadowWidth,
HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) * 1.0 / nxagentShadowHeight); HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) * 1.0 / nxagentShadowHeight);
......
...@@ -2500,7 +2500,7 @@ void nxagentRefreshWindows(WindowPtr pWin) ...@@ -2500,7 +2500,7 @@ void nxagentRefreshWindows(WindowPtr pWin)
void nxagentUnmapWindows(void) void nxagentUnmapWindows(void)
{ {
if (nxagentOption(Fullscreen) == 1) if (nxagentOption(Fullscreen))
{ {
for (int i = 0; i < screenInfo.numScreens; i++) for (int i = 0; i < screenInfo.numScreens; i++)
{ {
...@@ -2556,7 +2556,7 @@ void nxagentMapDefaultWindows(void) ...@@ -2556,7 +2556,7 @@ void nxagentMapDefaultWindows(void)
XMapWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum]); XMapWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum]);
if (nxagentOption(Fullscreen) == 1 && nxagentWMIsRunning) if (nxagentOption(Fullscreen) && nxagentWMIsRunning)
{ {
nxagentMaximizeToFullScreen(pScreen); nxagentMaximizeToFullScreen(pScreen);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment