From bf0861aa0363f55dd95295dca3ccd6ff96acea87 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 2 Jun 2020 21:48:41 +0200 Subject: nxagent: clarify sleep time units No functional changes, just clarification/explanation of the existing code. Fixes ArcticaProject/nx-libs#926 --- nx-X11/programs/Xserver/hw/nxagent/Image.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Image.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c index 9369aeb1e..db174a9de 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c @@ -492,9 +492,19 @@ void nxagentPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, if (nxagentShadowCounter == 0 && NXDisplayError(nxagentDisplay) == 1 && - nxagentOption(SleepTime) > 0) + nxagentOption(SleepTimeMillis) > 0) { - int us = nxagentOption(SleepTime) * 4 * (length / 1024); + /* + * The original NX code had 250us (microseconds) * length/1024 + * here and 50ms (milliseconds) elsewhere. Later ONE combined + * configurable sleep parameter was introduced, having a default + * of 50ms (that's milliseconds, not microseconds!), which is + * factor 200. For unknown reasons the factor was changed to 250 + * at the same time. Ensure the value is somewhere between 10ms + * and 1s. + */ + + int us = nxagentOption(SleepTimeMillis) * 1000 * (length / 1024) / 250; us = (us < 10000 ? 10000 : (us > 1000000 ? 1000000 : us)); -- cgit v1.2.3