aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-08-05 15:51:42 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-09-29 17:44:07 +0200
commit79867f4a0ee04c40a35402435902abe9849dcd93 (patch)
tree8a52d45731d3557dc396389a1ad18c574a2445e1 /nx-X11/programs/Xserver
parent6621c53c554b654f21c92ee09d1341c788d3a047 (diff)
downloadnx-libs-79867f4a0ee04c40a35402435902abe9849dcd93.tar.gz
nx-libs-79867f4a0ee04c40a35402435902abe9849dcd93.tar.bz2
nx-libs-79867f4a0ee04c40a35402435902abe9849dcd93.zip
Clipboard.c: introduce nxagent{Clear,Store}SelectionOwner
Diffstat (limited to 'nx-X11/programs/Xserver')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 5f948eeea..a5dade03e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -464,6 +464,23 @@ Bool nxagentValidServerTargets(Atom target)
return False;
}
+void nxagentClearSelectionOwner(SelectionOwner *owner)
+{
+ /* there's no owner on nxagent side anymore */
+ owner->client = NULL;
+ owner->window = None;
+ owner->lastTimeChanged = GetTimeInMillis();
+ /* FIXME: why is windowPtr not cleared in the function? */
+}
+
+void nxagentStoreSelectionOwner(SelectionOwner *owner, Selection *sel)
+{
+ owner->client = sel->client;
+ owner->window = sel->window;
+ owner->windowPtr = sel->pWin;
+ owner->lastTimeChanged = GetTimeInMillis();
+}
+
void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
{
#ifdef DEBUG
@@ -487,10 +504,9 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
(void *) pClient, (void *) pWindow);
#endif
- lastSelectionOwner[i].client = NULL;
- lastSelectionOwner[i].window = None;
+ /* FIXME: why is windowPtr not cleared in the function? */
+ nxagentClearSelectionOwner(&lastSelectionOwner[i]);
lastSelectionOwner[i].windowPtr = NULL;
- lastSelectionOwner[i].lastTimeChanged = GetTimeInMillis();
lastClientWindowPtr = NULL;
SetClientSelectionStage(None);
@@ -547,9 +563,7 @@ void nxagentClearSelection(XEvent *X)
CurrentSelections[i].window = screenInfo.screens[0]->root->drawable.id;
CurrentSelections[i].client = NullClient;
- lastSelectionOwner[i].client = NULL;
- lastSelectionOwner[i].window = None;
- lastSelectionOwner[i].lastTimeChanged = GetTimeInMillis();
+ nxagentClearSelectionOwner(&lastSelectionOwner[i]);
}
lastClientWindowPtr = NULL;
@@ -1221,10 +1235,8 @@ void nxagentResetSelectionOwner(void)
fprintf(stderr, "%s: Reset clipboard state.\n", __func__);
#endif
- lastSelectionOwner[i].client = NULL;
- lastSelectionOwner[i].window = None;
+ nxagentClearSelectionOwner(&lastSelectionOwner[i]);
lastSelectionOwner[i].windowPtr = NULL;
- lastSelectionOwner[i].lastTimeChanged = GetTimeInMillis();
}
lastClientWindowPtr = NULL;
@@ -1352,10 +1364,7 @@ void nxagentSetSelectionOwner(Selection *pSelection)
*/
XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, serverWindow, CurrentTime);
- lastSelectionOwner[i].client = pSelection->client;
- lastSelectionOwner[i].window = pSelection->window;
- lastSelectionOwner[i].windowPtr = pSelection->pWin;
- lastSelectionOwner[i].lastTimeChanged = GetTimeInMillis();
+ nxagentStoreSelectionOwner(&lastSelectionOwner[i], pSelection);
}
}