pub trait DeviceExt:
IsA<Device>
+ Sealed
+ '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 { ... }
}Provided Methods§
Sourcefn associated_device(&self) -> Option<Device>
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
Sourcefn device_type(&self) -> DeviceType
fn device_type(&self) -> DeviceType
Sourcefn has_cursor(&self) -> bool
fn has_cursor(&self) -> bool
Sourcefn last_event_window(&self) -> Option<Window>
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
Sourcefn position(&self) -> (Screen, i32, i32)
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.
Sourcefn position_double(&self) -> (Screen, f64, f64)
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.
Sourcefn product_id(&self) -> Option<GString>
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
Sourcefn source(&self) -> InputSource
fn source(&self) -> InputSource
Sourcefn vendor_id(&self) -> Option<GString>
fn vendor_id(&self) -> Option<GString>
Returns the vendor 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.
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 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
Sourcefn window_at_position(&self) -> (Option<Window>, i32, i32)
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.
Sourcefn window_at_position_double(&self) -> (Option<Window>, f64, f64)
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.
Sourcefn list_axes(&self) -> Vec<Atom>
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().
Sourcefn list_slave_devices(&self) -> Vec<Device>
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.
Sourcefn set_axis_use(&self, index_: u32, use_: AxisUse)
fn set_axis_use(&self, index_: u32, use_: AxisUse)
Sourcefn set_key(&self, index_: u32, keyval: u32, modifiers: ModifierType)
fn set_key(&self, index_: u32, keyval: u32, modifiers: ModifierType)
Sourcefn set_mode(&self, mode: InputMode) -> bool
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.
Sourcefn warp(&self, screen: &Screen, x: i32, y: i32)
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.
Sourcefn device_manager(&self) -> Option<DeviceManager>
fn device_manager(&self) -> Option<DeviceManager>
The DeviceManager the Device pertains to.
fn input_mode(&self) -> InputMode
fn set_input_mode(&self, input_mode: InputMode)
Sourcefn input_source(&self) -> InputSource
fn input_source(&self) -> InputSource
Source type for the device.
Sourcefn num_touches(&self) -> u32
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.
fn tool(&self) -> Option<DeviceTool>
Sourcefn type_(&self) -> DeviceType
fn type_(&self) -> DeviceType
Device role in the device manager.
Sourcefn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
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.
Sourcefn connect_tool_changed<F: Fn(&Self, &DeviceTool) + 'static>(
&self,
f: F,
) -> SignalHandlerId
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
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".