[gnome-shell] Revert "Revert "keyboard: Handle touch events""
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Revert "Revert "keyboard: Handle touch events""
- Date: Tue, 2 Jun 2015 15:59:14 +0000 (UTC)
commit a7b0910566587676f9eab88884f8cb6628854f99
Author: Rui Matos <tiagomatos gmail com>
Date: Mon Jun 1 16:21:08 2015 +0100
Revert "Revert "keyboard: Handle touch events""
And make these only handled on wayland. There's a plethora of issues
around touch passive grab and touch/pointer doubly handling to use
these right away on X11, so we stick to single-touch/pointer there.
This reverts commit 032a688a72110c7f7b976a5b3bd03c3feab32646.
https://bugzilla.gnome.org/show_bug.cgi?id=750287
js/ui/keyboard.js | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 20c4501..3f356b6 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -114,6 +114,35 @@ const Key = new Lang.Class({
key.release();
return Clutter.EVENT_PROPAGATE;
}));
+ button.connect('touch-event', Lang.bind(this,
+ function (actor, event) {
+ let device = event.get_device();
+ let sequence = event.get_event_sequence();
+
+ // We only handle touch events here on wayland. On X11
+ // we do get emulated pointer events, which already works
+ // for single-touch cases. Besides, the X11 passive touch grab
+ // set up by Mutter will make us see first the touch events
+ // and later the pointer events, so it will look like two
+ // unrelated series of events, we want to avoid double handling
+ // in these cases.
+ if (!Meta.is_wayland_compositor())
+ return Clutter.EVENT_PROPAGATE;
+
+ if (!this._touchPressed &&
+ event.type() == Clutter.EventType.TOUCH_BEGIN) {
+ device.sequence_grab(sequence, actor);
+ this._touchPressed = true;
+ key.press();
+ } else if (this._touchPressed &&
+ event.type() == Clutter.EventType.TOUCH_END &&
+ device.sequence_get_grabbed_actor(sequence) == actor) {
+ device.sequence_ungrab(sequence);
+ this._touchPressed = false;
+ key.release();
+ }
+ return Clutter.EVENT_PROPAGATE;
+ }));
return button;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]