Commit 2565484f authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

nxagent: treat several nxagentOptions as real Booleans

Adaptive, Composite, DeviceControl, DeviceControlUserDefined, IgnoreVisibility, InhibitXkb, Nested, Menu, MagicPixel, Persistent, Reset, ResetzKeyboardAtResume, SharedMemory, SharedPixmaps, Streaming, UseDamage, ViewOnly, Xdmcp, Xinerama
parent ca5a1474
......@@ -488,11 +488,11 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
if (!strcmp(argv[i], "0"))
{
nxagentChangeOption(Streaming, 0);
nxagentChangeOption(Streaming, False);
}
else
{
nxagentChangeOption(Streaming, 1);
nxagentChangeOption(Streaming, True);
}
return 2;
}
......@@ -670,7 +670,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if (!strcmp(argv[i], "-nomagicpixel"))
{
nxagentChangeOption(MagicPixel, 0);
nxagentChangeOption(MagicPixel, False);
return 1;
}
......@@ -725,13 +725,13 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if (!strcmp(argv[i], "-nocomposite"))
{
nxagentChangeOption(Composite, 0);
nxagentChangeOption(Composite, False);
return 1;
}
if (!strcmp(argv[i], "-nodamage"))
{
nxagentChangeOption(UseDamage, 0);
nxagentChangeOption(UseDamage, False);
return 1;
}
......@@ -779,7 +779,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if (!strcmp(argv[i], "-noignore"))
{
nxagentChangeOption(DeviceControl, True);
nxagentChangeOption(DeviceControlUserDefined , True);
nxagentChangeOption(DeviceControlUserDefined, True);
return 1;
}
......@@ -791,7 +791,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if (!strcmp(argv[i], "-noxkblock"))
{
nxagentChangeOption(InhibitXkb, 0);
nxagentChangeOption(InhibitXkb, False);
return 1;
}
......@@ -832,7 +832,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
nxagentChangeOption(Shadow, 1);
nxagentChangeOption(DeferLevel, 0);
nxagentChangeOption(Persistent, 0);
nxagentChangeOption(Persistent, False);
return 1;
}
......@@ -858,11 +858,11 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
if (!strcmp(argv[i], "0"))
{
nxagentChangeOption(ViewOnly, 1);
nxagentChangeOption(ViewOnly, True);
}
else
{
nxagentChangeOption(ViewOnly, 0);
nxagentChangeOption(ViewOnly, False);
}
return 2;
}
......@@ -998,7 +998,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
* has been disabled on the cmdline.
*/
if (PANORAMIX_DISABLED_COND && RRXINERAMA_DISABLED_COND)
nxagentChangeOption(Xinerama, 0);
nxagentChangeOption(Xinerama, False);
return 0;
}
......@@ -1174,11 +1174,11 @@ static void nxagentParseSingleOption(char *name, char *value)
{
if (!strcmp(value, "1"))
{
nxagentChangeOption(Composite, 1);
nxagentChangeOption(Composite, True);
}
else if (!strcmp(value, "0"))
{
nxagentChangeOption(Composite, 0);
nxagentChangeOption(Composite, False);
}
else
{
......@@ -1190,25 +1190,25 @@ static void nxagentParseSingleOption(char *name, char *value)
else if (!strcmp(name, "xinerama"))
{
#if !defined(PANORAMIX) && !defined(RANDR)
nxagentChangeOption(Xinerama, 0);
nxagentChangeOption(Xinerama, False);
fprintf(stderr, "Warning: No Xinerama support compiled into %s.\n", nxagentProgName);
return;
#else
if (PANORAMIX_DISABLED_COND && RRXINERAMA_DISABLED_COND)
{
nxagentChangeOption(Xinerama, 0);
nxagentChangeOption(Xinerama, False);
fprintf(stderr, "Warning: XINERAMA extension has been disabled on %s startup.\n", nxagentProgName);
return;
}
if (!strcmp(value, "1"))
{
nxagentChangeOption(Xinerama, 1);
nxagentChangeOption(Xinerama, True);
return;
}
else if (!strcmp(value, "0"))
{
nxagentChangeOption(Xinerama, 0);
nxagentChangeOption(Xinerama, False);
}
else
{
......@@ -1251,11 +1251,11 @@ static void nxagentParseSingleOption(char *name, char *value)
{
if (!strcmp(value, "0"))
{
nxagentChangeOption(Menu, 0);
nxagentChangeOption(Menu, False);
}
else
{
nxagentChangeOption(Menu, 1);
nxagentChangeOption(Menu, True);
}
return;
}
......@@ -1263,11 +1263,11 @@ static void nxagentParseSingleOption(char *name, char *value)
{
if (!strcmp(value, "0"))
{
nxagentChangeOption(MagicPixel, 0);
nxagentChangeOption(MagicPixel, False);
}
else
{
nxagentChangeOption(MagicPixel, 1);
nxagentChangeOption(MagicPixel, True);
}
return;
}
......@@ -2038,7 +2038,7 @@ FIXME: In rootless mode the backing-store support is not functional yet.
* We enable server reset only for indirect XDMCP sessions.
*/
if (nxagentOption(Reset) == True && nxagentMaxAllowedResets == 0)
if (nxagentOption(Reset) && nxagentMaxAllowedResets == 0)
{
#ifdef WARNING
fprintf(stderr, "nxagentPostProcessArgs: Disabling the server reset.\n");
......@@ -2054,7 +2054,7 @@ FIXME: In rootless mode the backing-store support is not functional yet.
* passing the -noreset option to a standard XFree86 server.
*/
if (nxagentOption(Reset) == False)
if (!nxagentOption(Reset))
{
#ifdef TEST
fprintf(stderr, "nxagentPostProcessArgs: Disabling dispatch of exception at server reset.\n");
......@@ -2166,7 +2166,7 @@ void nxagentSetPackMethod(void)
if (nxagentOption(LinkType) == LINK_TYPE_NONE)
{
nxagentChangeOption(Streaming, 0);
nxagentChangeOption(Streaming, False);
nxagentPackMethod = PACK_NONE;
nxagentPackLossless = PACK_NONE;
......@@ -2189,7 +2189,7 @@ void nxagentSetPackMethod(void)
fprintf(stderr, "nxagentSetPackMethod: Using adaptive mode for image compression.\n");
#endif
nxagentChangeOption(Adaptive, 1);
nxagentChangeOption(Adaptive, True);
}
else
{
......@@ -2197,7 +2197,7 @@ void nxagentSetPackMethod(void)
fprintf(stderr, "nxagentSetPackMethod: Not using adaptive mode for image compression.\n");
#endif
nxagentChangeOption(Adaptive, 0);
nxagentChangeOption(Adaptive, False);
}
if (method == PACK_LOSSY || method == PACK_ADAPTIVE)
......@@ -2326,11 +2326,11 @@ void nxagentSetDeferLevel(void)
* version of the agent.
*/
if (nxagentOption(Streaming) == 1)
if (nxagentOption(Streaming))
{
fprintf(stderr, "Warning: Streaming of images not available in this agent.\n");
nxagentChangeOption(Streaming, 0);
nxagentChangeOption(Streaming, False);
}
switch (nxagentOption(LinkType))
......
......@@ -336,7 +336,7 @@ int nxagentQueryAtoms(ScreenPtr pScreen)
* server.
*/
nxagentChangeOption(Nested, 1);
nxagentChangeOption(Nested, True);
/*
* Avoid the image degradation caused by
......
......@@ -332,7 +332,7 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property)
* the windows updated.
*/
nxagentChangeOption(IgnoreVisibility, 1);
nxagentChangeOption(IgnoreVisibility, True);
}
}
}
......@@ -373,7 +373,7 @@ static void checkIfShadowAgent(ClientPtr client)
fprintf(stderr, "nxagentCheckIfShadowAgent: The last shadow nxagent has been detached.\n");
#endif
nxagentChangeOption(IgnoreVisibility, 0);
nxagentChangeOption(IgnoreVisibility, False);
}
}
}
......
......@@ -57,7 +57,7 @@ void nxagentCompositeExtensionInit(void)
nxagentCompositeEnable = 0;
if (nxagentOption(Composite) == 1)
if (nxagentOption(Composite))
{
int eventBase, errorBase;
......
......@@ -312,7 +312,7 @@ static void nxagentSighupHandler(int signal)
}
else if (nxagentSessionState == SESSION_UP)
{
if (nxagentOption(Persistent) == 1)
if (nxagentOption(Persistent))
{
#ifdef TEST
fprintf(stderr, "nxagentSighupHandler: Handling the signal by disconnecting the agent.\n");
......
......@@ -1097,7 +1097,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
nxagentRemoveDuplicatedKeys(&X);
}
if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow) == 1 && result == doNothing)
if (!nxagentOption(ViewOnly) && nxagentOption(Shadow) == 1 && result == doNothing)
{
X.xkey.keycode = nxagentConvertKeycode(X.xkey.keycode);
......@@ -1190,7 +1190,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
CriticalOutputPending = 1;
if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow))
if (!nxagentOption(ViewOnly) && nxagentOption(Shadow))
{
X.xkey.keycode = nxagentConvertKeycode(X.xkey.keycode);
......@@ -1219,7 +1219,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
if (nxagentOption(Fullscreen))
{
if ( (nxagentOption(MagicPixel) == 1) && (nxagentMagicPixelZone(X.xbutton.x, X.xbutton.y)) )
if ( nxagentOption(MagicPixel) && nxagentMagicPixelZone(X.xbutton.x, X.xbutton.y) )
{
pScreen = nxagentScreen(X.xbutton.window);
......@@ -1285,7 +1285,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
CriticalOutputPending = 1;
}
if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow))
if (!nxagentOption(ViewOnly) && nxagentOption(Shadow))
{
X.xbutton.x -= nxagentOption(RootX);
X.xbutton.y -= nxagentOption(RootY);
......@@ -1359,7 +1359,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
CriticalOutputPending = 1;
}
if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow))
if (!nxagentOption(ViewOnly) && nxagentOption(Shadow))
{
X.xbutton.x -= nxagentOption(RootX);
X.xbutton.y -= nxagentOption(RootY);
......@@ -1420,7 +1420,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
(nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) - 50) &&
X.xmotion.x_root < (nxagentLastEnteredTopLevelWindow -> drawable.x +
(nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) + 50) &&
nxagentOption(Menu) == 1)
nxagentOption(Menu))
{
nxagentPulldownDialog(nxagentLastEnteredTopLevelWindow -> drawable.id);
}
......@@ -1474,7 +1474,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
viewportLastY = X.xmotion.y;
}
if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow) && !viewportCursor)
if (!nxagentOption(ViewOnly) && nxagentOption(Shadow) && !viewportCursor)
{
X.xmotion.x -= nxagentOption(RootX);
X.xmotion.y -= nxagentOption(RootY);
......@@ -1609,7 +1609,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
x.u.u.detail = i * 8 + k;
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow))
if (!nxagentOption(ViewOnly) && nxagentOption(Shadow))
{
XEvent xM = {0};
xM.type = KeyRelease;
......@@ -2020,7 +2020,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
}
if (nxagentUseNXTrans == 1 && nxagentOption(Rootless) == 0 &&
nxagentOption(Nested) == 0 &&
!nxagentOption(Nested) &&
X.xmap.window != nxagentIconWindow)
{
nxagentVisibility = VisibilityFullyObscured;
......
......@@ -698,7 +698,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
* little use.
*/
if (nxagentOption(IgnoreVisibility) == 0 && pDstDrawable -> type == DRAWABLE_WINDOW &&
if (!nxagentOption(IgnoreVisibility) && pDstDrawable -> type == DRAWABLE_WINDOW &&
(nxagentWindowIsVisible((WindowPtr) pDstDrawable) == 0 ||
(nxagentDefaultWindowIsVisible() == 0 && nxagentCompositeEnable == 0)))
{
......
......@@ -648,7 +648,7 @@ void nxagentWakeupHandler(void * data, int count, void * mask)
* the session.
*/
if (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0)
if (nxagentOption(Xdmcp) && nxagentXdmcpUp == 0)
{
#ifdef DEBUG
fprintf(stderr, "nxagentWakeupHandler: XdmcpState [%d].\n", XdmcpState);
......
......@@ -524,7 +524,7 @@ void nxagentPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
* window.
*/
if (nxagentOption(IgnoreVisibility) == 0 && pDrawable -> type == DRAWABLE_WINDOW &&
if (!nxagentOption(IgnoreVisibility) && pDrawable -> type == DRAWABLE_WINDOW &&
(nxagentWindowIsVisible((WindowPtr) pDrawable) == 0 ||
(nxagentDefaultWindowIsVisible() == 0 && nxagentCompositeEnable == 0)))
{
......@@ -667,11 +667,11 @@ FIXME: Should use these.
/*
FIXME: Should we disable the split with link LAN?
split = (nxagentOption(Streaming) == 1 &&
split = (nxagentOption(Streaming) &&
nxagentOption(LinkType) != LINK_TYPE_NONE &&
nxagentOption(LinkType) != LINK_TYPE_LAN
*/
split = (nxagentOption(Streaming) == 1 &&
split = (nxagentOption(Streaming) &&
nxagentOption(LinkType) != LINK_TYPE_NONE
/*
FIXME: Do we stream the images from GLX or Xv? If we do that, we
......@@ -1284,7 +1284,7 @@ FIXME: There should be a callback registered by the agent that
* lossless encoder will compress better.
*/
if (lossless == 0 && nxagentOption(Adaptive) == 1)
if (lossless == 0 && nxagentOption(Adaptive))
{
int ratio = nxagentUniquePixels(plainImage);
......
......@@ -518,7 +518,7 @@ FIXME: Do we need to check the key grab if the
fprintf(stderr, "Info: Auto-terminating session with no client running.\n");
raise(SIGTERM);
}
else if (nxagentOption(Persistent) == 0)
else if (!nxagentOption(Persistent))
{
fprintf(stderr, "Info: Auto-terminating session with persistence not allowed.\n");
raise(SIGTERM);
......
......@@ -330,7 +330,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
clientReady[0] = 0;
if (nxagentHaveSplashWindow() || (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0))
if (nxagentHaveSplashWindow() || (nxagentOption(Xdmcp) && nxagentXdmcpUp == 0))
{
#ifdef TEST
fprintf(stderr, "******Dispatch: Requesting a timeout of [%d] Ms.\n",
......@@ -343,7 +343,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
if (serverGeneration > nxagentMaxAllowedResets &&
nxagentSessionState == SESSION_STARTING &&
(nxagentOption(Xdmcp) == 0 || nxagentXdmcpUp == 1))
(!nxagentOption(Xdmcp) || nxagentXdmcpUp == 1))
{
#ifdef NX_DEBUG_INPUT
fprintf(stderr, "Session: Session started at '%s' timestamp [%u].\n",
......
......@@ -96,7 +96,7 @@ ShmExtensionInit(void)
#endif
#ifdef NXAGENT_SERVER
if (nxagentOption(SharedMemory) == False)
if (!nxagentOption(SharedMemory))
{
return;
}
......
......@@ -60,7 +60,7 @@ void nxagentInitOptions(void)
nxagentOptions.LinkType = UNDEFINED;
nxagentOptions.Desktop = UNDEFINED;
nxagentOptions.Persistent = 1;
nxagentOptions.Persistent = True;
nxagentOptions.Rootless = UNDEFINED;
nxagentOptions.Fullscreen = False;
nxagentOptions.AllScreens = False;
......@@ -82,23 +82,23 @@ void nxagentInitOptions(void)
nxagentOptions.Timeout = 0;
nxagentOptions.Nested = 0;
nxagentOptions.Nested = False;
nxagentOptions.BackingStore = BackingStoreUndefined;
nxagentOptions.Clipboard = ClipboardBoth;
nxagentOptions.SharedMemory = 1;
nxagentOptions.SharedMemory = True;
nxagentOptions.SharedPixmaps = 1;
nxagentOptions.SharedPixmaps = True;
nxagentOptions.DeviceControl = 0;
nxagentOptions.DeviceControl = False;
nxagentOptions.DeviceControlUserDefined = 0;
nxagentOptions.DeviceControlUserDefined = False;
nxagentOptions.ResetKeyboardAtResume = 1;
nxagentOptions.ResetKeyboardAtResume = True;
nxagentOptions.Reset = 0;
nxagentOptions.Reset = False;
nxagentOptions.RootX = 0;
nxagentOptions.RootY = 0;
......@@ -118,25 +118,25 @@ void nxagentInitOptions(void)
nxagentOptions.FloatXRatio = 1.0;
nxagentOptions.FloatYRatio = 1.0;
nxagentOptions.UseDamage = 1;
nxagentOptions.UseDamage = True;
nxagentOptions.Binder = UNDEFINED;
nxagentOptions.BinderOptions = NULL;
nxagentOptions.Xdmcp = 0;
nxagentOptions.Xdmcp = False;
nxagentOptions.DisplayBuffer = UNDEFINED;
nxagentOptions.DisplayCoalescence = 0;
nxagentOptions.Composite = 1;
nxagentOptions.Composite = True;
nxagentOptions.IgnoreVisibility = 0;
nxagentOptions.IgnoreVisibility = False;
nxagentOptions.ViewOnly = 0;
nxagentOptions.ViewOnly = False;
nxagentOptions.Adaptive = 0;
nxagentOptions.Adaptive = False;
nxagentOptions.Streaming = 0;
nxagentOptions.Streaming = False;
nxagentOptions.DeferLevel = UNDEFINED;
nxagentOptions.DeferTimeout = 200;
......@@ -144,19 +144,19 @@ void nxagentInitOptions(void)
nxagentOptions.TileWidth = UNDEFINED;
nxagentOptions.TileHeight = UNDEFINED;
nxagentOptions.Menu = 1;
nxagentOptions.Menu = True;
nxagentOptions.MagicPixel = 1;
nxagentOptions.MagicPixel = True;
nxagentOptions.ClientOs = UNDEFINED;
nxagentOptions.InhibitXkb = 1;
nxagentOptions.InhibitXkb = True;
nxagentOptions.CopyBufferSize = COPY_UNLIMITED;
nxagentOptions.ImageRateLimit = 0;
nxagentOptions.Xinerama = 1;
nxagentOptions.Xinerama = True;
nxagentOptions.SleepTimeMillis = DEFAULT_SLEEP_TIME_MILLIS;
......
......@@ -84,7 +84,7 @@ void nxagentChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl)
* leaves the agent's window.
*/
if (nxagentOption(DeviceControl) == True)
if (nxagentOption(DeviceControl))
{
#ifdef TEST
fprintf(stderr, "%s: WARNING! Propagating changes to pointer settings.\n", __func__);
......
......@@ -240,7 +240,7 @@ TODO: This should be reset only when the state became SESSION_DOWN.
*/
nxagentException.ioError = 0;
if (nxagentOption(Persistent) == 1 && nxagentSessionState != SESSION_STARTING)
if (nxagentOption(Persistent) && nxagentSessionState != SESSION_STARTING)
{
if (nxagentSessionState == SESSION_UP)
{
......@@ -588,7 +588,7 @@ Bool nxagentReconnectSession(void)
}
/* Reset the keyboard only if we detect any changes. */
if (nxagentOption(ResetKeyboardAtResume) == 1)
if (nxagentOption(ResetKeyboardAtResume))
{
if (nxagentKeyboard == NULL || nxagentOldKeyboard == NULL ||
strcmp(nxagentKeyboard, nxagentOldKeyboard) != 0 ||
......@@ -630,7 +630,7 @@ Bool nxagentReconnectSession(void)
nxagentRedirectDefaultWindows();
if (nxagentResizeDesktopAtStartup || nxagentOption(Rootless) == True || nxagentOption(Xinerama) == True)
if (nxagentResizeDesktopAtStartup || nxagentOption(Rootless) == True || nxagentOption(Xinerama))
{
nxagentChangeScreenConfig(0, nxagentOption(RootWidth),
nxagentOption(RootHeight), True);
......
......@@ -2001,7 +2001,7 @@ N/A
* change the real X server's keyboard and pointer settings.
*/
if (nxagentOption(DeviceControl) == False)
if (!nxagentOption(DeviceControl))
{
fprintf(stderr, "Info: Not using local device configuration changes.\n");
}
......@@ -2532,7 +2532,7 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
NXShadowSetDisplayUid(nxagentShadowUid);
}
if (nxagentOption(UseDamage) == 0)
if (nxagentOption(UseDamage))
{
NXShadowDisableDamage();
}
......
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