status/backlight: Fix keynav within discrete item

When representing the keyboard backlight levels as discrete items,
it is currently not possible to keynav past the first button.

Fix this by bypassing the usual event bubbling and passing key press
events directly to the focus manager, similar to what we do for
popup menu items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3545>
This commit is contained in:
Florian Müllner 2024-11-13 00:42:56 +01:00 committed by Marge Bot
parent 730fcf34e9
commit 64c9baf412

View File

@ -133,6 +133,10 @@ const DiscreteItem = GObject.registerClass({
this._levelButtons.set(key, box); this._levelButtons.set(key, box);
} }
vfunc_key_press_event(event) {
return global.focus_manager.navigate_from_event(event);
}
_syncLevels() { _syncLevels() {
this._levelButtons.get('off').visible = this.nLevels > 0; this._levelButtons.get('off').visible = this.nLevels > 0;
this._levelButtons.get('high').visible = this.nLevels > 1; this._levelButtons.get('high').visible = this.nLevels > 1;