diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2020-09-22 23:33:35 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2021-06-20 20:12:50 +0200 |
commit | e526e1cd0fec37b35a746d600170e923e8e86041 (patch) | |
tree | 0af38ae8c15c89e8062a68f2ee28a876f5ee4caa | |
parent | 4701db7bcf0c66f153c172aa9a31197ab4a48bbd (diff) | |
download | nx-libs-e526e1cd0fec37b35a746d600170e923e8e86041.tar.gz nx-libs-e526e1cd0fec37b35a746d600170e923e8e86041.tar.bz2 nx-libs-e526e1cd0fec37b35a746d600170e923e8e86041.zip |
Clipboard.c: fix nxagentConvertSelection
- debug output was not printed at the beginning but later and
was therefore missing sometimes
- add comments/FIXMEs
- re-enable failure notification for second call
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 60792bb44..fe6d39281 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -1863,6 +1863,24 @@ FIXME int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, Window requestor, Atom property, Atom target, Time time) { + const char *strTarget = NameForAtom(target); + + #ifdef DEBUG + fprintf(stderr, "%s: client %s requests sel [%s] " + "on window [0x%x] prop [%d][%s] target [%d][%s].\n", __func__, + nxagentClientInfoString(client), validateString(NameForAtom(selection)), requestor, + property, validateString(NameForAtom(property)), + target, validateString(strTarget)); + #endif + + if (strTarget == NULL) + { + #ifdef DEBUG + fprintf(stderr, "%s: cannot find name for target Atom [%d] - returning\n", __func__, target); + #endif + return 1; + } + if (!agentClipboardInitialized) { #ifdef DEBUG @@ -1915,20 +1933,22 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, if ((GetTimeInMillis() - lastClients[index].reqTime) >= CONVERSION_TIMEOUT) { #ifdef DEBUG - fprintf(stderr, "%s: timeout expired on last request, " + fprintf(stderr, "%s: timeout expired on previous request, " "notifying failure to client %s\n", __func__, nxagentClientInfoString(client)); #endif /* notify the waiting client of failure */ endTransfer(SELECTION_FAULT, index); - return 1; + + /* do NOT return here but process the new request instead! */ } else { /* * we got another convert request while already waiting for an - * answer from the real X server to a previous convert request, - * which we cannot handle (yet). So return an error. + * answer from the real X server to a previous convert request + * for this selection, which we cannot handle (yet). So return + * an error for the new request. */ #ifdef DEBUG fprintf(stderr, "%s: got new request " @@ -1943,24 +1963,6 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, } } - const char *strTarget = NameForAtom(target); - - #ifdef DEBUG - fprintf(stderr, "%s: client %s requests sel [%s] " - "on window [0x%x] prop [%d][%s] target [%d][%s].\n", __func__, - nxagentClientInfoString(client), validateString(NameForAtom(selection)), requestor, - property, validateString(NameForAtom(property)), - target, validateString(strTarget)); - #endif - - if (strTarget == NULL) - { - #ifdef DEBUG - fprintf(stderr, "%s: cannot find name for target Atom [%d] - returning\n", __func__, target); - #endif - return 1; - } - /* * The selection request target is TARGETS. The requestor is asking * for a list of supported data formats. |