From b7ef0308a95e2f86e84cf47a4ce542b1a547490d Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 3 Apr 2025 14:01:47 +0200 Subject: [PATCH] dix: write out xGetSelectionOwnerReply directly --- dix/selection.c | 14 +++++++++----- dix/swaprep.c | 9 --------- dix/tables.c | 2 +- include/swaprep.h | 5 ----- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/dix/selection.c b/dix/selection.c index ad4a1a9b8a..7425b42c5a 100644 --- a/dix/selection.c +++ b/dix/selection.c @@ -219,7 +219,6 @@ ProcGetSelectionOwner(ClientPtr client) { int rc; Selection *pSel; - xGetSelectionOwnerReply reply; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); @@ -229,7 +228,7 @@ ProcGetSelectionOwner(ClientPtr client) return BadAtom; } - reply = (xGetSelectionOwnerReply) { + xGetSelectionOwnerReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, @@ -237,13 +236,18 @@ ProcGetSelectionOwner(ClientPtr client) rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess); if (rc == Success) - reply.owner = pSel->window; + rep.owner = pSel->window; else if (rc == BadMatch) - reply.owner = None; + rep.owner = None; else return rc; - WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.owner); + } + + WriteToClient(client, sizeof(rep), &rep); return Success; } diff --git a/dix/swaprep.c b/dix/swaprep.c index ef7b2bf5bf..5617005087 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -249,15 +249,6 @@ SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply * pRep) WriteToClient(pClient, size, pRep); } -void _X_COLD -SGetSelectionOwnerReply(ClientPtr pClient, int size, - xGetSelectionOwnerReply * pRep) -{ - swaps(&pRep->sequenceNumber); - swapl(&pRep->owner); - WriteToClient(pClient, size, pRep); -} - void _X_COLD SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply * pRep) { diff --git a/dix/tables.c b/dix/tables.c index d0eb83b51e..2171b3375a 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -739,7 +739,7 @@ ReplySwapPtr ReplySwapVector[256] = { (ReplySwapPtr) SGetPropertyReply, /* 20 */ (ReplySwapPtr) SListPropertiesReply, ReplyNotSwappd, - (ReplySwapPtr) SGetSelectionOwnerReply, + ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 25 */ (ReplySwapPtr) SGenericReply, /* SGrabPointerReply, */ diff --git a/include/swaprep.h b/include/swaprep.h index 133b022c74..4bb248cc34 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -67,11 +67,6 @@ extern void SListPropertiesReply(ClientPtr /* pClient */ , int /* size */ , xListPropertiesReply * /* pRep */ ); -extern void SGetSelectionOwnerReply(ClientPtr /* pClient */ , - int /* size */ , - xGetSelectionOwnerReply * - /* pRep */ ); - extern void SQueryPointerReply(ClientPtr /* pClient */ , int /* size */ , xQueryPointerReply * /* pRep */ );