[gnome-shell/wip/carlosg/osk-updates: 20/40] keyboard: Handle OSK level changes on button release
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/osk-updates: 20/40] keyboard: Handle OSK level changes on button release
- Date: Thu, 28 Jul 2022 10:25:14 +0000 (UTC)
commit 34831af2a56d448c787ef7fb4d16180ebf6eb20f
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Apr 15 19:47:09 2022 +0200
keyboard: Handle OSK level changes on button release
Keep it consistent with the rest of the actions. This also means
the release should be cancelled after long press. Since we used to
hide the button being pressed on modifier changes, and it never
got a paired release, this also fixes spurious long-press signals
being emitted on pointers.
js/ui/keyboard.js | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index ec6a959eb6..f36a3e66ad 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1499,21 +1499,21 @@ var Keyboard = GObject.registerClass({
this._setActiveLayer(0);
});
if (key.action !== null) {
- button.connect('pressed', () => {
- if (key.action === 'levelSwitch') {
- this._setActiveLayer(key.level);
- this._setLatched (
- key.level === 1 &&
- key.iconName === 'keyboard-caps-lock-symbolic');
- }
- });
button.connect('released', () => {
- if (key.action === 'hide')
+ if (key.action === 'hide') {
this.close();
- else if (key.action === 'languageMenu')
+ } else if (key.action === 'languageMenu') {
this._popupLanguageMenu(button);
- else if (key.action === 'emoji')
+ } else if (key.action === 'emoji') {
this._toggleEmoji();
+ } else if (!this._longPressed && key.action === 'levelSwitch') {
+ this._setActiveLayer(key.level);
+ this._setLatched(
+ key.level === 1 &&
+ key.iconName === 'keyboard-caps-lock-symbolic');
+ }
+
+ this._longPressed = false;
});
}
@@ -1521,8 +1521,11 @@ var Keyboard = GObject.registerClass({
key.iconName === 'keyboard-shift-symbolic') {
layout.shiftKeys.push(button);
if (key.level === 1) {
- button.connect('long-press',
- () => this._setLatched(true));
+ button.connect('long-press', () => {
+ this._setActiveLayer(key.level);
+ this._setLatched(true);
+ this._longPressed = true;
+ });
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]