## GdkDeviceManager GdkDeviceManager — Functions for handling input devices |

## Synopsis

    #include <gdk/gdk.h>

    struct              GdkDeviceManager;
    struct              GdkDevice;
    enum                GdkDeviceType;
    enum                GdkInputSource;
    enum                GdkInputMode;
    struct              GdkDeviceKey;
    struct              GdkDeviceAxis;
    enum                GdkAxisUse;
    enum                GdkGrabOwnership;
    void                gdk_enable_multidevice              (void);
    GdkDisplay *              gdk_device_manager_get_display
                                                            (GdkDeviceManager *device_manager);
    GList *                   gdk_device_manager_list_devices
                                                            (GdkDeviceManager *device_manager,
                                                             GdkDeviceType type);
    GdkDevice *               gdk_device_manager_get_client_pointer
                                                            (GdkDeviceManager *device_manager);

    const gchar *       gdk_device_get_name                 (GdkDevice *device);
    void                gdk_device_set_source               (GdkDevice *device,
                                                             GdkInputSource source);
    GdkInputSource      gdk_device_get_source               (GdkDevice *device);
    gboolean            gdk_device_set_mode                 (GdkDevice *device,
                                                             GdkInputMode mode);
    GdkInputMode        gdk_device_get_mode                 (GdkDevice *device);
    void                gdk_device_set_key                  (GdkDevice *device,
                                                             guint index_,
                                                             guint keyval,
                                                             GdkModifierType modifiers);
    gboolean            gdk_device_get_key                  (GdkDevice *device,
                                                             guint index_,
                                                             guint *keyval,
                                                             GdkModifierType *modifiers);
    void                gdk_device_set_axis_use             (GdkDevice *device,
                                                             guint index_,
                                                             GdkAxisUse use);
    GdkAxisUse          gdk_device_get_axis_use             (GdkDevice *device,
                                                             guint index_);
    GdkDevice *         gdk_device_get_associated_device    (GdkDevice *device);
    GdkDeviceType       gdk_device_get_device_type          (GdkDevice *device);
    GdkDisplay *        gdk_device_get_display              (GdkDevice *device);
    gboolean            gdk_device_get_has_cursor           (GdkDevice *device);
    guint               gdk_device_get_n_axes               (GdkDevice *device);

    GdkGrabStatus       gdk_device_grab                     (GdkDevice *device,
                                                             GdkWindow *window,
                                                             GdkGrabOwnership grab_ownership,
                                                             gboolean owner_events,
                                                             GdkEventMask event_mask,
                                                             GdkCursor *cursor,
                                                             guint32 time_);
    void                gdk_device_ungrab                   (GdkDevice *device,
                                                             guint32 time_);

    void                gdk_device_get_state                (GdkDevice *device,
                                                             GdkWindow *window,
                                                             gdouble *axes,
                                                             GdkModifierType *mask);
    gboolean            gdk_device_get_history              (GdkDevice *device,
                                                             GdkWindow *window,
                                                             guint32 start,
                                                             guint32 stop,
                                                             GdkTimeCoord ***events,
                                                             gint *n_events);
    void                gdk_device_free_history             (GdkTimeCoord **events,
                                                             gint n_events);
    struct              GdkTimeCoord;
    gboolean            gdk_device_get_axis                 (GdkDevice *device,
                                                             gdouble *axes,
                                                             GdkAxisUse use,
                                                             gdouble *value);
    GList *             gdk_device_list_axes                (GdkDevice *device);
    gboolean            gdk_device_get_axis_value           (GdkDevice *device,
                                                             gdouble *axes,
                                                             GdkAtom axis_label,
                                                             gdouble *value);

    void                gdk_input_set_extension_events      (GdkWindow *window,
                                                             gint mask,
                                                             GdkExtensionMode mode);
    enum                GdkExtensionMode;

    GList *             gdk_devices_list                    (void);
    GdkDevice *         gdk_device_get_core_pointer         (void);

## Object Hierarchy

      GObject
       +----GdkDeviceManager

      GObject
       +----GdkDevice

