summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-12-15 07:48:49 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-12-21 14:16:36 +1000
commitcd3de8324e8908955a2e4be3000c8ffee8684c68 (patch)
tree1189957f65dc37fe9f33b313972fc8bf7b4da14e /dix
parent5b169cb695bd450d7f64e3800f00c9237ee67f96 (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>
Diffstat (limited to 'dix')
-rw-r--r--dix/events.c37
-rw-r--r--dix/touch.c26
2 files changed, 59 insertions, 4 deletions
diff --git a/dix/events.c b/dix/events.c
index d8530efc5..48cf7a244 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 */
@@ -1308,7 +1309,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,
@@ -1513,6 +1524,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;
@@ -3829,6 +3842,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)
@@ -3850,13 +3864,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 ||
@@ -3930,6 +3957,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;
+}