aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-11-17 19:00:59 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-01-05 23:36:02 +0100
commit166102e072073282768bd4b66c982b49b490284f (patch)
treef81f8d4d527628d55e5d77733a675ac6c2798190 /nx-X11/programs/Xserver/hw/nxagent
parentf05a2eca579e17c8d7d0b3327e794d1f615e432a (diff)
downloadnx-libs-166102e072073282768bd4b66c982b49b490284f.tar.gz
nx-libs-166102e072073282768bd4b66c982b49b490284f.tar.bz2
nx-libs-166102e072073282768bd4b66c982b49b490284f.zip
Clipboard.c: use macros instead of hardcoced values for timeouts
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 3a5488d18..5cc59e3b3 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -146,6 +146,17 @@ static char szAgentCOMPOUND_TEXT[] = "COMPOUND_TEXT";
static char szAgentUTF8_STRING[] = "UTF8_STRING";
static char szAgentNX_CUT_BUFFER_CLIENT[] = "NX_CUT_BUFFER_CLIENT";
+/* number of milliseconds to wait for a conversion from the real X server. */
+#define CONVERSION_TIMEOUT 5000
+
+#ifdef DEBUG
+/*
+ * Time window (milliseconds) within to detect multiple conversion
+ * calls of the same client.
+ */
+#define ACCUM_TIME 5000
+#endif
+
/*
* some helpers for debugging output
*/
@@ -1698,7 +1709,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
fprintf(stderr, "%s: lastClientWindowPtr != NULL.\n", __func__);
#endif
- if ((GetTimeInMillis() - lastClientReqTime) >= 5000)
+ if ((GetTimeInMillis() - lastClientReqTime) >= CONVERSION_TIMEOUT)
{
#ifdef DEBUG
fprintf(stderr, "%s: timeout expired on last request, "
@@ -1814,7 +1825,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
}
#ifdef DEBUG
- if (lastClientClientPtr == client && (GetTimeInMillis() - lastClientReqTime < 5000))
+ if (lastClientClientPtr == client && (GetTimeInMillis() - lastClientReqTime < ACCUM_TIME))
{
/*
* The same client made consecutive requests of clipboard content
@@ -1858,7 +1869,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
lastClientTarget = target;
/* if the last client request time is more than 5s ago update it. Why? */
- if ((GetTimeInMillis() - lastClientReqTime) >= 5000)
+ if ((GetTimeInMillis() - lastClientReqTime) >= CONVERSION_TIMEOUT)
lastClientReqTime = GetTimeInMillis();
if (selection == MakeAtom("CLIPBOARD", 9, 0))