Device
Object Hierarchy:
Description:
The Device object represents a single input device, such as a keyboard, a mouse, a touchpad, etc.
See the DeviceManager documentation for more information about the various kinds of master and slave devices, and their relationships.
Required by:
Namespace: Gdk
Package: gdk-3.0
Content:
Properties:
- public Device? associated_device { get; }
Associated pointer or keyboard with this device, if any.
- public AxisFlags axes { get; }
The axes currently available for this device.
- public DeviceManager device_manager { owned get; construct; }
The DeviceManager the Device pertains to.
- public Display display { get; construct; }
The Display the Device pertains to.
- public bool has_cursor { get; construct; }
Whether the device is represented by a cursor on the screen.
- public InputMode input_mode { get; set; }
- public InputSource input_source { get; construct; }
Source type for the device.
- public uint n_axes { get; }
Number of axes in the device.
- public string? name { get; construct; }
The device name.
- public uint num_touches { get; construct; }
The maximal number of concurrent touches on a touch device.
- public string product_id { get; construct; }
Product ID of this device, see get_product_id.
- public Seat seat { owned get; set; }
Seat of this device.
- public DeviceTool tool { owned get; }
- public DeviceType type { get; construct; }
Device role in the device manager.
- public string vendor_id { get; construct; }
Vendor ID of this device, see get_vendor_id.
Static methods:
- public static void free_history (TimeCoord[] events)
Frees an array of TimeCoord that was returned by get_history.
Creation methods:
- protected Device ()
Methods:
- public unowned Device? get_associated_device ()
Returns the associated device to this, if this is of type gdk_device_type_master, it will return the paired pointer or keyboard.
- public AxisFlags get_axes ()
Returns the axes currently available on the device.
- public bool get_axis (double[] axes, AxisUse use, out double 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.
- public AxisUse get_axis_use (uint index_)
Returns the axis use for
index_
. - public bool get_axis_value (double[] axes, Atom axis_label, out double 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 list_axes
- public DeviceType get_device_type ()
Returns the device type for this.
- public unowned Display get_display ()
Returns the Display to which this pertains.
- public bool get_has_cursor ()
Determines whether the pointer follows device motion.
- public bool get_history (Window window, uint32 start, uint32 stop, out TimeCoord[] 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.
- public bool get_key (uint index_, out uint keyval, out ModifierType modifiers)
If
index_
has a valid keyval, this function will return true and fill inkeyval
andmodifiers
with the keyval settings. - public unowned Window? get_last_event_window ()
Gets information about which window the given pointer device is in, based on events that have been received so far from the display server.
- public InputMode get_mode ()
Determines the mode of the device.
- public int get_n_axes ()
Returns the number of axes the device currently has.
- public int get_n_keys ()
Returns the number of keys the device currently has.
- public unowned string get_name ()
Determines the name of the device.
- public void get_position (out unowned Screen screen, out int x, out int y)
Gets the current location of this.
- public void get_position_double (out unowned Screen screen, out double x, out double y)
Gets the current location of this in double precision.
- public unowned string? get_product_id ()
Returns the product ID of this device, or null if this information couldn't be obtained.
- public unowned Seat get_seat ()
Returns the Seat the device belongs to.
- public InputSource get_source ()
Determines the type of the device.
- public void get_state (Window window, double[]? axes, out ModifierType mask)
Gets the current state of a pointer device relative to
window
. - public unowned string? get_vendor_id ()
Returns the vendor ID of this device, or null if this information couldn't be obtained.
- public unowned Window? get_window_at_position (out int win_x, out int win_y)
Obtains the window underneath this, returning the location of the device in
win_x
andwin_y
. - public unowned Window? get_window_at_position_double (out double win_x, out double win_y)
Obtains the window underneath this, returning the location of the device in
win_x
andwin_y
in double precision. - public GrabStatus grab (Window window, GrabOwnership grab_ownership, bool owner_events, EventMask event_mask, Cursor? cursor, uint32 time_)
Grabs the device so that all events coming from this device are passed to this application until the device is ungrabbed with ungrab, or the window becomes unviewable.
- public List<Atom> list_axes ()
- public List<unowned Device>? list_slave_devices ()
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
- public void set_axis_use (uint index_, AxisUse use)
Specifies how an axis of a device is used.
- public void set_key (uint index_, uint keyval, ModifierType modifiers)
Specifies the X key event to generate when a macro button of a device is pressed.
- public bool set_mode (InputMode mode)
Sets a the mode of an input device.
- public void ungrab (uint32 time_)
Release any grab on this.
- public void warp (Screen screen, int x, int y)
Warps this in
display
to the pointx
,y
on the screenscreen
, unless the device is confined to a window by a grab, in which case it will be moved as far as allowed by the grab.
Signals:
- public signal void changed ()
The changed signal is emitted either when the Device has changed the number of either axes or keys.
- public signal void tool_changed (DeviceTool tool)
The tool_changed signal is emitted on pen/eraser Devices whenever tools enter or leave proximity.
Inherited Members:
All known members inherited from class GLib.Object