From 0bcfe2f7f26a733512fe0cdfee3ede94d4a5e8f4 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 16 Jul 2024 14:10:24 +0200 Subject: [PATCH] (submit/cleanup-xkb) xkb: ProcXkbGetDeviceInfo(): move button button action data into payload struct Consolidate the button action data into the payload struct added by previous commit. So we can write it out (along with the name string) by just one call. Signed-off-by: Enrico Weigelt, metux IT consult --- xkb/xkb.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/xkb/xkb.c b/xkb/xkb.c index 86b2e5a9a6..077b39ad81 100644 --- a/xkb/xkb.c +++ b/xkb/xkb.c @@ -6441,21 +6441,19 @@ ProcXkbGetDeviceInfo(ClientPtr client) struct { char name[nameLen]; + xkbActionWireDesc actions[rep.nBtnsRtrn]; } buf; XkbWriteCountedString(buf.name, dev->name, client->swapped); + if (rep.nBtnsRtrn > 0) { + memcpy(buf.actions, + &dev->button->xkb_acts[rep.firstBtnRtrn], + sizeof(xkbActionWireDesc)*rep.nBtnsRtrn); + } + WriteToClient(client, sizeof(buf), &buf); length -= sizeof(buf); - if (rep.nBtnsRtrn > 0) { - int sz; - xkbActionWireDesc *awire; - - sz = rep.nBtnsRtrn * SIZEOF(xkbActionWireDesc); - awire = (xkbActionWireDesc *) &dev->button->xkb_acts[rep.firstBtnRtrn]; - WriteToClient(client, sz, awire); - length -= sz; - } if (nDeviceLedFBs > 0) { status = SendDeviceLedFBs(dev, ledClass, ledID, length, client); if (status != Success)