Events: CDK 3 Reference Manual

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

## Functions

gboolean | cdk_events_pending ()
CdkEvent * | cdk_event_peek ()
CdkEvent * | cdk_event_get ()
void | cdk_event_put ()
CdkEvent * | cdk_event_new ()
CdkEvent * | cdk_event_copy ()
void | cdk_event_free ()
gboolean | cdk_event_get_axis ()
gboolean | cdk_event_get_button ()
gboolean | cdk_event_get_click_count ()
gboolean | cdk_event_get_coords ()
gboolean | cdk_event_get_keycode ()
gboolean | cdk_event_get_keyval ()
gboolean | cdk_event_get_root_coords ()
gboolean | cdk_event_get_scroll_direction ()
gboolean | cdk_event_get_scroll_deltas ()
gboolean | cdk_event_is_scroll_stop_event ()
gboolean | cdk_event_get_state ()
guint32 | cdk_event_get_time ()
CdkWindow * | cdk_event_get_window ()
CdkEventType | cdk_event_get_event_type ()
CdkEventSequence * | cdk_event_get_event_sequence ()
void | cdk_event_request_motions ()
gboolean | cdk_events_get_angle ()
gboolean | cdk_events_get_center ()
gboolean | cdk_events_get_distance ()
gboolean | cdk_event_triggers_context_menu ()
CdkSeat * | cdk_event_get_seat ()
int | cdk_event_get_scancode ()
gboolean | cdk_event_get_pointer_emulated ()
void | cdk_event_handler_set ()
void | (*CdkEventFunc) ()
gboolean | cdk_get_show_events ()
void | cdk_set_show_events ()
void | cdk_event_set_screen ()
CdkScreen * | cdk_event_get_screen ()
CdkDevice * | cdk_event_get_device ()
void | cdk_event_set_device ()
CdkDevice * | cdk_event_get_source_device ()
void | cdk_event_set_source_device ()
CdkDeviceTool * | cdk_event_get_device_tool ()
void | cdk_event_set_device_tool ()
gboolean | cdk_setting_get ()

## Types and Values

enum | CdkEventType
enum | CdkEventMask
#define | CDK_CURRENT_TIME
#define | CDK_PRIORITY_EVENTS
#define | CDK_PRIORITY_REDRAW
#define | CDK_EVENT_PROPAGATE
#define | CDK_EVENT_STOP
#define | CDK_BUTTON_PRIMARY
#define | CDK_BUTTON_MIDDLE
#define | CDK_BUTTON_SECONDARY
| CdkEventSequence

## Includes

    #include <cdk/cdk.h>

## Description

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

In CTK+ applications the events are handled automatically in `ctk_main_do_event()` and passed on to the appropriate widgets, so these functions are rarely needed. Though some of the fields in the Event Structures are useful.

## Functions

### cdk_events_pending ()

    gboolean
    cdk_events_pending (void);

Checks if any events are ready to be processed for any display.

#### Returns

`TRUE` if any events are pending.

### cdk_event_peek ()

    CdkEvent *
    cdk_event_peek (void);

If there is an event waiting in the event queue of some open display, returns a copy of it. See `cdk_display_peek_event()`.

#### Returns

a copy of the first CdkEvent on some event queue, or `NULL` if no events are in any queues. The returned CdkEvent should be freed with `cdk_event_free()`.

[nullable]

### cdk_event_get ()

    CdkEvent *
    cdk_event_get (void);

Checks all open displays for a CdkEvent to process,to be processed on, fetching events from the windowing system if necessary. See `cdk_display_get_event()`.

#### Returns

the next CdkEvent to be processed, or `NULL` if no events are pending. The returned CdkEvent should be freed with `cdk_event_free()`.

[nullable]

