keyboard: Handle edge drag gesture cancellation
Hide the keyboard again if the gesture happens to stay/return within it's activation threshold. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1668>
This commit is contained in:
parent
c62177e669
commit
0b16565e70
@ -82,5 +82,7 @@ var EdgeDragAction = GObject.registerClass({
|
|||||||
(this._side == St.Side.LEFT && x > monitorRect.x + DRAG_DISTANCE) ||
|
(this._side == St.Side.LEFT && x > monitorRect.x + DRAG_DISTANCE) ||
|
||||||
(this._side == St.Side.RIGHT && x < monitorRect.x + monitorRect.width - DRAG_DISTANCE))
|
(this._side == St.Side.RIGHT && x < monitorRect.x + monitorRect.width - DRAG_DISTANCE))
|
||||||
this.emit('activated');
|
this.emit('activated');
|
||||||
|
else
|
||||||
|
this.cancel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1148,10 +1148,16 @@ var KeyboardManager = class KeyBoardManager {
|
|||||||
const mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN;
|
const mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN;
|
||||||
const bottomDragAction = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM, mode);
|
const bottomDragAction = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM, mode);
|
||||||
bottomDragAction.connect('activated', () => {
|
bottomDragAction.connect('activated', () => {
|
||||||
this._keyboard.gestureActivate(Main.layoutManager.bottomIndex);
|
if (this._keyboard)
|
||||||
|
this._keyboard.gestureActivate(Main.layoutManager.bottomIndex);
|
||||||
});
|
});
|
||||||
bottomDragAction.connect('progress', (_action, progress) => {
|
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);
|
global.stage.add_action(bottomDragAction);
|
||||||
this._bottomDragAction = bottomDragAction;
|
this._bottomDragAction = bottomDragAction;
|
||||||
@ -1844,6 +1850,7 @@ var Keyboard = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
gestureProgress(delta) {
|
gestureProgress(delta) {
|
||||||
|
this._gestureInProgress = true;
|
||||||
Main.layoutManager.keyboardBox.show();
|
Main.layoutManager.keyboardBox.show();
|
||||||
let progress = Math.min(delta, this.height) / this.height;
|
let progress = Math.min(delta, this.height) / this.height;
|
||||||
this.translation_y = -this.height * progress;
|
this.translation_y = -this.height * progress;
|
||||||
@ -1856,6 +1863,13 @@ var Keyboard = GObject.registerClass({
|
|||||||
|
|
||||||
gestureActivate() {
|
gestureActivate() {
|
||||||
this.open(true);
|
this.open(true);
|
||||||
|
this._gestureInProgress = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
gestureCancel() {
|
||||||
|
if (this._gestureInProgress)
|
||||||
|
this.animateHide();
|
||||||
|
this._gestureInProgress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
resetSuggestions() {
|
resetSuggestions() {
|
||||||
|
Loading…
Reference in New Issue
Block a user