From 9fa0cf3c6038983c26849f5de6336036f2f3fe74 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 4 Apr 2025 18:48:46 +0200 Subject: [PATCH] dix: write out X_GrabKeyboard 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 | 10 +++++++--- dix/tables.c | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dix/events.c b/dix/events.c index 42e882a2f..d54f97334 100644 --- a/dix/events.c +++ b/dix/events.c @@ -5244,7 +5244,6 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev, int ProcGrabKeyboard(ClientPtr client) { - xGrabKeyboardReply rep; BYTE status; REQUEST(xGrabKeyboardReq); @@ -5265,13 +5264,18 @@ ProcGrabKeyboard(ClientPtr client) if (result != Success) return result; - rep = (xGrabKeyboardReply) { + xGrabKeyboardReply rep = { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, .length = 0 }; - WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep); + + if (client->swapped) { + swaps(&rep.sequenceNumber); + } + + WriteToClient(client, sizeof(rep), &rep); return Success; } diff --git a/dix/tables.c b/dix/tables.c index cc80f83c4..e048356c9 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -743,7 +743,7 @@ ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 30 */ - (ReplySwapPtr) SGenericReply, /* SGrabKeyboardReply, */ + ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd,