[gnome-shell/wip/carlosg/osk-tap-drag-release: 38/39] keyboard: Allow calling _release() without press on OSK keys with touch
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/osk-tap-drag-release: 38/39] keyboard: Allow calling _release() without press on OSK keys with touch
- Date: Tue, 27 Apr 2021 20:04:31 +0000 (UTC)
commit f609d919aa08dd487efef1e7e69117ba0ea68a8d
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Mar 22 18:01:39 2021 +0100
keyboard: Allow calling _release() without press on OSK keys with touch
This is already allowed for pointer events, but touch events still expected
that the touch begin and end happen on the same Key actor. Change this
behavior for touch events, this is necessary for the tap-drag-release
pattern to select key variants to work on all input devices.
js/ui/keyboard.js | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 10a21cbe07..c6d6fab60a 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -347,7 +347,7 @@ var Key = GObject.registerClass({
this.emit('long-press');
if (this._extendedKeys.length > 0) {
- this._touchPressed = false;
+ this._touchPressSlot = null;
this._ensureExtendedKeysPopup();
this.keyButton.set_hover(false);
this.keyButton.fake_release();
@@ -378,7 +378,7 @@ var Key = GObject.registerClass({
GLib.source_remove(this._pressTimeoutId);
this._pressTimeoutId = 0;
}
- this._touchPressed = false;
+ this._touchPressSlot = null;
this.keyButton.set_hover(false);
this.keyButton.fake_release();
}
@@ -459,14 +459,19 @@ var Key = GObject.registerClass({
if (!Meta.is_wayland_compositor())
return Clutter.EVENT_PROPAGATE;
- if (!this._touchPressed &&
+ const slot = event.get_event_sequence().get_slot();
+
+ if (!this._touchPressSlot &&
event.type() == Clutter.EventType.TOUCH_BEGIN) {
- this._touchPressed = true;
+ this._touchPressSlot = slot;
this._press(key);
- } else if (this._touchPressed &&
- event.type() == Clutter.EventType.TOUCH_END) {
- this._touchPressed = false;
- this._release(key);
+ } else if (event.type() === Clutter.EventType.TOUCH_END) {
+ if (!this._touchPressSlot ||
+ this._touchPressSlot === slot)
+ this._release(key);
+
+ if (this._touchPressSlot === slot)
+ this._touchPressSlot = null;
}
return Clutter.EVENT_PROPAGATE;
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]