[X2Go-Commits] [nx-libs] 338/429: Clipboard.c: drop clientCLIPBOARD

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:37:01 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 59ee58ee79d948223e74c2a8a745565da95c64aa
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Tue Oct 13 00:14:49 2020 +0200

    Clipboard.c: drop clientCLIPBOARD
    
    read the value from the intSelAtoms array instead
---
 nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 28 +++++++++++++-------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index a92573f9d..3d33cb931 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -152,7 +152,6 @@ static Atom     clientTIMESTAMP;
 static Atom     clientTEXT;
 static Atom     clientCOMPOUND_TEXT;
 static Atom     clientUTF8_STRING;
-static Atom     clientCLIPBOARD;
 
 static char     szAgentTARGETS[] = "TARGETS";
 static char     szAgentTEXT[] = "TEXT";
@@ -1792,8 +1791,8 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data,
 
     if (pCurSel->pWin != NULL &&
         nxagentOption(Clipboard) != ClipboardNone && /* FIXME: shouldn't we also check for != ClipboardClient? */
-        (pCurSel->selection == XA_PRIMARY ||
-         pCurSel->selection == clientCLIPBOARD))
+        (pCurSel->selection == intSelAtoms[nxagentPrimarySelection] ||
+         pCurSel->selection == intSelAtoms[nxagentClipboardSelection]))
     {
       #ifdef DEBUG
       fprintf(stderr, "%s: calling setSelectionOwnerOnXServer\n", __func__);
@@ -2181,20 +2180,22 @@ XlibAtom translateLocalToRemoteSelection(Atom local)
    * XInternAtom(nxagentDisplay, "CLIPBOARD", 1), which is stored in
    * remSelAtoms[nxagentClipboardSelection]. For
    * PRIMARY there's nothing to map because that is identical on all
-   * X servers (defined in Xatom.h).
+   * X servers (defined in Xatom.h). We do it anyway so we do not
+   * require a special treatment.
    */
 
-  XlibAtom remote;
+  XlibAtom remote = -1;
 
-  if (local == XA_PRIMARY)
-  {
-    remote = XA_PRIMARY;
-  }
-  else if (local == clientCLIPBOARD)
+  for (int index = 0; index < nxagentMaxSelections; index++)
   {
-    remote = remSelAtoms[nxagentClipboardSelection];
+    if (local == intSelAtoms[index])
+    {
+      remote = remSelAtoms[index];
+      break;
+    }
   }
-  else
+
+  if (remote == -1)
   {
     remote = nxagentLocalToRemoteAtom(local);
   }
@@ -2396,7 +2397,6 @@ Bool nxagentInitClipboard(WindowPtr pWin)
   {
     /* cannot move that down to others - we need it for
      * initSelectionOwnerData ! */
-    clientCLIPBOARD = MakeAtom(szAgentCLIPBOARD, strlen(szAgentCLIPBOARD), True);
     clientTARGETS = MakeAtom(szAgentTARGETS, strlen(szAgentTARGETS), True);
     clientTEXT = MakeAtom(szAgentTEXT, strlen(szAgentTEXT), True);
     clientCOMPOUND_TEXT = MakeAtom(szAgentCOMPOUND_TEXT, strlen(szAgentCOMPOUND_TEXT), True);
@@ -2434,7 +2434,7 @@ Bool nxagentInitClipboard(WindowPtr pWin)
       FatalError("nxagentInitClipboard: Failed to allocate memory for the internal selection Atoms array.\n");
     }
     intSelAtoms[nxagentPrimarySelection] = XA_PRIMARY;
-    intSelAtoms[nxagentClipboardSelection] = clientCLIPBOARD;
+    intSelAtoms[nxagentClipboardSelection] = MakeAtom(szAgentCLIPBOARD, strlen(szAgentCLIPBOARD), True);
 
     SAFE_free(remSelAtoms);
     remSelAtoms = (XlibAtom *) calloc(nxagentMaxSelections, sizeof(XlibAtom));

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