## Events Events — Functions for handling events from the window system |

## Functions

GdkEvent * | gdk_event_new ()
GdkEvent * | gdk_event_copy ()
gboolean | gdk_event_get_axes ()
gboolean | gdk_event_get_button ()
gboolean | gdk_event_get_click_count ()
gboolean | gdk_event_get_coords ()
gboolean | gdk_event_get_keycode ()
gboolean | gdk_event_get_keyval ()
gboolean | gdk_event_get_root_coords ()
gboolean | gdk_event_get_scroll_direction ()
gboolean | gdk_event_get_scroll_deltas ()
gboolean | gdk_event_is_scroll_stop_event ()
gboolean | gdk_event_get_state ()
guint32 | gdk_event_get_time ()
GdkSurface * | gdk_event_get_surface ()
GdkEventType | gdk_event_get_event_type ()
GdkEventSequence * | gdk_event_get_event_sequence ()
gboolean | gdk_events_get_angle ()
gboolean | gdk_events_get_center ()
gboolean | gdk_events_get_distance ()
gboolean | gdk_event_triggers_context_menu ()
GdkSeat * | gdk_event_get_seat ()
int | gdk_event_get_scancode ()
gboolean | gdk_event_get_pointer_emulated ()
gboolean | gdk_event_get_crossing_detail ()
gboolean | gdk_event_get_crossing_mode ()
GdkDrop * | gdk_event_get_drop ()
gboolean | gdk_event_get_focus_in ()
gboolean | gdk_event_get_grab_surface ()
GList * | gdk_event_get_motion_history ()
gboolean | gdk_event_get_key_group ()
gboolean | gdk_event_get_key_is_modifier ()
gboolean | gdk_event_get_pad_axis_value ()
gboolean | gdk_event_get_pad_button ()
gboolean | gdk_event_get_pad_group_mode ()
gboolean | gdk_event_get_string ()
gboolean | gdk_event_get_touch_emulating_pointer ()
gboolean | gdk_event_get_touchpad_angle_delta ()
gboolean | gdk_event_get_touchpad_deltas ()
gboolean | gdk_event_get_touchpad_gesture_n_fingers ()
gboolean | gdk_event_get_touchpad_gesture_phase ()
gboolean | gdk_event_get_touchpad_scale ()
gboolean | gdk_event_is_sent ()
void | gdk_event_handler_set ()
void | (*GdkEventFunc) ()
gboolean | gdk_get_show_events ()
void | gdk_set_show_events ()
void | gdk_event_set_display ()
GdkDisplay * | gdk_event_get_display ()
GdkDevice * | gdk_event_get_device ()
void | gdk_event_set_device ()
GdkDevice * | gdk_event_get_source_device ()
void | gdk_event_set_source_device ()
GdkDeviceTool * | gdk_event_get_device_tool ()
void | gdk_event_set_device_tool ()

## Properties

GdkEventType | event-type | Read / Write / Construct Only

## Types and Values

| 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

## Object Hierarchy

        GObject
        ╰── GdkEvent

## Includes

    #include <gdk/gdk.h>

## Description

This section describes functions dealing with events from the window system.

In GTK+ applications the events are handled automatically in `gtk_main_do_event()` and passed on to the appropriate widgets, so these functions are rarely needed.

## Functions

### gdk_event_new ()

    GdkEvent *
    gdk_event_new (GdkEventType type);

Creates a new event of the given type. All fields are set to 0.

#### Parameters

type | a GdkEventType |

#### Returns

a newly-allocated GdkEvent. Free with `g_object_unref()`

### gdk_event_copy ()

    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).

#### Parameters

event | a GdkEvent |

#### Returns

a copy of `event` . Free with `g_object_unref()`.

[transfer full]

### gdk_event_get_axes ()

    gboolean
    gdk_event_get_axes (GdkEvent *event,
                        gdouble **axes,
                        guint *n_axes);

Extracts all axis values from an event.

