[X2Go-Commits] [nx-libs] 367/429: Clipboard.c: correctly pass back failure to real X server

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:37:09 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 41ea3b68425f45bdcd90a21baa84506f48332782
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Tue Nov 17 16:20:20 2020 +0100

    Clipboard.c: correctly pass back failure to real X server
---
 nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 68 +++++++++++++++++---------
 1 file changed, 46 insertions(+), 22 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 10dafcda6..ceed43aa9 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -2594,33 +2594,57 @@ int nxagentSendNotificationToSelfViaXServer(xEvent *event)
   else
   {
     /*
-     * Setup selection notify event to real server.
-     *
-     * .property must be a server-side Atom. As this property is only
-     * set on our serverWindow and normally there are few other
-     * properties except serverTransToAgentProperty, the only thing
-     * we need to ensure is that the internal Atom clientCutProperty
-     * differs from the server-side serverTransToAgentProperty
-     * Atom. The actual name is not important. To be clean here we use
-     * a separate serverTransFromAgentProperty.
+     * if the property is 0 (reporting failure) we can directly
+     * answer to the lastServer about the failure!
      */
+    if (lastServers[index].requestor != None && event->u.selectionNotify.property == 0)
+    {
+      #ifdef DEBUG
+      fprintf(stderr, "%s: passing on failure to lastServers[%d].requestor [%ld].\n", __func__,
+                  index, lastServers[index].requestor);
+      #endif
 
-    XSelectionEvent eventSelection = {
-      .requestor = serverWindow,
-      .selection = translateLocalToRemoteSelection(event->u.selectionNotify.selection),
-      .target    = translateLocalToRemoteTarget(event->u.selectionNotify.target),
-      .property  = serverTransFromAgentProperty,
-      .time      = CurrentTime,
-    };
+      XSelectionEvent eventSelection = {
+        .requestor = lastServers[index].requestor,
+        .selection = remSelAtoms[index],
+        .target    = lastServers[index].target,
+        .property  = 0,
+        .time      = lastServers[index].time,
+      };
+      sendSelectionNotifyEventToXServer(&eventSelection);
 
-    #ifdef DEBUG
-    fprintf(stderr, "%s: remote property [%ld][%s].\n", __func__,
-                serverTransFromAgentProperty, NameForRemAtom(serverTransFromAgentProperty));
-    #endif
+      lastServers[index].requestor = None;
+      return 1;
+    }
+    else
+    {
+      /*
+       * Setup selection notify event to real server.
+       *
+       * .property must be a server-side Atom. As this property is only
+       * set on our serverWindow and normally there are few other
+       * properties except serverTransToAgentProperty, the only thing
+       * we need to ensure is that the internal Atom clientCutProperty
+       * differs from the server-side serverTransToAgentProperty
+       * Atom. The actual name is not important. To be clean here we use
+       * a separate serverTransFromAgentProperty.
+       */
 
-    sendSelectionNotifyEventToXServer(&eventSelection);
+      XSelectionEvent eventSelection = {
+        .requestor = serverWindow,
+        .selection = translateLocalToRemoteSelection(event->u.selectionNotify.selection),
+        .target    = translateLocalToRemoteTarget(event->u.selectionNotify.target),
+        .property  = serverTransFromAgentProperty,
+        .time      = CurrentTime,
+      };
 
-    return 1;
+      #ifdef DEBUG
+      fprintf(stderr, "%s: remote property [%ld][%s].\n", __func__,
+                  serverTransFromAgentProperty, NameForRemAtom(serverTransFromAgentProperty));
+      #endif
+      sendSelectionNotifyEventToXServer(&eventSelection);
+      return 1;
+    }
   }
 }
 

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