From f419bd3ac3f0fdd99c38dceffae8d0c861b249a9 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 11 Sep 2025 19:39:48 +0200 Subject: [PATCH] Xext: xtest: inline SProc*()'s No need to have a hole bunch of extra functions, if we can just easily inline the few relevant lines. Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/xtest.c | 85 ++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 60 deletions(-) diff --git a/Xext/xtest.c b/Xext/xtest.c index b551aff61e..bc1171a8c2 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -89,30 +89,39 @@ static int XTestSwapFakeInput(ClientPtr /* client */ , static int ProcXTestGetVersion(ClientPtr client) { + REQUEST(xXTestGetVersionReq); + REQUEST_SIZE_MATCH(xXTestGetVersionReq); + + if (client->swapped) + swaps(&stuff->minorVersion); + xXTestGetVersionReply reply = { .majorVersion = XTestMajorVersion, .minorVersion = XTestMinorVersion }; - REQUEST_SIZE_MATCH(xXTestGetVersionReq); - - if (client->swapped) { + if (client->swapped) swaps(&reply.minorVersion); - } - X_SEND_REPLY_SIMPLE(client, reply); - return Success; + + return X_SEND_REPLY_SIMPLE(client, reply); } static int ProcXTestCompareCursor(ClientPtr client) { REQUEST(xXTestCompareCursorReq); + REQUEST_SIZE_MATCH(xXTestCompareCursorReq); + + if (client->swapped) { + swapl(&stuff->window); + swapl(&stuff->cursor); + } + WindowPtr pWin; CursorPtr pCursor; int rc; DeviceIntPtr ptr = PickPointer(client); - REQUEST_SIZE_MATCH(xXTestCompareCursorReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; @@ -137,8 +146,7 @@ ProcXTestCompareCursor(ClientPtr client) .same = (wCursor(pWin) == pCursor) }; - X_SEND_REPLY_SIMPLE(client, reply); - return Success; + return X_SEND_REPLY_SIMPLE(client, reply); } void @@ -173,6 +181,13 @@ XTestDeviceSendEvents(DeviceIntPtr dev, static int ProcXTestFakeInput(ClientPtr client) { + if (client->swapped) { + REQUEST(xReq); + int n = XTestSwapFakeInput(client, stuff); + if (n != Success) + return n; + } + REQUEST(xXTestFakeInputReq); int nev, n, type, rc; xEvent *ev; @@ -472,25 +487,6 @@ ProcXTestDispatch(ClientPtr client) } } -static int _X_COLD -SProcXTestGetVersion(ClientPtr client) -{ - REQUEST(xXTestGetVersionReq); - REQUEST_SIZE_MATCH(xXTestGetVersionReq); - swaps(&stuff->minorVersion); - return ProcXTestGetVersion(client); -} - -static int _X_COLD -SProcXTestCompareCursor(ClientPtr client) -{ - REQUEST(xXTestCompareCursorReq); - REQUEST_SIZE_MATCH(xXTestCompareCursorReq); - swapl(&stuff->window); - swapl(&stuff->cursor); - return ProcXTestCompareCursor(client); -} - static int _X_COLD XTestSwapFakeInput(ClientPtr client, xReq * req) { @@ -515,37 +511,6 @@ XTestSwapFakeInput(ClientPtr client, xReq * req) return Success; } -static int _X_COLD -SProcXTestFakeInput(ClientPtr client) -{ - int n; - - REQUEST(xReq); - - n = XTestSwapFakeInput(client, stuff); - if (n != Success) - return n; - return ProcXTestFakeInput(client); -} - -static int _X_COLD -SProcXTestDispatch(ClientPtr client) -{ - REQUEST(xReq); - switch (stuff->data) { - case X_XTestGetVersion: - return SProcXTestGetVersion(client); - case X_XTestCompareCursor: - return SProcXTestCompareCursor(client); - case X_XTestFakeInput: - return SProcXTestFakeInput(client); - case X_XTestGrabControl: - return ProcXTestGrabControl(client); - default: - return BadRequest; - } -} - /** * Allocate an virtual slave device for xtest events, this * is a slave device to inputInfo master devices @@ -677,7 +642,7 @@ void XTestExtensionInit(void) { AddExtension(XTestExtensionName, 0, 0, - ProcXTestDispatch, SProcXTestDispatch, + ProcXTestDispatch, ProcXTestDispatch, XTestExtensionTearDown, StandardMinorOpcode); xtest_evlist = InitEventList(GetMaximumEventsNum());