Skip to content

Commit de330fe

Browse files
committed
modalDialog.js: Remove on-screen-keyboard/lightbox workaround.
ModalDialog's lightbox is no longer disabled when the osk is enabled. Instead, the keyboard is raised above the lightbox, so it remains accessible while the rest of the desktop is covered. ref: linuxmint/mint22.1-beta#70
1 parent 31a7162 commit de330fe

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

js/ui/modalDialog.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ModalDialog extends BaseDialog.BaseDialog {
4646
*/
4747
_init(params) {
4848
params = Params.parse(params, {
49-
cinnamonReactive: Main.virtualKeyboardManager.enabled,
49+
cinnamonReactive: false,
5050
styleClass: null,
5151
destroyOnClose: true,
5252
});
@@ -63,6 +63,7 @@ class ModalDialog extends BaseDialog.BaseDialog {
6363
this._hasModal = false;
6464
this._savedKeyFocus = null;
6565
this._cinnamonReactive = params.cinnamonReactive;
66+
this._keyboardVisibleId = 0;
6667

6768
Main.uiGroup.add_actor(this);
6869

@@ -98,6 +99,23 @@ class ModalDialog extends BaseDialog.BaseDialog {
9899
this._eventBlocker = new Clutter.Actor({ reactive: true });
99100
this.backgroundStack.add_actor(this._eventBlocker);
100101
}
102+
103+
this.connect('destroy', () => this._disconnectKeyboardTracking());
104+
}
105+
106+
_disconnectKeyboardTracking() {
107+
if (this._keyboardVisibleId) {
108+
Main.layoutManager.disconnect(this._keyboardVisibleId);
109+
this._keyboardVisibleId = 0;
110+
}
111+
}
112+
113+
// Keep the on-screen keyboard above the lightbox shade so its keys remain
114+
// visible and tappable while a modal dialog is open.
115+
_raiseKeyboardAboveDialog() {
116+
let keyboardBox = Main.layoutManager.keyboardBox;
117+
if (keyboardBox && keyboardBox.visible)
118+
Main.uiGroup.set_child_above_sibling(keyboardBox, this);
101119
}
102120

103121
_fadeOpen() {
@@ -127,6 +145,15 @@ class ModalDialog extends BaseDialog.BaseDialog {
127145

128146
this._fadeOpen();
129147

148+
if (this._lightbox && !this._keyboardVisibleId) {
149+
this._keyboardVisibleId = Main.layoutManager.connect('keyboard-visible-changed',
150+
(lm, visible) => {
151+
if (visible)
152+
this._raiseKeyboardAboveDialog();
153+
});
154+
this._raiseKeyboardAboveDialog();
155+
}
156+
130157
this._openedId = this.connect('opened', () => {
131158
this.disconnect(this._openedId);
132159
this._openedId = 0;
@@ -152,6 +179,8 @@ class ModalDialog extends BaseDialog.BaseDialog {
152179
this._openedId = 0;
153180
}
154181

182+
this._disconnectKeyboardTracking();
183+
155184
this.popModal(timestamp);
156185
this._savedKeyFocus = null;
157186

0 commit comments

Comments
 (0)