From 34e969ac4ea35a42d8e14aa9de3f23e292845317 Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Wed, 4 Jul 2018 15:32:42 +0000 Subject: [PATCH] keyboard: Activated extended key on long-press. Activate an extended key in case the user keeps the mouse button pressed (or the finger attached to the screen) after showing the extended keys popup. Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/211 --- js/ui/keyboard.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index e13c7b7247..20908f2a2a 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -312,6 +312,7 @@ var Key = new Lang.Class({ if (this._extended_keys.length > 0) { this._touchPressed = false; + this._mousePressed = false; this.keyButton.set_hover(false); this.keyButton.fake_release(); this._ensureExtendedKeysPopup(); @@ -386,10 +387,17 @@ var Key = new Lang.Class({ button.keyWidth = 1; button.connect('button-press-event', () => { this._press(key); + this._mousePressed = true; return Clutter.EVENT_PROPAGATE; }); button.connect('button-release-event', () => { + if (this._mousePressed == false) { + // This is required in order to activate an extended key + // in case the user keeps the mouse pressed. + this._press(key); + } this._release(key); + this._mousePressed = false; return Clutter.EVENT_PROPAGATE; }); button.connect('touch-event', (actor, event) => { @@ -417,6 +425,13 @@ var Key = new Lang.Class({ device.sequence_ungrab(sequence); this._touchPressed = false; this._release(key); + } else if (!this._touchPressed && + event.type() == Clutter.EventType.TOUCH_END && + device.sequence_get_grabbed_actor(sequence) == null) { + // This is required in order to activate an extended key + // in case the user keeps the finger over the screen. + this._press(key); + this._release(key); } return Clutter.EVENT_PROPAGATE; }); -- GitLab