gtkmm: Gdk::DeviceManager Class Reference

Functions for handling input devices. More...

#include <gdkmm/devicemanager.h>

Inheritance diagram for Gdk::DeviceManager:

Public Member Functions

 DeviceManager (DeviceManager&& src) noexcept
 
DeviceManageroperator= (DeviceManager&& src) noexcept
 
 ~DeviceManager () noexceptoverride
 
GdkDeviceManager* gobj ()
 Provides access to the underlying C GObject. More...

 
const GdkDeviceManager* gobj () const
 Provides access to the underlying C GObject. More...

 
GdkDeviceManager* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
Glib::RefPtr< Displayget_display ()
 Gets the Gdk::Display associated to device_manager. More...

 
Glib::RefPtr< const Displayget_display () const
 Gets the Gdk::Display associated to device_manager. More...

 
std::vector< Glib::RefPtr< Device > > list_devices (DeviceType type)
 Returns the list of devices of type type currently attached to device_manager. More...

 
std::vector< Glib::RefPtr< const Device > > list_devices (DeviceType type) const
 Returns the list of devices of type type currently attached to device_manager. More...

 
Glib::RefPtr< Deviceget_client_pointer ()
 Returns the client pointer, that is, the master pointer that acts as the core pointer for this application. More...

 
Glib::RefPtr< const Deviceget_client_pointer () const
 Returns the client pointer, that is, the master pointer that acts as the core pointer for this application. More...

 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (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::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (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 ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (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. More...

 

Protected Member Functions

 DeviceManager ()
 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
 ~Object () noexceptoverride
 
- 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
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gdk::DeviceManagerwrap (GdkDeviceManager* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

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

Gdk::DeviceManager::DeviceManager ( DeviceManager&&  src)
noexcept
Gdk::DeviceManager::~DeviceManager ( )
overridenoexcept
Gdk::DeviceManager::DeviceManager ( )
protected

Member Function Documentation

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.
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.
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.
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.
static GType Gdk::DeviceManager::get_type ( )
static

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

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

Provides access to the underlying C GObject.

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

Provides access to the underlying C GObject.

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.

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
typeDevice type to get.
Returns
A list of Gdk::Devices. The list elements are owned by GTK+ and must not be freed or unreffed.
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
typeDevice type to get.
Returns
A list of Gdk::Devices. The list elements are owned by GTK+ and must not be freed or unreffed.
DeviceManager& Gdk::DeviceManager::operator= ( DeviceManager&&  src)
noexcept

Friends And Related Function Documentation

Glib::RefPtr< Gdk::DeviceManager > wrap ( GdkDeviceManager *  object,
bool  take_copy = false 
)
related

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

Parameters
objectThe C instance.
take_copyFalse 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.