#### Parameters

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]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_button ()

    gboolean
    gdk_event_get_button (const GdkEvent *event,
                          guint *button);

Extract the button number from an event.

#### Parameters

event | a GdkEvent |
button | location to store mouse button number. | [out]

#### Returns

`TRUE` if the event delivered a button number

### gdk_event_get_click_count ()

    gboolean
    gdk_event_get_click_count (const GdkEvent *event,
                               guint *click_count);

Extracts the click count from an event.

#### Parameters

event | a GdkEvent |
click_count | location to store click count. | [out]

#### Returns

`TRUE` if the event delivered a click count

### gdk_event_get_coords ()

    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.

#### Parameters

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]

#### Returns

`TRUE` if the event delivered event surface coordinates

### gdk_event_get_keycode ()

    gboolean
    gdk_event_get_keycode (const GdkEvent *event,
                           guint16 *keycode);

Extracts the hardware keycode from an event.

Also see `gdk_event_get_scancode()`.

#### Parameters

event | a GdkEvent |
keycode | location to store the keycode. | [out]

#### Returns

`TRUE` if the event delivered a hardware keycode

### gdk_event_get_keyval ()

    gboolean
    gdk_event_get_keyval (const GdkEvent *event,
                          guint *keyval);

Extracts the keyval from an event.

#### Parameters

event | a GdkEvent |
keyval | location to store the keyval. | [out]

#### Returns

`TRUE` if the event delivered a key symbol

### gdk_event_get_root_coords ()

    gboolean
    gdk_event_get_root_coords (const GdkEvent *event,
                               gdouble *x_root,
                               gdouble *y_root);

Extract the root window relative x/y coordinates from an event.

#### Parameters

event | a GdkEvent |
x_root | location to put root window x coordinate. | [out][optional]
y_root | location to put root window y coordinate. | [out][optional]

#### Returns

`TRUE` if the event delivered root window coordinates

### gdk_event_get_scroll_direction ()

    gboolean
    gdk_event_get_scroll_direction (const GdkEvent *event,
                                    GdkScrollDirection *direction);

Extracts the scroll direction from an event.

#### Parameters

event | a GdkEvent |
direction | location to store the scroll direction. | [out]

#### Returns

`TRUE` if the event delivered a scroll direction

### gdk_event_get_scroll_deltas ()

    gboolean
    gdk_event_get_scroll_deltas (const GdkEvent *event,
                                 gdouble *delta_x,
                                 gdouble *delta_y);

Retrieves the scroll deltas from a GdkEvent

#### Parameters

event | a GdkEvent |
delta_x | return location for X delta. | [out]
delta_y | return location for Y delta. | [out]

#### Returns

`TRUE` if the event contains smooth scroll information

### gdk_event_is_scroll_stop_event ()

    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 a delta of 0/0.

#### Parameters

event | a GdkEvent |

#### Returns

`TRUE` if the event is a scroll stop event

### gdk_event_get_state ()

    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.

#### Parameters

event | a GdkEvent or `NULL`. | [allow-none]
state | return location for state. | [out]

#### Returns

`TRUE` if there was a state field in the event

### gdk_event_get_time ()

    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.

#### Parameters

event | a GdkEvent |

#### Returns

time stamp field from `event`

### gdk_event_get_surface ()

    GdkSurface *
    gdk_event_get_surface (const GdkEvent *event);

Extracts the GdkSurface associated with an event.

#### Parameters

event | a GdkEvent |

#### Returns

The GdkSurface associated with the event.

[transfer none]

### gdk_event_get_event_type ()

    GdkEventType
    gdk_event_get_event_type (const GdkEvent *event);

Retrieves the type of the event.

#### Parameters

event | a GdkEvent |

#### Returns

a GdkEventType

### gdk_event_get_event_sequence ()

    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`.

#### Parameters

event | a GdkEvent |

#### Returns

the event sequence that the event belongs to.

[transfer none]

### gdk_events_get_angle ()

    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.

#### Parameters

event1 | first GdkEvent |
event2 | second GdkEvent |
angle | return location for the relative angle between both events. | [out]

#### Returns

`TRUE` if the angle could be calculated.

### gdk_events_get_center ()

    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` .

#### Parameters

event1 | first GdkEvent |
event2 | second GdkEvent |
x | return location for the X coordinate of the center. | [out]
y | return location for the Y coordinate of the center. | [out]

#### Returns

`TRUE` if the center could be calculated.

### gdk_events_get_distance ()

    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.

#### Parameters

event1 | first GdkEvent |
event2 | second GdkEvent |
distance | return location for the distance. | [out]

#### Returns

`TRUE` if the distance could be calculated.

### gdk_event_triggers_context_menu ()

    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`.

#### Parameters

event | a GdkEvent, currently only button events are meaningful values |

#### Returns

`TRUE` if the event should trigger a context menu.

### gdk_event_get_seat ()

    GdkSeat *
    gdk_event_get_seat (const GdkEvent *event);

Returns the GdkSeat this event was generated for.

#### Parameters

event | a GdkEvent |

#### Returns

The GdkSeat of this event.

[transfer none]

### gdk_event_get_scancode ()

    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.

#### Parameters

event | a GdkEvent |

#### Returns

The associated keyboard scancode or 0

### gdk_event_get_pointer_emulated ()

    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.

#### Parameters

event | a GdkEvent |

#### Returns

`TRUE` if this event is emulated

### gdk_event_get_crossing_detail ()

    gboolean
    gdk_event_get_crossing_detail (const GdkEvent *event,
                                   GdkNotifyType *detail);

Extracts the crossing detail from an event.

#### Parameters

event | a GdkEvent |
detail | return location for the crossing detail. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_crossing_mode ()

    gboolean
    gdk_event_get_crossing_mode (const GdkEvent *event,
                                 GdkCrossingMode *mode);

Extracts the crossing mode from an event.

#### Parameters

event | a GdkEvent |
mode | return location for the crossing mode. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_drop ()

    GdkDrop *
    gdk_event_get_drop (const GdkEvent *event);

Gets the GdkDrop from a DND event.

#### Parameters

event | a GdkEvent |

#### Returns

the drop.

[transfer none][nullable]

### gdk_event_get_focus_in ()

    gboolean
    gdk_event_get_focus_in (const GdkEvent *event,
                            gboolean *focus_in);

Extracts whether this is a focus-in or focus-out event.

#### Parameters

event | a GdkEvent |
focus_in | return location for focus direction. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_grab_surface ()

    gboolean
    gdk_event_get_grab_surface (const GdkEvent *event,
                                GdkSurface **surface);

Extracts the grab surface from a grab broken event.

#### Parameters

event | a GdkEvent |
surface | Return location for the grab surface. | [out][transfer none]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_motion_history ()

    GList *
    gdk_event_get_motion_history (const GdkEvent *event);

Retrieves the history of the `event` motion, as a list of time and coordinates.

#### Parameters

event | a GdkEvent of type `GDK_MOTION_NOTIFY` |

#### Returns

a list of time and coordinates.

[transfer container][element-type GdkTimeCoord][nullable]

### gdk_event_get_key_group ()

    gboolean
    gdk_event_get_key_group (const GdkEvent *event,
                             guint *group);

Extracts the key group from an event.

#### Parameters

event | a GdkEvent |
group | return location for the key group. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_key_is_modifier ()

    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.

#### Parameters

event | a GdkEvent |
is_modifier | return location for the value. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_pad_axis_value ()

    gboolean
    gdk_event_get_pad_axis_value (const GdkEvent *event,
                                  guint *index,
                                  gdouble *value);

Extracts the information from a pad event.

#### Parameters

event | a GdkEvent |
index | Return location for the axis index. | [out]
value | Return location for the axis value. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_pad_button ()

    gboolean
    gdk_event_get_pad_button (const GdkEvent *event,
                              guint *button);

Extracts information about the pressed button from a pad event.

#### Parameters

event | a GdkEvent |
button | Return location for the button. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_pad_group_mode ()

    gboolean
    gdk_event_get_pad_group_mode (const GdkEvent *event,
                                  guint *group,
                                  guint *mode);

Extracts group and mode information from a pad event.

#### Parameters

event | a GdkEvent |
group | return location for the group. | [out]
mode | return location for the mode. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_string ()

    gboolean
    gdk_event_get_string (const GdkEvent *event,
                          const char **string);

Extracts a string from an event. The string is an approximation of the keyval in a key event.

#### Parameters

event | a GdkEvent |
string | return location for the string. | [out][transfer none]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_touch_emulating_pointer ()

    gboolean
    gdk_event_get_touch_emulating_pointer (const GdkEvent *event,
                                           gboolean *emulating);

Extracts whether a touch event is emulating a pointer event.

#### Parameters

event | a GdkEvent |
emulating | Return location for information. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_touchpad_angle_delta ()

    gboolean
    gdk_event_get_touchpad_angle_delta (const GdkEvent *event,
                                        double *delta);

Extracts the angle from a touchpad event.

#### Parameters

event | a GdkEvent |
delta | Return location for angle. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_touchpad_deltas ()

    gboolean
    gdk_event_get_touchpad_deltas (const GdkEvent *event,
                                   double *dx,
                                   double *dy);

Extracts delta information from a touchpad event.

#### Parameters

event | a GdkEvent |
dx | return location for x. | [out]
dy | return location for y. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_touchpad_gesture_n_fingers ()

    gboolean
    gdk_event_get_touchpad_gesture_n_fingers
                                   (const GdkEvent *event,
                                    guint *n_fingers);

Extracts the number of fingers from a touchpad event.

#### Parameters

event | a GdkEvent |
n_fingers | return location for the number of fingers. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_touchpad_gesture_phase ()

    gboolean
    gdk_event_get_touchpad_gesture_phase (const GdkEvent *event,
                                          GdkTouchpadGesturePhase *phase);

Extracts the touchpad gesture phase from a touchpad event.

#### Parameters

event | a GdkEvent |
phase | Return location for the gesture phase. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_get_touchpad_scale ()

    gboolean
    gdk_event_get_touchpad_scale (const GdkEvent *event,
                                  double *scale);

Extracts the scale from a touchpad event.

#### Parameters

event | a GdkEvent |
scale | Return location for scale. | [out]

#### Returns

`TRUE` on success, otherwise `FALSE`

### gdk_event_is_sent ()

    gboolean
    gdk_event_is_sent (const GdkEvent *event);

Returns whether the event was sent explicitly.

#### Parameters

event | a GdkEvent |

#### Returns

`TRUE` if the event was sent explicitly

### gdk_event_handler_set ()

    void
    gdk_event_handler_set (GdkEventFunc func,
                           gpointer data,
                           GDestroyNotify notify);

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+.)

#### Parameters

func | the function to call to handle events from GDK. |
data | user data to pass to the function. |
notify | the function to call when the handler function is removed, i.e. when `gdk_event_handler_set()` is called with another event handler. |

### GdkEventFunc ()

    void
    (*GdkEventFunc) (GdkEvent *event,
                     gpointer data);

Specifies the type of function passed to `gdk_event_handler_set()` to handle all GDK events.

#### Parameters

event | the GdkEvent to process. |
data | user data set when the event handler was installed with `gdk_event_handler_set()`. | [closure]

### gdk_get_show_events ()

    gboolean
    gdk_get_show_events (void);

Gets whether event debugging output is enabled.

#### Returns

`TRUE` if event debugging output is enabled.

### gdk_set_show_events ()

    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.

#### Parameters

show_events | `TRUE` to output event debugging information. |

### gdk_event_set_display ()

    void
    gdk_event_set_display (GdkEvent *event,
                           GdkDisplay *display);

Sets the display that an event is associated with.

#### Parameters

event | a GdkEvent |
display | a GdkDisplay |

### gdk_event_get_display ()

    GdkDisplay *
    gdk_event_get_display (const GdkEvent *event);

Retrieves the GdkDisplay associated to the `event` .

#### Parameters

event | a GdkEvent |

#### Returns

a GdkDisplay.

[transfer none][nullable]

### gdk_event_get_device ()

    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`.

#### Parameters

event | a GdkEvent. |

#### Returns

a GdkDevice, or `NULL`.

[nullable][transfer none]

### gdk_event_set_device ()

    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()`.

#### Parameters

event | a GdkEvent |
device | a GdkDevice |

### gdk_event_get_source_device ()

    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`.

#### Parameters

event | a GdkEvent |

#### Returns

a GdkDevice, or `NULL`.

[nullable][transfer none]

### gdk_event_set_source_device ()

    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()`.

#### Parameters

event | a GdkEvent |
device | a GdkDevice |

### gdk_event_get_device_tool ()

    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()`

#### Parameters

event | a GdkEvent |

#### Returns

The current device tool, or `NULL`.

[transfer none]

### gdk_event_set_device_tool ()

    void
    gdk_event_set_device_tool (GdkEvent *event,
                               GdkDeviceTool *tool);

Sets the device tool for this event, should be rarely used.

#### Parameters

event | a GdkEvent |
tool | tool to set on the event, or `NULL`. | [nullable]

## Types and Values

### GdkEvent

The GdkEvent struct contains only private fields and should not be accessed directly.

### enum GdkEventType

Specifies the type of the event.

Do not confuse these events with the signals that GTK+ widgets emit. Although many of these events result in corresponding signals being emitted, the events are often transformed or filtered along the way.

