Add touchscreen fixes (including pointer emulation) #871064

This commit is contained in:
Peter Hutterer 2012-10-30 11:25:42 +10:00
parent 25c4b40ffb
commit f3b303024e
5 changed files with 179 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From bbf4fe102fb67ed43fe57df085c40de525b8f4c0 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 25 Oct 2012 15:03:50 +0200
Subject: [PATCH] Sync TouchListener memory allocation with population in
TouchSetupListeners()
The allocated TouchListener array may fall short by 1 if hitting the worst case
situation where there's an active grab, passive grabs on each window in the
sprite trace and event selection for touch in one of the windows. This may lead
to memory corruptions as the array is overflown.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
dix/touch.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dix/touch.c b/dix/touch.c
index e64a626..5f77be5 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -572,8 +572,8 @@ TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
return FALSE;
/* Mark which grabs/event selections we're delivering to: max one grab per
- * window plus the bottom-most event selection. */
- ti->listeners = calloc(sprite->spriteTraceGood + 1, sizeof(*ti->listeners));
+ * window plus the bottom-most event selection, plus any active grab. */
+ ti->listeners = calloc(sprite->spriteTraceGood + 2, sizeof(*ti->listeners));
if (!ti->listeners) {
sprite->spriteTraceGood = 0;
return FALSE;
--
1.7.11.7

View File

@ -0,0 +1,60 @@
From 0068a5ae02c6b9ba3a7c8e83de452b6383222b8d Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Mon, 29 Oct 2012 18:33:50 +0100
Subject: [PATCH] Xi: Call UpdateDeviceState() after the first emulated motion
event
The emulated motion event that happens before TouchBegin/ButtonPress should
contain no buttons set in the mask, as it virtually happens at a time when
the button is not yet pressed. This is known to confuse GTK+ and Abiword
to different degrees, as enclosing button press/release events are expected
around changes in the button mask.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
Xi/exevents.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 4cbeb37..769bb41 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1568,15 +1568,16 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
else
touchid = ev->device_event.touchid;
- if (emulate_pointer)
- UpdateDeviceState(dev, &ev->device_event);
-
if (type == ET_TouchBegin) {
ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
emulate_pointer);
}
- else
+ else {
+ if (emulate_pointer)
+ UpdateDeviceState(dev, &ev->device_event);
+
ti = TouchFindByClientID(dev, touchid);
+ }
/* Under the following circumstances we create a new touch record for an
* existing touch:
@@ -1615,8 +1616,12 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
/* if emulate_pointer is set, emulate the motion event right
* here, so we can ignore it for button event emulation. TouchUpdate
* events which _only_ emulate motion just work normally */
- if (emulate_pointer && ev->any.type != ET_TouchUpdate)
+ if (emulate_pointer && ev->any.type != ET_TouchUpdate) {
DeliverEmulatedMotionEvent(dev, ti, ev);
+
+ if (ev->any.type == ET_TouchBegin)
+ UpdateDeviceState(dev, &ev->device_event);
+ }
if (emulate_pointer && IsMaster(dev))
CheckMotion(&ev->device_event, dev);
--
1.7.11.7

View File

@ -0,0 +1,36 @@
From 3e6358ee6c33979329b78fe2097a1fdf76fb69cd Mon Sep 17 00:00:00 2001
From: Daniel Drake <dsd@laptop.org>
Date: Fri, 7 Sep 2012 21:48:35 -0400
Subject: [PATCH] Xi: Don't check for TOUCH_END, it's never set
This flag is never set, so checking for it here means that we'll
never release the simulated mouse button press after the user touches
(and releases) the touchscreen for the first time.
Fixes a problem where the XO laptop touchpad became totally
unusable after touching the screen for the first time (since X then
behaved as if the mouse button was held down all the time).
Signed-off-by: Daniel Drake <dsd@laptop.org>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
Xi/exevents.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 494d07e..6ed4991 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -949,8 +949,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
if (!(event->flags & TOUCH_POINTER_EMULATED))
return DONT_PROCESS;
- if (!(event->flags & TOUCH_END))
- return DONT_PROCESS;
DecreaseButtonCount(device, key, &t->buttonsDown, &t->motionMask,
&t->state);
--
1.7.11.7

View File

@ -0,0 +1,37 @@
From 676447190190d8546165e21be242cf16dd69f5ae Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed, 17 Oct 2012 14:13:29 +1000
Subject: [PATCH] Xi: don't deliver TouchEnd to a client waiting for
TouchBegin (#55738)
If a client is still waiting for the TouchBegin, don't deliver a TouchEnd
event.
X.Org Bug 55738 <http://bugs.freedesktop.org/show_bug.cgi?id=55738>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Thomas Jaeger <thjaeger@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
---
Xi/exevents.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 6ed4991..4cbeb37 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1862,6 +1862,11 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
goto out;
}
+ if (listener->state == LISTENER_AWAITING_BEGIN) {
+ listener->state = LISTENER_HAS_END;
+ goto out;
+ }
+
/* Event in response to reject */
if (ev->device_event.flags & TOUCH_REJECT) {
if (listener->state != LISTENER_HAS_END)
--
1.7.11.7

View File

@ -43,7 +43,7 @@
Summary: X.Org X11 X server
Name: xorg-x11-server
Version: 1.13.0
Release: 5%{?gitdate:.%{gitdate}}%{dist}
Release: 6%{?gitdate:.%{gitdate}}%{dist}
URL: http://www.x.org
License: MIT
Group: User Interface/X
@ -119,6 +119,12 @@ Patch7054: 0001-config-udev-ignore-change-on-drm-devices.patch
# device (ie virtual machine usb tablet)
Patch7055: 0001-dix-set-the-device-transformation-matrix.patch
# Bug 871064 - Add touchscreen fixes for F18
Patch7056: 0001-Sync-TouchListener-memory-allocation-with-population.patch
Patch7057: 0001-Xi-Call-UpdateDeviceState-after-the-first-emulated-m.patch
Patch7058: 0001-Xi-Don-t-check-for-TOUCH_END-it-s-never-set.patch
Patch7059: 0001-Xi-don-t-deliver-TouchEnd-to-a-client-waiting-for-To.patch
%global moduledir %{_libdir}/xorg/modules
%global drimoduledir %{_libdir}/dri
%global sdkdir %{_includedir}/xorg
@ -591,6 +597,9 @@ rm -rf $RPM_BUILD_ROOT
%{xserver_source_dir}
%changelog
* Tue Oct 30 2012 Peter Hutterer <peter.hutterer@redhat.com> 1.13.0-6
- Add touchscreen fixes (including pointer emulation) #871064
* Thu Sep 20 2012 Peter Hutterer <peter.hutterer@redhat.com> 1.13.0-5
- Set the transformation matrix to the unity matrix to avoid spurious cursor
jumps (#852841)