mirror of
https://github.com/X11Libre/xserver.git
synced 2026-01-26 14:03:17 +00:00
Xi: inline SProcXSendExtensionEvent()
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:
parent
3ddf48f3c6
commit
71133d6502
@ -412,7 +412,7 @@ SProcIDispatch(ClientPtr client)
|
||||
case X_QueryDeviceState:
|
||||
return ProcXQueryDeviceState(client);
|
||||
case X_SendExtensionEvent:
|
||||
return SProcXSendExtensionEvent(client);
|
||||
return ProcXSendExtensionEvent(client);
|
||||
case X_DeviceBell:
|
||||
return ProcXDeviceBell(client);
|
||||
case X_SetDeviceValuators:
|
||||
|
||||
@ -90,7 +90,6 @@ int SProcXISelectEvents(ClientPtr client);
|
||||
int SProcXISetClientPointer(ClientPtr client);
|
||||
int SProcXISetFocus(ClientPtr client);
|
||||
int SProcXIWarpPointer(ClientPtr client);
|
||||
int SProcXSendExtensionEvent(ClientPtr client);
|
||||
int SProcXSetDeviceFocus(ClientPtr client);
|
||||
int SProcXUngrabDeviceButton(ClientPtr client);
|
||||
int SProcXUngrabDeviceKey(ClientPtr client);
|
||||
|
||||
@ -65,53 +65,6 @@ SOFTWARE.
|
||||
|
||||
extern int lastEvent; /* Defined in extension.c */
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle requests from clients with a different byte order than us.
|
||||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
SProcXSendExtensionEvent(ClientPtr client)
|
||||
{
|
||||
CARD32 *p;
|
||||
int i;
|
||||
xEvent eventT = { .u.u.type = 0 };
|
||||
xEvent *eventP;
|
||||
EventSwapPtr proc;
|
||||
|
||||
REQUEST(xSendExtensionEventReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
|
||||
swapl(&stuff->destination);
|
||||
swaps(&stuff->count);
|
||||
|
||||
if (client->req_len !=
|
||||
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
|
||||
bytes_to_int32(stuff->num_events * sizeof(xEvent)))
|
||||
return BadLength;
|
||||
|
||||
eventP = (xEvent *) &stuff[1];
|
||||
for (i = 0; i < stuff->num_events; i++, eventP++) {
|
||||
if (eventP->u.u.type == GenericEvent) {
|
||||
client->errorValue = eventP->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
proc = EventSwapVector[eventP->u.u.type & 0177];
|
||||
/* no swapping proc; invalid event type? */
|
||||
if (proc == NotImplemented) {
|
||||
client->errorValue = eventP->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
(*proc) (eventP, &eventT);
|
||||
*eventP = eventT;
|
||||
}
|
||||
|
||||
p = (CARD32 *) (((xEvent *) &stuff[1]) + stuff->num_events);
|
||||
SwapLongs(p, stuff->count);
|
||||
return (ProcXSendExtensionEvent(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Send an event to some client, as if it had come from an extension input
|
||||
@ -122,20 +75,48 @@ SProcXSendExtensionEvent(ClientPtr client)
|
||||
int
|
||||
ProcXSendExtensionEvent(ClientPtr client)
|
||||
{
|
||||
int ret, i;
|
||||
DeviceIntPtr dev;
|
||||
xEvent *first;
|
||||
XEventClass *list;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
|
||||
REQUEST(xSendExtensionEventReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
|
||||
|
||||
if (client->swapped) {
|
||||
swapl(&stuff->destination);
|
||||
swaps(&stuff->count);
|
||||
}
|
||||
|
||||
if (client->req_len !=
|
||||
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
|
||||
(stuff->num_events * bytes_to_int32(sizeof(xEvent))))
|
||||
return BadLength;
|
||||
|
||||
if (client->swapped) {
|
||||
xEvent *eventP = (xEvent *) &stuff[1];
|
||||
for (int i = 0; i < stuff->num_events; i++, eventP++) {
|
||||
if (eventP->u.u.type == GenericEvent) {
|
||||
client->errorValue = eventP->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
EventSwapPtr proc = EventSwapVector[eventP->u.u.type & 0177];
|
||||
/* no swapping proc; invalid event type? */
|
||||
if (proc == NotImplemented) {
|
||||
client->errorValue = eventP->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
xEvent eventT = { 0 };
|
||||
(*proc) (eventP, &eventT);
|
||||
*eventP = eventT;
|
||||
}
|
||||
|
||||
CARD32 *p = (CARD32 *) (((xEvent *) &stuff[1]) + stuff->num_events);
|
||||
SwapLongs(p, stuff->count);
|
||||
}
|
||||
|
||||
int ret, i;
|
||||
DeviceIntPtr dev;
|
||||
xEvent *first;
|
||||
XEventClass *list;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
|
||||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user