Commit 79867f4a authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Clipboard.c: introduce nxagent{Clear,Store}SelectionOwner

parent 6621c53c
...@@ -464,6 +464,23 @@ Bool nxagentValidServerTargets(Atom target) ...@@ -464,6 +464,23 @@ Bool nxagentValidServerTargets(Atom target)
return False; 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) void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -487,10 +504,9 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) ...@@ -487,10 +504,9 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
(void *) pClient, (void *) pWindow); (void *) pClient, (void *) pWindow);
#endif #endif
lastSelectionOwner[i].client = NULL; /* FIXME: why is windowPtr not cleared in the function? */
lastSelectionOwner[i].window = None; nxagentClearSelectionOwner(&lastSelectionOwner[i]);
lastSelectionOwner[i].windowPtr = NULL; lastSelectionOwner[i].windowPtr = NULL;
lastSelectionOwner[i].lastTimeChanged = GetTimeInMillis();
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
SetClientSelectionStage(None); SetClientSelectionStage(None);
...@@ -547,9 +563,7 @@ void nxagentClearSelection(XEvent *X) ...@@ -547,9 +563,7 @@ void nxagentClearSelection(XEvent *X)
CurrentSelections[i].window = screenInfo.screens[0]->root->drawable.id; CurrentSelections[i].window = screenInfo.screens[0]->root->drawable.id;
CurrentSelections[i].client = NullClient; CurrentSelections[i].client = NullClient;
lastSelectionOwner[i].client = NULL; nxagentClearSelectionOwner(&lastSelectionOwner[i]);
lastSelectionOwner[i].window = None;
lastSelectionOwner[i].lastTimeChanged = GetTimeInMillis();
} }
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
...@@ -1221,10 +1235,8 @@ void nxagentResetSelectionOwner(void) ...@@ -1221,10 +1235,8 @@ void nxagentResetSelectionOwner(void)
fprintf(stderr, "%s: Reset clipboard state.\n", __func__); fprintf(stderr, "%s: Reset clipboard state.\n", __func__);
#endif #endif
lastSelectionOwner[i].client = NULL; nxagentClearSelectionOwner(&lastSelectionOwner[i]);
lastSelectionOwner[i].window = None;
lastSelectionOwner[i].windowPtr = NULL; lastSelectionOwner[i].windowPtr = NULL;
lastSelectionOwner[i].lastTimeChanged = GetTimeInMillis();
} }
lastClientWindowPtr = NULL; lastClientWindowPtr = NULL;
...@@ -1352,10 +1364,7 @@ void nxagentSetSelectionOwner(Selection *pSelection) ...@@ -1352,10 +1364,7 @@ void nxagentSetSelectionOwner(Selection *pSelection)
*/ */
XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, serverWindow, CurrentTime); XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, serverWindow, CurrentTime);
lastSelectionOwner[i].client = pSelection->client; nxagentStoreSelectionOwner(&lastSelectionOwner[i], pSelection);
lastSelectionOwner[i].window = pSelection->window;
lastSelectionOwner[i].windowPtr = pSelection->pWin;
lastSelectionOwner[i].lastTimeChanged = GetTimeInMillis();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment