Gnome::Gdk4::Event

#------------------------------------------------------------------------------- #--[Class Description]---------------------------------------------------------- #-------------------------------------------------------------------------------

=begin rakudoc

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.

=end rakudoc

#------------------------------------------------------------------------------- #--[Class Initialization]------------------------------------------------------- #-------------------------------------------------------------------------------

=begin rakudoc

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! )

=end rakudoc

#------------------------------------------------------------------------------- #--[Methods]-------------------------------------------------------------------- #-------------------------------------------------------------------------------

=begin rakudoc

Methods =end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

-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..

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

-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..

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

-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..

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

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.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

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.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-device

Returns the device of an event.

method get-device (--> N-Object )

Return value; a Gnome::Gdk4::Device.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

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.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-display

Retrieves the display associated to the $event.

method get-display (--> N-Object )

Return value; a Gnome::Gdk4::Display.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

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.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

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.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

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.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-modifier-state

Returns the modifier state field of an event.

method get-modifier-state (--> UInt )

Return value; the modifier state of $event.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

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.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

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.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-seat

Returns the seat that originated the event.

method get-seat (--> N-Object )

Return value; a Gnome::Gdk4::Seat..

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-surface

Extracts the surface associated with an event.

method get-surface (--> N-Object )

Return value; The Gnome::Gdk4::Surface associated with the event.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

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.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

ref

Increase the ref count of $event.

method ref (--> N-Object )

Return value; $event.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

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..

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

unref

Decrease the ref count of $event.

If the last reference is dropped, the structure is freed.

method unref ( )

=end rakudoc

Gnome::Gdk4 v0.1.23

Authors

  • Marcel Timmerman

License

Artistic-2.0

Dependencies

Gnome::Gio:api<2>Gnome::GObject:api<2>Gnome::Glib:api<2>Gnome::N:api<2>

Test Dependencies

Provides

  • Gnome::Gdk4::ContentProvider
  • Gnome::Gdk4::Display
  • Gnome::Gdk4::Drag
  • Gnome::Gdk4::Drop
  • Gnome::Gdk4::MemoryTexture
  • Gnome::Gdk4::N-ContentFormats
  • Gnome::Gdk4::N-ContentFormatsBuilder
  • Gnome::Gdk4::N-FileList
  • Gnome::Gdk4::N-RGBA
  • Gnome::Gdk4::N-Rectangle
  • Gnome::Gdk4::R-Paintable
  • Gnome::Gdk4::Snapshot
  • Gnome::Gdk4::Surface
  • Gnome::Gdk4::T-contentformats
  • Gnome::Gdk4::T-drag
  • Gnome::Gdk4::T-enums
  • Gnome::Gdk4::T-keysyms
  • Gnome::Gdk4::T-paintable
  • Gnome::Gdk4::T-rgba
  • Gnome::Gdk4::T-texture
  • Gnome::Gdk4::T-types
  • Gnome::Gdk4::Texture

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.