summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2021-10-06 15:42:17 -0400
committerRay Strode <rstrode@redhat.com>2021-10-07 13:59:50 -0400
commit5381d4422de65064961e9053212213bb339dc177 (patch)
tree171c748ecce42a8c8563d5f1d97e20511733421e
parentf5293a56e68323e11fb1cae9bda40b864153eb3d (diff)
downloadgnome-shell-drop-osk-key-repeat-feature.tar.gz
keyboard: Emit key release right awaydrop-osk-key-repeat-feature
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.
-rw-r--r--js/ui/keyboard.js31
1 files changed, 8 insertions, 23 deletions
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index f08ff8fd1..a5844e7e0 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -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);
}