backlight: Allow operating the keyboard backlight slider by keyboard

Also, hide its menu item from the a11y tree, similarly to the volume and
other sliders.

Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6894

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3538>
This commit is contained in:
Lukáš Tyrychtr 2024-11-07 13:45:03 +01:00 committed by Florian Müllner
parent 3d560909ea
commit 685a7948a5

View File

@ -55,6 +55,14 @@ const SliderItem = GObject.registerClass({
this.notify('value');
}
vfunc_key_press_event(event) {
const key = event.get_key_symbol();
if (key === Clutter.KEY_Left || key === Clutter.KEY_Right)
return this._slider.vfunc_key_press_event(event);
else
return super.vfunc_key_press_event(event);
}
});
const DiscreteItem = GObject.registerClass({
@ -163,6 +171,10 @@ class KeyboardBrightnessToggle extends QuickMenuToggle {
this._sliderItem = new SliderItem();
this.menu.box.add_child(this._sliderItem);
const sliderAccessible = this._sliderItem._slider.get_accessible();
sliderAccessible.set_parent(this.menu.box.get_accessible());
this._sliderItem.set_accessible(sliderAccessible);
this._discreteItem = new DiscreteItem();
this.menu.box.add_child(this._discreteItem);