[X2Go-Commits] [nx-libs] 332/429: Clipboard.c: split if clause

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:36:59 CEST 2021


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit 278ebeb70d7183ba62c6bbbcfce08ff08e205117
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Sat Oct 3 01:24:11 2020 +0200

    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(-)

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);
     }

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list