diff options
Diffstat (limited to 'Xi/exevents.c')
-rw-r--r-- | Xi/exevents.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index 377311ec9..9a179500b 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -67,11 +67,11 @@ SOFTWARE. #include "region.h" #include "exevents.h" #include "extnsionst.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixevents.h" /* DeliverFocusedEvent */ #include "dixgrabs.h" /* CreateGrab() */ #include "scrnintstr.h" +#include "xace.h" #ifdef XKB #include "xkbsrv.h" @@ -511,6 +511,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, WindowPtr pWin, confineTo; CursorPtr cursor; GrabPtr grab; + Mask access_mode = DixGrabAccess; int rc; if ((this_device_mode != GrabModeSync) && @@ -531,25 +532,33 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, client->errorValue = ownerEvents; return BadValue; } - rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; if (rconfineTo == None) confineTo = NullWindow; else { - rc = dixLookupWindow(&confineTo, rconfineTo, client, DixUnknownAccess); + rc = dixLookupWindow(&confineTo, rconfineTo, client, DixSetAttrAccess); if (rc != Success) return rc; } if (rcursor == None) cursor = NullCursor; else { - cursor = (CursorPtr) LookupIDByType(rcursor, RT_CURSOR); - if (!cursor) { + rc = dixLookupResource((pointer *)&cursor, rcursor, RT_CURSOR, + client, DixUseAccess); + if (rc != Success) + { client->errorValue = rcursor; - return BadCursor; + return (rc == BadValue) ? BadCursor : rc; } + access_mode |= DixForceAccess; } + if (this_device_mode == GrabModeSync || other_devices_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); + if (rc != Success) + return rc; grab = CreateGrab(client->index, dev, pWin, eventMask, (Bool) ownerEvents, (Bool) this_device_mode, @@ -569,6 +578,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, WindowPtr pWin; GrabPtr grab; KeyClassPtr k = dev->key; + Mask access_mode = DixGrabAccess; int rc; if (k == NULL) @@ -596,7 +606,12 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, client->errorValue = ownerEvents; return BadValue; } - rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; + if (this_device_mode == GrabModeSync || other_devices_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); if (rc != Success) return rc; @@ -837,7 +852,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, if (!mask) break; } - } else + } else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count)) (void)(DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, d->id)); return Success; } @@ -1101,7 +1116,8 @@ MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask) { DeviceIntPtr dev; - dev = LookupDeviceIntRec(pEvents->deviceid & DEVICE_BITS); + dixLookupDevice(&dev, pEvents->deviceid & DEVICE_BITS, serverClient, + DixReadAccess); if (!dev) return 0; @@ -1125,7 +1141,8 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, { DeviceIntPtr dev; - dev = LookupDeviceIntRec(xE->deviceid & DEVICE_BITS); + dixLookupDevice(&dev, xE->deviceid & DEVICE_BITS, serverClient, + DixReadAccess); if (!dev) return; |