#### Members

GDK_NOTHING | a special code to indicate a null event. |
GDK_DELETE | the window manager has requested that the toplevel surface be hidden or destroyed, usually when the user clicks on a special icon in the title bar. |
GDK_DESTROY | the surface has been destroyed. |
GDK_EXPOSE | all or part of the surface has become visible and needs to be redrawn. |
GDK_MOTION_NOTIFY | the pointer (usually a mouse) has moved. |
GDK_BUTTON_PRESS | a mouse button has been pressed. |
GDK_BUTTON_RELEASE | a mouse button has been released. |
GDK_KEY_PRESS | a key has been pressed. |
GDK_KEY_RELEASE | a key has been released. |
GDK_ENTER_NOTIFY | the pointer has entered the surface. |
GDK_LEAVE_NOTIFY | the pointer has left the surface. |
GDK_FOCUS_CHANGE | the keyboard focus has entered or left the surface. |
GDK_CONFIGURE | the size, position or stacking order of the surface has changed. Note that GTK+ discards these events for `GDK_SURFACE_CHILD` surfaces. |
GDK_MAP | the surface has been mapped. |
GDK_UNMAP | the surface has been unmapped. |
GDK_PROXIMITY_IN | an input device has moved into contact with a sensing surface (e.g. a touchscreen or graphics tablet). |
GDK_PROXIMITY_OUT | an input device has moved out of contact with a sensing surface. |
GDK_DRAG_ENTER | the mouse has entered the surface while a drag is in progress. |
GDK_DRAG_LEAVE | the mouse has left the surface while a drag is in progress. |
GDK_DRAG_MOTION | the mouse has moved in the surface while a drag is in progress. |
GDK_DROP_START | a drop operation onto the surface has started. |
GDK_SCROLL | the scroll wheel was turned |
GDK_GRAB_BROKEN | a pointer or keyboard grab was broken. This event type was added in 2.8. |
GDK_TOUCH_BEGIN | A new touch event sequence has just started. This event type was added in 3.4. |
GDK_TOUCH_UPDATE | A touch event sequence has been updated. This event type was added in 3.4. |
GDK_TOUCH_END | A touch event sequence has finished. This event type was added in 3.4. |
GDK_TOUCH_CANCEL | A touch event sequence has been canceled. This event type was added in 3.4. |
GDK_TOUCHPAD_SWIPE | A touchpad swipe gesture event, the current state is determined by its phase field. This event type was added in 3.18. |
GDK_TOUCHPAD_PINCH | A touchpad pinch gesture event, the current state is determined by its phase field. This event type was added in 3.18. |
GDK_PAD_BUTTON_PRESS | A tablet pad button press event. This event type was added in 3.22. |
GDK_PAD_BUTTON_RELEASE | A tablet pad button release event. This event type was added in 3.22. |
GDK_PAD_RING | A tablet pad axis event from a "ring". This event type was added in 3.22. |
GDK_PAD_STRIP | A tablet pad axis event from a "strip". This event type was added in 3.22. |
GDK_PAD_GROUP_MODE | A tablet pad group mode change. This event type was added in 3.22. |
GDK_EVENT_LAST | marks the end of the GdkEventType enumeration. Added in 2.18 |

