Class: Gdk::Device

Inherits:
Object
  • Object
show all
Extended by:
GLib::Deprecatable
Defined in:
lib/gdk3/deprecated.rb

Overview

The GdkDevice object represents an input device, such as a keyboard, a mouse, or a touchpad.

See the [classGdk.Seat] documentation for more information about the various kinds of devices, and their relationships.

Direct Known Subclasses

GdkX11::X11DeviceXI2

Instance Method Summary collapse

Instance Method Details

#caps_lock_stateBoolean

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

This is only relevant for keyboard devices.

Returns:

  • (Boolean)

    true if Caps Lock is on for device

#caps_lock_state=(caps_lock_state) ⇒ Boolean

Whether Caps Lock is on.

This is only relevant for keyboard devices.

Parameters:

  • caps_lock_state (Boolean)

Returns:

  • (Boolean)

    caps-lock-state

  • (Boolean)

    caps-lock-state

#caps_lock_state?Boolean

Whether Caps Lock is on.

This is only relevant for keyboard devices.

Returns:

  • (Boolean)

    caps-lock-state

#device_toolGdk::DeviceTool

Retrieves the current tool for device.

Returns:

#directionPango::Direction

The direction of the current layout.

This is only relevant for keyboard devices.

Returns:

  • (Pango::Direction)

    direction

#direction=(direction) ⇒ Pango::Direction

The direction of the current layout.

This is only relevant for keyboard devices.

Parameters:

  • direction (Pango::Direction)

Returns:

  • (Pango::Direction)

    direction

  • (Pango::Direction)

    direction

#displayGdk::Display

The GdkDisplay the GdkDevice pertains to.

Returns:

#display=(display) ⇒ Gdk::Display

The GdkDisplay the GdkDevice pertains to.

Parameters:

Returns:

#get_surface_at_position(win_x, win_y) ⇒ Gdk::Surface

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

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

Parameters:

  • win_x (Float)

    return location for the X coordinate of the device location relative to the surface origin

  • win_y (Float)

    return location for the Y coordinate of the device location relative to the surface origin

Returns:

  • (Gdk::Surface)

    the GdkSurface under the device position

#has_bidi_layoutsBoolean

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:

  • (Boolean)

    true if there are layouts with both directions, false otherwise

#has_bidi_layouts=(has_bidi_layouts) ⇒ Boolean

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

This is only relevant for keyboard devices.

Parameters:

  • has_bidi_layouts (Boolean)

Returns:

  • (Boolean)

    has-bidi-layouts

  • (Boolean)

    has-bidi-layouts

#has_bidi_layouts?Boolean

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

This is only relevant for keyboard devices.

Returns:

  • (Boolean)

    has-bidi-layouts

#has_cursorBoolean

Determines whether the pointer follows device motion.

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

Returns:

  • (Boolean)

    true if the pointer follows device motion

#has_cursor=(has_cursor) ⇒ Boolean

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

Parameters:

  • has_cursor (Boolean)

Returns:

  • (Boolean)

    has-cursor

  • (Boolean)

    has-cursor

#has_cursor?Boolean

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

Returns:

  • (Boolean)

    has-cursor

#modifier_stateGdk::ModifierType

The current modifier state of the device.

This is only relevant for keyboard devices.

Returns:

#modifier_state=(modifier_state) ⇒ Gdk::ModifierType

The current modifier state of the device.

This is only relevant for keyboard devices.

Parameters:

Returns:

#n_axesInteger

Number of axes in the device.

Returns:

  • (Integer)

    n-axes

#n_axes=(n_axes) ⇒ Integer

Number of axes in the device.

Parameters:

  • n_axes (Integer)

Returns:

  • (Integer)

    n-axes

  • (Integer)

    n-axes

#nameString

The device name.

Returns:

  • (String)

    name

#name=(name) ⇒ String

The device name.

Parameters:

  • name (String)

Returns:

  • (String)

    name

  • (String)

    name

#num_lock_stateBoolean

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

This is only relevant for keyboard devices.

Returns:

  • (Boolean)

    true if Num Lock is on for device

#num_lock_state=(num_lock_state) ⇒ Boolean

Whether Num Lock is on.

This is only relevant for keyboard devices.

Parameters:

  • num_lock_state (Boolean)

Returns:

  • (Boolean)

    num-lock-state

  • (Boolean)

    num-lock-state

#num_lock_state?Boolean

Whether Num Lock is on.

This is only relevant for keyboard devices.

Returns:

  • (Boolean)

    num-lock-state

#num_touchesInteger

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.

Returns:

  • (Integer)

    num-touches

#num_touches=(num_touches) ⇒ Integer

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.

Parameters:

  • num_touches (Integer)

Returns:

  • (Integer)

    num-touches

  • (Integer)

    num-touches

#product_idString

Product ID of this device.

See [methodGdk.Device.get_product_id].

Returns:

  • (String)

    product-id

#product_id=(product_id) ⇒ String

Product ID of this device.

See [methodGdk.Device.get_product_id].

Parameters:

  • product_id (String)

Returns:

  • (String)

    product-id

  • (String)

    product-id

#scroll_lock_stateBoolean

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

This is only relevant for keyboard devices.

Returns:

  • (Boolean)

    true if Scroll Lock is on for device

#scroll_lock_state=(scroll_lock_state) ⇒ Boolean

Whether Scroll Lock is on.

This is only relevant for keyboard devices.

Parameters:

  • scroll_lock_state (Boolean)

Returns:

  • (Boolean)

    scroll-lock-state

  • (Boolean)

    scroll-lock-state

#scroll_lock_state?Boolean

Whether Scroll Lock is on.

This is only relevant for keyboard devices.

Returns:

  • (Boolean)

    scroll-lock-state

#seatGdk::Seat

GdkSeat of this device.

Returns:

#seat=(seat) ⇒ Gdk::Seat

GdkSeat of this device.

Parameters:

Returns:

#sourceGdk::InputSource

Source type for the device.

Returns:

#source=(source) ⇒ Gdk::InputSource

Source type for the device.

Parameters:

Returns:

#timestampInteger

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

Returns:

  • (Integer)

    the timestamp of the last activity for this device

#toolGdk::DeviceTool

The GdkDeviceTool that is currently used with this device.

Returns:

#tool=(tool) ⇒ Gdk::DeviceTool

The GdkDeviceTool that is currently used with this device.

Parameters:

Returns:

#vendor_idString

Vendor ID of this device.

See [methodGdk.Device.get_vendor_id].

Returns:

  • (String)

    vendor-id

#vendor_id=(vendor_id) ⇒ String

Vendor ID of this device.

See [methodGdk.Device.get_vendor_id].

Parameters:

  • vendor_id (String)

Returns:

  • (String)

    vendor-id

  • (String)

    vendor-id