Struct InputDevice

Source
pub struct InputDevice(/* private fields */);

Implementations§

Source§

impl InputDevice

Source

pub fn get_associated_device(&self) -> Option<InputDevice>

Retrieves a pointer to the InputDevice that has been associated to self.

If the InputDevice:device-mode property of self is set to InputMode::Master, this function will return None.

§Returns

a InputDevice, or None

Source

pub fn get_axis(&self, index_: u32) -> InputAxis

Retrieves the type of axis on self at the given index.

§index_

the index of the axis

§Returns

the axis type

Source

pub fn get_device_id(&self) -> i32

Retrieves the unique identifier of self

§Returns

the identifier of the device

Source

pub fn get_device_mode(&self) -> InputMode

Retrieves the InputMode of self.

§Returns

the device mode

Source

pub fn get_device_name(&self) -> Option<GString>

Retrieves the name of the self

§Returns

the name of the device, or None. The returned string is owned by the InputDevice and should never be modified or freed

Source

pub fn get_device_type(&self) -> InputDeviceType

Retrieves the type of self

§Returns

the type of the device

Source

pub fn get_enabled(&self) -> bool

Retrieves whether self is enabled.

§Returns

true if the device is enabled

Source

pub fn get_grabbed_actor(&self) -> Option<Actor>

Retrieves a pointer to the Actor currently grabbing all the events coming from self.

§Returns

a Actor, or None

Source

pub fn get_has_cursor(&self) -> bool

Retrieves whether self has a pointer that follows the device motion.

§Returns

true if the device has a cursor

Source

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

Retrieves the key set using InputDevice::set_key

§index_

the index of the key

§keyval

return location for the keyval at index_

§modifiers

return location for the modifiers at index_

§Returns

true if a key was set at the given index

Source

pub fn get_modifier_state(&self) -> ModifierType

Retrieves the current modifiers state of the device, as seen by the last event Clutter processed.

§Returns

the last known modifier state

Source

pub fn get_n_axes(&self) -> u32

Retrieves the number of axes available on self.

§Returns

the number of axes on the device

Source

pub fn get_n_keys(&self) -> u32

Retrieves the number of keys registered for self.

§Returns

the number of registered keys

Source

pub fn get_pointer_actor(&self) -> Option<Actor>

Retrieves the Actor underneath the pointer of self

§Returns

a pointer to the Actor or None

Source

pub fn get_pointer_stage(&self) -> Option<Stage>

Retrieves the Stage underneath the pointer of self

§Returns

a pointer to the Stage or None

Source

pub fn get_product_id(&self) -> Option<GString>

Gets the product ID of this device.

§Returns

the product ID

Source

pub fn get_slave_devices(&self) -> Vec<InputDevice>

Retrieves the slave devices attached to self.

§Returns

a list of InputDevice, or None. The contents of the list are owned by the device. Use glib::List::free when done

Source

pub fn get_vendor_id(&self) -> Option<GString>

Gets the vendor ID of this device.

§Returns

the vendor ID

Source

pub fn grab<P: IsA<Actor>>(&self, actor: &P)

Acquires a grab on actor for the given self.

Any event coming from self will be delivered to actor, bypassing the usual event delivery mechanism, until the grab is released by calling InputDevice::ungrab.

The grab is client-side: even if the windowing system used by the Clutter backend has the concept of “device grabs”, Clutter will not use them.

Only InputDevice of types InputDeviceType::PointerDevice and InputDeviceType::KeyboardDevice can hold a grab.

§actor

a Actor

Source

pub fn sequence_get_grabbed_actor( &self, sequence: &mut EventSequence, ) -> Option<Actor>

Retrieves a pointer to the Actor currently grabbing the touch events coming from self given the sequence.

§sequence

a EventSequence

§Returns

a Actor, or None

Source

pub fn sequence_grab<P: IsA<Actor>>( &self, sequence: &mut EventSequence, actor: &P, )

Acquires a grab on actor for the given self and the given touch sequence.

Any touch event coming from self and from sequence will be delivered to actor, bypassing the usual event delivery mechanism, until the grab is released by calling InputDevice::sequence_ungrab.

The grab is client-side: even if the windowing system used by the Clutter backend has the concept of “device grabs”, Clutter will not use them.

§sequence

a EventSequence

§actor

a Actor

Source

pub fn sequence_ungrab(&self, sequence: &mut EventSequence)