## Properties

      "display"                  GdkDisplay*           : Read / Write / Construct Only
      "associated-device"        GdkDevice*            : Read
      "device-manager"           GdkDeviceManager*     : Read / Write / Construct Only
      "display"                  GdkDisplay*           : Read / Write / Construct Only
      "has-cursor"               gboolean              : Read / Write / Construct Only
      "input-mode"               GdkInputMode          : Read / Write
      "input-source"             GdkInputSource        : Read / Write / Construct Only
      "n-axes"                   guint                 : Read
      "name"                     gchar*                : Read / Write / Construct Only
      "type"                     GdkDeviceType         : Read / Write / Construct Only

## Signals

      "device-added"                                   : Run Last
      "device-changed"                                 : Run Last
      "device-removed"                                 : Run Last

## Description

By default, GDK supports the traditional single keyboard/pointer input scheme (Plus additional special input devices such as tablets. In short, backwards compatible with 2.X). Since version 3.0, if `gdk_enable_multidevice()` is called before `gdk_display_open()` and the platform supports it, GDK will be aware of multiple keyboard/pointer pairs interacting simultaneously with the user interface.

Conceptually, in multidevice mode there are 2 device types, virtual devices (or master devices) are represented by the pointer cursors and keyboard foci that are seen on the screen. physical devices (or slave devices) represent the hardware that is controlling the virtual devices, and thus has no visible cursor on the screen.

Virtual devices are always paired, there is a keyboard device for every pointer device, associations between devices may be inspected through `gdk_device_get_associated_device()`.

There may be several virtual devices, and several physical devices could be controlling each of these virtual devices. Physical devices may also be "floating", which means they are not attached to any virtual device.

By default, GDK will automatically listen for events coming from all master devices, setting the GdkDevice for all events coming from input devices [1] , although `gdk_window_set_support_multidevice()` has to be called on GdkWindow in order to support additional features of multiple pointer interaction, such as multiple, per-device enter/leave events. The default setting will emit just one enter/leave event pair for all devices on the window. See `gdk_window_set_support_multidevice()` documentation for more information.

In order to listen for events coming from other than a virtual device, `gdk_window_set_device_events()` must be called. Generally, this function can be used to modify the event mask for any given device.

Input devices may also provide additional information besides X/Y. For example, graphics tablets may also provide pressure and X/Y tilt information. This information is device-dependent, and may be queried through `gdk_device_get_axis()`. In multidevice mode, virtual devices will change axes in order to always represent the physical device that is routing events through it. Whenever the physical device changes, the "n-axes" property will be notified, and `gdk_device_list_axes()` will return the new device axes.

Devices may also have associated keys or macro buttons. Such keys can be globally set to map into normal X keyboard events. The mapping is set using `gdk_device_set_key()`.

In order to query the device hierarchy and be aware of changes in the device hierarchy (such as virtual devices being created or removed, or physical devices being plugged or unplugged), GDK provides GdkDeviceManager. On X11, multidevice support is implemented through XInput 2. If `gdk_enable_multidevice()` is called, the XInput 2.x GdkDeviceManager implementation will be used as input source, else either the core or XInput 1.x implementations will be used.

## Details

### struct GdkDeviceManager

    struct GdkDeviceManager;

### struct GdkDevice

    struct GdkDevice;

### enum GdkDeviceType

    typedef enum {
      GDK_DEVICE_TYPE_MASTER,
      GDK_DEVICE_TYPE_SLAVE,
      GDK_DEVICE_TYPE_FLOATING
    } GdkDeviceType;

Indicates the device type. See above for more information about the meaning of these device types.

`GDK_DEVICE_TYPE_MASTER` | Device is a master (or virtual) device. There will be an associated focus indicator on the screen.
`GDK_DEVICE_TYPE_SLAVE` | Device is a slave (or physical) device.
`GDK_DEVICE_TYPE_FLOATING` | Device is a physical device, currently not attached to any virtual device.

### enum GdkInputSource

    typedef enum
    {
      GDK_SOURCE_MOUSE,
      GDK_SOURCE_PEN,
      GDK_SOURCE_ERASER,
      GDK_SOURCE_CURSOR,
      GDK_SOURCE_KEYBOARD
    } GdkInputSource;

An enumeration describing the type of an input device in general terms.

`GDK_SOURCE_MOUSE` | the device is a mouse. (This will be reported for the core pointer, even if it is something else, such as a trackball.)
`GDK_SOURCE_PEN` | the device is a stylus of a graphics tablet or similar device.
`GDK_SOURCE_ERASER` | the device is an eraser. Typically, this would be the other end of a stylus on a graphics tablet.
`GDK_SOURCE_CURSOR` | the device is a graphics tablet "puck" or similar device.
`GDK_SOURCE_KEYBOARD` | the device is a keyboard.

