diff --git a/Xext/xace.c b/Xext/xace.c index 136a0055e..370316003 100644 --- a/Xext/xace.c +++ b/Xext/xace.c @@ -78,13 +78,20 @@ int XaceHookDeviceAccess(ClientPtr client, DeviceIntPtr dev, Mask access_mode) return rec.status; } +int XaceHookSendAccess(ClientPtr client, DeviceIntPtr dev, WindowPtr win, + xEventPtr ev, int count) +{ + XaceSendAccessRec rec = { client, dev, win, ev, count, Success }; + CallCallbacks(&XaceHooks[XACE_SEND_ACCESS], &rec); + return rec.status; +} + /* Entry point for hook functions. Called by Xserver. */ int XaceHook(int hook, ...) { union { - XaceSendAccessRec send; XaceReceiveAccessRec recv; XaceClientAccessRec client; XaceExtAccessRec ext; @@ -107,17 +114,6 @@ XaceHook(int hook, ...) * sets calldata directly to a single argument (with no return result) */ switch (hook) { - case XACE_SEND_ACCESS: - u.send.client = va_arg(ap, ClientPtr); - u.send.dev = va_arg(ap, DeviceIntPtr); - u.send.pWin = va_arg(ap, WindowPtr); - - u.send.events = va_arg(ap, xEventPtr); - u.send.count = va_arg(ap, int); - - u.send.status = Success; /* default allow */ - prv = &u.send.status; - break; case XACE_RECEIVE_ACCESS: u.recv.client = va_arg(ap, ClientPtr); u.recv.pWin = va_arg(ap, WindowPtr); diff --git a/Xext/xace.h b/Xext/xace.h index edba2a3d2..bf5968fce 100644 --- a/Xext/xace.h +++ b/Xext/xace.h @@ -84,6 +84,9 @@ _X_EXPORT int XaceHookResourceAccess(ClientPtr client, XID id, RESTYPE rtype, vo int XaceHookDeviceAccess(ClientPtr client, DeviceIntPtr dev, Mask access_mode); +int XaceHookSendAccess(ClientPtr client, DeviceIntPtr dev, WindowPtr win, + xEventPtr ev, int count); + /* Register a callback for a given hook. */ #define XaceRegisterCallback(hook,callback,data) \ diff --git a/Xi/exevents.c b/Xi/exevents.c index 38150bac7..8ecaf0110 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -2957,7 +2957,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, break; } } - else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count)) + else if (!XaceHookSendAccess(client, NULL, pWin, ev, count)) DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab); return Success; } diff --git a/dix/events.c b/dix/events.c index 127370b5d..3d7130342 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2789,7 +2789,7 @@ DeliverEvent(DeviceIntPtr dev, xEvent *xE, int count, Mask filter; int deliveries = 0; - if (XaceHook(XACE_SEND_ACCESS, NULL, dev, win, xE, count) == Success) { + if (XaceHookSendAccess(NULL, dev, win, xE, count) == Success) { filter = GetEventFilter(dev, xE); FixUpEventFromWindow(pSprite, xE, win, child, FALSE); deliveries = DeliverEventsToWindow(dev, win, xE, count, filter, grab); @@ -4213,7 +4213,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) rc = EventToXI(event, &xE, &count); if (rc == Success && - XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE, count) == Success) { + XaceHookSendAccess(NULL, keybd, focus, xE, count) == Success) { FixUpEventFromWindow(ptr->spriteInfo->sprite, xE, focus, None, FALSE); deliveries = DeliverEventsToWindow(keybd, focus, xE, count, GetEventFilter(keybd, xE), NullGrab); @@ -4229,7 +4229,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) if (sendCore) { rc = EventToCore(event, &core, &count); if (rc == Success) { - if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, core, count) == + if (XaceHookSendAccess(NULL, keybd, focus, core, count) == Success) { FixUpEventFromWindow(keybd->spriteInfo->sprite, core, focus, None, FALSE); @@ -4302,8 +4302,7 @@ DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev, if (rc == Success) { FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE); - if (XaceHook(XACE_SEND_ACCESS, 0, dev, - grab->window, xE, count) || + if (XaceHookSendAccess(0, dev, grab->window, xE, count) || XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), grab->window, xE, count)) deliveries = 1; /* don't send, but pretend we did */ @@ -5532,8 +5531,7 @@ ProcSendEvent(ClientPtr client) stuff->event.u.u.type |= SEND_EVENT_BIT; if (stuff->propagate) { for (; pWin; pWin = pWin->parent) { - if (XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, - &stuff->event, 1)) + if (XaceHookSendAccess(client, NULL, pWin, &stuff->event, 1)) return Success; if (DeliverEventsToWindow(dev, pWin, &stuff->event, 1, stuff->eventMask, @@ -5546,7 +5544,7 @@ ProcSendEvent(ClientPtr client) break; } } - else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, &stuff->event, 1)) + else if (!XaceHookSendAccess(client, NULL, pWin, &stuff->event, 1)) DeliverEventsToWindow(dev, pWin, &stuff->event, 1, stuff->eventMask, NullGrab); return Success;