Gdk.Device¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
|||
r |
|||
r/w/co |
|||
r |
|||
r/w/co |
|||
r |
|||
r |
|||
r/w/co |
|||
r |
|||
r/w/co |
|||
r/w/co |
|||
r |
|||
r/w |
|||
r/w/co/en |
|||
r |
|||
r/w/co |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted either when the number of either axes or keys changes. |
|
Emitted on pen/eraser devices whenever tools enter or leave proximity. |
Fields¶
- Inherited:
Class Details¶
- class Gdk.Device(**kwargs)¶
- Bases:
- Abstract:
Yes
The
GdkDevice
object represents an input device, such as a keyboard, a mouse, or a touchpad.See the [class`Gdk`.Seat] documentation for more information about the various kinds of devices, and their relationships.
- get_caps_lock_state()[source]¶
-
Retrieves whether the Caps Lock modifier of the keyboard is locked.
This is only relevant for keyboard devices.
- get_device_tool()[source]¶
- Returns:
the
GdkDeviceTool
- Return type:
Retrieves the current tool for self.
- get_direction()[source]¶
- Returns:
Pango.Direction.LTR
orPango.Direction.RTL
if it can determine the direction.Pango.Direction.NEUTRAL
otherwise- Return type:
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 [func`Pango`.unichar_direction].
- get_display()[source]¶
- Returns:
a
GdkDisplay
- Return type:
Returns the
GdkDisplay
to which self pertains.
- get_has_cursor()[source]¶
-
Determines whether the pointer follows device motion.
This is not meaningful for keyboard devices, which don’t have a pointer.
- get_modifier_state()[source]¶
- Returns:
the current modifier state
- Return type:
Retrieves the current modifier state of the keyboard.
This is only relevant for keyboard devices.
- get_name()[source]¶
- Returns:
a name
- Return type:
The name of the device, suitable for showing in a user interface.
- get_num_lock_state()[source]¶
-
Retrieves whether the Num Lock modifier of the keyboard is locked.
This is only relevant for keyboard devices.
- get_num_touches()[source]¶
- Returns:
the number of touch points
- Return type:
Retrieves the number of touch points associated to self.
- get_product_id()[source]¶
-
Returns the product ID of this device.
This ID is retrieved from the device, and does not change. See [method`Gdk`.Device.get_vendor_id] for more information.
- get_scroll_lock_state()[source]¶
-
Retrieves whether the Scroll Lock modifier of the keyboard is locked.
This is only relevant for keyboard devices.
- get_surface_at_position()[source]¶
- Returns:
the
GdkSurface
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
- Return type:
(
Gdk.Surface
orNone
, win_x:float
, win_y:float
)
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).
- get_timestamp()[source]¶
- Returns:
the timestamp of the last activity for this device
- Return type:
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).
New in version 4.2.
- get_vendor_id()[source]¶
-
Returns the vendor ID of this device.
This ID is retrieved from the device, and does not change.
This function, together with [method`Gdk`.Device.get_product_id], can be used to eg. compose
GSettings
paths to store settings for this device.```c static
Gio.Settings
* get_device_settings (Gdk.Device
*device) { conststr
*vendor, *product;Gio.Settings
*settings;Gdk.Device
*device;str
*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 =
Gio.Settings.new_with_path
(DEVICE_SCHEMA, path);GLib.free
(path);return settings; } ```
Signal Details¶
- Gdk.Device.signals.changed(device)¶
- Signal Name:
changed
- Flags:
- Parameters:
device (
Gdk.Device
) – The object which received the signal
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.
- Gdk.Device.signals.tool_changed(device, tool)¶
- Signal Name:
tool-changed
- Flags:
- Parameters:
device (
Gdk.Device
) – The object which received the signaltool (
Gdk.DeviceTool
) – The new current tool
Emitted on pen/eraser devices whenever tools enter or leave proximity.
Property Details¶
- Gdk.Device.props.caps_lock_state¶
-
Whether Caps Lock is on.
This is only relevant for keyboard devices.
- Gdk.Device.props.direction¶
- Name:
direction
- Type:
- Default Value:
- Flags:
The direction of the current layout.
This is only relevant for keyboard devices.
- Gdk.Device.props.display¶
- Name:
display
- Type:
- Default Value:
- Flags:
The
GdkDisplay
theGdkDevice
pertains to.
- Gdk.Device.props.has_bidi_layouts¶
-
Whether the device has both right-to-left and left-to-right layouts.
This is only relevant for keyboard devices.
- Gdk.Device.props.has_cursor¶
- Name:
has-cursor
- Type:
- Default Value:
- Flags:
Whether the device is represented by a cursor on the screen.
- Gdk.Device.props.modifier_state¶
- Name:
modifier-state
- Type:
- Default Value:
0
- Flags:
The current modifier state of the device.
This is only relevant for keyboard devices.
- Gdk.Device.props.n_axes¶
-
Number of axes in the device.
- Gdk.Device.props.name¶
- Name:
name
- Type:
- Default Value:
- Flags:
The device name.
- Gdk.Device.props.num_lock_state¶
-
Whether Num Lock is on.
This is only relevant for keyboard devices.
- Gdk.Device.props.num_touches¶
- Name:
num-touches
- Type:
- Default Value:
0
- Flags:
The maximal number of concurrent touches on a touch device.
Will be 0 if the device is not a touch device or if the number of touches is unknown.
- Gdk.Device.props.product_id¶
- Name:
product-id
- Type:
- Default Value:
- Flags:
Product ID of this device.
See [method`Gdk`.Device.get_product_id].
- Gdk.Device.props.scroll_lock_state¶
-
Whether Scroll Lock is on.
This is only relevant for keyboard devices.
- Gdk.Device.props.seat¶
-
GdkSeat
of this device.
- Gdk.Device.props.source¶
- Name:
source
- Type:
- Default Value:
- Flags:
Source type for the device.
- Gdk.Device.props.tool¶
- Name:
tool
- Type:
- Default Value:
- Flags:
The
GdkDeviceTool
that is currently used with this device.