### enum GdkInputMode

    typedef enum
    {
      GDK_MODE_DISABLED,
      GDK_MODE_SCREEN,
      GDK_MODE_WINDOW
    } GdkInputMode;

An enumeration that describes the mode of an input device.

`GDK_MODE_DISABLED` | the device is disabled and will not report any events.
`GDK_MODE_SCREEN` | the device is enabled. The device's coordinate space maps to the entire screen.
`GDK_MODE_WINDOW` | the device is enabled. The device's coordinate space is mapped to a single window. The manner in which this window is chosen is undefined, but it will typically be the same way in which the focus window for key events is determined.

### struct GdkDeviceKey

    struct GdkDeviceKey {
      guint keyval;
      GdkModifierType modifiers;
    };

The GdkDeviceKey structure contains information about the mapping of one device macro button onto a normal X key event.

guint `keyval`; | the keyval to generate when the macro button is pressed. If this is 0, no keypress will be generated.
GdkModifierType `modifiers`; | the modifiers set for the generated key event.

### struct GdkDeviceAxis

    struct GdkDeviceAxis {
      GdkAxisUse use;
      gdouble    min;
      gdouble    max;
    };

The GdkDeviceAxis structure contains information about the range and mapping of a device axis.

GdkAxisUse `use`; | specifies how the axis is used.
gdouble `min`; | the minimal value that will be reported by this axis.
gdouble `max`; | the maximal value that will be reported by this axis.

### enum GdkAxisUse

    typedef enum
    {
      GDK_AXIS_IGNORE,
      GDK_AXIS_X,
      GDK_AXIS_Y,
      GDK_AXIS_PRESSURE,
      GDK_AXIS_XTILT,
      GDK_AXIS_YTILT,
      GDK_AXIS_WHEEL,
      GDK_AXIS_LAST
    } GdkAxisUse;

An enumeration describing the way in which a device axis (valuator) maps onto the predefined valuator types that GTK+ understands.

`GDK_AXIS_IGNORE` | the axis is ignored.
`GDK_AXIS_X` | the axis is used as the x axis.
`GDK_AXIS_Y` | the axis is used as the y axis.
`GDK_AXIS_PRESSURE` | the axis is used for pressure information.
`GDK_AXIS_XTILT` | the axis is used for x tilt information.
`GDK_AXIS_YTILT` | the axis is used for x tilt information.
`GDK_AXIS_WHEEL` | the axis is used for wheel information.
`GDK_AXIS_LAST` | a constant equal to the numerically highest axis value.

### enum GdkGrabOwnership

    typedef enum
    {
      GDK_OWNERSHIP_NONE,
      GDK_OWNERSHIP_WINDOW,
      GDK_OWNERSHIP_APPLICATION
    } GdkGrabOwnership;

Defines how device grabs interact with other devices.

`GDK_OWNERSHIP_NONE` | All other devices' events are allowed.
`GDK_OWNERSHIP_WINDOW` | Other devices' events are blocked for the grab window.
`GDK_OWNERSHIP_APPLICATION` | Other devices' events are blocked for the whole application.

### gdk_enable_multidevice ()

    void                gdk_enable_multidevice              (void);

Enables multidevice support in GDK. This call must happen prior to `gdk_display_open()`, `gtk_init()`, `gtk_init_with_args()` or `gtk_init_check()` in order to take effect.

Note that individual GdkWindows still need to explicitly enable multidevice awareness through `gdk_window_set_support_multidevice()`.

This function must be called before initializing GDK.

Since 3.0

### gdk_device_manager_get_display ()

    GdkDisplay *              gdk_device_manager_get_display
                                                            (GdkDeviceManager *device_manager);

Gets the GdkDisplay associated to `device_manager`.

`device_manager` : | a GdkDeviceManager
Returns : | the GdkDisplay to which `device_manager` is associated to, or NULL.

Since 3.0

### gdk_device_manager_list_devices ()

    GList *                   gdk_device_manager_list_devices
                                                            (GdkDeviceManager *device_manager,
                                                             GdkDeviceType type);

Returns the list of devices of type `type` currently attached to `device_manager`.

