aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2021-06-16 23:48:32 +0200
committerUlrich Sibiller <uli42@gmx.de>2021-06-20 20:12:51 +0200
commit423caaf0ff8826449734a04dc9038b552e6c15e5 (patch)
treefe70a5fed0af7322500b16ace8cf706e4155adb8
parent1c8869b92f4e46b608636c2f6839b317cd7ef150 (diff)
downloadnx-libs-423caaf0ff8826449734a04dc9038b552e6c15e5.tar.gz
nx-libs-423caaf0ff8826449734a04dc9038b552e6c15e5.tar.bz2
nx-libs-423caaf0ff8826449734a04dc9038b552e6c15e5.zip
Clipboard.c: extend setSelectionOwnerOnXServer()
to let it handle a SelectionClear automatically.
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c17
1 files 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