-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwrapper.v
352 lines (268 loc) · 8.83 KB
/
wrapper.v
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
fn C.XSetInputFocus(&C.Display, C.Window, Revert, C.Time)
struct C.XSizeHints {}
struct C.GC {}
@[typedef]
union C.XEvent {
mut:
@type int
xkey C.XKeyEvent
xclient C.XClientMessageEvent
xbutton C.XButtonEvent
xmaprequest C.XMapRequestEvent
xconfigurerequest C.XConfigureRequestEvent
xunmap C.XUnmapEvent
xmap C.XMapEvent
xdestroywindow C.XDestroyWindowEvent
xcreatewindow C.XCreateWindowEvent
}
@[typedef]
struct C.XMapEvent {
@type int
serial u32
send_event bool
display &C.Display = unsafe { nil }
event C.Window
window C.Window
override_redirect bool
}
@[typedef]
struct C.XCreateWindowEvent {
@type int
serial u32
send_event bool
display &C.Display = unsafe { nil }
parent C.Window
window C.Window
x int
y int
width int
height int
border_width int
override_redirect bool
}
@[typedef]
struct C.XDestroyWindowEvent {
@type int // DestroyNotify
serial int // # of last request processed by server
send_event bool // true if this came from a SendEvent request
display &C.Display = unsafe { nil } // Display the event was read from
event C.Window
window C.Window
}
@[typedef]
struct C.XMapRequestEvent {
@type int // MapRequest
serial u32 // # of last request processed by server
send_event bool // true if this came from a SendEvent request
display &C.Display = unsafe { nil } // Display the event was read from
parent C.Window
window C.Window
}
@[typedef]
struct C.XWindowChanges {
x int
y int
width int
height int
border_width int
sibling C.Window
stack_mode int
}
@[typedef]
struct C.XConfigureRequestEvent {
@type int // ConfigureRequest
serial i64 // # of last request processed by server
send_event bool // true if this came from a SendEvent request
display &C.Display = unsafe { nil } // Display the event was read from
parent C.Window
window C.Window
x int
y int
width int
height int
border_width int
above C.Window
detail int // Above, Below, TopIf, BottomIf, Opposite
value_mask u64
}
@[typedef]
struct C.XUnmapEvent {
@type int // UnmapNotify
serial u32 // # of last request processed by server
send_event bool // true if this came from a SendEvent request
display &C.Display = unsafe { nil } // Display the event was read from
event C.Window
window C.Window
from_configure bool
}
union XClientMessageEventData {
mut:
b [20]u8
s [10]i16
l [5]i64
}
type C.Atom = int
type C.Time = int
struct C.Time {}
fn C.XInternAtom(&C.Display, &u8, bool) C.Atom
@[typedef]
struct C.XClientMessageEvent {
mut:
@type int // ClientMessage
serial int // # of last request processed by server
send_event bool // true if this came from a SendEvent request
display &C.Display = unsafe { nil } // Display the event was read from
window C.Window
message_type C.Atom
format int
data XClientMessageEventData
}
@[typedef]
struct C.XKeyEvent {
@type int
serial u32
send_event bool
display &C.Display = unsafe { nil }
window C.Window
root C.Window
subwindow C.Window
time C.Time
x int
y int
x_root int
y_root int
state int
keycode int
same_screen bool
}
@[typedef]
struct C.XButtonEvent {
@type int // ButtonPress or ButtonRelease
serial u32 // # of last request processed by server
send_event bool // true if this came from a SendEvent request
display &C.Display = unsafe { nil } // Display the event was read from
window C.Window // ``event'' window it is reported relative to
root C.Window // root window that the event occurred on
subwindow C.Window // child window
time C.Time // milliseconds
x int
y int // pointer x, y coordinates in event window
x_root int
y_root int // coordinates relative to root
state int // key or button mask
button int // detail
same_screen bool // same screen flag
}
fn C.XSetErrorHandler(fn (&C.Display, &C.XErrorEvent) int) int
fn C.XGetErrorText(&C.Display, int, &u8, int)
type C.XID = int
@[typedef]
struct C.XErrorEvent {
@type int
display &C.Display = unsafe { nil }
serial u64 // serial number of failed request
error_code u8 // error code of failed request
request_code u8 // Major op-code of failed request
minor_code u8 // Minor op-code of failed request
resourceid C.XID
}
fn C.XScreenOfDisplay(&C.Display, int) &C.Screen
fn C.XWidthOfScreen(&C.Screen) int
fn C.XHeightOfScreen(&C.Screen) int
fn C.XStringToKeysym(&u8) KeySym
fn C.XNextEvent(&C.Display, &C.XEvent) int
fn C.XDefaultGC(&C.Display, int) C.GC
fn C.XSetForeground(&C.Display, C.GC, u32)
fn C.XFillRectangle(&C.Display, C.Window, C.GC, int, int, int, int)
fn C.XClearWindow(&C.Display, C.Window)
fn C.XSetStandardProperties(&C.Display, C.Window, &u8, &u8, C.Pixmap, &&u8, int, C.XSizeHints)
fn C.XSelectInput(&C.Display, C.Window, i32)
fn C.XSetInputFocus(&C.Display, C.Window, int, C.Time)
fn C.XCloseDisplay(&C.Display)
fn C.XDefaultRootWindow(&C.Display) C.Window
fn C.XDefaultScreenOfDisplay(&C.Display) &C.Screen
fn C.XDefaultScreen(&C.Display) int
fn C.XDisplayWidth(&C.Display, int) int
fn C.XDisplayHeight(&C.Display, int) int
fn C.XMoveWindow(&C.Display, C.Window, int, int)
fn C.XGrabKey(&C.Display, int, int, C.Window, bool, int, int) // the 2th int is a u int
fn C.XGrabButton(&C.Display, int, int, C.Window, bool, int, int, int, C.Window, C.Cursor)
fn C.XKeysymToKeycode(&C.Display, KeySym) KeyCode
fn C.XUnmapWindow(&C.Display, C.Window)
fn C.XMapWindow(&C.Display, C.Window)
fn C.XFetchName(&C.Display, C.Window, &&u8)
fn C.XSetWindowBorderWidth(&C.Display, C.Window, int)
fn C.XSetWindowBorder(&C.Display, C.Window, u64)
fn C.XGetClassHint(&C.Display, C.Window, &C.XClassHint) int
fn C.XConfigureWindow(&C.Display, C.Window, int, &C.XWindowChanges)
fn C.XRaiseWindow(&C.Display, C.Window)
fn C.XMoveResizeWindow(&C.Display, C.Window, int, int, int, int)
fn C.XCreateFontCursor(&C.Display, int) C.Cursor
fn C.XChangeWindowAttributes(&C.Display, C.Window, u32, &C.XSetWindowAttributes)
fn C.XSetClassHint(&C.Display, C.Window, &C.XClassHint)
fn C.XftFontOpenName(&C.Display, int, &u8) &C.XftFont
struct C.Visual {}
fn C.XDefaultVisual(&C.Display, int) &C.Visual
struct C.Colormap {}
fn C.XOpenDisplay(&u8) &C.Display
fn C.XDefaultColormap(&C.Display, int) C.Colormap
fn C.XftDrawCreate(&C.Display, C.Window, &C.Visual, C.Colormap) &C.XftDraw
fn C.XFlush(&C.Display)
fn C.XftDrawStringUtf8(&C.XftDraw, &C.XftColor, &C.XftFont, int, int, &C.XftChar8, int)
fn C.XSendEvent(&C.Display, C.Window, bool, int, &C.XEvent)
struct C.XftChar8 {}
@[typedef]
struct C.XRenderColor {
red u16
green u16
blue u16
alpha u16
}
fn C.XftColorAllocValue(&C.Display, &C.Visual, C.Colormap, &C.XRenderColor, &C.XftColor) bool
fn C.XCreateSimpleWindow(&C.Display, C.Window, int, int, int, int, int, u32, u32) C.Window
@[heap; typedef]
struct C.Display {}
type C.Window = u64
struct C.Screen {}
struct C.XftFont {}
@[typedef]
struct C.XftColor {}
struct C.XftDraw {}
type C.Cursor = int
fn C.XFree(&u8)
@[typedef]
struct C.XClassHint {
res_name &u8 = unsafe { nil }
res_class &u8 = unsafe { nil }
}
@[typedef]
struct C.Pixmap {}
struct C.Colormap {}
@[typedef]
struct C.XWindowAttributes {
x int
y int
width int
height int
override_redirect bool
}
fn C.XGetWindowAttributes(&C.Display, C.Window, &C.XWindowAttributes) int
@[heap; typedef]
struct C.XSetWindowAttributes {
mut:
background_pixmap C.Pixmap // background, None, or ParentRelative
background_pixel u32 // background pixel
border_pixmap C.Pixmap // border of the window or CopyFromParent
border_pixel u32 // border pixel value
bit_gravity int // one of bit gravity values
win_gravity int // one of the window gravity values
backing_store int // NotUseful, WhenMapped, Always
backing_planes u32 // planes to be preserved if possible
backing_pixel u32 // value to use in restoring planes
save_under bool // should bits under be saved? (popups)
event_mask i32 // set of events that should be saved
do_not_propagate_mask i32 // set of events that should not propagate
override_redirect bool // boolean value for override_redirect
colormap C.Colormap // color map to be associated with window
cursor C.Cursor // cursor to be displayed (or None)
}