#[repr(transparent)]
pub struct ButtonEvent { /* private fields */ }
Expand description

An event related to a button on a pointer device.

Implements

[EventExt][trait@crate::prelude::EventExt]

Implementations

Extract the button number from a button event.

Returns

the button of @self

Methods from Deref<Target = Event>

Extracts all axis values from an event.

To find out which axes are used, use DeviceTool::axes() on the device tool returned by [EventExt::device_tool()][crate::prelude::EventExt::device_tool()].

Returns

true on success, otherwise false

axes

the array of values for all axes

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 [EventExt::device_tool()][crate::prelude::EventExt::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

Returns the device of an event.

Returns

a Device

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

Retrieves the display associated to the @self.

Returns

a Display

Retuns 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

Retrieves the type of the event.

Returns

a EventType

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

Returns the modifier state field of an event.

Returns

the modifier state of @self

Returns whether this event is an ‘emulated’ pointer event.

Emulated pointer events typically originate from a touch events.

Returns

true if this event is emulated

Extract the event surface relative x/y coordinates from an event.

Returns
x

location to put event surface x coordinate

y

location to put event surface y coordinate

Returns the seat that originated the event.

Returns

a Seat.

Extracts the surface associated with an event.

Returns

The Surface associated with the event

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.

This function should always be used instead of simply checking for event->button == GDK_BUTTON_SECONDARY.

Returns

true if the event should trigger a context menu.

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

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

Returns the distance between the event locations.

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 distance could be calculated.

distance

return location for the distance

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Formats the value using the given formatter. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Ensures that the type has been registered with the type system.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.