From 75acbbf299b57aeae993b73927fd8b727be94c81 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 23 Dec 2020 19:49:19 +0100 Subject: Clipboard.c: make index the first argument everywhere --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 68 +++++++++++++------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 8a5e3606c..d54171a0d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -305,11 +305,11 @@ XFixesAgentInfoRec nxagentXFixesInfo = { -1, -1, -1, False }; extern Display *nxagentDisplay; static Bool isTextTarget(XlibAtom target); -static void setClientSelectionStage(int stage, int index); -static void endTransfer(Bool success, int index); +static void setClientSelectionStage(int index, int stage); +static void endTransfer(int index, Bool success); #define SELECTION_SUCCESS True #define SELECTION_FAULT False -static void transferSelectionFromXServer(int resource, int index); +static void transferSelectionFromXServer(int index, int resource); #if 0 static void resetSelectionOwnerOnXServer(void); #endif @@ -508,7 +508,7 @@ static void resetClientSelectionStage(int index) lastClients[index].resource = -1; } -static void setClientSelectionStage(int stage, int index) +static void setClientSelectionStage(int index, int stage) { if (stage == SelectionStageNone) { @@ -721,14 +721,14 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) clearSelectionOwnerData(index); - setClientSelectionStage(SelectionStageNone, index); + setClientSelectionStage(index, SelectionStageNone); replyPendingRequestSelectionToXServer(index, False); } if (pWindow && pWindow == lastClients[index].windowPtr) { - setClientSelectionStage(SelectionStageNone, index); + setClientSelectionStage(index, SelectionStageNone); } } } @@ -885,7 +885,7 @@ void nxagentHandleSelectionClearFromXServer(XEvent *X) clearSelectionOwnerData(index); - setClientSelectionStage(SelectionStageNone, index); + setClientSelectionStage(index, SelectionStageNone); invalidateTargetCache(index); } @@ -1308,7 +1308,7 @@ void nxagentHandleSelectionRequestFromXServer(XEvent *X) * denied/failed" * Use SELECTION_SUCCESS and SELECTION_FAULT macros for success. */ -static void endTransfer(Bool success, int index) +static void endTransfer(int index, Bool success) { if (lastClients[index].clientPtr == NULL) { @@ -1338,10 +1338,10 @@ static void endTransfer(Bool success, int index) /* * Enable further requests from clients. */ - setClientSelectionStage(SelectionStageNone, index); + setClientSelectionStage(index, SelectionStageNone); } -static void transferSelectionFromXServer(int resource, int index) +static void transferSelectionFromXServer(int index, int resource) { #ifdef DEBUG fprintf(stderr, "%s: resource [%d] lastClients[%d].clientPtr->index [%d].\n", __func__, @@ -1355,7 +1355,7 @@ static void transferSelectionFromXServer(int resource, int index) resource, nxagentClientInfoString(lastClients[index].clientPtr)); #endif - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); return; } @@ -1406,12 +1406,12 @@ static void transferSelectionFromXServer(int resource, int index) nxagentClientInfoString(lastClients[index].clientPtr)); #endif - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); return; } - setClientSelectionStage(SelectionStageWaitSize, index); + setClientSelectionStage(index, SelectionStageWaitSize); NXFlushDisplay(nxagentDisplay, NXFlushLink); @@ -1463,12 +1463,12 @@ static void transferSelectionFromXServer(int resource, int index) nxagentClientInfoString(lastClients[index].clientPtr)); #endif - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); return; } - setClientSelectionStage(SelectionStageWaitData, index); + setClientSelectionStage(index, SelectionStageWaitData); /* we've seen situations where you had to move the mouse or press a key to let the transfer complete. Flushing here fixed it */ @@ -1557,7 +1557,7 @@ Bool nxagentCollectPropertyEventFromXServer(int resource) fprintf (stderr, "%s: Failed to get reply data.\n", __func__); #endif - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); } else if (resultFormat != 8 && resultFormat != 16 && resultFormat != 32) { @@ -1565,7 +1565,7 @@ Bool nxagentCollectPropertyEventFromXServer(int resource) fprintf(stderr, "%s: WARNING! Invalid property format.\n", __func__); #endif - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); } else { @@ -1585,7 +1585,7 @@ Bool nxagentCollectPropertyEventFromXServer(int resource) fprintf (stderr, "%s: data size is [0] - aborting selection notify procedure.\n", __func__); #endif - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); } else { @@ -1597,9 +1597,9 @@ Bool nxagentCollectPropertyEventFromXServer(int resource) * Request the selection data now. */ lastClients[index].propertySize = ulReturnBytesLeft; - setClientSelectionStage(SelectionStageQueryData, index); + setClientSelectionStage(index, SelectionStageQueryData); - transferSelectionFromXServer(resource, index); + transferSelectionFromXServer(index, resource); } break; } @@ -1617,7 +1617,7 @@ Bool nxagentCollectPropertyEventFromXServer(int resource) fprintf (stderr, "%s: not all content could be retrieved - [%lu] bytes left - aborting selection notify procedure.\n", __func__, ulReturnBytesLeft); #endif - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); } else { @@ -1635,7 +1635,7 @@ Bool nxagentCollectPropertyEventFromXServer(int resource) #endif /* operation failed */ - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); } else { @@ -1663,7 +1663,7 @@ Bool nxagentCollectPropertyEventFromXServer(int resource) cacheTargetsForInt(index, targets, numTargets); - endTransfer(SELECTION_SUCCESS, index); + endTransfer(index, SELECTION_SUCCESS); } } else @@ -1683,7 +1683,7 @@ Bool nxagentCollectPropertyEventFromXServer(int resource) pszReturnData); #endif - endTransfer(SELECTION_SUCCESS, index); + endTransfer(index, SELECTION_SUCCESS); } } break; @@ -1785,10 +1785,10 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) * tions. */ - setClientSelectionStage(SelectionStageQueryData, index); + setClientSelectionStage(index, SelectionStageQueryData); lastClients[index].propertySize = 262144; - transferSelectionFromXServer(lastClients[index].clientPtr -> index, index); + transferSelectionFromXServer(index, lastClients[index].clientPtr -> index); } else if (X->xselection.property == 0) { @@ -1796,7 +1796,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) fprintf(stderr, "%s: WARNING! Resetting selection transferral for client [%d] because of failure notification from real X server.\n", __func__, CLINDEX(lastClients[index].clientPtr)); #endif - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); } else { @@ -1804,7 +1804,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) fprintf(stderr, "%s: Unexpected property [%ld][%s] - reporting conversion failure.\n", __func__, X->xselection.property, NameForRemAtom(X->xselection.property)); #endif - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); } } else @@ -1814,7 +1814,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) CLINDEX(lastClients[index].clientPtr)); #endif - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); } } else @@ -2040,7 +2040,7 @@ static void resetSelectionOwnerOnXServer(void) clearSelectionOwnerData(index); - setClientSelectionStage(SelectionStageNone, index); + setClientSelectionStage(index, SelectionStageNone); /* Hmm, this is already None when reaching here */ lastServers[index].requestor = None; @@ -2213,7 +2213,7 @@ static void setSelectionOwnerOnXServer(Selection *pSelection) */ storeSelectionOwnerData(index, pSelection); - setClientSelectionStage(SelectionStageNone, index); + setClientSelectionStage(index, SelectionStageNone); /* * this will be repeated on reception of the SelectionOwner callback @@ -2241,7 +2241,7 @@ FIXME2: instead of XGetSelectionOwner we could check if the Xfixes lastSelectionOwnerWindow = pSelection->window; lastSelectionOwnerWindowPtr = pSelection->pWin; - setClientSelectionStage(SelectionStageNone); + setClientSelectionStage(index, SelectionStageNone); lastServers[index].requestor = None; } @@ -2337,7 +2337,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, #endif /* notify the waiting client of failure */ - endTransfer(SELECTION_FAULT, index); + endTransfer(index, SELECTION_FAULT); /* do NOT return here but process the new request instead! */ } @@ -2586,7 +2586,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, clientAccum = 0; } - setClientSelectionStage(SelectionStageNone, index); + setClientSelectionStage(index, SelectionStageNone); /* * store the original requestor, we need that later after -- cgit v1.2.3