gtkmm: Gdk::Device Class Reference

gtkmm 3.24.8

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gdk::Device Class Reference

A Gdk::Device instance contains a detailed description of an extended input device. More...

`#include <gdkmm/device.h>`

Inheritance diagram for Gdk::Device:
[legend]

## Public Member Functions
| Device (Device && src) noexcept
Device & | operator= (Device && src) noexcept
| ~Device () noexcept override
GdkDevice * | gobj ()
| Provides access to the underlying C GObject.
const GdkDevice * | gobj () const
| Provides access to the underlying C GObject.
GdkDevice * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::ustring | get_name () const
| Determines the name of the device.
bool | get_has_cursor () const
| Determines whether the pointer follows device motion.
InputSource | get_source () const
| Determines the type of the device.
InputMode | get_mode () const
| Determines the mode of the device.
bool | set_mode (InputMode mode)
| Sets a the mode of an input device.
int | get_n_keys () const
| Returns the number of keys the device currently has.
bool | get_key (guint index_, guint & keyval, ModifierType & modifiers) const
| If index has a valid keyval, this function will return `true` and fill in keyval and modifiers with the keyval settings.
void | set_key (guint index_, guint keyval, ModifierType modifiers)
| Specifies the X key event to generate when a macro button of a device is pressed.
AxisUse | get_axis_use (guint index_) const
| Returns the axis use for index.
void | set_axis_use (guint index_, AxisUse use)
| Specifies how an axis of a device is used.
void | get_state (const Glib::RefPtr< Window > & window, double & axes, ModifierType &mask)
| Gets the current state of a pointer device relative to window.
std::vector< TimeCoord > | get_history (const Glib::RefPtr< Window > & window, guint32 start, guint32 stop) const
| Obtains the motion history for a device.
std::vector< Glib::RefPtr< Gdk::Device > > | list_slave_devices ()
| If the device if of type Gdk::DEVICE_TYPE_MASTER, it will return the list of slave devices attached to it, otherwise it will return `nullptr`
int | get_n_axes () const
| Returns the number of axes the device currently has.
std::vector< std::string > | list_axes () const
| Returns the labels for the axes that the device currently has.
bool | get_axis_value (double & axes, GdkAtom axis_label, double & value) const
| 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 list_axes()
bool | get_axis (double & axes, AxisUse use, double & value) const
| Interprets an array of double as axis values for a given device, and locates the value in the array for a given axis use.
Glib::RefPtr< Display > | get_display ()
| Returns the Gdk::Display to which device pertains.
Glib::RefPtr< const Display > | get_display () const
| Returns the Gdk::Display to which device pertains.
Glib::RefPtr< Device > | get_associated_device ()
| Returns the associated device to device, if device is of type Gdk::DEVICE_TYPE_MASTER, it will return the paired pointer or keyboard.
Glib::RefPtr< const Device > | get_associated_device () const
| Returns the associated device to device, if device is of type Gdk::DEVICE_TYPE_MASTER, it will return the paired pointer or keyboard.
DeviceType | get_device_type () const
| Returns the device type for device.
GrabStatus | grab (const Glib::RefPtr< Window > & window, GrabOwnership grab_ownership, bool owner_events, EventMask event_mask, const Glib::RefPtr< Cursor > & 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 ungrab(), or the window becomes unviewable.
GrabStatus | grab (const Glib::RefPtr< Window > & window, GrabOwnership grab_ownership, bool owner_events, EventMask event_mask, guint32 time_)
| See the grab() method which takes more parameters.
void | ungrab (guint32 time_)
| Release any grab on device.
void | warp (const Glib::RefPtr< Screen > & screen, int x, int y)
| Warps device in display to the point x, y on the screen screen, unless the device is confined to a window by a grab, in which case it will be moved as far as allowed by the grab.
void | get_position (int & x, int & y) const
| Gets the current location of the device.
void | get_position (Glib::RefPtr< Screen > & screen, int & x, int & y) const
| Gets the current location of device.
void | get_position (double & x, double & y) const
| Gets the current location of the device in double precision.
void | get_position (Glib::RefPtr< Screen > & screen, double & x, double & y) const
| Gets the current location of the device in double precision.
Glib::RefPtr< Window > | get_window_at_position (int & win_x, int & win_y)
| Obtains the window underneath device, returning the location of the device in win_x and win_y.
Glib::RefPtr< const Window > | get_window_at_position (int & win_x, int & win_y) const
| Obtains the window underneath device, returning the location of the device in win_x and win_y.
Glib::RefPtr< Window > | get_window_at_position ()
| Obtains the window underneath the device.
Glib::RefPtr< const Window > | get_window_at_position () const
| Obtains the window underneath the device.
Glib::RefPtr< Window > | get_last_event_window ()
| Gets information about which window the given pointer device is in, based on events that have been received so far from the display server.
Glib::RefPtr< const Window > | get_last_event_window () const
| Gets information about which window the given pointer device is in, based on events that have been received so far from the display server.
Glib::ustring | get_vendor_id () const
| Returns the vendor ID of this device, or `nullptr` if this information couldn't be obtained.
Glib::ustring | get_product_id ()
| Returns the product ID of this device, or `nullptr` if this information couldn't be obtained.
Glib::RefPtr< Seat > | get_seat ()
| Returns the Gdk::Seat the device belongs to.
Glib::RefPtr< const Seat > | get_seat () const
| Returns the Gdk::Seat the device belongs to.
AxisFlags | get_axes () const
| Returns the axes currently available on the device.
Glib::SignalProxy< void > | signal_changed ()
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > | property_display () const
| The Gdk::Display the Gdk::Device pertains to.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_name () const
| The device name.
Glib::PropertyProxy_ReadOnly< DeviceType > | property_type () const
| Device role in the device manager.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Device > > | property_associated_device () const
| Associated pointer or keyboard with this device, if any.
Glib::PropertyProxy_ReadOnly< InputSource > | property_input_source () const
| Source type for the device.
Glib::PropertyProxy< InputMode > | property_input_mode ()
| Input mode for the device.
Glib::PropertyProxy_ReadOnly< InputMode > | property_input_mode () const
| Input mode for the device.
Glib::PropertyProxy_ReadOnly< bool > | property_has_cursor () const
| Whether the device is represented by a cursor on the screen.
Glib::PropertyProxy_ReadOnly< guint > | property_n_axes () const
| Number of axes in the device.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_vendor_id () const
| Vendor ID of this device, see Gdk::Device::get_vendor_id().
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_product_id () const
| Product ID of this device, see Gdk::Device::get_product_id().
Glib::PropertyProxy< Glib::RefPtr< Seat > > | property_seat ()
| Gdk::Seat of this device.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Seat > > | property_seat () const
| Gdk::Seat of this device.
Glib::PropertyProxy_ReadOnly< guint > | property_num_touches () const
| The maximal number of concurrent touches on a touch device.
Glib::PropertyProxy_ReadOnly< AxisFlags > | property_axes () const
| The axes currently available for this device.
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, sigc::slot< void > &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Member Functions
| Device ()
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gdk::Device > | wrap (GdkDevice * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

A Gdk::Device instance contains a detailed description of an extended input device.

Key values are the codes which are sent whenever a key is pressed or released. The complete list of key values can be found in the gdk/gdkkeysyms.h header file. They are prefixed with `GDK_KEY_`.

## Constructor & Destructor Documentation

## ◆ Device() [1/2]

Gdk::Device::Device | ( | Device && | src | ) |
| noexcept

## ◆ ~Device()

Gdk::Device::~Device | ( |  | ) |
| overridenoexcept

## ◆ Device() [2/2]

Gdk::Device::Device | ( |  | ) |
| protected

## Member Function Documentation

## ◆ get_associated_device() [1/2]

Glib::RefPtr< Device > Gdk::Device::get_associated_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, `nullptr` will be returned, as there is no associated device.

Since gtkmm 3.0:

Returns
  The associated device, or `nullptr`.

## ◆ get_associated_device() [2/2]

Glib::RefPtr< const Device > Gdk::Device::get_associated_device | ( |  | ) | const

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, `nullptr` will be returned, as there is no associated device.

Since gtkmm 3.0:

Returns
  The associated device, or `nullptr`.

## ◆ get_axes()

AxisFlags Gdk::Device::get_axes | ( |  | ) | const

Returns the axes currently available on the device.

Since gtkmm 3.22:

## ◆ get_axis()

bool Gdk::Device::get_axis | ( | double & | axes,
|  | AxisUse | use,
|  | double & | value
| ) |  | const

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

Parameters

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

## ◆ get_axis_use()

AxisUse Gdk::Device::get_axis_use | ( | guint | index_ | ) | const

Returns the axis use for index.

Since gtkmm 2.20:

Parameters

  index | The index of the axis.

Returns
  A Gdk::AxisUse specifying how the axis is used.

## ◆ get_axis_value()

bool Gdk::Device::get_axis_value | ( | double & | axes,
|  | GdkAtom | axis_label,
|  | double & | value
| ) |  | const

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

Since gtkmm 3.0:

Parameters

  axes | Pointer to an array of axes.
  axis_label | Gdk::Atom with the axis label.
  value | Location to store the found value.

Returns
  `true` if the given axis use was found, otherwise `false`.

## ◆ get_device_type()

DeviceType Gdk::Device::get_device_type | ( |  | ) | const

Returns the device type for device.

Since gtkmm 3.0:

Returns
  The Gdk::DeviceType for device.

## ◆ get_display() [1/2]

Glib::RefPtr< Display > Gdk::Device::get_display | ( |  | ) |

Returns the Gdk::Display to which device pertains.

Since gtkmm 3.0:

Returns
  A Gdk::Display. This memory is owned by GTK+, and must not be freed or unreffed.

## ◆ get_display() [2/2]

Glib::RefPtr< const Display > Gdk::Device::get_display | ( |  | ) | const

Returns the Gdk::Display to which device pertains.

Since gtkmm 3.0:

Returns
  A Gdk::Display. This memory is owned by GTK+, and must not be freed or unreffed.

## ◆ get_has_cursor()

bool Gdk::Device::get_has_cursor | ( |  | ) | const

Determines whether the pointer follows device motion.

This is not meaningful for keyboard devices, which don't have a pointer.

Since gtkmm 2.20:

Returns
  `true` if the pointer follows device motion.

## ◆ get_history()

std::vector< TimeCoord > Gdk::Device::get_history | ( | const Glib::RefPtr< Window > & | window,
|  | guint32 | start,
|  | guint32 | stop
| ) |  | const

Obtains the motion history for a device.

Given a starting and ending timestamp, this will 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.)

Parameters

  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.

Returns
  A vector of TimeCoord.

## ◆ get_key()

bool Gdk::Device::get_key | ( | guint | index_,
|  | guint & | keyval,
|  | ModifierType & | modifiers
| ) |  | const

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

Since gtkmm 2.20:

Parameters

  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.

## ◆ get_last_event_window() [1/2]

Glib::RefPtr< Window > Gdk::Device::get_last_event_window | ( |  | ) |

Gets information about which window the given pointer device is in, based on events that have been received so far from the display server.

If another application has a pointer grab, or this application has a grab with owner_events = `false`, `nullptr` may be returned even if the pointer is physically over one of this application's windows.

Since gtkmm 3.12:

Returns
  The last window the device.

## ◆ get_last_event_window() [2/2]

Glib::RefPtr< const Window > Gdk::Device::get_last_event_window | ( |  | ) | const

Gets information about which window the given pointer device is in, based on events that have been received so far from the display server.

If another application has a pointer grab, or this application has a grab with owner_events = `false`, `nullptr` may be returned even if the pointer is physically over one of this application's windows.

Since gtkmm 3.12:

Returns
  The last window the device.

## ◆ get_mode()

InputMode Gdk::Device::get_mode | ( |  | ) | const

Determines the mode of the device.

Since gtkmm 2.20:

Returns
  A Gdk::InputSource.

## ◆ get_n_axes()

int Gdk::Device::get_n_axes | ( |  | ) | const

Returns the number of axes the device currently has.

Since gtkmm 3.0:

Returns
  The number of axes.

## ◆ get_n_keys()

int Gdk::Device::get_n_keys | ( |  | ) | const

Returns the number of keys the device currently has.

Since gtkmm 2.24:

Returns
  The number of keys.

## ◆ get_name()

Glib::ustring Gdk::Device::get_name | ( |  | ) | const

Determines the name of the device.

Since gtkmm 2.20:

Returns
  A name.

## ◆ get_position() [1/4]

void Gdk::Device::get_position | ( | double & | x,
|  | double & | y
| ) |  | const

Gets the current location of the device in double precision.

As a slave device coordinates are those of its master pointer, this function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them. See grab().

Parameters

  x | This will contain the root window X coordinate of the device.
  y | This will contain the root window X coordinate of the device.

Since gtkmm 3.10:

## ◆ get_position() [2/4]

void Gdk::Device::get_position | ( | Glib::RefPtr< Screen > & | screen,
|  | double & | x,
|  | double & | y
| ) |  | const

Gets the current location of the device in double precision.

As a slave device coordinates are those of its master pointer, this function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them. See grab().

Parameters

  screen | This will contain the screen that the device is on.
  x | This will contain the root window X coordinate of the device.
  y | This will contain the root window X coordinate of the device.

Since gtkmm 3.10:

## ◆ get_position() [3/4]

void Gdk::Device::get_position | ( | Glib::RefPtr< Screen > & | screen,
|  | int & | x,
|  | int & | y
| ) |  | const

Gets the current location of device.

As a slave device coordinates are those of its master pointer, this function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them. See grab().

Parameters

  screen | This will contain the screen that the device is on.
  x | This will contain the root window X coordinate of the device.
  y | This will contain the root window X coordinate of the device.

## ◆ get_position() [4/4]

void Gdk::Device::get_position | ( | int & | x,
|  | int & | y
| ) |  | const

Gets the current location of the device.

As a slave device coordinates are those of its master pointer, this function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them. See grab().

Parameters

  x | This will contain the root window X coordinate of the device.
  y | This will contain the root window X coordinate of the device.

## ◆ get_product_id()

Glib::ustring Gdk::Device::get_product_id | ( |  | ) |

Returns the product ID of this device, or `nullptr` if this information couldn't be obtained.

This ID is retrieved from the device, and is thus constant for it. See get_vendor_id() for more information.

Since gtkmm 3.16:

Returns
  The product ID, or `nullptr`.

## ◆ get_seat() [1/2]

Glib::RefPtr< Seat > Gdk::Device::get_seat | ( |  | ) |

Returns the Gdk::Seat the device belongs to.

Since gtkmm 3.20:

Returns
  A Gdk::Seat. This memory is owned by GTK+ and must not be freed.

## ◆ get_seat() [2/2]

Glib::RefPtr< const Seat > Gdk::Device::get_seat | ( |  | ) | const

Returns the Gdk::Seat the device belongs to.

Since gtkmm 3.20:

Returns
  A Gdk::Seat. This memory is owned by GTK+ and must not be freed.

## ◆ get_source()

InputSource Gdk::Device::get_source | ( |  | ) | const

Determines the type of the device.

Since gtkmm 2.20:

Returns
  A Gdk::InputSource.

## ◆ get_state()

void Gdk::Device::get_state | ( | const Glib::RefPtr< Window > & | window,
|  | double & | axes,
|  | ModifierType & | mask
| ) |  |

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

As a slave device’s coordinates are those of its master pointer, this function may not be called on devices of type Gdk::DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them. See grab().

Parameters

  window | A Gdk::Window.
  axes | An array of doubles to store the values of the axes of device in, or `nullptr`.
  mask | Location to store the modifiers, or `nullptr`.

## ◆ get_type()

static GType Gdk::Device::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_vendor_id()

Glib::ustring Gdk::Device::get_vendor_id | ( |  | ) | const

Returns the vendor ID of this device, or `nullptr` if this information couldn't be obtained.

This ID is retrieved from the device, and is thus constant for it.

This function, together with get_product_id(), can be used to eg. compose Gio::Settings paths to store settings for this device.

[C example ellipted]

Since gtkmm 3.16:

Returns
  The vendor ID, or `nullptr`.

## ◆ get_window_at_position() [1/4]

Glib::RefPtr< Window > Gdk::Device::get_window_at_position | ( |  | ) |

Obtains the window underneath the device.

Returns an empty RefPtr if the window tree under the device is not known to GDK (for example, belongs to another application).

As a slave device coordinates are those of its master pointer, This function may not be called on devices of type Gdk::DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them. See grab().

Since gtkmm 3.0:

Returns
  The Gdk::Window under the device position.

## ◆ get_window_at_position() [2/4]

Glib::RefPtr< const Window > Gdk::Device::get_window_at_position | ( |  | ) | const

Obtains the window underneath the device.

Returns an empty RefPtr if the window tree under the device is not known to GDK (for example, belongs to another application).

As a slave device coordinates are those of its master pointer, This function may not be called on devices of type Gdk::DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them. See grab().

Since gtkmm 3.0:

Returns
  The Gdk::Window under the device position.

## ◆ get_window_at_position() [3/4]

Glib::RefPtr< Window > Gdk::Device::get_window_at_position | ( | int & | win_x,
|  | int & | win_y
| ) |  |

Obtains the window underneath device, returning the location of the device in win_x and win_y.

Returns `nullptr` if the window tree under device is not known to GDK (for example, belongs to another application).

As a slave device coordinates are those of its master pointer, This function may not be called on devices of type Gdk::DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them, see grab().

Since gtkmm 3.0:

Parameters

  win_x | Return location for the X coordinate of the device location, relative to the window origin, or `nullptr`.
  win_y | Return location for the Y coordinate of the device location, relative to the window origin, or `nullptr`.

Returns
  The Gdk::Window under the device position, or `nullptr`.

## ◆ get_window_at_position() [4/4]

Glib::RefPtr< const Window > Gdk::Device::get_window_at_position | ( | int & | win_x,
|  | int & | win_y
| ) |  | const

Obtains the window underneath device, returning the location of the device in win_x and win_y.

Returns `nullptr` if the window tree under device is not known to GDK (for example, belongs to another application).

As a slave device coordinates are those of its master pointer, This function may not be called on devices of type Gdk::DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them, see grab().

Since gtkmm 3.0:

Parameters

  win_x | Return location for the X coordinate of the device location, relative to the window origin, or `nullptr`.
  win_y | Return location for the Y coordinate of the device location, relative to the window origin, or `nullptr`.

Returns
  The Gdk::Window under the device position, or `nullptr`.

## ◆ gobj() [1/2]

GdkDevice * Gdk::Device::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GdkDevice * Gdk::Device::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GdkDevice * Gdk::Device::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ grab() [1/2]

GrabStatus Gdk::Device::grab | ( | const Glib::RefPtr< Window > & | window,
|  | GrabOwnership | grab_ownership,
|  | bool | owner_events,
|  | EventMask | event_mask,
|  | const Glib::RefPtr< Cursor > & | 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 ungrab(), or the window becomes unviewable.

This overrides any previous grab on the device by this client.

Note that device and window need to be on the same display.

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 Gdk::EventGrabBroken events that are emitted when the grab ends unvoluntarily.

Since gtkmm 3.0:

Deprecated: 3.20. Use Gdk::Seat::grab() instead.

Deprecated:
  Use Gdk::Seat::grab() instead.

Parameters

  window | The Gdk::Window 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 `nullptr` 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 Gdk::Event struct, though GDK_CURRENT_TIME can be used if the time isn’t known.

Returns
  Gdk::GRAB_SUCCESS if the grab was successful.

## ◆ grab() [2/2]

GrabStatus Gdk::Device::grab | ( | const Glib::RefPtr< Window > & | window,
|  | GrabOwnership | grab_ownership,
|  | bool | owner_events,
|  | EventMask | event_mask,
|  | guint32 | time_
| ) |  |

See the grab() method which takes more parameters.

Deprecated:
  Use Gdk::Seat::grab() instead.

## ◆ list_axes()

std::vector< std::string > Gdk::Device::list_axes | ( |  | ) | const

Returns the labels for the axes that the device currently has.

Since gtkmm 3.4:

## ◆ list_slave_devices()

std::vector< Glib::RefPtr< Gdk::Device > > Gdk::Device::list_slave_devices | ( |  | ) |

If the device if of type Gdk::DEVICE_TYPE_MASTER, it will return the list of slave devices attached to it, otherwise it will return `nullptr`

Returns
  The list of slave devices, or `nullptr`.

## ◆ operator=()

Device & Gdk::Device::operator= | ( | Device && | src | ) |
| noexcept

## ◆ property_associated_device()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Device > > Gdk::Device::property_associated_device | ( |  | ) | const

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 `nullptr` associated device.

Since gtkmm 3.22:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_axes()

Glib::PropertyProxy_ReadOnly< AxisFlags > Gdk::Device::property_axes | ( |  | ) | const

The axes currently available for this device.

Since gtkmm 3.22:

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_display()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > Gdk::Device::property_display | ( |  | ) | const

The Gdk::Display the Gdk::Device pertains to.

Since gtkmm 3.22:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_has_cursor()

Glib::PropertyProxy_ReadOnly< bool > Gdk::Device::property_has_cursor | ( |  | ) | const

Whether the device is represented by a cursor on the screen.

Devices of type Gdk::DEVICE_TYPE_MASTER will have `true` here.

Since gtkmm 3.22:

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_input_mode() [1/2]

Glib::PropertyProxy< InputMode > Gdk::Device::property_input_mode | ( |  | ) |

Input mode for the device.

Since gtkmm 3.22:

Default value: Gdk::MODE_DISABLED

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_input_mode() [2/2]

Glib::PropertyProxy_ReadOnly< InputMode > Gdk::Device::property_input_mode | ( |  | ) | const

Input mode for the device.

Since gtkmm 3.22:

Default value: Gdk::MODE_DISABLED

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_input_source()

Glib::PropertyProxy_ReadOnly< InputSource > Gdk::Device::property_input_source | ( |  | ) | const

Source type for the device.

Since gtkmm 3.22:

Default value: Gdk::SOURCE_MOUSE

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_n_axes()

Glib::PropertyProxy_ReadOnly< guint > Gdk::Device::property_n_axes | ( |  | ) | const

Number of axes in the device.

Since gtkmm 3.22:

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_name()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gdk::Device::property_name | ( |  | ) | const

The device name.

Since gtkmm 3.22:

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_num_touches()

Glib::PropertyProxy_ReadOnly< guint > Gdk::Device::property_num_touches | ( |  | ) | const

The maximal number of concurrent touches on a touch device.

Will be 0 if the device is not a touch device or if the number of touches is unknown.

Since gtkmm 3.22:

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_product_id()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gdk::Device::property_product_id | ( |  | ) | const

Product ID of this device, see Gdk::Device::get_product_id().

Since gtkmm 3.22:

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_seat() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Seat > > Gdk::Device::property_seat | ( |  | ) |

Gdk::Seat of this device.

Since gtkmm 3.22:

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_seat() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Seat > > Gdk::Device::property_seat | ( |  | ) | const

Gdk::Seat of this device.

Since gtkmm 3.22:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_type()

Glib::PropertyProxy_ReadOnly< DeviceType > Gdk::Device::property_type | ( |  | ) | const

Device role in the device manager.

Since gtkmm 3.22:

Default value: Gdk::DEVICE_TYPE_MASTER

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_vendor_id()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gdk::Device::property_vendor_id | ( |  | ) | const

Vendor ID of this device, see Gdk::Device::get_vendor_id().

Since gtkmm 3.22:

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ set_axis_use()

void Gdk::Device::set_axis_use | ( | guint | index_,
|  | AxisUse | use
| ) |  |

Specifies how an axis of a device is used.

Parameters

  index | The index of the axis.
  use | Specifies how the axis is used.

## ◆ set_key()

void Gdk::Device::set_key | ( | guint | index_,
|  | guint | keyval,
|  | ModifierType | modifiers
| ) |  |

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

Parameters

  index | The index of the macro button to set.
  keyval | The keyval to generate.
  modifiers | The modifiers to set.

## ◆ set_mode()

bool Gdk::Device::set_mode | ( | InputMode | 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.

Note
  This is only meaningful for floating devices, master devices (and slaves connected to these) drive the pointer cursor, which is not limited by the input mode.

Parameters

  mode | The input mode.

Returns
  `true` if the mode was successfully changed.

## ◆ signal_changed()

Glib::SignalProxy< void > Gdk::Device::signal_changed | ( |  | ) |

Slot Prototype:
  `void on_my_changed()`

Flags: Run Last

The signal_changed() signal is emitted either when the Gdk::Device 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 (for example, user switches from the USB mouse to a tablet), in that case the master device will change to reflect the new slave device axes and keys.

Since gtkmm 3.22:

## ◆ ungrab()

void Gdk::Device::ungrab | ( | guint32 | time_ | ) |

Release any grab on device.

Since gtkmm 3.0:

Deprecated: 3.20. Use Gdk::Seat::ungrab() instead.

Deprecated:
  Use Gdk::Seat::ungrab() instead.

Parameters

  time | A timestap (e.g. GDK_CURRENT_TIME).

## ◆ warp()

void Gdk::Device::warp | ( | const Glib::RefPtr< Screen > & | screen,
|  | int | x,
|  | int | y
| ) |  |

Warps device in display to the point x, y on the screen screen, unless the device is confined to a window by a grab, in which case it will be moved as far as allowed by the grab.

Warping the pointer creates events as if the user had moved the mouse instantaneously to the destination.

Note that the pointer should normally be under the control of the user. This function was added to cover some rare use cases like keyboard navigation support for the color picker in the Gtk::ColorSelectionDialog.

Since gtkmm 3.0:

Parameters

  screen | The screen to warp device to.
  x | The X coordinate of the destination.
  y | The Y coordinate of the destination.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gdk::Device > wrap | ( | GdkDevice * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.