[gnome-shell/wip/carlosg/osk-tap-drag-release: 39/39] keyboard: Always emit ::pressed late on keys with variants




commit 41fd06ce147c71b1a2a8c09b7de9412026f6fbb9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Apr 1 19:25:24 2021 +0200

    keyboard: Always emit ::pressed late on keys with variants
    
    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.

 js/ui/keyboard.js | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index c6d6fab60a..bc72d77f3d 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() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]