grabHelper: Special case event funneling towards the OSK

In the case of bringing up the OSK while there is a grab (like, every
GNOME Shell entry), we used to special case event capturing so events
directed to the OSK would be let through.

When Clutter.Grab came around, events would be propagated only within
the actor hierarchy that holds the grab, which rendered this special
case just as useless as the OSK while a grab was hold. Since it wouldn't
be part of the grab hierarchy, clicking on the OSK would do nothing.

In order to let the OSK handle events, double down on the special case
and let it forward the event directly to the actor under the device,
instead of trying to let it through somehow. Since the actor under the
device are usually OSK buttons in this case, we don't need further
propagation to make it work, which makes the OSK functional again while
the shell holds a grab.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2237>
This commit is contained in:
Carlos Garnacho 2022-03-09 23:11:03 +01:00 committed by Marge Bot
parent e8eeb44dfe
commit c29e0cf6e6
2 changed files with 10 additions and 4 deletions

View File

@ -272,7 +272,7 @@ var GrabHelper = class GrabHelper {
this.currentGrab.actor.contains(targetActor))
return Clutter.EVENT_PROPAGATE;
if (Main.keyboard.shouldTakeEvent(event))
if (Main.keyboard.maybeHandleEvent(event))
return Clutter.EVENT_PROPAGATE;
if (button || touchBegin) {

View File

@ -1263,13 +1263,19 @@ var KeyboardManager = class KeyBoardManager {
this._keyboard.resetSuggestions();
}
shouldTakeEvent(event) {
maybeHandleEvent(event) {
if (!this._keyboard)
return false;
const actor = global.stage.get_event_actor(event);
return Main.layoutManager.keyboardBox.contains(actor) ||
!!actor._extendedKeys || !!actor.extendedKey;
if (Main.layoutManager.keyboardBox.contains(actor) ||
!!actor._extendedKeys || !!actor.extendedKey) {
actor.event(event);
return true;
}
return false;
}
};