From d5d56b8c29857b6870012f35dcea1141228c6192 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 4 Apr 2025 18:43:55 +0200 Subject: [PATCH] dix: write out X_GetInputFocus reply directly No need for using a complex callback machinery, if we just move the little pieces of byte-swapping directly into the request handler. Signed-off-by: Enrico Weigelt, metux IT consult --- dix/events.c | 9 ++++++--- dix/swaprep.c | 8 -------- dix/tables.c | 2 +- include/swaprep.h | 4 ---- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/dix/events.c b/dix/events.c index c2e3e553e..da7ca5ae9 100644 --- a/dix/events.c +++ b/dix/events.c @@ -4972,7 +4972,6 @@ int ProcGetInputFocus(ClientPtr client) { DeviceIntPtr kbd = PickKeyboard(client); - xGetInputFocusReply rep; FocusClassPtr focus = kbd->focus; int rc; @@ -4983,7 +4982,7 @@ ProcGetInputFocus(ClientPtr client) if (rc != Success) return rc; - rep = (xGetInputFocusReply) { + xGetInputFocusReply rep = { .type = X_Reply, .length = 0, .sequenceNumber = client->sequence, @@ -4997,7 +4996,11 @@ ProcGetInputFocus(ClientPtr client) else rep.focus = focus->win->drawable.id; - WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.focus); + } + WriteToClient(client, sizeof(rep), &rep); return Success; } diff --git a/dix/swaprep.c b/dix/swaprep.c index a8edf09ad..3d8cdb5b6 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -239,14 +239,6 @@ SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord * pRep) } -void _X_COLD -SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply * pRep) -{ - swaps(&pRep->sequenceNumber); - swapl(&pRep->focus); - WriteToClient(pClient, size, pRep); -} - static void _X_COLD SwapCharInfo(xCharInfo * pInfo) { diff --git a/dix/tables.c b/dix/tables.c index 74c3cd32a..40179e851 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -758,7 +758,7 @@ ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, /* 40 */ ReplyNotSwappd, ReplyNotSwappd, - (ReplySwapPtr) SGetInputFocusReply, + ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 45 */ ReplyNotSwappd, diff --git a/include/swaprep.h b/include/swaprep.h index 93cb01c60..452ca21a7 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -60,10 +60,6 @@ extern void SwapTimeCoordWrite(ClientPtr /* pClient */ , int /* size */ , xTimecoord * /* pRep */ ); -extern void SGetInputFocusReply(ClientPtr /* pClient */ , - int /* size */ , - xGetInputFocusReply * /* pRep */ ); - extern void SListExtensionsReply(ClientPtr /* pClient */ , int /* size */ , xListExtensionsReply * /* pRep */ );