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 event controllers of appropriate widgets, so these functions are rarely needed.
void
gdk_event_unref (GdkEvent *event
);
Decrease the ref count of event
, and free it
if the last reference is dropped.
GdkEventType
gdk_event_get_event_type (GdkEvent *event
);
Retrieves the type of the event.
GdkSurface *
gdk_event_get_surface (GdkEvent *event
);
Extracts the GdkSurface associated with an event.
GdkDevice *
gdk_event_get_device (GdkEvent *event
);
Returns the device of an event.
GdkDevice *
gdk_event_get_source_device (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
.
GdkDeviceTool *
gdk_event_get_device_tool (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 GdkDeviceTools will be constant during
the application lifetime, if settings must be stored
persistently across runs, see gdk_device_tool_get_serial()
guint32
gdk_event_get_time (GdkEvent *event
);
Returns the time stamp from event
, if there is one; otherwise
returns GDK_CURRENT_TIME.
GdkDisplay *
gdk_event_get_display (GdkEvent *event
);
Retrieves the GdkDisplay associated to the event
.
GdkEventSequence *
gdk_event_get_event_sequence (GdkEvent *event
);
If event
is a touch event, returns the GdkEventSequence
to which the event belongs. Otherwise, return NULL
.
GdkModifierType
gdk_event_get_modifier_state (GdkEvent *event
);
Returns the modifier state field of an event.
gboolean gdk_event_get_position (GdkEvent *event
,double *x
,double *y
);
Extract the event surface relative x/y coordinates from an event.
event |
a GdkEvent |
|
x |
location to put event surface x coordinate. |
[out] |
y |
location to put event surface y coordinate. |
[out] |
gboolean gdk_event_get_axes (GdkEvent *event
,double **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 (GdkEvent *event
,GdkAxisUse axis_use
,double *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_pointer_emulated (GdkEvent *event
);
Returns whether this event is an 'emulated' pointer event (typically from a touch event), as opposed to a real one.
guint
gdk_button_event_get_button (GdkEvent *event
);
Extract the button number from a button event.
GdkScrollDirection
gdk_scroll_event_get_direction (GdkEvent *event
);
Extracts the direction of a scroll event.
void gdk_scroll_event_get_deltas (GdkEvent *event
,double *delta_x
,double *delta_y
);
Extracts the scroll deltas of a scroll event.
The deltas will be zero unless the scroll direction
is GDK_SCROLL_SMOOTH
.
gboolean
gdk_scroll_event_is_stop (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.
guint
gdk_key_event_get_keyval (GdkEvent *event
);
Extracts the keyval from a key event.
guint
gdk_key_event_get_keycode (GdkEvent *event
);
Extracts the keycode from a key event.
guint
gdk_key_event_get_scancode (GdkEvent *event
);
Extracts the scancode from a key event.
guint
gdk_key_event_get_group (GdkEvent *event
);
Extracts the group from a key event.
gboolean
gdk_key_event_is_modifier (GdkEvent *event
);
Extracts whether the key event is for a modifier key.
gboolean
gdk_focus_event_get_in (GdkEvent *event
);
Extracts whether this event is about focus entering or leaving the surface.
gboolean
gdk_touch_event_get_emulating_pointer (GdkEvent *event
);
Extracts whether a touch event is emulating a pointer event.
GdkCrossingMode
gdk_crossing_event_get_mode (GdkEvent *event
);
Extracts the crossing mode from a crossing event.
GdkNotifyType
gdk_crossing_event_get_detail (GdkEvent *event
);
Extracts the notify detail from a crossing event.
void gdk_configure_event_get_size (GdkEvent *event
,int *width
,int *height
);
Extracts the surface size from a configure event.
GdkTouchpadGesturePhase
gdk_touchpad_event_get_gesture_phase (GdkEvent *event
);
Extracts the touchpad gesture phase from a touchpad event.
guint
gdk_touchpad_event_get_n_fingers (GdkEvent *event
);
Extracts the number of fingers from a touchpad event.
void gdk_touchpad_event_get_deltas (GdkEvent *event
,double *dx
,double *dy
);
Extracts delta information from a touchpad event.
double
gdk_touchpad_pinch_event_get_angle_delta
(GdkEvent *event
);
Extracts the angle delta from a touchpad pinch event.
double
gdk_touchpad_pinch_event_get_scale (GdkEvent *event
);
Extracts the scale from a touchpad pinch event.
guint
gdk_pad_button_event_get_button (GdkEvent *event
);
Extracts information about the pressed button from a pad event.
void gdk_pad_axis_event_get_value (GdkEvent *event
,guint *index
,double *value
);
Extracts the information from a pad strip or ring event.
void gdk_pad_event_get_group_mode (GdkEvent *event
,guint *group
,guint *mode
);
Extracts group and mode information from a pad event.
GdkDrop *
gdk_drag_event_get_drop (GdkEvent *event
);
Gets the GdkDrop from a DND event.
GdkSurface *
gdk_grab_broken_event_get_grab_surface
(GdkEvent *event
);
Extracts the grab surface from a grab broken event.
GList *
gdk_event_get_motion_history (GdkEvent *event
);
Retrieves the history of the event
motion, as a list of time and
coordinates.
gboolean gdk_events_get_angle (GdkEvent *event1
,GdkEvent *event2
,double *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
,double *x
,double *y
);
If both events contain X/Y information, the center of both coordinates
will be returned in x
and y
.