@@ -945,73 +945,82 @@ struct xError{
945945enum ELFlagFocus = 1 << 0 ;
946946enum ELFlagSameScreen = 1 << 1 ;
947947struct _xEvent {
948- union u {
949- struct u {
948+ union {
949+ struct U {
950950 BYTE type;
951951 BYTE detail;
952952 CARD16 sequenceNumber;
953- }
954- struct keyButtonPointer {
953+ } U u;
954+
955+ struct KeyButtonPointer {
955956 CARD32 pad00;
956957 Time time;
957958 Window root, event, child;
958959 INT16 rootX, rootY, eventX, eventY;
959960 KeyButMask state;
960961 BOOL sameScreen;
961962 BYTE pad1;
962- }
963- struct enterLeave {
963+ } KeyButtonPointer keyButtonPointer;
964+
965+ struct EnterLeave {
964966 CARD32 pad00;
965967 Time time;
966968 Window root, event, child;
967969 INT16 rootX, rootY, eventX, eventY;
968970 KeyButMask state;
969971 BYTE mode; /* really XMode */
970972 BYTE flags; /* sameScreen and focus booleans, packed together */
971- }
972- struct focus {
973+ } EnterLeave enterLeave;
974+
975+ struct Focus {
973976 CARD32 pad00;
974977 Window window;
975978 BYTE mode; /* really XMode */
976979 BYTE pad1, pad2, pad3;
977- }
978- struct expose {
980+ } Focus focus;
981+
982+ struct Expose {
979983 CARD32 pad00;
980984 Window window;
981985 CARD16 x, y, width, height;
982986 CARD16 count;
983987 CARD16 pad2;
984- }
985- struct graphicsExposure {
988+ } Expose expose;
989+
990+ struct GraphicsExposure {
986991 CARD32 pad00;
987992 Drawable drawable;
988993 CARD16 x, y, width, height;
989994 CARD16 minorEvent;
990995 CARD16 count;
991996 BYTE majorEvent;
992997 BYTE pad1, pad2, pad3;
993- }
994- struct noExposure {
998+ } GraphicsExposure graphicsExposure;
999+
1000+ struct NoExposure {
9951001 CARD32 pad00;
9961002 Drawable drawable;
9971003 CARD16 minorEvent;
9981004 BYTE majorEvent;
9991005 BYTE bpad;
1000- }
1001- struct visibility {
1006+ } NoExposure noExposure;
1007+
1008+ struct Visibility {
10021009 CARD32 pad00;
10031010 Window window;
10041011 CARD8 state;
10051012 BYTE pad1, pad2, pad3;
1006- }
1007- struct createNotify {
1013+ } Visibility visibility;
1014+
1015+ struct CreateNotify {
10081016 CARD32 pad00;
10091017 Window parent, window;
10101018 INT16 x, y;
10111019 CARD16 width, height, borderWidth;
10121020 BOOL c_override;
10131021 BYTE bpad;
1014- }
1022+ } CreateNotify createNotify;
1023+
10151024 /*
10161025 * The event fields in the structures for DestroyNotify, UnmapNotify,
10171026 * MapNotify, ReparentNotify, ConfigureNotify, CirculateNotify, GravityNotify,
@@ -1020,123 +1029,141 @@ struct _xEvent {
10201029 * Also note that MapRequest, ConfigureRequest and CirculateRequest have
10211030 * the same offset for the event window.
10221031 */
1023- struct destroyNotify {
1032+ struct DestroyNotify {
10241033 CARD32 pad00;
10251034 Window event, window;
1026- }
1027- struct unmapNotify {
1035+ } DestroyNotify destroyNotify;
1036+
1037+ struct UnmapNotify {
10281038 CARD32 pad00;
10291039 Window event, window;
10301040 BOOL fromConfigure;
10311041 BYTE pad1, pad2, pad3;
1032- }
1033- struct mapNotify {
1042+ } UnmapNotify unmapNotify;
1043+
1044+ struct MapNotify {
10341045 CARD32 pad00;
10351046 Window event, window;
10361047 BOOL c_override;
10371048 BYTE pad1, pad2, pad3;
1038- }
1039- struct mapRequest {
1049+ } MapNotify mapNotify;
1050+
1051+ struct MapRequest {
10401052 CARD32 pad00;
10411053 Window parent, window;
1042- }
1043- struct reparent {
1054+ } MapRequest mapRequest;
1055+
1056+ struct Reparent {
10441057 CARD32 pad00;
10451058 Window event, window, parent;
10461059 INT16 x, y;
10471060 BOOL c_override;
10481061 BYTE pad1, pad2, pad3;
1049- }
1050- struct configureNotify {
1062+ } Reparent reparent;
1063+
1064+ struct ConfigureNotify {
10511065 CARD32 pad00;
10521066 Window event, window, aboveSibling;
10531067 INT16 x, y;
10541068 CARD16 width, height, borderWidth;
10551069 BOOL c_override;
10561070 BYTE bpad;
1057- }
1058- struct configureRequest {
1071+ } ConfigureNotify configureNotify;
1072+
1073+ struct ConfigureRequest {
10591074 CARD32 pad00;
10601075 Window parent, window, sibling;
10611076 INT16 x, y;
10621077 CARD16 width, height, borderWidth;
10631078 CARD16 valueMask;
10641079 CARD32 pad1;
1065- }
1066- struct gravity {
1080+ } ConfigureRequest configureRequest;
1081+
1082+ struct Gravity {
10671083 CARD32 pad00;
10681084 Window event, window;
10691085 INT16 x, y;
10701086 CARD32 pad1, pad2, pad3, pad4;
1071- }
1072- struct resizeRequest {
1087+ } Gravity gravity;
1088+
1089+ struct ResizeRequest {
10731090 CARD32 pad00;
10741091 Window window;
10751092 CARD16 width, height;
1076- }
1077- struct circulate {
1093+ } ResizeRequest resizeRequest;
1094+
1095+ struct Circulate {
10781096 /* The event field in the circulate record is really the parent when this
10791097 is used as a CirculateRequest instead of a CirculateNotify */
10801098 CARD32 pad00;
10811099 Window event, window, parent;
10821100 BYTE place; /* Top or Bottom */
10831101 BYTE pad1, pad2, pad3;
1084- }
1085- struct property {
1102+ } Circulate circulate;
1103+
1104+ struct Property {
10861105 CARD32 pad00;
10871106 Window window;
10881107 Atom atom;
10891108 Time time;
10901109 BYTE state; /* NewValue or Deleted */
10911110 BYTE pad1;
10921111 CARD16 pad2;
1093- }
1094- struct selectionClear {
1112+ } Property property;
1113+
1114+ struct SelectionClear {
10951115 CARD32 pad00;
10961116 Time time;
10971117 Window window;
10981118 Atom atom;
1099- }
1100- struct selectionRequest {
1119+ } SelectionClear selectionClear;
1120+
1121+ struct SelectionRequest {
11011122 CARD32 pad00;
11021123 Time time;
11031124 Window owner, requestor;
11041125 Atom selection, target, property;
1105- }
1106- struct selectionNotify {
1126+ } SelectionRequest selectionRequest;
1127+
1128+ struct SelectionNotify {
11071129 CARD32 pad00;
11081130 Time time;
11091131 Window requestor;
11101132 Atom selection, target, property;
1111- }
1112- struct colormap {
1133+ } SelectionNotify selectionNotify;
1134+
1135+ struct Colormap {
11131136 CARD32 pad00;
11141137 Window window;
1115- Colormap colormap;
1138+ . Colormap colormap;
11161139 BOOL c_new;
11171140 BYTE state; /* Installed or UnInstalled */
11181141 BYTE pad1, pad2;
1119- }
1120- struct mappingNotify {
1142+ } Colormap colormap;
1143+
1144+ struct MappingNotify {
11211145 CARD32 pad00;
11221146 CARD8 request;
11231147 KeyCode firstKeyCode;
11241148 CARD8 count;
11251149 BYTE pad1;
1126- }
1127- struct clientMessage {
1150+ } MappingNotify mappingNotify;
1151+
1152+ struct ClientMessage {
11281153 CARD32 pad00;
11291154 Window window;
1130- union u{
1131- struct l {
1155+ union
1156+ {
1157+ struct L {
11321158 Atom type;
11331159 INT32 longs0;
11341160 INT32 longs1;
11351161 INT32 longs2;
11361162 INT32 longs3;
11371163 INT32 longs4;
1138- }
1139- struct s {
1164+ } L l;
1165+
1166+ struct S {
11401167 Atom type;
11411168 INT16 shorts0;
11421169 INT16 shorts1;
@@ -1148,16 +1175,18 @@ struct _xEvent {
11481175 INT16 shorts7;
11491176 INT16 shorts8;
11501177 INT16 shorts9;
1151- }
1152- struct b {
1178+ } S s;
1179+
1180+ struct B {
11531181 Atom type;
11541182 INT8 [20 ] bytes;
1155- }
1183+ } B b;
11561184 }
11571185 }
11581186 }
11591187}
11601188alias _xEvent xEvent;
1189+ static assert (xEvent.sizeof == sz_xEvent);
11611190
11621191/* ********************************************************
11631192 *
0 commit comments