summaryrefslogtreecommitdiff
path: root/clutter/clutter/clutter-input-device-private.h
blob: b8506d5ec4f912f16ea5d0195fddeaa33825a967 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/*
 * Clutter.
 *
 * An OpenGL based 'interactive canvas' library.
 *
 * Copyright © 2009, 2010, 2011  Intel Corp.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 *
 * Author: Emmanuele Bassi <ebassi@linux.intel.com>
 */

#ifndef CLUTTER_INPUT_DEVICE_PRIVATE_H
#define CLUTTER_INPUT_DEVICE_PRIVATE_H

#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif

#include <clutter/clutter-input-device.h>

G_BEGIN_DECLS

typedef struct _ClutterAxisInfo
{
  ClutterInputAxis axis;

  double min_axis;
  double max_axis;

  double min_value;
  double max_value;

  double resolution;
} ClutterAxisInfo;

typedef struct _ClutterKeyInfo
{
  guint keyval;
  ClutterModifierType modifiers;
} ClutterKeyInfo;

typedef struct _ClutterScrollInfo
{
  guint axis_id;
  ClutterScrollDirection direction;
  double increment;

  double last_value;
  guint last_value_valid : 1;
} ClutterScrollInfo;

typedef struct _ClutterTouchInfo
{
  ClutterEventSequence *sequence;
  ClutterActor *actor;

  float current_x;
  float current_y;
} ClutterTouchInfo;

typedef struct _ClutterPtrA11yData
{
  int n_btn_pressed;
  float current_x;
  float current_y;

  float dwell_x;
  float dwell_y;
  gboolean dwell_drag_started;
  gboolean dwell_gesture_started;
  guint dwell_timer;
  guint dwell_position_timer;

  guint secondary_click_timer;
  gboolean secondary_click_triggered;
} ClutterPtrA11yData;

struct _ClutterInputDevice
{
  GObject parent_instance;

  int id;

  ClutterInputDeviceType device_type;
  ClutterInputMode device_mode;

  char *device_name;

  ClutterSeat *seat;

  ClutterBackend *backend;

  /* the associated device */
  ClutterInputDevice *associated;

  GList *physical_devices;

  /* the actor underneath the pointer */
  ClutterActor *cursor_actor;
  GHashTable   *inv_touch_sequence_actors;

  /* the actor that has a grab in place for the device */
  ClutterActor *pointer_grab_actor;
  ClutterActor *keyboard_grab_actor;
  GHashTable   *sequence_grab_actors;
  GHashTable   *inv_sequence_grab_actors;

  /* the current click count */
  int click_count;

  /* the stage the device is on */
  ClutterStage *stage;

  /* the current state */
  float current_x;
  float current_y;
  uint32_t current_time;
  int current_button_number;
  ClutterModifierType current_state;

  /* the current touch points states */
  GHashTable *touch_sequences_info;

  /* the previous state, used for click count generation */
  int previous_x;
  int previous_y;
  uint32_t previous_time;
  int previous_button_number;
  ClutterModifierType previous_state;

  GArray *axes;

  guint n_keys;
  GArray *keys;

  GArray *scroll_info;

  char *vendor_id;
  char *product_id;
  char *node_path;

  GPtrArray *tools;

  int n_rings;
  int n_strips;
  int n_mode_groups;

  ClutterInputDeviceMapping mapping_mode;

  guint has_cursor : 1;
  guint is_enabled : 1;

  /* Accessiblity */
  ClutterVirtualInputDevice *accessibility_virtual_device;
  ClutterPtrA11yData *ptr_a11y_data;
};

CLUTTER_EXPORT
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
                                                  ClutterInputDevice *associated);
CLUTTER_EXPORT
void _clutter_input_device_add_physical_device (ClutterInputDevice *logical,
                                                ClutterInputDevice *physical);
CLUTTER_EXPORT
void _clutter_input_device_remove_physical_device (ClutterInputDevice *logical,
                                                   ClutterInputDevice *physical);
CLUTTER_EXPORT
void clutter_input_device_update_from_tool (ClutterInputDevice     *device,
                                            ClutterInputDeviceTool *tool);
CLUTTER_EXPORT
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_device_set_stage (ClutterInputDevice *device,
                                      ClutterStage       *stage);
CLUTTER_EXPORT
void _clutter_input_device_set_coords (ClutterInputDevice   *device,
                                       ClutterEventSequence *sequence,
                                       gfloat                x,
                                       gfloat                y,
                                       ClutterStage         *stage);
CLUTTER_EXPORT
void _clutter_input_device_set_state (ClutterInputDevice  *device,
                                      ClutterModifierType  state);
CLUTTER_EXPORT
void _clutter_input_device_set_time (ClutterInputDevice *device,
                                     guint32             time_);
void _clutter_input_device_set_actor (ClutterInputDevice   *device,
                                      ClutterEventSequence *sequence,
                                      ClutterActor         *actor,
                                      gboolean              emit_crossing);
CLUTTER_EXPORT
ClutterActor * clutter_input_device_update (ClutterInputDevice   *device,
					    ClutterEventSequence *sequence,
					    gboolean              emit_crossing);
CLUTTER_EXPORT
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
                                               ClutterEvent       *event);
CLUTTER_EXPORT
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
                                                  ClutterEvent       *event);
CLUTTER_EXPORT
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
                                       guint               n_keys);
CLUTTER_EXPORT
void clutter_input_device_set_key (ClutterInputDevice  *device,
                                   guint                index_,
                                   guint                keyval,
                                   ClutterModifierType  modifiers);

CLUTTER_EXPORT
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
                                               guint               index_,
                                               gdouble             value,
                                               gdouble            *axis_value);
CLUTTER_EXPORT
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
                                      ClutterInputAxis    axis,
                                      gdouble             minimum,
                                      gdouble             maximum,
                                      gdouble             resolution);

CLUTTER_EXPORT
void _clutter_input_device_reset_axes (ClutterInputDevice *device);

CLUTTER_EXPORT
void _clutter_input_device_add_scroll_info (ClutterInputDevice     *device,
                                            guint                   index_,
                                            ClutterScrollDirection  direction,
                                            gdouble                 increment);
CLUTTER_EXPORT
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice     *device,
                                                 guint                   index_,
                                                 gdouble                 value,
                                                 ClutterScrollDirection *direction_p,
                                                 gdouble                *delta_p);
CLUTTER_EXPORT
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);

CLUTTER_EXPORT
void clutter_input_device_add_tool (ClutterInputDevice     *device,
                                    ClutterInputDeviceTool *tool);

CLUTTER_EXPORT
ClutterInputDeviceTool *
   clutter_input_device_lookup_tool (ClutterInputDevice         *device,
                                     guint64                     serial,
                                     ClutterInputDeviceToolType  type);

CLUTTER_EXPORT
void clutter_input_device_update_from_event (ClutterInputDevice  *device,
                                             ClutterEvent        *event,
                                             gboolean             update_stage);
CLUTTER_EXPORT
gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
                                                guint               hardware_keycode,
                                                guint              *evdev_keycode);

#endif /* CLUTTER_INPUT_DEVICE_PRIVATE_H */