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, direction : Pango::Direction? = nil, display : Gdk::Display? = nil, has_bidi_layouts : Bool? = nil, has_cursor : Bool? = nil, modifier_state : Gdk::ModifierType? = nil, n_axes : UInt32? = nil, name : String? = nil, num_lock_state : Bool? = nil, num_touches : UInt32? = nil, product_id : String? = nil, scroll_lock_state : Bool? = nil, seat : Gdk::Seat? = nil, source : Gdk::InputSource? = nil, tool : Gdk::DeviceTool? = nil, vendor_id : String? = nil)
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#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?
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?) : Gdk::Display?
-
#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
-
#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
-
#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?
Returns the product ID of this device.
- #product_id=(value : String) : String
-
#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?) : Gdk::Seat?
-
#source : Gdk::InputSource
Determines the type of the device.
- #source=(value : Gdk::InputSource) : Gdk::InputSource
-
#surface_at_position : Gdk::Surface?
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?
- #tool_changed_signal
-
#vendor_id : String?
Returns the vendor ID of this device.
- #vendor_id=(value : String) : String
Instance methods inherited from class GObject::Object
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)?
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
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)?
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void)?) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void)?
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void)?
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,
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
compat_control(what : UInt64, data : Pointer(Void)?) : 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
Constructor Detail
Class Method Detail
Instance Method Detail
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;
}