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

Functions for handling input devices. More...

#include <gdkmm/devicemanager.h>

Inherits Glib::Object.

Public Member Functions

 DeviceManager (DeviceManager && src) noexcept
 
DeviceManageroperator= (DeviceManager && src) noexcept
 
 ~DeviceManager () noexcept override
 
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...
 

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

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

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

static 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
typeDevice 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
typeDevice 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 Function Documentation

◆ wrap()

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.