Releases the grab on the self for the given sequence, if one is in place.

§sequence

a EventSequence

Source

pub fn set_enabled(&self, enabled: bool)

Enables or disables a InputDevice.

Only devices with a InputDevice:device-mode property set to InputMode::Slave or InputMode::Floating can be disabled.

§enabled

true to enable the self

Source

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

Sets the keyval and modifiers at the given index_ for self.

Clutter will use the keyval and modifiers set when filling out an event coming from the same input device.

§index_

the index of the key

§keyval

the keyval

§modifiers

a bitmask of modifiers

Source

pub fn ungrab(&self)

Releases the grab on the self, if one is in place.

Source

pub fn update_from_event(&self, event: &mut Event, update_stage: bool)

Forcibly updates the state of the self using a ClutterEvent

This function should never be used by applications: it is meant for integration with embedding toolkits, like clutter-gtk

Embedding toolkits that disable the event collection inside Clutter need to use this function to update the state of input devices depending on a ClutterEvent that they are going to submit to the event handling code in Clutter though clutter_do_event. Since the input devices hold the state that is going to be used to fill in fields like the ButtonEvent click count, or to emit synthesized events like EventType::Enter and EventType::Leave, it is necessary for embedding toolkits to also be responsible of updating the input device state.

For instance, this might be the code to translate an embedding toolkit native motion notification into a Clutter MotionEvent and ask Clutter to process it:

  ClutterEvent c_event;

  translate_native_event_to_clutter (native_event, &c_event);

  clutter_do_event (&c_event);

Before letting clutter_do_event process the event, it is necessary to call InputDevice::update_from_event:

  ClutterEvent c_event;
  ClutterDeviceManager *manager;
  ClutterInputDevice *device;

  translate_native_event_to_clutter (native_event, &c_event);

  // get the device manager
  manager = clutter_device_manager_get_default ();

  // use the default Core Pointer that Clutter backends register by default
  device = clutter_device_manager_get_core_device (manager, %CLUTTER_POINTER_DEVICE);

  // update the state of the input device
  clutter_input_device_update_from_event (device, &c_event, FALSE);

  clutter_do_event (&c_event);

The update_stage boolean argument should be used when the input device enters and leaves a Stage; it will use the Stage field of the passed event to update the stage associated to the input device.

§event

a ClutterEvent

§update_stage

whether to update the Stage of the self using the stage of the event

Source

pub fn get_property_backend(&self) -> Option<Backend>

The Backend that created the device.

Source

pub fn get_property_device_manager(&self) -> Option<DeviceManager>

The DeviceManager instance which owns the device

Source

pub fn get_property_id(&self) -> i32

The unique identifier of the device

Source

pub fn get_property_name(&self) -> Option<GString>

The name of the device

Source

pub fn connect_property_enabled_notify<F: Fn(&InputDevice) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

pub fn connect_property_n_axes_notify<F: Fn(&InputDevice) + 'static>( &self, f: F, ) -> SignalHandlerId

Trait Implementations§

Source§

impl Clone for InputDevice

Source§

fn clone(&self) -> InputDevice

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InputDevice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for InputDevice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for InputDevice

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for InputDevice

Source§

fn cmp(&self, other: &InputDevice) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: ObjectType> PartialEq<T> for InputDevice

Source§

fn eq(&self, other: &T) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: ObjectType> PartialOrd<T> for InputDevice

Source§

fn partial_cmp(&self, other: &T) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StaticType for InputDevice

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl Eq for InputDevice

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Cast for T
where T: ObjectType,

Source§

fn upcast<T>(self) -> T
where T: ObjectType, Self: IsA<T>,

Upcasts an object to a superclass or interface T. Read more
Source§

fn upcast_ref<T>(&self) -> &T
where T: ObjectType, Self: IsA<T>,

Upcasts an object to a reference of its superclass or interface T. Read more
Source§

fn downcast<T>(self) -> Result<T, Self>
where T: ObjectType, Self: CanDowncast<T>,

Tries to downcast to a subclass or interface implementor T. Read more
Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: ObjectType, Self: CanDowncast<T>,

Tries to downcast to a reference of its subclass or interface implementor T. Read more
Source§

fn dynamic_cast<T>(self) -> Result<T, Self>
where T: ObjectType,

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more
Source§

fn dynamic_cast_ref<T>(&self) -> Option<&T>
where T: ObjectType,

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more
Source§

unsafe fn unsafe_cast<T>(self) -> T
where T: ObjectType,

Casts to T unconditionally. Read more
Source§

unsafe fn unsafe_cast_ref<T>(&self) -> &T
where T: ObjectType,

Casts to &T unconditionally. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ObjectExt for T
where T: ObjectType,

Source§

fn is<U>(&self) -> bool
where U: StaticType,

Returns true if the object is an instance of (can be cast to) T.
Source§

fn get_type(&self) -> Type

Source§

fn get_object_class(&self) -> &ObjectClass

Source§

fn set_properties( &self, property_values: &[(&str, &dyn ToValue)], ) -> Result<(), BoolError>

Source§

fn set_property<'a, N>( &self, property_name: N, value: &dyn ToValue, ) -> Result<(), BoolError>
where N: Into<&'a str>,

Source§

fn get_property<'a, N>(&self, property_name: N) -> Result<Value, BoolError>
where N: Into<&'a str>,

Source§

unsafe fn set_qdata<QD>(&self, key: Quark, value: QD)
where QD: 'static,

Safety Read more
Source§

unsafe fn get_qdata<QD>(&self, key: Quark) -> Option<&QD>
where QD: 'static,

Safety Read more
Source§

unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD>
where QD: 'static,

Safety Read more
Source§

unsafe fn set_data<QD>(&self, key: &str, value: QD)
where QD: 'static,

Safety Read more
Source§

unsafe fn get_data<QD>(&self, key: &str) -> Option<&QD>
where QD: 'static,

Safety Read more
Source§

unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD>
where QD: 'static,

Safety Read more
Source§

fn block_signal(&self, handler_id: &SignalHandlerId)

Source§

fn unblock_signal(&self, handler_id: &SignalHandlerId)

Source§

fn stop_signal_emission(&self, signal_name: &str)

Source§

fn disconnect(&self, handler_id: SignalHandlerId)

Source§

fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
where F: Fn(&T, &ParamSpec) + Send + Sync + 'static,

Source§

unsafe fn connect_notify_unsafe<F>( &self, name: Option<&str>, f: F, ) -> SignalHandlerId
where F: Fn(&T, &ParamSpec),

Source§

fn notify<'a, N>(&self, property_name: N)
where N: Into<&'a str>,

Source§

fn notify_by_pspec(&self, pspec: &ParamSpec)

Source§

fn has_property<'a, N>(&self, property_name: N, type_: Option<Type>) -> bool
where N: Into<&'a str>,

Source§

fn get_property_type<'a, N>(&self, property_name: N) -> Option<Type>
where N: Into<&'a str>,

Source§

fn find_property<'a, N>(&self, property_name: N) -> Option<ParamSpec>
where N: Into<&'a str>,

Source§

fn list_properties(&self) -> Vec<ParamSpec>

Source§

fn connect<'a, N, F>( &self, signal_name: N, after: bool, callback: F, ) -> Result<SignalHandlerId, BoolError>
where N: Into<&'a str>, F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,

Source§

fn connect_local<'a, N, F>( &self, signal_name: N, after: bool, callback: F, ) -> Result<SignalHandlerId, BoolError>
where N: Into<&'a str>, F: Fn(&[Value]) -> Option<Value> + 'static,

Source§

unsafe fn connect_unsafe<'a, N, F>( &self, signal_name: N, after: bool, callback: F, ) -> Result<SignalHandlerId, BoolError>
where N: Into<&'a str>, F: Fn(&[Value]) -> Option<Value>,

Source§

fn emit<'a, N>( &self, signal_name: N, args: &[&dyn ToValue], ) -> Result<Option<Value>, BoolError>
where N: Into<&'a str>,

Source§

fn downgrade(&self) -> WeakRef<T>

Source§

fn bind_property<'a, O, N, M>( &'a self, source_property: N, target: &'a O, target_property: M, ) -> BindingBuilder<'a>
where O: ObjectType, N: Into<&'a str>, M: Into<&'a str>,

Source§

fn ref_count(&self) -> u32

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToValue for T
where T: SetValue + ?Sized,

Source§

fn to_value(&self) -> Value

Returns a Value clone of self.
Source§

fn to_value_type(&self) -> Type

Returns the type identifer of self. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<Super, Sub> CanDowncast<Sub> for Super
where Super: IsA<Super>, Sub: IsA<Super>,