summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2012-04-17 13:56:08 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2012-04-26 13:35:12 +1000
commitda9cedb1e5e50acc7d3dc40398e1a460b7e3cfdc (patch)
treec264b7cb8497c20fa2695ea9504cca7a0a163a77
parent7be71cb0894052943f94638ffa405cf8dd61bc4a (diff)
Rename TouchEnsureSprite to TouchBuildSprite and event type checks
The function will be used for building a sprite for pointer emulation after an explicit device grab. This commit refactors the code so that TouchBuildSprite will function with any event type and moves the checks to the caller. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 3d06bfe93d33cfe6150d8fb0058ee7bc8d80622b)
-rw-r--r--Xi/exevents.c6
-rw-r--r--dix/touch.c14
-rw-r--r--include/input.h4
3 files changed, 8 insertions, 16 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index eace62e5e..0c483acbb 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1625,9 +1625,11 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
CheckMotion(&ev->device_event, dev);
/* Make sure we have a valid window trace for event delivery; must be
- * called after event type mutation. */
+ * called after event type mutation. Touch end events are always processed
+ * in order to end touch records. */
/* FIXME: check this */
- if (!TouchEnsureSprite(dev, ti, ev))
+ if ((type == ET_TouchBegin && !TouchBuildSprite(dev, ti, ev)) ||
+ (type != ET_TouchEnd && ti->sprite.spriteTraceGood == 0))
return;
/* TouchOwnership events are handled separately from the rest, as they
diff --git a/dix/touch.c b/dix/touch.c
index 72faad546..e638a894a 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -542,22 +542,12 @@ TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite)
* TouchBegin events.
*/
Bool
-TouchEnsureSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
- InternalEvent *ev)
+TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
+ InternalEvent *ev)
{
TouchClassPtr t = sourcedev->touch;
SpritePtr sprite = &ti->sprite;
- /* We may not have a sprite if there are no applicable grabs or
- * event selections, or if they've disappeared, or if all the grab
- * owners have rejected the touch. Don't bother delivering motion
- * events if not, but TouchEnd events still need to be processed so
- * we can call FinishTouchPoint and release it for later use. */
- if (ev->any.type == ET_TouchEnd)
- return TRUE;
- else if (ev->any.type != ET_TouchBegin)
- return (sprite->spriteTraceGood > 0);
-
if (t->mode == XIDirectTouch) {
/* Focus immediately under the touchpoint in direct touch mode.
* XXX: Do we need to handle crossing screens here? */
diff --git a/include/input.h b/include/input.h
index 9a6fdfe6f..991d64813 100644
--- a/include/input.h
+++ b/include/input.h
@@ -563,8 +563,8 @@ extern void TouchAddListener(TouchPointInfoPtr ti, XID resource,
extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource);
extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti,
InternalEvent *ev);
-extern Bool TouchEnsureSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
- InternalEvent *ev);
+extern Bool TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
+ InternalEvent *ev);
extern Bool TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite);
extern int TouchConvertToPointerEvent(const InternalEvent *ev,
InternalEvent *motion,