[gnome-shell/wip/carlosg/osk-updates: 23/33] 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: 23/33] keyboard: Handle OSK level changes on button release
- Date: Tue, 26 Apr 2022 12:17:52 +0000 (UTC)
commit 6912cf8a348ba78de6c68719d91a53f0c4905c3e
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 | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index fb87e33519..980de0fd5f 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1500,14 +1500,6 @@ var Keyboard = GObject.registerClass({
if (!this._latched)
this._setActiveLayer(0);
});
- 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')
this.close();
@@ -1515,6 +1507,14 @@ var Keyboard = GObject.registerClass({
this._popupLanguageMenu(button);
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 = null;
});
if (key.action === 'levelSwitch' &&
@@ -1522,7 +1522,9 @@ var Keyboard = GObject.registerClass({
layout.shiftKeys.push(button);
if (key.level === 1) {
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]