Xi: inline SProcXIPassiveGrabDevice() and SProcXIPassiveUngrabDevice()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-09-25 16:07:58 +02:00
committed by Enrico Weigelt
parent 7a0efe7da5
commit 7d9fb7b4a0
7 changed files with 48 additions and 69 deletions

View File

@@ -460,9 +460,9 @@ SProcIDispatch(ClientPtr client)
case X_XIAllowEvents:
return ProcXIAllowEvents(client);
case X_XIPassiveGrabDevice:
return SProcXIPassiveGrabDevice(client);
return ProcXIPassiveGrabDevice(client);
case X_XIPassiveUngrabDevice:
return SProcXIPassiveUngrabDevice(client);
return ProcXIPassiveUngrabDevice(client);
case X_XIListProperties:
return ProcXIListProperties(client);
case X_XIChangeProperty:

View File

@@ -70,8 +70,6 @@ int ProcXUngrabDevice(ClientPtr client);
int ProcXUngrabDeviceKey(ClientPtr client);
int SProcXIGetSelectedEvents(ClientPtr client);
int SProcXIPassiveGrabDevice(ClientPtr client);
int SProcXIPassiveUngrabDevice(ClientPtr client);
int SProcXIQueryPointer(ClientPtr client);
int SProcXIQueryVersion(ClientPtr client);
int SProcXISelectEvents(ClientPtr client);

View File

@@ -48,37 +48,31 @@
#include "exglobals.h" /* BadDevice */
#include "misc.h"
int _X_COLD
SProcXIPassiveGrabDevice(ClientPtr client)
{
int i;
uint32_t *mods;
REQUEST(xXIPassiveGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq);
swaps(&stuff->deviceid);
swapl(&stuff->grab_window);
swapl(&stuff->cursor);
swapl(&stuff->time);
swapl(&stuff->detail);
swaps(&stuff->mask_len);
swaps(&stuff->num_modifiers);
REQUEST_FIXED_SIZE(xXIPassiveGrabDeviceReq,
((uint32_t) stuff->mask_len + stuff->num_modifiers) *4);
mods = (uint32_t *) &stuff[1] + stuff->mask_len;
for (i = 0; i < stuff->num_modifiers; i++, mods++) {
swapl(mods);
}
return ProcXIPassiveGrabDevice(client);
}
int
ProcXIPassiveGrabDevice(ClientPtr client)
{
REQUEST(xXIPassiveGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq);
if (client->swapped) {
swaps(&stuff->deviceid);
swapl(&stuff->grab_window);
swapl(&stuff->cursor);
swapl(&stuff->time);
swapl(&stuff->detail);
swaps(&stuff->mask_len);
swaps(&stuff->num_modifiers);
}
REQUEST_FIXED_SIZE(xXIPassiveGrabDeviceReq,
((uint32_t) stuff->mask_len + stuff->num_modifiers) *4);
if (client->swapped) {
uint32_t *mods = (uint32_t *) &stuff[1] + stuff->mask_len;
for (int i = 0; i < stuff->num_modifiers; i++, mods++)
swapl(mods);
}
DeviceIntPtr dev, mod_dev;
xXIPassiveGrabDeviceReply rep = {
.repType = X_Reply,
@@ -94,10 +88,6 @@ ProcXIPassiveGrabDevice(ClientPtr client)
void *tmp;
int mask_len;
REQUEST(xXIPassiveGrabDeviceReq);
REQUEST_FIXED_SIZE(xXIPassiveGrabDeviceReq,
((uint32_t) stuff->mask_len + stuff->num_modifiers) * 4);
if (stuff->deviceid == XIAllDevices)
dev = inputInfo.all_devices;
else if (stuff->deviceid == XIAllMasterDevices)
@@ -254,43 +244,34 @@ ProcXIPassiveGrabDevice(ClientPtr client)
return ret;
}
int _X_COLD
SProcXIPassiveUngrabDevice(ClientPtr client)
{
int i;
uint32_t *modifiers;
REQUEST(xXIPassiveUngrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq);
swapl(&stuff->grab_window);
swaps(&stuff->deviceid);
swapl(&stuff->detail);
swaps(&stuff->num_modifiers);
REQUEST_FIXED_SIZE(xXIPassiveUngrabDeviceReq,
((uint32_t) stuff->num_modifiers) << 2);
modifiers = (uint32_t *) &stuff[1];
for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
swapl(modifiers);
return ProcXIPassiveUngrabDevice(client);
}
int
ProcXIPassiveUngrabDevice(ClientPtr client)
{
REQUEST(xXIPassiveUngrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq);
if (client->swapped) {
swapl(&stuff->grab_window);
swaps(&stuff->deviceid);
swapl(&stuff->detail);
swaps(&stuff->num_modifiers);
}
REQUEST_FIXED_SIZE(xXIPassiveUngrabDeviceReq,
((uint32_t) stuff->num_modifiers) << 2);
if (client->swapped) {
uint32_t *modifiers = (uint32_t *) &stuff[1];
for (int i = 0; i < stuff->num_modifiers; i++, modifiers++)
swapl(modifiers);
}
DeviceIntPtr dev, mod_dev;
WindowPtr win;
GrabPtr tempGrab;
uint32_t *modifiers;
int i, rc;
REQUEST(xXIPassiveUngrabDeviceReq);
REQUEST_FIXED_SIZE(xXIPassiveUngrabDeviceReq,
((uint32_t) stuff->num_modifiers) << 2);
if (stuff->deviceid == XIAllDevices)
dev = inputInfo.all_devices;
else if (stuff->deviceid == XIAllMasterDevices)