Class: Gdk::Device
- Inherits:
-
Object
- Object
- Gdk::Device
- Defined in:
- (unknown)
Overview
The Gdk::Device object represents a single input device, such as a keyboard, a mouse, a touchpad, etc.
See the Gdk::DeviceManager documentation for more information about the various kinds of master and slave devices, and their relationships.
Instance Method Summary collapse
-
#associated_device ⇒ Gdk::Device
Associated pointer or keyboard with this device, if any.
-
#associated_device=(associated_device) ⇒ Gdk::Device
Associated pointer or keyboard with this device, if any.
-
#axes ⇒ Gdk::AxisFlags
The axes currently available for this device.
-
#axes=(axes) ⇒ Gdk::AxisFlags
The axes currently available for this device.
-
#device_manager ⇒ Gdk::DeviceManager
The Gdk::DeviceManager the #GdkDevice pertains to.
-
#device_manager=(device_manager) ⇒ Gdk::DeviceManager
The Gdk::DeviceManager the #GdkDevice pertains to.
-
#device_type ⇒ Gdk::DeviceType
Returns the device type for device.
-
#display ⇒ Gdk::Display
The Gdk::Display the #GdkDevice pertains to.
-
#display=(display) ⇒ Gdk::Display
The Gdk::Display the #GdkDevice pertains to.
-
#get_axis(axes, use, value) ⇒ TrueClass
Interprets an array of double as axis values for a given device, and locates the value in the array for a given axis use.
-
#get_axis_use(index_) ⇒ Gdk::AxisUse
Returns the axis use for index_.
-
#get_axis_value(axes, axis_label, value) ⇒ TrueClass
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_list_axes().
-
#get_history(window, start, stop, events, n_events) ⇒ TrueClass
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.
-
#get_key(index_, keyval, modifiers) ⇒ TrueClass
If index_ has a valid keyval, this function will return true and fill in keyval and modifiers with the keyval settings.
-
#get_position(screen, x, y) ⇒ nil
Gets the current location of device.
-
#get_position_double(screen, x, y) ⇒ nil
Gets the current location of device in double precision.
-
#get_state(window, axes, mask) ⇒ nil
Gets the current state of a pointer device relative to window.
-
#get_window_at_position(win_x, win_y) ⇒ Gdk::Window
Obtains the window underneath device, returning the location of the device in win_x and win_y.
-
#get_window_at_position_double(win_x, win_y) ⇒ Gdk::Window
Obtains the window underneath device, returning the location of the device in win_x and win_y in double precision.
-
#grab(window, grab_ownership, owner_events, event_mask, cursor, time_) ⇒ Gdk::GrabStatus
Grabs the device so that all events coming from this device are passed to this application until the device is ungrabbed with gdk_device_ungrab(), or the window becomes unviewable.
-
#has_cursor ⇒ TrueClass
Determines whether the pointer follows device motion.
-
#has_cursor=(has_cursor) ⇒ TrueClass
Whether the device is represented by a cursor on the screen.
-
#has_cursor? ⇒ TrueClass
Whether the device is represented by a cursor on the screen.
-
#input_mode ⇒ Gdk::InputMode
Input-mode.
- #input_mode=(input_mode) ⇒ Gdk::InputMode
-
#input_source ⇒ Gdk::InputSource
Source type for the device.
-
#input_source=(input_source) ⇒ Gdk::InputSource
Source type for the device.
-
#last_event_window ⇒ Gdk::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.
-
#list_axes ⇒ GLib::List
Returns a #GList of Gdk::Atoms, containing the labels for the axes that device currently has.
-
#list_slave_devices ⇒ GLib::List
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 nil.
-
#mode ⇒ Gdk::InputMode
Determines the mode of the device.
-
#mode=(mode) ⇒ TrueClass
Sets a the mode of an input device.
-
#n_axes ⇒ Integer
Number of axes in the device.
-
#n_axes=(n_axes) ⇒ Integer
Number of axes in the device.
-
#n_keys ⇒ Integer
Returns the number of keys the device currently has.
-
#name ⇒ String
The device name.
-
#name=(name) ⇒ String
The device name.
-
#num_touches ⇒ Integer
The maximal number of concurrent touches on a touch device.
-
#num_touches=(num_touches) ⇒ Integer
The maximal number of concurrent touches on a touch device.
-
#product_id ⇒ String
Product ID of this device, see gdk_device_get_product_id().
-
#product_id=(product_id) ⇒ String
Product ID of this device, see gdk_device_get_product_id().
-
#seat ⇒ Gdk::Seat
Gdk::Seat of this device.
-
#seat=(seat) ⇒ Gdk::Seat
Gdk::Seat of this device.
-
#set_axis_use(index_, use) ⇒ nil
Specifies how an axis of a device is used.
-
#set_key(index_, keyval, modifiers) ⇒ nil
Specifies the X key event to generate when a macro button of a device is pressed.
-
#source ⇒ Gdk::InputSource
Determines the type of the device.
-
#tool ⇒ Gdk::DeviceTool
Tool.
- #tool=(tool) ⇒ Gdk::DeviceTool
-
#type ⇒ Gdk::DeviceType
Device role in the device manager.
-
#type=(type) ⇒ Gdk::DeviceType
Device role in the device manager.
-
#ungrab(time_) ⇒ nil
Release any grab on device.
-
#vendor_id ⇒ String
Vendor ID of this device, see gdk_device_get_vendor_id().
-
#vendor_id=(vendor_id) ⇒ String
Vendor ID of this device, see gdk_device_get_vendor_id().
-
#warp(screen, x, y) ⇒ nil
Warps device 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.
Instance Method Details
#associated_device ⇒ Gdk::Device
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 nil associated device.
#associated_device=(associated_device) ⇒ Gdk::Device
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 nil associated device.
#axes ⇒ Gdk::AxisFlags
The axes currently available for this device.
#axes=(axes) ⇒ Gdk::AxisFlags
The axes currently available for this device.
#device_manager ⇒ Gdk::DeviceManager
The Gdk::DeviceManager the #GdkDevice pertains to.
#device_manager=(device_manager) ⇒ Gdk::DeviceManager
The Gdk::DeviceManager the #GdkDevice pertains to.
#device_type ⇒ Gdk::DeviceType
Returns the device type for device.
#display ⇒ Gdk::Display
The Gdk::Display the #GdkDevice pertains to.
#display=(display) ⇒ Gdk::Display
The Gdk::Display the #GdkDevice pertains to.
#get_axis(axes, use, value) ⇒ TrueClass
Interprets an array of double as axis values for a given device, and locates the value in the array for a given axis use.
#get_axis_use(index_) ⇒ Gdk::AxisUse
Returns the axis use for index_.
#get_axis_value(axes, axis_label, value) ⇒ TrueClass
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_list_axes()
#get_history(window, start, stop, events, n_events) ⇒ TrueClass
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_window_set_event_compression() to get more motion events delivered directly, independent of the windowing system.
#get_key(index_, keyval, modifiers) ⇒ TrueClass
If index_ has a valid keyval, this function will return true and fill in keyval and modifiers with the keyval settings.
#get_position(screen, x, y) ⇒ nil
Gets the current location of device. 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_device_grab().
#get_position_double(screen, x, y) ⇒ nil
Gets the current location of device in double precision. 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_device_grab().
#get_state(window, axes, mask) ⇒ nil
Gets the current state of a pointer device relative to window. 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_device_grab(). the axes of device in, or nil.
#get_window_at_position(win_x, win_y) ⇒ Gdk::Window
Obtains the window underneath device, returning the location of the device in win_x and win_y. Returns nil if the window 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_device_grab(). device position, or nil.
#get_window_at_position_double(win_x, win_y) ⇒ Gdk::Window
Obtains the window underneath device, returning the location of the device in win_x and win_y in double precision. Returns nil if the window 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_device_grab().
#grab(window, grab_ownership, owner_events, event_mask, cursor, time_) ⇒ Gdk::GrabStatus
Grabs the device so that all events coming from this device are passed to this application until the device is ungrabbed with gdk_device_ungrab(), or the window becomes unviewable. This overrides any previous grab on the device by this client.
Note that device and window need to be on the same display.
Device grabs are used for operations which need complete control over the given device events (either pointer or keyboard). For example in GTK+ this is used for Drag and Drop operations, popup menus and such.
Note that if the event mask of an X window has selected both button press and button release events, then a button press event will cause an automatic pointer grab until the button is released. X does this automatically since most applications expect to receive button press and release events in pairs. It is equivalent to a pointer grab on the window with owner_events set to true.
If you set up anything at the time you take the grab that needs to be cleaned up when the grab ends, you should handle the Gdk::EventGrabBroken events that are emitted when the grab ends unvoluntarily.
#has_cursor ⇒ TrueClass
Determines whether the pointer follows device motion. This is not meaningful for keyboard devices, which don’t have a pointer.
#has_cursor=(has_cursor) ⇒ TrueClass
Whether the device is represented by a cursor on the screen. Devices of type %GDK_DEVICE_TYPE_MASTER will have true here.
#has_cursor? ⇒ TrueClass
Whether the device is represented by a cursor on the screen. Devices of type %GDK_DEVICE_TYPE_MASTER will have true here.
#input_mode ⇒ Gdk::InputMode
Returns input-mode.
#input_mode=(input_mode) ⇒ Gdk::InputMode
#input_source ⇒ Gdk::InputSource
Source type for the device.
#input_source=(input_source) ⇒ Gdk::InputSource
Source type for the device.
#last_event_window ⇒ Gdk::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. If another application has a pointer grab, or this application has a grab with owner_events = false, nil may be returned even if the pointer is physically over one of this application’s windows.
#list_axes ⇒ GLib::List
Returns a #GList of Gdk::Atoms, containing the labels for the axes that device currently has.
#list_slave_devices ⇒ GLib::List
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 nil
#mode ⇒ Gdk::InputMode
Determines the mode of the device.
#mode=(mode) ⇒ TrueClass
Sets a the mode of an input device. The mode controls if the device is active and whether the device’s range is mapped to the entire screen or to a single window.
Note: This is only meaningful for floating devices, master devices (and slaves connected to these) drive the pointer cursor, which is not limited by the input mode.
#n_axes ⇒ Integer
Number of axes in the device.
#n_axes=(n_axes) ⇒ Integer
Number of axes in the device.
#n_keys ⇒ Integer
Returns the number of keys the device currently has.
#name ⇒ String
The device name.
#name=(name) ⇒ String
The device name.
#num_touches ⇒ Integer
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.
#num_touches=(num_touches) ⇒ Integer
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.
#product_id ⇒ String
Product ID of this device, see gdk_device_get_product_id().
#product_id=(product_id) ⇒ String
Product ID of this device, see gdk_device_get_product_id().
#seat ⇒ Gdk::Seat
Gdk::Seat of this device.
#seat=(seat) ⇒ Gdk::Seat
Gdk::Seat of this device.
#set_axis_use(index_, use) ⇒ nil
Specifies how an axis of a device is used.
#set_key(index_, keyval, modifiers) ⇒ nil
Specifies the X key event to generate when a macro button of a device is pressed.
#source ⇒ Gdk::InputSource
Determines the type of the device.
#tool ⇒ Gdk::DeviceTool
Returns tool.
#tool=(tool) ⇒ Gdk::DeviceTool
#type ⇒ Gdk::DeviceType
Device role in the device manager.
#type=(type) ⇒ Gdk::DeviceType
Device role in the device manager.
#ungrab(time_) ⇒ nil
Release any grab on device.
#vendor_id ⇒ String
Vendor ID of this device, see gdk_device_get_vendor_id().
#vendor_id=(vendor_id) ⇒ String
Vendor ID of this device, see gdk_device_get_vendor_id().
#warp(screen, x, y) ⇒ nil
Warps device 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. Warping the pointer creates events as if the user had moved the mouse instantaneously to the destination.
Note that the pointer should normally be under the control of the user. This function was added to cover some rare use cases like keyboard navigation support for the color picker in the Gtk::ColorSelectionDialog.