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
@@ -7,8 +7,9 @@
|
||||
pub(all) enum InputEvent {
|
||||
PointerMove(Double, Double)
|
||||
PointerButton(UInt, Bool)
|
||||
/// Vertical wheel scroll in wl_fixed units / 256 (positive = down).
|
||||
Scroll(Double)
|
||||
/// Wheel/touchpad scroll: axis (0 vertical, 1 horizontal), distance in surface pixels
|
||||
/// (positive = down/right) and wheel notches (0 when not from a wheel, e.g. a touchpad).
|
||||
Scroll(UInt, Double, Int)
|
||||
Key(UInt, Bool)
|
||||
Modifiers(UInt, UInt, UInt, UInt)
|
||||
}
|
||||
@@ -36,6 +37,9 @@ pub(all) struct NestedWindow {
|
||||
mut xdg_surf_id : UInt
|
||||
mut toplevel_id : UInt
|
||||
mut pointer_id : UInt
|
||||
/// wl_pointer.axis_discrete steps waiting for their axis event (vertical, horizontal).
|
||||
mut discrete_v : Int
|
||||
mut discrete_h : Int
|
||||
mut sync_cb : UInt
|
||||
mut sync_done : Bool
|
||||
mut frame_cb : UInt
|
||||
@@ -248,7 +252,21 @@ fn NestedWindow::dispatch(
|
||||
let axis = r.u32()
|
||||
let value = r.i32().to_double() / 256.0
|
||||
if axis == 0U {
|
||||
self.input.push(Scroll(value))
|
||||
self.input.push(Scroll(0U, value, self.discrete_v))
|
||||
self.discrete_v = 0
|
||||
} else if axis == 1U {
|
||||
self.input.push(Scroll(1U, value, self.discrete_h))
|
||||
self.discrete_h = 0
|
||||
}
|
||||
}
|
||||
8U => {
|
||||
// axis_discrete (seat v5+): sent before the axis event of the same frame.
|
||||
let axis = r.u32()
|
||||
let steps = r.i32()
|
||||
if axis == 0U {
|
||||
self.discrete_v = steps
|
||||
} else if axis == 1U {
|
||||
self.discrete_h = steps
|
||||
}
|
||||
}
|
||||
_ => ()
|
||||
@@ -321,6 +339,8 @@ pub fn NestedWindow::open(
|
||||
xdg_surf_id: 0U,
|
||||
toplevel_id: 0U,
|
||||
pointer_id: 0U,
|
||||
discrete_v: 0,
|
||||
discrete_h: 0,
|
||||
sync_cb: 0U,
|
||||
sync_done: false,
|
||||
frame_cb: 0U,
|
||||
|
||||
Reference in new issue
Block a user