keyboard: Shift key shouldn't latch the state unless long pressed
Instead of latching all states, make shift unlatched by default, and only latched when making a long press on the key. When not latched, the keyboard will switch to the first level (alphabetic lowercase) after the first key press. Also, move the actual level switch to Key::pressed, so it feels more reactive on long press. https://gitlab.gnome.org/GNOME/gnome-shell/issues/46
This commit is contained in:
parent
d8fd7b5a44
commit
5f6745cad0
@ -499,6 +499,7 @@ var Keyboard = new Lang.Class({
|
||||
|
||||
this._enableKeyboard = false; // a11y settings value
|
||||
this._enabled = false; // enabled state (by setting or device type)
|
||||
this._latched = false; // current level is latched
|
||||
|
||||
this._a11yApplicationsSettings = new Gio.Settings({ schema_id: A11Y_APPLICATIONS_SCHEMA });
|
||||
this._a11yApplicationsSettings.connect('changed', Lang.bind(this, this._syncEnabled));
|
||||
@ -787,6 +788,9 @@ var Keyboard = new Lang.Class({
|
||||
this._keyboardController.keyvalRelease(keyval);
|
||||
button._keyvalPress = false;
|
||||
}
|
||||
|
||||
if (!this._latched)
|
||||
this._setActiveLayer(0);
|
||||
}));
|
||||
|
||||
layout.appendKey(button.actor, button.keyButton.keyWidth);
|
||||
@ -821,13 +825,16 @@ var Keyboard = new Lang.Class({
|
||||
let actor = extraButton.keyButton;
|
||||
|
||||
extraButton.connect('pressed', Lang.bind(this, function() {
|
||||
if (keyval != null)
|
||||
if (switchToLevel != null) {
|
||||
this._setActiveLayer(switchToLevel);
|
||||
// Shift only gets latched on long press
|
||||
this._latched = (switchToLevel != 1);
|
||||
} else if (keyval != null) {
|
||||
this._keyboardController.keyvalPress(keyval);
|
||||
}
|
||||
}));
|
||||
extraButton.connect('released', Lang.bind(this, function() {
|
||||
if (switchToLevel != null)
|
||||
this._setActiveLayer(switchToLevel);
|
||||
else if (keyval != null)
|
||||
if (keyval != null)
|
||||
this._keyboardController.keyvalRelease(keyval);
|
||||
else if (action == 'hide')
|
||||
this.hide();
|
||||
@ -835,6 +842,12 @@ var Keyboard = new Lang.Class({
|
||||
this._popupLanguageMenu(actor);
|
||||
}));
|
||||
|
||||
if (switchToLevel == 1) {
|
||||
extraButton.connect('long-press', Lang.bind(this, function() {
|
||||
this._latched = true;
|
||||
}));
|
||||
}
|
||||
|
||||
/* Fixup default keys based on the number of levels/keys */
|
||||
if (key.label == '⇧' && numLevels == 3) {
|
||||
if (key.right) {
|
||||
|
Loading…
Reference in New Issue
Block a user