diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-15 07:48:49 +1000 |
---|---|---|
committer | Chase Douglas <chase.douglas@canonical.com> | 2011-12-21 10:34:12 -0800 |
commit | 09b10d42d8dcc3e4503ba79660a91b4b385bb1ff (patch) | |
tree | f7cdc7a9d0598a6a6a2e8e6894ab212df95c2162 | |
parent | e48a38d74ba8c415729801dbb3a16a3c372d4886 (diff) |
dix: hook up passive grabs and pointer emulated passive grabs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r-- | dix/events.c | 37 | ||||
-rw-r--r-- | dix/touch.c | 26 | ||||
-rw-r--r-- | include/input.h | 1 |
3 files changed, 60 insertions, 4 deletions
diff --git a/dix/events.c b/dix/events.c index 51300cb37..d80290360 100644 --- a/dix/events.c +++ b/dix/events.c @@ -152,6 +152,7 @@ typedef const char *string; #include "eventstr.h" #include "enterleave.h" #include "eventconvert.h" +#include "mi.h" /* Extension events type numbering starts at EXTENSION_EVENT_BASE. */ #define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ @@ -1309,7 +1310,17 @@ ComputeFreezes(void) event->root_x, event->root_y); if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin)) { - if (replayDev->focus && !IsPointerEvent((InternalEvent*)event)) + if (IsTouchEvent((InternalEvent*)event)) + { + InternalEvent *events = InitEventList(GetMaximumEventsNum()); + int i, nev; + TouchPointInfoPtr ti = TouchFindByClientID(replayDev, event->touchid); + BUG_WARN(!ti); + nev = GetTouchOwnershipEvents(events, replayDev, ti, XIRejectTouch, ti->listeners[0].listener, 0); + for (i = 0; i < nev; i++) + mieqProcessDeviceEvent(replayDev, events + i, NULL); + ProcessInputEvents(); + } else if (replayDev->focus && !IsPointerEvent((InternalEvent*)event)) DeliverFocusedEvent(replayDev, (InternalEvent*)event, w); else DeliverDeviceEvents(w, (InternalEvent*)event, NullGrab, @@ -1514,6 +1525,8 @@ DeactivatePointerGrab(DeviceIntPtr mouse) Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab && mouse->deviceGrab.implicitGrab); + TouchRemovePointerGrab(mouse); + mouse->valuator->motionHintWindow = NullWindow; mouse->deviceGrab.grab = NullGrab; mouse->deviceGrab.sync.state = NOT_GRABBED; @@ -3830,6 +3843,7 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event, DeviceIntPtr gdev; XkbSrvInfoPtr xkbi = NULL; enum MatchFlags match = 0; + int emulated_type = 0; gdev = grab->modifierDevice; if (grab->grabtype == CORE) @@ -3851,13 +3865,26 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event, tempGrab->modifiersDetail.exact = xkbi ? xkbi->state.grab_mods : 0; /* Check for XI2 and XI grabs first */ - match = MatchForType(grab, tempGrab, XI2, GetXI2Type(event->any.type)); + match = MatchForType(grab, tempGrab, XI2, event->any.type); + + if (!match && IsTouchEvent(event) && (event->device_event.flags & TOUCH_POINTER_EMULATED)) + { + emulated_type = TouchGetPointerEventType(event); + match = MatchForType(grab, tempGrab, XI2, emulated_type); + } if (!match) - match = MatchForType(grab, tempGrab, XI, GetXIType(event->any.type)); + match = MatchForType(grab, tempGrab, XI, event->any.type); + + if (!match && emulated_type) + match = MatchForType(grab, tempGrab, XI, emulated_type); if (!match && checkCore) - match = MatchForType(grab, tempGrab, CORE, GetCoreType(event->any.type)); + { + match = MatchForType(grab, tempGrab, CORE, event->any.type); + if (!match && emulated_type) + match = MatchForType(grab, tempGrab, CORE, emulated_type); + } if (!match || (grab->confineTo && (!grab->confineTo->realized || @@ -3931,6 +3958,8 @@ CheckPassiveGrabsOnWindow( break; case ET_ButtonPress: case ET_ButtonRelease: + case ET_TouchBegin: + case ET_TouchEnd: tempGrab->detail.exact = event->device_event.detail.button; break; default: diff --git a/dix/touch.c b/dix/touch.c index 5731d9118..9bd07c37c 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -910,3 +910,29 @@ TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev) return; } } + +/** + * Remove the touch pointer grab from the device. Called from AllowSome() + */ +void +TouchRemovePointerGrab(DeviceIntPtr dev) +{ + TouchPointInfoPtr ti; + GrabPtr grab; + DeviceEvent *ev; + + if (!dev->touch) + return; + + grab = dev->deviceGrab.grab; + if (!grab) + return; + + ev = dev->deviceGrab.sync.event; + if (!IsTouchEvent((InternalEvent*)ev)) + return; + + ti = TouchFindByClientID(dev, ev->touchid); + if (!ti) + return; +} diff --git a/include/input.h b/include/input.h index 03eb053c8..4ed9dce14 100644 --- a/include/input.h +++ b/include/input.h @@ -622,6 +622,7 @@ extern Bool TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite); extern int TouchConvertToPointerEvent(const InternalEvent *ev, InternalEvent *motion, InternalEvent *button); extern int TouchGetPointerEventType(const InternalEvent *ev); +extern void TouchRemovePointerGrab(DeviceIntPtr dev); /* misc event helpers */ extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients); |