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,15 +110,17 @@ 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();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Start an axis frame
|
||||
///
|
||||
///
|
||||
/// 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(),
|
||||
}
|
||||
|
@ -127,7 +135,7 @@ impl PointerHandle {
|
|||
}
|
||||
|
||||
/// A frame of pointer axis events.
|
||||
///
|
||||
///
|
||||
/// Can be used with the builder pattern, e.g.:
|
||||
/// ```ignore
|
||||
/// pointer.axis()
|
||||
|
@ -137,32 +145,36 @@ impl PointerHandle {
|
|||
/// .stop(Axis::Vertical);
|
||||
/// ```
|
||||
pub struct PointerAxisHandle<'a> {
|
||||
inner: MutexGuard<'a, PointerInternal>
|
||||
inner: MutexGuard<'a, PointerInternal>,
|
||||
}
|
||||
|
||||
impl<'a> PointerAxisHandle<'a> {
|
||||
/// Specify the source of the axis events
|
||||
///
|
||||
///
|
||||
/// This event is optional, if no source is known, you can ignore this call.
|
||||
/// Only one source event is allowed per frame.
|
||||
///
|
||||
///
|
||||
/// Using the `AxisSource::Finger` requires a stop event to be send,
|
||||
/// 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
|
||||
}
|
||||
|
||||
|
||||
/// Specify discrete scrolling steps additionally to the computed value.
|
||||
///
|
||||
///
|
||||
/// This event is optional and gives the client additional information about
|
||||
/// the nature of the axis event. E.g. a scroll wheel might issue separate 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 {
|
||||
self.inner.with_focused_pointers(|pointer, _| {
|
||||
pointer.axis_discrete(axis, steps);
|
||||
if pointer.version() >= 5 {
|
||||
pointer.axis_discrete(axis, steps);
|
||||
}
|
||||
});
|
||||
self
|
||||
}
|
||||
|
@ -177,21 +189,23 @@ impl<'a> PointerAxisHandle<'a> {
|
|||
}
|
||||
|
||||
/// Notification of stop of scrolling on an axis.
|
||||
///
|
||||
///
|
||||
/// This event is required for sources of the `AxisSource::Finger` type
|
||||
/// 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