Struct gdk4::KeyEvent[][src]

pub struct KeyEvent(_);
Expand description

An event related to a key-based device.

Implementations

Extracts the consumed modifiers from a key event.

Returns

the consumed modifiers or self

Extracts the keycode from a key event.

Returns

the keycode of self

Extracts the keyval from a key event.

Returns

the keyval of self

Extracts the layout from a key event.

Returns

the layout of self

Extracts the shift level from a key event.

Returns

the shift level of self

Gets a keyval and modifier combination that will match the event.

See matches().

Returns

true on success

keyval

return location for a keyval

modifiers

return location for modifiers

Extracts whether the key event is for a modifier key.

Returns

true if the self is for a modifier key

Matches a key event against a keyval and modifiers.

This is typically used to trigger keyboard shortcuts such as Ctrl-C.

Partial matches are possible where the combination matches if the currently active group is ignored.

Note that we ignore Caps Lock for matching.

keyval

the keyval to match

modifiers

the modifiers to match

Returns

a KeyMatch value describing whether self matches

Methods from Deref<Target = Event>

Extract the axis value for a particular axis use from an event structure.

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

Retrieves the display associated to the self.

Returns

a Display

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.

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.

Trait Implementations

Performs the conversion.

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

Performs the conversion.

Performs the conversion.

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)

recently added

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.