Lines Matching refs:grab
194 * Used to indicate a implicit passive grab created by a ButtonPress event.
806 pDev->deviceGrab.grab ? pDev->deviceGrab.grab->
979 GrabPtr grab = pDev->deviceGrab.grab;
985 if (grab) {
986 if (grab->cursor) {
987 ChangeToCursor(pDev, grab->cursor);
990 if (IsParent(grab->window, pSprite->win))
993 win = grab->window;
1321 GrabPtr grab;
1377 if ((grab = dev->deviceGrab.grab) && grab->confineTo) {
1378 if (grab->confineTo->drawable.pScreen !=
1382 ConfineCursorToWindow(dev, grab->confineTo, TRUE, TRUE);
1397 GrabPtr grab;
1406 if ((grab = pDev->deviceGrab.grab) && grab->confineTo) {
1407 if (grab->confineTo->drawable.pScreen
1411 ConfineCursorToWindow(pDev, grab->confineTo, TRUE, TRUE);
1424 GrabPtr grab = thisDev->deviceGrab.grab;
1433 CLIENT_BITS(grab->resource)))
1440 dev->deviceGrab.sync.other = grab;
1444 CLIENT_BITS(grab->resource)))
1454 * the duration of the grab, the device is detached, ungrabbing re-attaches it
1458 * while the device has a grab.
1512 * Update touch records when an explicit grab is activated. Any touches owned by
1513 * the grabbing client are updated so the listener state reflects the new grab.
1526 GrabPtr grab = mouse->deviceGrab.grab;
1529 CLIENT_BITS(listener->listener) == grab->resource) {
1530 if (grab->grabtype == CORE || grab->grabtype == XI ||
1531 !xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin)) {
1532 /* Note that the grab will override any current listeners and if these listeners
1544 listener->listener = grab->resource;
1545 listener->level = grab->grabtype;
1546 listener->window = grab->window;
1549 if (listener->grab)
1550 FreeGrab(listener->grab);
1551 listener->grab = AllocGrab(grab);
1557 * Update gesture records when an explicit grab is activated. Any gestures owned
1559 * grab.
1569 GrabPtr grab = mouse->deviceGrab.grab;
1571 if (gi->active && CLIENT_BITS(listener->listener) == grab->resource) {
1572 if (grab->grabtype == CORE || grab->grabtype == XI ||
1573 !xi2mask_isset(grab->xi2mask, mouse, GetXI2Type(gi->type))) {
1577 a gesture end because the grab overrides the previous listener and won't
1587 listener->listener = grab->resource;
1588 listener->window = grab->window;
1590 if (listener->grab)
1591 FreeGrab(listener->grab);
1592 listener->grab = AllocGrab(grab);
1597 * Activate a pointer grab on the given device. A pointer grab will cause all
1599 * No other device will send core events to the grab client while the grab is
1601 * Can cause the cursor to change if a grab cursor is set.
1603 * Note that parameter autoGrab may be (True & ImplicitGrabMask) if the grab
1604 * is an implicit grab caused by a ButtonPress event.
1606 * @param mouse The device to grab.
1607 * @param grab The grab structure, needs to be setup.
1608 * @param autoGrab True if the grab was caused by a button down event and not
1612 ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
1616 GrabPtr oldgrab = grabinfo->grab;
1617 WindowPtr oldWin = (grabinfo->grab) ?
1618 grabinfo->grab->window : mouse->spriteInfo->sprite->win;
1621 /* slave devices need to float for the duration of the grab. */
1622 if (grab->grabtype == XI2 &&
1626 if (grab->confineTo) {
1627 if (grab->confineTo->drawable.pScreen
1631 ConfineCursorToWindow(mouse, grab->confineTo, FALSE, TRUE);
1633 if (! (grabinfo->grab && oldWin == grabinfo->grab->window
1634 && oldWin == grab->window))
1635 DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window, NotifyGrab);
1641 grabinfo->grab = AllocGrab(grab);
1647 CheckGrabForSyncs(mouse, (Bool) grab->pointerMode,
1648 (Bool) grab->keyboardMode);
1654 * Delete grab on given device, update the sprite.
1661 GrabPtr grab = mouse->deviceGrab.grab;
1666 XID grab_resource = grab->resource;
1669 /* If an explicit grab was deactivated, we must remove it from the head of
1678 if (grab->grabtype == CORE || grab->grabtype == XI ||
1679 !xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin)) {
1694 mouse->deviceGrab.grab = NullGrab;
1699 if (dev->deviceGrab.sync.other == grab)
1703 /* in case of explicit gesture grab, send end event to the grab client */
1712 DoEnterLeaveEvents(mouse, mouse->id, grab->window,
1714 if (grab->confineTo)
1718 if (!wasImplicit && grab->grabtype == XI2)
1723 FreeGrab(grab);
1727 * Activate a keyboard grab on the given device.
1732 ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
1736 GrabPtr oldgrab = grabinfo->grab;
1743 /* slave devices need to float for the duration of the grab. */
1744 if (grab->grabtype == XI2 && keybd->enabled &&
1750 else if (grabinfo->grab)
1751 oldWin = grabinfo->grab->window;
1761 ! (grabinfo->grab && oldWin == grabinfo->grab->window
1762 && oldWin == grab->window))
1763 DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
1768 grabinfo->grab = AllocGrab(grab);
1771 CheckGrabForSyncs(keybd, (Bool) grab->keyboardMode,
1772 (Bool) grab->pointerMode);
1778 * Delete keyboard grab for the given device.
1783 GrabPtr grab = keybd->deviceGrab.grab;
1795 keybd->deviceGrab.grab = NullGrab;
1800 if (dev->deviceGrab.sync.other == grab)
1814 DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
1816 if (!wasImplicit && grab->grabtype == XI2)
1821 FreeGrab(grab);
1832 thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client);
1842 if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) {
1847 if (grabinfo->sync.other == devgrabinfo->grab)
1878 if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
1891 if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
1905 syncEvents.replayWin = grabinfo->grab->window;
1916 if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
1927 /* We've unfrozen the grab. If the grab was a touch grab, we're now the
2006 if (dev->deviceGrab.grab &&
2007 SameClient(dev->deviceGrab.grab, client)) {
2030 * - no other client has a grab on the device that caused the event.
2039 * @param grab Possible grab on the device that caused the event.
2041 * @return 1 if event was delivered, 0 if not or -1 if grab was not set by the
2046 int count, Mask mask, Mask filter, GrabPtr grab)
2071 if (grab && !SameClient(grab, client)) {
2073 ErrorF(" not delivered due to grab\n");
2203 xEvent *events, int count, Mask filter, GrabPtr grab)
2216 filter, grab);
2267 * accepts it and there is no interfering core grab..
2272 int count, Mask filter, GrabPtr grab,
2295 mask, filter, grab))) {
2328 int count, Mask filter, GrabPtr grab,
2337 grab, client_return, mask_return);
2343 * actually needs to be delivered. May activate a grab if the event is a
2357 * @param grab Possible grab on the device that caused the event.
2365 *pEvents, int count, Mask filter, GrabPtr grab)
2369 Mask deliveryMask = 0; /* If a grab occurs due to a button press, then
2370 this mask is the mask of the grab. */
2377 rc = DeliverToWindowOwner(pDev, pWin, pEvents, count, filter, grab);
2401 grab, &client, &deliveryMask);
2419 * Note that since core events are delivered first, an implicit grab may
2420 * be activated on a core grab, stopping the XI events.
2422 if (!grab &&
2424 /* grab activated */ ;
2430 grab, client, deliveryMask);
2439 * If there is a grab on the device, 2.0 clients only get raw events if they
2440 * have the grab. 2.1+ clients get raw events in all cases.
2445 FilterRawEvents(const ClientPtr client, const GrabPtr grab, WindowPtr root)
2451 if (!grab)
2464 return (grab->window != root) ? FALSE : SameClient(grab, client);
2468 * Deliver a raw event to the grab owner (if any) and to all root windows.
2479 GrabPtr grab = device->deviceGrab.grab;
2491 if (grab)
2512 * double events on XI 2.1 clients that have a grab on the
2517 if (!FilterRawEvents(rClient(&ic), grab, root))
2534 GrabPtr grab, Mask mask, Mask filter)
2538 if (grab && !SameClient(grab, client))
2817 WindowPtr win, Window child, GrabPtr grab)
2826 deliveries = DeliverEventsToWindow(dev, win, xE, count, filter, grab);
2834 WindowPtr win, Window child, GrabPtr grab)
2858 deliveries = DeliverEvent(dev, xE, count, win, child, grab);
2880 * @param grab Possible grab on a device.
2888 DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
2902 DeliverOneEvent(event, dev, XI2, pWin, child, grab);
2909 deliveries = DeliverOneEvent(event, dev, XI, pWin, child, grab);
2917 DeliverOneEvent(event, dev, CORE, pWin, child, grab);
3063 * Ungrab a currently FocusIn grabbed device and grab the device on the
3075 if (dev->deviceGrab.grab) {
3077 dev->deviceGrab.grab->type != XI_FocusIn ||
3078 dev->deviceGrab.grab->window == win ||
3079 IsParent(dev->deviceGrab.grab->window, win))
3105 * Ungrab a currently Enter grabbed device and grab the device for the given
3116 if (dev->deviceGrab.grab) {
3118 dev->deviceGrab.grab->type != XI_Enter ||
3119 dev->deviceGrab.grab->window == win ||
3120 IsParent(dev->deviceGrab.grab->window, win))
3289 GrabPtr grab;
3317 if ((grab = pDev->deviceGrab.grab) && grab->confineTo) {
3318 if (grab->confineTo->drawable.pScreen
3321 ConfineCursorToWindow(pDev, grab->confineTo, TRUE, TRUE);
3821 * Activate the given passive grab. If the grab is activated successfully, the
3825 * @param grab The grab to check.
3830 * @return Whether the grab has been activated.
3833 ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
3843 if (grab->grabtype == XI || grab->grabtype == CORE) {
3848 if (grab->grabtype == CORE)
3851 gdev = grab->modifierDevice;
3858 if (grab->grabtype == CORE) {
3866 else if (grab->grabtype == XI2) {
3886 ActivateGrabNoDelivery(device, grab, event, real_event);
3889 FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
3892 TryClientEvents(rClient(grab), device, xE, count,
3894 GetEventFilter(device, xE), grab);
3902 * Activates a grab without event delivery.
3905 * @param grab The grab to check.
3910 void ActivateGrabNoDelivery(DeviceIntPtr dev, GrabPtr grab,
3914 (*grabinfo->ActivateGrab) (dev, grab,
3923 CoreGrabInterferes(DeviceIntPtr device, GrabPtr grab)
3929 GrabPtr othergrab = other->deviceGrab.grab;
3932 SameClient(grab, rClient(othergrab)) &&
3933 ((IsPointerDevice(grab->device) &&
3935 (IsKeyboardDevice(grab->device) &&
3953 * Match the grab against the temporary grab on the given input level.
3954 * Modifies the temporary grab pointer.
3956 * @param grab The grab to match against
3957 * @param tmp The temporary grab to use for matching
3964 MatchForType(const GrabPtr grab, GrabPtr tmp, enum InputLevel level,
3997 if (tmp->type && GrabMatchesSecond(tmp, grab, ignore_device))
4004 * Check an individual grab against an event to determine if a passive grab
4008 * @param grab The grab to check.
4011 * @param tempGrab A pre-allocated temporary grab record for matching. This
4014 * @return Whether the grab matches the event.
4017 CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
4025 gdev = grab->modifierDevice;
4026 if (grab->grabtype == CORE) {
4029 else if (grab->grabtype == XI2) {
4032 * reattached after the grab, the modifier device may not be the
4034 if (!IsMaster(grab->device) && !IsFloating(device))
4040 tempGrab->modifierDevice = grab->modifierDevice;
4044 match = MatchForType(grab, tempGrab, XI2, event->any.type);
4049 match = MatchForType(grab, tempGrab, XI2, emulated_type);
4053 match = MatchForType(grab, tempGrab, XI, event->any.type);
4056 match = MatchForType(grab, tempGrab, XI, emulated_type);
4059 match = MatchForType(grab, tempGrab, CORE, event->any.type);
4061 match = MatchForType(grab, tempGrab, CORE, emulated_type);
4064 if (!match || (grab->confineTo &&
4065 (!grab->confineTo->realized ||
4066 !BorderSizeNotEmpty(device, grab->confineTo))))
4069 /* In some cases a passive core grab may exist, but the client
4070 * already has a core grab on some other device. In this case we
4071 * must not get the grab, otherwise we may never ungrab the
4075 if (grab->grabtype == CORE) {
4076 /* A passive grab may have been created for a different device
4078 Update the grab's device and modifier device to reflect the
4083 if (grab->type < GenericEvent) {
4084 grab->device = device;
4085 grab->modifierDevice = GetMaster(device, MASTER_KEYBOARD);
4088 if (CoreGrabInterferes(device, grab))
4097 * passive grab set on the window to be activated.
4098 * If activate is true and a passive grab is found, it will be activated,
4101 * @param pWin The window that may be subject to a passive grab.
4105 * @param activate If a grab is found, activate it and deliver the event.
4113 GrabPtr grab = wPassiveGrabs(pWin);
4116 if (!grab)
4123 /* Fill out the grab details, but leave the type for later before
4146 for (; grab; grab = grab->next) {
4147 if (!CheckPassiveGrab(device, grab, event, checkCore, tempGrab))
4150 if (activate && !ActivatePassiveGrab(device, grab, event, event))
4157 return grab;
4162 * a passive grab to be activated.
4172 * causes a passive grab to activate or all the windows are
4175 * If a grab is activated, the event has been sent to the client already!
4183 * @return TRUE if a grab has been activated or false otherwise.
4203 if (device->deviceGrab.grab)
4351 GrabPtr grab = grabinfo->grab;
4354 if (grab->grabtype != level)
4364 mask = GetXI2MaskByte(grab->xi2mask, dev, evtype);
4370 mask = grab->deviceMask;
4372 mask = grab->eventMask;
4379 mask = grab->eventMask;
4389 FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
4391 grab->window, xE, count) ||
4392 XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
4393 grab->window, xE, count))
4395 else if (level != CORE || !IsInterferingGrab(rClient(grab), dev, xE)) {
4396 deliveries = TryClientEvents(rClient(grab), dev,
4397 xE, count, mask, filter, grab);
4412 * grab. If not, TryClientEvents() is used.
4414 * @param deactivateGrab True if the device's grab should be deactivated.
4422 GrabPtr grab;
4429 grab = grabinfo->grab;
4431 if (grab->ownerEvents) {
4448 deliveries = DeliverDeviceEvents(pSprite->win, event, grab,
4452 deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus,
4455 deliveries = DeliverDeviceEvents(focus, event, grab, focus,
4461 if ((sendCore && grab->grabtype == CORE) || grab->grabtype != CORE)
4462 deliveries = DeliverOneGrabbedEvent(event, thisDev, grab->grabtype);
4465 thisDev->valuator->motionHintWindow = grab->window;
4482 GrabPtr grab = grabinfo->grab;
4491 (CLIENT_BITS(grab->resource) ==
4492 CLIENT_BITS(dev->deviceGrab.grab->resource)))
4495 dev->deviceGrab.sync.other = grab;
4740 GrabPtr grab = mouse->deviceGrab.grab;
4748 if (grab) {
4749 mask = (pWin == grab->window) ? grab->eventMask : 0;
4750 if (grab->ownerEvents)
4751 mask |= EventMaskForClient(pWin, rClient(grab));
4778 if (grab)
4779 TryClientEvents(rClient(grab), mouse, &event, 1, mask,
4780 GetEventFilter(mouse, &event), grab);
4790 ClientPtr client = grab ? rClient(grab) : wClient(pWin);
4797 if (grab)
4798 TryClientEvents(rClient(grab), keybd, (xEvent *) &ke, 1,
4799 mask, KeymapStateMask, grab);
4812 GrabPtr grab = mouse->deviceGrab.grab;
4866 if (grab && grab->grabtype == XI2) {
4869 mask = xi2mask_isset(grab->xi2mask, mouse, type);
4870 TryClientEvents(rClient(grab), mouse, (xEvent *) event, 1, mask, 1,
4871 grab);
4975 mode = (dev->deviceGrab.grab) ? NotifyWhileGrabbed : NotifyNormal;
5070 * Sets an active grab on the client's ClientPointer and returns success
5078 GrabPtr grab;
5103 grab = device->deviceGrab.grab;
5105 if (grab && grab->confineTo && !confineTo)
5129 * Changes properties of the grab hold by the client. If the client does not
5130 * hold an active grab on the device, nothing happens.
5136 GrabPtr grab;
5160 grab = device->deviceGrab.grab;
5162 if (!grab)
5164 if (!SameClient(grab, client))
5171 oldCursor = grab->cursor;
5172 grab->cursor = RefCursor(newCursor);
5176 grab->eventMask = stuff->eventMask;
5183 * Deletes a pointer grab on a device the client has grabbed.
5189 GrabPtr grab;
5196 grab = device->deviceGrab.grab;
5201 (grab) && SameClient(grab, client))
5207 * Sets a grab on the given device.
5216 * @param client Client that owns the grab.
5217 * @param dev The device to grab.
5231 GrabPtr grab;
5284 grab = grabInfo->grab;
5285 if (grab && grab->grabtype != grabtype)
5287 else if (grab && !SameClient(grab, client))
5372 * Deletes a possible grab on the client's keyboard.
5378 GrabPtr grab;
5386 grab = device->deviceGrab.grab;
5391 (grab) && SameClient(grab, client) && grab->grabtype == CORE)
5643 * Deletes a passive grab for the given key. Works on the
5697 * Creates a grab for the client's keyboard and adds it to the list of passive
5706 GrabPtr grab;
5738 grab = CreateGrab(client->index, keybd, keybd, pWin, CORE, &mask,
5740 if (!grab)
5742 return AddPassiveGrabToList(client, grab);
5748 * Creates a grab for the client's ClientPointer and adds it as a passive grab
5758 GrabPtr grab;
5832 grab = CreateGrab(client->index, ptr, modifierDevice, pWin,
5835 if (!grab)
5837 return AddPassiveGrabToList(client, grab);
5843 * Deletes a passive grab on the client's ClientPointer from the list.
5890 * Deactivate any grab that may be on the window, remove the focus.
5909 GrabPtr grab;
5913 grab = mouse->deviceGrab.grab;
5914 if (grab && ((grab->window == pWin) || (grab->confineTo == pWin)))
5917 /* Deactivating a keyboard grab should cause focus events. */
5918 grab = keybd->deviceGrab.grab;
5919 if (grab && (grab->window == pWin))
5924 grab = mouse->deviceGrab.grab;
5925 if (grab && ((grab->window == pWin) || (grab->confineTo == pWin)))
5939 /* If a grab is in progress, then alter the mode of focus events. */
5941 if (keybd->deviceGrab.grab)
6002 * there is a grab on the window, the cursor will be re-confined into the
6008 GrabPtr grab;
6019 grab = pDev->deviceGrab.grab;
6020 if (grab && (confineTo = grab->confineTo)) {
6245 * 1) A device the given client has a core grab on.
6254 /* First, check if the client currently has a grab on a device. Even
6257 GrabPtr grab = it->deviceGrab.grab;
6259 if (grab && grab->grabtype == CORE && SameClient(grab, client)) {
6297 * devices it does not have a grab on. Legacy applications behave bad
6322 if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client))
6327 if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client)