aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-11-17 21:58:16 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-01-05 23:36:02 +0100
commit8574c233a601d7f864258ab06718e01c1eadc179 (patch)
tree8878cc2947571751b8f414febc259b364be5240e /nx-X11/programs
parent28f07b52638716bb57121ca2b7d7ed2d2bebf64c (diff)
downloadnx-libs-8574c233a601d7f864258ab06718e01c1eadc179.tar.gz
nx-libs-8574c233a601d7f864258ab06718e01c1eadc179.tar.bz2
nx-libs-8574c233a601d7f864258ab06718e01c1eadc179.zip
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.
Diffstat (limited to 'nx-X11/programs')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 3c74b7825..454cf1483 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -736,19 +736,31 @@ void nxagentRequestSelection(XEvent *X)
return;
}
- /*
- * check if this request needs special treatment by checking
- * if any of the following is true:
- * - this is a special request like TARGETS or TIMESTAMP
- * - lastServerRequestor in non-NULL (= we are currenty in the transfer phase)
- * - the selection in this request is none we own.
- * In all cases we'll send back a SelectionNotify event with an
- * appropriate answer
- */
- if (!nxagentValidServerTargets(X->xselectionrequest.target) ||
- (lastServerRequestor != None) ||
- ((X->xselectionrequest.selection != lastSelectionOwner[nxagentPrimarySelection].selection) &&
- (X->xselectionrequest.selection != lastSelectionOwner[nxagentClipboardSelection].selection)))
+ /* lastServerRequestor in non-NULL (= we are currenty in the transfer phase) */
+ if (lastServerRequestor != None)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "%s: denying additional request during transfer phase.\n", __func__);
+ #endif
+
+ nxagentReplyRequestSelection(X, False);
+ return;
+ }
+
+ /* the selection in this request is none we own. */
+ 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)
{
@@ -830,15 +842,21 @@ void nxagentRequestSelection(XEvent *X)
}
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);
}
return;
}
/*
- * reaching this means the request is neither a special request nor
- * invalid. We can process it now.
+ * reaching this means the request is a normal, valid request. We
+ * can process it now.
*/
/*