]> Pileus Git - ~andy/gtk/blob - gdk/gdkinput.h
Implement gdkcc (visually broken, but can be fixed by someone with a clue
[~andy/gtk] / gdk / gdkinput.h
1 #ifndef __GDK_INPUT_H__
2 #define __GDK_INPUT_H__
3
4 #include <gdk/gdktypes.h>
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif /* __cplusplus */
9
10 typedef struct _GdkDeviceKey        GdkDeviceKey;
11 typedef struct _GdkDeviceAxis       GdkDeviceAxis;
12 typedef struct _GdkDevice           GdkDevice;
13 typedef struct _GdkTimeCoord        GdkTimeCoord;
14
15 typedef enum
16 {
17   GDK_EXTENSION_EVENTS_NONE,
18   GDK_EXTENSION_EVENTS_ALL,
19   GDK_EXTENSION_EVENTS_CURSOR
20 } GdkExtensionMode;
21
22 typedef enum
23 {
24   GDK_SOURCE_MOUSE,
25   GDK_SOURCE_PEN,
26   GDK_SOURCE_ERASER,
27   GDK_SOURCE_CURSOR
28 } GdkInputSource;
29
30 typedef enum
31 {
32   GDK_MODE_DISABLED,
33   GDK_MODE_SCREEN,
34   GDK_MODE_WINDOW
35 } GdkInputMode;
36
37 typedef enum
38 {
39   GDK_AXIS_IGNORE,
40   GDK_AXIS_X,
41   GDK_AXIS_Y,
42   GDK_AXIS_PRESSURE,
43   GDK_AXIS_XTILT,
44   GDK_AXIS_YTILT,
45   GDK_AXIS_WHEEL,
46   GDK_AXIS_LAST
47 } GdkAxisUse;
48
49 struct _GdkDeviceKey
50 {
51   guint keyval;
52   GdkModifierType modifiers;
53 };
54
55 struct _GdkDeviceAxis
56 {
57   GdkAxisUse use;
58   gdouble    min;
59   gdouble    max;
60 };
61
62 struct _GdkDevice
63 {
64   /* All fields are read-only */
65           
66   gchar *name;
67   GdkInputSource source;
68   GdkInputMode mode;
69   gboolean has_cursor;       /* TRUE if the X pointer follows device motion */
70           
71   gint num_axes;
72   GdkDeviceAxis *axes;
73           
74   gint num_keys;
75   GdkDeviceKey *keys;
76 };
77
78 /* We don't allocate each coordinate this big, but we use it to
79  * be ANSI compliant and avoid accessing past the defined limits.
80  */
81 #define GDK_MAX_TIMECOORD_AXES 128
82
83 struct _GdkTimeCoord
84 {
85   guint32 time;
86   gdouble axes[GDK_MAX_TIMECOORD_AXES];
87 };
88
89 /* Returns a list of GdkDevice * */       
90 GList *        gdk_devices_list         (void);
91
92 /* Functions to configure a device */
93 void           gdk_device_set_source    (GdkDevice      *device,
94                                          GdkInputSource  source);
95           
96 gboolean       gdk_device_set_mode      (GdkDevice      *device,
97                                          GdkInputMode    mode);
98
99 void           gdk_device_set_key       (GdkDevice      *device,
100                                          guint           index,
101                                          guint           keyval,
102                                          GdkModifierType modifiers);
103
104 void     gdk_device_set_axis_use (GdkDevice         *device,
105                                   guint              index,
106                                   GdkAxisUse         use);
107 void     gdk_device_get_state    (GdkDevice         *device,
108                                   GdkWindow         *window,
109                                   gdouble           *axes,
110                                   GdkModifierType   *mask);
111 gboolean gdk_device_get_history  (GdkDevice         *device,
112                                   GdkWindow         *window,
113                                   guint32            start,
114                                   guint32            stop,
115                                   GdkTimeCoord    ***events,
116                                   gint              *n_events);
117 void     gdk_device_free_history (GdkTimeCoord     **events,
118                                   gint               n_events);
119 gboolean gdk_device_get_axis     (GdkDevice         *device,
120                                   gdouble           *axes,
121                                   GdkAxisUse         use,
122                                   gdouble           *value);
123
124 void gdk_input_set_extension_events (GdkWindow        *window,
125                                      gint              mask,
126                                      GdkExtensionMode  mode);
127
128 GDKVAR GdkDevice *gdk_core_pointer;
129  
130 #ifdef __cplusplus
131 }
132 #endif /* __cplusplus */
133
134 #endif /* __GDK_INPUT_H__ */