Commit 5540a149 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Clipboard.c: add nxagentMatchSelectionOwner helper function

parent 1feb4985
...@@ -519,6 +519,12 @@ void nxagentStoreSelectionOwner(int index, Selection *sel) ...@@ -519,6 +519,12 @@ void nxagentStoreSelectionOwner(int index, Selection *sel)
lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis(); lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis();
} }
Bool nxagentMatchSelectionOwner(int index, ClientPtr pClient, WindowPtr pWindow)
{
return ((pClient && lastSelectionOwner[index].client == pClient) ||
(pWindow && lastSelectionOwner[index].windowPtr == pWindow));
}
void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -534,8 +540,7 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) ...@@ -534,8 +540,7 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
for (int i = 0; i < nxagentMaxSelections; i++) for (int i = 0; i < nxagentMaxSelections; i++)
{ {
if ((pClient != NULL && lastSelectionOwner[i].client == pClient) || if (nxagentMatchSelectionOwner(i, pClient, pWindow))
(pWindow != NULL && lastSelectionOwner[i].windowPtr == pWindow))
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Resetting state with client [%p] window [%p].\n", __func__, fprintf(stderr, "%s: Resetting state with client [%p] window [%p].\n", __func__,
......
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