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

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

#include <gdkmm/device.h>

Inheritance diagram for Gdk::Device:
Inheritance graph
[legend]

Public Member Functions

 Device (Device && src) noexcept
 
Deviceoperator= (Device && src) noexcept
 
 ~Device () noexcept override
 
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.
 
Glib::ustring get_name () const
 The name of the device, suitable for showing in a user interface.
 
bool get_has_cursor () const
 Determines whether the pointer follows device motion.
 
InputSource get_source () const
 Determines the type of the device.
 
Glib::RefPtr< Displayget_display ()
 Returns the Gdk::Display to which device pertains.
 
Glib::RefPtr< const Displayget_display () const
 Returns the Gdk::Display to which device pertains.
 
Glib::RefPtr< Surfaceget_surface_at_position (double & win_x, double & win_y)
 Obtains the surface underneath device, returning the location of the device in win_x and win_y.
 
Glib::RefPtr< const Surfaceget_surface_at_position (double & win_x, double & win_y) const
 Obtains the surface underneath device, returning the location of the device in win_x and win_y.
 
Glib::RefPtr< Surfaceget_surface_at_position ()
 Obtains the surface underneath the device.
 
Glib::RefPtr< const Surfaceget_surface_at_position () const
 Obtains the surface underneath the device.
 
Glib::ustring get_vendor_id () const
 Returns the vendor ID of this device.
 
Glib::ustring get_product_id ()
 Returns the product ID of this device.
 
Glib::RefPtr< Seatget_seat ()
 Returns the Gdk::Seat the device belongs to.
 
Glib::RefPtr< const Seatget_seat () const
 Returns the Gdk::Seat the device belongs to.
 
guint get_num_touches () const
 Retrieves the number of touch points associated to device.
 
Glib::RefPtr< DeviceToolget_device_tool ()
 Retrieves the current tool for device.
 
Glib::RefPtr< const DeviceToolget_device_tool () const
 Retrieves the current tool for device.
 
bool get_caps_lock_state () const
 Retrieves whether the Caps Lock modifier of the keyboard is locked.
 
bool get_num_lock_state () const
 Retrieves whether the Num Lock modifier of the keyboard is locked.
 
bool get_scroll_lock_state () const
 Retrieves whether the Scroll Lock modifier of the keyboard is locked.
 
ModifierType get_modifier_state () const
 Retrieves the current modifier state of the keyboard.
 
Pango::Direction get_direction () const
 Returns the direction of effective layout of the keyboard.
 
bool has_bidi_layouts () const
 Determines if layouts for both right-to-left and left-to-right languages are in use on the keyboard.
 
guint32 get_timestamp () const
 Returns the timestamp of the last activity for this device.
 
bool has_device_pad () const
 Checks if this Device instance is a DeviceWithPad.
 
Glib::RefPtr< DeviceWithPaddevice_with_pad_cast ()
 Casts this Device instance to a DeviceWithPad, if possible.
 
Glib::RefPtr< const DeviceWithPaddevice_with_pad_cast () const
 Casts this Device instance to a DeviceWithPad, if possible.
 
Glib::SignalProxy< void()> signal_changed ()
 
Glib::SignalProxy< void(const Glib::RefPtr< DeviceTool > &)> signal_tool_changed ()
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > property_display () const
 The Gdk::Display the Gdk::Device pertains to.
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_name () const
 The device name.
 
Glib::PropertyProxy_ReadOnly< InputSourceproperty_source () const
 Source type for the device.
 
Glib::PropertyProxy_ReadOnly< bool > property_has_cursor () const
 Whether the device is represented by a cursor on the screen.
 
Glib::PropertyProxy_ReadOnly< guint > property_n_axes () const
 Number of axes in the device.
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_vendor_id () const
 Vendor ID of this device.
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_product_id () const
 Product ID of this device.
 
Glib::PropertyProxy< Glib::RefPtr< Seat > > property_seat ()
 Gdk::Seat of this device.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Seat > > property_seat () const
 Gdk::Seat of this device.
 
Glib::PropertyProxy_ReadOnly< guint > property_num_touches () const
 The maximal number of concurrent touches on a touch device.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< DeviceTool > > property_tool () const
 The Gdk::DeviceTool that is currently used with this device.
 
Glib::PropertyProxy_ReadOnly< Pango::Direction > property_direction () const
 The direction of the current layout.
 
Glib::PropertyProxy_ReadOnly< bool > property_has_bidi_layouts () const
 Whether the device has both right-to-left and left-to-right layouts.
 
Glib::PropertyProxy_ReadOnly< bool > property_caps_lock_state () const
 Whether Caps Lock is on.
 
Glib::PropertyProxy_ReadOnly< bool > property_num_lock_state () const
 Whether Num Lock is on.
 
Glib::PropertyProxy_ReadOnly< bool > property_scroll_lock_state () const
 Whether Scroll Lock is on.
 
Glib::PropertyProxy_ReadOnly< ModifierTypeproperty_modifier_state () const
 The current modifier state of the device.
 

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

 Device ()
 

Related Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gdk::Devicewrap (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

◆ Device() [1/2]

Gdk::Device::Device ( Device &&  src)
noexcept

◆ ~Device()

Gdk::Device::~Device ( )
overridenoexcept

◆ Device() [2/2]

Gdk::Device::Device ( )
protected

Member Function Documentation

◆ device_with_pad_cast() [1/2]

Glib::RefPtr< DeviceWithPad > Gdk::Device::device_with_pad_cast ( )

Casts this Device instance to a DeviceWithPad, if possible.

Returns
A DeviceWithPad pointer, or an empty Glib::RefPtr if this Device can't be dynamic_cast to a DeviceWithPad.
Since gtkmm 3.96:

◆ device_with_pad_cast() [2/2]

Glib::RefPtr< const DeviceWithPad > Gdk::Device::device_with_pad_cast ( ) const

Casts this Device instance to a DeviceWithPad, if possible.

Returns
A DeviceWithPad pointer, or an empty Glib::RefPtr if this Device can't be dynamic_cast to a DeviceWithPad.
Since gtkmm 3.96:

◆ get_caps_lock_state()

bool Gdk::Device::get_caps_lock_state ( ) const

Retrieves whether the Caps Lock modifier of the keyboard is locked.

This is only relevant for keyboard devices.

Returns
true if Caps Lock is on for device.

◆ get_device_tool() [1/2]

Glib::RefPtr< DeviceTool > Gdk::Device::get_device_tool ( )

Retrieves the current tool for device.

Returns
The Gdk::DeviceTool.

◆ get_device_tool() [2/2]

Glib::RefPtr< const DeviceTool > Gdk::Device::get_device_tool ( ) const

Retrieves the current tool for device.

Returns
The Gdk::DeviceTool.

◆ get_direction()

Pango::Direction Gdk::Device::get_direction ( ) const

Returns the direction of effective layout of the keyboard.

This is only relevant for keyboard devices.

The direction of a layout is the direction of the majority of its symbols. See pango_unichar_direction().

Returns
Pango::Direction::LTR or Pango::Direction::RTL if it can determine the direction. Pango::Direction::NEUTRAL otherwise.

◆ get_display() [1/2]

Glib::RefPtr< Display > Gdk::Device::get_display ( )

Returns the Gdk::Display to which device pertains.

Returns
A Gdk::Display.

◆ get_display() [2/2]

Glib::RefPtr< const Display > Gdk::Device::get_display ( ) const

Returns the Gdk::Display to which device pertains.

Returns
A Gdk::Display.

◆ get_has_cursor()

bool Gdk::Device::get_has_cursor ( ) const

Determines whether the pointer follows device motion.

This is not meaningful for keyboard devices, which don't have a pointer.

Returns
true if the pointer follows device motion.

◆ get_modifier_state()

ModifierType Gdk::Device::get_modifier_state ( ) const

Retrieves the current modifier state of the keyboard.

This is only relevant for keyboard devices.

Returns
The current modifier state.

◆ get_name()

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

The name of the device, suitable for showing in a user interface.

Returns
A name.

◆ get_num_lock_state()

bool Gdk::Device::get_num_lock_state ( ) const

Retrieves whether the Num Lock modifier of the keyboard is locked.

This is only relevant for keyboard devices.

Returns
true if Num Lock is on for device.

◆ get_num_touches()

guint Gdk::Device::get_num_touches ( ) const

Retrieves the number of touch points associated to device.

Returns
The number of touch points.

◆ get_product_id()

Glib::ustring Gdk::Device::get_product_id ( )

Returns the product ID of this device.

This ID is retrieved from the device, and does not change. See get_vendor_id() for more information.

Returns
The product ID.

◆ get_scroll_lock_state()

bool Gdk::Device::get_scroll_lock_state ( ) const

Retrieves whether the Scroll Lock modifier of the keyboard is locked.

This is only relevant for keyboard devices.

Returns
true if Scroll Lock is on for device.

◆ get_seat() [1/2]

Glib::RefPtr< Seat > Gdk::Device::get_seat ( )

Returns the Gdk::Seat the device belongs to.

Returns
A Gdk::Seat.

◆ get_seat() [2/2]

Glib::RefPtr< const Seat > Gdk::Device::get_seat ( ) const

Returns the Gdk::Seat the device belongs to.

Returns
A Gdk::Seat.

◆ get_source()

InputSource Gdk::Device::get_source ( ) const

Determines the type of the device.

Returns
A Gdk::InputSource.

◆ get_surface_at_position() [1/4]

Glib::RefPtr< Surface > Gdk::Device::get_surface_at_position ( )

Obtains the surface underneath the device.

Returns an empty RefPtr if the surface tree under the device is not known to GDK (for example, belongs to another application).

Since gtkmm 3.0:
Returns
The Gdk::Surface under the device position.

◆ get_surface_at_position() [2/4]

Glib::RefPtr< const Surface > Gdk::Device::get_surface_at_position ( ) const

Obtains the surface underneath the device.

Returns an empty RefPtr if the surface tree under the device is not known to GDK (for example, belongs to another application).

Since gtkmm 3.0:
Returns
The Gdk::Surface under the device position.

◆ get_surface_at_position() [3/4]

Glib::RefPtr< Surface > Gdk::Device::get_surface_at_position ( double &  win_x,
double &  win_y 
)

Obtains the surface underneath device, returning the location of the device in win_x and win_y.

Parameters
win_xReturn location for the X coordinate of the device location relative to the surface origin.
win_yReturn location for the Y coordinate of the device location relative to the surface origin.
Returns
The Gdk::Surface under the device position.

◆ get_surface_at_position() [4/4]

Glib::RefPtr< const Surface > Gdk::Device::get_surface_at_position ( double &  win_x,
double &  win_y 
) const

Obtains the surface underneath device, returning the location of the device in win_x and win_y.

Parameters
win_xReturn location for the X coordinate of the device location relative to the surface origin.
win_yReturn location for the Y coordinate of the device location relative to the surface origin.
Returns
The Gdk::Surface under the device position.

◆ get_timestamp()

guint32 Gdk::Device::get_timestamp ( ) const

Returns the timestamp of the last activity for this device.

In practice, this means the timestamp of the last event that was received from the OS for this device. (GTK may occasionally produce events for a device that are not received from the OS, and will not update the timestamp).

Since gtkmm 4.2:
Returns
The timestamp of the last activity for this device.

◆ get_type()

static GType Gdk::Device::get_type ( )
static

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

◆ get_vendor_id()

Glib::ustring Gdk::Device::get_vendor_id ( ) const

Returns the vendor ID of this device.

This ID is retrieved from the device, and does not change.

This function, together with get_product_id(), can be used to eg. compose Gio::Settings paths to store settings for this device.

[C example ellipted]

Returns
The vendor ID.

◆ gobj() [1/2]

GdkDevice * Gdk::Device::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GdkDevice * Gdk::Device::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

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.

◆ has_bidi_layouts()

bool Gdk::Device::has_bidi_layouts ( ) const

Determines if layouts for both right-to-left and left-to-right languages are in use on the keyboard.

This is only relevant for keyboard devices.

Returns
true if there are layouts with both directions, false otherwise.

◆ has_device_pad()

bool Gdk::Device::has_device_pad ( ) const

Checks if this Device instance is a DeviceWithPad.

The underlying C object is usually a subclass of GdkDevice. If that subclass implements the GdkDevicePad interface, this C++ Gdk::Device instance is a Gdk::DeviceWithPad instance, and can be cast to a Gdk::DeviceWithPad by device_with_pad_cast().

Returns
true if this instance is a DeviceWithPad.
Since gtkmm 3.96:

◆ operator=()

Device & Gdk::Device::operator= ( Device &&  src)
noexcept

◆ property_caps_lock_state()

Glib::PropertyProxy_ReadOnly< bool > Gdk::Device::property_caps_lock_state ( ) const

Whether Caps Lock is on.

This is only relevant for keyboard devices.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_direction()

Glib::PropertyProxy_ReadOnly< Pango::Direction > Gdk::Device::property_direction ( ) const

The direction of the current layout.

This is only relevant for keyboard devices.

Default value: Pango::Direction::NEUTRAL

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_display()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > Gdk::Device::property_display ( ) const

The Gdk::Display the Gdk::Device pertains to.

Since gtkmm 3.22:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_has_bidi_layouts()

Glib::PropertyProxy_ReadOnly< bool > Gdk::Device::property_has_bidi_layouts ( ) const

Whether the device has both right-to-left and left-to-right layouts.

This is only relevant for keyboard devices.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_has_cursor()

Glib::PropertyProxy_ReadOnly< bool > Gdk::Device::property_has_cursor ( ) const

Whether the device is represented by a cursor on the screen.

Since gtkmm 3.22:

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_modifier_state()

Glib::PropertyProxy_ReadOnly< ModifierType > Gdk::Device::property_modifier_state ( ) const

The current modifier state of the device.

This is only relevant for keyboard devices.

Default value: Gdk::ModifierType::NO_MODIFIER_MASK

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_n_axes()

Glib::PropertyProxy_ReadOnly< guint > Gdk::Device::property_n_axes ( ) const

Number of axes in the device.

Since gtkmm 3.22:

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_name()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gdk::Device::property_name ( ) const

The device name.

Since gtkmm 3.22:

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_num_lock_state()

Glib::PropertyProxy_ReadOnly< bool > Gdk::Device::property_num_lock_state ( ) const

Whether Num Lock is on.

This is only relevant for keyboard devices.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_num_touches()

Glib::PropertyProxy_ReadOnly< guint > Gdk::Device::property_num_touches ( ) const

The maximal number of concurrent touches on a touch device.

Will be 0 if the device is not a touch device or if the number of touches is unknown.

Since gtkmm 3.22:

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_product_id()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gdk::Device::property_product_id ( ) const

Product ID of this device.

See Gdk::Device::get_product_id().

Since gtkmm 3.22:

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_scroll_lock_state()

Glib::PropertyProxy_ReadOnly< bool > Gdk::Device::property_scroll_lock_state ( ) const

Whether Scroll Lock is on.

This is only relevant for keyboard devices.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_seat() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Seat > > Gdk::Device::property_seat ( )

Gdk::Seat of this device.

Since gtkmm 3.22:
Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_seat() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Seat > > Gdk::Device::property_seat ( ) const

Gdk::Seat of this device.

Since gtkmm 3.22:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_source()

Glib::PropertyProxy_ReadOnly< InputSource > Gdk::Device::property_source ( ) const

Source type for the device.

Since gtkmm 3.22:

Default value: Gdk::InputSource::MOUSE

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_tool()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< DeviceTool > > Gdk::Device::property_tool ( ) const

The Gdk::DeviceTool that is currently used with this device.

Since gtkmm 3.94:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_vendor_id()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gdk::Device::property_vendor_id ( ) const

Vendor ID of this device.

See Gdk::Device::get_vendor_id().

Since gtkmm 3.22:

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ signal_changed()

Glib::SignalProxy< void()> Gdk::Device::signal_changed ( )
Slot Prototype:
void on_my_changed()

Flags: Run Last

Emitted either when the number of either axes or keys changes.

On X11 this will normally happen when the physical device routing events through the logical device changes (for example, user switches from the USB mouse to a tablet); in that case the logical device will change to reflect the axes and keys on the new physical device.

Since gtkmm 3.22:

◆ signal_tool_changed()

Glib::SignalProxy< void(const Glib::RefPtr< DeviceTool > &)> Gdk::Device::signal_tool_changed ( )
Slot Prototype:
void on_my_tool_changed(const Glib::RefPtr<DeviceTool>& tool)

Flags: Run Last

Emitted on pen/eraser devices whenever tools enter or leave proximity.

Since gtkmm 3.94:
Parameters
toolThe new current tool.

Friends And Related Symbol Documentation

◆ wrap()

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