This repository has been archived by the owner on Mar 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
libinput.vapi
2219 lines (2191 loc) · 99.6 KB
/
libinput.vapi
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
/* libinput Vala Bindings
* Copyright (c) 2019 Hannes Schulze <[email protected]>
*
* 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.
*/
[CCode (cheader_filename = "libinput.h")]
namespace Libinput {
/**
* Event type for events returned by {@link Context.get_event}.
*/
[CCode (cname = "enum libinput_event_type", cprefix = "LIBINPUT_EVENT_", has_type_id = false)]
public enum EventType {
NONE,
DEVICE_ADDED,
DEVICE_REMOVED,
KEYBOARD_KEY,
POINTER_MOTION,
POINTER_MOTION_ABSOLUTE,
POINTER_BUTTON,
POINTER_AXIS,
TOUCH_DOWN,
TOUCH_UP,
TOUCH_MOTION,
TOUCH_CANCEL,
TOUCH_FRAME,
TABLET_TOOL_AXIS,
TABLET_TOOL_PROXIMITY,
TABLET_TOOL_TIP,
TABLET_TOOL_BUTTON,
TABLET_PAD_BUTTON,
TABLET_PAD_RING,
TABLET_PAD_STRIP,
GESTURE_SWIPE_BEGIN,
GESTURE_SWIPE_UPDATE,
GESTURE_SWIPE_END,
GESTURE_PINCH_BEGIN,
GESTURE_PINCH_UPDATE,
GESTURE_PINCH_END,
SWITCH_TOGGLE
}
[CCode (cname = "enum libinput_led", cprefix = "LIBINPUT_LED_", has_type_id = "false")]
public enum LED {
NUM_LOCK,
CAPS_LOCK,
SCROLL_LOCK
}
[CCode (cname = "enum libinput_device_capability", cprefix = "LIBINPUT_DEVICE_CAP_", has_type_id = "false")]
public enum DeviceCapability {
KEYBOARD,
POINTER,
TOUCH,
TABLET_TOOL,
TABLET_PAD,
GESTURE,
SWITCH
}
[CCode (cname = "enum libinput_switch", cprefix = "LIBINPUT_SWITCH_", has_type_id = "false")]
public enum Switch {
LID,
TABLET_MODE
}
[CCode (cname = "enum libinput_key_state", cprefix = "LIBINPUT_KEY_STATE_", has_type_id = "false")]
public enum KeyState {
RELEASED,
PRESSED
}
[CCode (cname = "enum libinput_button_state", cprefix = "LIBINPUT_BUTTON_STATE_", has_type_id = "false")]
public enum ButtonState {
RELEASED,
PRESSED
}
[CCode (cname = "enum libinput_pointer_axis", cprefix = "LIBINPUT_POINTER_AXIS_", has_type_id = "false")]
public enum PointerAxis {
SCROLL_VERTICAL,
SCROLL_HORIZONTAL
}
[CCode (cname = "enum libinput_pointer_axis_source", cprefix = "LIBINPUT_POINTER_AXIS_SOURCE_", has_type_id = "false")]
public enum PointerAxisSource {
WHEEL,
FINGER,
CONTINUOUS,
WHEEL_TILT
}
[CCode (cname = "enum libinput_switch_state", cprefix = "LIBINPUT_SWITCH_STATE_", has_type_id = "false")]
public enum SwitchState {
OFF,
ON
}
[CCode (cname = "enum libinput_tablet_pad_ring_axis_source", cprefix = "LIBINPUT_TABLET_PAD_RING_SOURCE_", has_type_id = "false")]
public enum TabletPadRingAxisSource {
UNKNOWN,
FINGER
}
[CCode (cname = "enum libinput_tablet_pad_strip_axis_source", cprefix = "LIBINPUT_TABLET_PAD_STRIP_SOURCE_", has_type_id = "false")]
public enum TabletPadStripAxisSource {
UNKNOWN,
FINGER
}
[CCode (cname = "enum libinput_tablet_tool_proximity_state", cprefix = "LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_", has_type_id = "false")]
public enum TabletToolProximityState {
OUT,
IN
}
[CCode (cname = "enum libinput_tablet_tool_tip_state", cprefix = "LIBINPUT_TABLET_TOOL_TIP_", has_type_id = "false")]
public enum TabletToolTipState {
UP,
DOWN
}
[CCode (cname = "enum libinput_log_priority", cprefix = "LIBINPUT_LOG_PRIORITY_", has_type_id = "false")]
public enum LogPriority {
DEBUG,
INFO,
ERROR
}
[CCode (cname = "enum libinput_config_status", cprefix = "LIBINPUT_CONFIG_STATUS_", has_type_id = "false")]
public enum ConfigStatus {
SUCCESS,
UNSUPPORTED,
INVALID
}
[CCode (cname = "enum libinput_config_tap_state", cprefix = "LIBINPUT_CONFIG_TAP_", has_type_id = "false")]
public enum ConfigTapState {
DISABLED,
ENABLED
}
[CCode (cname = "enum libinput_config_tap_button_map", cprefix = "LIBINPUT_CONFIG_TAP_MAP_", has_type_id = "false")]
public enum ConfigTapButtonMap {
LRM,
LMR
}
[CCode (cname = "enum libinput_config_drag_state", cprefix = "LIBINPUT_CONFIG_DRAG_", has_type_id = "false")]
public enum ConfigDragState {
DISABLED,
ENABLED
}
[CCode (cname = "enum libinput_config_drag_lock_state", cprefix = "LIBINPUT_CONFIG_DRAG_LOCK_", has_type_id = "false")]
public enum ConfigDragLockState {
DISABLED,
ENABLED
}
[CCode (cname = "enum libinput_config_accel_profile", cprefix = "LIBINPUT_CONFIG_ACCEL_PROFILE_", has_type_id = "false")]
public enum ConfigAccelProfile {
NONE,
FLAT,
ADAPTIVE
}
[CCode (cname = "enum libinput_config_click_method", cprefix = "LIBINPUT_CONFIG_CLICK_METHOD_", has_type_id = "false")]
public enum ConfigClickMethod {
NONE,
BUTTON_AREAS,
CLICKFINGER
}
[CCode (cname = "enum libinput_config_middle_emulation_state", cprefix = "LIBINPUT_CONFIG_MIDDLE_EMULATION_", has_type_id = "false")]
public enum ConfigMiddleEmulationState {
DISABLED,
ENABLED
}
[CCode (cname = "enum libinput_config_scroll_method", cprefix = "LIBINPUT_CONFIG_SCROLL_", has_type_id = "false")]
public enum ConfigScrollMethod {
NO_SCROLL,
2FG,
EDGE,
ON_BUTTON_DOWN
}
[CCode (cname = "enum libinput_config_dwt_state", cprefix = "LIBINPUT_CONFIG_DWT_", has_type_id = "false")]
public enum ConfigDwtState {
DISABLED,
ENABLED
}
[CCode (cname = "enum libinput_tablet_tool_type", cprefix = "LIBINPUT_TABLET_TOOL_TYPE_", has_type_id = "false")]
public enum TabletToolType {
PEN,
ERASER,
BRUSH,
PENCIL,
AIRBRUSH,
MOUSE,
LENS
}
/**
* 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 Context.log_set_priority
* @see Context.log_get_priority
* @see Context.log_set_handler
*/
[CCode (cname = "libinput_log_handler", has_target = false)]
public delegate void LogHandler (Context libinput, LogPriority priority, string format, va_list args);
/**
* A handle for accessing libinput.
*/
[CCode (cname = "struct libinput", cprefix="libinput_", ref_function = "libinput_ref", unref_function = "libinput_unref")]
[Compact]
public class Context {
[CCode (simple_generics = true)]
public void set_user_data<T> (T user_data);
[CCode (simple_generics = true)]
public T get_user_data<T> ();
/**
* Create a new libinput context from udev. This context is inactive until
* assigned a seat ID with {@link udev_assign_seat}.
*
* @param iface The callback interface
* @param udev An already initialized udev context
*
* @return An initialized, but inactive libinput context or NULL on error
*/
[CCode (simple_generics = true)]
public static Context? udev_create_context<T> (Interface iface, T user_data, Udev.Udev udev);
/**
* Assign a seat to this libinput context. New devices or the removal of
* existing devices will appear as events during {@link dispatch}.
*
* {@link 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
* {@link 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 {@link resume}.
*
* This function may only be called once per context.
*
* @param seat_id A seat identifier. This string must not be NULL.
*
* @return 0 on success or -1 on failure.
*/
public int udev_assign_seat (string seat_id);
/**
* Create a new libinput context that requires the caller to manually add or
* remove devices with {@link path_add_device} and
* {@link path_remove_device}.
*
* The context is fully initialized but will not generate events until at
* least one device has been added.
*
* @param iface The callback interface
*
* @return An initialized, empty libinput context.
*/
[CCode (simple_generics = true)]
public static Context path_create_context<T> (Interface iface, T user_data);
/**
* Add a device to a libinput context initialized with
* {@link path_create_context}. If successful, the device will be
* added to the internal list and re-opened on {@link resume}. The device
* can be removed with {@link path_remove_device}.
*
* ''NOTE:'' It is an application bug to call this function on a libinput
* context initialized with {@link udev_create_context}.
*
* @param path Path to an input device
* @return The newly initiated device on success, or NULL on failure.
*/
public Device? path_add_device (string path);
/**
* Remove a device from a libinput context initialized with
* {@link path_create_context} or added to such a context with
* {@link path_add_device}.
*
* Events already processed from this input device are kept in the queue,
* the {@link EventType.DEVICE_REMOVED} event marks the end of events for
* this device.
*
* If no matching device exists, this function does nothing.
*
* ''NOTE:'' It is an application bug to call this function on a libinput
* context initialized with {@link udev_create_context}.
*
* @param device A libinput device
*/
[CCode (cname = "libinput_path_remove_device")]
public static void path_remove_device (Device device);
/**
* libinput keeps a single file descriptor for all events.
*
* Call into {@link dispatch} if any events become available on this fd.
*
* @return The file descriptor used to notify of pending events.
*/
public int get_fd ();
/**
* Main event dispatchment function. Reads events of the file descriptors
* and processes them internally. Use {@link 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 {@link get_fd}. libinput has a number of
* timing-sensitive features (e.g. tap-to-click), any delay in calling
* {@link dispatch} may prevent these features from working correctly.
*
* @return 0 on success, or a negative errno on failure
*/
public int dispatch ();
/**
* Retrieve the next event from libinput's internal event queue.
*
* @return The next available event, or null if no event is available.
*/
public Event? get_event ();
/**
* 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
* {@link get_event} returns that event.
*
* @return The event type of the next available event or {@link
* EventType.NONE} if no event is available.
*/
public EventType next_event_type ();
/**
* Resume a suspended libinput context. This re-enables device
* monitoring and adds existing devices.
*
* @see suspend
*
* @return 0 on success or -1 on failure
*/
public int resume ();
/**
* Suspend monitoring for new devices and close existing devices.
* This all but terminates libinput but does keep the context
* valid to be resumed with {@link resume}.
*/
public void suspend ();
/**
* 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 {@link LogPriority.ERROR}.
*
* @param priority The minimum priority of log messages to print.
*
* @see log_set_handler
* @see log_get_priority
*/
public void log_set_priority (LogPriority priority);
/**
* 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 {@link LogPriority.ERROR}.
*
* @return The minimum priority of log messages to print.
*
* @see log_set_handler
* @see log_set_priority
*/
public LogPriority log_get_priority ();
/**
* 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 log_handler The log handler for library messages.
*
* @see log_set_priority
* @see log_get_priority
*/
public void log_set_handler (LogHandler log_handler);
}
/**
* A base handle for accessing libinput devices.
*/
[CCode (cname = "struct libinput_device", ref_function = "libinput_device_ref", unref_function = "libinput_device_unref")]
[Compact]
public class Device {
[CCode (simple_generics = true)]
public void set_user_data<T> (T user_data);
[CCode (simple_generics = true)]
public T get_user_data<T> ();
/**
* Get the libinput context from the device.
*
* @return The Context for this device.
*/
public unowned Context get_context ();
/**
* 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 {@link Device}.
*
* libinput assigns these devices to the same {@link DeviceGroup}
* 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 {@link
* EventType.DEVICE_ADDED} and removed from that group on {@link
* EventType.DEVICE_REMOVED}. It is up to the caller to track how many
* devices are in each device group.
*
* 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.
*
* @return The device group this device belongs to
*/
public DeviceGroup get_device_group ();
/**
* Get the system name of the device.
*
* To get the descriptive device name, use {@link get_name}.
*
* @return System name of the device
*/
public unowned string get_sysname ();
/**
* The descriptive device name as advertised by the kernel and/or the
* hardware itself. To get the sysname for this device, use
* {@link get_sysname}.
*
* The lifetime of the returned string is tied to the Device.
* The string may be the empty string but is never NULL.
*
* @return The device name
*/
public unowned string? get_name ();
/**
* Get the product ID for this device.
*
* @return The product ID of this device
*/
public uint get_id_product ();
/**
* Get the vendor ID for this device.
*
* @return The vendor ID of this device
*/
public uint get_id_vendor ();
/**
* 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: Use of this function is discouraged.'' 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 {@link 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
*/
public unowned string? get_output_name ();
/**
* Get the seat associated with this input device, see seats for
* details.
*
* 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.
*
* @return The seat this input device belongs to
*/
public Seat get_seat ();
/**
* 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
* {@link EventType.DEVICE_REMOVED} event and this {@link Device} is
* considered removed from the context; it will not generate further events
* and will be freed when the refcount reaches zero.
* A {@link EventType.DEVICE_ADDED} event is generated with a new {@link
* 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 {@link
* Context.suspend}, whichever happens earlier.
*
* @param name The new logical seat name
* @return 0 on success, non-zero on error
*/
public int set_seat_logical_name (string name);
/**
* Return a udev handle to the device that is this libinput device, if any.
*
* 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.
*/
public Udev.Device? get_udev_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 leds A mask of the LEDs to set, or unset.
*/
public void led_update (LED leds);
/**
* Check if the given device has the specified capability
*
* @return Non-zero if the given device has the capability or zero otherwise
*/
public int has_capability (DeviceCapability capability);
/**
* 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 width Set to the width of the device
* @param height Set to the height of the device
* @return 0 on success, or nonzero otherwise
*/
public int get_size (out double width, out double height);
/**
* Check if a {@link DeviceCapability.POINTER} device has a button with the
* given code (see linux/input.h).
*
* @param code Button code to check for, e.g. //BTN_LEFT//
*
* @return 1 if the device supports this button code, 0 if it does not, -1
* on error.
*/
public int pointer_has_button (uint32 code);
/**
* Check if a {@link DeviceCapability.KEYBOARD} device has a key with the
* given code (see linux/input.h).
*
* @param code Key code to check for, e.g. //KEY_ESC//
*
* @return 1 if the device supports this key code, 0 if it does not, -1
* on error.
*/
public int keyboard_has_key (uint32 code);
/**
* Check if a {@link DeviceCapability.SWITCH} device has a switch of the
* given type.
*
* @param sw Switch to check for
*
* @return 1 if the device supports this switch, 0 if it does not, -1
* on error.
*/
public int switch_has_switch (Switch sw);
/**
* Return the number of buttons on a device with the
* {@link DeviceCapability.TABLET_PAD} capability.
* Buttons on a pad device are numbered sequentially, see
* tablet-pad-buttons for details.
*
* @return The number of buttons supported by the device.
*/
public int tablet_pad_get_num_buttons ();
/**
* Return the number of rings a device with the {@link
* DeviceCapability.TABLET_PAD} capability provides.
*
* @return The number of rings or 0 if the device has no rings.
*
* @see Event.TabletPad.get_ring_number
*/
public int tablet_pad_get_num_rings ();
/**
* Return the number of strips a device with the {@link
* DeviceCapability.TABLET_PAD} capability provides.
*
* @return The number of strips or 0 if the device has no strips.
*
* @see Event.TabletPad.get_strip_number
*/
public int tablet_pad_get_num_strips ();
/**
* 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
* {@link TabletPadModeGroup.has_button},
* {@link TabletPadModeGroup.has_ring} and
* {@link TabletPadModeGroup.has_strip} to associate each button,
* ring and strip with the correct mode group.
*
* @return the number of mode groups available on this device
*/
public int tablet_pad_get_num_mode_groups ();
public TabletPadModeGroup tablet_pad_get_mode_group (uint index);
public int config_tap_get_finger_count ();
public ConfigStatus config_tap_set_enabled (ConfigTapState enable);
public ConfigTapState config_tap_get_enabled ();
public ConfigTapState config_tap_get_default_enabled ();
public ConfigStatus config_tap_set_button_map (ConfigTapButtonMap map);
public ConfigTapButtonMap config_tap_get_button_map ();
public ConfigTapButtonMap config_tap_get_default_button_map ();
public ConfigStatus config_tap_set_drag_enabled (ConfigDragState enable);
public ConfigDragState config_tap_get_drag_enabled ();
public ConfigDragState config_tap_get_default_drag_enabled ();
public ConfigStatus config_tap_set_drag_lock_enabled (ConfigDragLockState enable);
public ConfigDragLockState config_tap_get_drag_lock_enabled ();
public ConfigDragLockState config_tap_get_default_drag_lock_enabled ();
public int config_calibration_has_matrix ();
public ConfigStatus config_calibration_set_matrix (float matrix[6]);
public int config_calibration_get_matrix (out float matrix[6]);
public int config_calibration_get_default_matrix (out float matrix[6]);
public uint32 config_send_events_get_modes ();
public ConfigStatus config_send_events_set_mode (uint32 mode);
public uint32 config_send_events_get_mode ();
public uint32 config_send_events_get_default_mode ();
public int config_accel_is_available ();
public ConfigStatus config_accel_set_speed (double speed);
public double config_accel_get_speed ();
public double config_accel_get_default_speed ();
public uint32 config_accel_get_profiles ();
public ConfigStatus config_accel_set_profile (ConfigAccelProfile mode);
public ConfigAccelProfile config_accel_get_profile ();
public ConfigAccelProfile config_accel_get_default_profile ();
public int config_scroll_has_natural_scroll ();
public ConfigStatus config_scroll_set_natural_scroll_enabled (int enable);
public int config_scroll_get_natural_scroll_enabled ();
public int config_scroll_get_default_natural_scroll_enabled ();
public int config_left_handed_is_available ();
public ConfigStatus config_left_handed_set (int left_handed);
public int config_left_handed_get ();
public int config_left_handed_get_default ();
public uint32 config_click_get_methods ();
public ConfigStatus config_click_set_method (ConfigClickMethod method);
public ConfigClickMethod config_click_get_method ();
public ConfigClickMethod config_click_get_default_method ();
public int config_middle_emulation_is_available ();
public ConfigStatus config_middle_emulation_set_enabled (ConfigMiddleEmulationState enable);
public ConfigMiddleEmulationState config_middle_emulation_get_enabled ();
public ConfigMiddleEmulationState config_middle_emulation_get_default_enabled ();
public uint32 config_scroll_get_methods ();
public ConfigStatus config_scroll_set_method (ConfigScrollMethod method);
public ConfigScrollMethod config_scroll_get_method ();
public ConfigScrollMethod config_scroll_get_default_method ();
public ConfigStatus config_scroll_set_button (uint32 button);
public uint32 config_scroll_get_button ();
public uint32 config_scroll_get_default_button ();
public int config_dwt_is_available ();
public ConfigStatus config_dwt_set_enabled (ConfigDwtState enable);
public ConfigDwtState config_dwt_get_enabled ();
public ConfigDwtState config_dwt_get_default_enabled ();
public int config_rotation_is_available ();
public ConfigStatus config_rotation_set_angle (uint degrees_cw);
public uint config_rotation_get_angle ();
public uint config_rotation_get_default_angle ();
}
/**
* A base handle for accessing libinput device groups.
*/
[CCode (cname = "struct libinput_device_group", ref_function = "libinput_device_group_ref", unref_function = "libinput_device_group_unref")]
[Compact]
public class DeviceGroup {
[CCode (simple_generics = true)]
public void set_user_data<T> (T user_data);
[CCode (simple_generics = true)]
public T get_user_data<T> ();
}
/**
* The base event type.
*/
[CCode (cname = "struct libinput_event", free_function = "libinput_event_destroy")]
[Compact]
public class Event {
/**
* Get the type of the event.
*/
public unowned EventType get_type ();
/**
* Get the libinput context from the event.
*
* @return The libinput context for this event.
*/
public unowned Context get_context ();
/**
* 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.
*
* @return The device associated with this event
*/
public unowned Device get_device ();
/**
* 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 {@link Event.Pointer.get_base_event}.
*
* @return A pointer event, or null for other events
*/
public unowned Event.Pointer? get_pointer_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 {@link Event.Keyboard.get_base_event}.
*
* @return A keyboard event, or null for other events
*/
public unowned Event.Keyboard? get_keyboard_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 {@link Event.Touch.get_base_event}.
*
* @return A touch event, or null for other events
*/
public unowned Event.Touch? get_touch_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.
*
* The inverse of this function is {@link Event.Gesture.get_base_event}.
*
* @return A gesture event, or null for other events
*/
public unowned Event.Gesture? get_gesture_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 {@link Event.TabletTool.get_base_event}.
*
* @return A tablet tool event, or null for other events
*/
public unowned Event.TabletTool? get_tablet_tool_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 {@link Event.TabletPad.get_base_event}.
*
* @return A tablet pad event, or null for other events
*/
public unowned Event.TabletPad? get_tablet_pad_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 {@link Event.Switch.get_base_event}.
*
* @return A switch event, or null for other events
*/
public unowned Event.Switch? get_switch_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 {@link Event.DeviceNotify.get_base_event}.
*
* @return A device event, or null for other events
*/
public unowned Event.DeviceNotify? get_device_notify_event ();
/**
* An event notifying the caller of a device being added or removed.
*/
[CCode (cname = "struct libinput_event_device_notify")]
[Compact]
public class DeviceNotify {
public unowned Event get_base_event ();
}
/**
* A keyboard event representing a key press/release.
*/
[CCode (cname = "struct libinput_event_keyboard")]
[Compact]
public class Keyboard {
public unowned Event get_base_event ();
public uint32 get_time ();
public uint64 get_time_usec ();
public uint32 get_key ();
public KeyState get_key_state ();
/**
* For the key of a {@link EventType.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
* {@link EventType.KEYBOARD_KEY}. For other events, this function returns 0.
*
* @return The seat wide pressed key count for the key of this event
*/
public uint32 get_seat_key_count ();
}
/**
* A pointer event representing relative or absolute pointer movement,
* a button press/release or scroll axis events.
*/
[CCode (cname = "struct libinput_event_pointer")]
[Compact]
public class Pointer {
public unowned Event get_base_event ();
public uint32 get_time ();
public uint64 get_time_usec ();
/**
* Return the delta between the last event and the current event. For pointer
* events that are not of type {@link EventType.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 motion_normalization for more details.
*
* ''NOTE:'' It is an application bug to call this function for events other than
* {@link EventType.POINTER_MOTION}.
*
* @return The relative x movement since the last event
*/
public double get_dx ();
/**
* Return the delta between the last event and the current event. For pointer
* events that are not of type {@link EventType.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 motion_normalization for more details.
*
* ''NOTE:'' It is an application bug to call this function for events other than
* {@link EventType.POINTER_MOTION}.
*
* @return The relative y movement since the last event
*/
public double get_dy ();
/**
* Return the relative delta of the unaccelerated motion vector of the
* current event. For pointer events that are not of type {@link
* EventType.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 motion_normalization for more
* details.
*
* Any rotation applied to the device also applies to unaccelerated motion
* (see {@link Device.config_rotation_set_angle}).
*
* ''NOTE:''' It is an application bug to call this function for events other than
* {@link EventType.POINTER_MOTION}.
*
* @return The unaccelerated relative x movement since the last event
*/
public double get_dx_unaccelerated ();
/**
* Return the relative delta of the unaccelerated motion vector of the
* current event. For pointer events that are not of type {@link
* EventType.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 motion_normalization for more
* details.
*
* Any rotation applied to the device also applies to unaccelerated motion
* (see {@link Device.config_rotation_set_angle}).
*
* ''NOTE:''' It is an application bug to call this function for events other than
* {@link EventType.POINTER_MOTION}.
*
* @return The unaccelerated relative y movement since the last event
*/
public double get_dy_unaccelerated ();
/**
* 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 {@link get_absolute_x_transformed}.
*
* For pointer events that are not of type
* {@link EventType.POINTER_MOTION_ABSOLUTE}, this function returns 0.
*
* ''NOTE:''' It is an application bug to call this function for events other than
* {@link EventType.POINTER_MOTION_ABSOLUTE}.
*
* @return The current absolute x coordinate
*/
public double get_absolute_x ();
/**
* 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 {@link get_absolute_y_transformed}.
*
* For pointer events that are not of type
* {@link EventType.POINTER_MOTION_ABSOLUTE}, this function returns 0.
*
* ''NOTE:''' It is an application bug to call this function for events other than
* {@link EventType.POINTER_MOTION_ABSOLUTE}.
*
* @return The current absolute y coordinate
*/
public double get_absolute_y ();
/**
* Return the current absolute x coordinate of the pointer event, transformed to
* screen coordinates.
*
* For pointer events that are not of type
* {@link EventType.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
* {@link EventType.POINTER_MOTION_ABSOLUTE}.
*
* @param width The current output screen width
* @return The current absolute x coordinate transformed to a screen coordinate
*/
public double get_absolute_x_transformed (uint32 width);
/**
* Return the current absolute y coordinate of the pointer event, transformed to
* screen coordinates.
*
* For pointer events that are not of type
* {@link EventType.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
* {@link EventType.POINTER_MOTION_ABSOLUTE}.
*
* @param height The current output screen height
* @return The current absolute y coordinate transformed to a screen coordinate
*/
public double get_absolute_y_transformed (uint32 height);
/**
* Return the button that triggered this event.
* For pointer events that are not of type {@link
* EventType.POINTER_BUTTON}, this function returns 0.
*
* ''NOTE:''' It is an application bug to call this function for events other than
* {@link EventType.POINTER_BUTTON}.
*
* @return The button triggering this event
*/
public uint32 get_button ();
/**
* Return the button state that triggered this event.
* For pointer events that are not of type {@link
* EventType.POINTER_BUTTON}, this function returns 0.
*
* ''NOTE:''' It is an application bug to call this function for events other than
* {@link EventType.POINTER_BUTTON}.
*
* @return The button state triggering this event
*/
public ButtonState get_button_state ();
/**
* For the button of a {@link EventType.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
* {@link EventType.POINTER_BUTTON}. For other events, this function
* returns 0.
*