`device_manager` : | a GdkDeviceManager
`type` : | device type to get.
Returns : | a list of GdkDevices. The returned list must be freed with `g_list_free()`. The list elements are owned by GTK+ and must not be freed or unreffed. [transfer container][element-type Gdk.Device]

Since 3.0

### gdk_device_manager_get_client_pointer ()

    GdkDevice *               gdk_device_manager_get_client_pointer
                                                            (GdkDeviceManager *device_manager);

Returns the client pointer, that is, the master pointer that acts as the core pointer for this application. In X11, window managers may change this depending on the interaction pattern under the presence of several pointers.

You should use this function sheldomly, only in code that isn't triggered by a GdkEvent and there aren't other means to get a meaningful GdkDevice to operate on.

`device_manager` : | a GdkDeviceManager
Returns : | The client pointer.

Since 3.0

### gdk_device_get_name ()

    const gchar *       gdk_device_get_name                 (GdkDevice *device);

Determines the name of the device.

`device` : | a GdkDevice
Returns : | a name

Since 2.20

### gdk_device_set_source ()

    void                gdk_device_set_source               (GdkDevice *device,
                                                             GdkInputSource source);

Sets the source type for an input device.

`device` : | a GdkDevice.
`source` : | the source type.

### gdk_device_get_source ()

    GdkInputSource      gdk_device_get_source               (GdkDevice *device);

Determines the type of the device.

`device` : | a GdkDevice
Returns : | a GdkInputSource

Since 2.20

### gdk_device_set_mode ()

    gboolean            gdk_device_set_mode                 (GdkDevice *device,
                                                             GdkInputMode mode);

Sets a the mode of an input device. The mode controls if the device is active and whether the device's range is mapped to the entire screen or to a single window.

`device` : | a GdkDevice.
`mode` : | the input mode.
Returns : | `TRUE` if the mode was successfully changed.

### gdk_device_get_mode ()

    GdkInputMode        gdk_device_get_mode                 (GdkDevice *device);

Determines the mode of the device.

`device` : | a GdkDevice
Returns : | a GdkInputSource

Since 2.20

### gdk_device_set_key ()

    void                gdk_device_set_key                  (GdkDevice *device,
                                                             guint index_,
                                                             guint keyval,
                                                             GdkModifierType modifiers);

Specifies the X key event to generate when a macro button of a device is pressed.

`device` : | a GdkDevice
`index_` : | the index of the macro button to set
`keyval` : | the keyval to generate
`modifiers` : | the modifiers to set

### gdk_device_get_key ()

    gboolean            gdk_device_get_key                  (GdkDevice *device,
                                                             guint index_,
                                                             guint *keyval,
                                                             GdkModifierType *modifiers);

If `index_` has a valid keyval, this function will return `TRUE` and fill in `keyval` and `modifiers` with the keyval settings.

`device` : | a GdkDevice.
`index_` : | the index of the macro button to get.
`keyval` : | return value for the keyval.
`modifiers` : | return value for modifiers.
Returns : | `TRUE` if keyval is set for `index`.

Since 2.20

### gdk_device_set_axis_use ()

    void                gdk_device_set_axis_use             (GdkDevice *device,
                                                             guint index_,
                                                             GdkAxisUse use);

Specifies how an axis of a device is used.

`device` : | a GdkDevice
`index_` : | the index of the axis
`use` : | specifies how the axis is used

### gdk_device_get_axis_use ()

    GdkAxisUse          gdk_device_get_axis_use             (GdkDevice *device,
                                                             guint index_);

Returns the axis use for `index_`.

`device` : | a GdkDevice.
`index_` : | the index of the axis.
Returns : | a GdkAxisUse specifying how the axis is used.

Since 2.20

### gdk_device_get_associated_device ()

    GdkDevice *         gdk_device_get_associated_device    (GdkDevice *device);

Returns the associated device to `device`, if `device` is of type `GDK_DEVICE_TYPE_MASTER`, it will return the paired pointer or keyboard.

If `device` is of type `GDK_DEVICE_TYPE_SLAVE`, it will return the master device to which `device` is attached to.

If `device` is of type `GDK_DEVICE_TYPE_FLOATING`, `NULL` will be returned, as there is no associated device.

`device` : | a GdkDevice
Returns : | The associated device, or `NULL`

Since 3.0

### gdk_device_get_device_type ()

    GdkDeviceType       gdk_device_get_device_type          (GdkDevice *device);

