mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
keyboard: Emit key release right away
At the moment the on-screen keyboard doesn't emit the key release event until the user stops pushing the keyboard button with their pointer. This means if the user uses the pointer to hold the button down, it can generate repeat events for some keys. But this creates a bit of an inconsistency in behavior between keys that support multiple choices via long press and those that don't. The ones that support long press, don't repeat, instead they show the available choices. Furthermore, key repeat doesn't work for any of the keys with the wayland backend, since key repeat is a client side thing, and we just don't have it implemented for this path. Also, key repeat is repeating the wrong keys right now, even on X11, for keys that require a shift level (see https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2045 ) Given key repeat is a dubious feature in an on-screen keyboard to begin with, and it's only implemented for one backend, and it's not even completely working on that backend, it's probably best to drop support. This commit changes the on-screen keyboard to always emit a key release immediately after each key press.
This commit is contained in:
parent
f5293a56e6
commit
5381d4422d
1 changed files with 8 additions and 23 deletions
|
|
@ -1400,8 +1400,7 @@ var Keyboard = GObject.registerClass({
|
|||
|
||||
this._keypad = new Keypad();
|
||||
this._connectSignal(this._keypad, 'keyval', (_keypad, keyval) => {
|
||||
this._keyboardController.keyvalPress(keyval);
|
||||
this._keyboardController.keyvalRelease(keyval);
|
||||
this._keyboardController.keyvalPressAndRelease(keyval);
|
||||
});
|
||||
this._aspectContainer.add_child(this._keypad);
|
||||
this._keypad.hide();
|
||||
|
|
@ -1501,20 +1500,11 @@ var Keyboard = GObject.registerClass({
|
|||
|
||||
button.connect('pressed', (actor, keyval, str) => {
|
||||
if (!Main.inputMethod.currentFocus ||
|
||||
!this._keyboardController.commitString(str, true)) {
|
||||
if (keyval != 0) {
|
||||
this._keyboardController.keyvalPress(keyval);
|
||||
button._keyvalPress = true;
|
||||
}
|
||||
}
|
||||
!this._keyboardController.commitString(str, true) &&
|
||||
keyval !== 0)
|
||||
this._keyboardController.keyvalPressAndRelease(keyval);
|
||||
});
|
||||
button.connect('released', (actor, keyval, _str) => {
|
||||
if (keyval != 0) {
|
||||
if (button._keyvalPress)
|
||||
this._keyboardController.keyvalRelease(keyval);
|
||||
button._keyvalPress = false;
|
||||
}
|
||||
|
||||
button.connect('released', () => {
|
||||
if (!this._latched)
|
||||
this._setActiveLayer(0);
|
||||
});
|
||||
|
|
@ -1561,13 +1551,11 @@ var Keyboard = GObject.registerClass({
|
|||
// Shift only gets latched on long press
|
||||
this._latched = switchToLevel != 1;
|
||||
} else if (keyval != null) {
|
||||
this._keyboardController.keyvalPress(keyval);
|
||||
this._keyboardController.keyvalPressAndRelease(keyval);
|
||||
}
|
||||
});
|
||||
extraButton.connect('released', () => {
|
||||
if (keyval)
|
||||
this._keyboardController.keyvalRelease(keyval);
|
||||
else if (action === 'hide')
|
||||
if (action === 'hide')
|
||||
this.close();
|
||||
else if (action === 'languageMenu')
|
||||
this._popupLanguageMenu(actor);
|
||||
|
|
@ -2124,12 +2112,9 @@ var KeyboardController = class {
|
|||
return true;
|
||||
}
|
||||
|
||||
keyvalPress(keyval) {
|
||||
keyvalPressAndRelease(keyval) {
|
||||
this._virtualDevice.notify_keyval(Clutter.get_current_event_time() * 1000,
|
||||
keyval, Clutter.KeyState.PRESSED);
|
||||
}
|
||||
|
||||
keyvalRelease(keyval) {
|
||||
this._virtualDevice.notify_keyval(Clutter.get_current_event_time() * 1000,
|
||||
keyval, Clutter.KeyState.RELEASED);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue