class Gdk::Event
- Gdk::Event
- Reference
- Object
Overview
Gdk::Event
s are immutable data structures, created by GDK to
represent 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 Gdk::Event
and its related API is rarely needed.
Direct Known Subclasses
- Gdk::ButtonEvent
- Gdk::CrossingEvent
- Gdk::DeleteEvent
- Gdk::DNDEvent
- Gdk::FocusEvent
- Gdk::GrabBrokenEvent
- Gdk::KeyEvent
- Gdk::MotionEvent
- Gdk::PadEvent
- Gdk::ProximityEvent
- Gdk::ScrollEvent
- Gdk::TouchEvent
- Gdk::TouchpadEvent
Defined in:
lib/gi-crystal/src/auto/gdk-4.0/event.crlib/gtk4/src/bindings/gdk/event.cr
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#_get_angle(event2 : Gdk::Event, angle : Float64) : Bool
Returns the relative angle from @event1 to @event2.
-
#_get_center(event2 : Gdk::Event, x : Float64, y : Float64) : Bool
Returns the point halfway between the events' positions.
-
#_get_distance(event2 : Gdk::Event, distance : Float64) : Bool
Returns the distance between the event locations.
-
#axes(axes : Enumerable(Float64)) : Bool
Extracts all axis values from an event.
- #axes(*axes : Float64)
-
#axis(axis_use : Gdk::AxisUse, value : Float64) : Bool
Extract the axis value for a particular axis use from an event structure.
-
#device : Gdk::Device?
Returns the device of an event.
-
#device_tool : Gdk::DeviceTool?
Returns a
Gdk::DeviceTool
representing the tool that caused the event. -
#display : Gdk::Display?
Retrieves the display associated to the @event.
-
#event_sequence : Gdk::EventSequence
Retuns the event sequence to which the event belongs.
-
#event_type : Gdk::EventType
Retrieves the type of the event.
-
#finalize
Called by the garbage collector.
-
#history : Enumerable(Gdk::TimeCoord)?
Retrieves the history of the device that @event is for, as a list of time and coordinates.
-
#modifier_state : Gdk::ModifierType
Returns the modifier state field of an event.
-
#pointer_emulated : Bool
Returns whether this event is an 'emulated' pointer event.
-
#position(x : Float64, y : Float64) : Bool
Extract the event surface relative x/y coordinates from an event.
-
#seat : Gdk::Seat?
Returns the seat that originated the event.
-
#surface : Gdk::Surface?
Extracts the surface associated with an event.
-
#time : UInt32
Returns the timestamp of @event.
-
#to_unsafe : Pointer(Void)
Returns a pointer to the C object.
-
#triggers_context_menu : Bool
Returns whether a
Gdk::Event
should trigger a context menu, according to platform conventions.
Class Method Detail
Instance Method Detail
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
.
Returns the point halfway between the events' positions.
This assumes that both events have X/Y information.
If not, this function returns false
.
Returns the distance between the event locations.
This assumes that both events have X/Y information.
If not, this function returns false
.
Extracts all axis values from an event.
To find out which axes are used, use Gdk::DeviceTool#axes
on the device tool returned by Gdk::Event#device_tool
.
Extract the axis value for a particular axis use from an event structure.
To find out which axes are used, use Gdk::DeviceTool#axes
on the device tool returned by Gdk::Event#device_tool
.
Returns a Gdk::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 nil
.
Note: the Gdk::DeviceTool
will be constant during
the application lifetime, if settings must be stored
persistently across runs, see Gdk::DeviceTool#serial
.
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.
Called by the garbage collector. Decreases the reference count of object. (i.e. its memory is freed).
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.
Returns whether this event is an 'emulated' pointer event.
Emulated pointer events typically originate from a touch events.
Extract the event surface relative x/y coordinates from an event.
Returns the timestamp of @event.
Not all events have timestamps. In that case, this function returns %GDK_CURRENT_TIME.