Returns the device type for `device`.

`device` : | a GdkDevice
Returns : | the GdkDeviceType for `device`.

Since 3.0

### gdk_device_get_display ()

    GdkDisplay *        gdk_device_get_display              (GdkDevice *device);

Returns the GdkDisplay to which `device` pertains.

`device` : | a GdkDevice
Returns : | a GdkDisplay. This memory is owned by GTK+, and must not be freed or unreffed.

Since 3.0

### gdk_device_get_has_cursor ()

    gboolean            gdk_device_get_has_cursor           (GdkDevice *device);

Determines whether the pointer follows device motion.

`device` : | a GdkDevice
Returns : | `TRUE` if the pointer follows device motion

Since 2.20

### gdk_device_get_n_axes ()

    guint               gdk_device_get_n_axes               (GdkDevice *device);

Returns the number of axes the device currently has.

`device` : | a GdkDevice
Returns : | the number of axes.

Since 3.0

### gdk_device_grab ()

    GdkGrabStatus       gdk_device_grab                     (GdkDevice *device,
                                                             GdkWindow *window,
                                                             GdkGrabOwnership grab_ownership,
                                                             gboolean owner_events,
                                                             GdkEventMask event_mask,
                                                             GdkCursor *cursor,
                                                             guint32 time_);

Grabs the device so that all events coming from this device are passed to this application until the device is ungrabbed with `gdk_device_ungrab()`, or the window becomes unviewable. This overrides any previous grab on the device by this client.

Device grabs are used for operations which need complete control over the given device events (either pointer or keyboard). For example in GTK+ this is used for Drag and Drop operations, popup menus and such.

Note that if the event mask of an X window has selected both button press and button release events, then a button press event will cause an automatic pointer grab until the button is released. X does this automatically since most applications expect to receive button press and release events in pairs. It is equivalent to a pointer grab on the window with `owner_events` set to `TRUE`.

If you set up anything at the time you take the grab that needs to be cleaned up when the grab ends, you should handle the GdkEventGrabBroken events that are emitted when the grab ends unvoluntarily.

`device` : | a GdkDevice
`window` : | the GdkWindow which will own the grab (the grab window)
`grab_ownership` : | specifies the grab ownership.
`owner_events` : | if `FALSE` then all device events are reported with respect to `window` and are only reported if selected by `event_mask`. If `TRUE` then pointer events for this application are reported as normal, but pointer events outside this application are reported with respect to `window` and only if selected by `event_mask`. In either mode, unreported events are discarded.
`event_mask` : | specifies the event mask, which is used in accordance with `owner_events`.
`cursor` : | the cursor to display while the grab is active if the device is a pointer. If this is `NULL` then the normal cursors are used for `window` and its descendants, and the cursor for `window` is used elsewhere.
`time_` : | the timestamp of the event which led to this pointer grab. This usually comes from the GdkEvent struct, though `GDK_CURRENT_TIME` can be used if the time isn't known.
Returns : | `GDK_GRAB_SUCCESS` if the grab was successful.

Since 3.0

### gdk_device_ungrab ()

    void                gdk_device_ungrab                   (GdkDevice *device,
                                                             guint32 time_);

Release any grab on `device`.

`device` : | a GdkDevice
`time_` : | a timestap (e.g. `GDK_CURRENT_TIME`).

Since 3.0

### gdk_device_get_state ()

    void                gdk_device_get_state                (GdkDevice *device,
                                                             GdkWindow *window,
                                                             gdouble *axes,
                                                             GdkModifierType *mask);

Gets the current state of a device relative to `window`.

`device` : | a GdkDevice.
`window` : | a GdkWindow.
`axes` : | an array of doubles to store the values of the axes of `device` in, or `NULL`.
`mask` : | location to store the modifiers, or `NULL`.

### gdk_device_get_history ()

    gboolean            gdk_device_get_history              (GdkDevice *device,
                                                             GdkWindow *window,
                                                             guint32 start,
                                                             guint32 stop,
                                                             GdkTimeCoord ***events,
                                                             gint *n_events);

Obtains the motion history for a device; given a starting and ending timestamp, return all events in the motion history for the device in the given range of time. Some windowing systems do not support motion history, in which case, `FALSE` will be returned. (This is not distinguishable from the case where motion history is supported and no events were found.)

`device` : | a GdkDevice
`window` : | the window with respect to which which the event coordinates will be reported
`start` : | starting timestamp for range of events to return
`stop` : | ending timestamp for the range of events to return
`events` : | location to store a newly-allocated array of GdkTimeCoord, or `NULL`. [array length=n_events][out][transfer none]
`n_events` : | location to store the length of `events`, or `NULL`
Returns : | `TRUE` if the windowing system supports motion history and at least one event was found.

### gdk_device_free_history ()

    void                gdk_device_free_history             (GdkTimeCoord **events,
                                                             gint n_events);

Frees an array of GdkTimeCoord that was returned by `gdk_device_get_history()`.

`events` : | an array of GdkTimeCoord. [inout][transfer none]
`n_events` : | the length of the array.

### struct GdkTimeCoord

    struct GdkTimeCoord {
      guint32 time;
      gdouble axes[GDK_MAX_TIMECOORD_AXES];
    };

The GdkTimeCoord structure stores a single event in a motion history.

guint32 `time`; | The timestamp for this event.
gdouble `axes`[GDK_MAX_TIMECOORD_AXES]; | the values of the device's axes.

### gdk_device_get_axis ()

    gboolean            gdk_device_get_axis                 (GdkDevice *device,
                                                             gdouble *axes,
                                                             GdkAxisUse use,
                                                             gdouble *value);

Interprets an array of double as axis values for a given device, and locates the value in the array for a given axis use.

`device` : | a GdkDevice
`axes` : | pointer to an array of axes
`use` : | the use to look for
`value` : | location to store the found value.
Returns : | `TRUE` if the given axis use was found, otherwise `FALSE`

### gdk_device_list_axes ()

    GList *             gdk_device_list_axes                (GdkDevice *device);

Returns a GList of GdkAtoms, containing the labels for the axes that `device` currently has.

`device` : | a GdkDevice
Returns : | A GList of GdkAtoms, free with `g_list_free()`. [transfer container][element-type GdkAtom]

Since 3.0

### gdk_device_get_axis_value ()

    gboolean            gdk_device_get_axis_value           (GdkDevice *device,
                                                             gdouble *axes,
                                                             GdkAtom axis_label,
                                                             gdouble *value);

Interprets an array of double as axis values for a given device, and locates the value in the array for a given axis label, as returned by `gdk_device_list_axes()`

`device` : | a GdkDevice.
`axes` : | pointer to an array of axes
`axis_label` : | GdkAtom with the axis label.
`value` : | location to store the found value.
Returns : | `TRUE` if the given axis use was found, otherwise `FALSE`.

Since 3.0

### gdk_input_set_extension_events ()

    void                gdk_input_set_extension_events      (GdkWindow *window,
                                                             gint mask,
                                                             GdkExtensionMode mode);

### Warning

`gdk_input_set_extension_events` has been deprecated since version 3.0 and should not be used in newly-written code. Use `gdk_window_set_device_events()` instead.

Turns extension events on or off for a particular window, and specifies the event mask for extension events.

`window` : | a GdkWindow.
`mask` : | the event mask
`mode` : | the type of extension events that are desired.

### enum GdkExtensionMode

    typedef enum
    {
      GDK_EXTENSION_EVENTS_NONE,
      GDK_EXTENSION_EVENTS_ALL,
      GDK_EXTENSION_EVENTS_CURSOR
    } GdkExtensionMode;

An enumeration used to specify which extension events are desired for a particular widget.

`GDK_EXTENSION_EVENTS_NONE` | no extension events are desired.
`GDK_EXTENSION_EVENTS_ALL` | all extension events are desired.
`GDK_EXTENSION_EVENTS_CURSOR` | extension events are desired only if a cursor will be displayed for the device.

### gdk_devices_list ()

    GList *             gdk_devices_list                    (void);

### Warning

`gdk_devices_list` has been deprecated since version 3.0 and should not be used in newly-written code. Use `gdk_device_manager_list_devices()` instead.

Returns the list of available input devices for the default display. The list is statically allocated and should not be freed.

Returns : | a list of GdkDevice. [transfer none][element-type GdkDevice]

### gdk_device_get_core_pointer ()

    GdkDevice *         gdk_device_get_core_pointer         (void);

### Warning

