summaryrefslogtreecommitdiff
path: root/src/libinput.h
blob: 54d40de641d166a5c0ee83bbdbbe6a43abb46a97 (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
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
/*
 * 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>
#include <libudev.h>

#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.
 */
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.
	 */
	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,
	LIBINPUT_EVENT_POINTER_AXIS,

	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.
	 *
	 * 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,

	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.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.
 *
 * @warning Unlike other structs events are considered transient and
 * <b>not</b> refcounted. Calling libinput_event_destroy() <b>will</b>
 * destroy the event.
 *
 * @param event An event retrieved by libinput_get_event().
 */
void
libinput_event_destroy(struct libinput_event *event);

/**
 * @ingroup event
 *
 * Get the type of the event.
 *
 * @param event An event retrieved by libinput_get_event().
 */
enum libinput_event_type
libinput_event_get_type(struct libinput_event *event);

/**
 * @ingroup event
 *
 * Get the libinput context from the event.
 *
 * @param event The libinput event
 * @return The libinput context for this event.
 */
struct libinput *
libinput_event_get_context(struct libinput_event *event);

/**
 * @ingroup event
 *
 * Return the device associated with this event. For device added/removed
 * events this is the device added or removed. For all other device events,
 * this is the device that generated the event.
 *
 * This device is not refcounted and its lifetime is that of the event. Use
 * libinput_device_ref() before using the device outside of this scope.
 *
 * @return The device associated with this event
 */

struct libinput_device *
libinput_event_get_device(struct libinput_event *event);

/**
 * @ingroup event
 *
 * Return the pointer event that is this input event. If the event type does
 * not match the pointer event types, this function returns NULL.
 *
 * The inverse of this function is libinput_event_pointer_get_base_event().
 *
 * @return A pointer event, or NULL for other events
 */
struct libinput_event_pointer *
libinput_event_get_pointer_event(struct libinput_event *event);

/**
 * @ingroup event
 *
 * Return the keyboard event that is this input event. If the event type does
 * not match the keyboard event types, this function returns NULL.
 *
 * The inverse of this function is libinput_event_keyboard_get_base_event().
 *
 * @return A keyboard event, or NULL for other events
 */
struct libinput_event_keyboard *
libinput_event_get_keyboard_event(struct libinput_event *event);

/**
 * @ingroup event
 *
 * Return the touch event that is this input event. If the event type does
 * not match the touch event types, this function returns NULL.
 *
 * The inverse of this function is libinput_event_touch_get_base_event().
 *
 * @return A touch event, or NULL for other events
 */
struct libinput_event_touch *
libinput_event_get_touch_event(struct libinput_event *event);

/**
 * @ingroup event
 *
 * Return the gesture event that is this input event. If the event type does
 * not match the gesture event types, this function returns NULL.
 *
 * A gesture's lifetime has three distinct stages: begin, update and end, each
 * with their own event types. Begin is sent when the fingers are first set
 * down or libinput decides that the gesture begins. For @ref
 * LIBINPUT_EVENT_GESTURE_PINCH_BEGIN this sets the initial scale. Any
 * events changing properties of the gesture are sent as update events. On
 * termination of the gesture, an end event is sent.
 *
 * The inverse of this function is libinput_event_gesture_get_base_event().
 *
 * @return A gesture event, or NULL for other events
 */
struct libinput_event_gesture *
libinput_event_get_gesture_event(struct libinput_event *event);

/**
 * @ingroup event
 *
 * Return the tablet tool event that is this input event. If the event type
 * does not match the tablet tool event types, this function returns NULL.
 *
 * The inverse of this function is libinput_event_tablet_tool_get_base_event().
 *
 * @return A tablet tool event, or NULL for other events
 *
 * @since 1.2
 */
struct libinput_event_tablet_tool *
libinput_event_get_tablet_tool_event(struct libinput_event *event);

/**
 * @ingroup event
 *
 * Return the tablet pad event that is this input event. If the event type does not
 * match the tablet pad event types, this function returns NULL.
 *
 * The inverse of this function is libinput_event_tablet_pad_get_base_event().
 *
 * @return A tablet pad event, or NULL for other events
 */
struct libinput_event_tablet_pad *
libinput_event_get_tablet_pad_event(struct libinput_event *event);

/**
 * @ingroup event
 *
 * Return the switch event that is this input event. If the event type does
 * not match the switch event types, this function returns NULL.
 *
 * The inverse of this function is libinput_event_switch_get_base_event().
 *
 * @return A switch event, or NULL for other events
 *
 * @since 1.7
 */
struct libinput_event_switch *
libinput_event_get_switch_event(struct libinput_event *event);

/**
 * @ingroup event
 *
 * Return the device event that is this input event. If the event type does
 * not match the device event types, this function returns NULL.
 *
 * The inverse of this function is
 * libinput_event_device_notify_get_base_event().
 *
 * @return A device event, or NULL for other events
 */
struct libinput_event_device_notify *
libinput_event_get_device_notify_event(struct libinput_event *event);

/**
 * @ingroup event
 *
 * @return The generic libinput_event of this event
 */
struct libinput_event *
libinput_event_device_notify_get_base_event(struct libinput_event_device_notify *event);

/**
 * @defgroup event_keyboard Keyboard events
 *
 * Key events are generated when a key changes its logical state, usually by
 * being pressed or released.
 */

/**
 * @ingroup event_keyboard
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @return The event time for this event
 */
uint32_t
libinput_event_keyboard_get_time(struct libinput_event_keyboard *event);

/**
 * @ingroup event_keyboard
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @return The event time for this event in microseconds
 */
uint64_t
libinput_event_keyboard_get_time_usec(struct libinput_event_keyboard *event);

/**
 * @ingroup event_keyboard
 *
 * @return The keycode that triggered this key event
 */
uint32_t
libinput_event_keyboard_get_key(struct libinput_event_keyboard *event);

/**
 * @ingroup event_keyboard
 *
 * @return The state change of the key
 */
enum libinput_key_state
libinput_event_keyboard_get_key_state(struct libinput_event_keyboard *event);

/**
 * @ingroup event_keyboard
 *
 * @return The generic libinput_event of this event
 */
struct libinput_event *
libinput_event_keyboard_get_base_event(struct libinput_event_keyboard *event);

/**
 * @ingroup event_keyboard
 *
 * For the key of a @ref LIBINPUT_EVENT_KEYBOARD_KEY event, return the total number
 * of keys pressed on all devices on the associated seat after the event was
 * triggered.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_KEYBOARD_KEY. For other events, this function returns 0.
 *
 * @return The seat wide pressed key count for the key of this event
 */
uint32_t
libinput_event_keyboard_get_seat_key_count(
	struct libinput_event_keyboard *event);

/**
 * @defgroup event_pointer Pointer events
 *
 * Pointer events reflect motion, button and scroll events, as well as
 * events from other axes.
 */

/**
 * @ingroup event_pointer
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @return The event time for this event
 */
uint32_t
libinput_event_pointer_get_time(struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @return The event time for this event in microseconds
 */
uint64_t
libinput_event_pointer_get_time_usec(struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * Return the delta between the last event and the current event. For pointer
 * events that are not of type @ref LIBINPUT_EVENT_POINTER_MOTION, this
 * function returns 0.
 *
 * If a device employs pointer acceleration, the delta returned by this
 * function is the accelerated delta.
 *
 * Relative motion deltas are to be interpreted as pixel movement of a
 * standardized mouse. See the libinput documentation for more details.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_MOTION.
 *
 * @return The relative x movement since the last event
 */
double
libinput_event_pointer_get_dx(struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * Return the delta between the last event and the current event. For pointer
 * events that are not of type @ref LIBINPUT_EVENT_POINTER_MOTION, this
 * function returns 0.
 *
 * If a device employs pointer acceleration, the delta returned by this
 * function is the accelerated delta.
 *
 * Relative motion deltas are to be interpreted as pixel movement of a
 * standardized mouse. See the libinput documentation for more details.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_MOTION.
 *
 * @return The relative y movement since the last event
 */
double
libinput_event_pointer_get_dy(struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * Return the relative delta of the unaccelerated motion vector of the
 * current event. For pointer events that are not of type @ref
 * LIBINPUT_EVENT_POINTER_MOTION, this function returns 0.
 *
 * Relative unaccelerated motion deltas are raw device coordinates.
 * Note that these coordinates are subject to the device's native
 * resolution. Touchpad coordinates represent raw device coordinates in the
 * X resolution of the touchpad. See the libinput documentation for more
 * details.
 *
 * Any rotation applied to the device also applies to unaccelerated motion
 * (see libinput_device_config_rotation_set_angle()).
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_MOTION.
 *
 * @return The unaccelerated relative x movement since the last event
 */
double
libinput_event_pointer_get_dx_unaccelerated(
	struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * Return the relative delta of the unaccelerated motion vector of the
 * current event. For pointer events that are not of type @ref
 * LIBINPUT_EVENT_POINTER_MOTION, this function returns 0.
 *
 * Relative unaccelerated motion deltas are raw device coordinates.
 * Note that these coordinates are subject to the device's native
 * resolution. Touchpad coordinates represent raw device coordinates in the
 * X resolution of the touchpad. See the libinput documentation for more
 * details.
 *
 * Any rotation applied to the device also applies to unaccelerated motion
 * (see libinput_device_config_rotation_set_angle()).
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_MOTION.
 *
 * @return The unaccelerated relative y movement since the last event
 */
double
libinput_event_pointer_get_dy_unaccelerated(
	struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * Return the current absolute x coordinate of the pointer event, in mm from
 * the top left corner of the device. To get the corresponding output screen
 * coordinate, use libinput_event_pointer_get_absolute_x_transformed().
 *
 * For pointer events that are not of type
 * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.
 *
 * @return The current absolute x coordinate
 */
double
libinput_event_pointer_get_absolute_x(struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * Return the current absolute y coordinate of the pointer event, in mm from
 * the top left corner of the device. To get the corresponding output screen
 * coordinate, use libinput_event_pointer_get_absolute_y_transformed().
 *
 * For pointer events that are not of type
 * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.
 *
 * @return The current absolute y coordinate
 */
double
libinput_event_pointer_get_absolute_y(struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * Return the current absolute x coordinate of the pointer event, transformed to
 * screen coordinates.
 *
 * For pointer events that are not of type
 * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, the return value of this
 * function is undefined.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.
 *
 * @param event The libinput pointer event
 * @param width The current output screen width
 * @return The current absolute x coordinate transformed to a screen coordinate
 */
double
libinput_event_pointer_get_absolute_x_transformed(
	struct libinput_event_pointer *event,
	uint32_t width);

/**
 * @ingroup event_pointer
 *
 * Return the current absolute y coordinate of the pointer event, transformed to
 * screen coordinates.
 *
 * For pointer events that are not of type
 * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, the return value of this function is
 * undefined.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.
 *
 * @param event The libinput pointer event
 * @param height The current output screen height
 * @return The current absolute y coordinate transformed to a screen coordinate
 */
double
libinput_event_pointer_get_absolute_y_transformed(
	struct libinput_event_pointer *event,
	uint32_t height);

/**
 * @ingroup event_pointer
 *
 * Return the button that triggered this event.
 * For pointer events that are not of type @ref
 * LIBINPUT_EVENT_POINTER_BUTTON, this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_BUTTON.
 *
 * @return The button triggering this event
 */
uint32_t
libinput_event_pointer_get_button(struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * Return the button state that triggered this event.
 * For pointer events that are not of type @ref
 * LIBINPUT_EVENT_POINTER_BUTTON, this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_BUTTON.
 *
 * @return The button state triggering this event
 */
enum libinput_button_state
libinput_event_pointer_get_button_state(struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * For the button of a @ref LIBINPUT_EVENT_POINTER_BUTTON event, return the
 * total number of buttons pressed on all devices on the associated seat
 * after the event was triggered.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_BUTTON. For other events, this function
 * returns 0.
 *
 * @return The seat wide pressed button count for the key of this event
 */
uint32_t
libinput_event_pointer_get_seat_button_count(
	struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * Check if the event has a valid value for the given axis.
 *
 * If this function returns non-zero for an axis and
 * libinput_event_pointer_get_axis_value() returns a value of 0, the event
 * is a scroll stop event.
 *
 * For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS,
 * this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_AXIS.
 *
 * @return Non-zero if this event contains a value for this axis
 */
int
libinput_event_pointer_has_axis(struct libinput_event_pointer *event,
				enum libinput_pointer_axis axis);

/**
 * @ingroup event_pointer
 *
 * Return the axis value of the given axis. The interpretation of the value
 * depends on the axis. For the two scrolling axes
 * @ref LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL and
 * @ref LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, the value of the event is in
 * relative scroll units, with the positive direction being down or right,
 * respectively. For the interpretation of the value, see
 * libinput_event_pointer_get_axis_source().
 *
 * If libinput_event_pointer_has_axis() returns 0 for an axis, this function
 * returns 0 for that axis.
 *
 * For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS,
 * this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_AXIS.
 *
 * @return The axis value of this event
 *
 * @see libinput_event_pointer_get_axis_value_discrete
 */
double
libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event,
				      enum libinput_pointer_axis axis);

/**
 * @ingroup event_pointer
 *
 * Return the source for a given axis event. Axis events (scroll events) can
 * be caused by a hardware item such as a scroll wheel or emulated from
 * other input sources, such as two-finger or edge scrolling on a
 * touchpad.
 *
 * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_FINGER, libinput
 * guarantees that a scroll sequence is terminated with a scroll value of 0.
 * A caller may use this information to decide on whether kinetic scrolling
 * should be triggered on this scroll sequence.
 * The coordinate system is identical to the cursor movement, i.e. a
 * scroll value of 1 represents the equivalent relative motion of 1.
 *
 * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, no terminating
 * event is guaranteed (though it may happen).
 * Scrolling is in discrete steps, the value is the angle the wheel moved
 * in degrees. The default is 15 degrees per wheel click, but some mice may
 * have differently grained wheels. It is up to the caller how to interpret
 * such different step sizes.
 *
 * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, no
 * terminating event is guaranteed (though it may happen).
 * The coordinate system is identical to the cursor movement, i.e. a
 * scroll value of 1 represents the equivalent relative motion of 1.
 *
 * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT, no
 * terminating event is guaranteed (though it may happen).
 * Scrolling is in discrete steps and there is no physical equivalent for
 * the value returned here. For backwards compatibility, the value returned
 * by this function is identical to a single mouse wheel rotation by this
 * device (see the documentation for @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL
 * above). Callers should not use this value but instead exclusively refer
 * to the value returned by libinput_event_pointer_get_axis_value_discrete().
 *
 * For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS,
 * this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_POINTER_AXIS.
 *
 * @return The source for this axis event
 */
enum libinput_pointer_axis_source
libinput_event_pointer_get_axis_source(struct libinput_event_pointer *event);

/**
 * @ingroup event_pointer
 *
 * Return the axis value in discrete steps for a given axis event. How a
 * value translates into a discrete step depends on the source.
 *
 * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, the discrete
 * value correspond to the number of physical mouse wheel clicks.
 *
 * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS or @ref
 * LIBINPUT_POINTER_AXIS_SOURCE_FINGER, the discrete value is always 0.
 *
 * @return The discrete value for the given event.
 *
 * @see libinput_event_pointer_get_axis_value
 */
double
libinput_event_pointer_get_axis_value_discrete(struct libinput_event_pointer *event,
					       enum libinput_pointer_axis axis);

/**
 * @ingroup event_pointer
 *
 * @return The generic libinput_event of this event
 */
struct libinput_event *
libinput_event_pointer_get_base_event(struct libinput_event_pointer *event);

/**
 * @defgroup event_touch Touch events
 *
 * Events from absolute touch devices.
 */

/**
 * @ingroup event_touch
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @return The event time for this event
 */
uint32_t
libinput_event_touch_get_time(struct libinput_event_touch *event);

/**
 * @ingroup event_touch
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @return The event time for this event in microseconds
 */
uint64_t
libinput_event_touch_get_time_usec(struct libinput_event_touch *event);

/**
 * @ingroup event_touch
 *
 * Get the slot of this touch event. See the kernel's multitouch
 * protocol B documentation for more information.
 *
 * If the touch event has no assigned slot, for example if it is from a
 * single touch device, this function returns -1.
 *
 * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
 * LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref
 * LIBINPUT_EVENT_TOUCH_CANCEL, this function returns 0.
 *
 * @note It is an application bug to call this function for events of type
 * other than @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_UP,
 * @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref LIBINPUT_EVENT_TOUCH_CANCEL.
 *
 * @return The slot of this touch event
 */
int32_t
libinput_event_touch_get_slot(struct libinput_event_touch *event);

/**
 * @ingroup event_touch
 *
 * Get the seat slot of the touch event. A seat slot is a non-negative seat
 * wide unique identifier of an active touch point.
 *
 * Events from single touch devices will be represented as one individual
 * touch point per device.
 *
 * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
 * LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref
 * LIBINPUT_EVENT_TOUCH_CANCEL, this function returns 0.
 *
 * @note It is an application bug to call this function for events of type
 * other than @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_UP,
 * @ref LIBINPUT_EVENT_TOUCH_MOTION or @ref LIBINPUT_EVENT_TOUCH_CANCEL.
 *
 * @return The seat slot of the touch event
 */
int32_t
libinput_event_touch_get_seat_slot(struct libinput_event_touch *event);

/**
 * @ingroup event_touch
 *
 * Return the current absolute x coordinate of the touch event, in mm from
 * the top left corner of the device. To get the corresponding output screen
 * coordinate, use libinput_event_touch_get_x_transformed().
 *
 * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
 * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.
 *
 * @note It is an application bug to call this function for events of type
 * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
 * LIBINPUT_EVENT_TOUCH_MOTION.
 *
 * @param event The libinput touch event
 * @return The current absolute x coordinate
 */
double
libinput_event_touch_get_x(struct libinput_event_touch *event);

/**
 * @ingroup event_touch
 *
 * Return the current absolute y coordinate of the touch event, in mm from
 * the top left corner of the device. To get the corresponding output screen
 * coordinate, use libinput_event_touch_get_y_transformed().
 *
 * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
 * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.
 *
 * @note It is an application bug to call this function for events of type
 * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
 * LIBINPUT_EVENT_TOUCH_MOTION.
 *
 * @param event The libinput touch event
 * @return The current absolute y coordinate
 */
double
libinput_event_touch_get_y(struct libinput_event_touch *event);

/**
 * @ingroup event_touch
 *
 * Return the current absolute x coordinate of the touch event, transformed to
 * screen coordinates.
 *
 * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
 * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.
 *
 * @note It is an application bug to call this function for events of type
 * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
 * LIBINPUT_EVENT_TOUCH_MOTION.
 *
 * @param event The libinput touch event
 * @param width The current output screen width
 * @return The current absolute x coordinate transformed to a screen coordinate
 */
double
libinput_event_touch_get_x_transformed(struct libinput_event_touch *event,
				       uint32_t width);

/**
 * @ingroup event_touch
 *
 * Return the current absolute y coordinate of the touch event, transformed to
 * screen coordinates.
 *
 * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
 * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.
 *
 * @note It is an application bug to call this function for events of type
 * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
 * LIBINPUT_EVENT_TOUCH_MOTION.
 *
 * @param event The libinput touch event
 * @param height The current output screen height
 * @return The current absolute y coordinate transformed to a screen coordinate
 */
double
libinput_event_touch_get_y_transformed(struct libinput_event_touch *event,
				       uint32_t height);

/**
 * @ingroup event_touch
 *
 * @return The generic libinput_event of this event
 */
struct libinput_event *
libinput_event_touch_get_base_event(struct libinput_event_touch *event);

/**
 * @defgroup event_gesture Gesture events
 *
 * Gesture events are generated when a gesture is recognized on a touchpad.
 *
 * Gesture sequences always start with a LIBINPUT_EVENT_GESTURE_FOO_START
 * event. All following gesture events will be of the
 * LIBINPUT_EVENT_GESTURE_FOO_UPDATE type until a
 * LIBINPUT_EVENT_GESTURE_FOO_END is generated which signals the end of the
 * gesture.
 *
 * See the libinput documentation for details on gesture handling.
 */

/**
 * @ingroup event_gesture
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @return The event time for this event
 */
uint32_t
libinput_event_gesture_get_time(struct libinput_event_gesture *event);

/**
 * @ingroup event_gesture
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @return The event time for this event in microseconds
 */
uint64_t
libinput_event_gesture_get_time_usec(struct libinput_event_gesture *event);

/**
 * @ingroup event_gesture
 *
 * @return The generic libinput_event of this event
 */
struct libinput_event *
libinput_event_gesture_get_base_event(struct libinput_event_gesture *event);

/**
 * @ingroup event_gesture
 *
 * Return the number of fingers used for a gesture. This can be used e.g.
 * to differentiate between 3 or 4 finger swipes.
 *
 * This function can be called on all gesture events and the returned finger
 * count value remains the same for the lifetime of a gesture. Thus, if a
 * user puts down a fourth finger during a three-finger swipe gesture,
 * libinput will end the three-finger gesture and, if applicable, start a
 * four-finger swipe gesture. A caller may decide that those gestures are
 * semantically identical and continue the two gestures as one single gesture.
 *
 * @return the number of fingers used for a gesture
 */
int
libinput_event_gesture_get_finger_count(struct libinput_event_gesture *event);

/**
 * @ingroup event_gesture
 *
 * Return if the gesture ended normally, or if it was cancelled.
 * For gesture events that are not of type
 * @ref LIBINPUT_EVENT_GESTURE_SWIPE_END or
 * @ref LIBINPUT_EVENT_GESTURE_PINCH_END, this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_GESTURE_SWIPE_END or
 * @ref LIBINPUT_EVENT_GESTURE_PINCH_END.
 *
 * @return 0 or 1, with 1 indicating that the gesture was cancelled.
 */
int
libinput_event_gesture_get_cancelled(struct libinput_event_gesture *event);

/**
 * @ingroup event_gesture
 *
 * Return the delta between the last event and the current event. For gesture
 * events that are not of type @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or
 * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.
 *
 * If a device employs pointer acceleration, the delta returned by this
 * function is the accelerated delta.
 *
 * Relative motion deltas are normalized to represent those of a device with
 * 1000dpi resolution. See the libinput documentation for more details.
 *
 * @return the relative x movement since the last event
 */
double
libinput_event_gesture_get_dx(struct libinput_event_gesture *event);

/**
 * @ingroup event_gesture
 *
 * Return the delta between the last event and the current event. For gesture
 * events that are not of type @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or
 * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.
 *
 * If a device employs pointer acceleration, the delta returned by this
 * function is the accelerated delta.
 *
 * Relative motion deltas are normalized to represent those of a device with
 * 1000dpi resolution. See the libinput documentation for more details.
 *
 * @return the relative y movement since the last event
 */
double
libinput_event_gesture_get_dy(struct libinput_event_gesture *event);

/**
 * @ingroup event_gesture
 *
 * Return the relative delta of the unaccelerated motion vector of the
 * current event. For gesture events that are not of type
 * @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or
 * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.
 *
 * Relative unaccelerated motion deltas are normalized to represent those of a
 * device with 1000dpi resolution. See the libinput documentation for more
 * details. Note that unaccelerated events are not equivalent to 'raw' events
 * as read from the device.
 *
 * Any rotation applied to the device also applies to gesture motion
 * (see libinput_device_config_rotation_set_angle()).
 *
 * @return the unaccelerated relative x movement since the last event
 */
double
libinput_event_gesture_get_dx_unaccelerated(
	struct libinput_event_gesture *event);

/**
 * @ingroup event_gesture
 *
 * Return the relative delta of the unaccelerated motion vector of the
 * current event. For gesture events that are not of type
 * @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or
 * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.
 *
 * Relative unaccelerated motion deltas are normalized to represent those of a
 * device with 1000dpi resolution. See the libinput documentation for more
 * details. Note that unaccelerated events are not equivalent to 'raw' events
 * as read from the device.
 *
 * Any rotation applied to the device also applies to gesture motion
 * (see libinput_device_config_rotation_set_angle()).
 *
 * @return the unaccelerated relative y movement since the last event
 */
double
libinput_event_gesture_get_dy_unaccelerated(
	struct libinput_event_gesture *event);

/**
 * @ingroup event_gesture
 *
 * Return the absolute scale of a pinch gesture, the scale is the division
 * of the current distance between the fingers and the distance at the start
 * of the gesture. The scale begins at 1.0, and if e.g. the fingers moved
 * together by 50% then the scale will become 0.5, if they move twice as far
 * apart as initially the scale becomes 2.0, etc.
 *
 * For gesture events that are of type @ref
 * LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, this function returns 1.0.
 *
 * For gesture events that are of type @ref
 * LIBINPUT_EVENT_GESTURE_PINCH_END, this function returns the scale value
 * of the most recent @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE event (if
 * any) or 1.0 otherwise.
 *
 * For all other events this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, @ref
 * LIBINPUT_EVENT_GESTURE_PINCH_END or
 * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE.
 *
 * @return the absolute scale of a pinch gesture
 */
double
libinput_event_gesture_get_scale(struct libinput_event_gesture *event);

/**
 * @ingroup event_gesture
 *
 * Return the angle delta in degrees between the last and the current @ref
 * LIBINPUT_EVENT_GESTURE_PINCH_UPDATE event. For gesture events that
 * are not of type @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this
 * function returns 0.
 *
 * The angle delta is defined as the change in angle of the line formed by
 * the 2 fingers of a pinch gesture. Clockwise rotation is represented
 * by a positive delta, counter-clockwise by a negative delta. If e.g. the
 * fingers are on the 12 and 6 location of a clock face plate and they move
 * to the 1 resp. 7 location in a single event then the angle delta is
 * 30 degrees.
 *
 * If more than two fingers are present, the angle represents the rotation
 * around the center of gravity. The calculation of the center of gravity is
 * implementation-dependent.
 *
 * @return the angle delta since the last event
 */
double
libinput_event_gesture_get_angle_delta(struct libinput_event_gesture *event);

/**
 * @defgroup event_tablet Tablet events
 *
 * Events that come from tools on tablet devices. For events from the pad,
 * see @ref event_tablet_pad.
 *
 * Events from tablet devices are exposed by two interfaces, tools and pads.
 * Tool events originate (usually) from a stylus-like device, pad events
 * reflect any events originating from the physical tablet itself.
 *
 * Note that many tablets support touch events. These are exposed through
 * the @ref LIBINPUT_DEVICE_CAP_POINTER interface (for external touchpad-like
 * devices such as the Wacom Intuos series) or @ref
 * LIBINPUT_DEVICE_CAP_TOUCH interface (for built-in touchscreen-like
 * devices such as the Wacom Cintiq series).
 */

/**
 * @ingroup event_tablet
 *
 * @return The generic libinput_event of this event
 *
 * @since 1.2
 */
struct libinput_event *
libinput_event_tablet_tool_get_base_event(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Check if the x axis was updated in this event.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,
 * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or
 * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.
 *
 * @note It is an application bug to call this function for events other
 * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
 * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return 1 if the axis was updated or 0 otherwise
 *
 * @since 1.2
 */
int
libinput_event_tablet_tool_x_has_changed(
				struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Check if the y axis was updated in this event.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,
 * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or
 * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.
 *
 * @note It is an application bug to call this function for events other
 * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
 * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return 1 if the axis was updated or 0 otherwise
 *
 * @since 1.2
 */
int
libinput_event_tablet_tool_y_has_changed(
				struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Check if the pressure axis was updated in this event.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,
 * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or
 * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.
 *
 * @note It is an application bug to call this function for events other
 * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
 * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return 1 if the axis was updated or 0 otherwise
 *
 * @since 1.2
 */
int
libinput_event_tablet_tool_pressure_has_changed(
				struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Check if the distance axis was updated in this event.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,
 * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or
 * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.
 * For tablet tool events of type @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY,
 * this function always returns 1.
 *
 * @note It is an application bug to call this function for events other
 * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
 * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return 1 if the axis was updated or 0 otherwise
 *
 * @since 1.2
 */
int
libinput_event_tablet_tool_distance_has_changed(
				struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Check if the tilt x axis was updated in this event.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,
 * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or
 * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.
 *
 * @note It is an application bug to call this function for events other
 * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
 * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return 1 if the axis was updated or 0 otherwise
 *
 * @since 1.2
 */
int
libinput_event_tablet_tool_tilt_x_has_changed(
				struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Check if the tilt y axis was updated in this event.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,
 * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or
 * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.
 *
 * @note It is an application bug to call this function for events other
 * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
 * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return 1 if the axis was updated or 0 otherwise
 *
 * @since 1.2
 */
int
libinput_event_tablet_tool_tilt_y_has_changed(
				struct libinput_event_tablet_tool *event);
/**
 * @ingroup event_tablet
 *
 * Check if the z-rotation axis was updated in this event.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,
 * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or
 * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.
 *
 * @note It is an application bug to call this function for events other
 * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
 * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return 1 if the axis was updated or 0 otherwise
 *
 * @since 1.2
 */
int
libinput_event_tablet_tool_rotation_has_changed(
				struct libinput_event_tablet_tool *event);
/**
 * @ingroup event_tablet
 *
 * Check if the slider axis was updated in this event.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,
 * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or
 * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.
 *
 * @note It is an application bug to call this function for events other
 * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
 * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return 1 if the axis was updated or 0 otherwise
 *
 * @since 1.2
 */
int
libinput_event_tablet_tool_slider_has_changed(
				struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Check if the size major axis was updated in this event.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,
 * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or
 * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.
 *
 * @note It is an application bug to call this function for events other
 * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
 * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return 1 if the axis was updated or 0 otherwise
 */
int
libinput_event_tablet_tool_size_major_has_changed(
				struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Check if the size minor axis was updated in this event.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,
 * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or
 * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.
 *
 * @note It is an application bug to call this function for events other
 * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
 * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return 1 if the axis was updated or 0 otherwise
 */
int
libinput_event_tablet_tool_size_minor_has_changed(
				struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Check if the wheel axis was updated in this event.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS,
 * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or
 * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0.
 *
 * @note It is an application bug to call this function for events other
 * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
 * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
 * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return 1 if the axis was updated or 0 otherwise
 *
 * @since 1.2
 */
int
libinput_event_tablet_tool_wheel_has_changed(
				struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the X coordinate of the tablet tool, in mm from the top left
 * corner of the tablet in its current logical orientation. Use
 * libinput_event_tablet_tool_get_x_transformed() for transforming the axis
 * value into a different coordinate space.
 *
 * @note On some devices, returned value may be negative or larger than the
 * width of the device. See the libinput documentation for more details.
 *
 * @param event The libinput tablet tool event
 * @return The current value of the the axis
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_x(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the Y coordinate of the tablet tool, in mm from the top left
 * corner of the tablet in its current logical orientation. Use
 * libinput_event_tablet_tool_get_y_transformed() for transforming the axis
 * value into a different coordinate space.
 *
 * @note On some devices, returned value may be negative or larger than the
 * width of the device. See the libinput documentation for more details.
 *
 * @param event The libinput tablet tool event
 * @return The current value of the the axis
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_y(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Return the delta between the last event and the current event.
 * If the tool employs pointer acceleration, the delta returned by this
 * function is the accelerated delta.
 *
 * This value is in screen coordinate space, the delta is to be interpreted
 * like the return value of libinput_event_pointer_get_dx().
 * See the libinput documentation for more details.
 *
 * @param event The libinput tablet event
 * @return The relative x movement since the last event
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_dx(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Return the delta between the last event and the current event.
 * If the tool employs pointer acceleration, the delta returned by this
 * function is the accelerated delta.
 *
 * This value is in screen coordinate space, the delta is to be interpreted
 * like the return value of libinput_event_pointer_get_dx().
 * See the libinput documentation for more details.
 *
 * @param event The libinput tablet event
 * @return The relative y movement since the last event
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_dy(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the current pressure being applied on the tool in use, normalized
 * to the range [0, 1].
 *
 * If this axis does not exist on the current tool, this function returns 0.
 *
 * @param event The libinput tablet tool event
 * @return The current value of the the axis
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_pressure(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the current distance from the tablet's sensor, normalized to the
 * range [0, 1].
 *
 * If this axis does not exist on the current tool, this function returns 0.
 *
 * @param event The libinput tablet tool event
 * @return The current value of the the axis
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_distance(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the current tilt along the X axis of the tablet's current logical
 * orientation, in degrees off the tablet's z axis. That is, if the tool is
 * perfectly orthogonal to the tablet, the tilt angle is 0. When the top
 * tilts towards the logical top/left of the tablet, the x/y tilt angles are
 * negative, if the top tilts towards the logical bottom/right of the
 * tablet, the x/y tilt angles are positive.
 *
 * If this axis does not exist on the current tool, this function returns 0.
 *
 * @param event The libinput tablet tool event
 * @return The current value of the axis in degrees
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_tilt_x(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the current tilt along the Y axis of the tablet's current logical
 * orientation, in degrees off the tablet's z axis. That is, if the tool is
 * perfectly orthogonal to the tablet, the tilt angle is 0. When the top
 * tilts towards the logical top/left of the tablet, the x/y tilt angles are
 * negative, if the top tilts towards the logical bottom/right of the
 * tablet, the x/y tilt angles are positive.
 *
 * If this axis does not exist on the current tool, this function returns 0.
 *
 * @param event The libinput tablet tool event
 * @return The current value of the the axis in degrees
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_tilt_y(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the current z rotation of the tool in degrees, clockwise from the
 * tool's logical neutral position.
 *
 * For tools of type @ref LIBINPUT_TABLET_TOOL_TYPE_MOUSE and @ref
 * LIBINPUT_TABLET_TOOL_TYPE_LENS the logical neutral position is
 * pointing to the current logical north of the tablet. For tools of type @ref
 * LIBINPUT_TABLET_TOOL_TYPE_BRUSH, the logical neutral position is with the
 * buttons pointing up.
 *
 * If this axis does not exist on the current tool, this function returns 0.
 *
 * @param event The libinput tablet tool event
 * @return The current value of the the axis
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_rotation(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the current position of the slider on the tool, normalized to the
 * range [-1, 1]. The logical zero is the neutral position of the slider, or
 * the logical center of the axis. This axis is available on e.g. the Wacom
 * Airbrush.
 *
 * If this axis does not exist on the current tool, this function returns 0.
 *
 * @param event The libinput tablet tool event
 * @return The current value of the the axis
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_slider_position(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the current size in mm along the major axis of the touching
 * ellipse. This axis is not necessarily aligned with either x or y, the
 * rotation must be taken into account.
 *
 * Where no rotation is available on a tool, or where rotation is zero, the
 * major axis aligns with the y axis and the minor axis with the x axis.
 *
 * If this axis does not exist on the current tool, this function returns 0.
 *
 * @param event The libinput tablet tool event
 * @return The current value of the axis major in mm
 */
double
libinput_event_tablet_tool_get_size_major(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the current size in mm along the minor axis of the touching
 * ellipse. This axis is not necessarily aligned with either x or y, the
 * rotation must be taken into account.
 *
 * Where no rotation is available on a tool, or where rotation is zero, the
 * minor axis aligns with the y axis and the minor axis with the x axis.
 *
 * If this axis does not exist on the current tool, this function returns 0.
 *
 * @param event The libinput tablet tool event
 * @return The current value of the axis minor in mm
 */
double
libinput_event_tablet_tool_get_size_minor(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Return the delta for the wheel in degrees.
 *
 * @param event The libinput tablet tool event
 * @return The delta of the wheel, in degrees, compared to the last event
 *
 * @see libinput_event_tablet_tool_get_wheel_delta_discrete
 */
double
libinput_event_tablet_tool_get_wheel_delta(
				   struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Return the delta for the wheel in discrete steps (e.g. wheel clicks).

 * @param event The libinput tablet tool event
 * @return The delta of the wheel, in discrete steps, compared to the last event
 *
 * @see libinput_event_tablet_tool_get_wheel_delta_discrete
 *
 * @since 1.2
 */
int
libinput_event_tablet_tool_get_wheel_delta_discrete(
				    struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Return the current absolute x coordinate of the tablet tool event,
 * transformed to screen coordinates.
 *
 * @note This function may be called for a specific axis even if
 * libinput_event_tablet_tool_*_has_changed() returns 0 for that axis.
 * libinput always includes all device axes in the event.
 *
 * @note On some devices, returned value may be negative or larger than the
 * width of the device. See the libinput documentation for more details.
 *
 * @param event The libinput tablet tool event
 * @param width The current output screen width
 * @return the current absolute x coordinate transformed to a screen coordinate
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_x_transformed(struct libinput_event_tablet_tool *event,
					     uint32_t width);

/**
 * @ingroup event_tablet
 *
 * Return the current absolute y coordinate of the tablet tool event,
 * transformed to screen coordinates.
 *
 * @note This function may be called for a specific axis even if
 * libinput_event_tablet_tool_*_has_changed() returns 0 for that axis.
 * libinput always includes all device axes in the event.
 *
 * @note On some devices, returned value may be negative or larger than the
 * width of the device. See the libinput documentation for more details.
 *
 * @param event The libinput tablet tool event
 * @param height The current output screen height
 * @return the current absolute y coordinate transformed to a screen coordinate
 *
 * @since 1.2
 */
double
libinput_event_tablet_tool_get_y_transformed(struct libinput_event_tablet_tool *event,
					     uint32_t height);

/**
 * @ingroup event_tablet
 *
 * Returns the tool that was in use during this event.
 *
 * The returned tablet tool is not refcounted and may become invalid after
 * the next call to libinput. Use libinput_tablet_tool_ref() and
 * libinput_tablet_tool_unref() to continue using the handle outside of the
 * immediate scope.
 *
 * If the caller holds at least one reference, this struct is used
 * whenever the tools enters proximity again.
  *
 * @note Physical tool tracking requires hardware support. If unavailable,
 * libinput creates one tool per type per tablet. See
 * libinput_tablet_tool_get_serial() for more details.
 *
 * @param event The libinput tablet tool event
 * @return The new tool triggering this event
 *
 * @since 1.2
 */
struct libinput_tablet_tool *
libinput_event_tablet_tool_get_tool(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the new proximity state of a tool from a proximity event.
 * Used to check whether or not a tool came in or out of proximity during an
 * event of type @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY.
 *
 * The proximity state represents the logical proximity state which does not
 * necessarily match when a tool comes into sensor range or leaves the
 * sensor range. On some tools this range does not represent the physical
 * range but a reduced tool-specific logical range. If the range is reduced,
 * this is done transparent to the caller.
 *
 * For example, the Wacom mouse and lens cursor tools are usually
 * used in relative mode, lying flat on the tablet. Movement typically follows
 * the interaction normal mouse movements have, i.e. slightly lift the tool and
 * place it in a separate location. The proximity detection on Wacom
 * tablets however extends further than the user may lift the mouse, i.e. the
 * tool may not be lifted out of physical proximity. For such tools, libinput
 * provides software-emulated proximity.
 *
 * @param event The libinput tablet tool event
 * @return The new proximity state of the tool from the event.
 *
 * @since 1.2
 */
enum libinput_tablet_tool_proximity_state
libinput_event_tablet_tool_get_proximity_state(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Returns the new tip state of a tool from a tip event.
 * Used to check whether or not a tool came in contact with the tablet
 * surface or left contact with the tablet surface during an
 * event of type @ref LIBINPUT_EVENT_TABLET_TOOL_TIP.
 *
 * @param event The libinput tablet tool event
 * @return The new tip state of the tool from the event.
 *
 * @since 1.2
 */
enum libinput_tablet_tool_tip_state
libinput_event_tablet_tool_get_tip_state(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Return the button that triggered this event.  For events that are not of
 * type @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON, this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return the button triggering this event
 *
 * @since 1.2
 */
uint32_t
libinput_event_tablet_tool_get_button(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Return the button state of the event.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
 *
 * @param event The libinput tablet tool event
 * @return the button state triggering this event
 *
 * @since 1.2
 */
enum libinput_button_state
libinput_event_tablet_tool_get_button_state(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * For the button of a @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON event, return the total
 * number of buttons pressed on all devices on the associated seat after the
 * the event was triggered.
 *
 " @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON. For other events, this function returns 0.
 *
 * @param event The libinput tablet tool event
 * @return the seat wide pressed button count for the key of this event
 *
 * @since 1.2
 */
uint32_t
libinput_event_tablet_tool_get_seat_button_count(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @param event The libinput tablet tool event
 * @return The event time for this event
 *
 * @since 1.2
 */
uint32_t
libinput_event_tablet_tool_get_time(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @param event The libinput tablet tool event
 * @return The event time for this event in microseconds
 *
 * @since 1.2
 */
uint64_t
libinput_event_tablet_tool_get_time_usec(struct libinput_event_tablet_tool *event);

/**
 * @ingroup event_tablet
 *
 * Return the high-level tool type for a tool object.
 *
 * The high level tool describes general interaction expected with the tool.
 * For example, a user would expect a tool of type @ref
 * LIBINPUT_TABLET_TOOL_TYPE_PEN to interact with a graphics application
 * taking pressure and tilt into account. The default virtual tool assigned
 * should be a drawing tool, e.g. a virtual pen or brush.
 * A tool of type @ref LIBINPUT_TABLET_TOOL_TYPE_ERASER would normally be
 * mapped to an eraser-like virtual tool.
 *
 * If supported by the hardware, a more specific tool id is always
 * available, see libinput_tablet_tool_get_tool_id().
 *
 * @param tool The libinput tool
 * @return The tool type for this tool object
 *
 * @see libinput_tablet_tool_get_tool_id
 *
 * @since 1.2
 */
enum libinput_tablet_tool_type
libinput_tablet_tool_get_type(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Return the tool ID for a tool object. If nonzero, this number identifies
 * the specific type of the tool with more precision than the type returned in
 * libinput_tablet_tool_get_type(). Not all tablets support a tool ID.
 *
 * Tablets known to support tool IDs include the Wacom Intuos 3, 4, 5, Wacom
 * Cintiq and Wacom Intuos Pro series. The tool ID can be used to
 * distinguish between e.g. a Wacom Classic Pen or a Wacom Pro Pen.  It is
 * the caller's responsibility to interpret the tool ID.
 *
 * @param tool The libinput tool
 * @return The tool ID for this tool object or 0 if none is provided
 *
 * @see libinput_tablet_tool_get_type
 *
 * @since 1.2
 */
uint64_t
libinput_tablet_tool_get_tool_id(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Increment the reference count of the tool by one. A tool is destroyed
 * whenever the reference count reaches 0. See libinput_tablet_tool_unref().
 *
 * @param tool The tool to increment the ref count of
 * @return The passed tool
 *
 * @see libinput_tablet_tool_unref
 *
 * @since 1.2
 */
struct libinput_tablet_tool *
libinput_tablet_tool_ref(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Decrement the reference count of the tool by one. When the reference
 * count of the tool reaches 0, the memory allocated for the tool will be
 * freed.
 *
 * @param tool The tool to decrement the ref count of
 * @return NULL if the tool was destroyed otherwise the passed tool
 *
 * @see libinput_tablet_tool_ref
 *
 * @since 1.2
 */
struct libinput_tablet_tool *
libinput_tablet_tool_unref(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Return whether the tablet tool supports pressure.
 *
 * @param tool The tool to check the axis capabilities of
 * @return Nonzero if the axis is available, zero otherwise.
 *
 * @since 1.2
 */
int
libinput_tablet_tool_has_pressure(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Return whether the tablet tool supports distance.
 *
 * @param tool The tool to check the axis capabilities of
 * @return Nonzero if the axis is available, zero otherwise.
 *
 * @since 1.2
 */
int
libinput_tablet_tool_has_distance(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Return whether the tablet tool supports tilt.
 *
 * @param tool The tool to check the axis capabilities of
 * @return Nonzero if the axis is available, zero otherwise.
 *
 * @since 1.2
 */
int
libinput_tablet_tool_has_tilt(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Return whether the tablet tool supports z-rotation.
 *
 * @param tool The tool to check the axis capabilities of
 * @return Nonzero if the axis is available, zero otherwise.
 *
 * @since 1.2
 */
int
libinput_tablet_tool_has_rotation(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Return whether the tablet tool has a slider axis.
 *
 * @param tool The tool to check the axis capabilities of
 * @return Nonzero if the axis is available, zero otherwise.
 *
 * @since 1.2
 */
int
libinput_tablet_tool_has_slider(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Return whether the tablet tool has a ellipsis major and minor.
 * Where the underlying hardware only supports one of either major or minor,
 * libinput emulates the other axis as a circular contact, i.e. major ==
 * minor for all values of major.
 *
 * @param tool The tool to check the axis capabilities of
 * @return Nonzero if the axis is available, zero otherwise.
 */
int
libinput_tablet_tool_has_size(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Return whether the tablet tool has a relative wheel.
 *
 * @param tool The tool to check the axis capabilities of
 * @return Nonzero if the axis is available, zero otherwise.
 *
 * @since 1.2
 */
int
libinput_tablet_tool_has_wheel(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Check if a tablet tool has a button with the
 * passed-in code (see linux/input.h).
 *
 * @param tool A tablet tool
 * @param code button code to check for
 *
 * @return 1 if the tool supports this button code, 0 if it does not
 *
 * @since 1.2
 */
int
libinput_tablet_tool_has_button(struct libinput_tablet_tool *tool,
				uint32_t code);

/**
 * @ingroup event_tablet
 *
 * Return nonzero if the physical tool can be uniquely identified by
 * libinput, or nonzero otherwise. If a tool can be uniquely identified,
 * keeping a reference to the tool allows tracking the tool across
 * proximity out sequences and across compatible tablets.
 * See libinput_tablet_tool_get_serial() for more details.
 *
 * @param tool A tablet tool
 * @return 1 if the tool can be uniquely identified, 0 otherwise.
 *
 * @see libinput_tablet_tool_get_serial
 *
 * @since 1.2
 */
int
libinput_tablet_tool_is_unique(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Return the serial number of a tool. If the tool does not report a serial
 * number, this function returns zero.
 *
 * Some tools provide hardware information that enables libinput to uniquely
 * identify the physical device. For example, tools compatible with the
 * Wacom Intuos 4, Intuos 5, Intuos Pro and Cintiq series are uniquely
 * identifiable through a serial number. libinput does not specify how a
 * tool can be identified uniquely, a caller should use
 * libinput_tablet_tool_is_unique() to check if the tool is unique.
 *
 * libinput creates a struct @ref libinput_tablet_tool on the first
 * proximity in of this tool. By default, this struct is destroyed on
 * proximity out and re-initialized on the next proximity in. If a caller
 * keeps a reference to the tool by using libinput_tablet_tool_ref()
 * libinput re-uses this struct whenever that same physical tool comes into
 * proximity on any tablet
 * recognized by libinput. It is possible to attach tool-specific virtual
 * state to the tool. For example, a graphics program such as the GIMP may
 * assign a specific color to each tool, allowing the artist to use the
 * tools like physical pens of different color. In multi-tablet setups it is
 * also possible to track the tool across devices.
 *
 * If the tool does not have a unique identifier, libinput creates a single
 * struct @ref libinput_tablet_tool per tool type on each tablet the tool is
 * used on.
 *
 * @param tool The libinput tool
 * @return The tool serial number
 *
 * @see libinput_tablet_tool_is_unique
 *
 * @since 1.2
 */
uint64_t
libinput_tablet_tool_get_serial(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Return the user data associated with a tool object. libinput does
 * not manage, look at, or modify this data. The caller must ensure the
 * data is valid.
 *
 * @param tool The libinput tool
 * @return The user data associated with the tool object
 *
 * @since 1.2
 */
void *
libinput_tablet_tool_get_user_data(struct libinput_tablet_tool *tool);

/**
 * @ingroup event_tablet
 *
 * Set the user data associated with a tool object, if any.
 *
 * @param tool The libinput tool
 * @param user_data The user data to associate with the tool object
 *
 * @since 1.2
 */
void
libinput_tablet_tool_set_user_data(struct libinput_tablet_tool *tool,
				   void *user_data);

/**
 * @defgroup event_tablet_pad Tablet pad events
 *
 * Events that come from the pad of tablet devices.  For events from the
 * tablet tools, see @ref event_tablet.
 *
 * @since 1.3
 */

/**
 * @ingroup event_tablet_pad
 *
 * @return The generic libinput_event of this event
 *
 * @since 1.3
 */
struct libinput_event *
libinput_event_tablet_pad_get_base_event(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * Returns the current position of the ring, in degrees counterclockwise
 * from the northern-most point of the ring in the tablet's current logical
 * orientation.
 *
 * If the source is @ref LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER,
 * libinput sends a terminating event with a ring value of -1 when the
 * finger is lifted from the ring. A caller may use this information to e.g.
 * determine if kinetic scrolling should be triggered.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_TABLET_PAD_RING.  For other events, this function
 * returns 0.
 *
 * @param event The libinput tablet pad event
 * @return The current value of the the axis
 * @retval -1 The finger was lifted
 *
 * @since 1.3
 */
double
libinput_event_tablet_pad_get_ring_position(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * Returns the number of the ring that has changed state, with 0 being the
 * first ring. On tablets with only one ring, this function always returns
 * 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_TABLET_PAD_RING.  For other events, this function
 * returns 0.
 *
 * @param event The libinput tablet pad event
 * @return The index of the ring that changed state
 *
 * @since 1.3
 */
unsigned int
libinput_event_tablet_pad_get_ring_number(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * Returns the source of the interaction with the ring. If the source is
 * @ref LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER, libinput sends a ring
 * position value of -1 to terminate the current interaction.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_TABLET_PAD_RING.  For other events, this function
 * returns 0.
 *
 * @param event The libinput tablet pad event
 * @return The source of the ring interaction
 *
 * @since 1.3
 */
enum libinput_tablet_pad_ring_axis_source
libinput_event_tablet_pad_get_ring_source(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * Returns the current position of the strip, normalized to the range
 * [0, 1], with 0 being the top/left-most point in the tablet's current
 * logical orientation.
 *
 * If the source is @ref LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER,
 * libinput sends a terminating event with a ring value of -1 when the
 * finger is lifted from the ring. A caller may use this information to e.g.
 * determine if kinetic scrolling should be triggered.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_TABLET_PAD_STRIP.  For other events, this function
 * returns 0.
 *
 * @param event The libinput tablet pad event
 * @return The current value of the the axis
 * @retval -1 The finger was lifted
 *
 * @since 1.3
 */
double
libinput_event_tablet_pad_get_strip_position(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * Returns the number of the strip that has changed state, with 0 being the
 * first strip. On tablets with only one strip, this function always returns
 * 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_TABLET_PAD_STRIP.  For other events, this function
 * returns 0.
 *
 * @param event The libinput tablet pad event
 * @return The index of the strip that changed state
 *
 * @since 1.3
 */
unsigned int
libinput_event_tablet_pad_get_strip_number(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * Returns the source of the interaction with the strip. If the source is
 * @ref LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER, libinput sends a strip
 * position value of -1 to terminate the current interaction.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_TABLET_PAD_STRIP.  For other events, this function
 * returns 0.
 *
 * @param event The libinput tablet pad event
 * @return The source of the strip interaction
 *
 * @since 1.3
 */
enum libinput_tablet_pad_strip_axis_source
libinput_event_tablet_pad_get_strip_source(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * Return the button number that triggered this event, starting at 0.
 * For events that are not of type @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON,
 * this function returns 0.
 *
 * Note that the number returned is a generic sequential button number and
 * not a semantic button code as defined in linux/input.h.
 * See the libinput documentation for more details.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON. For other events, this function
 * returns 0.
 *
 * @param event The libinput tablet pad event
 * @return the button triggering this event
 *
 * @since 1.3
 */
uint32_t
libinput_event_tablet_pad_get_button_number(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * Return the button state of the event.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON. For other events, this function
 * returns 0.
 *
 * @param event The libinput tablet pad event
 * @return the button state triggering this event
 *
 * @since 1.3
 */
enum libinput_button_state
libinput_event_tablet_pad_get_button_state(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * Returns the mode the button, ring, or strip that triggered this event is
 * in, at the time of the event.
 *
 * The mode is a virtual grouping of functionality, usually based on some
 * visual feedback like LEDs on the pad. Mode indices start at 0, a device
 * that does not support modes always returns 0.
 *
 * Mode switching is controlled by libinput and more than one mode may exist
 * on the tablet. This function returns the mode that this event's button,
 * ring or strip is logically in. If the button is a mode toggle button
 * and the button event caused a new mode to be toggled, the mode returned
 * is the new mode the button is in.
 *
 * Note that the returned mode is the mode valid as of the time of the
 * event. The returned mode may thus be different to the mode returned by
 * libinput_tablet_pad_mode_group_get_mode(). See
 * libinput_tablet_pad_mode_group_get_mode() for details.
 *
 * @param event The libinput tablet pad event
 * @return the 0-indexed mode of this button, ring or strip at the time of
 * the event
 *
 * @see libinput_tablet_pad_mode_group_get_mode
 *
 * @since 1.4
 */
unsigned int
libinput_event_tablet_pad_get_mode(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * Returns the mode group that the button, ring, or strip that triggered
 * this event is considered in. The mode is a virtual grouping of
 * functionality, usually based on some visual feedback like LEDs on the
 * pad.
 *
 * 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.
 *
 * @param event The libinput tablet pad event
 * @return the mode group of the button, ring or strip that caused this event
 *
 * @see libinput_device_tablet_pad_get_mode_group
 *
 * @since 1.4
 */
struct libinput_tablet_pad_mode_group *
libinput_event_tablet_pad_get_mode_group(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @param event The libinput tablet pad event
 * @return The event time for this event
 *
 * @since 1.3
 */
uint32_t
libinput_event_tablet_pad_get_time(struct libinput_event_tablet_pad *event);

/**
 * @ingroup event_tablet_pad
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @param event The libinput tablet pad event
 * @return The event time for this event in microseconds
 *
 * @since 1.3
 */
uint64_t
libinput_event_tablet_pad_get_time_usec(struct libinput_event_tablet_pad *event);

/**
 * @defgroup event_switch Switch events
 *
 * Events that come from switch devices.
 */

/**
 * @ingroup event_switch
 *
 * Return the switch that triggered this event.
 * For pointer events that are not of type @ref
 * LIBINPUT_EVENT_SWITCH_TOGGLE, this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_SWITCH_TOGGLE.
 *
 * @param event The libinput switch event
 * @return The switch triggering this event
 *
 * @since 1.7
 */
enum libinput_switch
libinput_event_switch_get_switch(struct libinput_event_switch *event);

/**
 * @ingroup event_switch
 *
 * Return the switch state that triggered this event.
 * For switch events that are not of type @ref
 * LIBINPUT_EVENT_SWITCH_TOGGLE, this function returns 0.
 *
 * @note It is an application bug to call this function for events other than
 * @ref LIBINPUT_EVENT_SWITCH_TOGGLE.
 *
 * @param event The libinput switch event
 * @return The switch state triggering this event
 *
 * @since 1.7
 */
enum libinput_switch_state
libinput_event_switch_get_switch_state(struct libinput_event_switch *event);

/**
 * @ingroup event_switch
 *
 * @return The generic libinput_event of this event
 *
 * @since 1.7
 */
struct libinput_event *
libinput_event_switch_get_base_event(struct libinput_event_switch *event);

/**
 * @ingroup event_switch
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @param event The libinput switch event
 * @return The event time for this event
 *
 * @since 1.7
 */
uint32_t
libinput_event_switch_get_time(struct libinput_event_switch *event);

/**
 * @ingroup event_switch
 *
 * @note Timestamps may not always increase. See the libinput documentation
 * for more details.
 *
 * @param event The libinput switch event
 * @return The event time for this event in microseconds
 *
 * @since 1.7
 */
uint64_t
libinput_event_switch_get_time_usec(struct libinput_event_switch *event);

/**
 * @defgroup base Initialization and manipulation of libinput contexts
 */

/**
 * @ingroup base
 * @struct libinput_interface
 *
 * libinput does not open file descriptors to devices directly, instead
 * open_restricted() and close_restricted() are called for each path that
 * must be opened.
 *
 * @see libinput_udev_create_context
 * @see libinput_path_create_context
 */
struct libinput_interface {
	/**
	 * Open the device at the given path with the flags provided and
	 * return the fd.
	 *
	 * @param path The device path to open
	 * @param flags Flags as defined by open(2)
	 * @param user_data The user_data provided in
	 * libinput_udev_create_context()
	 *
	 * @return The file descriptor, or a negative errno on failure.
	 */
	int (*open_restricted)(const char *path, int flags, void *user_data);
	/**
	 * Close the file descriptor.
	 *
	 * @param fd The file descriptor to close
	 * @param user_data The user_data provided in
	 * libinput_udev_create_context()
	 */
	void (*close_restricted)(int fd, void *user_data);
};

/**
 * @ingroup base
 *
 * Create a new libinput context from udev. This context is inactive until
 * assigned a seat ID with libinput_udev_assign_seat().
 *
 * @param interface The callback interface
 * @param user_data Caller-specific data passed to the various callback
 * interfaces.
 * @param udev An already initialized udev context
 *
 * @return An initialized, but inactive libinput context or NULL on error
 */
struct libinput *
libinput_udev_create_context(const struct libinput_interface *interface,
			     void *user_data,
			     struct udev *udev);

/**
 * @ingroup base
 *
 * Assign a seat to this libinput context. New devices or the removal of
 * existing devices will appear as events during libinput_dispatch().
 *
 * libinput_udev_assign_seat() succeeds even if no input devices are currently
 * available on this seat, or if devices are available but fail to open in
 * @ref libinput_interface::open_restricted. Devices that do not have the
 * minimum capabilities to be recognized as pointer, keyboard or touch
 * device are ignored. Such devices and those that failed to open
 * ignored until the next call to libinput_resume().
 *
 * This function may only be called once per context.
 *
 * @param libinput A libinput context initialized with
 * libinput_udev_create_context()
 * @param seat_id A seat identifier. This string must not be NULL.
 *
 * @return 0 on success or -1 on failure.
 */
int
libinput_udev_assign_seat(struct libinput *libinput,
			  const char *seat_id);

/**
 * @ingroup base
 *
 * Create a new libinput context that requires the caller to manually add or
 * remove devices with libinput_path_add_device() and
 * libinput_path_remove_device().
 *
 * The context is fully initialized but will not generate events until at
 * least one device has been added.
 *
 * The reference count of the context is initialized to 1. See @ref
 * libinput_unref.
 *
 * @param interface The callback interface
 * @param user_data Caller-specific data passed to the various callback
 * interfaces.
 *
 * @return An initialized, empty libinput context.
 */
struct libinput *
libinput_path_create_context(const struct libinput_interface *interface,
			     void *user_data);

/**
 * @ingroup base
 *
 * Add a device to a libinput context initialized with
 * libinput_path_create_context(). If successful, the device will be
 * added to the internal list and re-opened on libinput_resume(). The device
 * can be removed with libinput_path_remove_device().
 *
 * If the device was successfully initialized, it is returned in the device
 * argument. The lifetime of the returned device pointer is limited until
 * the next libinput_dispatch(), use libinput_device_ref() to keep a permanent
 * reference.
 *
 * @param libinput A previously initialized libinput context
 * @param path Path to an input device
 * @return The newly initiated device on success, or NULL on failure.
 *
 * @note It is an application bug to call this function on a libinput
 * context initialized with libinput_udev_create_context().
 */
struct libinput_device *
libinput_path_add_device(struct libinput *libinput,
			 const char *path);

/**
 * @ingroup base
 *
 * Remove a device from a libinput context initialized with
 * libinput_path_create_context() or added to such a context with
 * libinput_path_add_device().
 *
 * Events already processed from this input device are kept in the queue,
 * the @ref LIBINPUT_EVENT_DEVICE_REMOVED event marks the end of events for
 * this device.
 *
 * If no matching device exists, this function does nothing.
 *
 * @param device A libinput device
 *
 * @note It is an application bug to call this function on a libinput
 * context initialized with libinput_udev_create_context().
 */
void
libinput_path_remove_device(struct libinput_device *device);

/**
 * @ingroup base
 *
 * libinput keeps a single file descriptor for all events. Call into
 * libinput_dispatch() if any events become available on this fd.
 *
 * @return The file descriptor used to notify of pending events.
 */
int
libinput_get_fd(struct libinput *libinput);

/**
 * @ingroup base
 *
 * Main event dispatchment function. Reads events of the file descriptors
 * and processes them internally. Use libinput_get_event() to retrieve the
 * events.
 *
 * Dispatching does not necessarily queue libinput events. This function
 * should be called immediately once data is available on the file
 * descriptor returned by libinput_get_fd(). libinput has a number of
 * timing-sensitive features (e.g. tap-to-click), any delay in calling
 * libinput_dispatch() may prevent these features from working correctly.
 *
 * @param libinput A previously initialized libinput context
 *
 * @return 0 on success, or a negative errno on failure
 */
int
libinput_dispatch(struct libinput *libinput);

/**
 * @ingroup base
 *
 * Retrieve the next event from libinput's internal event queue.
 *
 * After handling the retrieved event, the caller must destroy it using
 * libinput_event_destroy().
 *
 * @param libinput A previously initialized libinput context
 * @return The next available event, or NULL if no event is available.
 */
struct libinput_event *
libinput_get_event(struct libinput *libinput);

/**
 * @ingroup base
 *
 * Return the type of the next event in the internal queue. This function
 * does not pop the event off the queue and the next call to
 * libinput_get_event() returns that event.
 *
 * @param libinput A previously initialized libinput context
 * @return The event type of the next available event or @ref
 * LIBINPUT_EVENT_NONE if no event is available.
 */
enum libinput_event_type
libinput_next_event_type(struct libinput *libinput);

/**
 * @ingroup base
 *
 * Set caller-specific data associated with this context. libinput does
 * not manage, look at, or modify this data. The caller must ensure the
 * data is valid.
 *
 * @param libinput A previously initialized libinput context
 * @param user_data Caller-specific data passed to the various callback
 * interfaces.
 */
void
libinput_set_user_data(struct libinput *libinput,
		       void *user_data);

/**
 * @ingroup base
 *
 * Get the caller-specific data associated with this context, if any.
 *
 * @param libinput A previously initialized libinput context
 * @return The caller-specific data previously assigned in
 * libinput_set_user_data(), libinput_path_create_context() or
 * libinput_udev_create_context().
 */
void *
libinput_get_user_data(struct libinput *libinput);

/**
 * @ingroup base
 *
 * Resume a suspended libinput context. This re-enables device
 * monitoring and adds existing devices.
 *
 * @param libinput A previously initialized libinput context
 * @see libinput_suspend
 *
 * @return 0 on success or -1 on failure
 */
int
libinput_resume(struct libinput *libinput);

/**
 * @ingroup base
 *
 * Suspend monitoring for new devices and close existing devices.
 * This all but terminates libinput but does keep the context
 * valid to be resumed with libinput_resume().
 *
 * @param libinput A previously initialized libinput context
 */
void
libinput_suspend(struct libinput *libinput);

/**
 * @ingroup base
 *
 * Add a reference to the context. A context is destroyed whenever the
 * reference count reaches 0. See @ref libinput_unref.
 *
 * @param libinput A previously initialized valid libinput context
 * @return The passed libinput context
 */
struct libinput *
libinput_ref(struct libinput *libinput);

/**
 * @ingroup base
 *
 * Dereference the libinput context. After this, the context may have been
 * destroyed, if the last reference was dereferenced. If so, the context is
 * invalid and may not be interacted with.
 *
 * @bug When the refcount reaches zero, libinput_unref() releases resources
 * even if a caller still holds refcounted references to related resources
 * (e.g. a libinput_device). When libinput_unref() returns
 * NULL, the caller must consider any resources related to that context
 * invalid. See https://bugs.freedesktop.org/show_bug.cgi?id=91872.
 *
 * Example code:
 * @code
 * li = libinput_path_create_context(&interface, NULL);
 * device = libinput_path_add_device(li, "/dev/input/event0");
 * // get extra reference to device
 * libinput_device_ref(device);
 *
 * // refcount reaches 0, so *all* resources are cleaned up,
 * // including device
 * libinput_unref(li);
 *
 * // INCORRECT: device has been cleaned up and must not be used
 * // li = libinput_device_get_context(device);
 * @endcode
 *
 * @param libinput A previously initialized libinput context
 * @return NULL if context was destroyed otherwise the passed context
 */
struct libinput *
libinput_unref(struct libinput *libinput);

/**
 * @ingroup base
 *
 * Set the log priority for the libinput context. Messages with priorities
 * equal to or higher than the argument will be printed to the context's
 * log handler.
 *
 * The default log priority is @ref LIBINPUT_LOG_PRIORITY_ERROR.
 *
 * @param libinput A previously initialized libinput context
 * @param priority The minimum priority of log messages to print.
 *
 * @see libinput_log_set_handler
 * @see libinput_log_get_priority
 */
void
libinput_log_set_priority(struct libinput *libinput,
			  enum libinput_log_priority priority);

/**
 * @ingroup base
 *
 * Get the context's log priority. Messages with priorities equal to or
 * higher than the argument will be printed to the current log handler.
 *
 * The default log priority is @ref LIBINPUT_LOG_PRIORITY_ERROR.
 *
 * @param libinput A previously initialized libinput context
 * @return The minimum priority of log messages to print.
 *
 * @see libinput_log_set_handler
 * @see libinput_log_set_priority
 */
enum libinput_log_priority
libinput_log_get_priority(const struct libinput *libinput);

/**
 * @ingroup base
 *
 * Log handler type for custom logging.
 *
 * @param libinput The libinput context
 * @param priority The priority of the current message
 * @param format Message format in printf-style
 * @param args Message arguments
 *
 * @see libinput_log_set_priority
 * @see libinput_log_get_priority
 * @see libinput_log_set_handler
 */
typedef void (*libinput_log_handler)(struct libinput *libinput,
				     enum libinput_log_priority priority,
				     const char *format, va_list args)
	   LIBINPUT_ATTRIBUTE_PRINTF(3, 0);

/**
 * @ingroup base
 *
 * Set the context's log handler. Messages with priorities equal to or
 * higher than the context's log priority will be passed to the given
 * log handler.
 *
 * The default log handler prints to stderr.
 *
 * @param libinput A previously initialized libinput context
 * @param log_handler The log handler for library messages.
 *
 * @see libinput_log_set_priority
 * @see libinput_log_get_priority
 */
void
libinput_log_set_handler(struct libinput *libinput,
			 libinput_log_handler log_handler);

/**
 * @defgroup seat Initialization and manipulation of seats
 *
 * A seat has two identifiers, the physical name and the logical name. A
 * device is always assigned to exactly one seat. It may change to a
 * different logical seat but it cannot change physical seats.
 *
 * See the libinput documentation for more information on seats.
 */

/**
 * @ingroup seat
 *
 * Increase the refcount of the seat. A seat will be freed whenever the
 * refcount reaches 0. This may happen during libinput_dispatch() if the
 * seat was removed from the system. A caller must ensure to reference
 * the seat correctly to avoid dangling pointers.
 *
 * @param seat A previously obtained seat
 * @return The passed seat
 */
struct libinput_seat *
libinput_seat_ref(struct libinput_seat *seat);

/**
 * @ingroup seat
 *
 * Decrease the refcount of the seat. A seat will be freed whenever the
 * refcount reaches 0. This may happen during libinput_dispatch() if the
 * seat was removed from the system. A caller must ensure to reference
 * the seat correctly to avoid dangling pointers.
 *
 * @param seat A previously obtained seat
 * @return NULL if seat was destroyed, otherwise the passed seat
 */
struct libinput_seat *
libinput_seat_unref(struct libinput_seat *seat);

/**
 * @ingroup seat
 *
 * Set caller-specific data associated with this seat. libinput does
 * not manage, look at, or modify this data. The caller must ensure the
 * data is valid.
 *
 * @param seat A previously obtained seat
 * @param user_data Caller-specific data pointer
 * @see libinput_seat_get_user_data
 */
void
libinput_seat_set_user_data(struct libinput_seat *seat, void *user_data);

/**
 * @ingroup seat
 *
 * Get the caller-specific data associated with this seat, if any.
 *
 * @param seat A previously obtained seat
 * @return Caller-specific data pointer or NULL if none was set
 * @see libinput_seat_set_user_data
 */
void *
libinput_seat_get_user_data(struct libinput_seat *seat);

/**
 * @ingroup seat
 *
 * Get the libinput context from the seat.
 *
 * @param seat A previously obtained seat
 * @return The libinput context for this seat.
 */
struct libinput *
libinput_seat_get_context(struct libinput_seat *seat);

/**
 * @ingroup seat
 *
 * Return the physical name of the seat. For libinput contexts created from
 * udev, this is always the same value as passed into
 * libinput_udev_assign_seat() and all seats from that context will have
 * the same physical name.
 *
 * The physical name of the seat is one that is usually set by the system or
 * lower levels of the stack. In most cases, this is the base filter for
 * devices - devices assigned to seats outside the current seat will not
 * be available to the caller.
 *
 * @param seat A previously obtained seat
 * @return The physical name of this seat
 */
const char *
libinput_seat_get_physical_name(struct libinput_seat *seat);

/**
 * @ingroup seat
 *
 * Return the logical name of the seat. This is an identifier to group sets
 * of devices within the compositor.
 *
 * @param seat A previously obtained seat
 * @return The logical name of this seat
 */
const char *
libinput_seat_get_logical_name(struct libinput_seat *seat);

/**
 * @defgroup device Initialization and manipulation of input devices
 */

/**
 * @ingroup device
 *
 * Increase the refcount of the input device. An input device will be freed
 * whenever the refcount reaches 0. This may happen during
 * libinput_dispatch() if the device was removed from the system. A caller
 * must ensure to reference the device correctly to avoid dangling pointers.
 *
 * @param device A previously obtained device
 * @return The passed device
 */
struct libinput_device *
libinput_device_ref(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Decrease the refcount of the input device. An input device will be freed
 * whenever the refcount reaches 0. This may happen during libinput_dispatch
 * if the device was removed from the system. A caller must ensure to
 * reference the device correctly to avoid dangling pointers.
 *
 * @param device A previously obtained device
 * @return NULL if the device was destroyed, otherwise the passed device
 */
struct libinput_device *
libinput_device_unref(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Set caller-specific data associated with this input device. libinput does
 * not manage, look at, or modify this data. The caller must ensure the
 * data is valid.
 *
 * @param device A previously obtained device
 * @param user_data Caller-specific data pointer
 * @see libinput_device_get_user_data
 */
void
libinput_device_set_user_data(struct libinput_device *device, void *user_data);

/**
 * @ingroup device
 *
 * Get the caller-specific data associated with this input device, if any.
 *
 * @param device A previously obtained device
 * @return Caller-specific data pointer or NULL if none was set
 * @see libinput_device_set_user_data
 */
void *
libinput_device_get_user_data(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Get the libinput context from the device.
 *
 * @param device A previously obtained device
 * @return The libinput context for this device.
 */
struct libinput *
libinput_device_get_context(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Get the device group this device is assigned to. Some physical
 * devices like graphics tablets are represented by multiple kernel
 * devices and thus by multiple struct @ref libinput_device.
 *
 * libinput assigns these devices to the same @ref libinput_device_group
 * allowing the caller to identify such devices and adjust configuration
 * settings accordingly. For example, setting a tablet to left-handed often
 * means turning it upside down. A touch device on the same tablet would
 * need to be turned upside down too to work correctly.
 *
 * All devices are part of a device group though for most devices the group
 * will be a singleton. A device is assigned to a device group on @ref
 * LIBINPUT_EVENT_DEVICE_ADDED and removed from that group on @ref
 * LIBINPUT_EVENT_DEVICE_REMOVED. It is up to the caller to track how many
 * devices are in each device group.
 *
 * @dot
 * digraph groups_libinput {
 *   rankdir="TB";
 *   node [
 *     shape="box";
 *   ]
 *
 *   mouse [ label="mouse"; URL="\ref libinput_device"];
 *   kbd [ label="keyboard"; URL="\ref libinput_device"];
 *
 *   pen [ label="tablet pen"; URL="\ref libinput_device"];
 *   touch [ label="tablet touch"; URL="\ref libinput_device"];
 *   pad [ label="tablet pad"; URL="\ref libinput_device"];
 *
 *   group1 [ label="group 1"; URL="\ref libinput_device_group"];
 *   group2 [ label="group 2"; URL="\ref libinput_device_group"];
 *   group3 [ label="group 3"; URL="\ref libinput_device_group"];
 *
 *   mouse -> group1
 *   kbd -> group2
 *
 *   pen -> group3;
 *   touch -> group3;
 *   pad -> group3;
 * }
 * @enddot
 *
 * Device groups do not get re-used once the last device in the group was
 * removed, i.e. unplugging and re-plugging a physical device with grouped
 * devices will return a different device group after every unplug.
 *
 * The returned device group is not refcounted and may become invalid after
 * the next call to libinput. Use libinput_device_group_ref() and
 * libinput_device_group_unref() to continue using the handle outside of the
 * immediate scope.
 *
 * Device groups are assigned based on the <b>LIBINPUT_DEVICE_GROUP</b> udev
 * property, see the libinput documentation for more details.
 *
 * @return The device group this device belongs to
 */
struct libinput_device_group *
libinput_device_get_device_group(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Get the system name of the device.
 *
 * To get the descriptive device name, use libinput_device_get_name().
 *
 * @param device A previously obtained device
 * @return System name of the device
 *
 */
const char *
libinput_device_get_sysname(struct libinput_device *device);

/**
 * @ingroup device
 *
 * The descriptive device name as advertised by the kernel and/or the
 * hardware itself. To get the sysname for this device, use
 * libinput_device_get_sysname().
 *
 * The lifetime of the returned string is tied to the struct
 * libinput_device. The string may be the empty string but is never NULL.
 *
 * @param device A previously obtained device
 * @return The device name
 */
const char *
libinput_device_get_name(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Get the product ID for this device.
 *
 * @param device A previously obtained device
 * @return The product ID of this device
 */
unsigned int
libinput_device_get_id_product(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Get the vendor ID for this device.
 *
 * @param device A previously obtained device
 * @return The vendor ID of this device
 */
unsigned int
libinput_device_get_id_vendor(struct libinput_device *device);

/**
 * @ingroup device
 *
 * A device may be mapped to a single output, or all available outputs. If a
 * device is mapped to a single output only, a relative device may not move
 * beyond the boundaries of this output. An absolute device has its input
 * coordinates mapped to the extents of this output.
 *
 * @note <b>Use of this function is discouraged.</b> Its return value is not
 * precisely defined and may not be understood by the caller or may be
 * insufficient to map the device. Instead, the system configuration could
 * set a udev property the caller understands and interprets correctly. The
 * caller could then obtain device with libinput_device_get_udev_device()
 * and query it for this property. For more complex cases, the caller
 * must implement monitor-to-device association heuristics.
 *
 * @return The name of the output this device is mapped to, or NULL if no
 * output is set
 */
const char *
libinput_device_get_output_name(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Get the seat associated with this input device.
 *
 * A seat can be uniquely identified by the physical and logical seat name.
 * There will ever be only one seat instance with a given physical and logical
 * seat name pair at any given time, but if no external reference is kept, it
 * may be destroyed if no device belonging to it is left.
 *
 * The returned seat is not refcounted and may become invalid after
 * the next call to libinput. Use libinput_seat_ref() and
 * libinput_seat_unref() to continue using the handle outside of the
 * immediate scope.
 *
 * See the libinput documentation for more information on seats.
 *
 * @param device A previously obtained device
 * @return The seat this input device belongs to
 */
struct libinput_seat *
libinput_device_get_seat(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Change the logical seat associated with this device by removing the
 * device and adding it to the new seat.
 *
 * This command is identical to physically unplugging the device, then
 * re-plugging it as a member of the new seat. libinput will generate a
 * @ref LIBINPUT_EVENT_DEVICE_REMOVED event and this @ref libinput_device is
 * considered removed from the context; it will not generate further events
 * and will be freed when the refcount reaches zero.
 * A @ref LIBINPUT_EVENT_DEVICE_ADDED event is generated with a new @ref
 * libinput_device handle. It is the caller's responsibility to update
 * references to the new device accordingly.
 *
 * If the logical seat name already exists in the device's physical seat,
 * the device is added to this seat. Otherwise, a new seat is created.
 *
 * @note This change applies to this device until removal or @ref
 * libinput_suspend(), whichever happens earlier.
 *
 * @param device A previously obtained device
 * @param name The new logical seat name
 * @return 0 on success, non-zero on error
 */
int
libinput_device_set_seat_logical_name(struct libinput_device *device,
				      const char *name);

/**
 * @ingroup device
 *
 * Return a udev handle to the device that is this libinput device, if any.
 * The returned handle has a refcount of at least 1, the caller must call
 * <i>udev_device_unref()</i> once to release the associated resources.
 * See the [libudev documentation]
 * (http://www.freedesktop.org/software/systemd/libudev/) for details.
 *
 * Some devices may not have a udev device, or the udev device may be
 * unobtainable. This function returns NULL if no udev device was available.
 *
 * Calling this function multiple times for the same device may not
 * return the same udev handle each time.
 *
 * @param device A previously obtained device
 * @return A udev handle to the device with a refcount of >= 1 or NULL.
 * @retval NULL This device is not represented by a udev device
 */
struct udev_device *
libinput_device_get_udev_device(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Update the LEDs on the device, if any. If the device does not have
 * LEDs, or does not have one or more of the LEDs given in the mask, this
 * function does nothing.
 *
 * @param device A previously obtained device
 * @param leds A mask of the LEDs to set, or unset.
 */
void
libinput_device_led_update(struct libinput_device *device,
			   enum libinput_led leds);

/**
 * @ingroup device
 *
 * Check if the given device has the specified capability
 *
 * @return Non-zero if the given device has the capability or zero otherwise
 */
int
libinput_device_has_capability(struct libinput_device *device,
			       enum libinput_device_capability capability);

/**
 * @ingroup device
 *
 * Get the physical size of a device in mm, where meaningful. This function
 * only succeeds on devices with the required data, i.e. tablets, touchpads
 * and touchscreens.
 *
 * If this function returns nonzero, width and height are unmodified.
 *
 * @param device The device
 * @param width Set to the width of the device
 * @param height Set to the height of the device
 * @return 0 on success, or nonzero otherwise
 */
int
libinput_device_get_size(struct libinput_device *device,
			 double *width,
			 double *height);

/**
 * @ingroup device
 *
 * Check if a @ref LIBINPUT_DEVICE_CAP_POINTER device has a button with the
 * given code (see linux/input-event-codes.h).
 *
 * @param device A current input device
 * @param code Button code to check for, e.g. <i>BTN_LEFT</i>
 *
 * @return 1 if the device supports this button code, 0 if it does not, -1
 * on error.
 */
int
libinput_device_pointer_has_button(struct libinput_device *device, uint32_t code);

/**
 * @ingroup device
 *
 * Check if a @ref LIBINPUT_DEVICE_CAP_KEYBOARD device has a key with the
 * given code (see linux/input-event-codes.h).
 *
 * @param device A current input device
 * @param code Key code to check for, e.g. <i>KEY_ESC</i>
 *
 * @return 1 if the device supports this key code, 0 if it does not, -1
 * on error.
 */
int
libinput_device_keyboard_has_key(struct libinput_device *device,
				 uint32_t code);

/**
 * @ingroup device
 *
 * Check how many touches a @ref LIBINPUT_DEVICE_CAP_TOUCH device supports
 * simultaneously.
 *
 * @param device A current input device
 *
 * @return The number of simultaneous touches or 0 if unknown, -1
 * on error.
 *
 * @since 1.11
 */
int
libinput_device_touch_get_touch_count(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Check if a @ref LIBINPUT_DEVICE_CAP_SWITCH device has a switch of the
 * given type.
 *
 * @param device A current input device
 * @param sw Switch to check for
 *
 * @return 1 if the device supports this switch, 0 if it does not, -1
 * on error.
 *
 * @since 1.9
 */
int
libinput_device_switch_has_switch(struct libinput_device *device,
				  enum libinput_switch sw);

/**
 * @ingroup device
 *
 * Return the number of buttons on a device with the
 * @ref LIBINPUT_DEVICE_CAP_TABLET_PAD capability.
 * Buttons on a pad device are numbered sequentially, see the
 * libinput documentation for details.
 *
 * @param device A current input device
 *
 * @return The number of buttons supported by the device.
 *
 * @since 1.3
 */
int
libinput_device_tablet_pad_get_num_buttons(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Return the number of rings a device with the @ref
 * LIBINPUT_DEVICE_CAP_TABLET_PAD capability provides.
 *
 * @param device A current input device
 *
 * @return The number of rings or 0 if the device has no rings.
 *
 * @see libinput_event_tablet_pad_get_ring_number
 *
 * @since 1.3
 */
int
libinput_device_tablet_pad_get_num_rings(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Return the number of strips a device with the @ref
 * LIBINPUT_DEVICE_CAP_TABLET_PAD capability provides.
 *
 * @param device A current input device
 *
 * @return The number of strips or 0 if the device has no strips.
 *
 * @see libinput_event_tablet_pad_get_strip_number
 *
 * @since 1.3
 */
int
libinput_device_tablet_pad_get_num_strips(struct libinput_device *device);

/**
 * @ingroup device
 *
 * Increase the refcount of the device group. A device group will be freed
 * whenever the refcount reaches 0. This may happen during
 * libinput_dispatch() if all devices of this group were removed from the
 * system. A caller must ensure to reference the device group correctly to
 * avoid dangling pointers.
 *
 * @param group A previously obtained device group
 * @return The passed device group
 */
struct libinput_device_group *
libinput_device_group_ref(struct libinput_device_group *group);

/**
 * @ingroup device
 *
 * Decrease the refcount of the device group. A device group will be freed
 * whenever the refcount reaches 0. This may happen during
 * libinput_dispatch() if all devices of this group were removed from the
 * system. A caller must ensure to reference the device group correctly to
 * avoid dangling pointers.
 *
 * @param group A previously obtained device group
 * @return NULL if the device group was destroyed, otherwise the passed
 * device group
 */
struct libinput_device_group *
libinput_device_group_unref(struct libinput_device_group *group);

/**
 * @ingroup device
 *
 * Set caller-specific data associated with this device group. libinput does
 * not manage, look at, or modify this data. The caller must ensure the
 * data is valid.
 *
 * @param group A previously obtained device group
 * @param user_data Caller-specific data pointer
 * @see libinput_device_group_get_user_data
 */
void
libinput_device_group_set_user_data(struct libinput_device_group *group,
				    void *user_data);

/**
 * @ingroup device
 *
 * Get the caller-specific data associated with this input device group, if
 * any.
 *
 * @param group A previously obtained group
 * @return Caller-specific data pointer or NULL if none was set
 * @see libinput_device_group_set_user_data
 */
void *
libinput_device_group_get_user_data(struct libinput_device_group *group);

/**
 * @defgroup config Device configuration
 *
 * Enable, disable, change and/or check for device-specific features. For
 * all features, libinput assigns a default based on the hardware
 * configuration. This default can be obtained with the respective
 * get_default call.
 *
 * Configuration options are device dependent and not all options are
 * supported on all devices. For all configuration options, libinput
 * provides a call to check if a configuration option is available on a
 * device (e.g. libinput_device_config_calibration_has_matrix())
 *
 * Some configuration option may be dependent on or mutually exclusive with
 * with other options. The behavior in those cases is
 * implementation-dependent, the caller must ensure that the options are set
 * in the right order.
 *
 * Below is a general grouping of configuration options according to device
 * type. Note that this is a guide only and not indicative of any specific
 * device.
 * - Touchpad:
 *    - libinput_device_config_tap_set_enabled()
 *    - libinput_device_config_tap_set_drag_enabled()
 *    - libinput_device_config_tap_set_drag_lock_enabled()
 *    - libinput_device_config_click_set_method()
 *    - libinput_device_config_scroll_set_method()
 *    - libinput_device_config_dwt_set_enabled()
 * - Touchscreens:
 *    - libinput_device_config_calibration_set_matrix()
 * - Pointer devices (mice, trackballs, touchpads):
 *    - libinput_device_config_accel_set_speed()
 *    - libinput_device_config_accel_set_profile()
 *    - libinput_device_config_scroll_set_natural_scroll_enabled()
 *    - libinput_device_config_left_handed_set()
 *    - libinput_device_config_middle_emulation_set_enabled()
 *    - libinput_device_config_rotation_set_angle()
 * - All devices:
 *    - libinput_device_config_send_events_set_mode()
 */

/**
 * @ingroup config
 *
 * Status codes returned when applying configuration settings.
 */
enum libinput_config_status {
	LIBINPUT_CONFIG_STATUS_SUCCESS = 0,	/**< Config applied successfully */
	LIBINPUT_CONFIG_STATUS_UNSUPPORTED,	/**< Configuration not available on
						     this device */
	LIBINPUT_CONFIG_STATUS_INVALID,		/**< Invalid parameter range */
};

/**
 * @ingroup config
 *
 * Return a string describing the error.
 *
 * @param status The status to translate to a string
 * @return A human-readable string representing the error or NULL for an
 * invalid status.
 */
const char *
libinput_config_status_to_str(enum libinput_config_status status);

/**
 * @ingroup config
 */
enum libinput_config_tap_state {
	LIBINPUT_CONFIG_TAP_DISABLED, /**< Tapping is to be disabled, or is
					currently disabled */
	LIBINPUT_CONFIG_TAP_ENABLED, /**< Tapping is to be enabled, or is
				       currently enabled */
};

/**
 * @ingroup config
 *
 * Check if the device supports tap-to-click and how many fingers can be
 * used for tapping. See
 * libinput_device_config_tap_set_enabled() for more information.
 *
 * @param device The device to configure
 * @return The number of fingers that can generate a tap event, or 0 if the
 * device does not support tapping.
 *
 * @see libinput_device_config_tap_set_enabled
 * @see libinput_device_config_tap_get_enabled
 * @see libinput_device_config_tap_get_default_enabled
 */
int
libinput_device_config_tap_get_finger_count(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Enable or disable tap-to-click on this device, with a default mapping of
 * 1, 2, 3 finger tap mapping to left, right, middle click, respectively.
 * Tapping is limited by the number of simultaneous touches
 * supported by the device, see
 * libinput_device_config_tap_get_finger_count().
 *
 * @param device The device to configure
 * @param enable @ref LIBINPUT_CONFIG_TAP_ENABLED to enable tapping or @ref
 * LIBINPUT_CONFIG_TAP_DISABLED to disable tapping
 *
 * @return A config status code. Disabling tapping on a device that does not
 * support tapping always succeeds.
 *
 * @see libinput_device_config_tap_get_finger_count
 * @see libinput_device_config_tap_get_enabled
 * @see libinput_device_config_tap_get_default_enabled
 */
enum libinput_config_status
libinput_device_config_tap_set_enabled(struct libinput_device *device,
				       enum libinput_config_tap_state enable);

/**
 * @ingroup config
 *
 * Check if tap-to-click is enabled on this device. If the device does not
 * support tapping, this function always returns @ref
 * LIBINPUT_CONFIG_TAP_DISABLED.
 *
 * @param device The device to configure
 *
 * @retval LIBINPUT_CONFIG_TAP_ENABLED If tapping is currently enabled
 * @retval LIBINPUT_CONFIG_TAP_DISABLED If tapping is currently disabled
 *
 * @see libinput_device_config_tap_get_finger_count
 * @see libinput_device_config_tap_set_enabled
 * @see libinput_device_config_tap_get_default_enabled
 */
enum libinput_config_tap_state
libinput_device_config_tap_get_enabled(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Return the default setting for whether tap-to-click is enabled on this
 * device.
 *
 * @param device The device to configure
 * @retval LIBINPUT_CONFIG_TAP_ENABLED If tapping is enabled by default
 * @retval LIBINPUT_CONFIG_TAP_DISABLED If tapping Is disabled by default
 *
 * @see libinput_device_config_tap_get_finger_count
 * @see libinput_device_config_tap_set_enabled
 * @see libinput_device_config_tap_get_enabled
 */
enum libinput_config_tap_state
libinput_device_config_tap_get_default_enabled(struct libinput_device *device);

/**
 * @ingroup config
 *
 * @since 1.5
 */
enum libinput_config_tap_button_map {
	/** 1/2/3 finger tap maps to left/right/middle */
	LIBINPUT_CONFIG_TAP_MAP_LRM,
	/** 1/2/3 finger tap maps to left/middle/right*/
	LIBINPUT_CONFIG_TAP_MAP_LMR,
};

/**
 * @ingroup config
 *
 * Set the finger number to button number mapping for tap-to-click. The
 * default mapping on most devices is to have a 1, 2 and 3 finger tap to map
 * to the left, right and middle button, respectively.
 * A device may permit changing the button mapping but disallow specific
 * maps. In this case @ref LIBINPUT_CONFIG_STATUS_UNSUPPORTED is returned,
 * the caller is expected to handle this case correctly.
 *
 * Changing the button mapping may not take effect immediately,
 * the device may wait until it is in a neutral state before applying any
 * changes.
 *
 * The mapping may be changed when tap-to-click is disabled. The new mapping
 * takes effect when tap-to-click is enabled in the future.
 *
 * @note It is an application bug to call this function for devices where
 * libinput_device_config_tap_get_finger_count() returns 0.
 *
 * @param device The device to configure
 * @param map The new finger-to-button number mapping
 * @return A config status code. Changing the order on a device that does not
 * support tapping always fails with @ref LIBINPUT_CONFIG_STATUS_UNSUPPORTED.
 *
 * @see libinput_device_config_tap_get_button_map
 * @see libinput_device_config_tap_get_default_button_map
 *
 * @since 1.5
 */
enum libinput_config_status
libinput_device_config_tap_set_button_map(struct libinput_device *device,
					    enum libinput_config_tap_button_map map);

/**
 * @ingroup config
 *
 * Get the finger number to button number mapping for tap-to-click.
 *
 * The return value for a device that does not support tapping is always
 * @ref LIBINPUT_CONFIG_TAP_MAP_LRM.
 *
 * @note It is an application bug to call this function for devices where
 * libinput_device_config_tap_get_finger_count() returns 0.
 *
 * @param device The device to configure
 * @return The current finger-to-button number mapping
 *
 * @see libinput_device_config_tap_set_button_map
 * @see libinput_device_config_tap_get_default_button_map
 *
 * @since 1.5
 */
enum libinput_config_tap_button_map
libinput_device_config_tap_get_button_map(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Get the default finger number to button number mapping for tap-to-click.
 *
 * The return value for a device that does not support tapping is always
 * @ref LIBINPUT_CONFIG_TAP_MAP_LRM.
 *
 * @note It is an application bug to call this function for devices where
 * libinput_device_config_tap_get_finger_count() returns 0.
 *
 * @param device The device to configure
 * @return The current finger-to-button number mapping
 *
 * @see libinput_device_config_tap_set_button_map
 * @see libinput_device_config_tap_get_default_button_map
 *
 * @since 1.5
 */
enum libinput_config_tap_button_map
libinput_device_config_tap_get_default_button_map(struct libinput_device *device);

/**
 * @ingroup config
 *
 * A config status to distinguish or set dragging on a device. Currently
 * implemented for tap-and-drag only, see
 * libinput_device_config_tap_set_drag_enabled()
 *
 * @since 1.2
 */
enum libinput_config_drag_state {
	/**
	 * Drag is to be disabled, or is
	 * currently disabled.
	 */
	LIBINPUT_CONFIG_DRAG_DISABLED,
	/**
	 * Drag is to be enabled, or is
	 * currently enabled
	 */
	LIBINPUT_CONFIG_DRAG_ENABLED,
};

/**
 * @ingroup config
 *
 * Enable or disable tap-and-drag on this device. When enabled, a
 * single-finger tap immediately followed by a finger down results in a
 * button down event, subsequent finger motion thus triggers a drag. The
 * button is released on finger up. See the libinput documentation for more
 * details.
 *
 * @param device The device to configure
 * @param enable @ref LIBINPUT_CONFIG_DRAG_ENABLED to enable, @ref
 * LIBINPUT_CONFIG_DRAG_DISABLED to disable tap-and-drag
 *
 * @see libinput_device_config_tap_drag_get_enabled
 * @see libinput_device_config_tap_drag_get_default_enabled
 *
 * @since 1.2
 */
enum libinput_config_status
libinput_device_config_tap_set_drag_enabled(struct libinput_device *device,
					    enum libinput_config_drag_state enable);

/**
 * @ingroup config
 *
 * Return whether tap-and-drag is enabled or disabled on this device.
 *
 * @param device The device to check
 * @retval LIBINPUT_CONFIG_DRAG_ENABLED if tap-and-drag is enabled
 * @retval LIBINPUT_CONFIG_DRAG_DISABLED if tap-and-drag is
 * disabled
 *
 * @see libinput_device_config_tap_drag_set_enabled
 * @see libinput_device_config_tap_drag_get_default_enabled
 *
 * @since 1.2
 */
enum libinput_config_drag_state
libinput_device_config_tap_get_drag_enabled(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Return whether tap-and-drag is enabled or disabled by default on this
 * device.
 *
 * @param device The device to check
 * @retval LIBINPUT_CONFIG_DRAG_ENABLED if tap-and-drag is enabled by
 * default
 * @retval LIBINPUT_CONFIG_DRAG_DISABLED if tap-and-drag is
 * disabled by default
 *
 * @see libinput_device_config_tap_drag_set_enabled
 * @see libinput_device_config_tap_drag_get_enabled
 *
 * @since 1.2
 */
enum libinput_config_drag_state
libinput_device_config_tap_get_default_drag_enabled(struct libinput_device *device);

/**
 * @ingroup config
 */
enum libinput_config_drag_lock_state {
	/** Drag lock is to be disabled, or is currently disabled */
	LIBINPUT_CONFIG_DRAG_LOCK_DISABLED,
	/** Drag lock is to be enabled, or is currently disabled */
	LIBINPUT_CONFIG_DRAG_LOCK_ENABLED,
};

/**
 * @ingroup config
 *
 * Enable or disable drag-lock during tapping on this device. When enabled,
 * a finger may be lifted and put back on the touchpad within a timeout and
 * the drag process continues. When disabled, lifting the finger during a
 * tap-and-drag will immediately stop the drag. See the libinput
 * documentation for more details.
 *
 * Enabling drag lock on a device that has tapping disabled is permitted,
 * but has no effect until tapping is enabled.
 *
 * @param device The device to configure
 * @param enable @ref LIBINPUT_CONFIG_DRAG_LOCK_ENABLED to enable drag lock
 * or @ref LIBINPUT_CONFIG_DRAG_LOCK_DISABLED to disable drag lock
 *
 * @return A config status code. Disabling drag lock on a device that does not
 * support tapping always succeeds.
 *
 * @see libinput_device_config_tap_get_drag_lock_enabled
 * @see libinput_device_config_tap_get_default_drag_lock_enabled
 */
enum libinput_config_status
libinput_device_config_tap_set_drag_lock_enabled(struct libinput_device *device,
						 enum libinput_config_drag_lock_state enable);

/**
 * @ingroup config
 *
 * Check if drag-lock during tapping is enabled on this device. If the
 * device does not support tapping, this function always returns
 * @ref LIBINPUT_CONFIG_DRAG_LOCK_DISABLED.
 *
 * Drag lock may be enabled even when tapping is disabled.
 *
 * @param device The device to configure
 *
 * @retval LIBINPUT_CONFIG_DRAG_LOCK_ENABLED If drag lock is currently enabled
 * @retval LIBINPUT_CONFIG_DRAG_LOCK_DISABLED If drag lock is currently disabled
 *
 * @see libinput_device_config_tap_set_drag_lock_enabled
 * @see libinput_device_config_tap_get_default_drag_lock_enabled
 */
enum libinput_config_drag_lock_state
libinput_device_config_tap_get_drag_lock_enabled(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Check if drag-lock during tapping is enabled by default on this device.
 * If the device does not support tapping, this function always returns
 * @ref LIBINPUT_CONFIG_DRAG_LOCK_DISABLED.
 *
 * Drag lock may be enabled by default even when tapping is disabled by
 * default.
 *
 * @param device The device to configure
 *
 * @retval LIBINPUT_CONFIG_DRAG_LOCK_ENABLED If drag lock is enabled by
 * default
 * @retval LIBINPUT_CONFIG_DRAG_LOCK_DISABLED If drag lock is disabled by
 * default
 *
 * @see libinput_device_config_tap_set_drag_lock_enabled
 * @see libinput_device_config_tap_get_drag_lock_enabled
 */
enum libinput_config_drag_lock_state
libinput_device_config_tap_get_default_drag_lock_enabled(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Check if the device can be calibrated via a calibration matrix.
 *
 * @param device The device to check
 * @return Non-zero if the device can be calibrated, zero otherwise.
 *
 * @see libinput_device_config_calibration_set_matrix
 * @see libinput_device_config_calibration_get_matrix
 * @see libinput_device_config_calibration_get_default_matrix
 */
int
libinput_device_config_calibration_has_matrix(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Apply the 3x3 transformation matrix to absolute device coordinates. This
 * matrix has no effect on relative events.
 *
 * Given a 6-element array [a, b, c, d, e, f], the matrix is applied as
 * @code
 * [ a  b  c ]   [ x ]
 * [ d  e  f ] * [ y ]
 * [ 0  0  1 ]   [ 1 ]
 * @endcode
 *
 * The translation component (c, f) is expected to be normalized to the
 * device coordinate range. For example, the matrix
 * @code
 * [ 1 0  1 ]
 * [ 0 1 -1 ]
 * [ 0 0  1 ]
 * @endcode
 * moves all coordinates by 1 device-width to the right and 1 device-height
 * up.
 *
 * The rotation matrix for rotation around the origin is defined as
 * @code
 * [ cos(a) -sin(a) 0 ]
 * [ sin(a)  cos(a) 0 ]
 * [   0      0     1 ]
 * @endcode
 * Note that any rotation requires an additional translation component to
 * translate the rotated coordinates back into the original device space.
 * The rotation matrixes for 90, 180 and 270 degrees clockwise are:
 * @code
 * 90 deg cw:		180 deg cw:		270 deg cw:
 * [ 0 -1 1]		[ -1  0 1]		[  0 1 0 ]
 * [ 1  0 0]		[  0 -1 1]		[ -1 0 1 ]
 * [ 0  0 1]		[  0  0 1]		[  0 0 1 ]
 * @endcode
 *
 * @param device The device to configure
 * @param matrix An array representing the first two rows of a 3x3 matrix as
 * described above.
 *
 * @return A config status code.
 *
 * @see libinput_device_config_calibration_has_matrix
 * @see libinput_device_config_calibration_get_matrix
 * @see libinput_device_config_calibration_get_default_matrix
 */
enum libinput_config_status
libinput_device_config_calibration_set_matrix(struct libinput_device *device,
					      const float matrix[6]);

/**
 * @ingroup config
 *
 * Return the current calibration matrix for this device.
 *
 * @param device The device to configure
 * @param matrix Set to the array representing the first two rows of a 3x3 matrix as
 * described in libinput_device_config_calibration_set_matrix().
 *
 * @return 0 if no calibration is set and the returned matrix is the
 * identity matrix, 1 otherwise
 *
 * @see libinput_device_config_calibration_has_matrix
 * @see libinput_device_config_calibration_set_matrix
 * @see libinput_device_config_calibration_get_default_matrix
 */
int
libinput_device_config_calibration_get_matrix(struct libinput_device *device,
					      float matrix[6]);

/**
 * @ingroup config
 *
 * Return the default calibration matrix for this device. On most devices,
 * this is the identity matrix. If the udev property
 * <b>LIBINPUT_CALIBRATION_MATRIX</b> is set on the respective udev device,
 * that property's value becomes the default matrix, see the libinput
 * documentation for more details.
 *
 * @param device The device to configure
 * @param matrix Set to the array representing the first two rows of a 3x3 matrix as
 * described in libinput_device_config_calibration_set_matrix().
 *
 * @return 0 if no calibration is set and the returned matrix is the
 * identity matrix, 1 otherwise
 *
 * @see libinput_device_config_calibration_has_matrix
 * @see libinput_device_config_calibration_set_matrix
 * @see libinput_device_config_calibration_get_matrix
 */
int
libinput_device_config_calibration_get_default_matrix(struct libinput_device *device,
						      float matrix[6]);

/**
 * @ingroup config
 *
 * The send-event mode of a device defines when a device may generate events
 * and pass those events to the caller.
 */
enum libinput_config_send_events_mode {
	/**
	 * Send events from this device normally. This is a placeholder
	 * mode only, any device detected by libinput can be enabled. Do not
	 * test for this value as bitmask.
	 */
	LIBINPUT_CONFIG_SEND_EVENTS_ENABLED = 0,
	/**
	 * Do not send events through this device. Depending on the device,
	 * this may close all file descriptors on the device or it may leave
	 * the file descriptors open and route events through a different
	 * device.
	 *
	 * If this bit field is set, other disable modes may be
	 * ignored. For example, if both @ref
	 * LIBINPUT_CONFIG_SEND_EVENTS_DISABLED and @ref
	 * LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE are set,
	 * the device remains disabled when all external pointer devices are
	 * unplugged.
	 */
	LIBINPUT_CONFIG_SEND_EVENTS_DISABLED = (1 << 0),
	/**
	 * If an external pointer device is plugged in, do not send events
	 * from this device. This option may be available on built-in
	 * touchpads.
	 */
	LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE = (1 << 1),
};

/**
 * @ingroup config
 *
 * Return the possible send-event modes for this device. These modes define
 * when a device may process and send events.
 *
 * @param device The device to configure
 *
 * @return A bitmask of possible modes.
 *
 * @see libinput_device_config_send_events_set_mode
 * @see libinput_device_config_send_events_get_mode
 * @see libinput_device_config_send_events_get_default_mode
 */
uint32_t
libinput_device_config_send_events_get_modes(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Set the send-event mode for this device. The mode defines when the device
 * processes and sends events to the caller.
 *
 * The selected mode may not take effect immediately. Events already
 * received and processed from this device are unaffected and will be passed
 * to the caller on the next call to libinput_get_event().
 *
 * If the mode is a bitmask of @ref libinput_config_send_events_mode,
 * the device may wait for or generate events until it is in a neutral
 * state. For example, this may include waiting for or generating button
 * release events.
 *
 * If the device is already suspended, this function does nothing and
 * returns success. Changing the send-event mode on a device that has been
 * removed is permitted.
 *
 * @param device The device to configure
 * @param mode A bitmask of send-events modes
 *
 * @return A config status code.
 *
 * @see libinput_device_config_send_events_get_modes
 * @see libinput_device_config_send_events_get_mode
 * @see libinput_device_config_send_events_get_default_mode
 */
enum libinput_config_status
libinput_device_config_send_events_set_mode(struct libinput_device *device,
					    uint32_t mode);

/**
 * @ingroup config
 *
 * Get the send-event mode for this device. The mode defines when the device
 * processes and sends events to the caller.
 *
 * If a caller enables the bits for multiple modes, some of which are
 * subsets of another mode libinput may drop the bits that are subsets. In
 * other words, don't expect libinput_device_config_send_events_get_mode()
 * to always return exactly the same bitmask as passed into
 * libinput_device_config_send_events_set_mode().
 *
 * @param device The device to configure
 * @return The current bitmask of the send-event mode for this device.
 *
 * @see libinput_device_config_send_events_get_modes
 * @see libinput_device_config_send_events_set_mode
 * @see libinput_device_config_send_events_get_default_mode
 */
uint32_t
libinput_device_config_send_events_get_mode(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Get the default send-event mode for this device. The mode defines when
 * the device processes and sends events to the caller.
 *
 * @param device The device to configure
 * @return The bitmask of the send-event mode for this device.
 *
 * @see libinput_device_config_send_events_get_modes
 * @see libinput_device_config_send_events_set_mode
 * @see libinput_device_config_send_events_get_mode
 */
uint32_t
libinput_device_config_send_events_get_default_mode(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Check if a device uses libinput-internal pointer-acceleration.
 *
 * @param device The device to configure
 *
 * @return 0 if the device is not accelerated, nonzero if it is accelerated
 *
 * @see libinput_device_config_accel_set_speed
 * @see libinput_device_config_accel_get_speed
 * @see libinput_device_config_accel_get_default_speed
 */
int
libinput_device_config_accel_is_available(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Set the pointer acceleration speed of this pointer device within a range
 * of [-1, 1], where 0 is the default acceleration for this device, -1 is
 * the slowest acceleration and 1 is the maximum acceleration available on
 * this device. The actual pointer acceleration mechanism is
 * implementation-dependent, as is the number of steps available within the
 * range. libinput picks the semantically closest acceleration step if the
 * requested value does not match a discrete setting.
 *
 * @param device The device to configure
 * @param speed The normalized speed, in a range of [-1, 1]
 *
 * @return A config status code
 *
 * @see libinput_device_config_accel_is_available
 * @see libinput_device_config_accel_get_speed
 * @see libinput_device_config_accel_get_default_speed
 */
enum libinput_config_status
libinput_device_config_accel_set_speed(struct libinput_device *device,
				       double speed);

/**
 * @ingroup config
 *
 * Get the current pointer acceleration setting for this pointer device. The
 * returned value is normalized to a range of [-1, 1].
 * See libinput_device_config_accel_set_speed() for details.
 *
 * @param device The device to configure
 *
 * @return The current speed, range -1 to 1
 *
 * @see libinput_device_config_accel_is_available
 * @see libinput_device_config_accel_set_speed
 * @see libinput_device_config_accel_get_default_speed
 */
double
libinput_device_config_accel_get_speed(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Return the default speed setting for this device, normalized to a range
 * of [-1, 1].
 * See libinput_device_config_accel_set_speed() for details.
 *
 * @param device The device to configure
 * @return The default speed setting for this device.
 *
 * @see libinput_device_config_accel_is_available
 * @see libinput_device_config_accel_set_speed
 * @see libinput_device_config_accel_get_speed
 */
double
libinput_device_config_accel_get_default_speed(struct libinput_device *device);

/**
 * @ingroup config
 *
 * @since 1.1
 */
enum libinput_config_accel_profile {
	/**
	 * Placeholder for devices that don't have a configurable pointer
	 * acceleration profile.
	 */
	LIBINPUT_CONFIG_ACCEL_PROFILE_NONE = 0,
	/**
	 * A flat acceleration profile. Pointer motion is accelerated by a
	 * constant (device-specific) factor, depending on the current
	 * speed.
	 *
	 * @see libinput_device_config_accel_set_speed
	 */
	LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT = (1 << 0),

	/**
	 * An adaptive acceleration profile. Pointer acceleration depends
	 * on the input speed. This is the default profile for most devices.
	 */
	LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE = (1 << 1),
};

/**
 * @ingroup config
 *
 * Returns a bitmask of the configurable acceleration modes available on
 * this device.
 *
 * @param device The device to configure
 *
 * @return A bitmask of all configurable modes available on this device.
 *
 * @since 1.1
 */
uint32_t
libinput_device_config_accel_get_profiles(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Set the pointer acceleration profile of this pointer device to the given
 * mode.
 *
 * @param device The device to configure
 * @param mode The mode to set the device to.
 *
 * @return A config status code
 *
 * @since 1.1
 */
enum libinput_config_status
libinput_device_config_accel_set_profile(struct libinput_device *device,
					 enum libinput_config_accel_profile mode);

/**
 * @ingroup config
 *
 * Get the current pointer acceleration profile for this pointer device.
 *
 * @param device The device to configure
 *
 * @return The currently configured pointer acceleration profile.
 *
 * @since 1.1
 */
enum libinput_config_accel_profile
libinput_device_config_accel_get_profile(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Return the default pointer acceleration profile for this pointer device.
 *
 * @param device The device to configure
 *
 * @return The default acceleration profile for this device.
 *
 * @since 1.1
 */
enum libinput_config_accel_profile
libinput_device_config_accel_get_default_profile(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Return non-zero if the device supports "natural scrolling".
 *
 * In traditional scroll mode, the movement of fingers on a touchpad when
 * scrolling matches the movement of the scroll bars. When the fingers move
 * down, the scroll bar moves down, a line of text on the screen moves
 * towards the upper end of the screen. This also matches scroll wheels on
 * mice (wheel down, content moves up).
 *
 * Natural scrolling is the term coined by Apple for inverted scrolling.
 * In this mode, the effect of scrolling movement of fingers on a touchpad
 * resemble physical manipulation of paper. When the fingers move down, a
 * line of text on the screen moves down (scrollbars move up). This is the
 * opposite of scroll wheels on mice.
 *
 * A device supporting natural scrolling can be switched between traditional
 * scroll mode and natural scroll mode.
 *
 * @param device The device to configure
 *
 * @return Zero if natural scrolling is not supported, non-zero if natural
 * scrolling is supported by this device
 *
 * @see libinput_device_config_scroll_set_natural_scroll_enabled
 * @see libinput_device_config_scroll_get_natural_scroll_enabled
 * @see libinput_device_config_scroll_get_default_natural_scroll_enabled
 */
int
libinput_device_config_scroll_has_natural_scroll(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Enable or disable natural scrolling on the device.
 *
 * @param device The device to configure
 * @param enable non-zero to enable, zero to disable natural scrolling
 *
 * @return A config status code
 *
 * @see libinput_device_config_scroll_has_natural_scroll
 * @see libinput_device_config_scroll_get_natural_scroll_enabled
 * @see libinput_device_config_scroll_get_default_natural_scroll_enabled
 */
enum libinput_config_status
libinput_device_config_scroll_set_natural_scroll_enabled(struct libinput_device *device,
							 int enable);
/**
 * @ingroup config
 *
 * Get the current mode for scrolling on this device
 *
 * @param device The device to configure
 *
 * @return Zero if natural scrolling is disabled, non-zero if enabled
 *
 * @see libinput_device_config_scroll_has_natural_scroll
 * @see libinput_device_config_scroll_set_natural_scroll_enabled
 * @see libinput_device_config_scroll_get_default_natural_scroll_enabled
 */
int
libinput_device_config_scroll_get_natural_scroll_enabled(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Get the default mode for scrolling on this device
 *
 * @param device The device to configure
 *
 * @return Zero if natural scrolling is disabled by default, non-zero if enabled
 *
 * @see libinput_device_config_scroll_has_natural_scroll
 * @see libinput_device_config_scroll_set_natural_scroll_enabled
 * @see libinput_device_config_scroll_get_natural_scroll_enabled
 */
int
libinput_device_config_scroll_get_default_natural_scroll_enabled(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Check if a device has a configuration that supports left-handed usage.
 *
 * @param device The device to configure
 * @return Non-zero if the device can be set to left-handed, or zero
 * otherwise
 *
 * @see libinput_device_config_left_handed_set
 * @see libinput_device_config_left_handed_get
 * @see libinput_device_config_left_handed_get_default
 */
int
libinput_device_config_left_handed_is_available(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Set the left-handed configuration of the device.
 *
 * The exact behavior is device-dependent. On a mouse and most pointing
 * devices, left and right buttons are swapped but the middle button is
 * unmodified. On a touchpad, physical buttons (if present) are swapped. On a
 * clickpad, the top and bottom software-emulated buttons are swapped where
 * present, the main area of the touchpad remains a left button. Tapping and
 * clickfinger behavior is not affected by this setting.
 *
 * Changing the left-handed configuration of a device may not take effect
 * until all buttons have been logically released.
 *
 * @param device The device to configure
 * @param left_handed Zero to disable, non-zero to enable left-handed mode
 * @return A configuration status code
 *
 * @see libinput_device_config_left_handed_is_available
 * @see libinput_device_config_left_handed_get
 * @see libinput_device_config_left_handed_get_default
 */
enum libinput_config_status
libinput_device_config_left_handed_set(struct libinput_device *device,
				       int left_handed);

/**
 * @ingroup config
 *
 * Get the current left-handed configuration of the device.
 *
 * @param device The device to configure
 * @return Zero if the device is in right-handed mode, non-zero if the
 * device is in left-handed mode
 *
 * @see libinput_device_config_left_handed_is_available
 * @see libinput_device_config_left_handed_set
 * @see libinput_device_config_left_handed_get_default
 */
int
libinput_device_config_left_handed_get(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Get the default left-handed configuration of the device.
 *
 * @param device The device to configure
 * @return Zero if the device is in right-handed mode by default, or non-zero
 * if the device is in left-handed mode by default
 *
 * @see libinput_device_config_left_handed_is_available
 * @see libinput_device_config_left_handed_set
 * @see libinput_device_config_left_handed_get
 */
int
libinput_device_config_left_handed_get_default(struct libinput_device *device);

/**
 * @ingroup config
 *
 * The click method defines when to generate software-emulated
 * buttons, usually on a device that does not have a specific physical
 * button available.
 */
enum libinput_config_click_method {
	/**
	 * Do not send software-emulated button events. This has no effect
	 * on events generated by physical buttons.
	 */
	LIBINPUT_CONFIG_CLICK_METHOD_NONE = 0,
	/**
	 * Use software-button areas to generate button events.
	 */
	LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS = (1 << 0),
	/**
	 * The number of fingers decides which button press to generate.
	 */
	LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER = (1 << 1),
};

/**
 * @ingroup config
 *
 * Check which button click methods a device supports. The button click
 * method defines when to generate software-emulated buttons, usually on a
 * device that does not have a specific physical button available.
 *
 * @param device The device to configure
 *
 * @return A bitmask of possible methods.
 *
 * @see libinput_device_config_click_get_methods
 * @see libinput_device_config_click_set_method
 * @see libinput_device_config_click_get_method
 */
uint32_t
libinput_device_config_click_get_methods(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Set the button click method for this device. The button click
 * method defines when to generate software-emulated buttons, usually on a
 * device that does not have a specific physical button available.
 *
 * @note The selected click method may not take effect immediately. The
 * device may require changing to a neutral state first before activating
 * the new method.
 *
 * @param device The device to configure
 * @param method The button click method
 *
 * @return A config status code
 *
 * @see libinput_device_config_click_get_methods
 * @see libinput_device_config_click_get_method
 * @see libinput_device_config_click_get_default_method
 */
enum libinput_config_status
libinput_device_config_click_set_method(struct libinput_device *device,
					enum libinput_config_click_method method);
/**
 * @ingroup config
 *
 * Get the button click method for this device. The button click
 * method defines when to generate software-emulated buttons, usually on a
 * device that does not have a specific physical button available.
 *
 * @param device The device to configure
 *
 * @return The current button click method for this device
 *
 * @see libinput_device_config_click_get_methods
 * @see libinput_device_config_click_set_method
 * @see libinput_device_config_click_get_default_method
 */
enum libinput_config_click_method
libinput_device_config_click_get_method(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Get the default button click method for this device. The button click
 * method defines when to generate software-emulated buttons, usually on a
 * device that does not have a specific physical button available.
 *
 * @param device The device to configure
 *
 * @return The default button click method for this device
 *
 * @see libinput_device_config_click_get_methods
 * @see libinput_device_config_click_set_method
 * @see libinput_device_config_click_get_method
 */
enum libinput_config_click_method
libinput_device_config_click_get_default_method(struct libinput_device *device);

/**
 * @ingroup config
 */
enum libinput_config_middle_emulation_state {
	/**
	 * Middle mouse button emulation is to be disabled, or
	 * is currently disabled.
	 */
	LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED,
	/**
	 * Middle mouse button emulation is to be enabled, or
	 * is currently enabled.
	 */
	LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED,
};

/**
 * @ingroup config
 *
 * Check if middle mouse button emulation configuration is available on this
 * device. See libinput_device_config_middle_emulation_set_enabled() for
 * more details.
 *
 * @note Some devices provide middle mouse button emulation but do not allow
 * enabling/disabling that emulation. These devices return zero in
 * libinput_device_config_middle_emulation_is_available().
 *
 * @param device The device to query
 *
 * @return Non-zero if middle mouse button emulation is available and can be
 * configured, zero otherwise.
 *
 * @see libinput_device_config_middle_emulation_set_enabled
 * @see libinput_device_config_middle_emulation_get_enabled
 * @see libinput_device_config_middle_emulation_get_default_enabled
 */
int
libinput_device_config_middle_emulation_is_available(
		struct libinput_device *device);

/**
 * @ingroup config
 *
 * Enable or disable middle button emulation on this device. When enabled, a
 * simultaneous press of the left and right button generates a middle mouse
 * button event. Releasing the buttons generates a middle mouse button
 * release, the left and right button events are discarded otherwise.
 *
 * See the libinput documentation for more details.
 *
 * @param device The device to configure
 * @param enable @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED to
 * disable, @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED To enable
 * middle button emulation.
 *
 * @return A config status code. Disabling middle button emulation on a
 * device that does not support middle button emulation always succeeds.
 *
 * @see libinput_device_config_middle_emulation_is_available
 * @see libinput_device_config_middle_emulation_get_enabled
 * @see libinput_device_config_middle_emulation_get_default_enabled
 */
enum libinput_config_status
libinput_device_config_middle_emulation_set_enabled(
		struct libinput_device *device,
		enum libinput_config_middle_emulation_state enable);

/**
 * @ingroup config
 *
 * Check if configurable middle button emulation is enabled on this device.
 * See libinput_device_config_middle_emulation_set_enabled() for more
 * details.
 *
 * If the device does not have configurable middle button emulation, this
 * function returns @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED.
 *
 * @note Some devices provide middle mouse button emulation but do not allow
 * enabling/disabling that emulation. These devices always return @ref
 * LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED.
 *
 * @param device The device to configure
 * @return @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED if disabled
 * or not available/configurable, @ref
 * LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED If enabled.
 *
 * @see libinput_device_config_middle_emulation_is_available
 * @see libinput_device_config_middle_emulation_set_enabled
 * @see libinput_device_config_middle_emulation_get_default_enabled
 */
enum libinput_config_middle_emulation_state
libinput_device_config_middle_emulation_get_enabled(
		struct libinput_device *device);

/**
 * @ingroup config
 *
 * Check if configurable middle button emulation is enabled by default on
 * this device. See libinput_device_config_middle_emulation_set_enabled()
 * for more details.
 *
 * If the device does not have configurable middle button
 * emulation, this function returns @ref
 * LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED.
 *
 * @note Some devices provide middle mouse button emulation but do not allow
 * enabling/disabling that emulation. These devices always return @ref
 * LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED.
 *
 * @param device The device to configure
 * @return @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED If disabled
 * or not available, @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED if
 * enabled.
 *
 * @see libinput_device_config_middle_emulation_is_available
 * @see libinput_device_config_middle_emulation_set_enabled
 * @see libinput_device_config_middle_emulation_get_enabled
 */
enum libinput_config_middle_emulation_state
libinput_device_config_middle_emulation_get_default_enabled(
		struct libinput_device *device);

/**
 * @ingroup config
 *
 * The scroll method of a device selects when to generate scroll axis events
 * instead of pointer motion events.
 */
enum libinput_config_scroll_method {
	/**
	 * Never send scroll events instead of pointer motion events.
	 * This has no effect on events generated by scroll wheels.
	 */
	LIBINPUT_CONFIG_SCROLL_NO_SCROLL = 0,
	/**
	 * Send scroll events when two fingers are logically down on the
	 * device.
	 */
	LIBINPUT_CONFIG_SCROLL_2FG = (1 << 0),
	/**
	 * Send scroll events when a finger moves along the bottom or
	 * right edge of a device.
	 */
	LIBINPUT_CONFIG_SCROLL_EDGE = (1 << 1),
	/**
	 * Send scroll events when a button is down and the device moves
	 * along a scroll-capable axis.
	 */
	LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN = (1 << 2),
};

/**
 * @ingroup config
 *
 * Check which scroll methods a device supports. The method defines when to
 * generate scroll axis events instead of pointer motion events.
 *
 * @param device The device to configure
 *
 * @return A bitmask of possible methods.
 *
 * @see libinput_device_config_scroll_set_method
 * @see libinput_device_config_scroll_get_method
 * @see libinput_device_config_scroll_get_default_method
 * @see libinput_device_config_scroll_set_button
 * @see libinput_device_config_scroll_get_button
 * @see libinput_device_config_scroll_get_default_button
 */
uint32_t
libinput_device_config_scroll_get_methods(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Set the scroll method for this device. The method defines when to
 * generate scroll axis events instead of pointer motion events.
 *
 * @note Setting @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN enables
 * the scroll method, but scrolling is only activated when the configured
 * button is held down. If no button is set, i.e.
 * libinput_device_config_scroll_get_button() returns 0, scrolling
 * cannot activate.
 *
 * @param device The device to configure
 * @param method The scroll method for this device.
 *
 * @return A config status code.
 *
 * @see libinput_device_config_scroll_get_methods
 * @see libinput_device_config_scroll_get_method
 * @see libinput_device_config_scroll_get_default_method
 * @see libinput_device_config_scroll_set_button
 * @see libinput_device_config_scroll_get_button
 * @see libinput_device_config_scroll_get_default_button
 */
enum libinput_config_status
libinput_device_config_scroll_set_method(struct libinput_device *device,
					 enum libinput_config_scroll_method method);

/**
 * @ingroup config
 *
 * Get the scroll method for this device. The method defines when to
 * generate scroll axis events instead of pointer motion events.
 *
 * @param device The device to configure
 * @return The current scroll method for this device.
 *
 * @see libinput_device_config_scroll_get_methods
 * @see libinput_device_config_scroll_set_method
 * @see libinput_device_config_scroll_get_default_method
 * @see libinput_device_config_scroll_set_button
 * @see libinput_device_config_scroll_get_button
 * @see libinput_device_config_scroll_get_default_button
 */
enum libinput_config_scroll_method
libinput_device_config_scroll_get_method(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Get the default scroll method for this device. The method defines when to
 * generate scroll axis events instead of pointer motion events.
 *
 * @param device The device to configure
 * @return The default scroll method for this device.
 *
 * @see libinput_device_config_scroll_get_methods
 * @see libinput_device_config_scroll_set_method
 * @see libinput_device_config_scroll_get_method
 * @see libinput_device_config_scroll_set_button
 * @see libinput_device_config_scroll_get_button
 * @see libinput_device_config_scroll_get_default_button
 */
enum libinput_config_scroll_method
libinput_device_config_scroll_get_default_method(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Set the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method
 * for this device.
 *
 * When the current scroll method is set to @ref
 * LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN, no button press/release events
 * will be send for the configured button.
 *
 * When the configured button is pressed, any motion events along a
 * scroll-capable axis are turned into scroll axis events.
 *
 * @note Setting the button does not change the scroll method. To change the
 * scroll method call libinput_device_config_scroll_set_method().
 *
 * If the button is 0, button scrolling is effectively disabled.
 *
 * @param device The device to configure
 * @param button The button which when pressed switches to sending scroll events
 *
 * @return A config status code
 * @retval LIBINPUT_CONFIG_STATUS_SUCCESS On success
 * @retval LIBINPUT_CONFIG_STATUS_UNSUPPORTED If @ref
 * LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN is not supported
 * @retval LIBINPUT_CONFIG_STATUS_INVALID The given button does not
 * exist on this device
 *
 * @see libinput_device_config_scroll_get_methods
 * @see libinput_device_config_scroll_set_method
 * @see libinput_device_config_scroll_get_method
 * @see libinput_device_config_scroll_get_default_method
 * @see libinput_device_config_scroll_get_button
 * @see libinput_device_config_scroll_get_default_button
 */
enum libinput_config_status
libinput_device_config_scroll_set_button(struct libinput_device *device,
					 uint32_t button);

/**
 * @ingroup config
 *
 * Get the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method
 * for this device.
 *
 * If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not
 * supported, or no button is set, this function returns 0.
 *
 * @note The return value is independent of the currently selected
 * scroll-method. For button scrolling to activate, a device must have the
 * @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method enabled, and a non-zero
 * button set as scroll button.
 *
 * @param device The device to configure
 * @return The button which when pressed switches to sending scroll events
 *
 * @see libinput_device_config_scroll_get_methods
 * @see libinput_device_config_scroll_set_method
 * @see libinput_device_config_scroll_get_method
 * @see libinput_device_config_scroll_get_default_method
 * @see libinput_device_config_scroll_set_button
 * @see libinput_device_config_scroll_get_default_button
 */
uint32_t
libinput_device_config_scroll_get_button(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Get the default button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN
 * method for this device.
 *
 * If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not supported,
 * or no default button is set, this function returns 0.
 *
 * @param device The device to configure
 * @return The default button for the @ref
 * LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method
 *
 * @see libinput_device_config_scroll_get_methods
 * @see libinput_device_config_scroll_set_method
 * @see libinput_device_config_scroll_get_method
 * @see libinput_device_config_scroll_get_default_method
 * @see libinput_device_config_scroll_set_button
 * @see libinput_device_config_scroll_get_button
 */
uint32_t
libinput_device_config_scroll_get_default_button(struct libinput_device *device);

enum libinput_config_scroll_button_lock_state {
	LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED,
	LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED,
};

/**
 * @ingroup config
 *
 * Set the scroll button lock. If the state is
 * @ref LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED, the button must
 * physically be held down for button scrolling to work.
 * If the state is
 * @ref LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED, the button is considered
 * logically down after the first press and release sequence, and logically
 * up after the second press and release sequence.
 *
 * @param device The device to configure
 * @param state The state to set the scroll button lock to
 *
 * @return A config status code. Disabling the scroll button lock on
 * device that does not support button scrolling always succeeds.
 *
 * @see libinput_device_config_scroll_set_button
 * @see libinput_device_config_scroll_get_button
 * @see libinput_device_config_scroll_get_default_button
 */
enum libinput_config_status
libinput_device_config_scroll_set_button_lock(struct libinput_device *device,
					      enum libinput_config_scroll_button_lock_state state);

/**
 * @ingroup config
 *
 * Get the current scroll button lock state.
 *
 * If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not
 * supported, or no button is set, this function returns @ref
 * LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED.
 *
 * @note The return value is independent of the currently selected
 * scroll-method. For the scroll button lock to activate, a device must have
 * the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method enabled, and a
 * non-zero button set as scroll button.
 *
 * @param device The device to configure
 * @return The scroll button lock state
 *
 * @see libinput_device_config_scroll_set_button
 * @see libinput_device_config_scroll_set_button_lock
 * @see libinput_device_config_scroll_get_button_lock
 * @see libinput_device_config_scroll_get_default_button_lock
 */
enum libinput_config_scroll_button_lock_state
libinput_device_config_scroll_get_button_lock(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Get the default scroll button lock state.
 *
 * If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not
 * supported, or no button is set, this function returns @ref
 * LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED.
 *
 * @param device The device to configure
 * @return The default scroll button lock state
 *
 * @see libinput_device_config_scroll_set_button
 * @see libinput_device_config_scroll_set_button_lock
 * @see libinput_device_config_scroll_get_button_lock
 * @see libinput_device_config_scroll_get_default_button_lock
 */
enum libinput_config_scroll_button_lock_state
libinput_device_config_scroll_get_default_button_lock(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Possible states for the disable-while-typing feature.
 */
enum libinput_config_dwt_state {
	LIBINPUT_CONFIG_DWT_DISABLED,
	LIBINPUT_CONFIG_DWT_ENABLED,
};

/**
 * @ingroup config
 *
 * Check if this device supports configurable disable-while-typing feature.
 * This feature is usually available on built-in touchpads and disables the
 * touchpad while typing. See the libinput documentation for details.
 *
 * @param device The device to configure
 * @return 0 if this device does not support disable-while-typing, or 1
 * otherwise.
 *
 * @see libinput_device_config_dwt_set_enabled
 * @see libinput_device_config_dwt_get_enabled
 * @see libinput_device_config_dwt_get_default_enabled
 */
int
libinput_device_config_dwt_is_available(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Enable or disable the disable-while-typing feature. When enabled, the
 * device will be disabled while typing and for a short period after. See
 * the libinput documentation for details.
 *
 * @note Enabling or disabling disable-while-typing may not take effect
 * immediately.
 *
 * @param device The device to configure
 * @param enable @ref LIBINPUT_CONFIG_DWT_DISABLED to disable
 * disable-while-typing, @ref LIBINPUT_CONFIG_DWT_ENABLED to enable
 *
 * @return A config status code. Disabling disable-while-typing on a
 * device that does not support the feature always succeeds.
 *
 * @see libinput_device_config_dwt_is_available
 * @see libinput_device_config_dwt_get_enabled
 * @see libinput_device_config_dwt_get_default_enabled
 */
enum libinput_config_status
libinput_device_config_dwt_set_enabled(struct libinput_device *device,
				       enum libinput_config_dwt_state enable);

/**
 * @ingroup config
 *
 * Check if the disable-while typing feature is currently enabled on this
 * device. If the device does not support disable-while-typing, this
 * function returns @ref LIBINPUT_CONFIG_DWT_DISABLED.
 *
 * @param device The device to configure
 * @return @ref LIBINPUT_CONFIG_DWT_DISABLED if disabled, @ref
 * LIBINPUT_CONFIG_DWT_ENABLED if enabled.
 *
 * @see libinput_device_config_dwt_is_available
 * @see libinput_device_config_dwt_set_enabled
 * @see libinput_device_config_dwt_get_default_enabled
 */
enum libinput_config_dwt_state
libinput_device_config_dwt_get_enabled(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Check if the disable-while typing feature is enabled on this device by
 * default. If the device does not support disable-while-typing, this
 * function returns @ref LIBINPUT_CONFIG_DWT_DISABLED.
 *
 * @param device The device to configure
 * @return @ref LIBINPUT_CONFIG_DWT_DISABLED if disabled, @ref
 * LIBINPUT_CONFIG_DWT_ENABLED if enabled.
 *
 * @see libinput_device_config_dwt_is_available
 * @see libinput_device_config_dwt_set_enabled
 * @see libinput_device_config_dwt_get_enabled
 */
enum libinput_config_dwt_state
libinput_device_config_dwt_get_default_enabled(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Check whether a device can have a custom rotation applied.
 *
 * @param device The device to configure
 * @return Non-zero if a device can be rotated, zero otherwise.
 *
 * @see libinput_device_config_rotation_set_angle
 * @see libinput_device_config_rotation_get_angle
 * @see libinput_device_config_rotation_get_default_angle
 *
 * @since 1.4
 */
int
libinput_device_config_rotation_is_available(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Set the rotation of a device in degrees clockwise off the logical neutral
 * position. Any subsequent motion events are adjusted according to the
 * given angle.
 *
 * The angle has to be in the range of [0, 360[ degrees, otherwise this
 * function returns LIBINPUT_CONFIG_STATUS_INVALID. If the angle is a
 * multiple of 360 or negative, the caller must ensure the correct ranging
 * before calling this function.
 *
 * libinput guarantees that this function accepts multiples of 90 degrees.
 * If a value is within the [0, 360[ range but not a multiple of 90 degrees,
 * this function may return LIBINPUT_CONFIG_STATUS_INVALID if the underlying
 * device or implementation does not support finer-grained rotation angles.
 *
 * The rotation angle is applied to all motion events emitted by the device.
 * Thus, rotating the device also changes the angle required or presented by
 * scrolling, gestures, etc.
 *
 * @param device The device to configure
 * @param degrees_cw The angle in degrees clockwise
 * @return A config status code. Setting a rotation of 0 degrees on a
 * device that does not support rotation always succeeds.
 *
 * @see libinput_device_config_rotation_is_available
 * @see libinput_device_config_rotation_get_angle
 * @see libinput_device_config_rotation_get_default_angle
 *
 * @since 1.4
 */
enum libinput_config_status
libinput_device_config_rotation_set_angle(struct libinput_device *device,
					  unsigned int degrees_cw);

/**
 * @ingroup config
 *
 * Get the current rotation of a device in degrees clockwise off the logical
 * neutral position. If this device does not support rotation, the return
 * value is always 0.
 *
 * @param device The device to configure
 * @return The angle in degrees clockwise
 *
 * @see libinput_device_config_rotation_is_available
 * @see libinput_device_config_rotation_set_angle
 * @see libinput_device_config_rotation_get_default_angle
 *
 * @since 1.4
 */
unsigned int
libinput_device_config_rotation_get_angle(struct libinput_device *device);

/**
 * @ingroup config
 *
 * Get the default rotation of a device in degrees clockwise off the logical
 * neutral position. If this device does not support rotation, the return
 * value is always 0.
 *
 * @param device The device to configure
 * @return The default angle in degrees clockwise
 *
 * @see libinput_device_config_rotation_is_available
 * @see libinput_device_config_rotation_set_angle
 * @see libinput_device_config_rotation_get_angle
 *
 * @since 1.4
 */
unsigned int
libinput_device_config_rotation_get_default_angle(struct libinput_device *device);

#ifdef __cplusplus
}
#endif
#endif /* LIBINPUT_H */