From bf0e05fd166012b5fb38eb7533c27359b8d954f3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 12 Oct 2020 20:12:28 +0200 Subject: Clipboard.c: restructure request accumulation code --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 39 +++++++++++++++----------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index cd3a890d0..30b781590 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -2080,27 +2080,32 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, return 1; } - if (lastClients[index].clientPtr == client && (GetTimeInMillis() - lastClients[index].reqTime < ACCUM_TIME)) + if (lastClients[index].clientPtr == client) { - /* - * The same client made consecutive requests of clipboard content - * with less than 5 seconds time interval between them. - */ - #ifdef DEBUG - fprintf(stderr, "%s: Consecutives request from client %s selection [%u] " - "elapsed time [%u] clientAccum [%d]\n", __func__, nxagentClientInfoString(client), - selection, GetTimeInMillis() - lastClients[index].reqTime, clientAccum); - #endif - - clientAccum++; + if (GetTimeInMillis() - lastClients[index].reqTime < ACCUM_TIME) + { + /* + * The same client made consecutive requests of clipboard content + * with less than 5 seconds time interval between them. + */ + #ifdef DEBUG + fprintf(stderr, "%s: Consecutives request from client %s selection [%u] " + "elapsed time [%u] clientAccum [%d]\n", __func__, + nxagentClientInfoString(client), + selection, GetTimeInMillis() - lastClients[index].reqTime, + clientAccum); + #endif + + clientAccum++; + } } else { - /* reset clientAccum as now another client requested the clipboard content */ - if (lastClients[index].clientPtr != client) - { - clientAccum = 0; - } + /* + * reset clientAccum as now another client requested the clipboard + * content + */ + clientAccum = 0; } if (target == clientTEXT || -- cgit v1.2.3