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.
- 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 in keyval
and modifiers
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
and win_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
and win_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 ()
Returns a List of
Atoms, containing the labels for the axes that this
currently has.
- 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 point x
,y
on the screen screen
, 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.