Trait gdk4::prelude::DeviceExt[][src]

pub trait DeviceExt: 'static {
Show 31 methods fn is_caps_locked(&self) -> bool;
fn device_tool(&self) -> Option<DeviceTool>;
fn direction(&self) -> Direction;
fn display(&self) -> Option<Display>;
fn has_cursor(&self) -> bool;
fn modifier_state(&self) -> ModifierType;
fn name(&self) -> Option<GString>;
fn is_num_locked(&self) -> bool;
fn num_touches(&self) -> u32;
fn product_id(&self) -> Option<GString>;
fn is_scroll_locked(&self) -> bool;
fn seat(&self) -> Option<Seat>;
fn source(&self) -> InputSource;
fn surface_at_position(&self) -> (Option<Surface>, f64, f64);
fn timestamp(&self) -> u32;
fn vendor_id(&self) -> Option<GString>;
fn has_bidi_layouts(&self) -> bool;
fn n_axes(&self) -> u32;
fn set_seat<P: IsA<Seat>>(&self, seat: Option<&P>);
fn tool(&self) -> Option<DeviceTool>;
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_tool_changed<F: Fn(&Self, &DeviceTool) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_caps_lock_state_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_direction_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_has_bidi_layouts_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_modifier_state_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_n_axes_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_num_lock_state_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_scroll_lock_state_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_seat_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_tool_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
}
Expand description

Trait containing all Device methods.

Implementors

DevicePad, Device

Required methods

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 self

Retrieves the current tool for self.

Returns

the DeviceTool

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

Returns

pango::Direction::Ltr or pango::Direction::Rtl if it can determine the direction. pango::Direction::Neutral otherwise

Returns the Display to which self pertains.

Returns

a Display

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

Retrieves the current modifier state of the keyboard.

This is only relevant for keyboard devices.

Returns

the current modifier state

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

Returns

a name

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 self

Retrieves the number of touch points associated to self.

Returns

the number of touch points

Returns the product ID of this device.

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

Returns

the product ID

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 self

Returns the Seat the device belongs to.

Returns

a Seat

Determines the type of the device.

Returns

a InputSource

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

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

Returns

the Surface under the device position

win_x

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

win_y

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

This is supported on crate feature v4_2 only.

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

Returns the vendor ID of this device.

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

This function, together with product_id(), can be used to eg. compose GSettings paths to store settings for this device.

⚠️ The following code is in 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

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

Number of axes in the device.

Seat of this device.

The DeviceTool that is currently used with this device.

Emitted either when the 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.

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

tool

The new current tool

Implementors