Top | ![]() |
![]() |
![]() |
![]() |
GdkEvent | |
enum | GdkEventType |
enum | GdkEventMask |
enum | GdkScrollDirection |
enum | GdkCrossingMode |
enum | GdkNotifyType |
#define | GDK_CURRENT_TIME |
#define | GDK_PRIORITY_EVENTS |
#define | GDK_PRIORITY_REDRAW |
#define | GDK_EVENT_PROPAGATE |
#define | GDK_EVENT_STOP |
#define | GDK_BUTTON_PRIMARY |
#define | GDK_BUTTON_MIDDLE |
#define | GDK_BUTTON_SECONDARY |
GdkEventSequence |
This section describes functions dealing with events from the window system.
In GTK+ applications the events are handled automatically by toplevel widgets and passed on to the appropriate widgets, so these functions are rarely needed.
GdkEvent *
gdk_event_new (GdkEventType type
);
Creates a new event of the given type. All fields are set to 0.
GdkEvent *
gdk_event_copy (const GdkEvent *event
);
Copies a GdkEvent, copying or incrementing the reference count of the resources associated with it (e.g. GdkSurface’s and strings).
gboolean gdk_event_get_axes (GdkEvent *event
,gdouble **axes
,guint *n_axes
);
Extracts all axis values from an event.
event |
a GdkEvent |
|
axes |
the array of values for all axes. |
[transfer none][out][array length=n_axes] |
n_axes |
the length of array. |
[out] |
gboolean gdk_event_get_axis (const GdkEvent *event
,GdkAxisUse axis_use
,gdouble *value
);
Extract the axis value for a particular axis use from an event structure.
event |
a GdkEvent |
|
axis_use |
the axis use to look for |
|
value |
location to store the value found. |
[out] |
gboolean gdk_event_get_button (const GdkEvent *event
,guint *button
);
Extract the button number from an event.
gboolean gdk_event_get_click_count (const GdkEvent *event
,guint *click_count
);
Extracts the click count from an event.
gboolean gdk_event_get_coords (const GdkEvent *event
,gdouble *x_win
,gdouble *y_win
);
Extract the event surface relative x/y coordinates from an event.
event |
a GdkEvent |
|
x_win |
location to put event surface x coordinate. |
[out][optional] |
y_win |
location to put event surface y coordinate. |
[out][optional] |
gboolean gdk_event_get_keycode (const GdkEvent *event
,guint16 *keycode
);
Extracts the hardware keycode from an event.
Also see gdk_event_get_scancode()
.
gboolean gdk_event_get_keyval (const GdkEvent *event
,guint *keyval
);
Extracts the keyval from an event.
gboolean gdk_event_get_scroll_direction (const GdkEvent *event
,GdkScrollDirection *direction
);
Extracts the scroll direction from an event.
gboolean gdk_event_get_scroll_deltas (const GdkEvent *event
,gdouble *delta_x
,gdouble *delta_y
);
Retrieves the scroll deltas from a GdkEvent
event |
a GdkEvent |
|
delta_x |
return location for X delta. |
[out] |
delta_y |
return location for Y delta. |
[out] |
gboolean
gdk_event_is_scroll_stop_event (const GdkEvent *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 delta of 0/0.
gboolean gdk_event_get_state (const GdkEvent *event
,GdkModifierType *state
);
If the event contains a “state” field, puts that field in state
.
Otherwise stores an empty state (0).
event
may be NULL
, in which case it’s treated
as if the event had no state field.
guint32
gdk_event_get_time (const GdkEvent *event
);
Returns the time stamp from event
, if there is one; otherwise
returns GDK_CURRENT_TIME. If event
is NULL
, returns GDK_CURRENT_TIME.
GdkSurface *
gdk_event_get_surface (const GdkEvent *event
);
Extracts the GdkSurface associated with an event.
GdkEventType
gdk_event_get_event_type (const GdkEvent *event
);
Retrieves the type of the event.
GdkEventSequence *
gdk_event_get_event_sequence (const GdkEvent *event
);
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
.
gboolean gdk_events_get_angle (GdkEvent *event1
,GdkEvent *event2
,gdouble *angle
);
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.
gboolean gdk_events_get_center (GdkEvent *event1
,GdkEvent *event2
,gdouble *x
,gdouble *y
);
If both events contain X/Y information, the center of both coordinates
will be returned in x
and y
.
gboolean gdk_events_get_distance (GdkEvent *event1
,GdkEvent *event2
,gdouble *distance
);
If both events have X/Y information, the distance between both coordinates
(as in a straight line going from event1
to event2
) will be returned.
gboolean
gdk_event_triggers_context_menu (const GdkEvent *event
);
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
.
GdkSeat *
gdk_event_get_seat (const GdkEvent *event
);
Returns the GdkSeat this event was generated for.
int
gdk_event_get_scancode (GdkEvent *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.
gboolean
gdk_event_get_pointer_emulated (GdkEvent *event
);
Returns whether this event is an 'emulated' pointer event (typically from a touch event), as opposed to a real one.
gboolean gdk_event_get_crossing_detail (const GdkEvent *event
,GdkNotifyType *detail
);
Extracts the crossing detail from an event.
gboolean gdk_event_get_crossing_mode (const GdkEvent *event
,GdkCrossingMode *mode
);
Extracts the crossing mode from an event.
GdkDrop *
gdk_event_get_drop (const GdkEvent *event
);
Gets the GdkDrop from a DND event.
gboolean gdk_event_get_focus_in (const GdkEvent *event
,gboolean *focus_in
);
Extracts whether this is a focus-in or focus-out event.
gboolean gdk_event_get_grab_surface (const GdkEvent *event
,GdkSurface **surface
);
Extracts the grab surface from a grab broken event.
GList *
gdk_event_get_motion_history (const GdkEvent *event
);
Retrieves the history of the event
motion, as a list of time and
coordinates.
gboolean gdk_event_get_key_group (const GdkEvent *event
,guint *group
);
Extracts the key group from an event.
gboolean gdk_event_get_key_is_modifier (const GdkEvent *event
,gboolean *is_modifier
);
Extracts whether the event is a key event for a modifier key.
gboolean gdk_event_get_pad_axis_value (const GdkEvent *event
,guint *index
,gdouble *value
);
Extracts the information from a pad event.
event |
a GdkEvent |
|
index |
Return location for the axis index. |
[out] |
value |
Return location for the axis value. |
[out] |
gboolean gdk_event_get_pad_button (const GdkEvent *event
,guint *button
);
Extracts information about the pressed button from a pad event.
gboolean gdk_event_get_pad_group_mode (const GdkEvent *event
,guint *group
,guint *mode
);
Extracts group and mode information from a pad event.
event |
a GdkEvent |
|
group |
return location for the group. |
[out] |
mode |
return location for the mode. |
[out] |
gboolean gdk_event_get_touch_emulating_pointer (const GdkEvent *event
,gboolean *emulating
);
Extracts whether a touch event is emulating a pointer event.
gboolean gdk_event_get_touchpad_angle_delta (const GdkEvent *event
,double *delta
);
Extracts the angle from a touchpad event.
gboolean gdk_event_get_touchpad_deltas (const GdkEvent *event
,double *dx
,double *dy
);
Extracts delta information from a touchpad event.
gboolean gdk_event_get_touchpad_gesture_n_fingers (const GdkEvent *event
,guint *n_fingers
);
Extracts the number of fingers from a touchpad event.
gboolean gdk_event_get_touchpad_gesture_phase (const GdkEvent *event
,GdkTouchpadGesturePhase *phase
);
Extracts the touchpad gesture phase from a touchpad event.
gboolean gdk_event_get_touchpad_scale (const GdkEvent *event
,double *scale
);
Extracts the scale from a touchpad event.
gboolean
gdk_event_is_sent (const GdkEvent *event
);
Returns whether the event was sent explicitly.
gboolean
gdk_get_show_events (void
);
Gets whether event debugging output is enabled.
void
gdk_set_show_events (gboolean show_events
);
Sets whether a trace of received events is output.
Note that GTK+ must be compiled with debugging (that is,
configured using the --enable-debug
option)
to use this option.
void gdk_event_set_display (GdkEvent *event
,GdkDisplay *display
);
Sets the display that an event is associated with.
GdkDisplay *
gdk_event_get_display (const GdkEvent *event
);
Retrieves the GdkDisplay associated to the event
.
GdkDevice *
gdk_event_get_device (const GdkEvent *event
);
If the event contains a “device” field, this function will return
it, else it will return NULL
.
void gdk_event_set_device (GdkEvent *event
,GdkDevice *device
);
Sets the device for event
to device
. The event must
have been allocated by GTK+, for instance, by
gdk_event_copy()
.
GdkDevice *
gdk_event_get_source_device (const GdkEvent *event
);
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 GdkSurface updates its
geometry or a grab is acquired/released.
If the event does not contain a device field, this function will
return NULL
.
void gdk_event_set_source_device (GdkEvent *event
,GdkDevice *device
);
Sets the slave device for event
to device
.
The event must have been allocated by GTK+,
for instance by gdk_event_copy()
.
GdkDeviceTool *
gdk_event_get_device_tool (const GdkEvent *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 GdkDeviceTool<!-- -->s will be constant during
the application lifetime, if settings must be stored
persistently across runs, see gdk_device_tool_get_serial()