pub struct TouchpadEvent { /* private fields */ }
Expand description
An event related to a gesture on a touchpad device.
Unlike touchscreens, where the windowing system sends basic sequences of begin, update, end events, and leaves gesture recognition to the clients, touchpad gestures are typically processed by the system, resulting in these events.
GLib type: Shared boxed type with reference counted clone semantics.
Implementations§
Source§impl TouchpadEvent
impl TouchpadEvent
Sourcepub fn as_ptr(&self) -> *mut GdkTouchpadEvent
pub fn as_ptr(&self) -> *mut GdkTouchpadEvent
Return the inner pointer to the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow(ptr: &*mut GdkTouchpadEvent) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut GdkTouchpadEvent) -> &Self
Borrows the underlying C value.
Source§impl TouchpadEvent
impl TouchpadEvent
Sourcepub fn gesture_phase(&self) -> TouchpadGesturePhase
pub fn gesture_phase(&self) -> TouchpadGesturePhase
Sourcepub fn pinch_angle_delta(&self) -> f64
pub fn pinch_angle_delta(&self) -> f64
Sourcepub fn pinch_scale(&self) -> f64
pub fn pinch_scale(&self) -> f64
Source§impl TouchpadEvent
impl TouchpadEvent
Methods from Deref<Target = Event>§
pub const NONE: Option<&'static Event> = None
Sourcepub fn axes(&self) -> Option<Vec<f64>>
pub fn axes(&self) -> Option<Vec<f64>>
Extracts all axis values from an event.
To find out which axes are used, use DeviceTool::axes()
on the device tool returned by device_tool()
.
§Returns
true
on success, otherwise false
§axes
the array of values for all axes
Sourcepub fn axis(&self, axis_use: AxisUse) -> Option<f64>
pub fn axis(&self, axis_use: AxisUse) -> Option<f64>
Extract the axis value for a particular axis use from an event structure.
To find out which axes are used, use DeviceTool::axes()
on the device tool returned by device_tool()
.
§axis_use
the axis use to look for
§Returns
true
if the specified axis was found, otherwise false
§value
location to store the value found
Sourcepub fn device_tool(&self) -> Option<DeviceTool>
pub fn device_tool(&self) -> Option<DeviceTool>
Returns a DeviceTool
representing the tool that
caused the event.
If the was not generated by a device that supports
different tools (such as a tablet), this function will
return None
.
Note: the DeviceTool
will be constant during
the application lifetime, if settings must be stored
persistently across runs, see DeviceTool::serial()
.
§Returns
The current device tool
Sourcepub fn event_sequence(&self) -> EventSequence
pub fn event_sequence(&self) -> EventSequence
Returns the event sequence to which the event belongs.
Related touch events are connected in a sequence. Other events typically don’t have event sequence information.
§Returns
the event sequence that the event belongs to
Sourcepub fn event_type(&self) -> EventType
pub fn event_type(&self) -> EventType
Sourcepub fn history(&self) -> Vec<TimeCoord>
pub fn history(&self) -> Vec<TimeCoord>
Retrieves the history of the device that @self is for, as a list of time and coordinates.
The history includes positions that are not delivered as separate events to the application because they occurred in the same frame as @self.
Note that only motion and scroll events record history, and motion events do it only if one of the mouse buttons is down, or the device has a tool.
§Returns
an array of time and coordinates
Sourcepub fn modifier_state(&self) -> ModifierType
pub fn modifier_state(&self) -> ModifierType
Sourcepub fn is_pointer_emulated(&self) -> bool
pub fn is_pointer_emulated(&self) -> bool
Sourcepub fn position(&self) -> Option<(f64, f64)>
pub fn position(&self) -> Option<(f64, f64)>
Extract the event surface relative x/y coordinates from an event.
This position is in surface coordinates.
§Returns
whether the positions were set
§x
location to put event surface x coordinate
§y
location to put event surface y coordinate
Sourcepub fn time(&self) -> u32
pub fn time(&self) -> u32
Returns the timestamp of @self.
Not all events have timestamps. In that case, this function
returns GDK_CURRENT_TIME
.
§Returns
timestamp field from @self
Returns whether a Event
should trigger a context menu,
according to platform conventions.
The right mouse button typically triggers context menus. On macOS, Control+left mouse button also triggers.
This function should always be used instead of simply checking for
⚠️ The following code is in c ⚠️
event->button == GDK_BUTTON_SECONDARY
§Returns
true
if the event should trigger a context menu.
pub fn is<T: EventKind>(&self) -> bool
pub fn type_(&self) -> Type
pub fn downcast_ref<T: EventKind>(&self) -> Option<&T>
Sourcepub fn angle(&self, event: impl AsRef<Event>) -> Option<f64>
pub fn angle(&self, event: impl AsRef<Event>) -> Option<f64>
Returns the relative angle from @event1 to @event2.
The relative angle is the angle between the X axis and the line through both events’ positions. The rotation direction for positive angles is from the positive X axis towards the positive Y axis.
This assumes that both events have X/Y information.
If not, this function returns false
.
§event1
first Event
§event2
second Event
§Returns
true
if the angle could be calculated.
§angle
return location for the relative angle between both events
Sourcepub fn center(&self, event: impl AsRef<Event>) -> Option<(f64, f64)>
pub fn center(&self, event: impl AsRef<Event>) -> Option<(f64, f64)>
Returns the point halfway between the events’ positions.
This assumes that both events have X/Y information.
If not, this function returns false
.
§event1
first Event
§event2
second Event
§Returns
true
if the center could be calculated.
§x
return location for the X coordinate of the center
§y
return location for the Y coordinate of the center
Trait Implementations§
Source§impl AsRef<Event> for TouchpadEvent
impl AsRef<Event> for TouchpadEvent
Source§impl Clone for TouchpadEvent
impl Clone for TouchpadEvent
Source§impl Debug for TouchpadEvent
impl Debug for TouchpadEvent
Source§impl Deref for TouchpadEvent
impl Deref for TouchpadEvent
Source§impl EventKind for TouchpadEvent
impl EventKind for TouchpadEvent
fn event_types() -> &'static [EventType]
Source§impl StaticType for TouchpadEvent
impl StaticType for TouchpadEvent
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.Auto Trait Implementations§
impl Freeze for TouchpadEvent
impl RefUnwindSafe for TouchpadEvent
impl !Send for TouchpadEvent
impl !Sync for TouchpadEvent
impl Unpin for TouchpadEvent
impl UnwindSafe for TouchpadEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)