forked from sizeofvoid/libinput
-
Notifications
You must be signed in to change notification settings - Fork 1
/
libinput.h
6250 lines (5905 loc) · 199 KB
/
libinput.h
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright © 2013 Jonas Ådahl
* Copyright © 2013-2015 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef LIBINPUT_H
#define LIBINPUT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
struct udev;
struct udev_device;
#define LIBINPUT_ATTRIBUTE_PRINTF(_format, _args) \
__attribute__ ((format (printf, _format, _args)))
#define LIBINPUT_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
/**
* @ingroup base
* @struct libinput
*
* A handle for accessing libinput. This struct is refcounted, use
* libinput_ref() and libinput_unref().
*/
struct libinput;
/**
* @ingroup device
* @struct libinput_device
*
* A base handle for accessing libinput devices. This struct is
* refcounted, use libinput_device_ref() and libinput_device_unref().
*/
struct libinput_device;
/**
* @ingroup device
* @struct libinput_device_group
*
* A base handle for accessing libinput device groups. This struct is
* refcounted, use libinput_device_group_ref() and
* libinput_device_group_unref().
*/
struct libinput_device_group;
/**
* @ingroup seat
* @struct libinput_seat
*
* The base handle for accessing libinput seats. This struct is
* refcounted, use libinput_seat_ref() and libinput_seat_unref().
*/
struct libinput_seat;
/**
* @ingroup device
* @struct libinput_tablet_tool
*
* An object representing a tool being used by a device with the @ref
* LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
*
* Tablet events generated by such a device are bound to a specific tool
* rather than coming from the device directly. Depending on the hardware it
* is possible to track the same physical tool across multiple
* struct libinput_device devices.
* See libinput_tablet_tool_get_serial() for more details.
*
* This struct is refcounted, use libinput_tablet_tool_ref() and
* libinput_tablet_tool_unref().
*
* @since 1.2
*/
struct libinput_tablet_tool;
/**
* @ingroup event
* @struct libinput_event
*
* The base event type. Use libinput_event_get_pointer_event() or similar to
* get the actual event type.
*
* @warning Unlike other structs events are considered transient and
* <b>not</b> refcounted.
*/
struct libinput_event;
/**
* @ingroup event
* @struct libinput_event_device_notify
*
* An event notifying the caller of a device being added or removed.
*/
struct libinput_event_device_notify;
/**
* @ingroup event_keyboard
* @struct libinput_event_keyboard
*
* A keyboard event representing a key press/release.
*/
struct libinput_event_keyboard;
/**
* @ingroup event_pointer
* @struct libinput_event_pointer
*
* A pointer event representing relative or absolute pointer movement,
* a button press/release or scroll axis events.
*/
struct libinput_event_pointer;
/**
* @ingroup event_touch
* @struct libinput_event_touch
*
* Touch event representing a touch down, move or up, as well as a touch
* cancel and touch frame events. Valid event types for this event are @ref
* LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_MOTION, @ref
* LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_CANCEL and @ref
* LIBINPUT_EVENT_TOUCH_FRAME.
*/
struct libinput_event_touch;
/**
* @ingroup event_tablet
* @struct libinput_event_tablet_tool
*
* Tablet tool event representing an axis update, button press, or tool
* update. Valid event types for this event are @ref
* LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
* LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY and @ref
* LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
*
* @since 1.2
*/
struct libinput_event_tablet_tool;
/**
* @ingroup event_tablet_pad
* @struct libinput_event_tablet_pad
*
* Tablet pad event representing a button press, or ring/strip update on
* the tablet pad itself. Valid event types for this event are @ref
* LIBINPUT_EVENT_TABLET_PAD_BUTTON, @ref LIBINPUT_EVENT_TABLET_PAD_RING and
* @ref LIBINPUT_EVENT_TABLET_PAD_STRIP.
*
* @since 1.3
*/
struct libinput_event_tablet_pad;
/**
* @ingroup base
*
* Log priority for internal logging messages.
*/
enum libinput_log_priority {
LIBINPUT_LOG_PRIORITY_DEBUG = 10,
LIBINPUT_LOG_PRIORITY_INFO = 20,
LIBINPUT_LOG_PRIORITY_ERROR = 30,
};
/**
* @ingroup device
*
* Capabilities on a device. A device may have one or more capabilities
* at a time, capabilities remain static for the lifetime of the device.
*/
enum libinput_device_capability {
LIBINPUT_DEVICE_CAP_KEYBOARD = 0,
LIBINPUT_DEVICE_CAP_POINTER = 1,
LIBINPUT_DEVICE_CAP_TOUCH = 2,
LIBINPUT_DEVICE_CAP_TABLET_TOOL = 3,
LIBINPUT_DEVICE_CAP_TABLET_PAD = 4,
LIBINPUT_DEVICE_CAP_GESTURE = 5,
LIBINPUT_DEVICE_CAP_SWITCH = 6,
};
/**
* @ingroup device
*
* Logical state of a key. Note that the logical state may not represent
* the physical state of the key.
*/
enum libinput_key_state {
LIBINPUT_KEY_STATE_RELEASED = 0,
LIBINPUT_KEY_STATE_PRESSED = 1
};
/**
* @ingroup device
*
* Mask reflecting LEDs on a device.
*/
enum libinput_led {
LIBINPUT_LED_NUM_LOCK = (1 << 0),
LIBINPUT_LED_CAPS_LOCK = (1 << 1),
LIBINPUT_LED_SCROLL_LOCK = (1 << 2)
};
/**
* @ingroup device
*
* Logical state of a physical button. Note that the logical state may not
* represent the physical state of the button.
*/
enum libinput_button_state {
LIBINPUT_BUTTON_STATE_RELEASED = 0,
LIBINPUT_BUTTON_STATE_PRESSED = 1
};
/**
* @ingroup device
*
* Axes on a device with the capability @ref LIBINPUT_DEVICE_CAP_POINTER
* that are not x or y coordinates.
*
* The two scroll axes @ref LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL and
* @ref LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL are engaged separately,
* depending on the device. libinput provides some scroll direction locking
* but it is up to the caller to determine which axis is needed and
* appropriate in the current interaction
*/
enum libinput_pointer_axis {
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL = 0,
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL = 1,
};
/**
* @ingroup device
*
* The source for a libinput_pointer_axis event. See
* libinput_event_pointer_get_axis_source() for details.
*
* @note Pointer axis sources are deprecated, the source is now encoded in
* the event types
* @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,
* @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and
* @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS.
*/
enum libinput_pointer_axis_source {
/**
* The event is caused by the rotation of a wheel.
*/
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL = 1,
/**
* The event is caused by the movement of one or more fingers on a
* device.
*/
LIBINPUT_POINTER_AXIS_SOURCE_FINGER,
/**
* The event is caused by the motion of some device.
*/
LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS,
/**
* The event is caused by the tilting of a mouse wheel rather than
* its rotation. This method is commonly used on mice without
* separate horizontal scroll wheels.
*
* @deprecated This axis source is deprecated as of libinput 1.16.
* It was never used by any device before libinput 1.16. All wheel
* tilt devices use @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL instead.
*/
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT,
};
/**
* @ingroup event_tablet_pad
*
* The source for a @ref LIBINPUT_EVENT_TABLET_PAD_RING event. See
* libinput_event_tablet_pad_get_ring_source() for details.
*
* @since 1.3
*/
enum libinput_tablet_pad_ring_axis_source {
LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN = 1,
/**
* The event is caused by the movement of one or more fingers on
* the ring.
*/
LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER,
};
/**
* @ingroup event_tablet_pad
*
* The source for a @ref LIBINPUT_EVENT_TABLET_PAD_STRIP event. See
* libinput_event_tablet_pad_get_strip_source() for details.
*
* @since 1.3
*/
enum libinput_tablet_pad_strip_axis_source {
LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN = 1,
/**
* The event is caused by the movement of one or more fingers on
* the strip.
*/
LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER,
};
/**
* @ingroup device
*
* Available tool types for a device with the @ref
* LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. The tool type defines the default
* usage of the tool as advertised by the manufacturer. Multiple different
* physical tools may share the same tool type, e.g. a Wacom Classic Pen,
* Wacom Pro Pen and a Wacom Grip Pen are all of type @ref
* LIBINPUT_TABLET_TOOL_TYPE_PEN.
* Use libinput_tablet_tool_get_tool_id() to get a specific model where applicable.
*
* Note that on some device, the eraser tool is on the tail end of a pen
* device. On other devices, e.g. MS Surface 3, the eraser is the pen tip
* while a button is held down.
*
* @note The @ref libinput_tablet_tool_type can only describe the default physical
* type of the device. For devices with adjustable physical properties
* the tool type remains the same, i.e. putting a Wacom stroke nib into a
* classic pen leaves the tool type as @ref LIBINPUT_TABLET_TOOL_TYPE_PEN.
*
* @since 1.2
*/
enum libinput_tablet_tool_type {
LIBINPUT_TABLET_TOOL_TYPE_PEN = 1, /**< A generic pen */
LIBINPUT_TABLET_TOOL_TYPE_ERASER, /**< Eraser */
LIBINPUT_TABLET_TOOL_TYPE_BRUSH, /**< A paintbrush-like tool */
LIBINPUT_TABLET_TOOL_TYPE_PENCIL, /**< Physical drawing tool, e.g.
Wacom Inking Pen */
LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH, /**< An airbrush-like tool */
LIBINPUT_TABLET_TOOL_TYPE_MOUSE, /**< A mouse bound to the tablet */
LIBINPUT_TABLET_TOOL_TYPE_LENS, /**< A mouse tool with a lens */
LIBINPUT_TABLET_TOOL_TYPE_TOTEM, /**< A rotary device with
positional and rotation
data */
};
/**
* @ingroup device
*
* The state of proximity for a tool on a device. The device must have the @ref
* LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
*
* The proximity of a tool is a binary state signalling whether the tool is
* within a detectable distance of the tablet device. A tool that is out of
* proximity cannot generate events.
*
* On some hardware a tool goes out of proximity when it ceases to touch the
* surface. On other hardware, the tool is still detectable within a short
* distance (a few cm) off the surface.
*
* @since 1.2
*/
enum libinput_tablet_tool_proximity_state {
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT = 0,
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN = 1,
};
/**
* @ingroup device
*
* The tip contact state for a tool on a device. The device must have
* the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
*
* The tip contact state of a tool is a binary state signalling whether the tool is
* touching the surface of the tablet device.
*
* @since 1.2
*/
enum libinput_tablet_tool_tip_state {
LIBINPUT_TABLET_TOOL_TIP_UP = 0,
LIBINPUT_TABLET_TOOL_TIP_DOWN = 1,
};
/**
* @defgroup tablet_pad_modes Tablet pad modes
*
* Handling the virtual mode groups of buttons, strips and rings on tablet
* pad devices. See the libinput documentation for more details.
*/
/**
* @ingroup tablet_pad_modes
* @struct libinput_tablet_pad_mode_group
*
* A mode on a tablet pad is a virtual grouping of functionality, usually
* based on some visual feedback like LEDs on the pad. The set of buttons,
* rings and strips that share the same mode are a "mode group". Whenever
* the mode changes, all buttons, rings and strips within this mode group
* are affected.
*
* Most tablets only have a single mode group, some tablets provide multiple
* mode groups through independent banks of LEDs (e.g. the Wacom Cintiq
* 24HD). libinput guarantees that at least one mode group is always
* available.
*
* This struct is refcounted, use libinput_tablet_pad_mode_group_ref() and
* libinput_tablet_pad_mode_group_unref().
*
* @since 1.4
*/
struct libinput_tablet_pad_mode_group;
/**
* @ingroup tablet_pad_modes
*
* Most devices only provide a single mode group, however devices such as
* the Wacom Cintiq 22HD provide two mode groups. If multiple mode groups
* are available, a caller should use
* libinput_tablet_pad_mode_group_has_button(),
* libinput_tablet_pad_mode_group_has_ring() and
* libinput_tablet_pad_mode_group_has_strip() to associate each button,
* ring and strip with the correct mode group.
*
* @return the number of mode groups available on this device
*
* @since 1.4
*/
int
libinput_device_tablet_pad_get_num_mode_groups(struct libinput_device *device);
/**
* @ingroup tablet_pad_modes
*
* The returned mode group is not refcounted and may become invalid after
* the next call to libinput. Use libinput_tablet_pad_mode_group_ref() and
* libinput_tablet_pad_mode_group_unref() to continue using the handle
* outside of the immediate scope.
*
* While at least one reference is kept by the caller, the returned mode
* group will be identical for each subsequent call of this function with
* the same index and that same struct is returned from
* libinput_event_tablet_pad_get_mode_group(), provided the event was
* generated by this mode group.
*
* @param device A device with the @ref LIBINPUT_DEVICE_CAP_TABLET_PAD
* capability
* @param index A mode group index
* @return the mode group with the given index or NULL if an invalid index
* is given.
*
* @since 1.4
*/
struct libinput_tablet_pad_mode_group*
libinput_device_tablet_pad_get_mode_group(struct libinput_device *device,
unsigned int index);
/**
* @ingroup tablet_pad_modes
*
* The returned number is the same index as passed to
* libinput_device_tablet_pad_get_mode_group(). For tablets with only one
* mode this number is always 0.
*
* @param group A previously obtained mode group
* @return the numeric index this mode group represents, starting at 0
*
* @since 1.4
*/
unsigned int
libinput_tablet_pad_mode_group_get_index(struct libinput_tablet_pad_mode_group *group);
/**
* @ingroup tablet_pad_modes
*
* Query the mode group for the number of available modes. The number of
* modes is usually decided by the number of physical LEDs available on the
* device. Different mode groups may have a different number of modes. Use
* libinput_tablet_pad_mode_group_get_mode() to get the currently active
* mode.
*
* libinput guarantees that at least one mode is available. A device without
* mode switching capability has a single mode group and a single mode.
*
* @param group A previously obtained mode group
* @return the number of modes available in this mode group
*
* @since 1.4
*/
unsigned int
libinput_tablet_pad_mode_group_get_num_modes(struct libinput_tablet_pad_mode_group *group);
/**
* @ingroup tablet_pad_modes
*
* Return the current mode this mode group is in. Note that the returned
* mode is the mode valid as of completing the last libinput_dispatch().
* The returned mode may thus be different than the mode returned by
* libinput_event_tablet_pad_get_mode().
*
* For example, if the mode was toggled three times between the call to
* libinput_dispatch(), this function returns the third mode but the events
* in the event queue will return the modes 1, 2 and 3, respectively.
*
* @param group A previously obtained mode group
* @return the numeric index of the current mode in this group, starting at 0
*
* @see libinput_event_tablet_pad_get_mode
*
* @since 1.4
*/
unsigned int
libinput_tablet_pad_mode_group_get_mode(struct libinput_tablet_pad_mode_group *group);
/**
* @ingroup tablet_pad_modes
*
* Devices without mode switching capabilities return true for every button.
*
* @param group A previously obtained mode group
* @param button A button index, starting at 0
* @return true if the given button index is part of this mode group or
* false otherwise
*
* @since 1.4
*/
int
libinput_tablet_pad_mode_group_has_button(struct libinput_tablet_pad_mode_group *group,
unsigned int button);
/**
* @ingroup tablet_pad_modes
*
* Devices without mode switching capabilities return true for every ring.
*
* @param group A previously obtained mode group
* @param ring A ring index, starting at 0
* @return true if the given ring index is part of this mode group or
* false otherwise
*
* @since 1.4
*/
int
libinput_tablet_pad_mode_group_has_ring(struct libinput_tablet_pad_mode_group *group,
unsigned int ring);
/**
* @ingroup tablet_pad_modes
*
* Devices without mode switching capabilities return true for every strip.
*
* @param group A previously obtained mode group
* @param strip A strip index, starting at 0
* @return true if the given strip index is part of this mode group or
* false otherwise
*
* @since 1.4
*/
int
libinput_tablet_pad_mode_group_has_strip(struct libinput_tablet_pad_mode_group *group,
unsigned int strip);
/**
* @ingroup tablet_pad_modes
*
* The toggle button in a mode group is the button assigned to cycle to or
* directly assign a new mode when pressed. Not all devices have a toggle
* button and some devices may have more than one toggle button. For
* example, the Wacom Cintiq 24HD has six toggle buttons in two groups, each
* directly selecting one of the three modes per group.
*
* Devices without mode switching capabilities return false for every button.
*
* @param group A previously obtained mode group
* @param button A button index, starting at 0
* @retval non-zero if the button is a mode toggle button for this group, or
* zero otherwise
*
* @since 1.4
*/
int
libinput_tablet_pad_mode_group_button_is_toggle(struct libinput_tablet_pad_mode_group *group,
unsigned int button);
/**
* @ingroup tablet_pad_modes
*
* Increase the refcount of the mode group. A mode group will be
* freed whenever the refcount reaches 0.
*
* @param group A previously obtained mode group
* @return The passed mode group
*
* @since 1.4
*/
struct libinput_tablet_pad_mode_group *
libinput_tablet_pad_mode_group_ref(
struct libinput_tablet_pad_mode_group *group);
/**
* @ingroup tablet_pad_modes
*
* Decrease the refcount of the mode group. A mode group will be
* freed whenever the refcount reaches 0.
*
* @param group A previously obtained mode group
* @return NULL if the group was destroyed, otherwise the passed mode group
*
* @since 1.4
*/
struct libinput_tablet_pad_mode_group *
libinput_tablet_pad_mode_group_unref(
struct libinput_tablet_pad_mode_group *group);
/**
* @ingroup tablet_pad_modes
*
* Set caller-specific data associated with this mode group. libinput does
* not manage, look at, or modify this data. The caller must ensure the
* data is valid.
*
* @param group A previously obtained mode group
* @param user_data Caller-specific data pointer
* @see libinput_tablet_pad_mode_group_get_user_data
*
* @since 1.4
*/
void
libinput_tablet_pad_mode_group_set_user_data(
struct libinput_tablet_pad_mode_group *group,
void *user_data);
/**
* @ingroup tablet_pad_modes
*
* Get the caller-specific data associated with this mode group, if any.
*
* @param group A previously obtained mode group
* @return Caller-specific data pointer or NULL if none was set
* @see libinput_tablet_pad_mode_group_set_user_data
*
* @since 1.4
*/
void *
libinput_tablet_pad_mode_group_get_user_data(
struct libinput_tablet_pad_mode_group *group);
/**
* @ingroup device
*
* The state of a switch. The default state of a switch is @ref
* LIBINPUT_SWITCH_STATE_OFF and no event is sent to confirm a switch in the
* off position. If a switch is logically on during initialization, libinput
* sends an event of type @ref LIBINPUT_EVENT_SWITCH_TOGGLE with a state
* @ref LIBINPUT_SWITCH_STATE_ON.
*
* @since 1.7
*/
enum libinput_switch_state {
LIBINPUT_SWITCH_STATE_OFF = 0,
LIBINPUT_SWITCH_STATE_ON = 1,
};
/**
* @ingroup device
*
* The type of a switch.
*
* @since 1.7
*/
enum libinput_switch {
/**
* The laptop lid was closed when the switch state is @ref
* LIBINPUT_SWITCH_STATE_ON, or was opened when it is @ref
* LIBINPUT_SWITCH_STATE_OFF.
*/
LIBINPUT_SWITCH_LID = 1,
/**
* This switch indicates whether the device is in normal laptop mode
* or behaves like a tablet-like device where the primary
* interaction is usually a touch screen. When in tablet mode, the
* keyboard and touchpad are usually inaccessible.
*
* If the switch is in state @ref LIBINPUT_SWITCH_STATE_OFF, the
* device is in laptop mode. If the switch is in state @ref
* LIBINPUT_SWITCH_STATE_ON, the device is in tablet mode and the
* keyboard or touchpad may not be accessible.
*
* It is up to the caller to identify which devices are inaccessible
* in tablet mode.
*/
LIBINPUT_SWITCH_TABLET_MODE,
};
/**
* @ingroup event_switch
* @struct libinput_event_switch
*
* A switch event representing a changed state in a switch.
*
* @since 1.7
*/
struct libinput_event_switch;
/**
* @ingroup base
*
* Event type for events returned by libinput_get_event().
*/
enum libinput_event_type {
/**
* This is not a real event type, and is only used to tell the user that
* no new event is available in the queue. See
* libinput_next_event_type().
*/
LIBINPUT_EVENT_NONE = 0,
/**
* Signals that a device has been added to the context. The device will
* not be read until the next time the user calls libinput_dispatch()
* and data is available.
*
* This allows setting up initial device configuration before any events
* are created.
*/
LIBINPUT_EVENT_DEVICE_ADDED,
/**
* Signals that a device has been removed. No more events from the
* associated device will be in the queue or be queued after this event.
*/
LIBINPUT_EVENT_DEVICE_REMOVED,
LIBINPUT_EVENT_KEYBOARD_KEY = 300,
LIBINPUT_EVENT_POINTER_MOTION = 400,
LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE,
LIBINPUT_EVENT_POINTER_BUTTON,
/**
* A scroll event from various sources.
*
* This event is deprecated as of libinput 1.19. Use
* @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,
* @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and
* @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS instead.
*
* Use libinput_event_pointer_get_axis_source() to determine the
* source of a scroll event. For libinput versions 1.19 and later,
* the source is encoded in the event type.
*
* This event is sent **in addition** to events of type
* @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,
* @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and
* @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS.
* Do not mix and match, either use the old event or the new events.
* libinput makes no guarantee about the relation between
* @ref LIBINPUT_EVENT_POINTER_AXIS and the new event types
* @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,
* @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and
* @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS. You may receive
* multiple zero, one or more new events per legacy event.
*
* @warning Ignore this event if you are processing
* @ref LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,
* @ref LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and
* @ref LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS.
*/
LIBINPUT_EVENT_POINTER_AXIS,
/**
* A scroll event from a wheel. This event is sent is sent **in
* addition** to the @ref LIBINPUT_EVENT_POINTER_AXIS
* event for all events with a
* libinput_event_pointer_get_axis_source() of @ref
* LIBINPUT_POINTER_AXIS_SOURCE_WHEEL. Ignore @ref
* LIBINPUT_EVENT_POINTER_AXIS if you are processing this event.
*
* See the libinput documentation for details.
*
* @since 1.19
*/
LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,
/**
* A scroll event caused by the movement of one or more fingers on a
* device. This event is sent is sent **in addition** to the @ref
* LIBINPUT_EVENT_POINTER_AXIS event for all events with a
* libinput_event_pointer_get_axis_source() of @ref
* LIBINPUT_POINTER_AXIS_SOURCE_FINGER. Ignore @ref
* LIBINPUT_EVENT_POINTER_AXIS if you are processing this event.
*
* See the libinput documentation for details.
*
* @since 1.19
*/
LIBINPUT_EVENT_POINTER_SCROLL_FINGER,
/**
* A scroll event from a continuous scroll source, e.g. button
* scrolling. This event is sent is sent **in
* addition** to the @ref LIBINPUT_EVENT_POINTER_AXIS
* event for all events with a
* libinput_event_pointer_get_axis_source() of @ref
* LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS. Ignore @ref
* LIBINPUT_EVENT_POINTER_AXIS if you are processing this event.
*
* See the libinput documentation for details.
*
* @since 1.19
*/
LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS,
LIBINPUT_EVENT_TOUCH_DOWN = 500,
LIBINPUT_EVENT_TOUCH_UP,
LIBINPUT_EVENT_TOUCH_MOTION,
LIBINPUT_EVENT_TOUCH_CANCEL,
/**
* Signals the end of a set of touchpoints at one device sample
* time. This event has no coordinate information attached.
*/
LIBINPUT_EVENT_TOUCH_FRAME,
/**
* One or more axes have changed state on a device with the @ref
* LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. This event is only sent
* when the tool is in proximity, see @ref
* LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY for details.
*
* The proximity event contains the initial state of the axis as the
* tool comes into proximity. An event of type @ref
* LIBINPUT_EVENT_TABLET_TOOL_AXIS is only sent when an axis value
* changes from this initial state. It is possible for a tool to
* enter and leave proximity without sending an event of type @ref
* LIBINPUT_EVENT_TABLET_TOOL_AXIS.
*
* An event of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS is sent
* when the tip state does not change. See the documentation for
* @ref LIBINPUT_EVENT_TABLET_TOOL_TIP for more details.
*
* @since 1.2
*/
LIBINPUT_EVENT_TABLET_TOOL_AXIS = 600,
/**
* Signals that a tool has come in or out of proximity of a device with
* the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
*
* Proximity events contain each of the current values for each axis,
* and these values may be extracted from them in the same way they are
* with @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS events.
*
* Some tools may always be in proximity. For these tools, events of
* type @ref LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN are sent only once after @ref
* LIBINPUT_EVENT_DEVICE_ADDED, and events of type @ref
* LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT are sent only once before @ref
* LIBINPUT_EVENT_DEVICE_REMOVED.
*
* If the tool that comes into proximity supports x/y coordinates,
* libinput guarantees that both x and y are set in the proximity
* event.
*
* When a tool goes out of proximity, the value of every axis should be
* assumed to have an undefined state and any buttons that are currently held
* down on the stylus are marked as released. Button release events for
* each button that was held down on the stylus are sent before the
* proximity out event.
*
* @since 1.2
*/
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY,
/**
* Signals that a tool has come in contact with the surface of a
* device with the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
*
* On devices without distance proximity detection, the @ref
* LIBINPUT_EVENT_TABLET_TOOL_TIP is sent immediately after @ref
* LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY for the tip down event, and
* immediately before for the tip up event.
*
* The decision when a tip touches the surface is device-dependent
* and may be derived from pressure data or other means. If the tip
* state is changed by axes changing state, the
* @ref LIBINPUT_EVENT_TABLET_TOOL_TIP event includes the changed
* axes and no additional axis event is sent for this state change.
* In other words, a caller must look at both @ref
* LIBINPUT_EVENT_TABLET_TOOL_AXIS and @ref
* LIBINPUT_EVENT_TABLET_TOOL_TIP events to know the current state
* of the axes.
*
* If a button state change occurs at the same time as a tip state
* change, the order of events is device-dependent.
*
* @since 1.2
*/
LIBINPUT_EVENT_TABLET_TOOL_TIP,
/**
* Signals that a tool has changed a logical button state on a
* device with the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
*
* Button state changes occur on their own and do not include axis
* state changes. If button and axis state changes occur within the
* same logical hardware event, the order of the @ref
* LIBINPUT_EVENT_TABLET_TOOL_BUTTON and @ref
* LIBINPUT_EVENT_TABLET_TOOL_AXIS event is device-specific.
*
* This event is not to be confused with the button events emitted
* by the tablet pad. See @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON.
*
* @see LIBINPUT_EVENT_TABLET_PAD_BUTTON
*
* @since 1.2
*/
LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
/**
* A button pressed on a device with the @ref
* LIBINPUT_DEVICE_CAP_TABLET_PAD capability.
*
* A button differs from @ref LIBINPUT_EVENT_TABLET_PAD_KEY in that
* buttons are sequentially indexed from 0 and do not carry any
* other information. Keys have a specific functionality assigned
* to them. The key code thus carries a semantic meaning, a button
* number does not.
*
* This event is not to be confused with the button events emitted
* by tools on a tablet (@ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON).
*
* @since 1.3
*/
LIBINPUT_EVENT_TABLET_PAD_BUTTON = 700,
/**
* A status change on a tablet ring with the @ref
* LIBINPUT_DEVICE_CAP_TABLET_PAD capability.
*
* @since 1.3
*/
LIBINPUT_EVENT_TABLET_PAD_RING,
/**
* A status change on a strip on a device with the @ref
* LIBINPUT_DEVICE_CAP_TABLET_PAD capability.
*
* @since 1.3
*/
LIBINPUT_EVENT_TABLET_PAD_STRIP,
/**
* A key pressed on a device with the @ref
* LIBINPUT_DEVICE_CAP_TABLET_PAD capability.
*
* A key differs from @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON in that
* keys have a specific functionality assigned to them (buttons are
* sequentially ordered). The key code thus carries a semantic
* meaning, a button number does not.
*
* @since 1.15
*/
LIBINPUT_EVENT_TABLET_PAD_KEY,
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN = 800,
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
LIBINPUT_EVENT_GESTURE_SWIPE_END,
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
LIBINPUT_EVENT_GESTURE_PINCH_END,
/**
* @since 1.19
*/
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
LIBINPUT_EVENT_GESTURE_HOLD_END,
/**
* @since 1.7
*/
LIBINPUT_EVENT_SWITCH_TOGGLE = 900,
};
/**
* @defgroup event Accessing and destruction of events
*/
/**
* @ingroup event
*
* Destroy the event, freeing all associated resources. Resources obtained
* from this event must be considered invalid after this call.