Basics
Guides
API Reference
Basics
Guides
API Reference
[16: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.
Event (Handle = null)
Creates a new
Eventby wrapping a native handle or another wrapper.
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 exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.get_device ()
Returns the device of an event.
get_device_tool ()
Returns a
GdkDeviceToolrepresenting 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: theGdkDeviceToolwill be constant during the application lifetime, if settings must be stored persistently across runs, see [method@Gdk.DeviceTool.get_serial].
get_display ()
Retrieves the display associated to the @event.
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.
get_event_type ()
Retrieves the type of the event.
get_modifier_state ()
Returns the modifier state field of an event.
get_pointer_emulated ()
Returns whether this event is an 'emulated' pointer event. Emulated pointer events typically originate from a touch events.
get_seat ()
Returns the seat that originated the event.
get_surface ()
Extracts the surface associated with an event.
ref ()
Increase the ref count of @event.
triggers_context_menu ()
Returns whether a
GdkEventshould 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 forc event->button == GDK_BUTTON_SECONDARY
unref ()
Decrease the ref count of @event. If the last reference is dropped, the structure is freed.
None.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.