### enum GdkEventMask

A set of bit-flags to indicate which events a surface is to receive. Most of these masks map onto one or more of the GdkEventType event types above.

See the input handling overview for details of event masks and event propagation.

If `GDK_TOUCH_MASK` is enabled, the surface will receive touch events from touch-enabled devices. Those will come as sequences of GdkEventTouch with type `GDK_TOUCH_UPDATE`, enclosed by two events with type `GDK_TOUCH_BEGIN` and `GDK_TOUCH_END` (or `GDK_TOUCH_CANCEL`). `gdk_event_get_event_sequence()` returns the event sequence for these events, so different sequences may be distinguished.

#### Members

GDK_EXPOSURE_MASK | receive expose events |
GDK_POINTER_MOTION_MASK | receive all pointer motion events |
GDK_BUTTON_MOTION_MASK | receive pointer motion events while any button is pressed |
GDK_BUTTON1_MOTION_MASK | receive pointer motion events while 1 button is pressed |
GDK_BUTTON2_MOTION_MASK | receive pointer motion events while 2 button is pressed |
GDK_BUTTON3_MOTION_MASK | receive pointer motion events while 3 button is pressed |
GDK_BUTTON_PRESS_MASK | receive button press events |
GDK_BUTTON_RELEASE_MASK | receive button release events |
GDK_KEY_PRESS_MASK | receive key press events |
GDK_KEY_RELEASE_MASK | receive key release events |
GDK_ENTER_NOTIFY_MASK | receive surface enter events |
GDK_LEAVE_NOTIFY_MASK | receive surface leave events |
GDK_FOCUS_CHANGE_MASK | receive focus change events |
GDK_STRUCTURE_MASK | receive events about surface configuration change |
GDK_PROPERTY_CHANGE_MASK | receive property change events |
GDK_PROXIMITY_IN_MASK | receive proximity in events |
GDK_PROXIMITY_OUT_MASK | receive proximity out events |
GDK_SUBSTRUCTURE_MASK | receive events about surface configuration changes of child surfaces |
GDK_SCROLL_MASK | receive scroll events |
GDK_TOUCH_MASK | receive touch events |
GDK_SMOOTH_SCROLL_MASK | receive smooth scrolling events |
GDK_TOUCHPAD_GESTURE_MASK | receive touchpad gesture events |
GDK_TABLET_PAD_MASK | receive tablet pad events |
GDK_ALL_EVENTS_MASK | the combination of all the above event masks. |

### enum GdkScrollDirection

Specifies the direction for scroll events.

#### Members

