gdk.event

Module for [Event] class

class Event

Types 1

A #GdkEvent 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.types.EventType.ButtonPress 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;

Methods
void * _cPtr(Flag!"Dup" dup = No.Dup) nothrow
GType _getGType() static nothrow
GType _gType() @property nothrow
Event self() nothrowReturns `this`, for use in `with` statements.
gdk.types.EventType type() @property nothrowGet `type` field. Returns: the #GdkEventType
void type(gdk.types.EventType propval) @property nothrowSet `type` field. Params: propval = the #GdkEventType
gdk.event_any.EventAny any() @property nothrowGet `any` field. Returns: a #GdkEventAny
gdk.event_expose.EventExpose expose() @property nothrowGet `expose` field. Returns: a #GdkEventExpose
gdk.event_visibility.EventVisibility visibility() @property nothrowGet `visibility` field. Returns: a #GdkEventVisibility
gdk.event_motion.EventMotion motion() @property nothrowGet `motion` field. Returns: a #GdkEventMotion
gdk.event_button.EventButton button() @property nothrowGet `button` field. Returns: a #GdkEventButton
gdk.event_touch.EventTouch touch() @property nothrowGet `touch` field. Returns: a #GdkEventTouch
gdk.event_scroll.EventScroll scroll() @property nothrowGet `scroll` field. Returns: a #GdkEventScroll
gdk.event_key.EventKey key() @property nothrowGet `key` field. Returns: a #GdkEventKey
gdk.event_crossing.EventCrossing crossing() @property nothrowGet `crossing` field. Returns: a #GdkEventCrossing
gdk.event_focus.EventFocus focusChange() @property nothrowGet `focusChange` field. Returns: a #GdkEventFocus
gdk.event_configure.EventConfigure configure() @property nothrowGet `configure` field. Returns: a #GdkEventConfigure
gdk.event_property.EventProperty property() @property nothrowGet `property` field. Returns: a #GdkEventProperty
gdk.event_selection.EventSelection selection() @property nothrowGet `selection` field. Returns: a #GdkEventSelection
gdk.event_owner_change.EventOwnerChange ownerChange() @property nothrowGet `ownerChange` field. Returns: a #GdkEventOwnerChange
gdk.event_proximity.EventProximity proximity() @property nothrowGet `proximity` field. Returns: a #GdkEventProximity
gdk.event_dnd.EventDND dnd() @property nothrowGet `dnd` field. Returns: a #GdkEventDND
gdk.event_window_state.EventWindowState windowState() @property nothrowGet `windowState` field. Returns: a #GdkEventWindowState
gdk.event_setting.EventSetting setting() @property nothrowGet `setting` field. Returns: a #GdkEventSetting
gdk.event_grab_broken.EventGrabBroken grabBroken() @property nothrowGet `grabBroken` field. Returns: a #GdkEventGrabBroken
gdk.event_touchpad_swipe.EventTouchpadSwipe touchpadSwipe() @property nothrowGet `touchpadSwipe` field. Returns: a #GdkEventTouchpadSwipe
gdk.event_touchpad_pinch.EventTouchpadPinch touchpadPinch() @property nothrowGet `touchpadPinch` field. Returns: a #GdkEventTouchpadPinch
gdk.event_pad_button.EventPadButton padButton() @property nothrowGet `padButton` field. Returns: a #GdkEventPadButton
gdk.event_pad_axis.EventPadAxis padAxis() @property nothrowGet `padAxis` field. Returns: a #GdkEventPadAxis
gdk.event_pad_group_mode.EventPadGroupMode padGroupMode() @property nothrowGet `padGroupMode` field. Returns: a #GdkEventPadGroupMode
gdk.event.Event copy() nothrowCopies a #GdkEvent, copying or incrementing the reference count of the resources associated with it (e.g. #GdkWindow’s and strings). Returns: a copy of event. The returned #GdkEvent should be fre...
bool getAxis(gdk.types.AxisUse axisUse, out double value) nothrowExtract the axis value for a particular axis use from an event structure.
bool getButton(out uint button) nothrowExtract the button number from an event.
bool getClickCount(out uint clickCount) nothrowExtracts the click count from an event.
bool getCoords(out double xWin, out double yWin) nothrowExtract the event window relative x/y coordinates from an event.
gdk.device.Device getDevice() nothrowIf the event contains a “device” field, this function will return it, else it will return null. Returns: a #GdkDevice, or null.
gdk.device_tool.DeviceTool getDeviceTool() nothrowIf the event was generated by a device that supports different tools (eg. a tablet), this function will return a #GdkDeviceTool representing the tool that caused the event. Otherwise, null will be ...
gdk.event_sequence.EventSequence getEventSequence() nothrowIf event if of type [gdk.types.EventType.TouchBegin], [gdk.types.EventType.TouchUpdate], [gdk.types.EventType.TouchEnd] or [gdk.types.EventType.TouchCancel], returns the #GdkEventSequence to which ...
gdk.types.EventType getEventType() nothrowRetrieves the type of the event. Returns: a #GdkEventType
bool getKeycode(out ushort keycode) nothrowExtracts the hardware keycode from an event.
bool getKeyval(out uint keyval) nothrowExtracts the keyval from an event.
bool getPointerEmulated() nothrow#event: a #GdkEvent Returns whether this event is an 'emulated' pointer event (typically from a touch event), as opposed to a real one. Returns: true if this event is emulated
bool getRootCoords(out double xRoot, out double yRoot) nothrowExtract the root window relative x/y coordinates from an event.
int getScancode() nothrowGets the keyboard low-level scancode of a key event.
gdk.screen.Screen getScreen() nothrowReturns the screen for the event. The screen is typically the screen for `event->any.window`, but for events such as mouse events, it is the screen where the pointer was when the event occurs - tha...
bool getScrollDeltas(out double deltaX, out double deltaY) nothrowRetrieves the scroll deltas from a #GdkEvent
bool getScrollDirection(out gdk.types.ScrollDirection direction) nothrowExtracts the scroll direction from an event.
gdk.seat.Seat getSeat() nothrowReturns the #GdkSeat this event was generated for. Returns: The #GdkSeat of this event
gdk.device.Device getSourceDevice() nothrowThis function returns the hardware (slave) #GdkDevice that has triggered the event, falling back to the virtual (master) device (as in [gdk.event.Event.getDevice]) if the event wasn’t caused by i...
bool getState(out gdk.types.ModifierType state) nothrowIf the event contains a “state” field, puts that field in state. Otherwise stores an empty state (0). Returns true if there was a state field in the event. event may be null, in which case it...
uint getTime() nothrowReturns the time stamp from event, if there is one; otherwise returns #GDK_CURRENT_TIME. If event is null, returns #GDK_CURRENT_TIME. Returns: time stamp field from event
gdk.window.Window getWindow() nothrowExtracts the #GdkWindow associated with an event. Returns: The #GdkWindow associated with the event
bool isScrollStopEvent() nothrowCheck whether a scroll event is a stop scroll event. Scroll sequences with smooth scroll information may provide a stop scroll event once the interaction with the device finishes, e.g. by lifting a...
void put() nothrowAppends a copy of the given event onto the front of the event queue for event->any.window’s display, or the default event queue if event->any.window is null. See [gdk.display.Display.putEvent].
void setDevice(gdk.device.Device device) nothrowSets the device for event to device. The event must have been allocated by GTK+, for instance, by [gdk.event.Event.copy].
void setDeviceTool(gdk.device_tool.DeviceTool tool = null) nothrowSets the device tool for this event, should be rarely used.
void setScreen(gdk.screen.Screen screen) nothrowSets the screen for event to screen. The event must have been allocated by GTK+, for instance, by [gdk.event.Event.copy].
void setSourceDevice(gdk.device.Device device) nothrowSets the slave device for event to device.
bool triggersContextMenu() nothrowThis function returns whether a #GdkEventButton should trigger a context menu, according to platform conventions. The right mouse button always triggers context menus. Additionally, if [gdk.keymap....
gdk.event.Event get() static nothrowChecks all open displays for a #GdkEvent to process,to be processed on, fetching events from the windowing system if necessary. See [gdk.display.Display.getEvent]. Returns: the next #GdkEvent to be...
void handlerSet(gdk.types.EventFunc func) static nothrowSets the function to call to handle all events from GDK.
gdk.event.Event peek() static nothrowIf there is an event waiting in the event queue of some open display, returns a copy of it. See [gdk.display.Display.peekEvent]. Returns: a copy of the first #GdkEvent on some event queue, or null ...
void requestMotions(gdk.event_motion.EventMotion event) static nothrowRequest more motion notifies if event is a motion notify hint event.
Constructors
this(void * ptr, Flag!"Take" take)
this(gdk.types.EventType type)Creates a new event of the given type. All fields are set to 0.