From 96523e64f38b42a82c2075f33b39b9be9f35106c Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 11 Apr 2025 17:52:46 +0200 Subject: [PATCH] xfixes: consolidate ProcXFixesSelectSelectionInput() No need to have it ripped into two pieces, just making upcoming changes more complicated. Signed-off-by: Enrico Weigelt, metux IT consult --- xfixes/select.c | 49 ++++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/xfixes/select.c b/xfixes/select.c index 1e8c7ee45..17b0cd8b1 100644 --- a/xfixes/select.c +++ b/xfixes/select.c @@ -116,26 +116,36 @@ CheckSelectionCallback(void) XFixesSelectionWindowDestroyNotifyMask |\ XFixesSelectionClientCloseNotifyMask) -static int -XFixesSelectSelectionInput(ClientPtr pClient, - Atom selection_name, WindowPtr pWindow, CARD32 eventMask) +int +ProcXFixesSelectSelectionInput(ClientPtr client) { + REQUEST(xXFixesSelectSelectionInputReq); + REQUEST_SIZE_MATCH(xXFixesSelectSelectionInputReq); + + WindowPtr pWindow; + int rc = dixLookupWindow(&pWindow, stuff->window, client, DixGetAttrAccess); + if (rc != Success) + return rc; + if (stuff->eventMask & ~SelectionAllEvents) { + client->errorValue = stuff->eventMask; + return BadValue; + } + void *val; - int rc; SelectionEventPtr *prev, e; Selection *selection; - rc = dixLookupSelection(&selection, selection_name, pClient, DixGetAttrAccess); + rc = dixLookupSelection(&selection, stuff->selection, client, DixGetAttrAccess); if (rc != Success) return rc; for (prev = &selectionEvents; (e = *prev); prev = &e->next) { if (e->selection == selection && - e->pClient == pClient && e->pWindow == pWindow) { + e->pClient == client && e->pWindow == pWindow) { break; } } - if (!eventMask) { + if (!stuff->eventMask) { if (e) { FreeResource(e->clientResource, 0); } @@ -148,9 +158,9 @@ XFixesSelectSelectionInput(ClientPtr pClient, e->next = 0; e->selection = selection; - e->pClient = pClient; + e->pClient = client; e->pWindow = pWindow; - e->clientResource = FakeClientID(pClient->index); + e->clientResource = FakeClientID(client->index); /* * Add a resource hanging from the window to @@ -175,29 +185,10 @@ XFixesSelectSelectionInput(ClientPtr pClient, return BadAlloc; } } - e->eventMask = eventMask; + e->eventMask = stuff->eventMask; return Success; } -int -ProcXFixesSelectSelectionInput(ClientPtr client) -{ - REQUEST(xXFixesSelectSelectionInputReq); - WindowPtr pWin; - int rc; - - REQUEST_SIZE_MATCH(xXFixesSelectSelectionInputReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); - if (rc != Success) - return rc; - if (stuff->eventMask & ~SelectionAllEvents) { - client->errorValue = stuff->eventMask; - return BadValue; - } - return XFixesSelectSelectionInput(client, stuff->selection, - pWin, stuff->eventMask); -} - int _X_COLD SProcXFixesSelectSelectionInput(ClientPtr client) {