Xi: inline swapped property request handlers

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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-09-16 19:22:15 +02:00 committed by Enrico Weigelt
parent 53338710d0
commit 90a258d08a
3 changed files with 60 additions and 106 deletions

View File

@ -425,11 +425,11 @@ SProcIDispatch(ClientPtr client)
case X_ListDeviceProperties:
return ProcXListDeviceProperties(client);
case X_ChangeDeviceProperty:
return SProcXChangeDeviceProperty(client);
return ProcXChangeDeviceProperty(client);
case X_DeleteDeviceProperty:
return SProcXDeleteDeviceProperty(client);
return ProcXDeleteDeviceProperty(client);
case X_GetDeviceProperty:
return SProcXGetDeviceProperty(client);
return ProcXGetDeviceProperty(client);
/* XI 2 */
case X_XIQueryPointer:
return SProcXIQueryPointer(client);
@ -464,13 +464,13 @@ SProcIDispatch(ClientPtr client)
case X_XIPassiveUngrabDevice:
return SProcXIPassiveUngrabDevice(client);
case X_XIListProperties:
return SProcXIListProperties(client);
return ProcXIListProperties(client);
case X_XIChangeProperty:
return SProcXIChangeProperty(client);
return ProcXIChangeProperty(client);
case X_XIDeleteProperty:
return SProcXIDeleteProperty(client);
return ProcXIDeleteProperty(client);
case X_XIGetProperty:
return SProcXIGetProperty(client);
return ProcXIGetProperty(client);
case X_XIGetSelectedEvents:
return SProcXIGetSelectedEvents(client);
case X_XIBarrierReleasePointer:

View File

@ -71,12 +71,9 @@ int ProcXUngrabDeviceKey(ClientPtr client);
int SProcXChangeDeviceControl(ClientPtr client);
int SProcXChangeDeviceDontPropagateList(ClientPtr client);
int SProcXChangeDeviceProperty(ClientPtr client);
int SProcXChangeFeedbackControl(ClientPtr client);
int SProcXDeleteDeviceProperty(ClientPtr client);
int SProcXGetDeviceDontPropagateList(ClientPtr client);
int SProcXGetDeviceMotionEvents(ClientPtr client);
int SProcXGetDeviceProperty(ClientPtr client);
int SProcXGetExtensionVersion(ClientPtr client);
int SProcXGetSelectedExtensionEvents(ClientPtr client);
int SProcXGrabDeviceButton(ClientPtr client);
@ -85,14 +82,10 @@ int SProcXGrabDeviceKey(ClientPtr client);
int SProcXIAllowEvents(ClientPtr client);
int SProcXIBarrierReleasePointer(ClientPtr client);
int SProcXIChangeCursor(ClientPtr client);
int SProcXIChangeProperty(ClientPtr client);
int SProcXIDeleteProperty(ClientPtr client);
int SProcXIGetClientPointer(ClientPtr client);
int SProcXIGetFocus(ClientPtr client);
int SProcXIGetProperty(ClientPtr client);
int SProcXIGetSelectedEvents(ClientPtr client);
int SProcXIGrabDevice(ClientPtr client);
int SProcXIListProperties(ClientPtr client);
int SProcXIPassiveGrabDevice(ClientPtr client);
int SProcXIPassiveUngrabDevice(ClientPtr client);
int SProcXIQueryDevice(ClientPtr client);

View File

