ibusCandidatePopup: Make pagination buttons clickable without stealing focus

The default StButton event handlers will create a temporary grab that will
steal the keyboard focus out of the client, and cause it to pop down the
candidates window.

Avoid the default grabbing behavior, so that focus stays on the Wayland
client while interacting with the ibusCandidatesPopup with the pointer.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2244
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2497>
This commit is contained in:
Carlos Garnacho 2022-09-20 17:40:10 +02:00 committed by Marge Bot
parent 943dae0735
commit b05a95dffe

View file

@ -69,11 +69,27 @@ var CandidateArea = GObject.registerClass({
this.add(this._buttonBox);
this._previousButton.connect('clicked', () => {
this._previousButton.connect('button-press-event', () => {
this.emit('previous-page');
return Clutter.EVENT_STOP;
});
this._nextButton.connect('clicked', () => {
this._previousButton.connect('touch-event', (actor, event) => {
if (event.type() === Clutter.EventType.TOUCH_BEGIN) {
this.emit('previous-page');
return Clutter.EVENT_STOP;
}
return Clutter.EVENT_PROPAGATE;
});
this._nextButton.connect('button-press-event', () => {
this.emit('next-page');
return Clutter.EVENT_STOP;
});
this._nextButton.connect('touch-event', (actor, event) => {
if (event.type() === Clutter.EventType.TOUCH_BEGIN) {
this.emit('next-page');
return Clutter.EVENT_STOP;
}
return Clutter.EVENT_PROPAGATE;
});
this._orientation = -1;