From 6effea543d04150ca0d5aa6d4b5edadfd320ea17 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan <ïonic@ionic.de> Date: Tue, 28 Jun 2016 23:51:14 +0000 Subject: nx-X11/programs/Xserver/hw/nxagent/Display.c: use new ReconnectTolerance nxagentOption in nxagentCheckForDefaultDepthCompatibility() and modify behavior based on this value. Recognized values: - Strict means that the old and new default depth values must match exactly. - Safe or Risky means that the default depth values might differ, but the new default depth value must be at least as high as the former default depth value. This is recommended, because it allows clients with a higher default depth value to still connect, but not lose functionality. - Bypass or higher means that all of these checks are essentially deactivated. This is probably a very bad idea. Note that the default ReconnectTolerance value is still Strict. --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 43 +++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 5943fbf77..ea58437ea 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -2175,10 +2175,40 @@ void nxagentDisconnectDisplay(void) static int nxagentCheckForDefaultDepthCompatibility() { + /* + * Depending on the (reconnect) tolerance checks value, this + * function checks stricter or looser: + * - Strict means that the old and new default depth values + * must match exactly. + * - Safe or Risky means that the default depth values might differ, + * but the new default depth value must be at least as + * high as the former default depth value. This is + * recommended, because it allows clients with a + * higher default depth value to still connect, but + * not lose functionality. + * - Bypass or higher means that all of these checks are + * essentially deactivated. This is probably a very + * bad idea. + */ + int dDepth; dDepth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); + const unsigned int tolerance = nxagentOption(ReconnectTolerance); + + if (ToleranceChecksBypass <= tolerance) + { + #ifdef WARNING + fprintf(stderr, "nxagentCheckForDefaultDepthCompatibility: WARNING! Not proceeding with any checks, " + "because tolerance [%u] higher than or equal [%u]. New default depth value " + "is [%d], former default depth value is [%d].\n", tolerance, + ToleranceChecksBypass, dDepth, nxagentDefaultDepthRecBackup); + #endif + + return 1; + } + if (nxagentDefaultDepthRecBackup == dDepth) { #ifdef TEST @@ -2188,11 +2218,22 @@ static int nxagentCheckForDefaultDepthCompatibility() return 1; } + else if ((ToleranceChecksSafe <= tolerance) && (nxagentDefaultDepthRecBackup < dDepth)) + { + #ifdef WARNING + fprintf(stderr, "nxagentCheckForDefaultDepthCompatibility: WARNING! New default depth [%d] " + "higher than the old default depth [%d] at tolerance [%u].\n", dDepth, + nxagentDefaultDepthRecBackup, tolerance); + #endif + + return 1; + } else { #ifdef WARNING fprintf(stderr, "nxagentCheckForDefaultDepthCompatibility: WARNING! New default depth [%d] " - "doesn't match with old default depth [%d].\n", dDepth, nxagentDefaultDepthRecBackup); + "doesn't match with old default depth [%d] at tolerance [%u].\n", dDepth, + nxagentDefaultDepthRecBackup, tolerance); #endif return 0; -- cgit v1.2.3