From 278ebeb70d7183ba62c6bbbcfce08ff08e205117 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 3 Oct 2020 01:24:11 +0200 Subject: Clipboard.c: split if clause this allows better error messages --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'nx-X11/programs/Xserver') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index da07cad40..202eb1baa 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -1003,15 +1003,24 @@ void nxagentHandleSelectionRequestFromXServer(XEvent *X) else #endif { + if (!(nxagentOption(Clipboard) == ClipboardServer || + nxagentOption(Clipboard) == ClipboardBoth)) + { + #ifdef DEBUG + fprintf (stderr, "%s: clipboard (partly) disabled - denying request.\n", __func__); + #endif + + /* deny the request */ + replyRequestSelectionToXServer(X, False); + } + /* * if one of our clients owns the selection we ask it to copy * the selection to the clientCutProperty on nxagent's root * window in the first step. We then later push that property's * content to the real X server. */ - if (IS_INTERNAL_OWNER(index) && - (nxagentOption(Clipboard) == ClipboardServer || - nxagentOption(Clipboard) == ClipboardBoth)) + if (IS_INTERNAL_OWNER(index)) { /* * store who on the real X server requested the data and how @@ -1061,9 +1070,18 @@ void nxagentHandleSelectionRequestFromXServer(XEvent *X) x.u.selectionRequest.requestor, x.u.selectionRequest.selection, NameForAtom(x.u.selectionRequest.selection)); #endif + /* no reply to Xserver yet - we will do that once the answer of + the above sendEventToClient arrives */ } else { + #ifdef DEBUG + char *s = XGetAtomName(nxagentDisplay, X->xselectionrequest.selection); + fprintf (stderr, "%s: no internal owner for selection [%ld][%s] - denying request.\n", __func__, + X->xselectionrequest.selection, s); + SAFE_XFree(s); + #endif + /* deny the request */ replyRequestSelectionToXServer(X, False); } -- cgit v1.2.3