Class Device

All Implemented Interfaces:
PointerInterface

public class Device extends Object
The `GdkDevice` object represents an input device, such
as a keyboard, a mouse, or a touchpad.

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

https://docs.gtk.org/gdk4/class.Device.html

  • Field Details

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getCapsLockState

      public boolean getCapsLockState()
      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
    • getDeviceTool

      public DeviceTool getDeviceTool()
      Retrieves the current tool for @device.
      Returns:
      the `GdkDeviceTool`
    • getDirection

      public int getDirection()
      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 [func@Pango.unichar_direction].
      Returns:
      %PANGO_DIRECTION_LTR or %PANGO_DIRECTION_RTL if it can determine the direction. %PANGO_DIRECTION_NEUTRAL otherwise
    • getDisplay

      public Display getDisplay()
      Returns the `GdkDisplay` to which @device pertains.
      Returns:
      a `GdkDisplay`
    • getHasCursor

      public boolean getHasCursor()
      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
    • getModifierState

      public int getModifierState()
      Retrieves the current modifier state of the keyboard.

      This is only relevant for keyboard devices.
      Returns:
      the current modifier state
    • getName

      public Str getName()
      The name of the device, suitable for showing in a user interface.
      Returns:
      a name
    • getNumLockState

      public boolean getNumLockState()
      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
    • getNumTouches

      public int getNumTouches()
      Retrieves the number of touch points associated to @device.
      Returns:
      the number of touch points
    • getProductId

      public Str getProductId()
      Returns the product ID of this device.

      This ID is retrieved from the device, and does not change.
      See [method@Gdk.Device.get_vendor_id] for more information.
      Returns:
      the product ID
    • getScrollLockState

      public boolean getScrollLockState()
      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
    • getSeat

      public Seat getSeat()
      Returns the `GdkSeat` the device belongs to.
      Returns:
      a `GdkSeat`
    • getSource

      public int getSource()
      Determines the type of the device.
      Returns:
      a `GdkInputSource`
    • getTimestamp

      public int getTimestamp()
      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:
      the timestamp of the last activity for this device
    • getVendorId

      public Str getVendorId()
      Returns the vendor ID of this device.

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

      This function, together with [method@Gdk.Device.get_product_id],
      can be used to eg. compose `GSettings` paths to store settings
      for this device.

      ```c
      static GSettings *
      get_device_settings (GdkDevice *device)
      {
      const char *vendor, *product;
      GSettings *settings;
      GdkDevice *device;
      char *path;

      vendor = gdk_device_get_vendor_id (device);
      product = gdk_device_get_product_id (device);

      path = g_strdup_printf ("/org/example/app/devices/%s:%s/", vendor, product);
      settings = g_settings_new_with_path (DEVICE_SCHEMA, path);
      g_free (path);

      return settings;
      }
      ```
      Returns:
      the vendor ID
    • hasBidiLayouts

      public boolean hasBidiLayouts()
      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
    • onChanged

      public SignalHandler onChanged(Device.OnChanged signal)
      Connect to signal "changed".
      See Device.OnChanged.onChanged() for signal description.
      Field SIGNAL_ON_CHANGED contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onToolChanged

      public SignalHandler onToolChanged(Device.OnToolChanged signal)
      Connect to signal "tool-changed".
      See Device.OnToolChanged.onToolChanged(ch.bailu.gtk.gdk.DeviceTool) for signal description.
      Field SIGNAL_ON_TOOL_CHANGED contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()