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.
true if the angle could be calculated.
Copies a Gdk.Event, copying or incrementing the reference count of the resources associated with it (e.g. Gdk.Window’s and strings).
a copy of event. The returned Gdk.Event should be freed with gdk_event_free().
Frees a Gdk.Event, 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().
Extract the button number from an event.
true if the event delivered a button number
Extracts the click count from an event.
true if the event delivered a click count
Extract the event window relative x/y coordinates from an event.
true if the event delivered event window coordinates
If the event contains a “device” field, this function will return
it, else it will return null.
a Gdk.Device, or null.
If the event was generated by a device that supports
different tools (eg. a tablet), this function will
return a Gdk.DeviceTool representing the tool that
caused the event. Otherwise, null will be returned.
Note: the Gdk.DeviceTools will be constant during
the application lifetime, if settings must be stored
persistently across runs, see gdk_device_tool_get_serial()
The current device tool, or null
If event if of type Gdk.EventType.TOUCH_BEGIN, Gdk.EventType.TOUCH_UPDATE,
Gdk.EventType.TOUCH_END or Gdk.EventType.TOUCH_CANCEL, returns the Gdk.EventSequence
to which the event belongs. Otherwise, return null.
the event sequence that the event belongs to
Extracts the hardware keycode from an event.
Also see gdk_event_get_scancode().
true if the event delivered a hardware keycode
Extracts the keyval from an event.
true if the event delivered a key symbol
#event: a Gdk.Event Returns whether this event is an 'emulated' pointer event (typically from a touch event), as opposed to a real one.
true if this event is emulated
Extract the root window relative x/y coordinates from an event.
true if the event delivered root window coordinates
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.
The associated keyboard scancode or 0
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.
the screen for the event
Retrieves the scroll deltas from a Gdk.Event
See also: gdk_event_get_scroll_direction()
true if the event contains smooth scroll information and false otherwise
Extracts the scroll direction from an event.
If event is not of type Gdk.EventType.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;
}
true if the event delivered a scroll direction and false otherwise
This function returns the hardware (slave) Gdk.Device 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 Gdk.Window updates its
geometry or a grab is acquired/released.
If the event does not contain a device field, this function will
return null.
a Gdk.Device, or 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.
true if there was a state field in the event
Returns the time stamp from event, if there is one; otherwise
returns #GDK_CURRENT_TIME. If event is null, returns #GDK_CURRENT_TIME.
time stamp field from event
Extracts the Gdk.Window associated with an event.
The Gdk.Window associated with the event
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.
true if the event is a scroll stop event
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.
Optionaltool: Gdk.DeviceTooltool to set on the event, or null
This function returns whether a Gdk.EventButton 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.ModifierIntent.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.
true if the event should trigger a context menu.
StaticgetStatichandler_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+.)
the function to call to handle events from GDK.
StaticnewStaticpeekStaticrequest_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.EventType.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 Gdk.Event
A Gdk.Event 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.EventType.BUTTON_PRESS then the x coordinate of the button press can be accessed with:
or: