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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-04 18:48:46 +02:00
parent 02930c99fe
commit ec118ccbb8
2 changed files with 8 additions and 4 deletions

View File

@ -5278,7 +5278,6 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
int int
ProcGrabKeyboard(ClientPtr client) ProcGrabKeyboard(ClientPtr client)
{ {
xGrabKeyboardReply rep;
BYTE status; BYTE status;
REQUEST(xGrabKeyboardReq); REQUEST(xGrabKeyboardReq);
@ -5299,13 +5298,18 @@ ProcGrabKeyboard(ClientPtr client)
if (result != Success) if (result != Success)
return result; return result;
rep = (xGrabKeyboardReply) { xGrabKeyboardReply rep = {
.type = X_Reply, .type = X_Reply,
.status = status, .status = status,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0 .length = 0
}; };
WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(rep), &rep);
return Success; return Success;
} }

View File

@ -746,7 +746,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, /* 30 */ ReplyNotSwappd, /* 30 */
(ReplySwapPtr) SGenericReply, /* SGrabKeyboardReply, */ ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,