summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2021-04-01 19:25:24 +0200
committerCarlos Garnacho <carlosg@gnome.org>2021-04-27 22:02:53 +0200
commit41fd06ce147c71b1a2a8c09b7de9412026f6fbb9 (patch)
tree1add715c1129793e83f70525e9ee1399e8769b43
parentf609d919aa08dd487efef1e7e69117ba0ea68a8d (diff)
downloadgnome-shell-wip/carlosg/osk-tap-drag-release.tar.gz
keyboard: Always emit ::pressed late on keys with variantswip/carlosg/osk-tap-drag-release
When we press a key with variants, we used to prevent an early ::pressed, because a long press could show the options popover, and the press be undone. In addition, this long press could move to one of the suboptions, and be released there. For this case we also want this late emission of the ::pressed signal. This makes the "tap, drag, release" pattern work on the regular OSK keys, in addition to the emoji panel.
-rw-r--r--js/ui/keyboard.js7
1 files changed, 2 insertions, 5 deletions
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index c6d6fab60..bc72d77f3 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -296,7 +296,6 @@ var Key = GObject.registerClass({
this._capturedEventId = 0;
this._unmapId = 0;
- this._longPress = false;
}
_onDestroy() {
@@ -334,14 +333,13 @@ var Key = GObject.registerClass({
_press(key) {
this.emit('activated');
- if (key !== this.key || this._extendedKeys.length === 0)
+ if (this._extendedKeys.length === 0)
this.emit('pressed', this._getKeyval(key), key);
if (key == this.key) {
this._pressTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
KEY_LONG_PRESS_TIME,
() => {
- this._longPress = true;
this._pressTimeoutId = 0;
this.emit('long-press');
@@ -365,12 +363,11 @@ var Key = GObject.registerClass({
this._pressTimeoutId = 0;
}
- if (!this._longPress && key === this.key && this._extendedKeys.length > 0)
+ if (this._extendedKeys.length > 0)
this.emit('pressed', this._getKeyval(key), key);
this.emit('released', this._getKeyval(key), key);
this._hideSubkeys();
- this._longPress = false;
}
cancel() {