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>
This commit is contained in:
parent
c29e0cf6e6
commit
c1d13fb471
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user