### cdk_event_put ()

    void
    cdk_event_put (const CdkEvent *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 `cdk_display_put_event()`.

#### Parameters

event | a CdkEvent. |

### cdk_event_new ()

    CdkEvent *
    cdk_event_new (CdkEventType type);

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

#### Parameters

type | a CdkEventType |

#### Returns

a newly-allocated CdkEvent. The returned CdkEvent should be freed with `cdk_event_free()`.

Since: 2.2

### cdk_event_copy ()

    CdkEvent *
    cdk_event_copy (const CdkEvent *event);

Copies a CdkEvent, copying or incrementing the reference count of the resources associated with it (e.g. CdkWindow’s and strings).

#### Parameters

event | a CdkEvent |

#### Returns

a copy of `event` . The returned CdkEvent should be freed with `cdk_event_free()`.

### cdk_event_free ()

    void
    cdk_event_free (CdkEvent *event);

Frees a CdkEvent, freeing or decrementing any resources associated with it. Note that this function should only be called with events returned from functions such as `cdk_event_peek()`, `cdk_event_get()`, `cdk_event_copy()` and `cdk_event_new()`.

#### Parameters

event | a CdkEvent. |

### cdk_event_get_axis ()

    gboolean
    cdk_event_get_axis (const CdkEvent *event,
                        CdkAxisUse axis_use,
                        gdouble *value);

Extract the axis value for a particular axis use from an event structure.

#### Parameters

event | a CdkEvent |
axis_use | the axis use to look for |
value | location to store the value found. | [out]

#### Returns

`TRUE` if the specified axis was found, otherwise `FALSE`

### cdk_event_get_button ()

    gboolean
    cdk_event_get_button (const CdkEvent *event,
                          guint *button);

Extract the button number from an event.

#### Parameters

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

#### Returns

`TRUE` if the event delivered a button number

Since: 3.2

### cdk_event_get_click_count ()

    gboolean
    cdk_event_get_click_count (const CdkEvent *event,
                               guint *click_count);

Extracts the click count from an event.

#### Parameters

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

#### Returns

`TRUE` if the event delivered a click count

Since: 3.2

### cdk_event_get_coords ()

    gboolean
    cdk_event_get_coords (const CdkEvent *event,
                          gdouble *x_win,
                          gdouble *y_win);

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

#### Parameters

event | a CdkEvent |
x_win | location to put event window x coordinate. | [out][optional]
y_win | location to put event window y coordinate. | [out][optional]

#### Returns

`TRUE` if the event delivered event window coordinates

### cdk_event_get_keycode ()

    gboolean
    cdk_event_get_keycode (const CdkEvent *event,
                           guint16 *keycode);

Extracts the hardware keycode from an event.

Also see `cdk_event_get_scancode()`.

#### Parameters

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

#### Returns

`TRUE` if the event delivered a hardware keycode

Since: 3.2

### cdk_event_get_keyval ()

    gboolean
    cdk_event_get_keyval (const CdkEvent *event,
                          guint *keyval);

Extracts the keyval from an event.

#### Parameters

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

#### Returns

`TRUE` if the event delivered a key symbol

Since: 3.2

### cdk_event_get_root_coords ()

    gboolean
    cdk_event_get_root_coords (const CdkEvent *event,
                               gdouble *x_root,
                               gdouble *y_root);

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

#### Parameters

event | a CdkEvent |
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

### cdk_event_get_scroll_direction ()

    gboolean
    cdk_event_get_scroll_direction (const CdkEvent *event,
                                    CdkScrollDirection *direction);

Extracts the scroll direction from an event.

If `event` is not of type `CDK_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 `cdk_event_get_scroll_deltas()`; for instance:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    CdkScrollDirection direction;
    double vscroll_factor = 0.0;
    double x_scroll, y_scroll;

    if (cdk_event_get_scroll_direction (event, &direction))
      {
        // Handle discrete scrolling with a known constant delta;
        const double delta = 12.0;

        switch (direction)
          {
          case CDK_SCROLL_UP:
            vscroll_factor = -delta;
            break;
          case CDK_SCROLL_DOWN:
            vscroll_factor = delta;
            break;
          default:
            // no scrolling
            break;
          }
      }
    else if (cdk_event_get_scroll_deltas (event, &x_scroll, &y_scroll))
      {
        // Handle smooth scrolling directly
        vscroll_factor = y_scroll;
      }

#### Parameters

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

#### Returns

`TRUE` if the event delivered a scroll direction and `FALSE` otherwise

Since: 3.2

### cdk_event_get_scroll_deltas ()

    gboolean
    cdk_event_get_scroll_deltas (const CdkEvent *event,
                                 gdouble *delta_x,
                                 gdouble *delta_y);

Retrieves the scroll deltas from a CdkEvent

See also: `cdk_event_get_scroll_direction()`

#### Parameters

event | a CdkEvent |
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 and `FALSE` otherwise

Since: 3.4

### cdk_event_is_scroll_stop_event ()

    gboolean
    cdk_event_is_scroll_stop_event (const CdkEvent *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 CdkEvent |

#### Returns

`TRUE` if the event is a scroll stop event

Since: 3.20

### cdk_event_get_state ()

    gboolean
    cdk_event_get_state (const CdkEvent *event,
                         CdkModifierType *state);

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.

#### Parameters

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

#### Returns

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

### cdk_event_get_time ()

    guint32
    cdk_event_get_time (const CdkEvent *event);

Returns the time stamp from `event` , if there is one; otherwise returns CDK_CURRENT_TIME. If `event` is `NULL`, returns CDK_CURRENT_TIME.

#### Parameters

event | a CdkEvent |

#### Returns

time stamp field from `event`

### cdk_event_get_window ()

    CdkWindow *
    cdk_event_get_window (const CdkEvent *event);

Extracts the CdkWindow associated with an event.

#### Parameters

event | a CdkEvent |

#### Returns

The CdkWindow associated with the event.

[transfer none]

Since: 3.10

### cdk_event_get_event_type ()

    CdkEventType
    cdk_event_get_event_type (const CdkEvent *event);

Retrieves the type of the event.

#### Parameters

event | a CdkEvent |

#### Returns

a CdkEventType

Since: 3.10

### cdk_event_get_event_sequence ()

    CdkEventSequence *
    cdk_event_get_event_sequence (const CdkEvent *event);

If `event` if of type `CDK_TOUCH_BEGIN`, `CDK_TOUCH_UPDATE`, `CDK_TOUCH_END` or `CDK_TOUCH_CANCEL`, returns the CdkEventSequence to which the event belongs. Otherwise, return `NULL`.

#### Parameters

event | a CdkEvent |

#### Returns

the event sequence that the event belongs to.

[transfer none]

Since: 3.4

### cdk_event_request_motions ()

    void
    cdk_event_request_motions (const CdkEventMotion *event);

Request more motion notifies if `event` is a motion notify hint event.

This function should be used instead of `cdk_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 `CDK_MOTION_NOTIFY` event usually works like this:

    1
    2
    3
    4
    5
    6
    7
    {
      // motion_event handler
      x = motion_event->x;
      y = motion_event->y;
      // handle (x,y) motion
      cdk_event_request_motions (motion_event); // handles is_hint events
    }

#### Parameters

event | a valid CdkEvent |

Since: 2.12

### cdk_events_get_angle ()

    gboolean
    cdk_events_get_angle (CdkEvent *event1,
                          CdkEvent *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 CdkEvent |
event2 | second CdkEvent |
angle | return location for the relative angle between both events. | [out]

#### Returns

`TRUE` if the angle could be calculated.

Since: 3.0

### cdk_events_get_center ()

    gboolean
    cdk_events_get_center (CdkEvent *event1,
                           CdkEvent *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 CdkEvent |
event2 | second CdkEvent |
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.

Since: 3.0

### cdk_events_get_distance ()

    gboolean
    cdk_events_get_distance (CdkEvent *event1,
                             CdkEvent *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 CdkEvent |
event2 | second CdkEvent |
distance | return location for the distance. | [out]

#### Returns

`TRUE` if the distance could be calculated.

Since: 3.0

### cdk_event_triggers_context_menu ()

    gboolean
    cdk_event_triggers_context_menu (const CdkEvent *event);

This function returns whether a CdkEventButton should trigger a context menu, according to platform conventions. The right mouse button always triggers context menus. Additionally, if `cdk_keymap_get_modifier_mask()` returns a non-0 mask for `CDK_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 == `CDK_BUTTON_SECONDARY`.

#### Parameters

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

#### Returns

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

Since: 3.4

### cdk_event_get_seat ()

    CdkSeat *
    cdk_event_get_seat (const CdkEvent *event);

Returns the CdkSeat this event was generated for.

#### Parameters

event | a CdkEvent |

#### Returns

The CdkSeat of this event.

[transfer none]

Since: 3.20

### cdk_event_get_scancode ()

    int
    cdk_event_get_scancode (CdkEvent *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 CdkEvent |

#### Returns

The associated keyboard scancode or 0

Since: 3.22

### cdk_event_get_pointer_emulated ()

    gboolean
    cdk_event_get_pointer_emulated (CdkEvent *event);

Returns whether this event is an 'emulated' pointer event (typically from a touch event), as opposed to a real one.

#### Parameters

event | a CdkEvent |

#### Returns

`TRUE` if this event is emulated

Since: 3.22

### cdk_event_handler_set ()

    void
    cdk_event_handler_set (CdkEventFunc func,
                           gpointer data,
                           GDestroyNotify notify);

Sets the function to call to handle all events from CDK.

Note that CTK+ uses this to install its own event handler, so it is usually not useful for CTK+ applications. (Although an application can call this function then call `ctk_main_do_event()` to pass events to CTK+.)

#### Parameters

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

### CdkEventFunc ()

    void
    (*CdkEventFunc) (CdkEvent *event,
                     gpointer data);

Specifies the type of function passed to `cdk_event_handler_set()` to handle all CDK events.

#### Parameters

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

### cdk_get_show_events ()

    gboolean
    cdk_get_show_events (void);

Gets whether event debugging output is enabled.

#### Returns

`TRUE` if event debugging output is enabled.

### cdk_set_show_events ()

    void
    cdk_set_show_events (gboolean show_events);

Sets whether a trace of received events is output. Note that CTK+ 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. |

### cdk_event_set_screen ()

    void
    cdk_event_set_screen (CdkEvent *event,
                          CdkScreen *screen);

Sets the screen for `event` to `screen` . The event must have been allocated by CTK+, for instance, by `cdk_event_copy()`.

#### Parameters

event | a CdkEvent |
screen | a CdkScreen |

Since: 2.2

### cdk_event_get_screen ()

    CdkScreen *
    cdk_event_get_screen (const CdkEvent *event);

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.

#### Parameters

event | a CdkEvent |

#### Returns

the screen for the event.

[transfer none]

Since: 2.2

### cdk_event_get_device ()

    CdkDevice *
    cdk_event_get_device (const CdkEvent *event);

If the event contains a “device” field, this function will return it, else it will return `NULL`.

#### Parameters

event | a CdkEvent. |

#### Returns

a CdkDevice, or `NULL`.

[nullable][transfer none]

Since: 3.0

### cdk_event_set_device ()

    void
    cdk_event_set_device (CdkEvent *event,
                          CdkDevice *device);

Sets the device for `event` to `device` . The event must have been allocated by CTK+, for instance, by `cdk_event_copy()`.

#### Parameters

event | a CdkEvent |
device | a CdkDevice |

Since: 3.0

### cdk_event_get_source_device ()

    CdkDevice *
    cdk_event_get_source_device (const CdkEvent *event);

This function returns the hardware (slave) CdkDevice that has triggered the event, falling back to the virtual (master) device (as in `cdk_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 CdkWindow 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 CdkEvent |

#### Returns

a CdkDevice, or `NULL`.

[nullable][transfer none]

Since: 3.0

### cdk_event_set_source_device ()

    void
    cdk_event_set_source_device (CdkEvent *event,
                                 CdkDevice *device);

Sets the slave device for `event` to `device` .

The event must have been allocated by CTK+, for instance by `cdk_event_copy()`.

#### Parameters

event | a CdkEvent |
device | a CdkDevice |

Since: 3.0

### cdk_event_get_device_tool ()

    CdkDeviceTool *
    cdk_event_get_device_tool (const CdkEvent *event);

If the event was generated by a device that supports different tools (eg. a tablet), this function will return a CdkDeviceTool representing the tool that caused the event. Otherwise, `NULL` will be returned.

Note: the CdkDeviceTool<!-- -->s will be constant during the application lifetime, if settings must be stored persistently across runs, see `cdk_device_tool_get_serial()`

#### Parameters

event | a CdkEvent |

#### Returns

The current device tool, or `NULL`.

[transfer none]

Since: 3.22

### cdk_event_set_device_tool ()

    void
    cdk_event_set_device_tool (CdkEvent *event,
                               CdkDeviceTool *tool);

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

#### Parameters

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

Since: 3.22

### cdk_setting_get ()

    gboolean
    cdk_setting_get (const gchar *name,
                     GValue *value);

Obtains a desktop-wide setting, such as the double-click time, for the default screen. See `cdk_screen_get_setting()`.

#### Parameters

name | the name of the setting. |
value | location to store the value of the setting. |

#### Returns

`TRUE` if the setting existed and a value was stored in `value` , `FALSE` otherwise.

## Types and Values

### enum CdkEventType

Specifies the type of the event.

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

In some language bindings, the values `CDK_2BUTTON_PRESS` and `CDK_3BUTTON_PRESS` would translate into something syntactically invalid (eg `Cdk.EventType.2ButtonPress`, where a symbol is not allowed to start with a number). In that case, the aliases `CDK_DOUBLE_BUTTON_PRESS` and `CDK_TRIPLE_BUTTON_PRESS` can be used instead.

#### Members

CDK_NOTHING | a special code to indicate a null event. |
CDK_DELETE | the window manager has requested that the toplevel window be hidden or destroyed, usually when the user clicks on a special icon in the title bar. |
CDK_DESTROY | the window has been destroyed. |
CDK_EXPOSE | all or part of the window has become visible and needs to be redrawn. |
CDK_MOTION_NOTIFY | the pointer (usually a mouse) has moved. |
CDK_BUTTON_PRESS | a mouse button has been pressed. |
CDK_2BUTTON_PRESS | a mouse button has been double-clicked (clicked twice within a short period of time). Note that each click also generates a `CDK_BUTTON_PRESS` event. |
CDK_DOUBLE_BUTTON_PRESS | alias for `CDK_2BUTTON_PRESS`, added in 3.6. |
CDK_3BUTTON_PRESS | a mouse button has been clicked 3 times in a short period of time. Note that each click also generates a `CDK_BUTTON_PRESS` event. |
CDK_TRIPLE_BUTTON_PRESS | alias for `CDK_3BUTTON_PRESS`, added in 3.6. |
CDK_BUTTON_RELEASE | a mouse button has been released. |
CDK_KEY_PRESS | a key has been pressed. |
CDK_KEY_RELEASE | a key has been released. |
CDK_ENTER_NOTIFY | the pointer has entered the window. |
CDK_LEAVE_NOTIFY | the pointer has left the window. |
CDK_FOCUS_CHANGE | the keyboard focus has entered or left the window. |
CDK_CONFIGURE | the size, position or stacking order of the window has changed. Note that CTK+ discards these events for `CDK_WINDOW_CHILD` windows. |
CDK_MAP | the window has been mapped. |
CDK_UNMAP | the window has been unmapped. |
CDK_PROPERTY_NOTIFY | a property on the window has been changed or deleted. |
CDK_SELECTION_CLEAR | the application has lost ownership of a selection. |
CDK_SELECTION_REQUEST | another application has requested a selection. |
CDK_SELECTION_NOTIFY | a selection has been received. |
CDK_PROXIMITY_IN | an input device has moved into contact with a sensing surface (e.g. a touchscreen or graphics tablet). |
CDK_PROXIMITY_OUT | an input device has moved out of contact with a sensing surface. |
CDK_DRAG_ENTER | the mouse has entered the window while a drag is in progress. |
CDK_DRAG_LEAVE | the mouse has left the window while a drag is in progress. |
CDK_DRAG_MOTION | the mouse has moved in the window while a drag is in progress. |
CDK_DRAG_STATUS | the status of the drag operation initiated by the window has changed. |
CDK_DROP_START | a drop operation onto the window has started. |
CDK_DROP_FINISHED | the drop operation initiated by the window has completed. |
CDK_CLIENT_EVENT | a message has been received from another application. |
CDK_VISIBILITY_NOTIFY | the window visibility status has changed. |
CDK_SCROLL | the scroll wheel was turned |
CDK_WINDOW_STATE | the state of a window has changed. See CdkWindowState for the possible window states |
CDK_SETTING | a setting has been modified. |
CDK_OWNER_CHANGE | the owner of a selection has changed. This event type was added in 2.6 |
CDK_GRAB_BROKEN | a pointer or keyboard grab was broken. This event type was added in 2.8. |
CDK_DAMAGE | the content of the window has been changed. This event type was added in 2.14. |
CDK_TOUCH_BEGIN | A new touch event sequence has just started. This event type was added in 3.4. |
CDK_TOUCH_UPDATE | A touch event sequence has been updated. This event type was added in 3.4. |
CDK_TOUCH_END | A touch event sequence has finished. This event type was added in 3.4. |
CDK_TOUCH_CANCEL | A touch event sequence has been canceled. This event type was added in 3.4. |
CDK_TOUCHPAD_SWIPE | A touchpad swipe gesture event, the current state is determined by its phase field. This event type was added in 3.18. |
CDK_TOUCHPAD_PINCH | A touchpad pinch gesture event, the current state is determined by its phase field. This event type was added in 3.18. |
CDK_PAD_BUTTON_PRESS | A tablet pad button press event. This event type was added in 3.22. |
CDK_PAD_BUTTON_RELEASE | A tablet pad button release event. This event type was added in 3.22. |
CDK_PAD_RING | A tablet pad axis event from a "ring". This event type was added in 3.22. |
CDK_PAD_STRIP | A tablet pad axis event from a "strip". This event type was added in 3.22. |
CDK_PAD_GROUP_MODE | A tablet pad group mode change. This event type was added in 3.22. |
CDK_EVENT_LAST | marks the end of the CdkEventType enumeration. Added in 2.18 |

### enum CdkEventMask

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

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

`CDK_POINTER_MOTION_HINT_MASK` is deprecated. It is a special mask to reduce the number of `CDK_MOTION_NOTIFY` events received. When using `CDK_POINTER_MOTION_HINT_MASK`, fewer `CDK_MOTION_NOTIFY` events will be sent, some of which are marked as a hint (the is_hint member is `TRUE`). To receive more motion events after a motion hint event, the application needs to asks for more, by calling `cdk_event_request_motions()`.

Since CTK 3.8, motion events are already compressed by default, independent of this mechanism. This compression can be disabled with `cdk_window_set_event_compression()`. See the documentation of that function for details.

If `CDK_TOUCH_MASK` is enabled, the window will receive touch events from touch-enabled devices. Those will come as sequences of CdkEventTouch with type `CDK_TOUCH_UPDATE`, enclosed by two events with type `CDK_TOUCH_BEGIN` and `CDK_TOUCH_END` (or `CDK_TOUCH_CANCEL`). `cdk_event_get_event_sequence()` returns the event sequence for these events, so different sequences may be distinguished.

#### Members

CDK_EXPOSURE_MASK | receive expose events |
CDK_POINTER_MOTION_MASK | receive all pointer motion events |
CDK_POINTER_MOTION_HINT_MASK | deprecated. see the explanation above |
CDK_BUTTON_MOTION_MASK | receive pointer motion events while any button is pressed |
CDK_BUTTON1_MOTION_MASK | receive pointer motion events while 1 button is pressed |
CDK_BUTTON2_MOTION_MASK | receive pointer motion events while 2 button is pressed |
CDK_BUTTON3_MOTION_MASK | receive pointer motion events while 3 button is pressed |
CDK_BUTTON_PRESS_MASK | receive button press events |
CDK_BUTTON_RELEASE_MASK | receive button release events |
CDK_KEY_PRESS_MASK | receive key press events |
CDK_KEY_RELEASE_MASK | receive key release events |
CDK_ENTER_NOTIFY_MASK | receive window enter events |
CDK_LEAVE_NOTIFY_MASK | receive window leave events |
CDK_FOCUS_CHANGE_MASK | receive focus change events |
CDK_STRUCTURE_MASK | receive events about window configuration change |
CDK_PROPERTY_CHANGE_MASK | receive property change events |
CDK_VISIBILITY_NOTIFY_MASK | receive visibility change events |
CDK_PROXIMITY_IN_MASK | receive proximity in events |
CDK_PROXIMITY_OUT_MASK | receive proximity out events |
CDK_SUBSTRUCTURE_MASK | receive events about window configuration changes of child windows |
CDK_SCROLL_MASK | receive scroll events |
CDK_TOUCH_MASK | receive touch events. Since 3.4 |
CDK_SMOOTH_SCROLL_MASK | receive smooth scrolling events. Since 3.4 |
CDK_TOUCHPAD_GESTURE_MASK | receive touchpad gesture events. Since 3.18 |
CDK_TABLET_PAD_MASK | receive tablet pad events. Since 3.22 |
CDK_ALL_EVENTS_MASK | the combination of all the above event masks. |

### CDK_CURRENT_TIME

    #define CDK_CURRENT_TIME     0L

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

### CDK_PRIORITY_EVENTS

    #define             CDK_PRIORITY_EVENTS

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

### CDK_PRIORITY_REDRAW

    #define CDK_PRIORITY_REDRAW     (G_PRIORITY_HIGH_IDLE + 20)

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

### CDK_EVENT_PROPAGATE

    #define CDK_EVENT_PROPAGATE     (FALSE)

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

Since: 3.4

### CDK_EVENT_STOP

    #define CDK_EVENT_STOP          (TRUE)

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

Since: 3.4

### CDK_BUTTON_PRIMARY

    #define CDK_BUTTON_PRIMARY      (1)

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

Since: 3.4

### CDK_BUTTON_MIDDLE

    #define CDK_BUTTON_MIDDLE       (2)

The middle button.

Since: 3.4

### CDK_BUTTON_SECONDARY

    #define CDK_BUTTON_SECONDARY    (3)

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

Since: 3.4

### CdkEventSequence

    typedef struct _CdkEventSequence CdkEventSequence;

## See Also

Event Structures