Commit 8574c233 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Clipboard.c: split combined check

By splitting it up we can print appropriate debug messages. More important: The code tried to handle the special targets for all other cases where it should only deny the request.
parent 28f07b52
...@@ -736,19 +736,31 @@ void nxagentRequestSelection(XEvent *X) ...@@ -736,19 +736,31 @@ void nxagentRequestSelection(XEvent *X)
return; return;
} }
/* /* lastServerRequestor in non-NULL (= we are currenty in the transfer phase) */
* check if this request needs special treatment by checking if (lastServerRequestor != None)
* if any of the following is true: {
* - this is a special request like TARGETS or TIMESTAMP #ifdef DEBUG
* - lastServerRequestor in non-NULL (= we are currenty in the transfer phase) fprintf(stderr, "%s: denying additional request during transfer phase.\n", __func__);
* - the selection in this request is none we own. #endif
* In all cases we'll send back a SelectionNotify event with an
* appropriate answer nxagentReplyRequestSelection(X, False);
*/ return;
if (!nxagentValidServerTargets(X->xselectionrequest.target) || }
(lastServerRequestor != None) ||
((X->xselectionrequest.selection != lastSelectionOwner[nxagentPrimarySelection].selection) && /* the selection in this request is none we own. */
(X->xselectionrequest.selection != lastSelectionOwner[nxagentClipboardSelection].selection))) if ((X->xselectionrequest.selection != lastSelectionOwner[nxagentPrimarySelection].selection) &&
(X->xselectionrequest.selection != lastSelectionOwner[nxagentClipboardSelection].selection))
{
#ifdef DEBUG
fprintf(stderr, "%s: not owning selection [%ld] - denying request.\n", __func__, X->xselectionrequest.selection);
#endif
nxagentReplyRequestSelection(X, False);
return;
}
/* this is a special request like TARGETS or TIMESTAMP */
if (!nxagentValidServerTargets(X->xselectionrequest.target))
{ {
if (X->xselectionrequest.target == serverTARGETS) if (X->xselectionrequest.target == serverTARGETS)
{ {
...@@ -830,15 +842,21 @@ void nxagentRequestSelection(XEvent *X) ...@@ -830,15 +842,21 @@ void nxagentRequestSelection(XEvent *X)
} }
else else
{ {
/* deny the request */ /*
* unknown special request - probably bug! Check if this code handles all cases
* that are handled in nxagentValidServerTargets!
*/
#ifdef DEBUG
fprintf(stderr, "%s: unknown special target [%ld] - denying request.\n", __func__, X->xselectionrequest.target);
#endif
nxagentReplyRequestSelection(X, False); nxagentReplyRequestSelection(X, False);
} }
return; return;
} }
/* /*
* reaching this means the request is neither a special request nor * reaching this means the request is a normal, valid request. We
* invalid. We can process it now. * can process it now.
*/ */
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment