Public Member Functions | Protected Member Functions | Related Functions

Gdk::DeviceManager Class Reference

Functions for handling input devices. More...

Inheritance diagram for Gdk::DeviceManager:
Inheritance graph
[legend]
Collaboration diagram for Gdk::DeviceManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~DeviceManager ()
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< Displayget_display ()
Glib::RefPtr< const Displayget_display () const
std::vector< Glib::RefPtr
< Device > > 
list_devices (DeviceType type)
std::vector< Glib::RefPtr
< const Device > > 
list_devices (DeviceType type) const
Glib::RefPtr< Deviceget_client_pointer ()
Glib::RefPtr< const Deviceget_client_pointer () const

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.

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.

Since gtkmm 3.0:

Constructor & Destructor Documentation

virtual Gdk::DeviceManager::~DeviceManager (  ) [virtual]
Gdk::DeviceManager::DeviceManager (  ) [protected]

Member Function Documentation

Glib::RefPtr<Device> Gdk::DeviceManager::get_client_pointer (  )
Glib::RefPtr<const Device> Gdk::DeviceManager::get_client_pointer (  ) const
Glib::RefPtr<const Display> Gdk::DeviceManager::get_display (  ) const
Glib::RefPtr<Display> Gdk::DeviceManager::get_display (  )
const GdkDeviceManager* Gdk::DeviceManager::gobj (  ) const [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

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

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

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<const Device> > Gdk::DeviceManager::list_devices ( DeviceType  type ) const
std::vector< Glib::RefPtr<Device> > Gdk::DeviceManager::list_devices ( DeviceType  type )

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.

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