fix: handle wheel events before cursor bounds check in MouseArea
Some checks failed
Continuous Integration / formatting (push) Has been cancelled
Continuous Integration / linting (push) Has been cancelled

Move the on_mouse_wheel handler before the cursor.is_over(bounds)
guard. The panel's nested compositor only routes axis events to the
applet surface when the pointer is over it, making the bounds check
redundant for scroll events. This fixes scroll-to-adjust-volume not
working on the audio applet after a fresh login, when the cursor
coordinates sent by the panel may not match the applet's surface-local
coordinate space.
This commit is contained in:
Lionel DARNIS 2026-07-29 11:59:32 +02:00
parent 2d78a0abff
commit a9f15d67a2

View file

@ -307,6 +307,19 @@ fn update<Message: Clone, Theme, Renderer>(
shell: &mut Shell<'_, Message>,
state: &mut State,
) {
// Handle wheel events before the bounds check. The panel's nested
// compositor routes axis events to this surface only when the pointer
// is over the applet, but the cursor coordinates it sends may be in
// panel-local space rather than surface-local space. This makes
// cursor.is_over() unreliable for scroll events.
if let Event::Mouse(mouse::Event::WheelScrolled { delta }) = event {
if let Some(message) = widget.on_mouse_wheel.as_ref() {
shell.publish((message)(*delta));
shell.capture_event();
return;
}
}
if !cursor.is_over(layout.bounds()) {
if !state.is_out_of_bounds {
if widget
@ -416,12 +429,4 @@ fn update<Message: Clone, Theme, Renderer>(
}
}
}
if let Some(message) = widget.on_mouse_wheel.as_ref() {
if let Event::Mouse(mouse::Event::WheelScrolled { delta }) = event {
shell.publish((message)(*delta));
shell.capture_event();
return;
}
}
}