class Gdk::Device
- Gdk::Device
- GObject::Object
- Reference
- Object
Overview
The Gdk::Device
object represents an input device, such
as a keyboard, a mouse, or a touchpad.
See the Gdk::Seat
documentation for more information
about the various kinds of devices, and their relationships.
Defined in:
lib/gi-crystal/src/auto/gdk-4.0/device.crConstructors
-
.new
Initialize a new
Device
. - .new(*, caps_lock_state : Bool | Nil = nil, direction : Pango::Direction | Nil = nil, display : Gdk::Display | Nil = nil, has_bidi_layouts : Bool | Nil = nil, has_cursor : Bool | Nil = nil, modifier_state : Gdk::ModifierType | Nil = nil, n_axes : UInt32 | Nil = nil, name : String | Nil = nil, num_lock_state : Bool | Nil = nil, num_touches : UInt32 | Nil = nil, product_id : String | Nil = nil, scroll_lock_state : Bool | Nil = nil, seat : Gdk::Seat | Nil = nil, source : Gdk::InputSource | Nil = nil, tool : Gdk::DeviceTool | Nil = nil, vendor_id : String | Nil = nil)
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#caps_lock_state : Bool
Retrieves whether the Caps Lock modifier of the keyboard is locked.
- #caps_lock_state? : Bool
- #changed_signal
-
#device_tool : Gdk::DeviceTool | Nil
Retrieves the current tool for device.
-
#direction : Pango::Direction
Returns the direction of effective layout of the keyboard.
-
#display : Gdk::Display
Returns the
Gdk::Display
to which device pertains. - #display=(value : Gdk::Display | Nil) : Gdk::Display | Nil
-
#has_bidi_layouts : Bool
Determines if layouts for both right-to-left and left-to-right languages are in use on the keyboard.
- #has_bidi_layouts? : Bool
-
#has_cursor : Bool
Determines whether the pointer follows device motion.
- #has_cursor=(value : Bool) : Bool
- #has_cursor? : Bool
-
#hash(hasher)
See
Object#hash(hasher)
-
#modifier_state : Gdk::ModifierType
Retrieves the current modifier state of the keyboard.
- #n_axes : UInt32
-
#name : String
The name of the device, suitable for showing in a user interface.
- #name=(value : String) : String
-
#name=(value : Nil) : Nil
Set
#name
property to nil. -
#name? : String | Nil
Same as
#name
, but can return nil. -
#num_lock_state : Bool
Retrieves whether the Num Lock modifier of the keyboard is locked.
- #num_lock_state? : Bool
-
#num_touches : UInt32
Retrieves the number of touch points associated to device.
- #num_touches=(value : UInt32) : UInt32
-
#product_id : String | Nil
Returns the product ID of this device.
- #product_id=(value : String) : String
-
#product_id=(value : Nil) : Nil
Set
#product_id
property to nil. -
#product_id? : String | Nil
Same as
#product_id
, but can return nil. -
#scroll_lock_state : Bool
Retrieves whether the Scroll Lock modifier of the keyboard is locked.
- #scroll_lock_state? : Bool
-
#seat : Gdk::Seat
Returns the
Gdk::Seat
the device belongs to. - #seat=(value : Gdk::Seat | Nil) : Gdk::Seat | Nil
-
#source : Gdk::InputSource
Determines the type of the device.
- #source=(value : Gdk::InputSource) : Gdk::InputSource
-
#surface_at_position : Gdk::Surface | Nil
Obtains the surface underneath device, returning the location of the device in win_x and win_y.
-
#timestamp : UInt32
Returns the timestamp of the last activity for this device.
- #tool : Gdk::DeviceTool | Nil
- #tool_changed_signal
-
#vendor_id : String | Nil
Returns the vendor ID of this device.
- #vendor_id=(value : String) : String
-
#vendor_id=(value : Nil) : Nil
Set
#vendor_id
property to nil. -
#vendor_id? : String | Nil
Same as
#vendor_id
, but can return nil.
Instance methods inherited from class GObject::Object
==(other : self)
==,
bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding
bind_property,
bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding
bind_property_full,
data(key : String) : Pointer(Void) | Nil
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
hash(hasher)
hash,
notify(property_name : String) : Nil
notify,
notify_by_pspec(pspec : GObject::ParamSpec) : Nil
notify_by_pspec,
notify_signal
notify_signal,
property(property_name : String, value : _) : Nil
property,
qdata(quark : UInt32) : Pointer(Void) | Nil
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void) | Nil) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void) | Nil
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void) | Nil
steal_qdata,
thaw_notify : Nil
thaw_notify,
to_unsafe : Pointer(Void)
to_unsafe,
watch_closure(closure : GObject::Closure) : Nil
watch_closure
Constructor methods inherited from class GObject::Object
cast(obj : GObject::Object) : self
cast,
new(pointer : Pointer(Void), transfer : GICrystal::Transfer)new new, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv
Class methods inherited from class GObject::Object
cast?(obj : GObject::Object) : self | Nil
cast?,
compat_control(what : UInt64, data : Pointer(Void) | Nil) : UInt64
compat_control,
g_type : UInt64
g_type,
interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec
interface_find_property,
interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec)
interface_list_properties
Macros inherited from class GObject::Object
previous_vfunc(*args)
previous_vfunc,
previous_vfunc!(*args)
previous_vfunc!,
signal(signature)
signal
Constructor Detail
Class Method Detail
Returns the type id (GType) registered in GLib type system.
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Retrieves whether the Caps Lock modifier of the keyboard is locked.
This is only relevant for keyboard devices.
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 Pango::unichar_direction
.
Determines if layouts for both right-to-left and left-to-right languages are in use on the keyboard.
This is only relevant for keyboard devices.
Determines whether the pointer follows device motion.
This is not meaningful for keyboard devices, which don't have a pointer.
Retrieves the current modifier state of the keyboard.
This is only relevant for keyboard devices.
Retrieves whether the Num Lock modifier of the keyboard is locked.
This is only relevant for keyboard devices.
Returns the product ID of this device.
This ID is retrieved from the device, and does not change.
See Gdk::Device#vendor_id
for more information.
Retrieves whether the Scroll Lock modifier of the keyboard is locked.
This is only relevant for keyboard devices.
Obtains the surface underneath device, returning the location of the device in win_x and win_y.
Returns nil
if the surface tree under device is not known to GDK
(for example, belongs to another application).
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 vendor ID of this device.
This ID is retrieved from the device, and does not change.
This function, together with Gdk::Device#product_id
,
can be used to eg. compose GSettings
paths to store settings
for this device.
WARNING ⚠️ The following code is in c ⚠️
static GSettings *
get_device_settings (Gdk::Device *device)
{
const char *vendor, *product;
GSettings *settings;
Gdk::Device *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;
}