# Gdk::Device Class Reference

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

Inherits Glib::Object.

Collaboration diagram for Gdk::Device:
[legend]

List of all members.

## Public Member Functions
virtual | ~Device ()
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.
void | set_source (InputSource source)
bool | set_mode (InputMode mode)
void | get_key (guint index_, guint& keyval, ModifierType& modifiers) const
| If index has a valid keyval, this function will fill in keyval and modifiers with the keyval settings.
void | set_key (guint index_, guint keyval, ModifierType modifiers)
AxisUse | get_axis_use (guint index_) const
| Returns the axis use for index.
void | set_axis_use (guint index_, AxisUse use)
void | get_state (const Glib::RefPtr< Window >& window, double& axes, ModifierType& mask)
| Gets the current state of a device.
bool | get_history (const Glib::RefPtr< Window >& window, guint32 start, guint32 stop, GdkTimeCoord**& events, int& 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.
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::ustring | get_name () const
| Determines the name of the device.
InputSource | get_source () const
| Determines the type of the device.
InputMode | get_mode () const
| Determines the mode of the device.
bool | get_has_cursor () const
| Determines whether the pointer follows device motion.
gint | get_n_axes () const
| Gets the number of axes of a device.
## Protected Member Functions
| Device ()
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gdk::Device > | wrap (GdkDevice* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

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

## Constructor & Destructor Documentation

virtual Gdk::Device::~Device | ( |  | ) | `[virtual]`

Gdk::Device::Device | ( |  | ) | `[protected]`

## Member Function Documentation

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

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

Returns the axis use for index.

Since gtkmm 2.22:

Parameters:

  | index | The index of the axis.

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

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

Determines whether the pointer follows device motion.

Since gtkmm 2.22:

Returns:
  `true` if the pointer follows device motion.

bool Gdk::Device::get_history | ( | const Glib::RefPtr< Window >& | window,
|  | guint32 | start,
|  | guint32 | stop,
|  | GdkTimeCoord **& | events,
|  | int & | 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.)

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.
  | events | Location to store a newly-allocated array of Gdk::TimeCoord, or `0`.
  | n_events | Location to store the length of events, or `0`.

Returns:
  `true` if the windowing system supports motion history and at least one event was found.

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

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

Since gtkmm 2.22:

Parameters:

  | index | The index of the macro button to get.
  | keyval | Return value for the keyval.
  | modifiers | Return value for modifiers.

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

Determines the mode of the device.

Since gtkmm 2.22:

Returns:
  A Gdk::InputSource.

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

Gets the number of axes of a device.

Since gtkmm 2.22:

Returns:
  The number of axes of device.

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

Determines the name of the device.

Since gtkmm 2.22:

Returns:
  A name.

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

Determines the type of the device.

Since gtkmm 2.22:

Returns:
  A Gdk::InputSource.

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

Gets the current state of a device.

Parameters:

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

const GdkDevice* Gdk::Device::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdkDevice* Gdk::Device::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

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.

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

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

bool Gdk::Device::set_mode | ( | InputMode | mode | ) |

void Gdk::Device::set_source | ( | InputSource | source | ) |

## Friends And Related Function Documentation

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.

The documentation for this class was generated from the following file:

- gdkmm/device.h