Top | ![]() |
![]() |
![]() |
![]() |
GdkDevice * | associated-device | Read |
GdkAxisFlags | axes | Read |
gboolean | caps-lock-state | Read |
PangoDirection | direction | Read |
GdkDisplay * | display | Read / Write / Construct Only |
gboolean | has-bidi-layouts | Read |
gboolean | has-cursor | Read / Write / Construct Only |
GdkModifierType | modifier-state | Read |
guint | n-axes | Read |
gchar * | name | Read / Write / Construct Only |
gboolean | num-lock-state | Read |
guint | num-touches | Read / Write / Construct Only |
gchar * | product-id | Read / Write / Construct Only |
gboolean | scroll-lock-state | Read |
GdkSeat * | seat | Read / Write |
GdkInputSource | source | Read / Write / Construct Only |
GdkDeviceTool * | tool | Read |
GdkDeviceType | type | Read / Write / Construct Only |
gchar * | vendor-id | Read / Write / Construct Only |
GdkDevice | |
enum | GdkInputSource |
enum | GdkAxisUse |
enum | GdkAxisFlags |
enum | GdkDeviceToolType |
enum | GdkDeviceType |
struct | GdkTimeCoord |
The GdkDevice object represents a single input device, such as a keyboard, a mouse, a touchpad, etc.
See the GdkSeat documentation for more information about the various kinds of master and slave devices, and their relationships.
const gchar *
gdk_device_get_name (GdkDevice *device
);
Determines the name of the device.
const gchar *
gdk_device_get_vendor_id (GdkDevice *device
);
Returns the vendor ID of this device, or NULL
if this information couldn't
be obtained. This ID is retrieved from the device, and is thus constant for
it.
This function, together with gdk_device_get_product_id()
, can be used to eg.
compose GSettings paths to store settings for this device.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
static GSettings * get_device_settings (GdkDevice *device) { const gchar *vendor, *product; GSettings *settings; GdkDevice *device; gchar *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; } |
const gchar *
gdk_device_get_product_id (GdkDevice *device
);
Returns the product ID of this device, or NULL
if this information couldn't
be obtained. This ID is retrieved from the device, and is thus constant for
it. See gdk_device_get_vendor_id()
for more information.
GdkInputSource
gdk_device_get_source (GdkDevice *device
);
Determines the type of the device.
void gdk_device_set_key (GdkDevice *device
,guint index_
,guint keyval
,GdkModifierType modifiers
);
Specifies the X key event to generate when a macro button of a device is pressed.
gboolean gdk_device_get_key (GdkDevice *device
,guint index_
,guint *keyval
,GdkModifierType *modifiers
);
If index_
has a valid keyval, this function will return TRUE
and fill in keyval
and modifiers
with the keyval settings.
device |
a GdkDevice. |
|
index_ |
the index of the macro button to get. |
|
keyval |
return value for the keyval. |
[out] |
modifiers |
return value for modifiers. |
[out] |
void gdk_device_set_axis_use (GdkDevice *device
,guint index_
,GdkAxisUse use
);
Specifies how an axis of a device is used.
device |
a pointer GdkDevice |
|
index_ |
the index of the axis |
|
use |
specifies how the axis is used |
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device
,guint index_
);
Returns the axis use for index_
.
GdkDevice *
gdk_device_get_associated_device (GdkDevice *device
);
Returns the associated device to device
, if device
is of type
GDK_DEVICE_TYPE_MASTER
, it will return the paired pointer or
keyboard.
If device
is of type GDK_DEVICE_TYPE_SLAVE
, it will return
the master device to which device
is attached to.
If device
is of type GDK_DEVICE_TYPE_FLOATING
, NULL
will be
returned, as there is no associated device.
GList *
gdk_device_list_slave_devices (GdkDevice *device
);
If the device if of type GDK_DEVICE_TYPE_MASTER
, it will return
the list of slave devices attached to it, otherwise it will return
NULL
GdkDeviceType
gdk_device_get_device_type (GdkDevice *device
);
Returns the device type for device
.
GdkDisplay *
gdk_device_get_display (GdkDevice *device
);
Returns the GdkDisplay to which device
pertains.
a GdkDisplay. This memory is owned by GTK+, and must not be freed or unreffed.
[transfer none]
gboolean
gdk_device_get_has_cursor (GdkDevice *device
);
Determines whether the pointer follows device motion. This is not meaningful for keyboard devices, which don't have a pointer.
gint
gdk_device_get_n_axes (GdkDevice *device
);
Returns the number of axes the device currently has.
gint
gdk_device_get_n_keys (GdkDevice *device
);
Returns the number of keys the device currently has.
GdkAxisFlags
gdk_device_get_axes (GdkDevice *device
);
Returns the axes currently available on the device.
GdkSeat *
gdk_device_get_seat (GdkDevice *device
);
Returns the GdkSeat the device belongs to.
guint
gdk_device_get_num_touches (GdkDevice *device
);
Retrieves the number of touch points associated to device
.
GdkDeviceTool *
gdk_device_get_device_tool (GdkDevice *device
);
Retrieves the GdkDeviceTool associated to device
.
void gdk_device_get_state (GdkDevice *device
,GdkSurface *surface
,gdouble *axes
,GdkModifierType *mask
);
Gets the current state of a pointer device relative to surface
. As a slave
device’s coordinates are those of its master pointer, this
function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE
,
unless there is an ongoing grab on them. See gdk_seat_grab()
.
[skip]
device |
a GdkDevice. |
|
surface |
a GdkSurface. |
|
axes |
an array of doubles to store the values of
the axes of |
[nullable][array] |
mask |
location to store the modifiers, or |
[optional][out] |
GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device
,double *win_x
,double *win_y
);
Obtains the surface underneath device
, returning the location of the device in win_x
and win_y
in
double precision. Returns NULL
if the surface tree under device
is not known to GDK (for example,
belongs to another application).
As a slave device coordinates are those of its master pointer, This
function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE
,
unless there is an ongoing grab on them, see gdk_seat_grab()
.
device |
pointer GdkDevice to query info to. |
|
win_x |
return location for the X coordinate of the device location,
relative to the surface origin, or |
[out][allow-none] |
win_y |
return location for the Y coordinate of the device location,
relative to the surface origin, or |
[out][allow-none] |
gboolean gdk_device_get_history (GdkDevice *device
,GdkSurface *surface
,guint32 start
,guint32 stop
,GdkTimeCoord ***events
,gint *n_events
);
Obtains the motion history for a pointer device; given a starting and
ending timestamp, return all events in the motion history for
the device in the given range of time. Some windowing systems
do not support motion history, in which case, FALSE
will
be returned. (This is not distinguishable from the case where
motion history is supported and no events were found.)
Note that there is also gdk_surface_set_event_compression()
to get
more motion events delivered directly, independent of the windowing
system.
[skip]
device |
||
surface |
the surface with respect to which which the event coordinates will be reported |
|
start |
starting timestamp for range of events to return |
|
stop |
ending timestamp for the range of events to return |
|
events |
location to store a newly-allocated array of GdkTimeCoord, or
|
[array length=n_events][out][transfer full][optional] |
n_events |
location to store the length of
|
[out][optional] |
void gdk_device_free_history (GdkTimeCoord **events
,gint n_events
);
Frees an array of GdkTimeCoord that was returned by gdk_device_get_history()
.
[skip]
events |
an array of GdkTimeCoord. |
[array length=n_events] |
n_events |
the length of the array. |
gboolean gdk_device_get_axis (GdkDevice *device
,gdouble *axes
,GdkAxisUse use
,gdouble *value
);
Interprets an array of double as axis values for a given device, and locates the value in the array for a given axis use.
[skip]
char **
gdk_device_get_axis_names (GdkDevice *device
);
Returns a null-terminated array of strings, containing the labels for
the axes that device
currently has.
If the device has no axes, NULL
is returned.
gboolean gdk_device_get_axis_value (GdkDevice *device
,gdouble *axes
,const char *axis_label
,gdouble *value
);
Interprets an array of double as axis values for a given device,
and locates the value in the array for a given axis label, as returned
by gdk_device_get_axes()
[skip]
device |
a pointer GdkDevice. |
|
axes |
pointer to an array of axes. |
[array] |
axis_label |
name of the label |
|
value |
location to store the found value. |
[out] |
GdkSurface *
gdk_device_get_last_event_surface (GdkDevice *device
);
Gets information about which surface the given pointer device is in, based on events
that have been received so far from the display server. If another application
has a pointer grab, or this application has a grab with owner_events = FALSE
,
NULL
may be returned even if the pointer is physically over one of this
application's surfaces.
guint64
gdk_device_tool_get_serial (GdkDeviceTool *tool
);
Gets the serial of this tool, this value can be used to identify a physical tool (eg. a tablet pen) across program executions.
GdkDeviceToolType
gdk_device_tool_get_tool_type (GdkDeviceTool *tool
);
Gets the GdkDeviceToolType of the tool.
guint64
gdk_device_tool_get_hardware_id (GdkDeviceTool *tool
);
Gets the hardware ID of this tool, or 0 if it's not known. When
non-zero, the identificator is unique for the given tool model,
meaning that two identical tools will share the same hardware_id
,
but will have different serial numbers (see gdk_device_tool_get_serial()
).
This is a more concrete (and device specific) method to identify
a GdkDeviceTool than gdk_device_tool_get_tool_type()
, as a tablet
may support multiple devices with the same GdkDeviceToolType,
but having different hardware identificators.
typedef struct _GdkDevice GdkDevice;
The GdkDevice struct contains only private fields and should not be accessed directly.
An enumeration describing the type of an input device in general terms.
the device is a mouse. (This will be reported for the core pointer, even if it is something else, such as a trackball.) |
||
the device is a stylus of a graphics tablet or similar device. |
||
the device is an eraser. Typically, this would be the other end of a stylus on a graphics tablet. |
||
the device is a graphics tablet “puck” or similar device. |
||
the device is a keyboard. |
||
the device is a direct-input touch device, such as a touchscreen or tablet. This device type has been added in 3.4. |
||
the device is an indirect touch device, such as a touchpad. This device type has been added in 3.4. |
||
the device is a trackpoint. This device type has been added in 3.22 |
||
the device is a "pad", a collection of buttons, rings and strips found in drawing tablets. This device type has been added in 3.22. |
An enumeration describing the way in which a device axis (valuator) maps onto the predefined valuator types that GTK understands.
Note that the X and Y axes are not really needed; pointer devices report their location via the x/y members of events regardless. Whether X and Y are present as axes depends on the GDK backend.
the axis is ignored. |
||
the axis is used as the x axis. |
||
the axis is used as the y axis. |
||
the axis is used for pressure information. |
||
the axis is used for x tilt information. |
||
the axis is used for y tilt information. |
||
the axis is used for wheel information. |
||
the axis is used for pen/tablet distance information |
||
the axis is used for pen rotation information |
||
the axis is used for pen slider information |
||
a constant equal to the numerically highest axis value. |
Flags describing the current capabilities of a device/tool.
Indicates the specific type of tool being used being a tablet. Such as an airbrush, pencil, etc.
struct GdkTimeCoord { guint32 time; gdouble axes[GDK_MAX_TIMECOORD_AXES]; };
A GdkTimeCoord stores a single event in a motion history.
“associated-device”
property“associated-device” GdkDevice *
Associated pointer or keyboard with this device, if any. Devices of type GDK_DEVICE_TYPE_MASTER
always come in keyboard/pointer pairs. Other device types will have a NULL
associated device.
Owner: GdkDevice
Flags: Read
“axes”
property“axes” GdkAxisFlags
The axes currently available for this device.
Owner: GdkDevice
Flags: Read
“caps-lock-state”
property “caps-lock-state” gboolean
Whether the keyboard caps lock is on.
Owner: GdkDevice
Flags: Read
Default value: FALSE
“direction”
property“direction” PangoDirection
The direction of the current layout of the keyboard.
Owner: GdkDevice
Flags: Read
Default value: PANGO_DIRECTION_NEUTRAL
“display”
property“display” GdkDisplay *
The GdkDisplay the GdkDevice pertains to.
Owner: GdkDevice
Flags: Read / Write / Construct Only
“has-bidi-layouts”
property “has-bidi-layouts” gboolean
Whether the keyboard has bidi layouts.
Owner: GdkDevice
Flags: Read
Default value: FALSE
“has-cursor”
property “has-cursor” gboolean
Whether the device is represented by a cursor on the screen. Devices of type
GDK_DEVICE_TYPE_MASTER
will have TRUE
here.
Owner: GdkDevice
Flags: Read / Write / Construct Only
Default value: FALSE
“modifier-state”
property“modifier-state” GdkModifierType
The modifier state of the keyboard.
Owner: GdkDevice
Flags: Read
“n-axes”
property “n-axes” guint
Number of axes in the device.
Owner: GdkDevice
Flags: Read
Default value: 0
“name”
property “name” gchar *
The device name.
Owner: GdkDevice
Flags: Read / Write / Construct Only
Default value: NULL
“num-lock-state”
property “num-lock-state” gboolean
Whether the keyboard num lock is on.
Owner: GdkDevice
Flags: Read
Default value: FALSE
“num-touches”
property “num-touches” guint
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.
Owner: GdkDevice
Flags: Read / Write / Construct Only
Default value: 0
“product-id”
property “product-id” gchar *
Product ID of this device, see gdk_device_get_product_id()
.
Owner: GdkDevice
Flags: Read / Write / Construct Only
Default value: NULL
“scroll-lock-state”
property “scroll-lock-state” gboolean
Whether the keyboard scroll lock is on.
Owner: GdkDevice
Flags: Read
Default value: FALSE
“source”
property“source” GdkInputSource
Source type for the device.
Owner: GdkDevice
Flags: Read / Write / Construct Only
Default value: GDK_SOURCE_MOUSE
“tool”
property “tool” GdkDeviceTool *
The tool that is currently used with this device.
Owner: GdkDevice
Flags: Read
“type”
property“type” GdkDeviceType
Device role in the device manager.
Owner: GdkDevice
Flags: Read / Write / Construct Only
Default value: GDK_DEVICE_TYPE_MASTER
“vendor-id”
property “vendor-id” gchar *
Vendor ID of this device, see gdk_device_get_vendor_id()
.
Owner: GdkDevice
Flags: Read / Write / Construct Only
Default value: NULL
“changed”
signalvoid user_function (GdkDevice *device, gpointer user_data)
The ::changed signal is emitted either when the GdkDevice has changed the number of either axes or keys. For example In X this will normally happen when the slave device routing events through the master device changes (for example, user switches from the USB mouse to a tablet), in that case the master device will change to reflect the new slave device axes and keys.
device |
the GdkDevice that changed. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“tool-changed”
signalvoid user_function (GdkDevice *device, GdkDeviceTool *tool, gpointer user_data)
The ::tool-changed signal is emitted on pen/eraser GdkDevices whenever tools enter or leave proximity.
device |
the GdkDevice that changed. |
|
tool |
The new current tool |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last