add discrete120 scroll event (#120)

* add discrete120 scroll event
This commit is contained in:
Ferdinand Schober
2024-05-04 03:34:13 +02:00
committed by GitHub
parent 973360a774
commit 1f0d386d4a
9 changed files with 167 additions and 64 deletions

View File

@@ -750,14 +750,24 @@ impl Dispatch<WlPointer, ()> for State {
}),
));
}
wl_pointer::Event::AxisValue120 { axis, value120 } => {
wl_pointer::Event::Axis { time, axis, value } => {
let (_, client) = app.focused.as_ref().unwrap();
app.pending_events.push_back((
*client,
Event::Pointer(PointerEvent::Axis {
time: 0,
time,
axis: u32::from(axis) as u8,
value: value120 as f64,
value,
}),
));
}
wl_pointer::Event::AxisValue120 { axis, value120 } => {
let (_, client) = app.focused.as_ref().unwrap();
app.pending_events.push_back((
*client,
Event::Pointer(PointerEvent::AxisDiscrete120 {
axis: u32::from(axis) as u8,
value: value120,
}),
));
}

View File

@@ -139,10 +139,9 @@ fn to_mouse_event(wparam: WPARAM, lparam: LPARAM) -> Option<PointerEvent> {
relative_y: dy as f64,
})
},
WPARAM(p) if p == WM_MOUSEWHEEL as usize => Some(PointerEvent::Axis {
time: 0,
WPARAM(p) if p == WM_MOUSEWHEEL as usize => Some(PointerEvent::AxisDiscrete120 {
axis: 0,
value: -(mouse_low_level.mouseData as i32) as f64,
value: -(mouse_low_level.mouseData as i32),
}),
WPARAM(p) if p == WM_XBUTTONDOWN as usize || p == WM_XBUTTONUP as usize => {
let hb = mouse_low_level.mouseData >> 16;