Class Event

All Implemented Interfaces:
PointerInterface
Direct Known Subclasses:
ButtonEvent, CrossingEvent, DeleteEvent, DNDEvent, FocusEvent, GrabBrokenEvent, KeyEvent, MotionEvent, PadEvent, ProximityEvent, ScrollEvent, TouchEvent, TouchpadEvent

public class Event extends Pointer
`GdkEvent`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 `GdkEvent` and its related API is rarely needed.

https://docs.gtk.org/gdk4/class.Event.html

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getDevice

      public Device getDevice()
      Returns the device of an event.
      Returns:
      a `GdkDevice`
    • getDeviceTool

      public DeviceTool getDeviceTool()
      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].
      Returns:
      The current device tool
    • getDisplay

      public Display getDisplay()
      Retrieves the display associated to the @event.
      Returns:
      a `GdkDisplay`
    • getEventSequence

      public EventSequence getEventSequence()
      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.
      Returns:
      the event sequence that the event belongs to
    • getEventType

      public int getEventType()
      Retrieves the type of the event.
      Returns:
      a `GdkEvent`Type
    • getModifierState

      public int getModifierState()
      Returns the modifier state field of an event.
      Returns:
      the modifier state of @event
    • getPointerEmulated

      public boolean getPointerEmulated()
      Returns whether this event is an 'emulated' pointer event.

      Emulated pointer events typically originate from a touch events.
      Returns:
      %TRUE if this event is emulated
    • getSeat

      public Seat getSeat()
      Returns the seat that originated the event.
      Returns:
      a `GdkSeat`.
    • getSurface

      public Surface getSurface()
      Extracts the surface associated with an event.
      Returns:
      The `GdkSurface` associated with the event
    • getTime

      public int getTime()
      Returns the timestamp of @event.

      Not all events have timestamps. In that case, this function
      returns %GDK_CURRENT_TIME.
      Returns:
      timestamp field from @event
    • ref

      public Event ref()
      Increase the ref count of @event.
      Returns:
      @event
    • triggersContextMenu

      public boolean triggersContextMenu()
      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.
      Returns:
      %TRUE if the event should trigger a context menu.
    • unref

      public void unref()
      Decrease the ref count of @event.

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

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()