GDK_SCROLL_UP | the surface is scrolled up. |
GDK_SCROLL_DOWN | the surface is scrolled down. |
GDK_SCROLL_LEFT | the surface is scrolled to the left. |
GDK_SCROLL_RIGHT | the surface is scrolled to the right. |
GDK_SCROLL_SMOOTH | the scrolling is determined by the delta values in scroll events. See `gdk_event_get_scroll_deltas()` |

### enum GdkCrossingMode

Specifies the crossing mode for enter and leave events.

#### Members

GDK_CROSSING_NORMAL | crossing because of pointer motion. |
GDK_CROSSING_GRAB | crossing because a grab is activated. |
GDK_CROSSING_UNGRAB | crossing because a grab is deactivated. |
GDK_CROSSING_GTK_GRAB | crossing because a GTK+ grab is activated. |
GDK_CROSSING_GTK_UNGRAB | crossing because a GTK+ grab is deactivated. |
GDK_CROSSING_STATE_CHANGED | crossing because a GTK+ widget changed state (e.g. sensitivity). |
GDK_CROSSING_TOUCH_BEGIN | crossing because a touch sequence has begun, this event is synthetic as the pointer might have not left the surface. |
GDK_CROSSING_TOUCH_END | crossing because a touch sequence has ended, this event is synthetic as the pointer might have not left the surface. |
GDK_CROSSING_DEVICE_SWITCH | crossing because of a device switch (i.e. a mouse taking control of the pointer after a touch device), this event is synthetic as the pointer didn’t leave the surface. |

### enum GdkNotifyType

Specifies the kind of crossing for enter and leave events.

See the X11 protocol specification of LeaveNotify for full details of crossing event generation.

#### Members

GDK_NOTIFY_ANCESTOR | the surface is entered from an ancestor or left towards an ancestor. |
GDK_NOTIFY_VIRTUAL | the pointer moves between an ancestor and an inferior of the surface. |
GDK_NOTIFY_INFERIOR | the surface is entered from an inferior or left towards an inferior. |
GDK_NOTIFY_NONLINEAR | the surface is entered from or left towards a surface which is neither an ancestor nor an inferior. |
GDK_NOTIFY_NONLINEAR_VIRTUAL | the pointer moves between two surfaces which are not ancestors of each other and the surface is part of the ancestor chain between one of these surfaces and their least common ancestor. |
GDK_NOTIFY_UNKNOWN | an unknown type of enter/leave event occurred. |

### GDK_CURRENT_TIME

    #define GDK_CURRENT_TIME     0L

Represents the current time, and can be used anywhere a time is expected.

### GDK_PRIORITY_EVENTS

    #define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)

This is the priority that events from the X server are given in the GLib Main Loop.

### GDK_PRIORITY_REDRAW

    #define GDK_PRIORITY_REDRAW     (G_PRIORITY_HIGH_IDLE + 20)

This is the priority that the idle handler processing surface updates is given in the GLib Main Loop.

### GDK_EVENT_PROPAGATE

    #define GDK_EVENT_PROPAGATE     (FALSE)

Use this macro as the return value for continuing the propagation of an event handler.

### GDK_EVENT_STOP

    #define GDK_EVENT_STOP          (TRUE)

Use this macro as the return value for stopping the propagation of an event handler.

### GDK_BUTTON_PRIMARY

    #define GDK_BUTTON_PRIMARY      (1)

The primary button. This is typically the left mouse button, or the right button in a left-handed setup.

### GDK_BUTTON_MIDDLE

    #define GDK_BUTTON_MIDDLE       (2)

The middle button.

### GDK_BUTTON_SECONDARY

    #define GDK_BUTTON_SECONDARY    (3)

The secondary button. This is typically the right mouse button, or the left button in a left-handed setup.

### GdkEventSequence

    typedef struct _GdkEventSequence GdkEventSequence;

GdkEventSequence is an opaque type representing a sequence of related touch events.

## Property Details

### The `“event-type”` property

      “event-type”               GdkEventType

Event type.

Flags: Read / Write / Construct Only

Default value: GDK_NOTHING

## See Also

Event Structures