[gnome-shell/wip/carlosg/osk-events-in-grab: 11/11] keyboard: Prevent OSK key buttons from creating grabs
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/osk-events-in-grab: 11/11] keyboard: Prevent OSK key buttons from creating grabs
- Date: Sat, 12 Mar 2022 09:28:16 +0000 (UTC)
commit c1d13fb4714b2813c84be3cfdaea4c898de93484
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Mar 9 23:32:30 2022 +0100
keyboard: Prevent OSK key buttons from creating grabs
In a very un-StButton fashion, OSK keys are not interested in
altering the current focus state, as otherwise pressing those
will trigger a grab that will alter key focus, so the generated
key or IM state events will not be handled by the actor that
originally had the focus as long as the OSK key is pressed.
Despite being StButtons, OSK keys do already perform their own
press/release handling with internal state tracking, so it is
not a big stretch to simply consume the events, and update the
:active pseudo-class manually.
This makes OSK keys still look and behave as usual, but without
any grabbing shenanigans that might affect the focus state. This
makes all OSK keys work again.
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4986
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2237>
js/ui/keyboard.js | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index af195dccfd..37c71b16b6 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -449,11 +449,13 @@ var Key = GObject.registerClass({
button.keyWidth = 1;
button.connect('button-press-event', () => {
this._press(key);
- return Clutter.EVENT_PROPAGATE;
+ button.add_style_pseudo_class('active');
+ return Clutter.EVENT_STOP;
});
button.connect('button-release-event', () => {
this._release(key);
- return Clutter.EVENT_PROPAGATE;
+ button.remove_style_pseudo_class('active');
+ return Clutter.EVENT_STOP;
});
button.connect('touch-event', (actor, event) => {
// We only handle touch events here on wayland. On X11
@@ -472,15 +474,18 @@ var Key = GObject.registerClass({
event.type() == Clutter.EventType.TOUCH_BEGIN) {
this._touchPressSlot = slot;
this._press(key);
+ button.add_style_pseudo_class('active');
} else if (event.type() === Clutter.EventType.TOUCH_END) {
if (!this._touchPressSlot ||
- this._touchPressSlot === slot)
+ this._touchPressSlot === slot) {
this._release(key);
+ button.remove_style_pseudo_class('active');
+ }
if (this._touchPressSlot === slot)
this._touchPressSlot = null;
}
- return Clutter.EVENT_PROPAGATE;
+ return Clutter.EVENT_STOP;
});
return button;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]