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




commit 7dc037e160569e938973a64f703a33eef1442da9
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 to work on the
    regular OSK keys, in addition to the emoji panel.

 js/ui/keyboard.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index b07990d543..86ce378653 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -334,7 +334,7 @@ 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) {
@@ -365,7 +365,7 @@ 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);


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