`gdk_device_get_core_pointer` has been deprecated since version 3.0 and should not be used in newly-written code. Use `gdk_device_manager_get_client_pointer()` instead, or `gdk_event_get_device()` if a GdkEvent with pointer device information is available.

Returns the core pointer device for the default display.

Returns : | the core pointer device; this is owned by the display and should not be freed.

## Property Details

### The `"display"` property

      "display"                  GdkDisplay*           : Read / Write / Construct Only

Display for the device manager.

### The `"associated-device"` property

      "associated-device"        GdkDevice*            : Read

Associated pointer or keyboard with this device, if any. Devices of type GDK_DEVICE_TYPE_MASTER always come in keyboard/pointer pairs. Other device types will have a `NULL` associated device.

Since 3.0

### The `"device-manager"` property

      "device-manager"           GdkDeviceManager*     : Read / Write / Construct Only

The GdkDeviceManager the GdkDevice pertains to.

Since 3.0

### The `"display"` property

      "display"                  GdkDisplay*           : Read / Write / Construct Only

The GdkDisplay the GdkDevice pertains to.

Since 3.0

### The `"has-cursor"` property

      "has-cursor"               gboolean              : Read / Write / Construct Only

Whether the device is represented by a cursor on the screen. Devices of type `GDK_DEVICE_TYPE_MASTER` will have `TRUE` here.

Default value: FALSE

Since 3.0

### The `"input-mode"` property

      "input-mode"               GdkInputMode          : Read / Write

Input mode for the device.

Default value: GDK_MODE_DISABLED

Since 3.0

### The `"input-source"` property

      "input-source"             GdkInputSource        : Read / Write / Construct Only

Source type for the device.

Default value: GDK_SOURCE_MOUSE

Since 3.0

### The `"n-axes"` property

      "n-axes"                   guint                 : Read

Number of axes in the device.

Default value: 0

Since 3.0

### The `"name"` property

      "name"                     gchar*                : Read / Write / Construct Only

The device name.

Default value: NULL

Since 3.0

### The `"type"` property

      "type"                     GdkDeviceType         : Read / Write / Construct Only

Device role in the device manager.

Default value: GDK_DEVICE_TYPE_MASTER

Since 3.0

## Signal Details

### The `"device-added"` signal

    void                user_function                      (GdkDeviceManager *device_manager,
                                                            GdkDevice        *device,
                                                            gpointer          user_data)           : Run Last

The ::device-added signal is emitted either when a new master pointer is created, or when a slave (Hardware) input device is plugged in.

`device_manager` : | the object on which the signal is emitted
`device` : | the newly added GdkDevice.
`user_data` : | user data set when the signal handler was connected.

### The `"device-changed"` signal

    void                user_function                      (GdkDeviceManager *device_manager,
                                                            GdkDevice        *device,
                                                            gpointer          user_data)           : Run Last

The ::device-changed signal is emitted either when some GdkDevice has changed the number of either axes or keys. For example In X this will normally happen when the slave device routing events through the master device changes, in that case the master device will change to reflect the new slave device axes and keys.

`device_manager` : | the object on which the signal is emitted
`device` : | the GdkDevice that changed.
`user_data` : | user data set when the signal handler was connected.

### The `"device-removed"` signal

    void                user_function                      (GdkDeviceManager *device_manager,
                                                            GdkDevice        *device,
                                                            gpointer          user_data)           : Run Last

The ::device-removed signal is emitted either when a master pointer is removed, or when a slave (Hardware) input device is unplugged.

`device_manager` : | the object on which the signal is emitted
`device` : | the just removed GdkDevice.
`user_data` : | user data set when the signal handler was connected.

## See Also

GdkDevice, GdkEvent, `gdk_enable_multidevice()`

[1] GDK_MOTION_NOTIFY GDK_BUTTON_PRESS GDK_2BUTTON_PRESS GDK_3BUTTON_PRESS GDK_BUTTON_RELEASE GDK_SCROLL GDK_KEY_PRESS GDK_KEY_RELEASE GDK_ENTER_NOTIFY GDK_LEAVE_NOTIFY GDK_FOCUS_CHANGE GDK_PROXIMITY_IN GDK_PROXIMITY_OUT GDK_DRAG_ENTER GDK_DRAG_LEAVE GDK_DRAG_MOTION GDK_DRAG_STATUS GDK_DROP_START GDK_DROP_FINISHED GDK_GRAB_BROKEN