a #GdkEventAny
a #GdkEventButton
a #GdkEventConfigure
a #GdkEventCrossing
a #GdkEventDND
a #GdkEventExpose
a #GdkEventFocus
a #GdkEventGrabBroken
a #GdkEventKey
a #GdkEventMotion
a #GdkEventOwnerChange
a #GdkEventPadAxis
a #GdkEventPadButton
a #GdkEventPadGroupMode
a #GdkEventProperty
a #GdkEventProximity
a #GdkEventScroll
a #GdkEventSelection
a #GdkEventSetting
a #GdkEventTouch
a #GdkEventTouchpadPinch
a #GdkEventTouchpadSwipe
the #GdkEventType
a #GdkEventVisibility
a #GdkEventWindowState
Frees a #GdkEvent, freeing or decrementing any resources associated with it. Note that this function should only be called with events returned from functions such as gdk_event_peek(), gdk_event_get(), gdk_event_copy() and gdk_event_new().
If both events contain X/Y information, this function will return %TRUE
and return in angle
the relative angle from event1
to event2
. The rotation
direction for positive angles is from the positive X axis towards the positive
Y axis.
Extract the button number from an event.
Extracts the click count from an event.
Extract the event window relative x/y coordinates from an event.
If 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 returned.
Note: the #GdkDeviceTools will be constant during the application lifetime, if settings must be stored persistently across runs, see gdk_device_tool_get_serial()
If event
if of type %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
%GDK_TOUCH_END or %GDK_TOUCH_CANCEL, returns the #GdkEventSequence
to which the event belongs. Otherwise, return %NULL.
Extracts the hardware keycode from an event.
Also see gdk_event_get_scancode().
Extracts the keyval from an event.
#event: a #GdkEvent Returns whether this event is an 'emulated' pointer event (typically from a touch event), as opposed to a real one.
Extract the root window relative x/y coordinates from an event.
Gets the keyboard low-level scancode of a key event.
This is usually hardware_keycode. On Windows this is the high word of WM_KEY{DOWN,UP} lParam which contains the scancode and some extended flags.
Returns 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 -
that is, the screen which has the root window
to which event->motion.x_root
and
event->motion.y_root
are relative.
Retrieves the scroll deltas from a #GdkEvent
See also: gdk_event_get_scroll_direction()
Extracts the scroll direction from an event.
If event
is not of type %GDK_SCROLL, the contents of direction
are undefined.
If you wish to handle both discrete and smooth scrolling, you should check the return value of this function, or of gdk_event_get_scroll_deltas(); for instance:
GdkScrollDirection direction;
double vscroll_factor = 0.0;
double x_scroll, y_scroll;
if (gdk_event_get_scroll_direction (event, &direction))
{
// Handle discrete scrolling with a known constant delta;
const double delta = 12.0;
switch (direction)
{
case GDK_SCROLL_UP:
vscroll_factor = -delta;
break;
case GDK_SCROLL_DOWN:
vscroll_factor = delta;
break;
default:
// no scrolling
break;
}
}
else if (gdk_event_get_scroll_deltas (event, &x_scroll, &y_scroll))
{
// Handle smooth scrolling directly
vscroll_factor = y_scroll;
}
This function returns the hardware (slave) #GdkDevice that has triggered the event, falling back to the virtual (master) device (as in gdk_event_get_device()) if the event wasn’t caused by interaction with a hardware device. This may happen for example in synthesized crossing events after a #GdkWindow updates its geometry or a grab is acquired/released.
If the event does not contain a device field, this function will return %NULL.
If 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’s treated
as if the event had no state field.
Returns the time stamp from event,
if there is one; otherwise
returns #GDK_CURRENT_TIME. If event
is %NULL, returns #GDK_CURRENT_TIME.
Check 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 finger. This stop scroll event is the signal that a widget may trigger kinetic scrolling based on the current velocity.
Stop scroll events always have a a delta of 0/0.
Appends 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_put_event().
Sets the device tool for this event, should be rarely used.
tool to set on the event, or %NULL
This 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_get_modifier_mask() returns a non-0 mask for %GDK_MODIFIER_INTENT_CONTEXT_MENU, then the left mouse button will also trigger a context menu if this modifier is pressed.
This function should always be used instead of simply checking for event->button == %GDK_BUTTON_SECONDARY.
Sets the function to call to handle all events from GDK.
Note that GTK+ uses this to install its own event handler, so it is usually not useful for GTK+ applications. (Although an application can call this function then call gtk_main_do_event() to pass events to GTK+.)
Request more motion notifies if event
is a motion notify hint event.
This function should be used instead of gdk_window_get_pointer() to request further motion notifies, because it also works for extension events where motion notifies are provided for devices other than the core pointer. Coordinate extraction, processing and requesting more motion events from a %GDK_MOTION_NOTIFY event usually works like this:
{
// motion_event handler
x = motion_event->x;
y = motion_event->y;
// handle (x,y) motion
gdk_event_request_motions (motion_event); // handles is_hint events
}
a valid #GdkEvent
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:
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_BUTTON_PRESS then the x coordinate of the button press can be accessed with:
or: