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)

View File

@@ -145,7 +145,7 @@ request_XIGetSelectedEvents(xXIGetSelectedEventsReq * req, int error)
The handler proc's don't use that field anymore, thus also SProc's
wont swap it. But this test program uses that field to initialize
client->req_len (see above). We previously had to swap it here, so
that SProcXIPassiveGrabDevice() will swap it back. Since that's gone
that ProcXIPassiveGrabDevice() will swap it back. Since that's gone
now, still swapping itself would break if this function is called
again and writing back a errornously swapped value
*/

View File

@@ -151,7 +151,7 @@ request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req,
The handler proc's don't use that field anymore, thus also SProc's
wont swap it. But this test program uses that field to initialize
client->req_len (see above). We previously had to swap it here, so
that SProcXIPassiveGrabDevice() will swap it back. Since that's gone
that ProcXIPassiveGrabDevice() will swap it back. Since that's gone
now, still swapping itself would break if this function is called
again and writing back a errornously swapped value
*/
@@ -172,7 +172,7 @@ request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req,
swapl(mod);
}
rc = SProcXIPassiveGrabDevice(&client_request);
rc = ProcXIPassiveGrabDevice(&client_request);
assert(rc == error);
if (rc != Success)

View File

@@ -114,7 +114,7 @@ request_XISelectEvent(xXISelectEventsReq * req, int error)
The handler proc's don't use that field anymore, thus also SProc's
wont swap it. But this test program uses that field to initialize
client->req_len (see above). We previously had to swap it here, so
that SProcXIPassiveGrabDevice() will swap it back. Since that's gone
that ProcXIPassiveGrabDevice() will swap it back. Since that's gone
now, still swapping itself would break if this function is called
again and writing back a errornously swapped value
*/

View File

@@ -74,7 +74,7 @@ request_XISetClientPointer(xXISetClientPointerReq * req, int error)
The handler proc's don't use that field anymore, thus also SProc's
wont swap it. But this test program uses that field to initialize
client->req_len (see above). We previously had to swap it here, so
that SProcXIPassiveGrabDevice() will swap it back. Since that's gone
that ProcXIPassiveGrabDevice() will swap it back. Since that's gone
now, still swapping itself would break if this function is called
again and writing back a errornously swapped value
*/