Class: Gdk::Event
- Inherits:
-
Object
- Object
- Gdk::Event
- Defined in:
- lib/gtk3/deprecated.rb
Overview
GdkEvents 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 GdkEvent and its related API is rarely needed.
Direct Known Subclasses
ButtonEvent, CrossingEvent, DNDEvent, DeleteEvent, FocusEvent, GrabBrokenEvent, KeyEvent, MotionEvent, PadEvent, ProximityEvent, ScrollEvent, TouchEvent, TouchpadEvent
Instance Method Summary collapse
-
#_get_angle(event2, angle) ⇒ Boolean
Returns the relative angle from event1 to event2.
-
#_get_center(event2, x, y) ⇒ Boolean
Returns the point halfway between the events' positions.
-
#_get_distance(event2, distance) ⇒ Boolean
Returns the distance between the event locations.
-
#device ⇒ Gdk::Device
Returns the device of an event.
-
#device_tool ⇒ Gdk::DeviceTool
Returns a
GdkDeviceToolrepresenting the tool that caused the event. -
#display ⇒ Gdk::Display
Retrieves the display associated to the event.
-
#event_sequence ⇒ Gdk::EventSequence
Returns the event sequence to which the event belongs.
-
#event_type ⇒ Gdk::EventType
Retrieves the type of the event.
-
#get_axes(axes, n_axes) ⇒ Boolean
Extracts all axis values from an event.
-
#get_axis(axis_use, value) ⇒ Boolean
Extract the axis value for a particular axis use from an event structure.
-
#get_history(out_n_coords) ⇒ Array<Gdk::TimeCoord>
Retrieves the history of the device that event is for, as a list of time and coordinates.
-
#get_position(x, y) ⇒ Boolean
Extract the event surface relative x/y coordinates from an event.
-
#modifier_state ⇒ Gdk::ModifierType
Returns the modifier state field of an event.
-
#pointer_emulated ⇒ Boolean
Returns whether this event is an 'emulated' pointer event.
-
#ref ⇒ Gdk::Event
Increase the ref count of event.
-
#seat ⇒ Gdk::Seat
Returns the seat that originated the event.
-
#surface ⇒ Gdk::Surface
Extracts the surface associated with an event.
-
#time ⇒ Integer
Returns the timestamp of event.
-
#triggers_context_menu ⇒ Boolean
Returns whether a
GdkEventshould trigger a context menu, according to platform conventions. -
#unref ⇒ nil
Decrease the ref count of event.
Instance Method Details
#_get_angle(event2, angle) ⇒ Boolean
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.
#_get_center(event2, x, y) ⇒ Boolean
Returns the point halfway between the events' positions.
This assumes that both events have X/Y information. If not, this function returns false.
#_get_distance(event2, distance) ⇒ Boolean
Returns the distance between the event locations.
This assumes that both events have X/Y information. If not, this function returns false.
#device ⇒ Gdk::Device
Returns the device of an event.
#device_tool ⇒ Gdk::DeviceTool
Returns a GdkDeviceTool 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 GdkDeviceTool will be constant during
the application lifetime, if settings must be stored
persistently across runs, see [methodGdk.DeviceTool.get_serial].
#display ⇒ Gdk::Display
Retrieves the display associated to the event.
#event_sequence ⇒ Gdk::EventSequence
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.
#event_type ⇒ Gdk::EventType
Retrieves the type of the event.
#get_axes(axes, n_axes) ⇒ Boolean
Extracts all axis values from an event.
To find out which axes are used, use [methodGdk.DeviceTool.get_axes] on the device tool returned by [methodGdk.Event.get_device_tool].
#get_axis(axis_use, value) ⇒ Boolean
Extract the axis value for a particular axis use from an event structure.
To find out which axes are used, use [methodGdk.DeviceTool.get_axes] on the device tool returned by [methodGdk.Event.get_device_tool].
#get_history(out_n_coords) ⇒ Array<Gdk::TimeCoord>
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.
#get_position(x, y) ⇒ Boolean
Extract the event surface relative x/y coordinates from an event.
This position is in surface coordinates.
#modifier_state ⇒ Gdk::ModifierType
Returns the modifier state field of an event.
#pointer_emulated ⇒ Boolean
Returns whether this event is an 'emulated' pointer event.
Emulated pointer events typically originate from a touch events.
#ref ⇒ Gdk::Event
Increase the ref count of event.
#seat ⇒ Gdk::Seat
Returns the seat that originated the event.
#surface ⇒ Gdk::Surface
Extracts the surface associated with an event.
#time ⇒ Integer
Returns the timestamp of event.
Not all events have timestamps. In that case, this function returns %GDK_CURRENT_TIME.
#triggers_context_menu ⇒ Boolean
Returns whether a GdkEvent 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.
#unref ⇒ nil
Decrease the ref count of event.
If the last reference is dropped, the structure is freed.