Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GdkEvent

[17:7] extends: object

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 GdkEvent and its related API is rarely needed. GdkEvent structs are immutable.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • GdkEvent (Handle = null)

    Creates a new Event by wrapping a native handle or another wrapper.

    • @p Handle is the native handle or another wrapper whose handle to adopt.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • _get_angle (object event2)

    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.

    • @p event2 is second GdkEvent.
    • @p angle is return location for the relative angle between both events.
    • @r %TRUE if the angle could be calculated..
  • _get_center (object event2)

    Returns the point halfway between the events' positions. This assumes that both events have X/Y information. If not, this function returns %FALSE.

    • @p event2 is second GdkEvent.
    • @p x is return location for the X coordinate of the center.
    • @p y is return location for the Y coordinate of the center.
    • @r %TRUE if the center could be calculated..
  • _get_distance (object event2)

    Returns the distance between the event locations. This assumes that both events have X/Y information. If not, this function returns %FALSE.

    • @p event2 is second GdkEvent.
    • @p distance is return location for the distance.
    • @r %TRUE if the distance could be calculated..
  • get_axes ()

    Extracts all axis values from an event. To find out which axes are used, use [method@Gdk.DeviceTool.get_axes] on the device tool returned by [method@Gdk.Event.get_device_tool].

    • @p axes is the array of values for all axes.
    • @p n_axes is the length of array.
    • @r %TRUE on success, otherwise %FALSE.
  • get_axis (string axis_use)

    Extract the axis value for a particular axis use from an event structure. To find out which axes are used, use [method@Gdk.DeviceTool.get_axes] on the device tool returned by [method@Gdk.Event.get_device_tool].

    • @p axis_use is the axis use to look for.
    • @p value is location to store the value found.
    • @r %TRUE if the specified axis was found, otherwise %FALSE.
  • get_device ()

    Returns the device of an event.

    • @r a GdkDevice.
  • get_device_tool ()

    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 %NULL. Note: the GdkDeviceTool will be constant during the application lifetime, if settings must be stored persistently across runs, see [method@Gdk.DeviceTool.get_serial].

    • @r The current device tool.
  • get_display ()

    Retrieves the display associated to the @event.

    • @r a GdkDisplay.
  • 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.

    • @r the event sequence that the event belongs to.
  • get_event_type ()

    Retrieves the type of the event.

    • @r a GdkEventType.
  • 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.

    • @p out_n_coords is Return location for the length of the returned array.
    • @r an array of time and coordinates.
  • get_modifier_state ()

    Returns the modifier state field of an event.

    • @r 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.

    • @r %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.

    • @p x is location to put event surface x coordinate.
    • @p y is location to put event surface y coordinate.
    • @r whether the positions were set.
  • get_seat ()

    Returns the seat that originated the event.

    • @r a GdkSeat..
  • get_surface ()

    Extracts the surface associated with an event.

    • @r The GdkSurface 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.

    • @r timestamp field from @event.
  • ref ()

    Increase the ref count of @event.

    • @r @event.
  • triggers_context_menu ()

    Returns whether a GdkEvent 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 c event->button == GDK_BUTTON_SECONDARY

    • @r %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.

    • @r None.