[gnome-shell/wip/carlosg/osk-gesture-feedback: 15/15] keyboard: Handle edge drag gesture cancellation




commit e3c91cf2709b160f0e1b433f9fee72d30f922756
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Feb 14 10:26:38 2021 +0100

    keyboard: Handle edge drag gesture cancellation
    
    Hide the keyboard again if the gesture happens to stay/return
    within it's activation threshold.

 js/ui/edgeDragAction.js | 2 ++
 js/ui/keyboard.js       | 7 +++++++
 2 files changed, 9 insertions(+)
---
diff --git a/js/ui/edgeDragAction.js b/js/ui/edgeDragAction.js
index 540ff4b9dd..986b658e06 100644
--- a/js/ui/edgeDragAction.js
+++ b/js/ui/edgeDragAction.js
@@ -82,5 +82,7 @@ var EdgeDragAction = GObject.registerClass({
             (this._side == St.Side.LEFT && x > monitorRect.x + DRAG_DISTANCE) ||
             (this._side == St.Side.RIGHT && x < monitorRect.x + monitorRect.width - DRAG_DISTANCE))
             this.emit('activated');
+        else
+            this.cancel();
     }
 });
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 474314ea72..6124b0377a 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1153,6 +1153,9 @@ var KeyboardManager = class KeyBoardManager {
         bottomDragAction.connect('progress', (_action, progress) => {
             this._keyboard.gestureProgress(progress);
         });
+        bottomDragAction.connect('gesture-cancel', () => {
+            this._keyboard.gestureCancel();
+        });
         global.stage.add_action(bottomDragAction);
         this._bottomDragAction = bottomDragAction;
 
@@ -1858,6 +1861,10 @@ var Keyboard = GObject.registerClass({
         this.open(true);
     }
 
+    gestureCancel() {
+        this.animateHide();
+    }
+
     resetSuggestions() {
         if (this._suggestions)
             this._suggestions.clear();


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