Home

GdkEvent

GdkEvent is a core data structure in the GDK (GIMP Drawing Kit) library used by GTK applications to represent a single event from the windowing system. It serves as a generic container for all kinds of input and window events that can occur while an application runs, such as keyboard input, mouse actions, and window changes. Each event type is identified by a type field, and the event-specific information is stored in a union of per-event structures.

Common event types include key presses and releases (GdkEventKey), button presses and releases (GdkEventButton), pointer motion

In GTK applications, event handlers receive a pointer to GdkEvent and typically use a switch on event->type

GdkEvent objects are owned by the GDK event system. They are valid for the duration of the

Platform coverage: GDK abstracts over X11, Wayland, and other backends, providing a unified event API to GTK

(GdkEventMotion),
scrolling
(GdkEventScroll),
window
configure
events
for
size
and
position
changes
(GdkEventConfigure),
enter/leave
and
focus
events,
expose
or
paint
requests
(GdkEventExpose),
and
client
or
window
state
notifications.
The
exact
fields
available
depend
on
the
event
type.
to
determine
how
to
process
the
event,
then
access
the
appropriate
fields
via
the
corresponding
event
structure
(for
example,
event->key
for
GdkEventKey,
event->button
for
GdkEventButton).
Many
events
are
dispatched
through
widget
signals
such
as
button-press-event
or
key-press-event,
but
low-level
handlers
may
observe
GdkEvent
pointers
directly.
callback
and
should
not
be
freed
by
the
application;
if
persistence
is
required,
data
should
be
copied
into
the
application’s
own
structures.
applications.