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
|
#ifndef MY_X11_DEFS
#define MY_X11_DEFS
#include <stdint.h>
typedef unsigned long XID;
typedef struct XImageSave_s {
int anyEmu;
void* create;
void* destroy;
void* get;
void* put;
void* sub;
void* add;
} XImageSave_t;
typedef struct ximage_s {
void*(*create_image)(
void* /* display */,
void* /* visual */,
uint32_t /* depth */,
int32_t /* format */,
int32_t /* offset */,
void* /* data */,
uint32_t /* width */,
uint32_t /* height */,
int32_t /* bitmap_pad */,
int32_t /* bytes_per_line */);
int32_t (*destroy_image) (void*);
uintptr_t (*get_pixel) (void*, int32_t, int32_t);
int32_t (*put_pixel) (void*, int32_t, int32_t, uintptr_t);
void*(*sub_image) (void*, int32_t, int32_t, uint32_t, uint32_t); //sub_image return a new XImage that need bridging => custom wrapper
int32_t (*add_pixel) (void*, intptr_t);
} ximage_t;
typedef struct _XImage {
int32_t width, height; /* size of image */
int32_t xoffset; /* number of pixels offset in X direction */
int32_t format; /* XYBitmap, XYPixmap, ZPixmap */
void* data; /* pointer to image data */
int32_t byte_order; /* data byte order, LSBFirst, MSBFirst */
int32_t bitmap_unit; /* quant. of scanline 8, 16, 32 */
int32_t bitmap_bit_order; /* LSBFirst, MSBFirst */
int32_t bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */
int32_t depth; /* depth of image */
int32_t bytes_per_line; /* accelarator to next line */
int32_t bits_per_pixel; /* bits per pixel (ZPixmap) */
uintptr_t red_mask; /* bits in z arrangment */
uintptr_t green_mask;
uintptr_t blue_mask;
void* obdata; /* hook for the object routines to hang on */
ximage_t f;
} XImage;
struct my_XFreeFuncs {
void* atoms;
void* modifiermap;
void* key_bindings;
void* context_db;
void* defaultCCCs;
void* clientCmaps;
void* intensityMaps;
void* im_filters;
void* xkb;
};
struct my_XExten {
struct my_XExten *next;
void* codes; // XExtCodes
void* create_GC; // CreateGCType
void* copy_GC; // CopyGCType
void* flush_GC; // FlushGCType
void* free_GC; // FreeGCType
void* create_Font; // CreateFontType
void* free_Font; // FreeFontType
void* close_display; // CloseDisplayType
void* error; // ErrorType
void* error_string; // ErrorStringType
char *name;
void* error_values; // PrintErrorType
void* before_flush; // BeforeFlushType
struct my_XExten *next_flush;
};
struct my_XInternalAsync {
struct my_XInternalAsync *next;
int (*handler)(void*, void*, char*, int, void*);
void* data;
};
struct my_XLockPtrs {
void (*lock_display)(void* dpy);
void (*unlock_display)(void *dpy);
};
struct my_XConnectionInfo {
int fd;
void* read_callback; // _XInternalConnectionProc
void* call_data;
void* *watch_data;
struct my_XConnectionInfo *next;
};
struct my_XConnWatchInfo {
void* fn; // XConnectionWatchProc
void* client_data;
struct _XConnWatchInfo *next;
};
typedef struct my_Visual_s {
void* ext_data; //XExtData*
XID visualid;
int c_class;
unsigned long red_mask, green_mask, blue_mask;
int bits_per_rgb;
int map_entries;
} my_Visual_t;
typedef struct my_Screen_s {
void* ext_data; //XExtData *
struct my_XDisplay_s *display;
XID root;
int width, height;
int mwidth, mheight;
int ndepths;
void* depths; //Depth *
int root_depth; /* bits per pixel */
my_Visual_t* root_visual;
void* default_gc; //GC == struct _XGC*
XID cmap;
unsigned long white_pixel;
unsigned long black_pixel;
int max_maps, min_maps;
int backing_store;
int save_unders;
long root_input_mask;
} my_Screen_t;
typedef struct my_XDisplay_s
{
void *ext_data;
struct my_XFreeFuncs *free_funcs;
int fd;
int conn_checker;
int proto_major_version;
int proto_minor_version;
char *vendor;
XID resource_base;
XID resource_mask;
XID resource_id;
int resource_shift;
XID (*resource_alloc)(void*);
int byte_order;
int bitmap_unit;
int bitmap_pad;
int bitmap_bit_order;
int nformats;
void *pixmap_format;
int vnumber;
int release;
void *head, *tail;
int qlen;
unsigned long last_request_read;
unsigned long request;
char *last_req;
char *buffer;
char *bufptr;
char *bufmax;
unsigned max_request_size;
void* *db;
int (*synchandler)(void*);
char *display_name;
int default_screen;
int nscreens;
my_Screen_t *screens;
unsigned long motion_buffer;
volatile unsigned long flags;
int min_keycode;
int max_keycode;
void *keysyms;
void *modifiermap;
int keysyms_per_keycode;
char *xdefaults;
char *scratch_buffer;
unsigned long scratch_length;
int ext_number;
struct my_XExten *ext_procs;
int (*event_vec[128])(void *, void *, void *);
int (*wire_vec[128])(void *, void *, void *);
XID lock_meaning;
void* lock;
struct my_XInternalAsync *async_handlers;
unsigned long bigreq_size;
struct my_XLockPtrs *lock_fns;
void (*idlist_alloc)(void *, void *, int);
void* key_bindings;
XID cursor_font;
void* *atoms;
unsigned int mode_switch;
unsigned int num_lock;
void* context_db;
int (**error_vec)(void*, void*, void*);
struct {
void* defaultCCCs;
void* clientCmaps;
void* perVisualIntensityMaps;
} cms;
void* im_filters;
void* qfree;
unsigned long next_event_serial_num;
struct my_XExten *flushes;
struct my_XConnectionInfo *im_fd_info;
int im_fd_length;
struct my_XConnWatchInfo *conn_watchers;
int watcher_count;
void* filedes;
int (*savedsynchandler)(void *);
XID resource_max;
int xcmisc_opcode;
void* *xkb_info;
void* *trans_conn;
void* *xcb;
unsigned int next_cookie;
int (*generic_event_vec[128])(void*, void*, void*);
int (*generic_event_copy_vec[128])(void*, void*, void*);
void *cookiejar;
unsigned long last_request_read_upper32bit; // 64bits only
unsigned long request_upper32bit; // 64bits only
void* error_threads;
void* exit_handler;
void* exit_handler_data;
} my_XDisplay_t;
typedef struct my_XSetWindowAttributes_s {
XID background_pixmap;
unsigned long background_pixel;
XID border_pixmap;
unsigned long border_pixel;
int bit_gravity;
int win_gravity;
int backing_store;
unsigned long backing_planes;
unsigned long backing_pixel;
int save_under;
long event_mask;
long do_not_propagate_mask;
int override_redirect;
XID colormap;
XID cursor;
} my_XSetWindowAttributes_t;
typedef struct my_XKeyEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
XID root;
XID subwindow;
unsigned long time;
int x, y;
int x_root, y_root;
unsigned int state;
unsigned int keycode;
int same_screen;
} my_XKeyEvent_t;
typedef my_XKeyEvent_t my_XKeyPressedEvent_t;
typedef my_XKeyEvent_t my_XKeyReleasedEvent_t;
typedef struct my_XButtonEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
XID root;
XID subwindow;
unsigned long time;
int x, y;
int x_root, y_root;
unsigned int state;
unsigned int button;
int same_screen;
} my_XButtonEvent_t;
typedef my_XButtonEvent_t my_XButtonPressedEvent_t;
typedef my_XButtonEvent_t my_XButtonReleasedEvent_t;
typedef struct my_XMotionEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
XID root;
XID subwindow;
unsigned long time;
int x, y;
int x_root, y_root;
unsigned int state;
char is_hint;
int same_screen;
} my_XMotionEvent_t;
typedef my_XMotionEvent_t my_XPointerMovedEvent_t;
typedef struct my_XCrossingEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
XID root;
XID subwindow;
unsigned long time;
int x, y;
int x_root, y_root;
int mode;
int detail;
int same_screen;
int focus;
unsigned int state;
} my_XCrossingEvent_t;
typedef my_XCrossingEvent_t my_XEnterWindowEvent_t;
typedef my_XCrossingEvent_t my_XLeaveWindowEvent_t;
typedef struct my_XFocusChangeEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
int mode;
int detail;
} my_XFocusChangeEvent_t;
typedef my_XFocusChangeEvent_t my_XFocusInEvent_t;
typedef my_XFocusChangeEvent_t my_XFocusOutEvent_t;
typedef struct my_XKeymapEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
char key_vector[32];
} my_XKeymapEvent_t;
typedef struct my_XExposeEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
int x, y;
int width, height;
int count;
} my_XExposeEvent_t;
typedef struct my_XGraphicsExposeEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID drawable;
int x, y;
int width, height;
int count;
int major_code;
int minor_code;
} my_XGraphicsExposeEvent_t;
typedef struct my_XNoExposeEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID drawable;
int major_code;
int minor_code;
} my_XNoExposeEvent_t;
typedef struct my_XVisibilityEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
int state;
} my_XVisibilityEvent_t;
typedef struct my_XCreateWindowEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID parent;
XID window;
int x, y;
int width, height;
int border_width;
int override_redirect;
} my_XCreateWindowEvent_t;
typedef struct my_XDestroyWindowEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID event;
XID window;
} my_XDestroyWindowEvent_t;
typedef struct my_XUnmapEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID event;
XID window;
int from_configure;
} my_XUnmapEvent_t;
typedef struct my_XMapEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID event;
XID window;
int override_redirect;
} my_XMapEvent_t;
typedef struct my_XMapRequestEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID parent;
XID window;
} my_XMapRequestEvent_t;
typedef struct my_XReparentEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID event;
XID window;
XID parent;
int x, y;
int override_redirect;
} my_XReparentEvent_t;
typedef struct my_XConfigureEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID event;
XID window;
int x, y;
int width, height;
int border_width;
XID above;
int override_redirect;
} my_XConfigureEvent_t;
typedef struct my_XGravityEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID event;
XID window;
int x, y;
} my_XGravityEvent_t;
typedef struct my_XResizeRequestEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
int width, height;
} my_XResizeRequestEvent_t;
typedef struct my_XConfigureRequestEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID parent;
XID window;
int x, y;
int width, height;
int border_width;
XID above;
int detail;
unsigned long value_mask;
} my_XConfigureRequestEvent_t;
typedef struct my_XCirculateEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID event;
XID window;
int place;
} my_XCirculateEvent_t;
typedef struct my_XCirculateRequestEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID parent;
XID window;
int place;
} my_XCirculateRequestEvent_t;
typedef struct my_XPropertyEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
XID atom;
unsigned long time;
int state;
} my_XPropertyEvent_t;
typedef struct my_XSelectionClearEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
XID selection;
unsigned long time;
} my_XSelectionClearEvent_t;
typedef struct my_XSelectionRequestEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID owner;
XID requestor;
XID selection;
XID target;
XID property;
unsigned long time;
} my_XSelectionRequestEvent_t;
typedef struct my_XSelectionEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID requestor;
XID selection;
XID target;
XID property;
unsigned long time;
} my_XSelectionEvent_t;
typedef struct my_XColormapEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
XID colormap;
int c_new;
int state;
} my_XColormapEvent_t;
typedef struct my_XClientMessageEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
XID message_type;
int format;
union {
char b[20];
short s[10];
long l[5];
} data;
} my_XClientMessageEvent_t;
typedef struct my_XMappingEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
int request;
int first_keycode;
int count;
} my_XMappingEvent_t;
typedef struct my_XErrorEvent_s
{
int type;
my_XDisplay_t *display;
XID resourceid;
unsigned long serial;
unsigned char error_code;
unsigned char request_code;
unsigned char minor_code;
} my_XErrorEvent_t;
typedef struct my_XAnyEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
XID window;
} my_XAnyEvent_t;
typedef struct my_XGenericEvent_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
int extension;
int evtype;
} my_XGenericEvent_t;
typedef struct my_XGenericEventCookie_s
{
int type;
unsigned long serial;
int send_event;
my_XDisplay_t *display;
int extension;
int evtype;
unsigned int cookie;
void *data;
} my_XGenericEventCookie_t;
typedef union my_XEvent_s {
int type;
my_XAnyEvent_t xany;
my_XKeyEvent_t xkey;
my_XButtonEvent_t xbutton;
my_XMotionEvent_t xmotion;
my_XCrossingEvent_t xcrossing;
my_XFocusChangeEvent_t xfocus;
my_XExposeEvent_t xexpose;
my_XGraphicsExposeEvent_t xgraphicsexpose;
my_XNoExposeEvent_t xnoexpose;
my_XVisibilityEvent_t xvisibility;
my_XCreateWindowEvent_t xcreatewindow;
my_XDestroyWindowEvent_t xdestroywindow;
my_XUnmapEvent_t xunmap;
my_XMapEvent_t xmap;
my_XMapRequestEvent_t xmaprequest;
my_XReparentEvent_t xreparent;
my_XConfigureEvent_t xconfigure;
my_XGravityEvent_t xgravity;
my_XResizeRequestEvent_t xresizerequest;
my_XConfigureRequestEvent_t xconfigurerequest;
my_XCirculateEvent_t xcirculate;
my_XCirculateRequestEvent_t xcirculaterequest;
my_XPropertyEvent_t xproperty;
my_XSelectionClearEvent_t xselectionclear;
my_XSelectionRequestEvent_t xselectionrequest;
my_XSelectionEvent_t xselection;
my_XColormapEvent_t xcolormap;
my_XClientMessageEvent_t xclient;
my_XMappingEvent_t xmapping;
my_XErrorEvent_t xerror;
my_XKeymapEvent_t xkeymap;
my_XGenericEvent_t xgeneric;
my_XGenericEventCookie_t xcookie;
long pad[24];
} my_XEvent_t;
#define XEVT_KeyPress 2
#define XEVT_KeyRelease 3
#define XEVT_ButtonPress 4
#define XEVT_ButtonRelease 5
#define XEVT_MotionNotify 6
#define XEVT_EnterNotify 7
#define XEVT_LeaveNotify 8
#define XEVT_FocusIn 9
#define XEVT_FocusOut 10
#define XEVT_KeymapNotify 11
#define XEVT_Expose 12
#define XEVT_GraphicsExpose 13
#define XEVT_NoExpose 14
#define XEVT_VisibilityNotify 15
#define XEVT_CreateNotify 16
#define XEVT_DestroyNotify 17
#define XEVT_UnmapNotify 18
#define XEVT_MapNotify 19
#define XEVT_MapRequest 20
#define XEVT_ReparentNotify 21
#define XEVT_ConfigureNotify 22
#define XEVT_ConfigureRequest 23
#define XEVT_GravityNotify 24
#define XEVT_ResizeRequest 25
#define XEVT_CirculateNotify 26
#define XEVT_CirculateRequest 27
#define XEVT_PropertyNotify 28
#define XEVT_SelectionClear 29
#define XEVT_SelectionRequest 30
#define XEVT_SelectionNotify 31
#define XEVT_ColormapNotify 32
#define XEVT_ClientMessage 33
#define XEVT_MappingNotify 34
#define XEVT_GenericEvent 35
// WMHints
typedef struct my_XWMHints_s {
long flags;
int input;
int initial_state;
XID icon_pixmap;
XID icon_window;
int icon_x;
int icon_y;
XID icon_mask;
XID window_group;
} my_XWMHints_t;
#define XWMHint_InputHint (1L << 0)
#define XWMHint_StateHint (1L << 1)
#define XWMHint_IconPixmapHint (1L << 2)
#define XWMHint_IconWindowHint (1L << 3)
#define XWMHint_IconPositionHint (1L << 4)
#define XWMHint_IconMaskHint (1L << 5)
#define XWMHint_WindowGroupHint (1L << 6)
#define XWMHint_XUrgencyHint (1L << 8)
typedef struct my_XRRModeInfo_s {
XID id;
unsigned int width;
unsigned int height;
unsigned long dotClock;
unsigned int hSyncStart;
unsigned int hSyncEnd;
unsigned int hTotal;
unsigned int hSkew;
unsigned int vSyncStart;
unsigned int vSyncEnd;
unsigned int vTotal;
char *name;
unsigned int nameLength;
unsigned long modeFlags;
} my_XRRModeInfo_t;
typedef struct my_XRRScreenResources_s {
unsigned long timestamp;
unsigned long configTimestamp;
int ncrtc;
XID *crtcs;
int noutput;
XID *outputs;
int nmode;
my_XRRModeInfo_t *modes;
} my_XRRScreenResources_t;
typedef struct my_XRRCrtcInfo_s {
unsigned long timestamp;
int x, y;
unsigned int width, height;
XID mode;
uint16_t rotation;
int noutput;
XID *outputs;
uint16_t rotations;
int npossible;
XID *possible;
} my_XRRCrtcInfo_t;
typedef struct my_XRROutputInfo_s {
unsigned long timestamp;
XID crtc;
char *name;
int nameLen;
unsigned long mm_width;
unsigned long mm_height;
uint16_t connection;
uint16_t subpixel_order;
int ncrtc;
XID *crtcs;
int nclone;
XID *clones;
int nmode;
int npreferred;
XID *modes;
} my_XRROutputInfo_t;
// Window Attribute
typedef struct my_XWindowAttributes_s {
int x, y;
int width, height;
int border_width;
int depth;
void* visual; //Visual*
XID root;
int c_class;
int bit_gravity;
int win_gravity;
int backing_store;
unsigned long backing_planes;
unsigned long backing_pixel;
int save_under;
XID colormap;
int map_installed;
int map_state;
long all_event_masks;
long your_event_mask;
long do_not_propagate_mask;
int override_redirect;
void* screen; //Screen*
} my_XWindowAttributes_t;
typedef struct my_XVisualInfo_s {
my_Visual_t* visual;
unsigned long visualid;
int screen;
int depth;
int c_class;
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
int colormap_size;
int bits_per_rgb;
} my_XVisualInfo_t;
typedef struct my_XModifierKeymap_s {
int max_keypermod;
uint8_t* modifiermap;
} my_XModifierKeymap_t;
typedef struct my_XdbeVisualInfo_s
{
XID visual;
int depth;
int perflevel;
} my_XdbeVisualInfo_t;
typedef struct my_XdbeScreenVisualInfo_s
{
int count;
my_XdbeVisualInfo_t* visinfo;
} my_XdbeScreenVisualInfo_t;
typedef struct my_XF86VidModeModeInfo_s
{
unsigned int dotclock;
unsigned short hdisplay;
unsigned short hsyncstart;
unsigned short hsyncend;
unsigned short htotal;
unsigned short hskew;
unsigned short vdisplay;
unsigned short vsyncstart;
unsigned short vsyncend;
unsigned short vtotal;
unsigned int flags;
int privsize;
int* tc_private;
} my_XF86VidModeModeInfo_t;
typedef struct my_XColor_s {
unsigned long pixel;
unsigned short red, green, blue;
char flags;
char pad;
} my_XColor_t;
typedef struct my_XRRProviderInfo_s {
unsigned int capabilities;
int ncrtcs;
XID* crtcs;
int noutputs;
XID* outputs;
char* name;
int nassociatedproviders;
XID* associated_providers;
unsigned int* associated_capability;
int nameLen;
} my_XRRProviderInfo_t;
typedef struct my_XRRProviderResources_t {
unsigned long timestamp;
int nproviders;
XID* providers;
} my_XRRProviderResources_t;
typedef struct my_XIAnyClassInfo_s
{
int type;
int sourceid;
} my_XIAnyClassInfo_t;
typedef struct my_XIDeviceInfo_s
{
int deviceid;
char* name;
int use;
int attachment;
int enabled;
int num_classes;
my_XIAnyClassInfo_t** classes;
} my_XIDeviceInfo_t;
typedef struct my_XIEventMask_s {
int deviceid;
int mask_len;
unsigned char* mask;
} my_XIEventMask_t;
typedef struct my_XInputClassInfo_s {
unsigned char input_class;
unsigned char event_type_base;
} my_XInputClassInfo_t;
typedef struct my_XDevice_s {
XID device_id;
int num_classes;
my_XInputClassInfo_t* classes;
} my_XDevice_t;
typedef struct my_XDeviceKeyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display; //Display*
XID window;
XID deviceid;
XID root;
XID subwindow;
unsigned long time;
int x, y;
int x_root;
int y_root;
unsigned int state;
unsigned int keycode;
int same_screen;
unsigned int device_state;
unsigned char axes_count;
unsigned char first_axis;
int axis_data[6];
} my_XDeviceKeyEvent_t;
typedef my_XDeviceKeyEvent_t my_XDeviceButtonEvent_t;
typedef struct my_XDeviceMotionEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display; //Display*
XID window;
XID deviceid;
XID root;
XID subwindow;
unsigned long time;
int x, y;
int x_root;
int y_root;
unsigned int state;
char is_hint;
int same_screen;
unsigned int device_state;
unsigned char axes_count;
unsigned char first_axis;
int axis_data[6];
} my_XDeviceMotionEvent_t;
typedef struct my_XDeviceFocusChangeEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display; //Display*
XID window;
XID deviceid;
int mode;
int detail;
unsigned long time;
} my_XDeviceFocusChangeEvent_t;
typedef struct my_XProximityNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display; //Display*
XID window;
XID deviceid;
XID root;
XID subwindow;
unsigned long time;
int x, y;
int x_root;
int y_root;
unsigned int state;
int same_screen;
unsigned int device_state;
unsigned char axes_count;
unsigned char first_axis;
int axis_data[6];
} my_XProximityNotifyEvent_t;
typedef struct my_XDeviceStateNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display; //Display*
XID window;
XID deviceid;
unsigned long time;
int num_classes;
char data[64];
} my_XDeviceStateNotifyEvent_t;
typedef struct my_XDeviceMappingEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
XID deviceid;
unsigned long time;
int request;
int first_keycode;
int count;
} my_XDeviceMappingEvent_t;
typedef struct my_XChangeDeviceNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
XID deviceid;
unsigned long time;
int request;
} my_XChangeDeviceNotifyEvent_t;
typedef struct my_XDevicePresenceNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
unsigned long time;
int devchange;
XID deviceid;
XID control;
} my_XDevicePresenceNotifyEvent_t;
typedef struct my_XDevicePropertyNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
unsigned long time;
XID deviceid;
XID atom;
int state;
} my_XDevicePropertyNotifyEvent_t;
typedef struct my_XInputClass_s {
unsigned char class;
unsigned char length;
} my_XInputClass_t;
typedef struct my_XDeviceState_s {
XID device_id;
int num_classes;
my_XInputClass_t* data;
} my_XDeviceState_t;
typedef struct my_XFixesSelectionNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
int subtype;
XID owner;
XID selection;
unsigned long timestamp;
unsigned long selection_timestamp;
} my_XFixesSelectionNotifyEvent_t;
typedef struct my_XFixesCursorNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
int subtype;
unsigned long cursor_serial;
unsigned long timestamp;
XID cursor_name;
} my_XFixesCursorNotifyEvent_t;
typedef struct my_XRRScreenChangeNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
XID root;
unsigned long timestamp;
unsigned long config_timestamp;
uint16_t size_index;
uint16_t subpixel_order;
uint16_t rotation;
int width;
int height;
int mwidth;
int mheight;
} my_XRRScreenChangeNotifyEvent_t;
typedef struct my_XRRNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
int subtype;
} my_XRRNotifyEvent_t;
typedef struct my_XRROutputChangeNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
int subtype;
XID output;
XID crtc;
XID mode;
uint16_t rotation;
uint16_t connection;
uint16_t subpixel_order;
} my_XRROutputChangeNotifyEvent_t;
typedef struct my_XRRCrtcChangeNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
int subtype;
XID crtc;
XID mode;
uint16_t rotation;
int x, y;
unsigned int width, height;
} my_XRRCrtcChangeNotifyEvent_t;
typedef struct my_XRROutputPropertyNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
int subtype;
XID output;
XID property;
unsigned long timestamp;
int state;
} my_XRROutputPropertyNotifyEvent_t;
typedef struct my_XRRProviderChangeNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
int subtype;
XID provider;
unsigned long timestamp;
unsigned int current_role;
} my_XRRProviderChangeNotifyEvent_t;
typedef struct my_XRRProviderPropertyNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
int subtype;
XID provider;
XID property;
unsigned long timestamp;
int state;
} my_XRRProviderPropertyNotifyEvent_t;
typedef struct my_XRRResourceChangeNotifyEvent_s
{
int type;
unsigned long serial;
int send_event;
void* display;
XID window;
int subtype;
unsigned long timestamp;
} my_XRRResourceChangeNotifyEvent_t;
typedef struct my_XcursorCursors_s {
void* dpy; //Display*
int ref;
int ncursor;
void* cursors; //Cursor*
} my_XcursorCursors_t;
typedef struct my_XcursorImage_s {
uint32_t version;
uint32_t size;
uint32_t width;
uint32_t height;
uint32_t xhot;
uint32_t yhot;
uint32_t delay;
void* pixels;
} my_XcursorImage_t;
typedef struct my_XcursorImages_s {
int nimage;
my_XcursorImage_t** images;
char* name;
} my_XcursorImages_t;
typedef struct my_XExtCodes_s {
int extension;
int major_opcode;
int first_event;
int first_error;
} my_XExtCodes_t;
typedef struct my_XExtDisplayInfo_s {
struct my_XExtDisplayInfo_s *next;
void* display; //Didsplay*
my_XExtCodes_t *codes;
void* data;
} my_XExtDisplayInfo_t;
typedef struct my_XExtensionInfo_s {
my_XExtDisplayInfo_t *head;
my_XExtDisplayInfo_t *cur;
int ndisplays;
} my_XExtensionInfo_t;
typedef struct my_XCharStruct_s {
short lbearing;
short rbearing;
short width;
short ascent;
short descent;
unsigned short attributes;
} my_XCharStruct_t;
typedef struct my_XFontProp_s {
XID name;
unsigned long card32;
} my_XFontProp_t;
typedef struct my_XFontStruct_s {
void* ext_data; //XExtData*
XID fid;
unsigned direction;
unsigned min_char_or_byte2;
unsigned max_char_or_byte2;
unsigned min_byte1;
unsigned max_byte1;
int all_chars_exist;
unsigned default_char;
int n_properties;
my_XFontProp_t* properties;
my_XCharStruct_t min_bounds;
my_XCharStruct_t max_bounds;
my_XCharStruct_t* per_char;
int ascent;
int descent;
} my_XFontStruct_t;
typedef struct my_XExtensionHooks_s {
int (*create_gc)(void* dpy, void* gc, my_XExtCodes_t* e);
int (*copy_gc)(void* dpy, void* gc, my_XExtCodes_t* e);
int (*flush_gc)(void* dpy, void* gc, my_XExtCodes_t* e);
int (*free_gc)(void* dpy, void* gc, my_XExtCodes_t* e);
int (*create_font)(void* dpy, my_XFontStruct_t* f, my_XExtCodes_t* e);
int (*free_font)(void* dpy, my_XFontStruct_t* f, my_XExtCodes_t* e);
int (*close_display)(void* dpy, my_XExtCodes_t* e);
int (*wire_to_event)(void* dpy, my_XEvent_t* evt, void* xEvent);
int (*event_to_wire)(void* dpy, my_XEvent_t* evt, void* xEvent);
int (*error)(void* dpy, void* xError, my_XExtCodes_t* e, int* n);
char*(*error_string)(void* dpy, int, my_XExtCodes_t* e, char* s, int n);
} my_XExtensionHooks_t;
typedef struct my_XRRPropertyInfo_s {
int pending;
int range;
int immutable;
int num_values;
long* values;
} my_XRRPropertyInfo_t;
typedef struct my_XShmSegmentInfo_s {
XID shmseg;
int shmid;
char* shmaddr;
int readOnly;
} my_XShmSegmentInfo_t;
typedef struct my_XkbNamesRec_s {
XID keycodes;
XID geometry;
XID symbols;
XID types;
XID compat;
XID vmods[16];
XID indicators[32];
XID groups[4];
void* keys; //XkbKeyNameRec* as array[xkb->max_key_code + 1]
void* key_aliases; //XkbKeyAliasRec* as array[num_key_aliases]
XID* radio_groups;
XID phys_symbols;
unsigned char num_keys;
unsigned char num_key_aliases;
unsigned short num_rg;
} my_XkbNamesRec_t;
typedef struct my_XkbClientMapRec_s {
unsigned char size_types;
unsigned char num_types;
void* types; //XkbKeyTypePtr
unsigned short size_syms;
unsigned short num_syms;
void* syms; //KeySym*
void* key_sym_map; //XkbSymMapPtr
unsigned char* modmap;
} my_XkbClientMapRec_t;
typedef struct my_XkbDescRec_s {
my_XDisplay_t* display;
unsigned short flags;
unsigned short device_spec;
uint8_t min_key_code;
uint8_t max_key_code;
void* ctrls; //XkbControlsPtr
void* server; //XkbServerMapPtr
my_XkbClientMapRec_t* map; //XkbClientMapPtr
void* indicators; //XkbIndicatorPtr
my_XkbNamesRec_t* names;
void* compat; //XkbCompatMapPtr
void* geom; //XkbGeometryPtr
} my_XkbDescRec_t;
typedef struct my_XmbTextItem_s {
void* chars; //char*
int nchars;
int delta;
void* font_set; //XFontSet
} my_XmbTextItem_t;
typedef struct my_XwcTextItem_s {
void* chars; //wchar_t*
int nchars;
int delta;
void* font_set; //XFontSet
} my_XwcTextItem_t;
typedef struct my_XAnyClassinfo_s {
XID c_class;
int length;
} my_XAnyClassInfo_t;
typedef struct my_XKeyInfo_s
{
XID c_class;
int length;
unsigned short min_keycode;
unsigned short max_keycode;
unsigned short num_keys;
} my_XKeyInfo_t;
typedef struct my_XButtonInfo_s
{
XID c_class;
int length;
short num_buttons;
} my_XButtonInfo_t;
typedef struct my_XValuatorInfo_s
{
XID c_class;
int length;
unsigned char num_axes;
unsigned char mode;
unsigned long motion_buffer;
void* axes; //XAxisInfoPtr
} my_XValuatorInfo_t;
typedef struct my_XDeviceInfo_s
{
XID id;
XID type;
char* name;
int num_classes;
int use;
my_XAnyClassInfo_t* inputclassinfo;
} my_XDeviceInfo_t;
typedef struct my_XTimeCoord_s {
unsigned long time;
short x, y;
} my_XTimeCoord_t;
typedef struct my_XDeviceTimeCoord_s {
unsigned long time;
int* data;
} my_XDeviceTimeCoord_t;
typedef struct my_XFixesCursorImage_s {
short x, y;
unsigned short width, height;
unsigned short xhot, yhot;
unsigned long cursor_serial;
unsigned long* pixels;
XID atom; /* Version >= 2 only */
void* name; /* Version >= 2 only */
} my_XFixesCursorImage_t;
typedef struct my_XFilters_s {
int nfilter;
char **filter;
int nalias;
short *alias;
} my_XFilters_t;
typedef struct my__XRRMonitorInfo_s {
XID name;
int primary;
int automatic;
int noutput;
int x;
int y;
int width;
int height;
int mwidth;
int mheight;
XID* outputs;
} my_XRRMonitorInfo_t;
#endif//MY_X11_DEFS
|