Unix.X11Api.Mod 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161
  1. MODULE X11Api; (** AUTHOR "fnecati"; PURPOSE "some missing types, const and functions in Unix.X11.Mod"; *)
  2. IMPORT
  3. X11, Unix, Modules, SYSTEM;
  4. TYPE
  5. PChar* = POINTER TO ARRAY OF CHAR;
  6. VisualPtr = X11.VisualPtr;
  7. VisualInfoPtr* = POINTER {UNSAFE, UNTRACED} TO X11.VisualInfo;
  8. DisplayPtr* = X11.DisplayPtr;
  9. Window * = X11.Window;
  10. Time* = X11.Time;
  11. Pixmap = X11.Pixmap;
  12. Cursor* = X11.Cursor;
  13. Atom* = X11.Atom;
  14. XID* = ADDRESS;
  15. Drawable* = X11.Drawable;
  16. Colormap* = X11.Colormap;
  17. ComposeStatus* = RECORD
  18. composePtr*: ADDRESS; (* state table pointer *)
  19. charsMatched*: WORD; (* match state *)
  20. END ;
  21. KeySym* = X11.KeySym;
  22. (* Cursor control & motion *)
  23. (* X11/keysymdef.h *)
  24. CONST
  25. XK_Home* = 0FF50H;
  26. XK_Left* = 0FF51H; (* Move left, left arrow *)
  27. XK_Up* = 0FF52H; (* Move up, up arrow *)
  28. XK_Right* = 0FF53H; (* Move right, right arrow *)
  29. XK_Down* = 0FF54H; (* Move down, down arrow *)
  30. XK_Prior* = 0FF55H; (* Prior, previous *)
  31. XK_Page_Up* = 0FF55H;
  32. XK_Next* = 0FF56H; (* Next *)
  33. XK_Page_Down* = 0FF56H;
  34. XK_End* = 0FF57H; (* EOL *)
  35. XK_Begin* = 0FF58H; (* BOL *)
  36. XK_Escape* = 0FF1BH;
  37. XK_F1* =0FFBEH;
  38. (* X11/X.h *)
  39. (* ****************************************************************
  40. RESERVED RESOURCE AND CONSTANT DEFINITIONS
  41. **************************************************************** *)
  42. None* = 0; (* universal null resource or null atom *)
  43. ParentRelative* = 1; (* background pixmap in CreateWindow
  44. and ChangeWindowAttributes *)
  45. CopyFromParent* = 0; (* border pixmap in CreateWindow
  46. and ChangeWindowAttributes
  47. special VisualID and special window
  48. class passed to CreateWindow *)
  49. PointerWindow* = 0; (* destination window in SendEvent *)
  50. InputFocus* = 1; (* destination window in SendEvent *)
  51. PointerRoot* = 1; (* focus window in SetInputFocus *)
  52. AnyPropertyType* = 0; (* special Atom, passed to GetProperty *)
  53. AnyKey* = 0; (* special Key Code, passed to GrabKey *)
  54. AnyButton* = 0; (* special Button Code, passed to GrabButton *)
  55. AllTemporary* = 0; (* special Resource ID passed to KillClient *)
  56. CurrentTime* = 0; (* special Time *)
  57. NoSymbol* = 0; (* special KeySym *)
  58. (* EVENT DEFINITIONS
  59. Input Event Masks. Used as event-mask window attribute and as arguments
  60. to Grab requests. Not to be confused with event names. *)
  61. CONST
  62. NoEventMask* = 0H; KeyPressMask* = 1H; KeyReleaseMask* = 2H;
  63. ButtonPressMask* = 4H; ButtonReleaseMask* = 8H; EnterWindowMask* = 10H;
  64. LeaveWindowMask* = 20H; PointerMotionMask* = 40H; PointerMotionHintMask* = 80H;
  65. Button1MotionMask* = 100H; Button2MotionMask* = 200H; Button3MotionMask* = 400H;
  66. Button4MotionMask* = 800H; Button5MotionMask* = 1000H; ButtonMotionMask* = 2000H;
  67. KeymapStateMask* = 4000H; ExposureMask* = 8000H; VisibilityChangeMask* = 10000H;
  68. StructureNotifyMask* = 20000H; ResizeRedirectMask* = 40000H; SubstructureNotifyMask* = 80000H;
  69. SubstructureRedirectMask* = 100000H; FocusChangeMask * = 200000H; PropertyChangeMask* = 400000H;
  70. ColormapChangeMask* = 800000H; OwnerGrabButtonMask* = 1000000H;
  71. (* Event names. Used in "type" field in XEvent structures. Not to be
  72. confused with event masks above. They start from 2 because 0 and 1
  73. are reserved in the protocol for errors and replies. *)
  74. CONST
  75. KeyPress* = 2; KeyRelease* =3; ButtonPress* = 4; ButtonRelease* = 5; MotionNotify* =6;
  76. EnterNotify* = 7; LeaveNotify* =8; FocusIn* = 9; FocusOut* = 10; KeymapNotify* = 11;
  77. Expose* = 12; GraphicsExpose* = 13; NoExpose* = 14; VisibilityNotify* = 15;
  78. CreateNotify* = 16; DestroyNotify* = 17; UnmapNotify* = 18; MapNotify* = 19;
  79. MapRequest* = 20; ReparentNotify* = 21; ConfigureNotify* = 22; ConfigureRequest* = 23;
  80. GravityNotify* = 24; ResizeRequest* = 25; CirculateNotify* = 26; CirculateRequest* = 27;
  81. PropertyNotify* = 28; SelectionClear* = 29; SelectionRequest* =30; SelectionNotify* = 31;
  82. ColormapNotify* = 32; ClientMessage* = 33; MappingNotify* = 34; GenericEvent* = 35;
  83. LASTEvent* = 36; (* must be bigger than any event # *)
  84. (* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
  85. state in various key-, mouse-, and button-related events. *)
  86. ShiftMask* = 0; LockMask* = 1; ControlMask* = 2;
  87. Mod1Mask* = 3; Mod2Mask* = 4; Mod3Mask* = 5;
  88. Mod4Mask* = 6; Mod5Mask* = 7;
  89. (* modifier names. Used to build a SetModifierMapping request or
  90. to read a GetModifierMapping request. These correspond to the
  91. masks defined above. *)
  92. ShiftMapIndex* = 0; LockMapIndex* = 1; ControlMapIndex* = 2;
  93. Mod1MapIndex* = 3; Mod2MapIndex* = 4; Mod3MapIndex* = 5;
  94. Mod4MapIndex* = 6; Mod5MapIndex* = 7;
  95. (* button masks. Used in same manner as Key masks above. Not to be confused
  96. with button names below. *)
  97. Button1Mask* = 8; Button2Mask* = 9; Button3Mask* = 10;
  98. Button4Mask* = 11; Button5Mask* = 12;
  99. AnyModifier* = 15; (* used in GrabButton, GrabKey *)
  100. (* button names. Used as arguments to GrabButton and as detail in ButtonPress
  101. and ButtonRelease events. Not to be confused with button masks above.
  102. Note that 0 is already defined above as "AnyButton". *)
  103. Button1* = 1; Button2* = 2; Button3* = 3;
  104. Button4* = 4; Button5* = 5;
  105. (* Notify modes *)
  106. NotifyNormal* = 0; NotifyGrab* = 1; NotifyUngrab* = 2; NotifyWhileGrabbed* = 3;
  107. NotifyHint* = 1; (* for MotionNotify events *)
  108. (* Notify detail *)
  109. NotifyAncestor* = 0; NotifyVirtual* = 1; NotifyInferior* = 2; NotifyNonlinear* = 3;
  110. NotifyNonlinearVirtual* = 4; NotifyPointer* = 5; NotifyPointerRoot* = 6;
  111. NotifyDetailNone* = 7;
  112. (* Visibility notify *)
  113. VisibilityUnobscured* = 0; VisibilityPartiallyObscured* = 1; VisibilityFullyObscured* = 2;
  114. (* Circulation request *)
  115. PlaceOnTop* = 0; PlaceOnBottom* = 1;
  116. (* protocol families *)
  117. FamilyInternet* = 0; (* IPv4 *) FamilyDECnet* = 1; FamilyChaos* = 2; FamilyInternet6* = 6; (* IPv6 *)
  118. (* authentication families not tied to a specific protocol *)
  119. FamilyServerInterpreted* = 5;
  120. (* Property notification *)
  121. PropertyNewValue* = 0; PropertyDelete* = 1;
  122. (* Color Map notification *)
  123. ColormapUninstalled* = 0; ColormapInstalled* = 1;
  124. (* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes *)
  125. GrabModeSync* = 0; GrabModeAsync* = 1;
  126. (* GrabPointer, GrabKeyboard reply status *)
  127. GrabSuccess* = 0; AlreadyGrabbed* = 1; GrabInvalidTime* = 2; GrabNotViewable* = 3; GrabFrozen* = 4;
  128. (* AllowEvents modes *)
  129. AsyncPointer* = 0; SyncPointer* = 1; ReplayPointer* = 2; AsyncKeyboard* = 3;
  130. SyncKeyboard* = 4; ReplayKeyboard* = 5; AsyncBoth* = 6; SyncBoth* = 7;
  131. (* Used in SetInputFocus, GetInputFocus *)
  132. RevertToNone* = None; RevertToPointerRoot* = PointerRoot; RevertToParent* = 2;
  133. (* ****************************************************************
  134. ERROR CODES
  135. **************************************************************** *)
  136. CONST
  137. Success* = 0; (* everything's okay *)
  138. BadRequest* = 1; (* bad request code *)
  139. BadValue* = 2; (* int parameter out of range *)
  140. BadWindow* = 3; (* parameter not a Window *)
  141. BadPixmap* = 4; (* parameter not a Pixmap *)
  142. BadAtom* = 5; (* parameter not an Atom *)
  143. BadCursor* = 6; (* parameter not a Cursor *)
  144. BadFont* = 7; (* parameter not a Font *)
  145. BadMatch* = 8; (* parameter mismatch *)
  146. BadDrawable* = 9; (* parameter not a Pixmap or Window *)
  147. BadAccess* = 10; (* depending on context:
  148. - key/button already grabbed
  149. - attempt to free an illegal
  150. cmap entry
  151. - attempt to store into a read-only
  152. color map entry.
  153. - attempt to modify the access control
  154. list from other than the local host.
  155. *)
  156. BadAlloc* = 11; (* insufficient resources *)
  157. BadColor* = 12; (* no such colormap *)
  158. BadGC* = 13; (* parameter not a GC *)
  159. BadIDChoice* = 14; (* choice not in range or already used *)
  160. BadName* = 15; (* font or color name doesn't exist *)
  161. BadLength* = 16; (* Request length incorrect *)
  162. BadImplementation* = 17; (* server is defective *)
  163. FirstExtensionError* = 128;
  164. LastExtensionError* = 255;
  165. (* ****************************************************************
  166. WINDOW DEFINITIONS
  167. **************************************************************** *)
  168. (* Window classes used by CreateWindow *)
  169. (* Note that CopyFromParent is already defined as 0 above *)
  170. InputOutput* = 1; InputOnly* = 2;
  171. (* Window attributes for CreateWindow and ChangeWindowAttributes *)
  172. CWBackPixmap* = 1H; CWBackPixel* = 2H; CWBorderPixmap* = 4H; CWBorderPixel* = 8H;
  173. CWBitGravity* = 10H; CWWinGravity* = 20H; CWBackingStore* = 40H; CWBackingPlanes* = 80;
  174. CWBackingPixel* = 100H; CWOverrideRedirect* = 200H; CWSaveUnder* =400H; CWEventMask* =800H;
  175. CWDontPropagate* =1000H; CWColormap* = 2000H; CWCursor* =4000H;
  176. (* ConfigureWindow structure *)
  177. CWX* = 1H; CWY* = 2H; CWWidth* = 4H; CWHeight* = 8H; CWBorderWidth* = 10H;
  178. CWSibling* = 20H; CWStackMode* = 40H;
  179. (* Bit Gravity *)
  180. ForgetGravity* = 0; NorthWestGravity* = 1; NorthGravity* = 2; NorthEastGravity* = 3;
  181. WestGravity* = 4; CenterGravity *= 5; EastGravity* = 6; SouthWestGravity* = 7;
  182. SouthGravity* = 8; SouthEastGravity* = 9; StaticGravity* = 10;
  183. (* Window gravity + bit gravity above *)
  184. UnmapGravity* = 0;
  185. (* Used in CreateWindow for backing-store hint *)
  186. NotUseful* = 0; WhenMapped* = 1; Always*= 2;
  187. (* Used in GetWindowAttributes reply *)
  188. IsUnmapped* = 0; IsUnviewable* = 1; IsViewable*= 2;
  189. (* Used in ChangeSaveSet *)
  190. SetModeInsert* = 0; SetModeDelete* = 1;
  191. (* Used in ChangeCloseDownMode *)
  192. DestroyAll* = 0; RetainPermanent* = 1; RetainTemporary* = 2;
  193. (* Window stacking method (in configureWindow) *)
  194. Above* = 0; Below* =1; TopIf* = 2; BottomIf* = 3; Opposite* = 4;
  195. (* Circulation direction *)
  196. RaiseLowest* = 0; LowerHighest* = 1;
  197. (* Property modes *)
  198. PropModeReplace* = 0; PropModePrepend* = 1; PropModeAppend * = 2;
  199. (* ****************************************************************
  200. GRAPHICS DEFINITIONS not translated yet
  201. **************************************************************** *)
  202. (* ****************************************************************
  203. FONTS
  204. ************************************************************* *)
  205. (* used in QueryFont -- draw direction *)
  206. FontLeftToRight* = 0;
  207. FontRightToLeft* = 1;
  208. FontChange* = 255;
  209. (* ****************************************************************
  210. IMAGING
  211. ************************************************************** *)
  212. (* ImageFormat -- PutImage, GetImage *)
  213. XYBitmap* = 0; (* depth 1, XYFormat *)
  214. XYPixmap* = 1; (* depth == drawable depth *)
  215. ZPixmap* = 2; (* depth == drawable depth *)
  216. (* ****************************************************************
  217. COLOR MAP STUFF
  218. ***************************************************************** *)
  219. (* For CreateColormap *)
  220. AllocNone* = 0; (* create map with no entries *)
  221. AllocAll* = 1; (* allocate entire map writeable *)
  222. (* Flags used in StoreNamedColor, StoreColors *)
  223. DoRed* = 1H; DoGreen* = 2H; DoBlue* = 4H;
  224. (* ****************************************************************
  225. CURSOR STUFF
  226. **************************************************************** *)
  227. (* QueryBestSize Class *)
  228. CursorShape* = 0; (* largest size that can be displayed *)
  229. TileShape* = 1; (* size tiled fastest *)
  230. StippleShape* = 2; (* size stippled fastest *)
  231. (* ****************************************************************
  232. KEYBOARD/POINTER STUFF
  233. **************************************************************** *)
  234. AutoRepeatModeOff*= 0; AutoRepeatModeOn* = 1; AutoRepeatModeDefault* = 2;
  235. LedModeOff* = 0; LedModeOn* = 1;
  236. (* masks for ChangeKeyboardControl *)
  237. KBKeyClickPercent* = 1H; KBBellPercent* = 2H; KBBellPitch* = 4H; KBBellDuration* = 8H;
  238. KBLed* = 10H; KBLedMode* = 20H; KBKey* = 40H; KBAutoRepeatMode* = 80;
  239. MappingSuccess* = 0; MappingBusy* = 1; MappingFailed* = 2;
  240. MappingModifier* = 0; MappingKeyboard* = 1; MappingPointer* = 2;
  241. (* ****************************************************************
  242. SCREEN SAVER STUFF
  243. **************************************************************** *)
  244. DontPreferBlanking* = 0; PreferBlanking* = 1; DefaultBlanking* = 2;
  245. DisableScreenSaver* = 0; DisableScreenInterval* = 0;
  246. DontAllowExposures* = 0; AllowExposures* = 1; DefaultExposures* =2;
  247. (* for ForceScreenSaver *)
  248. ScreenSaverReset* = 0; ScreenSaverActive* = 1;
  249. (* ****************************************************************
  250. HOSTS AND CONNECTIONS
  251. **************************************************************** *)
  252. (* for ChangeHosts *)
  253. HostInsert* = 0; HostDelete* = 1;
  254. (* for ChangeAccessControl *)
  255. EnableAccess* = 1; DisableAccess* = 0;
  256. (* Display classes used in opening the connection
  257. Note that the statically allocated ones are even numbered and the
  258. dynamically changeable ones are odd numbered *)
  259. StaticGray* = 0; GrayScale* = 1; StaticColor* = 2; PseudoColor* = 3;
  260. TrueColor* = 4; DirectColor* = 5;
  261. (* Byte order used in imageByteOrder and bitmapBitOrder *)
  262. LSBFirst* = 0; MSBFirst* = 1;
  263. (* ****************************************************************
  264. ATOMS <X11/Xatom.h>
  265. **************************************************************** *)
  266. (* Do not change! Changing this file implies a protocol change! *)
  267. XA_PRIMARY * = 1; XA_SECONDARY * = 2; XA_ARC * = 3; XA_ATOM * = 4; XA_BITMAP * = 5;
  268. XA_CARDINAL * = 6; XA_COLORMAP * = 7; XA_CURSOR * = 8; XA_CUT_BUFFER0 * = 9;
  269. XA_CUT_BUFFER1 * = 10; XA_CUT_BUFFER2 * = 11; XA_CUT_BUFFER3 * = 12; XA_CUT_BUFFER4 * = 13;
  270. XA_CUT_BUFFER5 * = 14; XA_CUT_BUFFER6 * = 15; XA_CUT_BUFFER7 * = 16; XA_DRAWABLE * = 17;
  271. XA_FONT * = 18; XA_INTEGER * = 19; XA_PIXMAP * = 20; XA_POINT * = 21; XA_RECTANGLE * = 22;
  272. XA_RESOURCE_MANAGER * = 23; XA_RGB_COLOR_MAP * = 24; XA_RGB_BEST_MAP * = 25;
  273. XA_RGB_BLUE_MAP * = 26; XA_RGB_DEFAULT_MAP * = 27; XA_RGB_GRAY_MAP * = 28;
  274. XA_RGB_GREEN_MAP * = 29; XA_RGB_RED_MAP * = 30; XA_STRING * = 31; XA_VISUALID * = 32;
  275. XA_WINDOW * = 33; XA_WM_COMMAND * = 34; XA_WM_HINTS * = 35; XA_WM_CLIENT_MACHINE * = 36;
  276. XA_WM_ICON_NAME * = 37; XA_WM_ICON_SIZE * = 38; XA_WM_NAME * = 39; XA_WM_NORMAL_HINTS * = 40;
  277. XA_WM_SIZE_HINTS * = 41; XA_WM_ZOOM_HINTS * = 42; XA_MIN_SPACE * = 43; XA_NORM_SPACE * = 44;
  278. XA_MAX_SPACE * = 45; XA_END_SPACE * = 46; XA_SUPERSCRIPT_X * = 47; XA_SUPERSCRIPT_Y * = 48;
  279. XA_SUBSCRIPT_X * = 49; XA_SUBSCRIPT_Y * = 50; XA_UNDERLINE_POSITION * = 51; XA_UNDERLINE_THICKNESS * = 52;
  280. XA_STRIKEOUT_ASCENT * = 53; XA_STRIKEOUT_DESCENT * = 54; XA_ITALIC_ANGLE * = 55;
  281. XA_X_HEIGHT * = 56; XA_QUAD_WIDTH * = 57; XA_WEIGHT * = 58; XA_POINT_SIZE * = 59;
  282. XA_RESOLUTION * = 60; XA_COPYRIGHT * = 61; XA_NOTICE * = 62; XA_FONT_NAME * = 63;
  283. XA_FAMILY_NAME * = 64; XA_FULL_NAME * = 65; XA_CAP_HEIGHT * = 66; XA_WM_CLASS * = 67;
  284. XA_WM_TRANSIENT_FOR * = 68; XA_LAST_PREDEFINED * = 68;
  285. (* ****************************************************************
  286. CURSORS <X11/Xcursorfont.h>
  287. **************************************************************** *)
  288. CONST
  289. XC_num_glyphs* = 154;
  290. XC_X_cursor* = 0; XC_arrow* = 2; XC_based_arrow_down* = 4; XC_based_arrow_up* = 6;
  291. XC_boat* = 8; XC_bogosity* = 10; XC_bottom_left_corner* = 12; XC_bottom_right_corner* = 14;
  292. XC_bottom_side* = 16; XC_bottom_tee* = 18; XC_box_spiral* = 20; XC_center_ptr* = 22;
  293. XC_circle* = 24; XC_clock* = 26; XC_coffee_mug* = 28; XC_cross* = 30; XC_cross_reverse* = 32;
  294. XC_crosshair* = 34; XC_diamond_cross* = 36; XC_dot* = 38; XC_dotbox* = 40; XC_double_arrow* = 42;
  295. XC_draft_large* = 44; XC_draft_small* = 46; XC_draped_box* = 48; XC_exchange* = 50;
  296. XC_fleur* = 52; XC_gobbler* = 54; XC_gumby* = 56; XC_hand1* = 58; XC_hand2* = 60;
  297. XC_heart* = 62; XC_icon* = 64; XC_iron_cross* = 66; XC_left_ptr* = 68; XC_left_side* = 70;
  298. XC_left_tee* = 72; XC_leftbutton* = 74; XC_ll_angle* = 76; XC_lr_angle* = 78; XC_man* = 80;
  299. XC_middlebutton* = 82; XC_mouse* = 84; XC_pencil* = 86; XC_pirate* = 88; XC_plus* = 90;
  300. XC_question_arrow* = 92; XC_right_ptr* = 94; XC_right_side* = 96; XC_right_tee* = 98;
  301. XC_rightbutton* = 100; XC_rtl_logo* = 102; XC_sailboat* = 104; XC_sb_down_arrow* = 106;
  302. XC_sb_h_double_arrow* = 108; XC_sb_left_arrow* = 110; XC_sb_right_arrow* = 112;
  303. XC_sb_up_arrow* = 114; XC_sb_v_double_arrow* = 116; XC_shuttle* = 118; XC_sizing* = 120;
  304. XC_spider* = 122; XC_spraycan* = 124; XC_star* = 126; XC_target* = 128; XC_tcross* = 130;
  305. XC_top_left_arrow* = 132; XC_top_left_corner* = 134; XC_top_right_corner* = 136;
  306. XC_top_side* = 138; XC_top_tee* = 140; XC_trek* = 142; XC_ul_angle* = 144;
  307. XC_umbrella* = 146; XC_ur_angle* = 148; XC_watch* = 150; XC_xterm* = 152;
  308. (* *********************************************** *)
  309. (* X11/Xlib.h*)
  310. (* *********************************************** *)
  311. TYPE
  312. Bool* = WORD;
  313. Status* = WORD;
  314. CONST
  315. True* = 1; False* = 0;
  316. QueuedAlready* = 0; QueuedAfterReading* = 1; QueuedAfterFlush* = 2;
  317. TYPE
  318. XSetWindowAttributes* = RECORD
  319. backgroundPixmap*: Pixmap; (* background, None, or ParentRelative *)
  320. backgroundPixel*: LONGWORD;(* background pixel *)
  321. borderPixmap*: Pixmap; (* border of the window or CopyFromParent *)
  322. borderPixel*: LONGWORD;(* border pixel value *)
  323. bitGravity*: WORD; (* one of bit gravity values *)
  324. winGravity*: WORD; (* one of the window gravity values *)
  325. backingStore*: WORD; (* NotUseful, WhenMapped, Always *)
  326. backingPlanes*: LONGWORD;(* planes to be preserved if possible *)
  327. backingPixel*: LONGWORD;(* value to use in restoring planes *)
  328. saveUnder*: BOOLEAN; (* should bits under be saved? (popups) *)
  329. eventMask*: LONGWORD; (* set of events that should be saved *)
  330. doNotPropagateMask*: LONGWORD;(* set of events that should not propagate *)
  331. overrideRedirect*: BOOLEAN; (* boolean value for override_redirect *)
  332. colormap*: Colormap; (* color map to be associated with window *)
  333. cursor*: Cursor ; (* cursor to be displayed (or None) *)
  334. END ;
  335. XWindowAttributes* = RECORD
  336. x*, y*: WORD; (* location of window *)
  337. width*, height*: WORD; (* width and height of window *)
  338. borderWidth*: WORD; (* border width of window *)
  339. depth*: WORD; (* depth of window *)
  340. visual* : VisualPtr; (* the associated visual structure *)
  341. root* : Window; (* root of screen containing window *)
  342. class*: WORD; (* InputOutput, InputOnly*)
  343. bitGravity*: WORD; (* one of the bit gravity values *)
  344. winGravity*: WORD; (* one of the window gravity values *)
  345. backingStore*: WORD; (* NotUseful, WhenMapped, Always *)
  346. backingPlanes*: LONGWORD; (* planes to be preserved if possible *)
  347. backingPixel*: LONGWORD; (* value to be used when restoring planes *)
  348. saveUnder*: BOOLEAN; (* boolean, should bits under be saved? *)
  349. colormap*: Colormap; (* color map to be associated with window *)
  350. mapInstalled*: BOOLEAN; (* boolean, is color map currently installed*)
  351. mapState*: WORD; (* IsUnmapped, IsUnviewable, IsViewable *)
  352. allEventMasks*: LONGWORD; (* set of events all people have interest in*)
  353. yourEventMask*: LONGWORD; (* my event mask *)
  354. doNotPropagateMask*: LONGWORD; (* set of events that should not propagate *)
  355. overrideRedirect*: BOOLEAN; (* boolean value for override-redirect *)
  356. screen*: ADDRESS; (*X11.Screen;*) (* back pointer to correct screen *)
  357. END;
  358. (* Data structure for host setting; getting routines. *)
  359. TYPE XHostAddress* = RECORD
  360. family* : WORD; (* for example FamilyInternet *)
  361. length* : WORD; (* length of address, in bytes *)
  362. address*: ADDRESS; (* pointer to where to find the bytes *)
  363. END;
  364. (* Data structure for ServerFamilyInterpreted addresses in host routines *)
  365. TYPE XServerInterpretedAddress* = RECORD
  366. typelength*: WORD; (* length of type string, in bytes *)
  367. valuelength*: WORD; (* length of value string, in bytes *)
  368. type*: ADDRESS; (* pointer to where to find the type string *)
  369. value*: ADDRESS; (* pointer to where to find the address *)
  370. END;
  371. (* Data structure for XReconfigureWindow *)
  372. TYPE XWindowChanges * = RECORD
  373. x*, y*: WORD;
  374. width*, height* : WORD;
  375. borderWidth*: WORD;
  376. sibling* : Window;
  377. stackMode*: WORD;
  378. END;
  379. (* new version containing base_width, base_height, and win_gravity fields;
  380. used with WM_NORMAL_HINTS.
  381. *)
  382. TYPE DataAspect*=RECORD
  383. x*: WORD; (* numerator *)
  384. y*: WORD; (* denominator *)
  385. END;
  386. TYPE XSizeHints* = RECORD
  387. flags*: LONGWORD; (* marks which fields in this structure are defined *) (* HUGEINT ?*)
  388. x*, y*: WORD; (* obsolete for new window mgrs, but clients *)
  389. width*, height*: WORD; (* should set so old wm's don't mess up *)
  390. minWidth*, minHeight*: WORD;
  391. maxWidth*, maxHeight*: WORD;
  392. widthInc*, heightInc*: WORD;
  393. maxAspect*, minAspect*: DataAspect;
  394. baseWidth*, baseHeight*: WORD; (* added by ICCCM version 1 *)
  395. winGravity*: WORD; (* added by ICCCM version 1 *)
  396. END;
  397. (* The next block of definitions are for window manager properties that
  398. clients and applications use for communication. *)
  399. (* flags argument in size hints *)
  400. CONST
  401. USPosition * = 1H; (* user specified x, y *)
  402. USSize * = 2H; (* user specified width, height *)
  403. PPosition * = 4H; (* program specified position *)
  404. PSize * = 8H; (* program specified size *)
  405. PMinSize * = 10H; (* program specified minimum size *)
  406. PMaxSize * = 20H; (* program specified maximum size *)
  407. PResizeInc * = 40H; (* program specified resize increments *)
  408. PAspect * = 80H; (* program specified min and max aspect ratios *)
  409. PBaseSize * = 100H; (* program specified base for incrementing *)
  410. PWinGravity * = 200H; (* program specified window gravity *)
  411. (* ******************************************** *)
  412. (* ******************************************** *)
  413. (* Definitions of specific events. from X11lib.h *)
  414. (*!
  415. This union is defined so Xlib can always use the same sized
  416. event structure internally, to avoid memory fragmentation.
  417. In C, XEvent type is union of all event types with size of 192 bytes ,
  418. In Oberon, other event fields are padded with chars to prevent memory leaks.
  419. Use type casting to obtain real event type.
  420. *)
  421. TYPE XEvent* = RECORD
  422. typ* : WORD; (* of event, must bot be changed; first element *)
  423. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  424. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  425. display* : DisplayPtr; (* Display the event was read from *)
  426. window* : Window; (* "event" window it is reported relative to *)
  427. pad*: ARRAY 192 - SIZE OF XAnyEvent OF CHAR;
  428. END;
  429. TYPE XAnyEvent * = RECORD
  430. typ* : WORD;
  431. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  432. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  433. display* : DisplayPtr;(* Display the event was read from *)
  434. window* : Window; (* window on which event was requested in event mask *)
  435. END;
  436. TYPE XKeyEvent * = RECORD
  437. typ* : WORD; (* of event *)
  438. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  439. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  440. display* : DisplayPtr; (* Display the event was read from *)
  441. window* : Window; (* "event" window it is reported relative to *)
  442. root* : Window; (* root window that the event occurred on *)
  443. subwindow* : Window; (* child window *)
  444. time* : Time; (* milliseconds *)
  445. x*, y* : WORD; (* pointer x, y coordinates in event window *)
  446. xRoot*, yRoot* : WORD; (* coordinates relative to root *)
  447. state* : WORDSET; (* key or button mask *)
  448. keycode* : WORD; (* detail *)
  449. sameScreen* : BOOLEAN; (* same screen flag *)
  450. END;
  451. TYPE XKeyPressedEvent* = XKeyEvent;
  452. TYPE XKeyReleasedEvent* = XKeyEvent;
  453. TYPE XButtonEvent * = RECORD
  454. typ* : WORD; (* of event *)
  455. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  456. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  457. display* : DisplayPtr; (* Display the event was read from *)
  458. window* : Window; (* "event" window it is reported relative to *)
  459. root* : Window; (* root window that the event occurred on *)
  460. subwindow* : Window; (* child window *)
  461. time* : Time; (* milliseconds *)
  462. x*, y* : WORD; (* pointer x, y coordinates in event window *)
  463. xRoot*, yRoot* : WORD; (* coordinates relative to root *)
  464. state* : WORDSET; (* key or button mask *)
  465. button* : WORD; (* detail *)
  466. sameScreen* : BOOLEAN; (* same screen flag *)
  467. END;
  468. TYPE XButtonPressedEvent* = XButtonEvent;
  469. TYPE XButtonReleasedEvent* = XButtonEvent;
  470. TYPE XMotionEvent * = RECORD
  471. typ* : WORD; (* of event *)
  472. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  473. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  474. display* : DisplayPtr; (* Display the event was read from *)
  475. window* : Window; (* "event" window reported relative to *)
  476. root* : Window; (* root window that the event occurred on *)
  477. subwindow* : Window; (* child window *)
  478. time* : Time; (* milliseconds *)
  479. x*, y* : WORD; (* pointer x, y coordinates in event window *)
  480. xRoot*, yRoot* : WORD; (* coordinates relative to root *)
  481. state* : WORDSET; (* key or button mask *)
  482. isHint* : CHAR; (* detail *)
  483. sameScreen* : Bool; (* same screen flag *)
  484. END;
  485. TYPE PointerMovedEvent* = XMotionEvent;
  486. TYPE XCrossingEvent * = RECORD
  487. typ* : WORD; (* of event *)
  488. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  489. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  490. display* : DisplayPtr; (* Display the event was read from *)
  491. window* : Window; (* "event" window reported relative to *)
  492. root* : Window; (* root window that the event occurred on *)
  493. subwindow* : Window; (* child window *)
  494. time* : Time; (* milliseconds *)
  495. x*, y* : WORD; (* pointer x, y coordinates in event window *)
  496. xRoot*, yRoot* : WORD; (* coordinates relative to root *)
  497. mode* : WORD; (* NotifyNormal, NotifyGrab, NotifyUngrab *)
  498. detail* : WORD;
  499. (*
  500. * NotifyAncestor, NotifyVirtual, NotifyInferior,
  501. * NotifyNonlinear,NotifyNonlinearVirtual
  502. *)
  503. sameScreen* : Bool; (* same screen flag *)
  504. focus* : Bool; (* boolean focus *)
  505. state* : WORDSET; (* key or button mask *)
  506. END;
  507. TYPE XEnterWindowEvent* = XCrossingEvent;
  508. TYPE XLeaveWindowEvent* = XCrossingEvent;
  509. TYPE XFocusChangeEvent * = RECORD
  510. typ* : WORD; (* FocusIn or FocusOut *)
  511. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  512. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  513. display* : DisplayPtr; (* Display the event was read from *)
  514. window* : Window; (* window of event *)
  515. mode* : LONGINT; (* NotifyNormal, NotifyWhileGrabbed, NotifyGrab, NotifyUngrab *)
  516. detail* : LONGINT;
  517. (*
  518. * NotifyAncestor, NotifyVirtual, NotifyInferior,
  519. * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
  520. * NotifyPointerRoot, NotifyDetailNone
  521. *)
  522. END;
  523. TYPE XFocusInEvent* = XFocusChangeEvent;
  524. TYPE XFocusOutEvent* = XFocusChangeEvent;
  525. (* generated on EnterWindow and FocusIn when KeyMapState selected *)
  526. TYPE XKeymapEvent * = RECORD
  527. typ* : WORD;
  528. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  529. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  530. display* : DisplayPtr; (* Display the event was read from *)
  531. window* : Window;
  532. keyVector* : ARRAY 32 OF CHAR;
  533. END;
  534. TYPE XExposeEvent * = RECORD
  535. typ* : WORD;
  536. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  537. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  538. display* : DisplayPtr; (* Display the event was read from *)
  539. window* : Window;
  540. x*, y* : WORD;
  541. width*, height* : WORD;
  542. count* : WORD; (* if non-zero, at least this many more *)
  543. END;
  544. TYPE XGraphicsExposeEvent * = RECORD
  545. typ* : WORD;
  546. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  547. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  548. display* : DisplayPtr; (* Display the event was read from *)
  549. drawable* : Drawable;
  550. x*, y* : WORD;
  551. width*, height* : WORD;
  552. count* : WORD; (* if non-zero, at least this many more *)
  553. majorCode* : WORD; (* core is CopyArea or CopyPlane *)
  554. minorCode* : WORD; (* not defined in the core *)
  555. END;
  556. TYPE XNoExposeEvent * = RECORD
  557. typ* : WORD;
  558. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  559. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  560. display* : DisplayPtr; (* Display the event was read from *)
  561. drawable* : Drawable;
  562. majorCode* : WORD; (* core is CopyArea or CopyPlane *)
  563. minorCode* : WORD; (* not defined in the core *)
  564. END;
  565. TYPE XVisibilityEvent * = RECORD
  566. typ* : WORD;
  567. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  568. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  569. display* : DisplayPtr; (* Display the event was read from *)
  570. window* : Window;
  571. state* : WORD; (* Visibility state *)
  572. END;
  573. TYPE XCreateWindowEvent * = RECORD
  574. typ* : WORD;
  575. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  576. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  577. display* : DisplayPtr; (* Display the event was read from *)
  578. parent* : Window; (* parent of the window *)
  579. window* : Window; (* window id of window created *)
  580. x*, y* : WORD; (* window location *)
  581. width*, height* : WORD; (* size of window *)
  582. borderWidth* : WORD; (* border width *)
  583. overrideRedirect* : BOOLEAN; (* creation should be overridden *)
  584. END;
  585. TYPE XDestroyWindowEvent * = RECORD
  586. typ* : WORD;
  587. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  588. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  589. display* : DisplayPtr; (* Display the event was read from *)
  590. event* : Window;
  591. window* : Window;
  592. END;
  593. TYPE XUnmapEvent * = RECORD
  594. typ* : WORD;
  595. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  596. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  597. display* : DisplayPtr; (* Display the event was read from *)
  598. event* : Window;
  599. window* : Window;
  600. fromConfigure* : BOOLEAN;
  601. END;
  602. TYPE XMapEvent * = RECORD
  603. typ* : WORD;
  604. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  605. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  606. display* : DisplayPtr; (* Display the event was read from *)
  607. event* : Window;
  608. window* : Window;
  609. overrideRedirect* : BOOLEAN; (* boolean, is override set... *)
  610. END;
  611. TYPE XMapRequestEvent * = RECORD
  612. typ* : WORD;
  613. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  614. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  615. display* : DisplayPtr; (* Display the event was read from *)
  616. parent* : Window;
  617. window* : Window;
  618. END;
  619. TYPE XReparentEvent * = RECORD
  620. typ* : WORD;
  621. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  622. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  623. display* : DisplayPtr; (* Display the event was read from *)
  624. event* : Window;
  625. window* : Window;
  626. parent* : Window;
  627. x*, y* : WORD;
  628. overrideRedirect* : BOOLEAN;
  629. END;
  630. TYPE XConfigureEvent * = RECORD
  631. typ* : WORD;
  632. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  633. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  634. display* : DisplayPtr; (* Display the event was read from *)
  635. event* : Window;
  636. window* : Window;
  637. x*, y* : WORD;
  638. width*, height* : WORD;
  639. borderWidth* : WORD;
  640. above* : Window;
  641. overrideRedirect* : BOOLEAN;
  642. END;
  643. TYPE XGravityEvent * = RECORD
  644. typ* : WORD;
  645. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  646. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  647. display* : DisplayPtr; (* Display the event was read from *)
  648. event* : Window;
  649. window* : Window;
  650. x*, y* : WORD;
  651. END;
  652. TYPE XResizeRequestEvent * = RECORD
  653. typ* : WORD;
  654. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  655. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  656. display* : DisplayPtr; (* Display the event was read from *)
  657. window* : Window;
  658. width*, height* : LONGWORD;
  659. END;
  660. TYPE XConfigureRequestEvent * = RECORD
  661. typ* : WORD;
  662. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  663. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  664. display* : DisplayPtr; (* Display the event was read from *)
  665. parent* : Window;
  666. window* : Window;
  667. x*, y* : WORD;
  668. width*, height* : WORD;
  669. borderWidth* : WORD;
  670. above* : Window;
  671. detail* : WORD; (* Above, Below, TopIf, BottomIf, Opposite *)
  672. valueMask* : LONGWORD(*unsigned*);
  673. END;
  674. TYPE XCirculateEvent * = RECORD
  675. typ* : WORD;
  676. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  677. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  678. display* : DisplayPtr; (* Display the event was read from *)
  679. event* : Window;
  680. window* : Window;
  681. place* : WORD; (* PlaceOnTop, PlaceOnBottom *)
  682. END;
  683. TYPE XCirculateRequestEvent * = RECORD
  684. typ* : WORD;
  685. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  686. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  687. display* : DisplayPtr; (* Display the event was read from *)
  688. parent* : Window;
  689. window* : Window;
  690. place* : WORD; (* PlaceOnTop, PlaceOnBottom *)
  691. END;
  692. TYPE XPropertyEvent * = RECORD
  693. typ* : WORD;
  694. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  695. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  696. display* : DisplayPtr; (* Display the event was read from *)
  697. window* : Window;
  698. atom* : Atom;
  699. time* : Time;
  700. state* : WORD; (* NewValue, Deleted *)
  701. END;
  702. TYPE XSelectionClearEvent * = RECORD
  703. typ* : WORD;
  704. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  705. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  706. display* : DisplayPtr; (* Display the event was read from *)
  707. window* : Window;
  708. selection* : Atom;
  709. time* : Time;
  710. END;
  711. TYPE XSelectionRequestEvent * = RECORD
  712. typ* : WORD;
  713. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  714. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  715. display* : DisplayPtr; (* Display the event was read from *)
  716. owner* : Window;
  717. requestor* : Window;
  718. selection* : Atom;
  719. target* : Atom;
  720. property* : Atom;
  721. time* : Time;
  722. END;
  723. TYPE XSelectionEvent * = RECORD
  724. typ* : WORD;
  725. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  726. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  727. display* : DisplayPtr; (* Display the event was read from *)
  728. requestor* : Window;
  729. selection* : Atom;
  730. target* : Atom;
  731. property* : Atom; (* ATOM or None *)
  732. time* : Time;
  733. END;
  734. TYPE
  735. Data40 * = ARRAY 5 OF LONGWORD; (* max of these is 40 bytes*)
  736. Data40b* = ARRAY 20 OF CHAR; (* 20x 8 bits *)
  737. Data40s* = ARRAY 10 OF INTEGER; (* 10x 16 bits *)
  738. Data40l* = ARRAY 5 OF LONGINT; (* 5x 32 bits *)
  739. TYPE XClientMessageEvent * = RECORD
  740. typ* : WORD;
  741. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  742. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  743. display* : DisplayPtr; (* Display the event was read from *)
  744. window* : Window;
  745. messageType* : Atom;
  746. format* : WORD;
  747. data*: Data40;
  748. (* any of these, union
  749. b* : ARRAY 20 OF CHAR;
  750. s* : ARRAY 10 OF INTEGER;
  751. l* : ARRAY 5 OF LONGINT;
  752. *)
  753. END;
  754. TYPE XMappingEvent * = RECORD
  755. typ* : WORD;
  756. serial* : LONGWORD(*unsigned*); (* # of last request processed by server *)
  757. sendEvent* : BOOLEAN; (* true if this came from a SendEvent request *)
  758. display* : DisplayPtr; (* Display the event was read from *)
  759. window* : Window; (* unused *)
  760. request* : WORD; (* one of MappingModifier, MappingKeyboard, MappingPointer *)
  761. firstKeycode* : WORD; (* first keycode *)
  762. count* : WORD; (* defines range of change w. firstKeycode*)
  763. END;
  764. TYPE XErrorEvent * = RECORD
  765. typ* : WORD;
  766. display* : DisplayPtr; (* Display the event was read from *)
  767. resourceid* : XID; (* resource id *)
  768. serial* : LONGWORD(*unsigned*); (* serial number of failed request *)
  769. errorCode* : CHAR(*unsigned*); (* error code of failed request *)
  770. requestCode* : CHAR(*unsigned*); (* Major op-code of failed request *)
  771. minorCode* : CHAR(*unsigned*); (* Minor op-code of failed request *)
  772. END;
  773. (* ************************************************************** *)
  774. (* GenericEvent. This event is the standard event for all newer extensions. *)
  775. TYPE XGenericEvent * = RECORD
  776. typ* : WORD; (* of event. Always GenericEvent *)
  777. serial* : LONGWORD(*unsigned*); (* # of last request processed *)
  778. sendEvent* : BOOLEAN; (* true if from SendEvent request *)
  779. display* : DisplayPtr; (* Display the event was read from *)
  780. extension* : WORD; (* major opcode of extension that caused the event *)
  781. evtype* : WORD; (* actual event type. *)
  782. END;
  783. TYPE XGenericEventCookie * = RECORD
  784. typ* : WORD; (* of event. Always GenericEvent *)
  785. serial* : LONGWORD(*unsigned*); (* # of last request processed *)
  786. sendEvent* : BOOLEAN; (* true if from SendEvent request *)
  787. display* : DisplayPtr; (* Display the event was read from *)
  788. extension* : WORD; (* major opcode of extension that caused the event *)
  789. evtype* : WORD; (* actual event type. *)
  790. cookie* : WORD;
  791. data* : ADDRESS;
  792. END;
  793. CONST
  794. (* Action for EWMH client messages *)
  795. NET_WM_STATE_REMOVE* = 0;
  796. NET_WM_STATE_ADD* =1;
  797. NET_WM_STATE_TOGGLE* = 2;
  798. (*! ----------FONTS, from Xutil.h ------------------ *)
  799. TYPE
  800. (* Extensions need a way to hang private data on some structures.
  801. called to free private storage
  802. free_private_proc* = PROCEDURE (extension: ExtData): LONGINT;*)
  803. ExtData* = POINTER {UNTRACED, UNSAFE} TO ExtDataDesc;
  804. ExtDataDesc* = RECORD
  805. number*: WORD; (* number returned by XRegisterExtension *)
  806. next*: ExtData; (* next item on list of data for structure *)
  807. free_private*: ADDRESS; (* called to free private storage *)
  808. extension* : ExtData;
  809. private_data*: ADDRESS; (* data private to this extension. *)
  810. END;
  811. (* per character font metric information. *)
  812. CharStruct* = RECORD
  813. lbearing*: INTEGER; (* origin to left edge of raster *)
  814. rbearing*: INTEGER; (* origin to right edge of raster *)
  815. width*: INTEGER; (* advance to next char's origin *)
  816. ascent*: INTEGER; (* baseline to top edge of raster *)
  817. descent*: INTEGER; (* baseline to bottom edge of raster *)
  818. attributes*: INTEGER; (* per char flags (not predefined) *)
  819. END;
  820. (* To allow arbitrary information with fonts, there are additional properties returned. *)
  821. FontProp* = RECORD
  822. name*: Atom;
  823. card32*: LONGWORD;
  824. END;
  825. FontStruct* = POINTER {UNTRACED, UNSAFE} TO FontStructDesc;
  826. FontStructDesc* = RECORD
  827. ext_data*: ExtData; (* hook for extension to hang data *)
  828. fid*: X11.Font; (* Font id for this font *)
  829. direction*: WORD; (* hint about direction the font is painted *)
  830. min_char_or_byte2*: WORD;(* first character *)
  831. max_char_or_byte2*: WORD;(* last character *)
  832. min_byte1*: WORD; (* first row that exists *)
  833. max_byte1*: WORD; (* last row that exists *)
  834. all_chars_exist*: Bool;(* flag if all characters have non-zero size*)
  835. default_char*: WORD; (* char to print for undefined character *)
  836. n_properties*: WORD; (* how many properties there are *)
  837. properties*: ADDRESS; (*POINTER TO ARRAY OF FontProp; *) (* pointer to array of additional properties*)
  838. min_bounds*: CharStruct; (* minimum bounds over all existing char*)
  839. max_bounds*: CharStruct; (* maximum bounds over all existing char*)
  840. per_char*: ADDRESS; (*POINTER TO ARRAY OF CharStruct;*) (* first_char to last_char information *)
  841. ascent*: WORD; (* log. extent above baseline for spacing *)
  842. descent*: WORD; (* log. descent below baseline for spacing *)
  843. END;
  844. (* new structure for manipulating TEXT properties; used with WM_NAME,
  845. WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND. *)
  846. XTextProperty* = RECORD
  847. value*: ADDRESS; (* same as Property routines *)
  848. encoding*: Atom; (* prop type *)
  849. format*: WORD; (* prop data format: 8, 16, or 32 *)
  850. nitems*: LONGWORD; (* number of data items in value *)
  851. END;
  852. (*! ------------------- ends Xutil.h ----------- *)
  853. VAR
  854. xlib: ADDRESS;
  855. OpenDisplay- : PROCEDURE {C} (CONST name: ARRAY OF CHAR): DisplayPtr;
  856. CloseDisplay- : PROCEDURE {C} (display:DisplayPtr): WORD;
  857. CreateWindow- : PROCEDURE {C} (display: DisplayPtr; parent: Window; x, y: WORD; width, height, borderWidth, depth, class: WORD; visual: VisualPtr; valuemask: LONGWORD; VAR attributes: XSetWindowAttributes ): Window;
  858. DestroyWindow-: PROCEDURE {C}(display:DisplayPtr; win: Window): WORD;
  859. DisplayWidthMM-: PROCEDURE {C} (d: DisplayPtr; screen: WORD ): WORD;
  860. FreeColormap- : PROCEDURE {C} (display: DisplayPtr; colormap: Colormap);
  861. FreeCursor- : PROCEDURE {C} (display: DisplayPtr; cursor: Cursor);
  862. XGetAtomName- : PROCEDURE {C} (display: DisplayPtr; atom: Atom): ADDRESS;
  863. GetWindowAttributes- : PROCEDURE {C} (display: DisplayPtr; win: Window; VAR attr: XWindowAttributes): Status;
  864. GetWindowProperty-: PROCEDURE {C} (d: DisplayPtr; w: Window; property: Atom;
  865. offset, length: LONGWORD; delete: Bool; reqtype: Atom; VAR typ: Atom;
  866. VAR format: WORD; VAR nitems, bytesafter: LONGWORD; VAR prop: ADDRESS ): WORD;
  867. GrabKeyboard-: PROCEDURE {C} (display: DisplayPtr; grabwindow: Window; ownerevents: Bool; pointermode, keyboardmode: WORD; time: Time): WORD;
  868. GrabPointer-: PROCEDURE {C} (display:DisplayPtr; grabwindow: Window; ownerevents: Bool; eventmask: WORD; pointermode, keyboardmode: WORD; confineto: Window; cursor: Cursor; time: Time): WORD;
  869. InternAtom-: PROCEDURE {C} (display: DisplayPtr; CONST name: ARRAY OF CHAR; onlyifexists: Bool ): Atom;
  870. LookupKeysym- : PROCEDURE {C} (CONST event: XKeyEvent; index: WORD): KeySym;
  871. LookupString-: PROCEDURE {C} (VAR event: XKeyEvent; VAR buf: ARRAY OF CHAR; bufsize: WORD; VAR keysym: KeySym; VAR cstat: ComposeStatus ): WORD;
  872. MapWindow- : PROCEDURE {C} (display: DisplayPtr; win: Window);
  873. NextEvent-: PROCEDURE {C} (d: DisplayPtr; VAR event: XEvent );
  874. Pending- : PROCEDURE {C} (display: DisplayPtr): WORD;
  875. RaiseWindow-: PROCEDURE {C}(display: DisplayPtr; win: Window);
  876. RootWindow-: PROCEDURE {C}(display: DisplayPtr; screen: WORD): Window;
  877. SendEvent-: PROCEDURE {C} (d: DisplayPtr; w: Window; propagate: Bool; eventmask: LONGWORD; event: ADDRESS ): Status;
  878. SetNormalHints-: PROCEDURE {C} (d: DisplayPtr; w: Window; VAR hints: XSizeHints);
  879. GetNormalHints-: PROCEDURE {C} (d: DisplayPtr; w: Window; VAR hints: XSizeHints): Status;
  880. SetStandardProperties-: PROCEDURE {C} (display: DisplayPtr; w: Window; CONST winName: ARRAY OF CHAR;
  881. CONST iconName: ARRAY OF CHAR; iconpixmap: Pixmap; argv: ADDRESS; argc: WORD; VAR hints: XSizeHints);
  882. SetWMProtocols-: PROCEDURE {C} (display: DisplayPtr; win: Window; protocols: ADDRESS (* ARRAY OF Atoms *); count: WORD): Status;
  883. StoreName- : PROCEDURE {C} (display: DisplayPtr; win: Window; CONST s: ARRAY OF CHAR): WORD;
  884. UnmapWindow- : PROCEDURE {C} (display: DisplayPtr; win: Window);
  885. WarpPointer- : PROCEDURE {C} (display: DisplayPtr; srcwin, destwin: Window; srcx, srcy: WORD; srcwidth, srcheight: WORD; destx, desty: WORD);
  886. (* cut and paste delegates *)
  887. SendSelection*: PROCEDURE {DELEGATE} (VAR event: XSelectionRequestEvent );
  888. ReceiveSelection*: PROCEDURE {DELEGATE} (VAR event: XSelectionEvent );
  889. ClearSelection*: PROCEDURE {DELEGATE} ;
  890. CheckTypedEvent-: PROCEDURE {C} (display: DisplayPtr; eventType: WORD; VAR event: XEvent): Bool;
  891. CheckMaskEvent-: PROCEDURE {C} (display: DisplayPtr; eventMask: LONGWORD; VAR event: XEvent): Bool;
  892. CheckTypedWindowEvent-: PROCEDURE {C} (display: DisplayPtr; window: Window; eventType: WORD; VAR event: XEvent): Bool;
  893. CheckWindowEvent-: PROCEDURE {C} (display: DisplayPtr; window: Window; eventMask: LONGWORD; VAR event: XEvent): Bool;
  894. (* Font *)
  895. LoadQueryFont-: PROCEDURE {C} (display: DisplayPtr; name: ADDRESS): FontStruct;
  896. QueryFont- : PROCEDURE {C} (display: DisplayPtr; name: XID): FontStruct;
  897. KeycodeToKeysym-: PROCEDURE {C} (disp: DisplayPtr; keycode: WORD; index: WORD): KeySym;
  898. KeysymToKeycode-: PROCEDURE {C} (disp: DisplayPtr; keysym: KeySym): WORD;
  899. XKeysymToString- : PROCEDURE {C} (keysym: KeySym): ADDRESS;
  900. (* helper procedure *)
  901. PROCEDURE GetStringFromAddress*(adr: ADDRESS): PChar;
  902. VAR
  903. adr1: ADDRESS;
  904. name: PChar;
  905. i, cnt: LONGINT;
  906. ch: CHAR;
  907. BEGIN
  908. cnt := 0;
  909. adr1 := adr;
  910. (* count # of characters *)
  911. SYSTEM.GET(adr1, ch);
  912. WHILE ch # 0X DO
  913. INC(cnt); INC(adr1);
  914. SYSTEM.GET(adr1, ch);
  915. END;
  916. IF cnt > 0 THEN
  917. (* copy characters to name *)
  918. adr1 := adr;
  919. NEW(name, cnt+1);
  920. FOR i :=0 TO cnt-1 DO
  921. SYSTEM.GET(adr1, ch); name[i] := ch; INC(adr1);
  922. END;
  923. END;
  924. RETURN name;
  925. END GetStringFromAddress;
  926. (* wrapper procedure for XKeysymToString *)
  927. PROCEDURE KeysymToString*(keysym: KeySym): PChar;
  928. VAR adr: ADDRESS;
  929. name: PChar;
  930. BEGIN
  931. adr := XKeysymToString(keysym);
  932. name := GetStringFromAddress(adr);
  933. RETURN name;
  934. END KeysymToString;
  935. (* wrapper procedure for XGetAtomName *)
  936. PROCEDURE GetAtomName*(display: DisplayPtr; atom: Atom): PChar;
  937. VAR adr: ADDRESS;
  938. name: PChar;
  939. BEGIN
  940. adr := XGetAtomName(display, atom);
  941. name := GetStringFromAddress(adr);
  942. X11.Free(adr); (* free resulting string *)
  943. RETURN name;
  944. END GetAtomName;
  945. PROCEDURE LoadX11Functions;
  946. BEGIN
  947. xlib := Unix.Dlopen( Unix.libX11name, 2 );
  948. Unix.Dlsym( xlib, "XOpenDisplay", ADDRESSOF( OpenDisplay));
  949. Unix.Dlsym( xlib, "XCloseDisplay", ADDRESSOF( CloseDisplay));
  950. Unix.Dlsym( xlib, "XCreateWindow", ADDRESSOF( CreateWindow));
  951. Unix.Dlsym( xlib, "XDestroyWindow", ADDRESSOF( DestroyWindow));
  952. Unix.Dlsym( xlib, "XDisplayWidthMM", ADDRESSOF( DisplayWidthMM));
  953. Unix.Dlsym( xlib, "XFreeColormap", ADDRESSOF( FreeColormap));
  954. Unix.Dlsym( xlib, "XFreeCursor", ADDRESSOF( FreeCursor));
  955. Unix.Dlsym( xlib, "XGetAtomName", ADDRESSOF( XGetAtomName));
  956. Unix.Dlsym( xlib, "XGetNormalHints", ADDRESSOF( GetNormalHints));
  957. Unix.Dlsym( xlib, "XGetWindowAttributes", ADDRESSOF( GetWindowAttributes));
  958. Unix.Dlsym( xlib, "XGetWindowProperty", ADDRESSOF( GetWindowProperty));
  959. Unix.Dlsym( xlib, "XGrabKeyboard", ADDRESSOF( GrabKeyboard));
  960. Unix.Dlsym( xlib, "XGrabPointer", ADDRESSOF( GrabPointer));
  961. Unix.Dlsym( xlib, "XInternAtom", ADDRESSOF( InternAtom));
  962. Unix.Dlsym( xlib, "XLookupKeysym", ADDRESSOF( LookupKeysym));
  963. Unix.Dlsym( xlib, "XLookupString", ADDRESSOF( LookupString));
  964. Unix.Dlsym( xlib, "XMapWindow", ADDRESSOF( MapWindow));
  965. Unix.Dlsym( xlib, "XNextEvent", ADDRESSOF( NextEvent));
  966. Unix.Dlsym( xlib, "XUnmapWindow", ADDRESSOF( UnmapWindow));
  967. Unix.Dlsym( xlib, "XPending", ADDRESSOF( Pending));
  968. Unix.Dlsym( xlib, "XRaiseWindow", ADDRESSOF( RaiseWindow));
  969. Unix.Dlsym( xlib, "XRootWindow", ADDRESSOF( RootWindow));
  970. Unix.Dlsym( xlib, "XSendEvent", ADDRESSOF( SendEvent));
  971. Unix.Dlsym( xlib, "XSetNormalHints", ADDRESSOF( SetNormalHints));
  972. Unix.Dlsym( xlib, "XSetStandardProperties", ADDRESSOF( SetStandardProperties));
  973. Unix.Dlsym( xlib, "XSetWMProtocols", ADDRESSOF( SetWMProtocols));
  974. Unix.Dlsym( xlib, "XStoreName", ADDRESSOF( StoreName));
  975. Unix.Dlsym( xlib, "XWarpPointer", ADDRESSOF( WarpPointer));
  976. Unix.Dlsym( xlib, "XCheckTypedEvent", ADDRESSOF( CheckTypedEvent));
  977. Unix.Dlsym( xlib, "XCheckMaskEvent", ADDRESSOF( CheckMaskEvent));
  978. Unix.Dlsym( xlib, "XCheckTypedWindowEvent", ADDRESSOF( CheckTypedWindowEvent));
  979. Unix.Dlsym( xlib, "XCheckWindowEvent", ADDRESSOF( CheckWindowEvent));
  980. Unix.Dlsym(xlib, 'XLoadQueryFont', ADDRESSOF( LoadQueryFont));
  981. Unix.Dlsym(xlib, 'XQueryFont', ADDRESSOF( QueryFont));
  982. Unix.Dlsym(xlib, "XKeycodeToKeysym", ADDRESSOF(KeycodeToKeysym));
  983. Unix.Dlsym(xlib, "XKeysymToKeycode", ADDRESSOF(KeysymToKeycode));
  984. Unix.Dlsym(xlib, "XKeysymToString", ADDRESSOF(XKeysymToString));
  985. END LoadX11Functions;
  986. PROCEDURE OnClose;
  987. BEGIN
  988. IF xlib # 0 THEN
  989. Unix.Dlclose(xlib);
  990. END;
  991. END OnClose;
  992. BEGIN
  993. LoadX11Functions;
  994. Modules.InstallTermHandler(OnClose) ;
  995. END X11Api.