Mouse wheel scrolls windows: forward scroll to Wayland clients
The wheel used to reach only the Interface Explorer dialog; clients never got wl_pointer.axis, and the login-session (KMS/libinput) backend dropped scroll events. - libinput axis events (wheel, touchpad, trackpoint) are queued as EV_AXIS and surface as InputEvent::Scroll(axis, value, discrete) in both the native and wasm (moonplasma:host/display seat-event.scroll) backends. - The nested backend keeps horizontal scroll and the host's axis_discrete notches. - The compositor sends axis_source(wheel) + axis_discrete/axis_value120 + axis + frame to the popup or window under the pointer; the explorer still takes the wheel while inspect mode is on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hjdz1uQ1y3GgazdKrR
This commit is contained in:
12 files changed
+200
-44
No files matched your search
@@ -1067,10 +1067,49 @@ pub fn MoonPlasmaCompositor::handle_input(
|
||||
_ => self.leave_pointer()
|
||||
}
|
||||
}
|
||||
Scroll(v) => {
|
||||
// ~10 units per wheel notch -> 3 lines.
|
||||
let lines = if v > 0.0 { (v / 10.0).to_int() + 1 } else { (v / 10.0).to_int() - 1 }
|
||||
ignore(self.shell.scroll_inspector(lines))
|
||||
Scroll(axis, v, discrete) => {
|
||||
if v == 0.0 && discrete == 0 {
|
||||
return
|
||||
}
|
||||
let xi = self.ptr_x.to_int()
|
||||
let yi = self.ptr_y.to_int()
|
||||
match self.popup_at(xi, yi) {
|
||||
Some(p) => {
|
||||
self.pointer_into_popup(p, time_ms, false)
|
||||
self.server.pointer_axis(p.id, time_ms, axis, v, discrete)
|
||||
return
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
if axis == 0U && self.shell.inspecting() {
|
||||
// ~10 units per wheel notch -> 3 lines.
|
||||
let lines = if v > 0.0 { (v / 10.0).to_int() + 1 } else { (v / 10.0).to_int() - 1 }
|
||||
ignore(self.shell.scroll_inspector(lines))
|
||||
return
|
||||
}
|
||||
if self.wm.drag is Some(_) || self.split_drag is Some(_) {
|
||||
return
|
||||
}
|
||||
// The wheel scrolls the window under the pointer (focused or not), like Plasma.
|
||||
match self.window_at(xi, yi) {
|
||||
Some((wid, true)) =>
|
||||
match self.windows.get(wid) {
|
||||
Some(win) => {
|
||||
if self.ptr_win != Some(wid) {
|
||||
self.leave_pointer()
|
||||
self.ptr_win = Some(wid)
|
||||
self.server.pointer_enter(
|
||||
wid,
|
||||
self.ptr_x - win.geometry.x.to_double(),
|
||||
self.ptr_y - win.geometry.y.to_double(),
|
||||
)
|
||||
}
|
||||
self.server.pointer_axis(wid, time_ms, axis, v, discrete)
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
PointerButton(button, pressed) => {
|
||||
let xi = self.ptr_x.to_int()
|
||||
|
||||
Reference in new issue
Block a user