aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-11-22 00:24:35 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-01-05 23:36:02 +0100
commit6c0536a20b965ddb1de8ca00d8919d8c43bf109b (patch)
treee613b7e167536678ba7af363d3c47ef7481f0e7b
parent2b59a199332809722e5fceb891b6845f328054bc (diff)
downloadnx-libs-6c0536a20b965ddb1de8ca00d8919d8c43bf109b.tar.gz
nx-libs-6c0536a20b965ddb1de8ca00d8919d8c43bf109b.tar.bz2
nx-libs-6c0536a20b965ddb1de8ca00d8919d8c43bf109b.zip
Clipboard.c: introduce helper macro IS_INTERNAL_OWNER
Using this macro makes the code more readable
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 6b8123643..cef663033 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -98,6 +98,8 @@ typedef struct _SelectionOwner
static SelectionOwner *lastSelectionOwner;
static XlibAtom nxagentLastRequestedSelection;
+#define IS_INTERNAL_OWNER(lsoindex) (lastSelectionOwner[lsoindex].client != NULL)
+
/*
* Needed to handle the notify selection event to
* be sent to client once the selection property
@@ -661,7 +663,7 @@ void nxagentClearSelection(XEvent *X)
if (i < nxagentMaxSelections)
{
- if (lastSelectionOwner[i].client != NULL)
+ if (IS_INTERNAL_OWNER(i))
{
/* send a SelectionClear event to (our) previous owner */
xEvent x = {0};
@@ -888,7 +890,7 @@ void nxagentRequestSelection(XEvent *X)
int i = nxagentFindLastSelectionOwnerIndex(X->xselectionrequest.selection);
if (i < nxagentMaxSelections)
{
- if ((lastClientWindowPtr != NULL) && (lastSelectionOwner[i].client != NULL))
+ if (lastClientWindowPtr != NULL && IS_INTERNAL_OWNER(i))
{
/*
* Request the real X server to transfer the selection content
@@ -910,7 +912,7 @@ void nxagentRequestSelection(XEvent *X)
* the selection to the clientCutProperty on nxagent's root
* window
*/
- if (lastSelectionOwner[i].client != NULL &&
+ if (IS_INTERNAL_OWNER(i) &&
nxagentOption(Clipboard) != ClipboardClient)
{
/*
@@ -1361,9 +1363,9 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
if (i < nxagentMaxSelections)
{
/* if the last owner was an internal one */
- if ((lastSelectionOwner[i].client != NULL) &&
- (lastSelectionOwner[i].windowPtr != NULL) &&
- (X->xselection.property == serverClientCutProperty))
+ if (IS_INTERNAL_OWNER(i) &&
+ lastSelectionOwner[i].windowPtr != NULL &&
+ X->xselection.property == serverClientCutProperty)
{
Atom atomReturnType;
int resultFormat;
@@ -1725,8 +1727,8 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
for (int i = 0; i < nxagentMaxSelections; i++)
{
- if ((selection == CurrentSelections[i].selection) &&
- (lastSelectionOwner[i].client != NULL))
+ if (selection == CurrentSelections[i].selection &&
+ IS_INTERNAL_OWNER(i))
{
/*
* There is a client owner on the agent side, let normal dix stuff happen.
@@ -2248,7 +2250,7 @@ Bool nxagentInitClipboard(WindowPtr pWin)
* claim the ownership. Note that we report our serverWindow as
* owner, not the real window!
*/
- if (lastSelectionOwner[i].client && lastSelectionOwner[i].window)
+ if (IS_INTERNAL_OWNER(i) && lastSelectionOwner[i].window)
{
XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, serverWindow, CurrentTime);
}