~ubuntu-branches/ubuntu/natty/libxi/natty-201011191114

« back to all changes in this revision

Viewing changes to include/X11/extensions/XInput2.h

  • Committer: Bazaar Package Importer
  • Author(s): Julien Cristau
  • Date: 2009-11-21 18:39:28 UTC
  • mfrom: (1.1.10 upstream) (0.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20091121183928-ek2jwqx3rmhv3zjz
Tags: 2:1.3-1
* Bump Standards-Version to 3.8.3.
* Add build-deps on xmlto and asciidoc to build the manpages.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2009 Red Hat, Inc.
 
3
 *
 
4
 * Permission is hereby granted, free of charge, to any person obtaining a
 
5
 * copy of this software and associated documentation files (the "Software"),
 
6
 * to deal in the Software without restriction, including without limitation
 
7
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
8
 * and/or sell copies of the Software, and to permit persons to whom the
 
9
 * Software is furnished to do so, subject to the following conditions:
 
10
 *
 
11
 * The above copyright notice and this permission notice (including the next
 
12
 * paragraph) shall be included in all copies or substantial portions of the
 
13
 * Software.
 
14
 *
 
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
21
 * DEALINGS IN THE SOFTWARE.
 
22
 *
 
23
 */
 
24
 
 
25
/* Definitions used by the library and client */
 
26
 
 
27
#ifndef _XINPUT2_H_
 
28
#define _XINPUT2_H_
 
29
 
 
30
#include <X11/Xlib.h>
 
31
#include <X11/extensions/XI2.h>
 
32
#include <X11/extensions/Xge.h>
 
33
 
 
34
/*******************************************************************
 
35
 *
 
36
 */
 
37
typedef struct {
 
38
    int                 type;
 
39
    char*               name;
 
40
    Bool                send_core;
 
41
    Bool                enable;
 
42
} XIAddMasterInfo;
 
43
 
 
44
typedef struct {
 
45
    int                 type;
 
46
    int                 deviceid;
 
47
    int                 return_mode; /* AttachToMaster, Floating */
 
48
    int                 return_pointer;
 
49
    int                 return_keyboard;
 
50
} XIRemoveMasterInfo;
 
51
 
 
52
typedef struct {
 
53
    int                 type;
 
54
    int                 deviceid;
 
55
    int                 new_master;
 
56
} XIAttachSlaveInfo;
 
57
 
 
58
typedef struct {
 
59
    int                 type;
 
60
    int                 deviceid;
 
61
} XIDetachSlaveInfo;
 
62
 
 
63
typedef union {
 
64
    int                   type; /* must be first element */
 
65
    XIAddMasterInfo       add;
 
66
    XIRemoveMasterInfo    remove;
 
67
    XIAttachSlaveInfo     attach;
 
68
    XIDetachSlaveInfo     detach;
 
69
} XIAnyHierarchyChangeInfo;
 
70
 
 
71
typedef struct
 
72
{
 
73
    int    base;
 
74
    int    latched;
 
75
    int    locked;
 
76
    int    effective;
 
77
} XIModifierState;
 
78
 
 
79
typedef XIModifierState XIGroupState;
 
80
 
 
81
typedef struct {
 
82
    int           mask_len;
 
83
    unsigned char *mask;
 
84
} XIButtonState;
 
85
 
 
86
typedef struct {
 
87
    int           mask_len;
 
88
    unsigned char *mask;
 
89
    double        *values;
 
90
} XIValuatorState;
 
91
 
 
92
 
 
93
typedef struct
 
94
{
 
95
    int                 deviceid;
 
96
    int                 mask_len;
 
97
    unsigned char*      mask;
 
98
} XIEventMask;
 
99
 
 
100
typedef struct
 
101
{
 
102
    int         type;
 
103
    int         sourceid;
 
104
} XIAnyClassInfo;
 
105
 
 
106
typedef struct
 
107
{
 
108
    int         type;
 
109
    int         sourceid;
 
110
    int         num_buttons;
 
111
    Atom        *labels;
 
112
    XIButtonState state;
 
113
} XIButtonClassInfo;
 
114
 
 
115
typedef struct
 
116
{
 
117
    int         type;
 
118
    int         sourceid;
 
119
    int         num_keycodes;
 
120
    int         *keycodes;
 
121
} XIKeyClassInfo;
 
122
 
 
123
typedef struct
 
124
{
 
125
    int         type;
 
126
    int         sourceid;
 
127
    int         number;
 
128
    Atom        label;
 
129
    double      min;
 
130
    double      max;
 
131
    double      value;
 
132
    int         resolution;
 
133
    int         mode;
 
134
} XIValuatorClassInfo;
 
135
 
 
136
typedef struct
 
137
{
 
138
    int                 deviceid;
 
139
    char                *name;
 
140
    int                 use;
 
141
    int                 attachment;
 
142
    Bool                enabled;
 
143
    int                 num_classes;
 
144
    XIAnyClassInfo      **classes;
 
145
} XIDeviceInfo;
 
146
 
 
147
typedef struct
 
148
{
 
149
    int                 modifiers;
 
150
    int                 status;
 
151
} XIGrabModifiers;
 
152
 
 
153
/**
 
154
 * Generic XI2 event. All XI2 events have the same header.
 
155
 */
 
156
typedef struct {
 
157
    int           type;         /* GenericEvent */
 
158
    unsigned long serial;       /* # of last request processed by server */
 
159
    Bool          send_event;   /* true if this came from a SendEvent request */
 
160
    Display       *display;     /* Display the event was read from */
 
161
    int           extension;    /* XI extension offset */
 
162
    int           evtype;
 
163
    Time          time;
 
164
} XIEvent;
 
165
 
 
166
 
 
167
typedef struct {
 
168
    int           deviceid;
 
169
    int           attachment;
 
170
    int           use;
 
171
    Bool          enabled;
 
172
    int           flags;
 
173
} XIHierarchyInfo;
 
174
 
 
175
/*
 
176
 * Notifies the client that the device hierarchy has been changed. The client
 
177
 * is expected to re-query the server for the device hierarchy.
 
178
 */
 
179
typedef struct {
 
180
    int           type;         /* GenericEvent */
 
181
    unsigned long serial;       /* # of last request processed by server */
 
182
    Bool          send_event;   /* true if this came from a SendEvent request */
 
183
    Display       *display;     /* Display the event was read from */
 
184
    int           extension;    /* XI extension offset */
 
185
    int           evtype;       /* XI_HierarchyChanged */
 
186
    Time          time;
 
187
    int           flags;
 
188
    int           num_info;
 
189
    XIHierarchyInfo *info;
 
190
} XIHierarchyEvent;
 
191
 
 
192
/*
 
193
 * Notifies the client that the classes have been changed. This happens when
 
194
 * the slave device that sends through the master changes.
 
195
 */
 
196
typedef struct {
 
197
    int           type;         /* GenericEvent */
 
198
    unsigned long serial;       /* # of last request processed by server */
 
199
    Bool          send_event;   /* true if this came from a SendEvent request */
 
200
    Display       *display;     /* Display the event was read from */
 
201
    int           extension;    /* XI extension offset */
 
202
    int           evtype;       /* XI_DeviceChanged */
 
203
    Time          time;
 
204
    int           deviceid;     /* id of the device that changed */
 
205
    int           sourceid;     /* Source for the new classes. */
 
206
    int           reason;       /* Reason for the change */
 
207
    int           num_classes;
 
208
    XIAnyClassInfo **classes; /* same as in XIDeviceInfo */
 
209
} XIDeviceChangedEvent;
 
210
 
 
211
typedef struct {
 
212
    int           type;         /* GenericEvent */
 
213
    unsigned long serial;       /* # of last request processed by server */
 
214
    Bool          send_event;   /* true if this came from a SendEvent request */
 
215
    Display       *display;     /* Display the event was read from */
 
216
    int           extension;    /* XI extension offset */
 
217
    int           evtype;
 
218
    Time          time;
 
219
    int           deviceid;
 
220
    int           sourceid;
 
221
    int           detail;
 
222
    Window        root;
 
223
    Window        event;
 
224
    Window        child;
 
225
    double        root_x;
 
226
    double        root_y;
 
227
    double        event_x;
 
228
    double        event_y;
 
229
    int           flags;
 
230
    XIButtonState       buttons;
 
231
    XIValuatorState     valuators;
 
232
    XIModifierState     mods;
 
233
    XIGroupState        group;
 
234
} XIDeviceEvent;
 
235
 
 
236
typedef struct {
 
237
    int           type;         /* GenericEvent */
 
238
    unsigned long serial;       /* # of last request processed by server */
 
239
    Bool          send_event;   /* true if this came from a SendEvent request */
 
240
    Display       *display;     /* Display the event was read from */
 
241
    int           extension;    /* XI extension offset */
 
242
    int           evtype;       /* XI_RawKeyPress, XI_RawKeyRelease, etc. */
 
243
    Time          time;
 
244
    int           deviceid;
 
245
    int           sourceid;
 
246
    int           detail;
 
247
    int           flags;
 
248
    XIValuatorState valuators;
 
249
    double        *raw_values;
 
250
} XIRawEvent;
 
251
 
 
252
typedef struct {
 
253
    int           type;         /* GenericEvent */
 
254
    unsigned long serial;       /* # of last request processed by server */
 
255
    Bool          send_event;   /* true if this came from a SendEvent request */
 
256
    Display       *display;     /* Display the event was read from */
 
257
    int           extension;    /* XI extension offset */
 
258
    int           evtype;
 
259
    Time          time;
 
260
    int           deviceid;
 
261
    int           sourceid;
 
262
    int           detail;
 
263
    Window        root;
 
264
    Window        event;
 
265
    Window        child;
 
266
    double        root_x;
 
267
    double        root_y;
 
268
    double        event_x;
 
269
    double        event_y;
 
270
    int           mode;
 
271
    Bool          focus;
 
272
    Bool          same_screen;
 
273
    XIButtonState       buttons;
 
274
    XIModifierState     mods;
 
275
    XIGroupState        group;
 
276
} XIEnterEvent;
 
277
 
 
278
typedef XIEnterEvent XILeaveEvent;
 
279
typedef XIEnterEvent XIFocusInEvent;
 
280
typedef XIEnterEvent XIFocusOutEvent;
 
281
 
 
282
typedef struct {
 
283
    int           type;         /* GenericEvent */
 
284
    unsigned long serial;       /* # of last request processed by server */
 
285
    Bool          send_event;   /* true if this came from a SendEvent request */
 
286
    Display       *display;     /* Display the event was read from */
 
287
    int           extension;    /* XI extension offset */
 
288
    int           evtype;       /* XI_PropertyEvent */
 
289
    Time          time;
 
290
    int           deviceid;     /* id of the device that changed */
 
291
    Atom          property;
 
292
    int           what;
 
293
} XIPropertyEvent;
 
294
 
 
295
_XFUNCPROTOBEGIN
 
296
 
 
297
extern Bool     XIQueryPointer(
 
298
    Display*            display,
 
299
    int                 deviceid,
 
300
    Window              win,
 
301
    Window*             root,
 
302
    Window*             child,
 
303
    double*             root_x,
 
304
    double*             root_y,
 
305
    double*             win_x,
 
306
    double*             win_y,
 
307
    XIButtonState       *buttons,
 
308
    XIModifierState     *mods,
 
309
    XIGroupState        *group
 
310
);
 
311
 
 
312
extern Bool     XIWarpPointer(
 
313
    Display*            display,
 
314
    int                 deviceid,
 
315
    Window              src_win,
 
316
    Window              dst_win,
 
317
    double              src_x,
 
318
    double              src_y,
 
319
    unsigned int        src_width,
 
320
    unsigned int        src_height,
 
321
    double              dst_x,
 
322
    double              dst_y
 
323
);
 
324
 
 
325
extern Status   XIDefineCursor(
 
326
    Display*            display,
 
327
    int                 deviceid,
 
328
    Window              win,
 
329
    Cursor              cursor
 
330
);
 
331
 
 
332
extern Status   XIUndefineCursor(
 
333
    Display*            display,
 
334
    int                 deviceid,
 
335
    Window              win
 
336
);
 
337
 
 
338
extern Status   XIChangeHierarchy(
 
339
    Display*            display,
 
340
    XIAnyHierarchyChangeInfo*  changes,
 
341
    int                 num_changes
 
342
);
 
343
 
 
344
extern Status   XISetClientPointer(
 
345
    Display*            dpy,
 
346
    Window              win,
 
347
    int                 deviceid
 
348
);
 
349
 
 
350
extern Bool     XIGetClientPointer(
 
351
    Display*            dpy,
 
352
    Window              win,
 
353
    int*                deviceid
 
354
);
 
355
 
 
356
extern int      XISelectEvents(
 
357
     Display*            dpy,
 
358
     Window              win,
 
359
     XIEventMask         *masks,
 
360
     int                 num_masks
 
361
);
 
362
 
 
363
extern XIEventMask *XIGetSelectedEvents(
 
364
     Display*            dpy,
 
365
     Window              win,
 
366
     int                 *num_masks_return
 
367
);
 
368
 
 
369
extern Status XIQueryVersion(
 
370
     Display*           dpy,
 
371
     int*               major_version_inout,
 
372
     int*               minor_version_inout
 
373
);
 
374
 
 
375
extern XIDeviceInfo* XIQueryDevice(
 
376
     Display*           dpy,
 
377
     int                deviceid,
 
378
     int*               ndevices_return
 
379
);
 
380
 
 
381
extern Status XISetFocus(
 
382
     Display*           dpy,
 
383
     int                deviceid,
 
384
     Window             focus,
 
385
     Time               time
 
386
);
 
387
 
 
388
extern Status XIGetFocus(
 
389
     Display*           dpy,
 
390
     int                deviceid,
 
391
     Window             *focus_return);
 
392
 
 
393
extern Status XIGrabDevice(
 
394
     Display*           dpy,
 
395
     int                deviceid,
 
396
     Window             grab_window,
 
397
     Time               time,
 
398
     Cursor             cursor,
 
399
     int                grab_mode,
 
400
     int                paired_device_mode,
 
401
     Bool               owner_events,
 
402
     XIEventMask        *mask
 
403
);
 
404
 
 
405
extern Status XIUngrabDevice(
 
406
     Display*           dpy,
 
407
     int                deviceid,
 
408
     Time               time
 
409
);
 
410
 
 
411
extern Status XIAllowEvents(
 
412
    Display*            display,
 
413
    int                 deviceid,
 
414
    int                 event_mode,
 
415
    Time                time
 
416
);
 
417
 
 
418
extern int XIGrabButton(
 
419
    Display*            display,
 
420
    int                 deviceid,
 
421
    int                 button,
 
422
    Window              grab_window,
 
423
    Cursor              cursor,
 
424
    int                 grab_mode,
 
425
    int                 paired_device_mode,
 
426
    int                 owner_events,
 
427
    XIEventMask         *mask,
 
428
    int                 num_modifiers,
 
429
    XIGrabModifiers     *modifiers_inout
 
430
);
 
431
 
 
432
extern int XIGrabKeycode(
 
433
    Display*            display,
 
434
    int                 deviceid,
 
435
    int                 keycode,
 
436
    Window              grab_window,
 
437
    int                 grab_mode,
 
438
    int                 paired_device_mode,
 
439
    int                 owner_events,
 
440
    XIEventMask         *mask,
 
441
    int                 num_modifiers,
 
442
    XIGrabModifiers     *modifiers_inout
 
443
);
 
444
 
 
445
extern int XIGrabEnter(
 
446
    Display*            display,
 
447
    int                 deviceid,
 
448
    Window              grab_window,
 
449
    Cursor              cursor,
 
450
    int                 grab_mode,
 
451
    int                 paired_device_mode,
 
452
    int                 owner_events,
 
453
    XIEventMask         *mask,
 
454
    int                 num_modifiers,
 
455
    XIGrabModifiers     *modifiers_inout
 
456
);
 
457
 
 
458
extern int XIGrabFocusIn(
 
459
    Display*            display,
 
460
    int                 deviceid,
 
461
    Window              grab_window,
 
462
    int                 grab_mode,
 
463
    int                 paired_device_mode,
 
464
    int                 owner_events,
 
465
    XIEventMask         *mask,
 
466
    int                 num_modifiers,
 
467
    XIGrabModifiers     *modifiers_inout
 
468
);
 
469
extern Status XIUngrabButton(
 
470
    Display*            display,
 
471
    int                 deviceid,
 
472
    int                 button,
 
473
    Window              grab_window,
 
474
    int                 num_modifiers,
 
475
    XIGrabModifiers     *modifiers
 
476
);
 
477
 
 
478
extern Status XIUngrabKeycode(
 
479
    Display*            display,
 
480
    int                 deviceid,
 
481
    int                 keycode,
 
482
    Window              grab_window,
 
483
    int                 num_modifiers,
 
484
    XIGrabModifiers     *modifiers
 
485
);
 
486
 
 
487
extern Status XIUngrabEnter(
 
488
    Display*            display,
 
489
    int                 deviceid,
 
490
    Window              grab_window,
 
491
    int                 num_modifiers,
 
492
    XIGrabModifiers     *modifiers
 
493
);
 
494
 
 
495
extern Status XIUngrabFocusIn(
 
496
    Display*            display,
 
497
    int                 deviceid,
 
498
    Window              grab_window,
 
499
    int                 num_modifiers,
 
500
    XIGrabModifiers     *modifiers
 
501
);
 
502
 
 
503
 
 
504
extern Atom *XIListProperties(
 
505
    Display*            display,
 
506
    int                 deviceid,
 
507
    int                 *num_props_return
 
508
);
 
509
 
 
510
extern void XIChangeProperty(
 
511
    Display*            display,
 
512
    int                 deviceid,
 
513
    Atom                property,
 
514
    Atom                type,
 
515
    int                 format,
 
516
    int                 mode,
 
517
    unsigned char       *data,
 
518
    int                 num_items
 
519
);
 
520
 
 
521
extern void
 
522
XIDeleteProperty(
 
523
    Display*            display,
 
524
    int                 deviceid,
 
525
    Atom                property
 
526
);
 
527
 
 
528
extern Status
 
529
XIGetProperty(
 
530
    Display*            display,
 
531
    int                 deviceid,
 
532
    Atom                property,
 
533
    long                offset,
 
534
    long                length,
 
535
    Bool                delete_property,
 
536
    Atom                type,
 
537
    Atom                *type_return,
 
538
    int                 *format_return,
 
539
    unsigned long       *num_items_return,
 
540
    unsigned long       *bytes_after_return,
 
541
    unsigned char       **data
 
542
);
 
543
 
 
544
extern void XIFreeDeviceInfo(XIDeviceInfo       *info);
 
545
 
 
546
_XFUNCPROTOEND
 
547
 
 
548
#endif /* XINPUT2_H */