use {super::super::all_types::*, ::wl_client::builder::prelude::*};
static INTERFACE: wl_interface = wl_interface {
name: c"wl_pointer".as_ptr(),
version: 10,
method_count: 2,
methods: {
static MESSAGES: [wl_message; 2] = [
wl_message {
name: c"set_cursor".as_ptr(),
signature: c"u?oii".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 4] =
[None, Some(WlSurface::WL_INTERFACE), None, None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"release".as_ptr(),
signature: c"".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 0] = [];
TYPES.as_ptr().cast()
},
},
];
MESSAGES.as_ptr()
},
event_count: 11,
events: {
static MESSAGES: [wl_message; 11] = [
wl_message {
name: c"enter".as_ptr(),
signature: c"uoff".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 4] =
[None, Some(WlSurface::WL_INTERFACE), None, None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"leave".as_ptr(),
signature: c"uo".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 2] =
[None, Some(WlSurface::WL_INTERFACE)];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"motion".as_ptr(),
signature: c"uff".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 3] = [None, None, None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"button".as_ptr(),
signature: c"uuuu".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 4] = [None, None, None, None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"axis".as_ptr(),
signature: c"uuf".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 3] = [None, None, None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"frame".as_ptr(),
signature: c"".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 0] = [];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"axis_source".as_ptr(),
signature: c"u".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 1] = [None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"axis_stop".as_ptr(),
signature: c"uu".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 2] = [None, None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"axis_discrete".as_ptr(),
signature: c"ui".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 2] = [None, None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"axis_value120".as_ptr(),
signature: c"ui".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 2] = [None, None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"axis_relative_direction".as_ptr(),
signature: c"uu".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 2] = [None, None];
TYPES.as_ptr().cast()
},
},
];
MESSAGES.as_ptr()
},
};
#[derive(Clone, Eq, PartialEq)]
#[repr(transparent)]
pub struct WlPointer {
proxy: UntypedOwnedProxy,
}
#[derive(Eq, PartialEq)]
#[repr(transparent)]
pub struct WlPointerRef {
proxy: UntypedBorrowedProxy,
}
unsafe impl UntypedOwnedProxyWrapper for WlPointer {}
unsafe impl OwnedProxy for WlPointer {
const INTERFACE: &'static str = "wl_pointer";
const WL_INTERFACE: &'static wl_interface = &INTERFACE;
const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
private::EventHandler(private::NoOpEventHandler);
const MAX_VERSION: u32 = 10;
type Borrowed = WlPointerRef;
type Api = private::ProxyApi;
type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
}
unsafe impl UntypedBorrowedProxyWrapper for WlPointerRef {}
unsafe impl BorrowedProxy for WlPointerRef {
type Owned = WlPointer;
}
impl Deref for WlPointer {
type Target = WlPointerRef;
fn deref(&self) -> &Self::Target {
proxy::low_level::deref(self)
}
}
mod private {
pub struct ProxyApi;
#[allow(dead_code)]
pub struct EventHandler<H>(pub(super) H);
#[allow(dead_code)]
pub struct NoOpEventHandler;
}
impl Debug for WlPointer {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "wl_pointer#{}", self.proxy.id())
}
}
impl Debug for WlPointerRef {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "wl_pointer#{}", self.proxy.id())
}
}
impl PartialEq<WlPointerRef> for WlPointer {
fn eq(&self, other: &WlPointerRef) -> bool {
self.proxy == other.proxy
}
}
impl PartialEq<WlPointer> for WlPointerRef {
fn eq(&self, other: &WlPointer) -> bool {
self.proxy == other.proxy
}
}
#[allow(dead_code)]
impl WlPointer {
#[allow(dead_code)]
pub const REQ__RELEASE__SINCE: u32 = 3;
#[inline]
pub fn release(&self) {
let mut args = [];
unsafe {
self.proxy.send_destructor(1, &mut args);
}
}
}
#[allow(dead_code)]
impl WlPointerRef {
#[inline]
pub fn set_cursor(
&self,
serial: u32,
surface: Option<&WlSurfaceRef>,
hotspot_x: i32,
hotspot_y: i32,
) {
let (arg0, arg1, arg2, arg3) = (serial, surface, hotspot_x, hotspot_y);
let obj1_lock = arg1.map(|arg1| proxy::lock(arg1));
let obj1 = obj1_lock
.map(|obj1_lock| check_argument_proxy("surface", obj1_lock.wl_proxy()))
.unwrap_or(ptr::null_mut());
let mut args = [
wl_argument { u: arg0 },
wl_argument { o: obj1 },
wl_argument { i: arg2 },
wl_argument { i: arg3 },
];
unsafe {
self.proxy.send_request(0, &mut args);
}
}
}
impl WlPointer {
#[allow(dead_code)]
pub const EVT__ENTER__SINCE: u32 = 1;
#[allow(dead_code)]
pub const EVT__LEAVE__SINCE: u32 = 1;
#[allow(dead_code)]
pub const EVT__MOTION__SINCE: u32 = 1;
#[allow(dead_code)]
pub const EVT__BUTTON__SINCE: u32 = 1;
#[allow(dead_code)]
pub const EVT__AXIS__SINCE: u32 = 1;
#[allow(dead_code)]
pub const EVT__FRAME__SINCE: u32 = 5;
#[allow(dead_code)]
pub const EVT__AXIS_SOURCE__SINCE: u32 = 5;
#[allow(dead_code)]
pub const EVT__AXIS_STOP__SINCE: u32 = 5;
#[allow(dead_code)]
pub const EVT__AXIS_DISCRETE__SINCE: u32 = 5;
#[allow(dead_code)]
pub const EVT__AXIS_DISCRETE__DEPRECATED_SINCE: u32 = 8;
#[allow(dead_code)]
pub const EVT__AXIS_VALUE120__SINCE: u32 = 8;
#[allow(dead_code)]
pub const EVT__AXIS_RELATIVE_DIRECTION__SINCE: u32 = 9;
}
#[allow(dead_code)]
pub trait WlPointerEventHandler {
type Data: 'static;
#[inline]
fn enter(
&self,
_data: &mut Self::Data,
_slf: &WlPointerRef,
serial: u32,
surface: Option<&WlSurfaceRef>,
surface_x: Fixed,
surface_y: Fixed,
) {
let _ = serial;
let _ = surface;
let _ = surface_x;
let _ = surface_y;
}
#[inline]
fn leave(
&self,
_data: &mut Self::Data,
_slf: &WlPointerRef,
serial: u32,
surface: Option<&WlSurfaceRef>,
) {
let _ = serial;
let _ = surface;
}
#[inline]
fn motion(
&self,
_data: &mut Self::Data,
_slf: &WlPointerRef,
time: u32,
surface_x: Fixed,
surface_y: Fixed,
) {
let _ = time;
let _ = surface_x;
let _ = surface_y;
}
#[inline]
fn button(
&self,
_data: &mut Self::Data,
_slf: &WlPointerRef,
serial: u32,
time: u32,
button: u32,
state: WlPointerButtonState,
) {
let _ = serial;
let _ = time;
let _ = button;
let _ = state;
}
#[inline]
fn axis(
&self,
_data: &mut Self::Data,
_slf: &WlPointerRef,
time: u32,
axis: WlPointerAxis,
value: Fixed,
) {
let _ = time;
let _ = axis;
let _ = value;
}
#[inline]
fn frame(&self, _data: &mut Self::Data, _slf: &WlPointerRef) {}
#[inline]
fn axis_source(
&self,
_data: &mut Self::Data,
_slf: &WlPointerRef,
axis_source: WlPointerAxisSource,
) {
let _ = axis_source;
}
#[inline]
fn axis_stop(
&self,
_data: &mut Self::Data,
_slf: &WlPointerRef,
time: u32,
axis: WlPointerAxis,
) {
let _ = time;
let _ = axis;
}
#[inline]
fn axis_discrete(
&self,
_data: &mut Self::Data,
_slf: &WlPointerRef,
axis: WlPointerAxis,
discrete: i32,
) {
let _ = axis;
let _ = discrete;
}
#[inline]
fn axis_value120(
&self,
_data: &mut Self::Data,
_slf: &WlPointerRef,
axis: WlPointerAxis,
value120: i32,
) {
let _ = axis;
let _ = value120;
}
#[inline]
fn axis_relative_direction(
&self,
_data: &mut Self::Data,
_slf: &WlPointerRef,
axis: WlPointerAxis,
direction: WlPointerAxisRelativeDirection,
) {
let _ = axis;
let _ = direction;
}
}
impl WlPointerEventHandler for private::NoOpEventHandler {
type Data = ();
}
unsafe impl<H> EventHandler for private::EventHandler<H>
where
H: WlPointerEventHandler,
{
const WL_INTERFACE: &'static wl_interface = &INTERFACE;
#[inline]
fn mutable_type() -> Option<(TypeId, &'static str)> {
let id = TypeId::of::<H::Data>();
let name = std::any::type_name::<H::Data>();
Some((id, name))
}
#[allow(unused_variables)]
unsafe fn handle_event(
&self,
queue: &Queue,
data: *mut u8,
slf: &UntypedBorrowedProxy,
opcode: u32,
args: *mut wl_argument,
) {
let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlPointerRef>(slf) };
let data: &mut H::Data = unsafe { &mut *data.cast() };
match opcode {
0 => {
let args = unsafe { &*args.cast::<[wl_argument; 4]>() };
let arg0 = unsafe { args[0].u };
let arg1 = unsafe {
if let Some(p) = NonNull::new(args[1].o.cast()) {
Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
} else {
None
}
};
let arg1 = arg1.as_ref().map(|arg1| unsafe {
proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
});
let arg2 = unsafe { Fixed::from_wire(args[2].f) };
let arg3 = unsafe { Fixed::from_wire(args[3].f) };
self.0.enter(data, slf, arg0, arg1, arg2, arg3);
}
1 => {
let args = unsafe { &*args.cast::<[wl_argument; 2]>() };
let arg0 = unsafe { args[0].u };
let arg1 = unsafe {
if let Some(p) = NonNull::new(args[1].o.cast()) {
Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
} else {
None
}
};
let arg1 = arg1.as_ref().map(|arg1| unsafe {
proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
});
self.0.leave(data, slf, arg0, arg1);
}
2 => {
let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
let arg0 = unsafe { args[0].u };
let arg1 = unsafe { Fixed::from_wire(args[1].f) };
let arg2 = unsafe { Fixed::from_wire(args[2].f) };
self.0.motion(data, slf, arg0, arg1, arg2);
}
3 => {
let args = unsafe { &*args.cast::<[wl_argument; 4]>() };
let arg0 = unsafe { args[0].u };
let arg1 = unsafe { args[1].u };
let arg2 = unsafe { args[2].u };
let arg3 = unsafe { WlPointerButtonState(args[3].u) };
self.0.button(data, slf, arg0, arg1, arg2, arg3);
}
4 => {
let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
let arg0 = unsafe { args[0].u };
let arg1 = unsafe { WlPointerAxis(args[1].u) };
let arg2 = unsafe { Fixed::from_wire(args[2].f) };
self.0.axis(data, slf, arg0, arg1, arg2);
}
5 => {
self.0.frame(data, slf);
}
6 => {
let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
let arg0 = unsafe { WlPointerAxisSource(args[0].u) };
self.0.axis_source(data, slf, arg0);
}
7 => {
let args = unsafe { &*args.cast::<[wl_argument; 2]>() };
let arg0 = unsafe { args[0].u };
let arg1 = unsafe { WlPointerAxis(args[1].u) };
self.0.axis_stop(data, slf, arg0, arg1);
}
8 => {
let args = unsafe { &*args.cast::<[wl_argument; 2]>() };
let arg0 = unsafe { WlPointerAxis(args[0].u) };
let arg1 = unsafe { args[1].i };
self.0.axis_discrete(data, slf, arg0, arg1);
}
9 => {
let args = unsafe { &*args.cast::<[wl_argument; 2]>() };
let arg0 = unsafe { WlPointerAxis(args[0].u) };
let arg1 = unsafe { args[1].i };
self.0.axis_value120(data, slf, arg0, arg1);
}
10 => {
let args = unsafe { &*args.cast::<[wl_argument; 2]>() };
let arg0 = unsafe { WlPointerAxis(args[0].u) };
let arg1 = unsafe { WlPointerAxisRelativeDirection(args[1].u) };
self.0.axis_relative_direction(data, slf, arg0, arg1);
}
_ => {
invalid_opcode("wl_pointer", opcode);
}
}
}
}
impl<H> CreateEventHandler<H> for private::ProxyApi
where
H: WlPointerEventHandler,
{
type EventHandler = private::EventHandler<H>;
#[inline]
fn create_event_handler(handler: H) -> Self::EventHandler {
private::EventHandler(handler)
}
}
impl WlPointer {
#[allow(dead_code)]
pub const ENM__ERROR_ROLE__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__BUTTON_STATE_RELEASED__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__BUTTON_STATE_PRESSED__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__AXIS_VERTICAL_SCROLL__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__AXIS_HORIZONTAL_SCROLL__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__AXIS_SOURCE_WHEEL__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__AXIS_SOURCE_FINGER__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__AXIS_SOURCE_CONTINUOUS__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__AXIS_SOURCE_WHEEL_TILT__SINCE: u32 = 6;
#[allow(dead_code)]
pub const ENM__AXIS_RELATIVE_DIRECTION_IDENTICAL__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__AXIS_RELATIVE_DIRECTION_INVERTED__SINCE: u32 = 1;
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[allow(dead_code)]
pub struct WlPointerError(pub u32);
impl WlPointerError {
#[allow(dead_code)]
pub const ROLE: Self = Self(0);
}
impl Debug for WlPointerError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let name = match *self {
Self::ROLE => "ROLE",
_ => return Debug::fmt(&self.0, f),
};
f.write_str(name)
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[allow(dead_code)]
pub struct WlPointerButtonState(pub u32);
impl WlPointerButtonState {
#[allow(dead_code)]
pub const RELEASED: Self = Self(0);
#[allow(dead_code)]
pub const PRESSED: Self = Self(1);
}
impl Debug for WlPointerButtonState {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let name = match *self {
Self::RELEASED => "RELEASED",
Self::PRESSED => "PRESSED",
_ => return Debug::fmt(&self.0, f),
};
f.write_str(name)
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[allow(dead_code)]
pub struct WlPointerAxis(pub u32);
impl WlPointerAxis {
#[allow(dead_code)]
pub const VERTICAL_SCROLL: Self = Self(0);
#[allow(dead_code)]
pub const HORIZONTAL_SCROLL: Self = Self(1);
}
impl Debug for WlPointerAxis {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let name = match *self {
Self::VERTICAL_SCROLL => "VERTICAL_SCROLL",
Self::HORIZONTAL_SCROLL => "HORIZONTAL_SCROLL",
_ => return Debug::fmt(&self.0, f),
};
f.write_str(name)
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[allow(dead_code)]
pub struct WlPointerAxisSource(pub u32);
impl WlPointerAxisSource {
#[allow(dead_code)]
pub const WHEEL: Self = Self(0);
#[allow(dead_code)]
pub const FINGER: Self = Self(1);
#[allow(dead_code)]
pub const CONTINUOUS: Self = Self(2);
#[allow(dead_code)]
pub const WHEEL_TILT: Self = Self(3);
}
impl Debug for WlPointerAxisSource {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let name = match *self {
Self::WHEEL => "WHEEL",
Self::FINGER => "FINGER",
Self::CONTINUOUS => "CONTINUOUS",
Self::WHEEL_TILT => "WHEEL_TILT",
_ => return Debug::fmt(&self.0, f),
};
f.write_str(name)
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[allow(dead_code)]
pub struct WlPointerAxisRelativeDirection(pub u32);
impl WlPointerAxisRelativeDirection {
#[allow(dead_code)]
pub const IDENTICAL: Self = Self(0);
#[allow(dead_code)]
pub const INVERTED: Self = Self(1);
}
impl Debug for WlPointerAxisRelativeDirection {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let name = match *self {
Self::IDENTICAL => "IDENTICAL",
Self::INVERTED => "INVERTED",
_ => return Debug::fmt(&self.0, f),
};
f.write_str(name)
}
}
pub mod event_handlers {
use super::*;
pub struct Enter<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlPointerEventHandler for Enter<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, Option<&WlSurfaceRef>, Fixed, Fixed),
{
type Data = T;
#[inline]
fn enter(
&self,
_data: &mut T,
_slf: &WlPointerRef,
serial: u32,
surface: Option<&WlSurfaceRef>,
surface_x: Fixed,
surface_y: Fixed,
) {
self.0(_data, _slf, serial, surface, surface_x, surface_y)
}
}
pub struct Leave<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlPointerEventHandler for Leave<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, Option<&WlSurfaceRef>),
{
type Data = T;
#[inline]
fn leave(
&self,
_data: &mut T,
_slf: &WlPointerRef,
serial: u32,
surface: Option<&WlSurfaceRef>,
) {
self.0(_data, _slf, serial, surface)
}
}
pub struct Motion<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlPointerEventHandler for Motion<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, Fixed, Fixed),
{
type Data = T;
#[inline]
fn motion(
&self,
_data: &mut T,
_slf: &WlPointerRef,
time: u32,
surface_x: Fixed,
surface_y: Fixed,
) {
self.0(_data, _slf, time, surface_x, surface_y)
}
}
pub struct Button<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlPointerEventHandler for Button<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, u32, u32, WlPointerButtonState),
{
type Data = T;
#[inline]
fn button(
&self,
_data: &mut T,
_slf: &WlPointerRef,
serial: u32,
time: u32,
button: u32,
state: WlPointerButtonState,
) {
self.0(_data, _slf, serial, time, button, state)
}
}
pub struct Axis<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlPointerEventHandler for Axis<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, WlPointerAxis, Fixed),
{
type Data = T;
#[inline]
fn axis(
&self,
_data: &mut T,
_slf: &WlPointerRef,
time: u32,
axis: WlPointerAxis,
value: Fixed,
) {
self.0(_data, _slf, time, axis, value)
}
}
pub struct Frame<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlPointerEventHandler for Frame<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef),
{
type Data = T;
#[inline]
fn frame(&self, _data: &mut T, _slf: &WlPointerRef) {
self.0(_data, _slf)
}
}
pub struct AxisSource<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlPointerEventHandler for AxisSource<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, WlPointerAxisSource),
{
type Data = T;
#[inline]
fn axis_source(
&self,
_data: &mut T,
_slf: &WlPointerRef,
axis_source: WlPointerAxisSource,
) {
self.0(_data, _slf, axis_source)
}
}
pub struct AxisStop<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlPointerEventHandler for AxisStop<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, WlPointerAxis),
{
type Data = T;
#[inline]
fn axis_stop(&self, _data: &mut T, _slf: &WlPointerRef, time: u32, axis: WlPointerAxis) {
self.0(_data, _slf, time, axis)
}
}
pub struct AxisDiscrete<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlPointerEventHandler for AxisDiscrete<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, WlPointerAxis, i32),
{
type Data = T;
#[inline]
fn axis_discrete(
&self,
_data: &mut T,
_slf: &WlPointerRef,
axis: WlPointerAxis,
discrete: i32,
) {
self.0(_data, _slf, axis, discrete)
}
}
pub struct AxisValue120<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlPointerEventHandler for AxisValue120<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, WlPointerAxis, i32),
{
type Data = T;
#[inline]
fn axis_value120(
&self,
_data: &mut T,
_slf: &WlPointerRef,
axis: WlPointerAxis,
value120: i32,
) {
self.0(_data, _slf, axis, value120)
}
}
pub struct AxisRelativeDirection<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlPointerEventHandler for AxisRelativeDirection<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, WlPointerAxis, WlPointerAxisRelativeDirection),
{
type Data = T;
#[inline]
fn axis_relative_direction(
&self,
_data: &mut T,
_slf: &WlPointerRef,
axis: WlPointerAxis,
direction: WlPointerAxisRelativeDirection,
) {
self.0(_data, _slf, axis, direction)
}
}
impl WlPointer {
#[allow(dead_code)]
pub fn on_enter<T, F>(f: F) -> Enter<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, Option<&WlSurfaceRef>, Fixed, Fixed),
{
Enter(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_leave<T, F>(f: F) -> Leave<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, Option<&WlSurfaceRef>),
{
Leave(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_motion<T, F>(f: F) -> Motion<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, Fixed, Fixed),
{
Motion(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_button<T, F>(f: F) -> Button<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, u32, u32, WlPointerButtonState),
{
Button(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_axis<T, F>(f: F) -> Axis<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, WlPointerAxis, Fixed),
{
Axis(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_frame<T, F>(f: F) -> Frame<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef),
{
Frame(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_axis_source<T, F>(f: F) -> AxisSource<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, WlPointerAxisSource),
{
AxisSource(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_axis_stop<T, F>(f: F) -> AxisStop<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, u32, WlPointerAxis),
{
AxisStop(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_axis_discrete<T, F>(f: F) -> AxisDiscrete<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, WlPointerAxis, i32),
{
AxisDiscrete(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_axis_value120<T, F>(f: F) -> AxisValue120<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, WlPointerAxis, i32),
{
AxisValue120(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_axis_relative_direction<T, F>(f: F) -> AxisRelativeDirection<T, F>
where
T: 'static,
F: Fn(&mut T, &WlPointerRef, WlPointerAxis, WlPointerAxisRelativeDirection),
{
AxisRelativeDirection(f, PhantomData)
}
}
}