
Gnome::Gdk4::Event
Description
Represents windowing system events.
In GTK applications the events are handled automatically by toplevel widgets and passed on to the event controllers of appropriate widgets, so using Gnome::Gdk4::Event and its related API is rarely needed.
Gnome::Gdk4::Event structs are immutable.
Class initialization
new
:native-object
Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object() :$native-object! )
Methods
-get-angle
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.
method -get-angle ( N-Object() $event2, Num() $angle --> Bool )
$event2; second Gnome::Gdk4::Event.
$angle; (transfer ownership: full) return location for the relative angle between both events.
Return value; True if the angle could be calculated..
-get-center
Returns the point halfway between the events' positions.
This assumes that both events have X/Y information. If not, this function returns False.
method -get-center ( N-Object() $event2, Num() $x, Num() $y --> Bool )
$event2; second Gnome::Gdk4::Event.
$x; (transfer ownership: full) return location for the X coordinate of the center.
$y; (transfer ownership: full) return location for the Y coordinate of the center.
Return value; True if the center could be calculated..
-get-distance
Returns the distance between the event locations.
This assumes that both events have X/Y information. If not, this function returns False.
method -get-distance ( N-Object() $event2, Num() $distance --> Bool )
$event2; second Gnome::Gdk4::Event.
$distance; (transfer ownership: full) return location for the distance.
Return value; True if the distance could be calculated..
get-axes
Extracts all axis values from an event.
To find out which axes are used, use .get-axes() in class Gnome on the device tool returned by .get-device-tool().
method get-axes ( Num() $axes, Array[Int] $n-axes --> Bool )
$axes; the array of values for all axes.
$n-axes; (transfer ownership: full) the length of array.
Return value; True on success, otherwise False.
get-axis
Extract the axis value for a particular axis use from an event structure.
To find out which axes are used, use .get-axes() in class Gnome on the device tool returned by .get-device-tool().
method get-axis ( GdkAxisUse $axis-use, Num() $value --> Bool )
$axis-use; the axis use to look for.
$value; (transfer ownership: full) location to store the value found.
Return value; True if the specified axis was found, otherwise False.
get-device
Returns the device of an event.
method get-device (--> N-Object )
Return value; a Gnome::Gdk4::Device.
get-device-tool
Returns a Gnome::Gdk4::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 undefined.
Note: the Gnome::Gdk4::DeviceTool will be constant during the application lifetime, if settings must be stored persistently across runs, see .get-serial() in class Gnome.
method get-device-tool (--> N-Object )
Return value; The current device tool.
get-display
Retrieves the display associated to the $event.
method get-display (--> N-Object )
Return value; a Gnome::Gdk4::Display.
get-event-sequence
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.
method get-event-sequence (--> N-Object )
Return value; the event sequence that the event belongs to.
get-event-type This function is not yet available
Retrieves the type of the event.
method get-event-type (--> GdkEventType )
Return value; a Gnome::Gdk4::EventType.
get-history
Retrieves the history of the device that $event 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 $event.
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.
method get-history ( Array[Int] $out-n-coords --> N-Object )
$out-n-coords; (transfer ownership: full) Return location for the length of the returned array.
Return value; an array of time and coordinates.
get-modifier-state
Returns the modifier state field of an event.
method get-modifier-state (--> UInt )
Return value; the modifier state of $event.
get-pointer-emulated
Returns whether this event is an 'emulated' pointer event.
Emulated pointer events typically originate from a touch events.
method get-pointer-emulated (--> Bool )
Return value; True if this event is emulated.
get-position
Extract the event surface relative x/y coordinates from an event.
This position is in [surface coordinates](coordinates.html).
method get-position ( Num() $x, Num() $y --> Bool )
$x; (transfer ownership: full) location to put event surface x coordinate.
$y; (transfer ownership: full) location to put event surface y coordinate.
Return value; whether the positions were set.
get-seat
Returns the seat that originated the event.
method get-seat (--> N-Object )
Return value; a Gnome::Gdk4::Seat..
get-surface
Extracts the surface associated with an event.
method get-surface (--> N-Object )
Return value; The Gnome::Gdk4::Surface associated with the event.
get-time
Returns the timestamp of $event.
Not all events have timestamps. In that case, this function returns GDK_CURRENT_TIME.
method get-time (--> UInt )
Return value; timestamp field from $event.
ref
Increase the ref count of $event.
method ref (--> N-Object )
Return value; $event.
triggers-context-menu
Returns whether a Gnome::Gdk4::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
method triggers-context-menu (--> Bool )
Return value; True if the event should trigger a context menu..
unref
Decrease the ref count of $event.
If the last reference is dropped, the structure is freed.
method unref ( )
About my projects, examples and tutorials