summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2021-02-14 10:26:38 +0100
committerCarlos Garnacho <carlosg@gnome.org>2021-02-16 15:11:22 +0100
commit1e9c0e8e6fa565629e2040e4c9f1f721288d4bd2 (patch)
treef1645df9dc25c76a7e1bc27b12de2334a16554f5
parentd1f9def7196c408c4fedb2ff301e96ed7cce16ea (diff)
downloadgnome-shell-wip/carlosg/osk-gesture-feedback.tar.gz
keyboard: Handle edge drag gesture cancellationwip/carlosg/osk-gesture-feedback
Hide the keyboard again if the gesture happens to stay/return within it's activation threshold.
-rw-r--r--js/ui/edgeDragAction.js2
-rw-r--r--js/ui/keyboard.js18
2 files changed, 18 insertions, 2 deletions
diff --git a/js/ui/edgeDragAction.js b/js/ui/edgeDragAction.js
index 540ff4b9d..986b658e0 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 50a1cd7f4..aae72b960 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1148,10 +1148,16 @@ var KeyboardManager = class KeyBoardManager {
const mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN;
const bottomDragAction = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM, mode);
bottomDragAction.connect('activated', () => {
- this._keyboard.gestureActivate(Main.layoutManager.bottomIndex);
+ if (this._keyboard)
+ this._keyboard.gestureActivate(Main.layoutManager.bottomIndex);
});
bottomDragAction.connect('progress', (_action, progress) => {
- this._keyboard.gestureProgress(progress);
+ if (this._keyboard)
+ this._keyboard.gestureProgress(progress);
+ });
+ bottomDragAction.connect('gesture-cancel', () => {
+ if (this._keyboard)
+ this._keyboard.gestureCancel();
});
global.stage.add_action(bottomDragAction);
this._bottomDragAction = bottomDragAction;
@@ -1844,6 +1850,7 @@ var Keyboard = GObject.registerClass({
}
gestureProgress(delta) {
+ this._gestureInProgress = true;
Main.layoutManager.keyboardBox.show();
let progress = Math.min(delta, this.height) / this.height;
this.translation_y = -this.height * progress;
@@ -1856,6 +1863,13 @@ var Keyboard = GObject.registerClass({
gestureActivate() {
this.open(true);
+ this._gestureInProgress = false;
+ }
+
+ gestureCancel() {
+ if (this._gestureInProgress)
+ this.animateHide();
+ this._gestureInProgress = false;
}
resetSuggestions() {