Event
Object Hierarchy:
Gdk.Event
Gdk.Event
Gdk.Event
Description:
[ CCode ( copy_function = "g_boxed_copy" , free_function = "g_boxed_free" , type_id = "gdk_event_get_type ()" ) ] [ Compact ]public class Event
A Event contains a union of all of the event types, and allows access to the data fields in a number of ways.
The event type is always the first field in all of the event types, and can always be accessed with the following code, no matter what type of
event it is:
GdkEvent *event; GdkEventType type; type = event->type;
To access other fields of the event, the pointer to the event can be cast to the appropriate event type, or the union member name can be used.
For example if the event type is gdk_button_press then the x coordinate of the button press can be accessed
with:
GdkEvent *event; gdouble x; x = ((GdkEventButton*)event)->x;
or:
GdkEvent *event; gdouble x; x = event->button.x;
Content:
Properties:
Static methods:
Creation methods:
Methods:
public Event copy ()
Copies a Event , copying or incrementing the
reference count of the resources associated with it (e.
public void free ()
Frees a Event , freeing or decrementing any
resources associated with it.
public bool get_axis (AxisUse axis_use, out double value)
Extract the axis value for a particular axis use from an event structure.
public bool get_button (out uint button)
Extract the button number from an event.
public bool get_click_count (out uint click_count)
Extracts the click count from an event.
public bool get_coords (out double x_win, out double y_win)
Extract the event window relative x/y coordinates from an event.
public unowned Device ? get_device ()
If the event contains a “device” field, this function will return it,
else it will return null .
public unowned DeviceTool get_device_tool ()
If the event was generated by a device that supports different tools (eg.
public unowned EventSequence get_event_sequence ()
If this if of type
gdk_touch_begin , gdk_touch_update ,
gdk_touch_end or gdk_touch_cancel , returns the
EventSequence to which the event belongs.
public EventType get_event_type ()
Retrieves the type of the event.
public bool get_keycode (out uint16 keycode)
Extracts the hardware keycode from an event.
public bool get_keyval (out uint keyval)
Extracts the keyval from an event.
public bool get_pointer_emulated ()
event
: a Event Returns whether this
event is an 'emulated' pointer event (typically from a touch event), as opposed to a real one.
public bool get_root_coords (out double x_root, out double y_root)
Extract the root window relative x/y coordinates from an event.
public int get_scancode ()
Gets the keyboard low-level scancode of a key event.
public unowned Screen get_screen ()
Returns the screen for the event.
public bool get_scroll_deltas (out double delta_x, out double delta_y)
Retrieves the scroll deltas from a Event
public bool get_scroll_direction (out ScrollDirection direction)
Extracts the scroll direction from an event.
public unowned Seat get_seat ()
Returns the Seat
this event was generated for.
public unowned Device ? get_source_device ()
This function returns the hardware (slave)
Device that has triggered the event, falling back to the virtual (master)
device (as in get_device ) if the event wasn’t caused by interaction with a
hardware device.
public bool get_state (out ModifierType state)
If the event contains a “state” field, puts that field in state
.
public uint32 get_time ()
Returns the time stamp from this , if there
is one; otherwise returns CURRENT_TIME .
public unowned Window get_window ()
Extracts the Window
associated with an event.
public bool is_scroll_stop_event ()
Check whether a scroll event is a stop scroll event.
public void put ()
Appends a copy of the given event onto the front of the event queue for
event->any.
public void set_device (Device device)
Sets the device for this to device
.
public void set_device_tool (DeviceTool ? tool)
Sets the device tool for this event, should be rarely used.
public void set_screen (Screen screen)
Sets the screen for this to screen
.
public void set_source_device (Device device)
Sets the slave device for this to
device
.
public bool triggers_context_menu ()
This function returns whether a
EventButton should trigger a context menu, according to platform conventions.
Fields: