Skip to content

Commit 14dac8d

Browse files
committed
keyboardManager.js: Re-apply the keymap on resume, make sure
reapply() really does so. - Connect to prepare-for-sleep from the login manager, re-apply the keymap on resume. - Clear the existing keymap in reapply() so that _applyLayoutGroup() doesn't return early. I was unable to reproduce reported issues after resume, but the conditions for this can be hardware-dependent. Either way, the fix is safe. ref: #13213
1 parent 64540d2 commit 14dac8d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

js/ui/keyboardManager.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const Signals = imports.signals;
77
const ByteArray = imports.byteArray;
88

99
const IBusManager = imports.misc.ibusManager;
10+
const LoginManager = imports.misc.loginManager;
1011
const Main = imports.ui.main;
1112
const PopupMenu = imports.ui.popupMenu;
1213
const Cairo = imports.cairo;
@@ -107,6 +108,10 @@ var KeyboardManager = class {
107108
if (!this._current)
108109
return;
109110

111+
// The live X keymap may have been changed out from under us (e.g. a
112+
// keyboard re-enumerating across suspend/resume), so clear the cache
113+
// to force _applyLayoutGroup to re-push it.
114+
this._currentKeymap = null;
110115
this._applyLayoutGroup(this._current.group);
111116
this._applyLayoutGroupIndex(this._current.groupIndex);
112117
}
@@ -511,6 +516,14 @@ var InputSourceManager = class {
511516

512517
global.display.connect('modifiers-accelerator-activated', () => this._modifiersSwitcher(false));
513518

519+
// The keyboard device can re-initialize across suspend and drop our
520+
// xkb group/options, so re-apply them on resume.
521+
this._loginManager = LoginManager.getLoginManager();
522+
this._loginManager.connect('prepare-for-sleep', (lm, aboutToSuspend) => {
523+
if (!aboutToSuspend)
524+
this._keyboardManager.reapply();
525+
});
526+
514527
this._sourcesPerWindow = false;
515528
this._focusWindowNotifyId = 0;
516529
this._overviewShowingId = 0;

0 commit comments

Comments
 (0)