pub trait DeviceExt: IsA<Device> + Sealed + 'static {
Show 30 methods
// Provided methods
fn is_caps_locked(&self) -> bool { ... }
fn device_tool(&self) -> Option<DeviceTool> { ... }
fn direction(&self) -> Direction { ... }
fn display(&self) -> Display { ... }
fn has_cursor(&self) -> bool { ... }
fn modifier_state(&self) -> ModifierType { ... }
fn name(&self) -> 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) -> 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 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
Provided Methods§
sourcefn is_caps_locked(&self) -> bool
fn is_caps_locked(&self) -> bool
sourcefn device_tool(&self) -> Option<DeviceTool>
fn device_tool(&self) -> Option<DeviceTool>
sourcefn direction(&self) -> Direction
fn direction(&self) -> Direction
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
sourcefn has_cursor(&self) -> bool
fn has_cursor(&self) -> bool
sourcefn modifier_state(&self) -> ModifierType
fn modifier_state(&self) -> ModifierType
Retrieves the current modifier state of the keyboard.
This is only relevant for keyboard devices.
Returns
the current modifier state
sourcefn is_num_locked(&self) -> bool
fn is_num_locked(&self) -> bool
sourcefn num_touches(&self) -> u32
fn num_touches(&self) -> u32
sourcefn product_id(&self) -> Option<GString>
fn product_id(&self) -> Option<GString>
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
sourcefn is_scroll_locked(&self) -> bool
fn is_scroll_locked(&self) -> bool
sourcefn source(&self) -> InputSource
fn source(&self) -> InputSource
sourcefn surface_at_position(&self) -> (Option<Surface>, f64, f64)
fn surface_at_position(&self) -> (Option<Surface>, f64, f64)
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
sourcefn timestamp(&self) -> u32
fn timestamp(&self) -> u32
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
sourcefn vendor_id(&self) -> Option<GString>
fn vendor_id(&self) -> Option<GString>
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
sourcefn has_bidi_layouts(&self) -> bool
fn has_bidi_layouts(&self) -> bool
sourcefn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted either when 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.