aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-11-17 11:47:39 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-01-05 23:36:01 +0100
commitfba367160b09aee08cb2ec96dc86e32f56e7fa44 (patch)
treea4fc9dfbc0561822e1383392f6f33925e56a3fb7
parent057ce728fcb43e6b91a54f98f6f6d9ed8fe680a6 (diff)
downloadnx-libs-fba367160b09aee08cb2ec96dc86e32f56e7fa44.tar.gz
nx-libs-fba367160b09aee08cb2ec96dc86e32f56e7fa44.tar.bz2
nx-libs-fba367160b09aee08cb2ec96dc86e32f56e7fa44.zip
Clipboard.c: refactor nxagent*SelectionOwner
expect an index instead of a pointer All calls referenced lastSelectionOwner so let the function directly use it and only pass the required index.
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index b42396731..da0899dd7 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -493,21 +493,30 @@ Bool nxagentValidServerTargets(XlibAtom target)
return False;
}
-void nxagentClearSelectionOwner(SelectionOwner *owner)
+void nxagentInitSelectionOwner(int index, Atom selection)
{
- /* 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? */
+ lastSelectionOwner[index].selection = selection;
+ lastSelectionOwner[index].client = NullClient;
+ lastSelectionOwner[index].window = screenInfo.screens[0]->root->drawable.id;
+ lastSelectionOwner[index].windowPtr = NULL;
+ lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis();
}
-void nxagentStoreSelectionOwner(SelectionOwner *owner, Selection *sel)
+/* there's no owner on nxagent side anymore */
+void nxagentClearSelectionOwner(int index)
{
- owner->client = sel->client;
- owner->window = sel->window;
- owner->windowPtr = sel->pWin;
- owner->lastTimeChanged = GetTimeInMillis();
+ lastSelectionOwner[index].client = NULL;
+ lastSelectionOwner[index].window = None;
+ lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis();
+ /* FIXME: why is windowPtr not cleared in the function? */
+}
+
+void nxagentStoreSelectionOwner(int index, Selection *sel)
+{
+ lastSelectionOwner[index].client = sel->client;
+ lastSelectionOwner[index].window = sel->window;
+ lastSelectionOwner[index].windowPtr = sel->pWin;
+ lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis();
}
void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
@@ -534,7 +543,7 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
#endif
/* FIXME: why is windowPtr not cleared in the function? */
- nxagentClearSelectionOwner(&lastSelectionOwner[i]);
+ nxagentClearSelectionOwner(i);
lastSelectionOwner[i].windowPtr = NULL;
lastClientWindowPtr = NULL;
@@ -618,7 +627,7 @@ void nxagentClearSelection(XEvent *X)
CurrentSelections[i].window = screenInfo.screens[0]->root->drawable.id;
CurrentSelections[i].client = NullClient;
- nxagentClearSelectionOwner(&lastSelectionOwner[i]);
+ nxagentClearSelectionOwner(i);
}
lastClientWindowPtr = NULL;
@@ -1418,7 +1427,7 @@ void nxagentResetSelectionOwner(void)
fprintf(stderr, "%s: Reset selection state for selection [%d].\n", __func__, i);
#endif
- nxagentClearSelectionOwner(&lastSelectionOwner[i]);
+ nxagentClearSelectionOwner(i);
lastSelectionOwner[i].windowPtr = NULL;
}
@@ -1570,7 +1579,7 @@ void nxagentSetSelectionOwner(Selection *pSelection)
* points to the struct that contains all information about the
* owner window.
*/
- nxagentStoreSelectionOwner(&lastSelectionOwner[i], pSelection);
+ nxagentStoreSelectionOwner(i, pSelection);
}
}
@@ -2009,15 +2018,6 @@ WindowPtr nxagentGetClipboardWindow(Atom property)
}
}
-void nxagentInitSelectionOwner(SelectionOwner *owner, Atom selection)
-{
- owner->selection = selection;
- owner->client = NullClient;
- owner->window = screenInfo.screens[0]->root->drawable.id;
- owner->windowPtr = NULL;
- owner->lastTimeChanged = GetTimeInMillis();
-}
-
int nxagentInitClipboard(WindowPtr pWin)
{
Window iWindow = nxagentWindow(pWin);
@@ -2037,8 +2037,8 @@ int nxagentInitClipboard(WindowPtr pWin)
serverTIMESTAMP = nxagentAtoms[11]; /* TIMESTAMP */
- nxagentInitSelectionOwner(&lastSelectionOwner[nxagentPrimarySelection], XA_PRIMARY);
- nxagentInitSelectionOwner(&lastSelectionOwner[nxagentClipboardSelection], nxagentAtoms[10]); /* CLIPBOARD */
+ nxagentInitSelectionOwner(nxagentPrimarySelection, XA_PRIMARY);
+ nxagentInitSelectionOwner(nxagentClipboardSelection, nxagentAtoms[10]); /* CLIPBOARD */
#ifdef NXAGENT_TIMESTAMP
{
@@ -2143,8 +2143,8 @@ int nxagentInitClipboard(WindowPtr pWin)
}
else
{
- lastSelectionOwner[nxagentPrimarySelection].client = NULL;
- lastSelectionOwner[nxagentClipboardSelection].client = NULL;
+ nxagentClearSelectionOwner(nxagentPrimarySelection);
+ nxagentClearSelectionOwner(nxagentClipboardSelection);
lastServerRequestor = None;