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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-11 17:52:46 +02:00
parent 69078b1d15
commit 96523e64f3

View File

@ -116,26 +116,36 @@ CheckSelectionCallback(void)
XFixesSelectionWindowDestroyNotifyMask |\ XFixesSelectionWindowDestroyNotifyMask |\
XFixesSelectionClientCloseNotifyMask) XFixesSelectionClientCloseNotifyMask)
static int int
XFixesSelectSelectionInput(ClientPtr pClient, ProcXFixesSelectSelectionInput(ClientPtr client)
Atom selection_name, WindowPtr pWindow, CARD32 eventMask)
{ {
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; void *val;
int rc;
SelectionEventPtr *prev, e; SelectionEventPtr *prev, e;
Selection *selection; Selection *selection;
rc = dixLookupSelection(&selection, selection_name, pClient, DixGetAttrAccess); rc = dixLookupSelection(&selection, stuff->selection, client, DixGetAttrAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
for (prev = &selectionEvents; (e = *prev); prev = &e->next) { for (prev = &selectionEvents; (e = *prev); prev = &e->next) {
if (e->selection == selection && if (e->selection == selection &&
e->pClient == pClient && e->pWindow == pWindow) { e->pClient == client && e->pWindow == pWindow) {
break; break;
} }
} }
if (!eventMask) { if (!stuff->eventMask) {
if (e) { if (e) {
FreeResource(e->clientResource, 0); FreeResource(e->clientResource, 0);
} }
@ -148,9 +158,9 @@ XFixesSelectSelectionInput(ClientPtr pClient,
e->next = 0; e->next = 0;
e->selection = selection; e->selection = selection;
e->pClient = pClient; e->pClient = client;
e->pWindow = pWindow; e->pWindow = pWindow;
e->clientResource = FakeClientID(pClient->index); e->clientResource = FakeClientID(client->index);
/* /*
* Add a resource hanging from the window to * Add a resource hanging from the window to
@ -175,29 +185,10 @@ XFixesSelectSelectionInput(ClientPtr pClient,
return BadAlloc; return BadAlloc;
} }
} }
e->eventMask = eventMask; e->eventMask = stuff->eventMask;
return Success; 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 int _X_COLD
SProcXFixesSelectSelectionInput(ClientPtr client) SProcXFixesSelectSelectionInput(ClientPtr client)
{ {