keyboard: Drop layoutManager's keyboard-visible-changed
Since now the signal is emitted and handled all within keyboard.js, use an internal signal to manage keyboard visibility and gesture enablement. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1668>
This commit is contained in:
parent
0580fe6eff
commit
8e73143b24
@ -1150,11 +1150,8 @@ var KeyboardManager = class KeyBoardManager {
|
|||||||
bottomDragAction.connect('activated', () => {
|
bottomDragAction.connect('activated', () => {
|
||||||
this.open(Main.layoutManager.bottomIndex);
|
this.open(Main.layoutManager.bottomIndex);
|
||||||
});
|
});
|
||||||
Main.layoutManager.connect('keyboard-visible-changed', (_manager, visible) => {
|
|
||||||
bottomDragAction.cancel();
|
|
||||||
bottomDragAction.set_enabled(!visible);
|
|
||||||
});
|
|
||||||
global.stage.add_action(bottomDragAction);
|
global.stage.add_action(bottomDragAction);
|
||||||
|
this._bottomDragAction = bottomDragAction;
|
||||||
|
|
||||||
this._syncEnabled();
|
this._syncEnabled();
|
||||||
}
|
}
|
||||||
@ -1177,10 +1174,14 @@ var KeyboardManager = class KeyBoardManager {
|
|||||||
|
|
||||||
if (enabled && !this._keyboard) {
|
if (enabled && !this._keyboard) {
|
||||||
this._keyboard = new Keyboard();
|
this._keyboard = new Keyboard();
|
||||||
|
this._keyboard.connect('visibility-changed', () => {
|
||||||
|
this._bottomDragAction.enabled = !this._keyboard.visible;
|
||||||
|
});
|
||||||
} else if (!enabled && this._keyboard) {
|
} else if (!enabled && this._keyboard) {
|
||||||
this._keyboard.setCursorLocation(null);
|
this._keyboard.setCursorLocation(null);
|
||||||
this._keyboard.destroy();
|
this._keyboard.destroy();
|
||||||
this._keyboard = null;
|
this._keyboard = null;
|
||||||
|
this._bottomDragAction.enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1222,8 +1223,11 @@ var KeyboardManager = class KeyBoardManager {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var Keyboard = GObject.registerClass(
|
var Keyboard = GObject.registerClass({
|
||||||
class Keyboard extends St.BoxLayout {
|
Signals: {
|
||||||
|
'visibility-changed': {},
|
||||||
|
},
|
||||||
|
}, class Keyboard extends St.BoxLayout {
|
||||||
_init() {
|
_init() {
|
||||||
super._init({ name: 'keyboard', reactive: true, vertical: true });
|
super._init({ name: 'keyboard', reactive: true, vertical: true });
|
||||||
this._focusInExtendedKeys = false;
|
this._focusInExtendedKeys = false;
|
||||||
@ -1260,9 +1264,6 @@ class Keyboard extends St.BoxLayout {
|
|||||||
this._showIdleId = 0;
|
this._showIdleId = 0;
|
||||||
|
|
||||||
this._keyboardVisible = false;
|
this._keyboardVisible = false;
|
||||||
this._connectSignal(Main.layoutManager, 'keyboard-visible-changed', (_lm, visible) => {
|
|
||||||
this._keyboardVisible = visible;
|
|
||||||
});
|
|
||||||
this._keyboardRequested = false;
|
this._keyboardRequested = false;
|
||||||
this._keyboardRestingId = 0;
|
this._keyboardRestingId = 0;
|
||||||
|
|
||||||
@ -1802,7 +1803,8 @@ class Keyboard extends St.BoxLayout {
|
|||||||
this._animateShowComplete();
|
this._animateShowComplete();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Main.layoutManager.emit('keyboard-visible-changed', true);
|
this._keyboardVisible = true;
|
||||||
|
this.emit('visibility-changed');
|
||||||
}
|
}
|
||||||
|
|
||||||
_animateShowComplete() {
|
_animateShowComplete() {
|
||||||
@ -1830,7 +1832,8 @@ class Keyboard extends St.BoxLayout {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Main.layoutManager.emit('keyboard-visible-changed', false);
|
this._keyboardVisible = false;
|
||||||
|
this.emit('visibility-changed');
|
||||||
}
|
}
|
||||||
|
|
||||||
_animateHideComplete() {
|
_animateHideComplete() {
|
||||||
|
@ -181,12 +181,13 @@ const defaultParams = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var LayoutManager = GObject.registerClass({
|
var LayoutManager = GObject.registerClass({
|
||||||
Signals: { 'hot-corners-changed': {},
|
Signals: {
|
||||||
'startup-complete': {},
|
'hot-corners-changed': {},
|
||||||
'startup-prepared': {},
|
'startup-complete': {},
|
||||||
'monitors-changed': {},
|
'startup-prepared': {},
|
||||||
'system-modal-opened': {},
|
'monitors-changed': {},
|
||||||
'keyboard-visible-changed': { param_types: [GObject.TYPE_BOOLEAN] } },
|
'system-modal-opened': {},
|
||||||
|
},
|
||||||
}, class LayoutManager extends GObject.Object {
|
}, class LayoutManager extends GObject.Object {
|
||||||
_init() {
|
_init() {
|
||||||
super._init();
|
super._init();
|
||||||
|
Loading…
Reference in New Issue
Block a user