1 | // x11-rs: Rust bindings for X11 libraries |
2 | // The X11 libraries are available under the MIT license. |
3 | // These bindings are public domain. |
4 | |
5 | use std::os::raw::{c_char, c_int, c_uchar, c_ulong, c_ushort}; |
6 | |
7 | use super::xlib::{Bool, Display, Time, XID}; |
8 | |
9 | // |
10 | // functions |
11 | // |
12 | |
13 | x11_link! { Xf86vmode, xtst, ["libXtst.so.6" , "libXtst.so" ], 14, |
14 | pub fn XRecordAllocRange () -> *mut XRecordRange, |
15 | pub fn XRecordCreateContext (_6: *mut Display, _5: c_int, _4: *mut c_ulong, _3: c_int, _2: *mut *mut XRecordRange, _1: c_int) -> c_ulong, |
16 | pub fn XRecordDisableContext (_2: *mut Display, _1: c_ulong) -> c_int, |
17 | pub fn XRecordEnableContext (_4: *mut Display, _3: c_ulong, _2: Option<unsafe extern "C" fn (*mut c_char, *mut XRecordInterceptData)>, _1: *mut c_char) -> c_int, |
18 | pub fn XRecordEnableContextAsync (_4: *mut Display, _3: c_ulong, _2: Option<unsafe extern "C" fn (*mut c_char, *mut XRecordInterceptData)>, _1: *mut c_char) -> c_int, |
19 | pub fn XRecordFreeContext (_2: *mut Display, _1: c_ulong) -> c_int, |
20 | pub fn XRecordFreeData (_1: *mut XRecordInterceptData) -> (), |
21 | pub fn XRecordFreeState (_1: *mut XRecordState) -> (), |
22 | pub fn XRecordGetContext (_3: *mut Display, _2: c_ulong, _1: *mut *mut XRecordState) -> c_int, |
23 | pub fn XRecordIdBaseMask (_1: *mut Display) -> c_ulong, |
24 | pub fn XRecordProcessReplies (_1: *mut Display) -> (), |
25 | pub fn XRecordQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int, |
26 | pub fn XRecordRegisterClients (_7: *mut Display, _6: c_ulong, _5: c_int, _4: *mut c_ulong, _3: c_int, _2: *mut *mut XRecordRange, _1: c_int) -> c_int, |
27 | pub fn XRecordUnregisterClients (_4: *mut Display, _3: c_ulong, _2: *mut c_ulong, _1: c_int) -> c_int, |
28 | variadic: |
29 | globals: |
30 | } |
31 | |
32 | // |
33 | // constants |
34 | // |
35 | |
36 | pub const XRecordFromServerTime: c_int = 0x01; |
37 | pub const XRecordFromClientTime: c_int = 0x02; |
38 | pub const XRecordFromClientSequence: c_int = 0x04; |
39 | |
40 | pub const XRecordCurrentClients: c_ulong = 1; |
41 | pub const XRecordFutureClients: c_ulong = 2; |
42 | pub const XRecordAllClients: c_ulong = 3; |
43 | |
44 | pub const XRecordFromServer: c_int = 0; |
45 | pub const XRecordFromClient: c_int = 1; |
46 | pub const XRecordClientStarted: c_int = 2; |
47 | pub const XRecordClientDied: c_int = 3; |
48 | pub const XRecordStartOfData: c_int = 4; |
49 | pub const XRecordEndOfData: c_int = 5; |
50 | |
51 | // |
52 | // types |
53 | // |
54 | |
55 | pub type XRecordClientSpec = c_ulong; |
56 | pub type XRecordContext = c_ulong; |
57 | |
58 | #[derive (Debug, Clone, Copy, PartialEq)] |
59 | #[repr (C)] |
60 | pub struct XRecordClientInfo { |
61 | pub client: XRecordClientSpec, |
62 | pub nranges: c_ulong, |
63 | pub ranges: *mut *mut XRecordRange, |
64 | } |
65 | |
66 | #[derive (Debug, Clone, Copy, PartialEq)] |
67 | #[repr (C)] |
68 | pub struct XRecordExtRange { |
69 | pub ext_major: XRecordRange8, |
70 | pub ext_minor: XRecordRange16, |
71 | } |
72 | |
73 | #[derive (Debug, Clone, Copy, PartialEq)] |
74 | #[repr (C)] |
75 | pub struct XRecordInterceptData { |
76 | pub id_base: XID, |
77 | pub server_time: Time, |
78 | pub client_seq: c_ulong, |
79 | pub category: c_int, |
80 | pub client_swapped: Bool, |
81 | pub data: *mut c_uchar, |
82 | pub data_len: c_ulong, |
83 | } |
84 | |
85 | #[derive (Debug, Clone, Copy, PartialEq)] |
86 | #[repr (C)] |
87 | pub struct XRecordRange { |
88 | pub core_requests: XRecordRange8, |
89 | pub core_replies: XRecordRange8, |
90 | pub ext_requests: XRecordExtRange, |
91 | pub ext_replies: XRecordExtRange, |
92 | pub delivered_events: XRecordRange8, |
93 | pub device_events: XRecordRange8, |
94 | pub errors: XRecordRange8, |
95 | pub client_started: Bool, |
96 | pub client_died: Bool, |
97 | } |
98 | |
99 | #[derive (Debug, Clone, Copy, PartialEq)] |
100 | #[repr (C)] |
101 | pub struct XRecordRange8 { |
102 | pub first: c_uchar, |
103 | pub last: c_uchar, |
104 | } |
105 | |
106 | #[derive (Debug, Clone, Copy, PartialEq)] |
107 | #[repr (C)] |
108 | pub struct XRecordRange16 { |
109 | pub first: c_ushort, |
110 | pub last: c_ushort, |
111 | } |
112 | |
113 | #[derive (Debug, Clone, Copy, PartialEq)] |
114 | #[repr (C)] |
115 | pub struct XRecordState { |
116 | pub enabled: Bool, |
117 | pub datum_flags: c_int, |
118 | pub nclients: c_ulong, |
119 | pub client_info: *mut *mut XRecordClientInfo, |
120 | } |
121 | |