@ -867,12 +867,19 @@ int
ProcXChangeDeviceProperty(ClientPtr client)
{
REQUEST(xChangeDevicePropertyReq);
REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
if (client->swapped) {
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->nUnits);
}
DeviceIntPtr dev;
unsigned long len;
uint64_t totalSize;
int rc;
REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
UpdateCurrentTime();
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetPropAccess);
@ -900,10 +907,14 @@ int
ProcXDeleteDeviceProperty(ClientPtr client)
{
REQUEST(xDeleteDevicePropertyReq);
REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
if (client->swapped)
swapl(&stuff->property);
DeviceIntPtr dev;
int rc;
REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
UpdateCurrentTime();
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetPropAccess);
if (rc != Success)
@ -922,13 +933,21 @@ int
ProcXGetDeviceProperty(ClientPtr client)
{
REQUEST(xGetDevicePropertyReq);
REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
if (client->swapped) {
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->longOffset);
swapl(&stuff->longLength);
}
DeviceIntPtr dev;
int length;
int rc, format, nitems, bytes_after;
char *data;
Atom type;
REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
if (stuff->delete)
UpdateCurrentTime();
rc = dixLookupDevice(&dev, stuff->deviceid, client,
@ -994,41 +1013,6 @@ ProcXGetDeviceProperty(ClientPtr client)
return X_SEND_REPLY_WITH_RPCBUF(client, rep, rpcbuf);
}
int _X_COLD
SProcXChangeDeviceProperty(ClientPtr client)
{
REQUEST(xChangeDevicePropertyReq);
REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->nUnits);
return (ProcXChangeDeviceProperty(client));
}
int _X_COLD
SProcXDeleteDeviceProperty(ClientPtr client)
{
REQUEST(xDeleteDevicePropertyReq);
REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
swapl(&stuff->property);
return (ProcXDeleteDeviceProperty(client));
}
int _X_COLD
SProcXGetDeviceProperty(ClientPtr client)
{
REQUEST(xGetDevicePropertyReq);
REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->longOffset);
swapl(&stuff->longLength);
return (ProcXGetDeviceProperty(client));
}
/* XI2 Request/reply handling */
int
ProcXIListProperties(ClientPtr client)
@ -1036,6 +1020,9 @@ ProcXIListProperties(ClientPtr client)
REQUEST(xXIListPropertiesReq);
REQUEST_SIZE_MATCH(xXIListPropertiesReq);
if (client->swapped)
swaps(&stuff->deviceid);
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
size_t natoms = 0;
@ -1058,13 +1045,21 @@ ProcXIListProperties(ClientPtr client)
int
ProcXIChangeProperty(ClientPtr client)
{
REQUEST(xXIChangePropertyReq);
REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
if (client->swapped) {
swaps(&stuff->deviceid);
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->num_items);
}
int rc;
DeviceIntPtr dev;
uint64_t totalSize;
unsigned long len;
REQUEST(xXIChangePropertyReq);
REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
UpdateCurrentTime();
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetPropAccess);
@ -1091,12 +1086,17 @@ ProcXIChangeProperty(ClientPtr client)
int
ProcXIDeleteProperty(ClientPtr client)
{
REQUEST(xXIDeletePropertyReq);
REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
if (client->swapped) {
swaps(&stuff->deviceid);
swapl(&stuff->property);
}
DeviceIntPtr dev;
int rc;
REQUEST(xXIDeletePropertyReq);
REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
UpdateCurrentTime();
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetPropAccess);
if (rc != Success)
@ -1115,13 +1115,22 @@ int
ProcXIGetProperty(ClientPtr client)
{
REQUEST(xXIGetPropertyReq);
REQUEST_SIZE_MATCH(xXIGetPropertyReq);
if (client->swapped) {
swaps(&stuff->deviceid);
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->offset);
swapl(&stuff->len);
}
DeviceIntPtr dev;
int length;
int rc, format, nitems, bytes_after;
char *data;
Atom type;
REQUEST_SIZE_MATCH(xXIGetPropertyReq);
if (stuff->delete)
UpdateCurrentTime();
rc = dixLookupDevice(&dev, stuff->deviceid, client,
@ -1189,51 +1198,3 @@ ProcXIGetProperty(ClientPtr client)
return rc;
}
int _X_COLD
SProcXIListProperties(ClientPtr client)
{
REQUEST(xXIListPropertiesReq);
REQUEST_SIZE_MATCH(xXIListPropertiesReq);
swaps(&stuff->deviceid);
return (ProcXIListProperties(client));
}
int _X_COLD
SProcXIChangeProperty(ClientPtr client)
{
REQUEST(xXIChangePropertyReq);
REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
swaps(&stuff->deviceid);
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->num_items);
return (ProcXIChangeProperty(client));
}
int _X_COLD
SProcXIDeleteProperty(ClientPtr client)
{
REQUEST(xXIDeletePropertyReq);
REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
swaps(&stuff->deviceid);
swapl(&stuff->property);
return (ProcXIDeleteProperty(client));
}
int _X_COLD
SProcXIGetProperty(ClientPtr client)
{
REQUEST(xXIGetPropertyReq);
REQUEST_SIZE_MATCH(xXIGetPropertyReq);
swaps(&stuff->deviceid);
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->offset);
swapl(&stuff->len);
return (ProcXIGetProperty(client));
}