[X2Go-Commits] [nx-libs] 413/429: Clipboard.c: extend setSelectionOwnerOnXServer()

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:37:17 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 423caaf0ff8826449734a04dc9038b552e6c15e5
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Wed Jun 16 23:48:32 2021 +0200

    Clipboard.c: extend setSelectionOwnerOnXServer()
    
    to let it handle a SelectionClear automatically.
---
 nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 4e95c024d..c200ad64c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -2296,11 +2296,6 @@ static void setSelectionOwnerOnXServer(Selection *pSelection)
     return;
   }
 
-  #ifdef DEBUG
-  fprintf(stderr, "%s: Setting selection owner to serverwindow ([0x%lx]).\n", __func__,
-              serverWindow);
-  #endif
-
   int index = nxagentFindCurrentSelectionIndex(pSelection->selection);
   if (index != -1)
   {
@@ -2312,7 +2307,7 @@ static void setSelectionOwnerOnXServer(Selection *pSelection)
                 lastSelectionOwner[index].window, pSelection->window);
     fprintf(stderr, "%s: lastSelectionOwner.windowPtr [%p] -> [%p] [0x%x] (serverWindow: [0x%lx])\n", __func__,
                 (void *)lastSelectionOwner[index].windowPtr, (void *)pSelection->pWin,
-                    nxagentWindow(pSelection->pWin), serverWindow);
+                    pSelection->pWin ? nxagentWindow(pSelection->pWin) : 0, serverWindow);
     fprintf(stderr, "%s: lastSelectionOwner.lastTimeChanged [%u]\n", __func__,
                 lastSelectionOwner[index].lastTimeChanged);
     #endif
@@ -2342,8 +2337,16 @@ static void setSelectionOwnerOnXServer(Selection *pSelection)
      * watch clipboard ownership changes, clipboard owners should
      * reacquire the clipboard whenever the content or metadata (e.g
      * the list of supported targets) changes."
+     * If pWin is NULL this is a SelectionClear.
      */
-    XSetSelectionOwner(nxagentDisplay, remoteSelectionAtoms[index], serverWindow, CurrentTime);
+    #ifdef DEBUG
+    if (pSelection->pWin)
+    {
+      fprintf(stderr, "%s: Setting selection owner to serverwindow ([0x%lx]).\n", __func__,
+                  serverWindow);
+    }
+    #endif
+    XSetSelectionOwner(nxagentDisplay, remoteSelectionAtoms[index], pSelection->pWin ? serverWindow : 0, CurrentTime);
 
     /*
      * The real owner window (inside nxagent) is stored in

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