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() {
|
if let input::AxisSource::Wheel = evt.source() {
|
||||||
event.discrete(axis, evt.amount() as i32);
|
event.discrete(axis, evt.amount() as i32);
|
||||||
}
|
}
|
||||||
// drop and submit the axis event
|
event.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn on_touch_down(
|
fn on_touch_down(
|
||||||
|
|
|
@ -130,7 +130,7 @@ impl InputHandler<winit::WinitInputBackend> for WinitInputHandler {
|
||||||
if let input::AxisSource::Wheel = evt.source() {
|
if let input::AxisSource::Wheel = evt.source() {
|
||||||
event.discrete(axis, evt.amount() as i32);
|
event.discrete(axis, evt.amount() as i32);
|
||||||
}
|
}
|
||||||
// drop and submit the axis event
|
event.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn on_touch_down(
|
fn on_touch_down(
|
||||||
|
|
|
@ -73,7 +73,9 @@ impl PointerHandle {
|
||||||
if leave {
|
if leave {
|
||||||
guard.with_focused_pointers(|pointer, surface| {
|
guard.with_focused_pointers(|pointer, surface| {
|
||||||
pointer.leave(serial, surface);
|
pointer.leave(serial, surface);
|
||||||
|
if pointer.version() >= 5 {
|
||||||
pointer.frame();
|
pointer.frame();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
guard.focus = None;
|
guard.focus = None;
|
||||||
}
|
}
|
||||||
|
@ -84,13 +86,17 @@ impl PointerHandle {
|
||||||
guard.focus = surface.clone();
|
guard.focus = surface.clone();
|
||||||
guard.with_focused_pointers(|pointer, surface| {
|
guard.with_focused_pointers(|pointer, surface| {
|
||||||
pointer.enter(serial, surface, x, y);
|
pointer.enter(serial, surface, x, y);
|
||||||
|
if pointer.version() >= 5 {
|
||||||
pointer.frame();
|
pointer.frame();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// we were on top of a surface and remained on it
|
// we were on top of a surface and remained on it
|
||||||
guard.with_focused_pointers(|pointer, _| {
|
guard.with_focused_pointers(|pointer, _| {
|
||||||
pointer.motion(time, x, y);
|
pointer.motion(time, x, y);
|
||||||
|
if pointer.version() >= 5 {
|
||||||
pointer.frame();
|
pointer.frame();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +110,9 @@ impl PointerHandle {
|
||||||
let guard = self.inner.lock().unwrap();
|
let guard = self.inner.lock().unwrap();
|
||||||
guard.with_focused_pointers(|pointer, _| {
|
guard.with_focused_pointers(|pointer, _| {
|
||||||
pointer.button(serial, time, button, state);
|
pointer.button(serial, time, button, state);
|
||||||
|
if pointer.version() >= 5 {
|
||||||
pointer.frame();
|
pointer.frame();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +145,7 @@ impl PointerHandle {
|
||||||
/// .stop(Axis::Vertical);
|
/// .stop(Axis::Vertical);
|
||||||
/// ```
|
/// ```
|
||||||
pub struct PointerAxisHandle<'a> {
|
pub struct PointerAxisHandle<'a> {
|
||||||
inner: MutexGuard<'a, PointerInternal>
|
inner: MutexGuard<'a, PointerInternal>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PointerAxisHandle<'a> {
|
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).
|
/// when the user lifts off the finger (not necessarily in the same frame).
|
||||||
pub fn source(&mut self, source: wl_pointer::AxisSource) -> &mut Self {
|
pub fn source(&mut self, source: wl_pointer::AxisSource) -> &mut Self {
|
||||||
self.inner.with_focused_pointers(|pointer, _| {
|
self.inner.with_focused_pointers(|pointer, _| {
|
||||||
|
if pointer.version() >= 5 {
|
||||||
pointer.axis_source(source);
|
pointer.axis_source(source);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
@ -162,7 +172,9 @@ impl<'a> PointerAxisHandle<'a> {
|
||||||
/// while a touchpad may never issue this event as it has no steps.
|
/// 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 {
|
pub fn discrete(&mut self, axis: wl_pointer::Axis, steps: i32) -> &mut Self {
|
||||||
self.inner.with_focused_pointers(|pointer, _| {
|
self.inner.with_focused_pointers(|pointer, _| {
|
||||||
|
if pointer.version() >= 5 {
|
||||||
pointer.axis_discrete(axis, steps);
|
pointer.axis_discrete(axis, steps);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
@ -182,16 +194,18 @@ impl<'a> PointerAxisHandle<'a> {
|
||||||
/// and otherwise optional.
|
/// and otherwise optional.
|
||||||
pub fn stop(&mut self, axis: wl_pointer::Axis, time: u32) -> &mut Self {
|
pub fn stop(&mut self, axis: wl_pointer::Axis, time: u32) -> &mut Self {
|
||||||
self.inner.with_focused_pointers(|pointer, _| {
|
self.inner.with_focused_pointers(|pointer, _| {
|
||||||
|
if pointer.version() >= 5 {
|
||||||
pointer.axis_stop(time, axis);
|
pointer.axis_stop(time, axis);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Drop for PointerAxisHandle<'a> {
|
pub fn done(&mut self) {
|
||||||
fn drop(&mut self) {
|
|
||||||
self.inner.with_focused_pointers(|pointer, _| {
|
self.inner.with_focused_pointers(|pointer, _| {
|
||||||
|
if pointer.version() >= 5 {
|
||||||
pointer.frame();
|
pointer.frame();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue