pub struct InputDevice(/* private fields */);
Implementations§
Source§impl InputDevice
impl InputDevice
Sourcepub fn get_associated_device(&self) -> Option<InputDevice>
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
Sourcepub fn get_device_id(&self) -> i32
pub fn get_device_id(&self) -> i32
Sourcepub fn get_device_mode(&self) -> InputMode
pub fn get_device_mode(&self) -> InputMode
Sourcepub fn get_device_name(&self) -> Option<GString>
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
Sourcepub fn get_device_type(&self) -> InputDeviceType
pub fn get_device_type(&self) -> InputDeviceType
Sourcepub fn get_enabled(&self) -> bool
pub fn get_enabled(&self) -> bool
Sourcepub fn get_grabbed_actor(&self) -> Option<Actor>
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
Sourcepub fn get_has_cursor(&self) -> bool
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
Sourcepub fn get_modifier_state(&self) -> ModifierType
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
Sourcepub fn get_n_axes(&self) -> u32
pub fn get_n_axes(&self) -> u32
Sourcepub fn get_n_keys(&self) -> u32
pub fn get_n_keys(&self) -> u32
Sourcepub fn get_pointer_actor(&self) -> Option<Actor>
pub fn get_pointer_actor(&self) -> Option<Actor>
Sourcepub fn get_pointer_stage(&self) -> Option<Stage>
pub fn get_pointer_stage(&self) -> Option<Stage>
Sourcepub fn get_product_id(&self) -> Option<GString>
pub fn get_product_id(&self) -> Option<GString>
Sourcepub fn get_slave_devices(&self) -> Vec<InputDevice>
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
Sourcepub fn get_vendor_id(&self) -> Option<GString>
pub fn get_vendor_id(&self) -> Option<GString>
Sourcepub fn grab<P: IsA<Actor>>(&self, actor: &P)
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
Sourcepub fn sequence_get_grabbed_actor(
&self,
sequence: &mut EventSequence,
) -> Option<Actor>
pub fn sequence_get_grabbed_actor( &self, sequence: &mut EventSequence, ) -> Option<Actor>
Sourcepub fn sequence_grab<P: IsA<Actor>>(
&self,
sequence: &mut EventSequence,
actor: &P,
)
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
Sourcepub fn sequence_ungrab(&self, sequence: &mut EventSequence)
pub fn sequence_ungrab(&self, sequence: &mut EventSequence)
Sourcepub fn set_enabled(&self, enabled: bool)
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
Sourcepub fn set_key(&self, index_: u32, keyval: u32, modifiers: ModifierType)
pub fn set_key(&self, index_: u32, keyval: u32, modifiers: ModifierType)
Sourcepub fn update_from_event(&self, event: &mut Event, update_stage: bool)
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
Sourcepub fn get_property_backend(&self) -> Option<Backend>
pub fn get_property_backend(&self) -> Option<Backend>
The Backend
that created the device.
Sourcepub fn get_property_device_manager(&self) -> Option<DeviceManager>
pub fn get_property_device_manager(&self) -> Option<DeviceManager>
The DeviceManager
instance which owns the device
Sourcepub fn get_property_id(&self) -> i32
pub fn get_property_id(&self) -> i32
The unique identifier of the device
Sourcepub fn get_property_name(&self) -> Option<GString>
pub fn get_property_name(&self) -> Option<GString>
The name of the device
pub fn connect_property_enabled_notify<F: Fn(&InputDevice) + 'static>( &self, f: F, ) -> SignalHandlerId
pub fn connect_property_n_axes_notify<F: Fn(&InputDevice) + 'static>( &self, f: F, ) -> SignalHandlerId
Trait Implementations§
Source§impl Clone for InputDevice
impl Clone for InputDevice
Source§fn clone(&self) -> InputDevice
fn clone(&self) -> InputDevice
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for InputDevice
impl Debug for InputDevice
Source§impl Display for InputDevice
impl Display for InputDevice
Source§impl Hash for InputDevice
impl Hash for InputDevice
Source§impl Ord for InputDevice
impl Ord for InputDevice
Source§fn cmp(&self, other: &InputDevice) -> Ordering
fn cmp(&self, other: &InputDevice) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: ObjectType> PartialEq<T> for InputDevice
impl<T: ObjectType> PartialEq<T> for InputDevice
Source§impl<T: ObjectType> PartialOrd<T> for InputDevice
impl<T: ObjectType> PartialOrd<T> for InputDevice
Source§impl StaticType for InputDevice
impl StaticType for InputDevice
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Eq for InputDevice
Auto Trait Implementations§
impl Freeze for InputDevice
impl RefUnwindSafe for InputDevice
impl !Send for InputDevice
impl !Sync for InputDevice
impl Unpin for InputDevice
impl UnwindSafe for InputDevice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Cast for Twhere
T: ObjectType,
impl<T> Cast for Twhere
T: ObjectType,
Source§fn upcast<T>(self) -> Twhere
T: ObjectType,
Self: IsA<T>,
fn upcast<T>(self) -> Twhere
T: ObjectType,
Self: IsA<T>,
T
. Read moreSource§fn upcast_ref<T>(&self) -> &Twhere
T: ObjectType,
Self: IsA<T>,
fn upcast_ref<T>(&self) -> &Twhere
T: ObjectType,
Self: IsA<T>,
T
. Read moreSource§fn downcast<T>(self) -> Result<T, Self>where
T: ObjectType,
Self: CanDowncast<T>,
fn downcast<T>(self) -> Result<T, Self>where
T: ObjectType,
Self: CanDowncast<T>,
T
. Read moreSource§fn downcast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
Self: CanDowncast<T>,
fn downcast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
Self: CanDowncast<T>,
T
. Read moreSource§fn dynamic_cast<T>(self) -> Result<T, Self>where
T: ObjectType,
fn dynamic_cast<T>(self) -> Result<T, Self>where
T: ObjectType,
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 moreSource§fn dynamic_cast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
fn dynamic_cast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
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 moreSource§unsafe fn unsafe_cast<T>(self) -> Twhere
T: ObjectType,
unsafe fn unsafe_cast<T>(self) -> Twhere
T: ObjectType,
T
unconditionally. Read moreSource§unsafe fn unsafe_cast_ref<T>(&self) -> &Twhere
T: ObjectType,
unsafe fn unsafe_cast_ref<T>(&self) -> &Twhere
T: ObjectType,
&T
unconditionally. Read moreSource§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> ObjectExt for Twhere
T: ObjectType,
impl<T> ObjectExt for Twhere
T: ObjectType,
Source§fn is<U>(&self) -> boolwhere
U: StaticType,
fn is<U>(&self) -> boolwhere
U: StaticType,
true
if the object is an instance of (can be cast to) T
.