From 8e505a0d8a769510278be480a708904c2f659e7f Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Fri, 5 Jul 2024 18:06:03 +0200 Subject: [PATCH] Alias --- ndk/src/event.rs | 171 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/ndk/src/event.rs b/ndk/src/event.rs index 24e7db42..b68bc438 100644 --- a/ndk/src/event.rs +++ b/ndk/src/event.rs @@ -21,6 +21,7 @@ use num_enum::{FromPrimitive, IntoPrimitive}; /// [`AInputEvent *`]: https://developer.android.com/ndk/reference/group/input#ainputevent #[derive(Debug)] #[non_exhaustive] +#[doc(alias = "AInputEvent")] pub enum InputEvent { MotionEvent(MotionEvent), KeyEvent(KeyEvent), @@ -30,6 +31,7 @@ pub enum InputEvent { /// [`MotionEvent::from_java()`] with respective [`Drop`] semantics. #[cfg(feature = "api-level-31")] #[derive(Debug)] +#[doc(alias = "AInputEvent")] pub struct InputEventJava(InputEvent); #[cfg(feature = "api-level-31")] @@ -53,22 +55,39 @@ impl Drop for InputEventJava { #[repr(i32)] #[non_exhaustive] pub enum Source { + #[doc(alias = "AINPUT_SOURCE_UNKNOWN")] Unknown = ffi::AINPUT_SOURCE_UNKNOWN as i32, + #[doc(alias = "AINPUT_SOURCE_KEYBOARD")] Keyboard = ffi::AINPUT_SOURCE_KEYBOARD as i32, + #[doc(alias = "AINPUT_SOURCE_DPAD")] Dpad = ffi::AINPUT_SOURCE_DPAD as i32, + #[doc(alias = "AINPUT_SOURCE_GAMEPAD")] Gamepad = ffi::AINPUT_SOURCE_GAMEPAD as i32, + #[doc(alias = "AINPUT_SOURCE_TOUCHSCREEN")] Touchscreen = ffi::AINPUT_SOURCE_TOUCHSCREEN as i32, + #[doc(alias = "AINPUT_SOURCE_MOUSE")] Mouse = ffi::AINPUT_SOURCE_MOUSE as i32, + #[doc(alias = "AINPUT_SOURCE_STYLUS")] Stylus = ffi::AINPUT_SOURCE_STYLUS as i32, + #[doc(alias = "AINPUT_SOURCE_BLUETOOTH_STYLUS")] BluetoothStylus = ffi::AINPUT_SOURCE_BLUETOOTH_STYLUS as i32, + #[doc(alias = "AINPUT_SOURCE_TRACKBALL")] Trackball = ffi::AINPUT_SOURCE_TRACKBALL as i32, + #[doc(alias = "AINPUT_SOURCE_MOUSE_RELATIVE")] MouseRelative = ffi::AINPUT_SOURCE_MOUSE_RELATIVE as i32, + #[doc(alias = "AINPUT_SOURCE_TOUCHPAD")] Touchpad = ffi::AINPUT_SOURCE_TOUCHPAD as i32, + #[doc(alias = "AINPUT_SOURCE_TOUCH_NAVIGATION")] TouchNavigation = ffi::AINPUT_SOURCE_TOUCH_NAVIGATION as i32, + #[doc(alias = "AINPUT_SOURCE_JOYSTICK")] Joystick = ffi::AINPUT_SOURCE_JOYSTICK as i32, + #[doc(alias = "AINPUT_SOURCE_HDMI")] Hdmi = ffi::AINPUT_SOURCE_HDMI as i32, + #[doc(alias = "AINPUT_SOURCE_SENSOR")] Sensor = ffi::AINPUT_SOURCE_SENSOR as i32, + #[doc(alias = "AINPUT_SOURCE_ROTARY_ENCODER")] RotaryEncoder = ffi::AINPUT_SOURCE_ROTARY_ENCODER as i32, + #[doc(alias = "AINPUT_SOURCE_ANY")] Any = ffi::AINPUT_SOURCE_ANY as i32, #[doc(hidden)] @@ -77,6 +96,7 @@ pub enum Source { } impl Source { + #[doc(alias = "AINPUT_SOURCE_CLASS_MASK")] pub fn class(self) -> SourceClass { let class = i32::from(self) & ffi::AINPUT_SOURCE_CLASS_MASK as i32; // The mask fits in a u8. @@ -111,6 +131,7 @@ impl InputEvent { /// By calling this function, you assert that the pointer is a valid pointer to a /// native [`ffi::AInputEvent`]. #[inline] + #[doc(alias = "AInputEvent_getType")] pub unsafe fn from_ptr(ptr: NonNull) -> Self { match ffi::AInputEvent_getType(ptr.as_ptr()) as u32 { ffi::AINPUT_EVENT_TYPE_KEY => InputEvent::KeyEvent(KeyEvent::from_ptr(ptr)), @@ -133,6 +154,7 @@ impl InputEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#ainputevent_getsource) #[inline] + #[doc(alias = "AInputEvent_getSource")] pub fn source(&self) -> Source { let source = unsafe { ffi::AInputEvent_getSource(self.ptr().as_ptr()) }; source.into() @@ -143,6 +165,7 @@ impl InputEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#ainputevent_getdeviceid) #[inline] + #[doc(alias = "AInputEvent_getDeviceId")] pub fn device_id(&self) -> i32 { unsafe { ffi::AInputEvent_getDeviceId(self.ptr().as_ptr()) } } @@ -155,70 +178,87 @@ pub struct MetaState(pub u32); impl MetaState { #[inline] + #[doc(alias = "AMETA_ALT_ON")] pub fn alt_on(self) -> bool { self.0 & ffi::AMETA_ALT_ON != 0 } #[inline] + #[doc(alias = "AMETA_ALT_LEFT_ON")] pub fn alt_left_on(self) -> bool { self.0 & ffi::AMETA_ALT_LEFT_ON != 0 } #[inline] + #[doc(alias = "AMETA_ALT_RIGHT_ON")] pub fn alt_right_on(self) -> bool { self.0 & ffi::AMETA_ALT_RIGHT_ON != 0 } #[inline] + #[doc(alias = "AMETA_SHIFT_ON")] pub fn shift_on(self) -> bool { self.0 & ffi::AMETA_SHIFT_ON != 0 } #[inline] + #[doc(alias = "AMETA_SHIFT_LEFT_ON")] pub fn shift_left_on(self) -> bool { self.0 & ffi::AMETA_SHIFT_LEFT_ON != 0 } #[inline] + #[doc(alias = "AMETA_SHIFT_RIGHT_ON")] pub fn shift_right_on(self) -> bool { self.0 & ffi::AMETA_SHIFT_RIGHT_ON != 0 } #[inline] + #[doc(alias = "AMETA_SYM_ON")] pub fn sym_on(self) -> bool { self.0 & ffi::AMETA_SYM_ON != 0 } #[inline] + #[doc(alias = "AMETA_FUNCTION_ON")] pub fn function_on(self) -> bool { self.0 & ffi::AMETA_FUNCTION_ON != 0 } #[inline] + #[doc(alias = "AMETA_CTRL_ON")] pub fn ctrl_on(self) -> bool { self.0 & ffi::AMETA_CTRL_ON != 0 } #[inline] + #[doc(alias = "AMETA_CTRL_LEFT_ON")] pub fn ctrl_left_on(self) -> bool { self.0 & ffi::AMETA_CTRL_LEFT_ON != 0 } #[inline] + #[doc(alias = "AMETA_CTRL_RIGHT_ON")] pub fn ctrl_right_on(self) -> bool { self.0 & ffi::AMETA_CTRL_RIGHT_ON != 0 } #[inline] + #[doc(alias = "AMETA_META_ON")] pub fn meta_on(self) -> bool { self.0 & ffi::AMETA_META_ON != 0 } #[inline] + #[doc(alias = "AMETA_META_LEFT_ON")] pub fn meta_left_on(self) -> bool { self.0 & ffi::AMETA_META_LEFT_ON != 0 } #[inline] + #[doc(alias = "AMETA_META_RIGHT_ON")] pub fn meta_right_on(self) -> bool { self.0 & ffi::AMETA_META_RIGHT_ON != 0 } #[inline] + #[doc(alias = "AMETA_CAPS_LOCK_ON")] pub fn caps_lock_on(self) -> bool { self.0 & ffi::AMETA_CAPS_LOCK_ON != 0 } #[inline] + #[doc(alias = "AMETA_NUM_LOCK_ON")] pub fn num_lock_on(self) -> bool { self.0 & ffi::AMETA_NUM_LOCK_ON != 0 } #[inline] + #[doc(alias = "AMETA_SCROLL_LOCK_ON")] pub fn scroll_lock_on(self) -> bool { self.0 & ffi::AMETA_SCROLL_LOCK_ON != 0 } @@ -233,6 +273,8 @@ impl MetaState { /// /// [`AInputEvent *`]: https://developer.android.com/ndk/reference/group/input#ainputevent #[derive(Clone, Debug)] +#[doc(alias = "AMotionEvent")] +#[doc(alias = "AINPUT_EVENT_TYPE_MOTION")] pub struct MotionEvent { ptr: NonNull, } @@ -244,18 +286,31 @@ pub struct MotionEvent { #[repr(i32)] #[non_exhaustive] pub enum MotionAction { + #[doc(alias = "AMOTION_EVENT_ACTION_DOWN")] Down = ffi::AMOTION_EVENT_ACTION_DOWN as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_UP")] Up = ffi::AMOTION_EVENT_ACTION_UP as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_MOVE")] Move = ffi::AMOTION_EVENT_ACTION_MOVE as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_CANCEL")] Cancel = ffi::AMOTION_EVENT_ACTION_CANCEL as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_OUTSIDE")] Outside = ffi::AMOTION_EVENT_ACTION_OUTSIDE as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_POINTER_DOWN")] PointerDown = ffi::AMOTION_EVENT_ACTION_POINTER_DOWN as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_POINTER_UP")] PointerUp = ffi::AMOTION_EVENT_ACTION_POINTER_UP as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_HOVER_MOVE")] HoverMove = ffi::AMOTION_EVENT_ACTION_HOVER_MOVE as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_SCROLL")] Scroll = ffi::AMOTION_EVENT_ACTION_SCROLL as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_HOVER_ENTER")] HoverEnter = ffi::AMOTION_EVENT_ACTION_HOVER_ENTER as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_HOVER_EXIT")] HoverExit = ffi::AMOTION_EVENT_ACTION_HOVER_EXIT as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_BUTTON_PRESS")] ButtonPress = ffi::AMOTION_EVENT_ACTION_BUTTON_PRESS as i32, + #[doc(alias = "AMOTION_EVENT_ACTION_BUTTON_RELEASE")] ButtonRelease = ffi::AMOTION_EVENT_ACTION_BUTTON_RELEASE as i32, #[doc(hidden)] @@ -267,51 +322,97 @@ pub enum MotionAction { #[derive(Copy, Clone, Debug, PartialEq, Eq, FromPrimitive, IntoPrimitive)] #[repr(i32)] #[non_exhaustive] +#[doc(alias = "AMOTION_EVENT_AXIS")] pub enum Axis { + #[doc(alias = "AMOTION_EVENT_AXIS_X")] X = ffi::AMOTION_EVENT_AXIS_X as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_Y")] Y = ffi::AMOTION_EVENT_AXIS_Y as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_PRESSURE")] Pressure = ffi::AMOTION_EVENT_AXIS_PRESSURE as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_SIZE")] Size = ffi::AMOTION_EVENT_AXIS_SIZE as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_TOUCH_MAJOR")] TouchMajor = ffi::AMOTION_EVENT_AXIS_TOUCH_MAJOR as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_TOUCH_MINOR")] TouchMinor = ffi::AMOTION_EVENT_AXIS_TOUCH_MINOR as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_TOOL_MAJOR")] ToolMajor = ffi::AMOTION_EVENT_AXIS_TOOL_MAJOR as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_TOOL_MINOR")] ToolMinor = ffi::AMOTION_EVENT_AXIS_TOOL_MINOR as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_ORIENTATION")] Orientation = ffi::AMOTION_EVENT_AXIS_ORIENTATION as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_VSCROLL")] Vscroll = ffi::AMOTION_EVENT_AXIS_VSCROLL as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_HSCROLL")] Hscroll = ffi::AMOTION_EVENT_AXIS_HSCROLL as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_Z")] Z = ffi::AMOTION_EVENT_AXIS_Z as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_RX")] Rx = ffi::AMOTION_EVENT_AXIS_RX as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_RY")] Ry = ffi::AMOTION_EVENT_AXIS_RY as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_RZ")] Rz = ffi::AMOTION_EVENT_AXIS_RZ as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_HAT_X")] HatX = ffi::AMOTION_EVENT_AXIS_HAT_X as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_HAT_Y")] HatY = ffi::AMOTION_EVENT_AXIS_HAT_Y as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_LTRIGGER")] Ltrigger = ffi::AMOTION_EVENT_AXIS_LTRIGGER as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_RTRIGGER")] Rtrigger = ffi::AMOTION_EVENT_AXIS_RTRIGGER as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_THROTTLE")] Throttle = ffi::AMOTION_EVENT_AXIS_THROTTLE as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_RUDDER")] Rudder = ffi::AMOTION_EVENT_AXIS_RUDDER as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_WHEEL")] Wheel = ffi::AMOTION_EVENT_AXIS_WHEEL as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GAS")] Gas = ffi::AMOTION_EVENT_AXIS_GAS as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_BRAKE")] Brake = ffi::AMOTION_EVENT_AXIS_BRAKE as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_DISTANCE")] Distance = ffi::AMOTION_EVENT_AXIS_DISTANCE as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_TILT")] Tilt = ffi::AMOTION_EVENT_AXIS_TILT as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_SCROLL")] Scroll = ffi::AMOTION_EVENT_AXIS_SCROLL as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_RELATIVE_X")] RelativeX = ffi::AMOTION_EVENT_AXIS_RELATIVE_X as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_RELATIVE_Y")] RelativeY = ffi::AMOTION_EVENT_AXIS_RELATIVE_Y as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_1")] Generic1 = ffi::AMOTION_EVENT_AXIS_GENERIC_1 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_2")] Generic2 = ffi::AMOTION_EVENT_AXIS_GENERIC_2 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_3")] Generic3 = ffi::AMOTION_EVENT_AXIS_GENERIC_3 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_4")] Generic4 = ffi::AMOTION_EVENT_AXIS_GENERIC_4 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_5")] Generic5 = ffi::AMOTION_EVENT_AXIS_GENERIC_5 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_6")] Generic6 = ffi::AMOTION_EVENT_AXIS_GENERIC_6 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_7")] Generic7 = ffi::AMOTION_EVENT_AXIS_GENERIC_7 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_8")] Generic8 = ffi::AMOTION_EVENT_AXIS_GENERIC_8 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_9")] Generic9 = ffi::AMOTION_EVENT_AXIS_GENERIC_9 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_10")] Generic10 = ffi::AMOTION_EVENT_AXIS_GENERIC_10 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_11")] Generic11 = ffi::AMOTION_EVENT_AXIS_GENERIC_11 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_12")] Generic12 = ffi::AMOTION_EVENT_AXIS_GENERIC_12 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_13")] Generic13 = ffi::AMOTION_EVENT_AXIS_GENERIC_13 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_14")] Generic14 = ffi::AMOTION_EVENT_AXIS_GENERIC_14 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_15")] Generic15 = ffi::AMOTION_EVENT_AXIS_GENERIC_15 as i32, + #[doc(alias = "AMOTION_EVENT_AXIS_GENERIC_16")] Generic16 = ffi::AMOTION_EVENT_AXIS_GENERIC_16 as i32, /// Axis constant: X gesture offset axis of a motion event. @@ -381,11 +482,17 @@ pub enum Axis { #[repr(i32)] #[non_exhaustive] pub enum ToolType { + #[doc(alias = "AMOTION_EVENT_TOOL_TYPE_UNKNOWN")] Unknown = ffi::AMOTION_EVENT_TOOL_TYPE_UNKNOWN as i32, + #[doc(alias = "AMOTION_EVENT_TOOL_TYPE_FINGER")] Finger = ffi::AMOTION_EVENT_TOOL_TYPE_FINGER as i32, + #[doc(alias = "AMOTION_EVENT_TOOL_TYPE_STYLUS")] Stylus = ffi::AMOTION_EVENT_TOOL_TYPE_STYLUS as i32, + #[doc(alias = "AMOTION_EVENT_TOOL_TYPE_MOUSE")] Mouse = ffi::AMOTION_EVENT_TOOL_TYPE_MOUSE as i32, + #[doc(alias = "AMOTION_EVENT_TOOL_TYPE_ERASER")] Eraser = ffi::AMOTION_EVENT_TOOL_TYPE_ERASER as i32, + #[doc(alias = "AMOTION_EVENT_TOOL_TYPE_PALM")] Palm = ffi::AMOTION_EVENT_TOOL_TYPE_PALM as i32, #[doc(hidden)] @@ -438,30 +545,37 @@ pub struct ButtonState(pub u32); impl ButtonState { #[inline] + #[doc(alias = "AMOTION_EVENT_BUTTON_PRIMARY")] pub fn primary(self) -> bool { self.0 & ffi::AMOTION_EVENT_BUTTON_PRIMARY != 0 } #[inline] + #[doc(alias = "AMOTION_EVENT_BUTTON_SECONDARY")] pub fn secondary(self) -> bool { self.0 & ffi::AMOTION_EVENT_BUTTON_SECONDARY != 0 } #[inline] + #[doc(alias = "AMOTION_EVENT_BUTTON_TERTIARY")] pub fn teriary(self) -> bool { self.0 & ffi::AMOTION_EVENT_BUTTON_TERTIARY != 0 } #[inline] + #[doc(alias = "AMOTION_EVENT_BUTTON_BACK")] pub fn back(self) -> bool { self.0 & ffi::AMOTION_EVENT_BUTTON_BACK != 0 } #[inline] + #[doc(alias = "AMOTION_EVENT_BUTTON_FORWARD")] pub fn forward(self) -> bool { self.0 & ffi::AMOTION_EVENT_BUTTON_FORWARD != 0 } #[inline] + #[doc(alias = "AMOTION_EVENT_BUTTON_STYLUS_PRIMARY")] pub fn stylus_primary(self) -> bool { self.0 & ffi::AMOTION_EVENT_BUTTON_STYLUS_PRIMARY != 0 } #[inline] + #[doc(alias = "AMOTION_EVENT_BUTTON_STYLUS_SECONDARY")] pub fn stylus_secondary(self) -> bool { self.0 & ffi::AMOTION_EVENT_BUTTON_STYLUS_SECONDARY != 0 } @@ -474,29 +588,35 @@ pub struct EdgeFlags(pub u32); impl EdgeFlags { #[inline] + #[doc(alias = "AMOTION_EVENT_EDGE_FLAG_TOP")] pub fn top(self) -> bool { self.0 & ffi::AMOTION_EVENT_EDGE_FLAG_TOP != 0 } #[inline] + #[doc(alias = "AMOTION_EVENT_EDGE_FLAG_BOTTOM")] pub fn bottom(self) -> bool { self.0 & ffi::AMOTION_EVENT_EDGE_FLAG_BOTTOM != 0 } #[inline] + #[doc(alias = "AMOTION_EVENT_EDGE_FLAG_LEFT")] pub fn left(self) -> bool { self.0 & ffi::AMOTION_EVENT_EDGE_FLAG_LEFT != 0 } #[inline] + #[doc(alias = "AMOTION_EVENT_EDGE_FLAG_RIGHT")] pub fn right(self) -> bool { self.0 & ffi::AMOTION_EVENT_EDGE_FLAG_RIGHT != 0 } } +// TODO: bitflags /// Flags associated with this [`MotionEvent`]. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct MotionEventFlags(pub u32); impl MotionEventFlags { #[inline] + #[doc(alias = "AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED")] pub fn window_is_obscured(self) -> bool { self.0 & ffi::AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED != 0 } @@ -544,6 +664,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#ainputevent_getsource) #[inline] + #[doc(alias = "AInputEvent_getSource")] pub fn source(&self) -> Source { let source = unsafe { ffi::AInputEvent_getSource(self.ptr.as_ptr()) }; source.into() @@ -554,6 +675,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#ainputevent_getdeviceid) #[inline] + #[doc(alias = "AInputEvent_getDeviceId")] pub fn device_id(&self) -> i32 { unsafe { ffi::AInputEvent_getDeviceId(self.ptr.as_ptr()) } } @@ -563,6 +685,8 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getaction) #[inline] + #[doc(alias = "AMotionEvent_getAction")] + #[doc(alias = "AMOTION_EVENT_ACTION_MASK")] pub fn action(&self) -> MotionAction { let action = unsafe { ffi::AMotionEvent_getAction(self.ptr.as_ptr()) } & ffi::AMOTION_EVENT_ACTION_MASK as i32; @@ -578,6 +702,9 @@ impl MotionEvent { /// [`Down`][MotionAction::Down], [`PointerUp`][MotionAction::PointerUp], /// or [`PointerDown`][MotionAction::PointerDown]. #[inline] + #[doc(alias = "AMotionEvent_getAction")] + #[doc(alias = "AMOTION_EVENT_ACTION_POINTER_INDEX_MASK")] + #[doc(alias = "AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT")] pub fn pointer_index(&self) -> usize { let action = unsafe { ffi::AMotionEvent_getAction(self.ptr.as_ptr()) as u32 }; let index = (action & ffi::AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) @@ -592,6 +719,7 @@ impl MotionEvent { /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getpointerid) // TODO: look at output with out-of-range pointer index // Probably -1 though + #[doc(alias = "AMotionEvent_getPointerId")] pub fn pointer_id_for(&self, pointer_index: usize) -> i32 { unsafe { ffi::AMotionEvent_getPointerId(self.ptr.as_ptr(), pointer_index) } } @@ -602,12 +730,14 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getpointercount) #[inline] + #[doc(alias = "AMotionEvent_getPointerCount")] pub fn pointer_count(&self) -> usize { unsafe { ffi::AMotionEvent_getPointerCount(self.ptr.as_ptr()) } } /// An iterator over the pointers in this motion event #[inline] + #[doc(alias = "AMotionEvent_getPointerCount")] pub fn pointers(&self) -> PointersIter<'_> { PointersIter { event: self.ptr, @@ -637,12 +767,14 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_gethistorysize) #[inline] + #[doc(alias = "AMotionEvent_getHistorySize")] pub fn history_size(&self) -> usize { unsafe { ffi::AMotionEvent_getHistorySize(self.ptr.as_ptr()) } } /// An iterator over the historical events contained in this event. #[inline] + #[doc(alias = "AMotionEvent_getHistorySize")] pub fn history(&self) -> HistoricalMotionEventsIter<'_> { HistoricalMotionEventsIter { event: self.ptr, @@ -657,6 +789,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getmetastate) #[inline] + #[doc(alias = "AMotionEvent_getMetaState")] pub fn meta_state(&self) -> MetaState { MetaState(unsafe { ffi::AMotionEvent_getMetaState(self.ptr.as_ptr()) } as u32) } @@ -666,6 +799,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getbuttonstate) #[inline] + #[doc(alias = "AMotionEvent_getButtonState")] pub fn button_state(&self) -> ButtonState { ButtonState(unsafe { ffi::AMotionEvent_getButtonState(self.ptr.as_ptr()) } as u32) } @@ -676,6 +810,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getdowntime) #[inline] + #[doc(alias = "AMotionEvent_getDownTime")] pub fn down_time(&self) -> i64 { unsafe { ffi::AMotionEvent_getDownTime(self.ptr.as_ptr()) } } @@ -685,6 +820,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getedgeflags) #[inline] + #[doc(alias = "AMotionEvent_getEdgeFlags")] pub fn edge_flags(&self) -> EdgeFlags { EdgeFlags(unsafe { ffi::AMotionEvent_getEdgeFlags(self.ptr.as_ptr()) } as u32) } @@ -694,6 +830,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_geteventtime) #[inline] + #[doc(alias = "AMotionEvent_getEventTime")] pub fn event_time(&self) -> i64 { unsafe { ffi::AMotionEvent_getEventTime(self.ptr.as_ptr()) } } @@ -703,6 +840,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getflags) #[inline] + #[doc(alias = "AMotionEvent_getFlags")] pub fn flags(&self) -> MotionEventFlags { MotionEventFlags(unsafe { ffi::AMotionEvent_getFlags(self.ptr.as_ptr()) } as u32) } @@ -712,6 +850,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getxoffset) #[inline] + #[doc(alias = "AMotionEvent_getXOffset")] pub fn x_offset(&self) -> f32 { unsafe { ffi::AMotionEvent_getXOffset(self.ptr.as_ptr()) } } @@ -721,6 +860,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getyoffset) #[inline] + #[doc(alias = "AMotionEvent_getYOffset")] pub fn y_offset(&self) -> f32 { unsafe { ffi::AMotionEvent_getYOffset(self.ptr.as_ptr()) } } @@ -730,6 +870,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getxprecision) #[inline] + #[doc(alias = "AMotionEvent_getXPrecision")] pub fn x_precision(&self) -> f32 { unsafe { ffi::AMotionEvent_getXPrecision(self.ptr.as_ptr()) } } @@ -739,6 +880,7 @@ impl MotionEvent { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getyprecision) #[inline] + #[doc(alias = "AMotionEvent_getYPrecision")] pub fn y_precision(&self) -> f32 { unsafe { ffi::AMotionEvent_getYPrecision(self.ptr.as_ptr()) } } @@ -781,71 +923,85 @@ impl<'a> Pointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getPointerId")] pub fn pointer_id(&self) -> i32 { unsafe { ffi::AMotionEvent_getPointerId(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getAxisValue")] pub fn axis_value(&self, axis: Axis) -> f32 { unsafe { ffi::AMotionEvent_getAxisValue(self.event.as_ptr(), axis.into(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getOrientation")] pub fn orientation(&self) -> f32 { unsafe { ffi::AMotionEvent_getOrientation(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getPressure")] pub fn pressure(&self) -> f32 { unsafe { ffi::AMotionEvent_getPressure(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getRawX")] pub fn raw_x(&self) -> f32 { unsafe { ffi::AMotionEvent_getRawX(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getRawY")] pub fn raw_y(&self) -> f32 { unsafe { ffi::AMotionEvent_getRawY(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getX")] pub fn x(&self) -> f32 { unsafe { ffi::AMotionEvent_getX(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getY")] pub fn y(&self) -> f32 { unsafe { ffi::AMotionEvent_getY(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getSize")] pub fn size(&self) -> f32 { unsafe { ffi::AMotionEvent_getSize(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getToolMajor")] pub fn tool_major(&self) -> f32 { unsafe { ffi::AMotionEvent_getToolMajor(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getToolMinor")] pub fn tool_minor(&self) -> f32 { unsafe { ffi::AMotionEvent_getToolMinor(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getTouchMajor")] pub fn touch_major(&self) -> f32 { unsafe { ffi::AMotionEvent_getTouchMajor(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getTouchMinor")] pub fn touch_minor(&self) -> f32 { unsafe { ffi::AMotionEvent_getTouchMinor(self.event.as_ptr(), self.index) } } #[inline] + #[doc(alias = "AMotionEvent_getToolType")] pub fn tool_type(&self) -> ToolType { let tool_type = unsafe { ffi::AMotionEvent_getToolType(self.event.as_ptr(), self.index) }; tool_type.into() @@ -912,12 +1068,14 @@ impl<'a> HistoricalMotionEvent<'a> { /// See [the NDK /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_gethistoricaleventtime) #[inline] + #[doc(alias = "AMotionEvent_getHistoricalEventTime")] pub fn event_time(&self) -> i64 { unsafe { ffi::AMotionEvent_getHistoricalEventTime(self.event.as_ptr(), self.history_index) } } /// An iterator over the pointers of this historical motion event #[inline] + #[doc(alias = "MotionEvent_getPointerCount")] pub fn pointers(&self) -> HistoricalPointersIter<'a> { HistoricalPointersIter { event: self.event, @@ -1002,6 +1160,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getPointerId")] pub fn pointer_id(&self) -> i32 { unsafe { ffi::AMotionEvent_getPointerId(self.event.as_ptr(), self.pointer_index) } } @@ -1012,6 +1171,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalAxisValue")] pub fn axis_value(&self, axis: Axis) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalAxisValue( @@ -1024,6 +1184,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalOrientation")] pub fn orientation(&self) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalOrientation( @@ -1035,6 +1196,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalPressure")] pub fn pressure(&self) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalPressure( @@ -1046,6 +1208,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalRawX")] pub fn raw_x(&self) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalRawX( @@ -1057,6 +1220,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalRawY")] pub fn raw_y(&self) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalRawY( @@ -1068,6 +1232,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalX")] pub fn x(&self) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalX( @@ -1079,6 +1244,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalY")] pub fn y(&self) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalY( @@ -1090,6 +1256,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalSize")] pub fn size(&self) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalSize( @@ -1101,6 +1268,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalToolMajor")] pub fn tool_major(&self) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalToolMajor( @@ -1112,6 +1280,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalToolMinor")] pub fn tool_minor(&self) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalToolMinor( @@ -1123,6 +1292,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalTouchMajor")] pub fn touch_major(&self) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalTouchMajor( @@ -1134,6 +1304,7 @@ impl<'a> HistoricalPointer<'a> { } #[inline] + #[doc(alias = "AMotionEvent_getHistoricalTouchMinor")] pub fn touch_minor(&self) -> f32 { unsafe { ffi::AMotionEvent_getHistoricalTouchMinor(