Skip to main content

DeviceExt

Trait DeviceExt 

Source
pub trait DeviceExt: IsA<Device> + 'static {
Show 43 methods // Provided methods fn associated_device(&self) -> Option<Device> { ... } fn axes(&self) -> AxisFlags { ... } fn axis_use(&self, index_: u32) -> AxisUse { ... } fn device_type(&self) -> DeviceType { ... } fn display(&self) -> Display { ... } fn has_cursor(&self) -> bool { ... } fn key(&self, index_: u32) -> Option<(u32, ModifierType)> { ... } fn last_event_window(&self) -> Option<Window> { ... } fn mode(&self) -> InputMode { ... } fn n_axes(&self) -> i32 { ... } fn n_keys(&self) -> i32 { ... } fn name(&self) -> Option<GString> { ... } fn position(&self) -> (Screen, i32, i32) { ... } fn position_double(&self) -> (Screen, f64, f64) { ... } fn product_id(&self) -> Option<GString> { ... } fn seat(&self) -> Option<Seat> { ... } fn source(&self) -> InputSource { ... } fn vendor_id(&self) -> Option<GString> { ... } fn window_at_position(&self) -> (Option<Window>, i32, i32) { ... } fn window_at_position_double(&self) -> (Option<Window>, f64, f64) { ... } fn list_axes(&self) -> Vec<Atom> { ... } fn list_slave_devices(&self) -> Vec<Device> { ... } fn set_axis_use(&self, index_: u32, use_: AxisUse) { ... } fn set_key(&self, index_: u32, keyval: u32, modifiers: ModifierType) { ... } fn set_mode(&self, mode: InputMode) -> bool { ... } fn warp(&self, screen: &Screen, x: i32, y: i32) { ... } fn device_manager(&self) -> Option<DeviceManager> { ... } fn input_mode(&self) -> InputMode { ... } fn set_input_mode(&self, input_mode: InputMode) { ... } fn input_source(&self) -> InputSource { ... } fn num_touches(&self) -> u32 { ... } fn set_seat<P: IsA<Seat>>(&self, seat: Option<&P>) { ... } fn tool(&self) -> Option<DeviceTool> { ... } fn type_(&self) -> DeviceType { ... } 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_associated_device_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_axes_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_input_mode_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_n_axes_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 { ... } fn connect_type_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all Device methods.

§Implementors

DevicePad, Device

Provided Methods§

Source

fn associated_device(&self) -> Option<Device>

Returns the associated device to self, if self is of type DeviceType::Master, it will return the paired pointer or keyboard.

If self is of type DeviceType::Slave, it will return the master device to which self is attached to.

If self is of type DeviceType::Floating, None will be returned, as there is no associated device.

§Returns

The associated device, or None

Source

fn axes(&self) -> AxisFlags

Returns the axes currently available on the device.

Source

fn axis_use(&self, index_: u32) -> AxisUse

Returns the axis use for index_.

§index_

the index of the axis.

§Returns

a AxisUse specifying how the axis is used.

Source

fn device_type(&self) -> DeviceType

Returns the device type for self.

§Returns

the DeviceType for self.

Source

fn display(&self) -> Display

Returns the Display to which self pertains.

§Returns

a Display. This memory is owned by GTK+, and must not be freed or unreffed.

Source

fn has_cursor(&self) -> bool

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

Source

fn key(&self, index_: u32) -> Option<(u32, ModifierType)>

If index_ has a valid keyval, this function will return true and fill in keyval and modifiers with the keyval settings.

§index_

the index of the macro button to get.

§Returns

true if keyval is set for index.

§keyval

return value for the keyval.

§modifiers

return value for modifiers.

Source

fn last_event_window(&self) -> Option<Window>

Gets information about which window the given pointer device is in, based on events that have been received so far from the display server. If another application has a pointer grab, or this application has a grab with owner_events = false, None may be returned even if the pointer is physically over one of this application’s windows.

§Returns

the last window the device

Source

fn mode(&self) -> InputMode

Determines the mode of the device.

§Returns

a InputSource

Source

fn n_axes(&self) -> i32

Returns the number of axes the device currently has.

§Returns

the number of axes.

Source

fn n_keys(&self) -> i32

Returns the number of keys the device currently has.

§Returns

the number of keys.

Source

fn name(&self) -> Option<GString>

Determines the name of the device.

§Returns

a name

Source

fn position(&self) -> (Screen, i32, i32)

Gets the current location of self. As a slave device coordinates are those of its master pointer, This function may not be called on devices of type DeviceType::Slave, unless there is an ongoing grab on them, see gdk_device_grab().

§Returns
§screen

location to store the Screen the self is on, or None.

§x

location to store root window X coordinate of self, or None.

§y

location to store root window Y coordinate of self, or None.

Source

fn position_double(&self) -> (Screen, f64, f64)

Gets the current location of self in double precision. As a slave device’s coordinates are those of its master pointer, this function may not be called on devices of type DeviceType::Slave, unless there is an ongoing grab on them. See gdk_device_grab().

§Returns
§screen

location to store the Screen the self is on, or None.

§x

location to store root window X coordinate of self, or None.

§y

location to store root window Y coordinate of self, or None.

Source

fn product_id(&self) -> Option<GString>

Returns the product ID of this device, or None if this information couldn’t be obtained. This ID is retrieved from the device, and is thus constant for it. See vendor_id() for more information.

§Returns

the product ID, or None

Source

fn seat(&self) -> Option<Seat>

Returns the Seat the device belongs to.

§Returns

A Seat. This memory is owned by GTK+ and must not be freed.

Source

fn source(&self) -> InputSource

Determines the type of the device.

§Returns

a InputSource

Source

fn vendor_id(&self) -> Option<GString>

static GSettings * get_device_settings (GdkDevice *device) { const gchar *vendor, *product; GSettings *settings; GdkDevice *device; gchar *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, or None

Source

fn window_at_position(&self) -> (Option<Window>, i32, i32)

Obtains the window underneath self, returning the location of the device in win_x and win_y. Returns None if the window tree under self is not known to GDK (for example, belongs to another application).

As a slave device coordinates are those of its master pointer, This function may not be called on devices of type DeviceType::Slave, unless there is an ongoing grab on them, see gdk_device_grab().

§Returns

the Window under the device position, or None.

§win_x

return location for the X coordinate of the device location, relative to the window origin, or None.

§win_y

return location for the Y coordinate of the device location, relative to the window origin, or None.

Source

fn window_at_position_double(&self) -> (Option<Window>, f64, f64)

Obtains the window underneath self, returning the location of the device in win_x and win_y in double precision. Returns None if the window tree under self is not known to GDK (for example, belongs to another application).

As a slave device coordinates are those of its master pointer, This function may not be called on devices of type DeviceType::Slave, unless there is an ongoing grab on them, see gdk_device_grab().

§Returns

the Window under the device position, or None.

§win_x

return location for the X coordinate of the device location, relative to the window origin, or None.

§win_y

return location for the Y coordinate of the device location, relative to the window origin, or None.

Source

fn list_axes(&self) -> Vec<Atom>

Returns a GList of GdkAtoms, containing the labels for the axes that self currently has.

§Returns

A GList of GdkAtoms, free with g_list_free().

Source

fn list_slave_devices(&self) -> Vec<Device>

If the device if of type DeviceType::Master, it will return the list of slave devices attached to it, otherwise it will return None

§Returns

the list of slave devices, or None. The list must be freed with g_list_free(), the contents of the list are owned by GTK+ and should not be freed.

Source

fn set_axis_use(&self, index_: u32, use_: AxisUse)

Specifies how an axis of a device is used.

§index_

the index of the axis

§use_

specifies how the axis is used

Source

fn set_key(&self, index_: u32, keyval: u32, modifiers: ModifierType)

Specifies the X key event to generate when a macro button of a device is pressed.

§index_

the index of the macro button to set

§keyval

the keyval to generate

§modifiers

the modifiers to set

Source

fn set_mode(&self, mode: InputMode) -> bool

Sets a the mode of an input device. The mode controls if the device is active and whether the device’s range is mapped to the entire screen or to a single window.

Note: This is only meaningful for floating devices, master devices (and slaves connected to these) drive the pointer cursor, which is not limited by the input mode.

§mode

the input mode.

§Returns

true if the mode was successfully changed.

Source

fn warp(&self, screen: &Screen, x: i32, y: i32)

Warps self in display to the point x,y on the screen screen, unless the device is confined to a window by a grab, in which case it will be moved as far as allowed by the grab. Warping the pointer creates events as if the user had moved the mouse instantaneously to the destination.

Note that the pointer should normally be under the control of the user. This function was added to cover some rare use cases like keyboard navigation support for the color picker in the GtkColorSelectionDialog.

§screen

the screen to warp self to.

§x

the X coordinate of the destination.

§y

the Y coordinate of the destination.

Source

fn device_manager(&self) -> Option<DeviceManager>

The DeviceManager the Device pertains to.

Source

fn input_mode(&self) -> InputMode

Source

fn set_input_mode(&self, input_mode: InputMode)

Source

fn input_source(&self) -> InputSource

Source type for the device.

Source

fn num_touches(&self) -> u32

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.

Source

fn set_seat<P: IsA<Seat>>(&self, seat: Option<&P>)

Seat of this device.

Source

fn tool(&self) -> Option<DeviceTool>

Source

fn type_(&self) -> DeviceType

Device role in the device manager.

Source

fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

The ::changed signal is emitted either when the Device has changed the number of either axes or keys. For example In X this will normally happen when the slave device routing events through the master device changes (for example, user switches from the USB mouse to a tablet), in that case the master device will change to reflect the new slave device axes and keys.

Source

fn connect_tool_changed<F: Fn(&Self, &DeviceTool) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::tool-changed signal is emitted on pen/eraser GdkDevices whenever tools enter or leave proximity.

§tool

The new current tool

Source

fn connect_associated_device_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_axes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source

fn connect_input_mode_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_n_axes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source

fn connect_seat_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source

fn connect_tool_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source

fn connect_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<O: IsA<Device>> DeviceExt for O