mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-23 12:53:19 +03:00
ignore Axis events corresponding to v120 events
This commit is contained in:
@@ -111,6 +111,7 @@ struct State {
|
|||||||
qh: QueueHandle<Self>,
|
qh: QueueHandle<Self>,
|
||||||
pending_events: VecDeque<(ClientHandle, Event)>,
|
pending_events: VecDeque<(ClientHandle, Event)>,
|
||||||
output_info: Vec<(WlOutput, OutputInfo)>,
|
output_info: Vec<(WlOutput, OutputInfo)>,
|
||||||
|
scroll_discrete_pending: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Inner {
|
struct Inner {
|
||||||
@@ -351,6 +352,7 @@ impl WaylandInputCapture {
|
|||||||
read_guard: None,
|
read_guard: None,
|
||||||
pending_events: VecDeque::new(),
|
pending_events: VecDeque::new(),
|
||||||
output_info: vec![],
|
output_info: vec![],
|
||||||
|
scroll_discrete_pending: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
// dispatch registry to () again, in order to read all wl_outputs
|
// dispatch registry to () again, in order to read all wl_outputs
|
||||||
@@ -752,17 +754,25 @@ impl Dispatch<WlPointer, ()> for State {
|
|||||||
}
|
}
|
||||||
wl_pointer::Event::Axis { time, axis, value } => {
|
wl_pointer::Event::Axis { time, axis, value } => {
|
||||||
let (_, client) = app.focused.as_ref().unwrap();
|
let (_, client) = app.focused.as_ref().unwrap();
|
||||||
app.pending_events.push_back((
|
if app.scroll_discrete_pending {
|
||||||
*client,
|
// each axisvalue120 event is coupled with
|
||||||
Event::Pointer(PointerEvent::Axis {
|
// a corresponding axis event, which needs to
|
||||||
time,
|
// be ignored to not duplicate the scrolling
|
||||||
axis: u32::from(axis) as u8,
|
app.scroll_discrete_pending = false;
|
||||||
value,
|
} else {
|
||||||
}),
|
app.pending_events.push_back((
|
||||||
));
|
*client,
|
||||||
|
Event::Pointer(PointerEvent::Axis {
|
||||||
|
time,
|
||||||
|
axis: u32::from(axis) as u8,
|
||||||
|
value,
|
||||||
|
}),
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
wl_pointer::Event::AxisValue120 { axis, value120 } => {
|
wl_pointer::Event::AxisValue120 { axis, value120 } => {
|
||||||
let (_, client) = app.focused.as_ref().unwrap();
|
let (_, client) = app.focused.as_ref().unwrap();
|
||||||
|
app.scroll_discrete_pending = true;
|
||||||
app.pending_events.push_back((
|
app.pending_events.push_back((
|
||||||
*client,
|
*client,
|
||||||
Event::Pointer(PointerEvent::AxisDiscrete120 {
|
Event::Pointer(PointerEvent::AxisDiscrete120 {
|
||||||
|
|||||||
Reference in New Issue
Block a user