Input Devices

Input Devices

Functions

Types and Values

Includes

#include <gdk/gdk.h>

Description

Functions

gdk_devices_list ()

GList *
gdk_devices_list (void);

Returns the list of available input devices for the default display. The list is statically allocated and should not be freed.

Returns

a list of GdkDevice.

[transfer none][element-type GdkDevice]


gdk_device_get_name ()

const gchar *
gdk_device_get_name (GdkDevice *device);

Determines the name of the device.

Parameters

device

a GdkDevice

 

Returns

a name

Since: 2.22


gdk_device_set_source ()

void
gdk_device_set_source (GdkDevice *device,
                       GdkInputSource source);

gdk_device_get_source ()

GdkInputSource
gdk_device_get_source (GdkDevice *device);

Determines the type of the device.

Parameters

device

a GdkDevice

 

Returns

a GdkInputSource

Since: 2.22


gdk_device_set_mode ()

gboolean
gdk_device_set_mode (GdkDevice *device,
                     GdkInputMode mode);

gdk_device_get_mode ()

GdkInputMode
gdk_device_get_mode (GdkDevice *device);

Determines the mode of the device.

Parameters

device

a GdkDevice

 

Returns

a GdkInputSource

Since: 2.22


gdk_device_set_key ()

void
gdk_device_set_key (GdkDevice *device,
                    guint index_,
                    guint keyval,
                    GdkModifierType modifiers);

gdk_device_get_key ()

void
gdk_device_get_key (GdkDevice *device,
                    guint index,
                    guint *keyval,
                    GdkModifierType *modifiers);

If index has a valid keyval, this function will fill in keyval and modifiers with the keyval settings.

Parameters

device

a GdkDevice.

 

index

the index of the macro button to get.

 

keyval

return value for the keyval.

 

modifiers

return value for modifiers.

 

Since: 2.22


gdk_device_set_axis_use ()

void
gdk_device_set_axis_use (GdkDevice *device,
                         guint index_,
                         GdkAxisUse use);

gdk_device_get_axis_use ()

GdkAxisUse
gdk_device_get_axis_use (GdkDevice *device,
                         guint index);

Returns the axis use for index .

Parameters

device

a GdkDevice.

 

index

the index of the axis.

 

Returns

a GdkAxisUse specifying how the axis is used.

Since: 2.22


gdk_device_get_core_pointer ()

GdkDevice *
gdk_device_get_core_pointer (void);

Returns the core pointer device for the default display.

Returns

the core pointer device; this is owned by the display and should not be freed.


gdk_device_get_state ()

void
gdk_device_get_state (GdkDevice *device,
                      GdkWindow *window,
                      gdouble *axes,
                      GdkModifierType *mask);

Gets the current state of a device.

Parameters

device

a GdkDevice.

 

window

a GdkWindow.

 

axes

an array of doubles to store the values of the axes of device in, or NULL.

 

mask

location to store the modifiers, or NULL.

 

gdk_device_get_history ()

gboolean
gdk_device_get_history (GdkDevice *device,
                        GdkWindow *window,
                        guint32 start,
                        guint32 stop,
                        GdkTimeCoord ***events,
                        gint *n_events);

Obtains the motion history for a 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.)

Parameters

device

a GdkDevice

 

window

the window 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 NULL.

[array length=n_events][out][transfer none]

n_events

location to store the length of events , or NULL

 

Returns

TRUE if the windowing system supports motion history and at least one event was found.


gdk_device_free_history ()

void
gdk_device_free_history (GdkTimeCoord **events,
                         gint n_events);

Frees an array of GdkTimeCoord that was returned by gdk_device_get_history().

Parameters

events

an array of GdkTimeCoord.

[inout][transfer none]

n_events

the length of the array.

 

gdk_device_get_axis ()

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.

Parameters

device

a GdkDevice

 

axes

pointer to an array of axes

 

use

the use to look for

 

value

location to store the found value.

 

Returns

TRUE if the given axis use was found, otherwise FALSE


gdk_device_get_n_axes ()

gint
gdk_device_get_n_axes (GdkDevice *device);

Gets the number of axes of a device.

Parameters

device

a GdkDevice.

 

Returns

the number of axes of device

Since: 2.22


gdk_input_set_extension_events ()

void
gdk_input_set_extension_events (GdkWindow *window,
                                gint mask,
                                GdkExtensionMode mode);

Types and Values

struct GdkDevice

struct GdkDevice {
  GObject parent_instance;
  /* All fields are read-only */

  gchar *GSEAL (name);
  GdkInputSource GSEAL (source);
  GdkInputMode GSEAL (mode);
  gboolean GSEAL (has_cursor);   /* TRUE if the X pointer follows device motion */

  gint GSEAL (num_axes);
  GdkDeviceAxis *GSEAL (axes);

  gint GSEAL (num_keys);
  GdkDeviceKey *GSEAL (keys);
};

enum GdkInputSource

Members

GDK_SOURCE_MOUSE

   

GDK_SOURCE_PEN

   

GDK_SOURCE_ERASER

   

GDK_SOURCE_CURSOR

   

enum GdkInputMode

Members

GDK_MODE_DISABLED

   

GDK_MODE_SCREEN

   

GDK_MODE_WINDOW

   

struct GdkDeviceKey

struct GdkDeviceKey {
  guint keyval;
  GdkModifierType modifiers;
};

struct GdkDeviceAxis

struct GdkDeviceAxis {
  GdkAxisUse use;
  gdouble    min;
  gdouble    max;
};

enum GdkAxisUse

Members

GDK_AXIS_IGNORE

   

GDK_AXIS_X

   

GDK_AXIS_Y

   

GDK_AXIS_PRESSURE

   

GDK_AXIS_XTILT

   

GDK_AXIS_YTILT

   

GDK_AXIS_WHEEL

   

GDK_AXIS_LAST

   

struct GdkTimeCoord

struct GdkTimeCoord {
  guint32 time;
  gdouble axes[GDK_MAX_TIMECOORD_AXES];
};

enum GdkExtensionMode

Members

GDK_EXTENSION_EVENTS_NONE

   

GDK_EXTENSION_EVENTS_ALL

   

GDK_EXTENSION_EVENTS_CURSOR