From c8cec75860755be83c7f76b932bdbcadf6c2afbd Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 15 Feb 2020 00:52:39 +0100 Subject: Clipboard.c: drop notifyConvertFailure Moving the client check to sendSelectionNotifyEventToClient enables us to drop notifyConvertFailure. --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 39 ++++++++++---------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 185a916d2..6291d4003 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -241,9 +241,6 @@ static void initSelectionOwner(int index, Atom selection); static void clearSelectionOwner(int index); static void storeSelectionOwner(int index, Selection *sel); static Bool matchSelectionOwner(int index, ClientPtr pClient, WindowPtr pWindow); - -static void notifyConvertFailure(ClientPtr client, Window requestor, - Atom selection, Atom target, Time time); static void setSelectionOwner(Selection *pSelection); static int sendEventToClient(ClientPtr client, xEvent *pEvents); static void sendSelectionNotifyEventToClient(ClientPtr client, @@ -493,6 +490,18 @@ static void sendSelectionNotifyEventToClient(ClientPtr client, Atom target, Atom property) { + /* + * Check if the client is still valid. + */ + if (clients[client -> index] != client) + { + #ifdef WARNING + fprintf(stderr, "%s: WARNING! Invalid client pointer.", __func__); + #endif + + return; + } + xEvent x = {0}; x.u.u.type = SelectionNotify; x.u.selectionNotify.time = time; @@ -1714,24 +1723,6 @@ FIXME */ } -static void notifyConvertFailure(ClientPtr client, Window requestor, - Atom selection, Atom target, Time time) -{ - /* - * Check if the client is still valid. - */ - if (clients[client -> index] != client) - { - #ifdef WARNING - fprintf(stderr, "%s: WARNING! Invalid client pointer.", __func__); - #endif - - return; - } - - sendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); -} - /* * This is called from dix (ProcConvertSelection) if an nxagent client * issues a ConvertSelection request. So all the Atoms are internal @@ -1788,8 +1779,8 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, "notifying failure to client\n", __func__); #endif - notifyConvertFailure(lastClientClientPtr, lastClientRequestor, - lastClientSelection, lastClientTarget, lastClientTime); + sendSelectionNotifyEventToClient(lastClientClientPtr, lastClientTime, lastClientRequestor, + lastClientSelection, lastClientTarget, None); setClientSelectionStage(SelectionStageNone); } @@ -1805,7 +1796,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, "before timeout expired on last request, notifying failure to client\n", __func__); #endif - notifyConvertFailure(client, requestor, selection, target, time); + sendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); return 1; } -- cgit v1.2.3