keyboard: Only reset to the default level on unlocked latched levels

Reportedly, non-alphanumeric key levels were able to stick by
happenstance, and let the user press multiple keys until explicitly
switching to a different mode. Reportedly, this broke, switching to
the default level after the first key press on the additional levels.

Since we have this information in the OSK key models (each level has
a "mode" field to either default/latched/locked), retrieve this
information for them for each level, and only reset to the default
level if on one of those latched levels, and the relevant key was not
locked through long-press.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5763
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2945>
This commit is contained in:
Carlos Garnacho 2023-09-08 19:01:29 +02:00
parent 08f3ad3835
commit bc3b890e75

View File

@ -1498,6 +1498,7 @@ export const Keyboard = GObject.registerClass({
let layout = new KeyContainer();
layout.shiftKeys = [];
layout.mode = currentLevel.mode;
this._loadRows(currentLevel, level, levels.length, layout);
layers[level] = layout;
@ -1534,7 +1535,7 @@ export const Keyboard = GObject.registerClass({
if (key.action !== 'modifier') {
button.connect('commit', (_actor, keyval, str) => {
this._commitAction(keyval, str).then(() => {
if (!this._latched)
if (layout.mode === 'latched' && !this._latched)
this._setActiveLayer(0);
});
});