gtkmm: Gdk::DeviceManager Class Reference

gtkmm 3.24.11

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

Functions for handling input devices. More...

`#include <gdkmm/devicemanager.h>`

Inheritance diagram for Gdk::DeviceManager:
[legend]

## Public Member Functions
| DeviceManager (DeviceManager && src) noexcept
DeviceManager & | operator= (DeviceManager && src) noexcept
| ~DeviceManager () noexcept override
GdkDeviceManager * | gobj ()
| Provides access to the underlying C GObject.
const GdkDeviceManager * | gobj () const
| Provides access to the underlying C GObject.
GdkDeviceManager * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< Display > | get_display ()
| Gets the Gdk::Display associated to device_manager.
Glib::RefPtr< const Display > | get_display () const
| Gets the Gdk::Display associated to device_manager.
std::vector< Glib::RefPtr< Device > > | list_devices (DeviceType type)
| Returns the list of devices of type type currently attached to device_manager.
std::vector< Glib::RefPtr< const Device > > | list_devices (DeviceType type) const
| Returns the list of devices of type type currently attached to device_manager.
Glib::RefPtr< Device > | get_client_pointer ()
| Returns the client pointer, that is, the master pointer that acts as the core pointer for this application.
Glib::RefPtr< const Device > | get_client_pointer () const
| Returns the client pointer, that is, the master pointer that acts as the core pointer for this application.
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
| DeviceManager ()
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::DeviceManager > | wrap (GdkDeviceManager * 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

Functions for handling input devices.

In addition to a single pointer and keyboard for user interface input, GDK contains support for a variety of input devices, including graphics tablets, touchscreens and multiple pointers/keyboards interacting simultaneously with the user interface. Under X, the support for multiple input devices is done through the XInput 2 extension, which also supports additional features such as sub-pixel positioning information and additional device-dependent information.

By default, and if the platform supports it, GDK is aware of multiple keyboard/pointer pairs and multitouch devices, this behavior can be changed by calling gdk_disable_multidevice() before Gdk::Display::open(), although there would rarely be a reason to do that. For a widget or window to be dealt as multipointer aware, Gdk::Window::set_support_multidevice() or Gtk::Widget::set_support_multidevice() must have been called on it.

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 have no visible cursor on the screen.

Virtual devices are always paired, so 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 Gdk::Device for all events coming from input devices,

Events containing device information are 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 and GDK_GRAB_BROKEN.

Although gdk_window_set_support_multidevice() must be called on #GdkWindows 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 method 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::Devie::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 Gdk::Device::property_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 Gdk::DeviceManager. On X11, multidevice support is implemented through XInput 2. Unless gdk_disable_multidevice() is called, the XInput 2.x Gdk::DeviceManager implementation will be used as the input source. Otherwise either the core or XInput 1.x implementations will be used.

In gtkmm 3.20, a new Gdk::Seat object has been introduced that supersedes Gdk::DeviceManager and should be preferred in newly written code.

Since gtkmm 3.0

## Constructor & Destructor Documentation

## ◆ DeviceManager() [1/2]

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

## ◆ ~DeviceManager()

Gdk::DeviceManager::~DeviceManager | ( |  | ) |
| overridenoexcept

## ◆ DeviceManager() [2/2]

Gdk::DeviceManager::DeviceManager | ( |  | ) |
| protected

## Member Function Documentation

## ◆ get_client_pointer() [1/2]

Glib::RefPtr< Device > Gdk::DeviceManager::get_client_pointer | ( |  | ) |

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 seldomly, only in code that isn’t triggered by a Gdk::Event and there aren’t other means to get a meaningful Gdk::Device to operate on.

Since gtkmm 3.0

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

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

Returns
  The client pointer. This memory is owned by GDK and must not be freed or unreferenced.

## ◆ get_client_pointer() [2/2]

Glib::RefPtr< const Device > Gdk::DeviceManager::get_client_pointer | ( |  | ) | const

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 seldomly, only in code that isn’t triggered by a Gdk::Event and there aren’t other means to get a meaningful Gdk::Device to operate on.

Since gtkmm 3.0

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

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

Returns
  The client pointer. This memory is owned by GDK and must not be freed or unreferenced.

## ◆ get_display() [1/2]

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

Gets the Gdk::Display associated to device_manager.

Since gtkmm 3.0

Returns
  The Gdk::Display to which device_manager is associated to, or nullptr. This memory is owned by GDK and must not be freed or unreferenced.

## ◆ get_display() [2/2]

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

Gets the Gdk::Display associated to device_manager.

Since gtkmm 3.0

Returns
  The Gdk::Display to which device_manager is associated to, or nullptr. This memory is owned by GDK and must not be freed or unreferenced.

## ◆ get_type()

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

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

## ◆ gobj() [1/2]

GdkDeviceManager * Gdk::DeviceManager::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GdkDeviceManager * Gdk::DeviceManager::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GdkDeviceManager * Gdk::DeviceManager::gobj_copy | ( |  | ) |

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

## ◆ list_devices() [1/2]

std::vector< Glib::RefPtr< Device > > Gdk::DeviceManager::list_devices | ( | DeviceType | type | ) |

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

Since gtkmm 3.0

Deprecated: 3.20, use Gdk::Seat::get_pointer(), Gdk::Seat::get_keyboard() and Gdk::Seat::get_slaves() instead.

Deprecated
  Use Gdk::Seat::get_pointer(), Gdk::Seat::get_keyboard() and Gdk::Seat::get_slaves() instead.

Parameters

  type | Device type to get.

Returns
  A list of Gdk::Devices. The list elements are owned by GTK+ and must not be freed or unreffed.

## ◆ list_devices() [2/2]

std::vector< Glib::RefPtr< const Device > > Gdk::DeviceManager::list_devices | ( | DeviceType | type | ) | const

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

Since gtkmm 3.0

Deprecated: 3.20, use Gdk::Seat::get_pointer(), Gdk::Seat::get_keyboard() and Gdk::Seat::get_slaves() instead.

Deprecated
  Use Gdk::Seat::get_pointer(), Gdk::Seat::get_keyboard() and Gdk::Seat::get_slaves() instead.

Parameters

  type | Device type to get.

Returns
  A list of Gdk::Devices. The list elements are owned by GTK+ and must not be freed or unreffed.

## ◆ operator=()

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

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gdk::DeviceManager > wrap | ( | GdkDeviceManager * | 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.