Reintroduce wl_seat 4 support
This commit is contained in:
parent
2fb36af926
commit
daccddf9b6
|
@ -209,7 +209,7 @@ impl InputHandler<LibinputInputBackend> for LibinputInputHandler {
|
|||
if let input::AxisSource::Wheel = evt.source() {
|
||||
event.discrete(axis, evt.amount() as i32);
|
||||
}
|
||||
// drop and submit the axis event
|
||||
event.done();
|
||||
}
|
||||
}
|
||||
fn on_touch_down(
|
||||
|
|
|
@ -130,7 +130,7 @@ impl InputHandler<winit::WinitInputBackend> for WinitInputHandler {
|
|||
if let input::AxisSource::Wheel = evt.source() {
|
||||
event.discrete(axis, evt.amount() as i32);
|
||||
}
|
||||
// drop and submit the axis event
|
||||
event.done();
|
||||
}
|
||||
}
|
||||
fn on_touch_down(
|
||||
|
|
|
@ -73,7 +73,9 @@ impl PointerHandle {
|
|||
if leave {
|
||||
guard.with_focused_pointers(|pointer, surface| {
|
||||
pointer.leave(serial, surface);
|
||||
pointer.frame();
|
||||
if pointer.version() >= 5 {
|
||||
pointer.frame();
|
||||
}
|
||||
});
|
||||
guard.focus = None;
|
||||
}
|
||||
|
@ -84,13 +86,17 @@ impl PointerHandle {
|
|||
guard.focus = surface.clone();
|
||||
guard.with_focused_pointers(|pointer, surface| {
|
||||
pointer.enter(serial, surface, x, y);
|
||||
pointer.frame();
|
||||
if pointer.version() >= 5 {
|
||||
pointer.frame();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// we were on top of a surface and remained on it
|
||||
guard.with_focused_pointers(|pointer, _| {
|
||||
pointer.motion(time, x, y);
|
||||
pointer.frame();
|
||||
if pointer.version() >= 5 {
|
||||
pointer.frame();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +110,9 @@ impl PointerHandle {
|
|||
let guard = self.inner.lock().unwrap();
|
||||
guard.with_focused_pointers(|pointer, _| {
|
||||
pointer.button(serial, time, button, state);
|
||||
pointer.frame();
|
||||
if pointer.version() >= 5 {
|
||||
pointer.frame();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -112,7 +120,7 @@ impl PointerHandle {
|
|||
///
|
||||
/// A single frame will group multiple scroll events as if they happended in the same instance.
|
||||
/// Dropping the returned `PointerAxisHandle` will group the events together.
|
||||
pub fn axis<'a>(&'a self) -> PointerAxisHandle<'a> {
|
||||
pub fn axis<'a>(&'a self) -> PointerAxisHandle<'a> {
|
||||
PointerAxisHandle {
|
||||
inner: self.inner.lock().unwrap(),
|
||||
}
|
||||
|
@ -137,7 +145,7 @@ impl PointerHandle {
|
|||
/// .stop(Axis::Vertical);
|
||||
/// ```
|
||||
pub struct PointerAxisHandle<'a> {
|
||||
inner: MutexGuard<'a, PointerInternal>
|
||||
inner: MutexGuard<'a, PointerInternal>,
|
||||
}
|
||||
|
||||
impl<'a> PointerAxisHandle<'a> {
|
||||
|
@ -150,7 +158,9 @@ impl<'a> PointerAxisHandle<'a> {
|
|||
/// when the user lifts off the finger (not necessarily in the same frame).
|
||||
pub fn source(&mut self, source: wl_pointer::AxisSource) -> &mut Self {
|
||||
self.inner.with_focused_pointers(|pointer, _| {
|
||||
pointer.axis_source(source);
|
||||
if pointer.version() >= 5 {
|
||||
pointer.axis_source(source);
|
||||
}
|
||||
});
|
||||
self
|
||||
}
|
||||
|
@ -162,7 +172,9 @@ impl<'a> PointerAxisHandle<'a> {
|
|||
/// while a touchpad may never issue this event as it has no steps.
|
||||
pub fn discrete(&mut self, axis: wl_pointer::Axis, steps: i32) -> &mut Self {
|
||||
self.inner.with_focused_pointers(|pointer, _| {
|
||||
pointer.axis_discrete(axis, steps);
|
||||
if pointer.version() >= 5 {
|
||||
pointer.axis_discrete(axis, steps);
|
||||
}
|
||||
});
|
||||
self
|
||||
}
|
||||
|
@ -182,16 +194,18 @@ impl<'a> PointerAxisHandle<'a> {
|
|||
/// and otherwise optional.
|
||||
pub fn stop(&mut self, axis: wl_pointer::Axis, time: u32) -> &mut Self {
|
||||
self.inner.with_focused_pointers(|pointer, _| {
|
||||
pointer.axis_stop(time, axis);
|
||||
if pointer.version() >= 5 {
|
||||
pointer.axis_stop(time, axis);
|
||||
}
|
||||
});
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Drop for PointerAxisHandle<'a> {
|
||||
fn drop(&mut self) {
|
||||
pub fn done(&mut self) {
|
||||
self.inner.with_focused_pointers(|pointer, _| {
|
||||
pointer.frame();
|
||||
if pointer.version() >= 5 {
|
||||
pointer.frame();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue