MODULE X11Api;
IMPORT
X11, Unix, Modules, Trace, SYSTEM;
TYPE
ADDRESS*= SYSTEM.ADDRESS;
PChar* = POINTER TO ARRAY OF CHAR;
Buffer = X11.Buffer;
VisualPtr = X11.VisualPtr;
VisualInfoPtr* = POINTER TO X11.VisualInfo;
DisplayPtr* = X11.DisplayPtr;
Window * = X11.Window;
Time* = X11.Time;
Pixmap = X11.Pixmap;
Cursor* = X11.Cursor;
Atom* = X11.Atom;
XID* = LONGINT;
Drawable* = X11.Drawable;
Colormap* = X11.Colormap;
ComposeStatus = X11.ComposeStatus;
KeySym* = X11.KeySym;
CONST
XK_Home* = 0FF50H;
XK_Left* = 0FF51H;
XK_Up* = 0FF52H;
XK_Right* = 0FF53H;
XK_Down* = 0FF54H;
XK_Prior* = 0FF55H;
XK_Page_Up* = 0FF55H;
XK_Next* = 0FF56H;
XK_Page_Down* = 0FF56H;
XK_End* = 0FF57H;
XK_Begin* = 0FF58H;
XK_Escape* = 0FF1BH;
XK_F1* =0FFBEH;
None* = 0;
ParentRelative* = 1;
CopyFromParent* = 0;
PointerWindow* = 0;
InputFocus* = 1;
PointerRoot* = 1;
AnyPropertyType* = 0;
AnyKey* = 0;
AnyButton* = 0;
AllTemporary* = 0;
CurrentTime* = 0;
NoSymbol* = 0;
CONST
NoEventMask* = 0; KeyPressMask* = 0; KeyReleaseMask* = 1;
ButtonPressMask* = 2; ButtonReleaseMask* = 3; EnterWindowMask* = 4;
LeaveWindowMask* = 5; PointerMotionMask* = 6; PointerMotionHintMask* = 7;
Button1MotionMask* = 8; Button2MotionMask* = 9; Button3MotionMask* = 10;
Button4MotionMask* = 11; Button5MotionMask* = 12; ButtonMotionMask* = 13;
KeymapStateMask* = 14; ExposureMask* = 15; VisibilityChangeMask* = 16;
StructureNotifyMask* = 17; ResizeRedirectMask* = 18; SubstructureNotifyMask* = 19;
SubstructureRedirectMask* = 20; FocusChangeMask * = 21; PropertyChangeMask* = 22;
ColormapChangeMask* = 23; OwnerGrabButtonMask* = 24;
CONST
KeyPress* = 2; KeyRelease* =3; ButtonPress* = 4; ButtonRelease* = 5; MotionNotify* =6;
EnterNotify* = 7; LeaveNotify* =8; FocusIn* = 9; FocusOut* = 10; KeymapNotify* = 11;
Expose* = 12; GraphicsExpose* = 13; NoExpose* = 14; VisibilityNotify* = 15;
CreateNotify* = 16; DestroyNotify* = 17; UnmapNotify* = 18; MapNotify* = 19;
MapRequest* = 20; ReparentNotify* = 21; ConfigureNotify* = 22; ConfigureRequest* = 23;
GravityNotify* = 24; ResizeRequest* = 25; CirculateNotify* = 26; CirculateRequest* = 27;
PropertyNotify* = 28; SelectionClear* = 29; SelectionRequest* =30; SelectionNotify* = 31;
ColormapNotify* = 32; ClientMessage* = 33; MappingNotify* = 34; GenericEvent* = 35;
LASTEvent* = 36;
ShiftMask* = 1; LockMask* = 2; ControlMask* = 2;
Mod1Mask* = 4; Mod2Mask* = 5; Mod3Mask* = 6;
Mod4Mask* = 7; Mod5Mask* = 8;
ShiftMapIndex* = 0; LockMapIndex* = 1; ControlMapIndex* = 2;
Mod1MapIndex* = 3; Mod2MapIndex* = 4; Mod3MapIndex* = 5;
Mod4MapIndex* = 6; Mod5MapIndex* = 7;
Button1Mask* = 9; Button2Mask* = 10; Button3Mask* = 11;
Button4Mask* = 12; Button5Mask* = 13;
AnyModifier* = 16;
Button1* = 1; Button2* = 2; Button3* = 3;
Button4* = 4; Button5* = 5;
NotifyNormal* = 0; NotifyGrab* = 1; NotifyUngrab* = 2; NotifyWhileGrabbed* = 3;
NotifyHint* = 1;
NotifyAncestor* = 0; NotifyVirtual* = 1; NotifyInferior* = 2; NotifyNonlinear* = 3;
NotifyNonlinearVirtual* = 4; NotifyPointer* = 5; NotifyPointerRoot* = 6;
NotifyDetailNone* = 7;
VisibilityUnobscured* = 0; VisibilityPartiallyObscured* = 1; VisibilityFullyObscured* = 2;
PlaceOnTop* = 0; PlaceOnBottom* = 1;
FamilyInternet* = 0; FamilyDECnet* = 1; FamilyChaos* = 2; FamilyInternet6* = 6;
FamilyServerInterpreted* = 5;
PropertyNewValue* = 0; PropertyDelete* = 1;
ColormapUninstalled* = 0; ColormapInstalled* = 1;
GrabModeSync* = 0; GrabModeAsync* = 1;
GrabSuccess* = 0; AlreadyGrabbed* = 1; GrabInvalidTime* = 2; GrabNotViewable* = 3; GrabFrozen* = 4;
AsyncPointer* = 0; SyncPointer* = 1; ReplayPointer* = 2; AsyncKeyboard* = 3;
SyncKeyboard* = 4; ReplayKeyboard* = 5; AsyncBoth* = 6; SyncBoth* = 7;
RevertToNone* = None; RevertToPointerRoot* = PointerRoot; RevertToParent* = 2;
CONST
Success* = 0;
BadRequest* = 1;
BadValue* = 2;
BadWindow* = 3;
BadPixmap* = 4;
BadAtom* = 5;
BadCursor* = 6;
BadFont* = 7;
BadMatch* = 8;
BadDrawable* = 9;
BadAccess* = 10;
BadAlloc* = 11;
BadColor* = 12;
BadGC* = 13;
BadIDChoice* = 14;
BadName* = 15;
BadLength* = 16;
BadImplementation* = 17;
FirstExtensionError* = 128;
LastExtensionError* = 255;
InputOutput* = 1; InputOnly* = 2;
CWBackPixmap* = 0; CWBackPixel* = 1; CWBorderPixmap* = 2; CWBorderPixel* = 3;
CWBitGravity* = 4; CWWinGravity* = 5; CWBackingStore* = 6; CWBackingPlanes* = 7;
CWBackingPixel* = 8; CWOverrideRedirect* = 9; CWSaveUnder* =10; CWEventMask* =11;
CWDontPropagate* =12; CWColormap* = 13; CWCursor* =14;
CWX* = 0; CWY* = 1; CWWidth* = 2; CWHeight* = 3; CWBorderWidth* = 4;
CWSibling* = 5; CWStackMode* = 6;
ForgetGravity* = 0; NorthWestGravity* = 1; NorthGravity* = 2; NorthEastGravity* = 3;
WestGravity* = 4; CenterGravity *= 5; EastGravity* = 6; SouthWestGravity* = 7;
SouthGravity* = 8; SouthEastGravity* = 9; StaticGravity* = 10;
UnmapGravity* = 0;
NotUseful* = 0; WhenMapped* = 1; Always*= 2;
IsUnmapped* = 0; IsUnviewable* = 1; IsViewable*= 2;
SetModeInsert* = 0; SetModeDelete* = 1;
DestroyAll* = 0; RetainPermanent* = 1; RetainTemporary* = 2;
Above* = 0; Below* =1; TopIf* = 2; BottomIf* = 3; Opposite* = 4;
RaiseLowest* = 0; LowerHighest* = 1;
PropModeReplace* = 0; PropModePrepend* = 1; PropModeAppend * = 2;
FontLeftToRight* = 0;
FontRightToLeft* = 1;
FontChange* = 255;
XYBitmap* = 0;
XYPixmap* = 1;
ZPixmap* = 2;
AllocNone* = 0;
AllocAll* = 1;
DoRed* = 0; DoGreen* = 1; DoBlue* = 2;
CursorShape* = 0;
TileShape* = 1;
StippleShape* = 2;
AutoRepeatModeOff*= 0; AutoRepeatModeOn* = 1; AutoRepeatModeDefault* = 2;
LedModeOff* = 0; LedModeOn* = 1;
KBKeyClickPercent* = 0; KBBellPercent* = 1; KBBellPitch* = 2; KBBellDuration* = 3;
KBLed* = 4; KBLedMode* = 5; KBKey* = 6; KBAutoRepeatMode* = 7;
MappingSuccess* = 0; MappingBusy* = 1; MappingFailed* = 2;
MappingModifier* = 0; MappingKeyboard* = 1; MappingPointer* = 2;
DontPreferBlanking* = 0; PreferBlanking* = 1; DefaultBlanking* = 2;
DisableScreenSaver* = 0; DisableScreenInterval* = 0;
DontAllowExposures* = 0; AllowExposures* = 1; DefaultExposures* =2;
ScreenSaverReset* = 0; ScreenSaverActive* = 1;
HostInsert* = 0; HostDelete* = 1;
EnableAccess* = 1; DisableAccess* = 0;
StaticGray* = 0; GrayScale* = 1; StaticColor* = 2; PseudoColor* = 3;
TrueColor* = 4; DirectColor* = 5;
LSBFirst* = 0; MSBFirst* = 1;
XA_PRIMARY * = 1; XA_SECONDARY * = 2; XA_ARC * = 3; XA_ATOM * = 4; XA_BITMAP * = 5;
XA_CARDINAL * = 6; XA_COLORMAP * = 7; XA_CURSOR * = 8; XA_CUT_BUFFER0 * = 9;
XA_CUT_BUFFER1 * = 10; XA_CUT_BUFFER2 * = 11; XA_CUT_BUFFER3 * = 12; XA_CUT_BUFFER4 * = 13;
XA_CUT_BUFFER5 * = 14; XA_CUT_BUFFER6 * = 15; XA_CUT_BUFFER7 * = 16; XA_DRAWABLE * = 17;
XA_FONT * = 18; XA_INTEGER * = 19; XA_PIXMAP * = 20; XA_POINT * = 21; XA_RECTANGLE * = 22;
XA_RESOURCE_MANAGER * = 23; XA_RGB_COLOR_MAP * = 24; XA_RGB_BEST_MAP * = 25;
XA_RGB_BLUE_MAP * = 26; XA_RGB_DEFAULT_MAP * = 27; XA_RGB_GRAY_MAP * = 28;
XA_RGB_GREEN_MAP * = 29; XA_RGB_RED_MAP * = 30; XA_STRING * = 31; XA_VISUALID * = 32;
XA_WINDOW * = 33; XA_WM_COMMAND * = 34; XA_WM_HINTS * = 35; XA_WM_CLIENT_MACHINE * = 36;
XA_WM_ICON_NAME * = 37; XA_WM_ICON_SIZE * = 38; XA_WM_NAME * = 39; XA_WM_NORMAL_HINTS * = 40;
XA_WM_SIZE_HINTS * = 41; XA_WM_ZOOM_HINTS * = 42; XA_MIN_SPACE * = 43; XA_NORM_SPACE * = 44;
XA_MAX_SPACE * = 45; XA_END_SPACE * = 46; XA_SUPERSCRIPT_X * = 47; XA_SUPERSCRIPT_Y * = 48;
XA_SUBSCRIPT_X * = 49; XA_SUBSCRIPT_Y * = 50; XA_UNDERLINE_POSITION * = 51; XA_UNDERLINE_THICKNESS * = 52;
XA_STRIKEOUT_ASCENT * = 53; XA_STRIKEOUT_DESCENT * = 54; XA_ITALIC_ANGLE * = 55;
XA_X_HEIGHT * = 56; XA_QUAD_WIDTH * = 57; XA_WEIGHT * = 58; XA_POINT_SIZE * = 59;
XA_RESOLUTION * = 60; XA_COPYRIGHT * = 61; XA_NOTICE * = 62; XA_FONT_NAME * = 63;
XA_FAMILY_NAME * = 64; XA_FULL_NAME * = 65; XA_CAP_HEIGHT * = 66; XA_WM_CLASS * = 67;
XA_WM_TRANSIENT_FOR * = 68; XA_LAST_PREDEFINED * = 68;
TYPE
Bool* = LONGINT;
Status* = LONGINT;
CONST
True* = 1; False* = 0;
QueuedAlready* = 0; QueuedAfterReading* = 1; QueuedAfterFlush* = 2;
TYPE
XSetWindowAttributes* = RECORD
backgroundPixmap*: Pixmap;
backgroundPixel*: LONGINT;
borderPixmap*: Pixmap;
borderPixel*: LONGINT;
bitGravity*: LONGINT;
winGravity*: LONGINT;
backingStore*: LONGINT;
backingPlanes*: LONGINT;
backingPixel*: LONGINT;
saveUnder*: BOOLEAN;
eventMask*: SET;
doNotPropagateMask*: SET;
overrideRedirect*: BOOLEAN;
colormap*: Colormap;
cursor*: Cursor ;
END ;
XWindowAttributes* = RECORD
x*, y*: LONGINT;
width*, height*: LONGINT;
border_width*: LONGINT;
depth*: LONGINT;
visual* : VisualPtr;
root* : Window;
class*: LONGINT;
bitGravity*: LONGINT;
winGravity*: LONGINT;
backingStore*: LONGINT;
backingPlanes*: LONGINT;
backingPixel*: LONGINT;
saveUnder*: BOOLEAN;
colormap*: Colormap;
mapInstalled*: BOOLEAN;
mapState*: LONGINT;
allEventMasks*: SET;
yourEventMask*: SET;
doNotPropagateMask*: SET;
overrideRedirect*: BOOLEAN;
screen*: LONGINT;
END;
TYPE XHostAddress* = RECORD
family* : LONGINT;
length* : LONGINT;
address*: ADDRESS;
END;
TYPE XServerInterpretedAddress* = RECORD
typelength*: LONGINT;
valuelength*: LONGINT;
type*: ADDRESS;
value*: ADDRESS;
END;
TYPE XWindowChanges * = RECORD
x*, y*: LONGINT;
width*, height* : LONGINT;
border_width*: LONGINT;
sibling* : Window;
stack_mode*: LONGINT;
END;
TYPE XEvent* = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
pad*: ARRAY 172 OF CHAR;
END;
TYPE XAnyEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
END;
TYPE XKeyEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
root* : Window;
subwindow* : Window;
time* : Time;
x*, y* : LONGINT;
xRoot*, yRoot* : LONGINT;
state* : LONGINT(*word*);
keycode* : LONGINT(*word*);
sameScreen* : BOOLEAN;
END;
TYPE XKeyPressedEvent* = XKeyEvent;
TYPE XKeyReleasedEvent* = XKeyEvent;
TYPE XButtonEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
root* : Window;
subwindow* : Window;
time* : Time;
x*, y* : LONGINT;
xRoot*, yRoot* : LONGINT;
state* : LONGINT(*word*);
button* : LONGINT(*word*);
sameScreen* : BOOLEAN;
END;
TYPE XButtonPressedEvent* = XButtonEvent;
TYPE XButtonReleasedEvent* = XButtonEvent;
TYPE XMotionEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
root* : Window;
subwindow* : Window;
time* : Time;
x*, y* : LONGINT;
xRoot*, yRoot* : LONGINT;
state* : LONGINT(*word*);
isHint* : CHAR;
sameScreen* : BOOLEAN;
END;
TYPE PointerMovedEvent* = XMotionEvent;
TYPE XCrossingEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
root* : Window;
subwindow* : Window;
time* : Time;
x*, y* : LONGINT;
xRoot*, yRoot* : LONGINT;
mode* : LONGINT;
detail* : LONGINT;
sameScreen* : BOOLEAN;
focus* : BOOLEAN;
state* : LONGINT(*word*);
END;
TYPE XEnterWindowEvent* = XCrossingEvent;
TYPE XLeaveWindowEvent* = XCrossingEvent;
TYPE XFocusChangeEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
mode* : LONGINT;
detail* : LONGINT;
END;
TYPE XFocusInEvent* = XFocusChangeEvent;
TYPE XFocusOutEvent* = XFocusChangeEvent;
TYPE XKeymapEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
keyVector* : ARRAY 32 OF CHAR;
END;
TYPE XExposeEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
x*, y* : LONGINT;
width*, height* : LONGINT;
count* : LONGINT;
END;
TYPE XGraphicsExposeEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
drawable* : Drawable;
x*, y* : LONGINT;
width*, height* : LONGINT;
count* : LONGINT;
majorCode* : LONGINT;
minorCode* : LONGINT;
END;
TYPE XNoExposeEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
drawable* : Drawable;
majorCode* : LONGINT;
minorCode* : LONGINT;
END;
TYPE XVisibilityEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
state* : LONGINT;
END;
TYPE XCreateWindowEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
parent* : Window;
window* : Window;
x*, y* : LONGINT;
width*, height* : LONGINT;
borderWidth* : LONGINT;
overrideRedirect* : BOOLEAN;
END;
TYPE XDestroyWindowEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
event* : Window;
window* : Window;
END;
TYPE XUnmapEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
event* : Window;
window* : Window;
fromConfigure* : BOOLEAN;
END;
TYPE XMapEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
event* : Window;
window* : Window;
overrideRedirect* : BOOLEAN;
END;
TYPE XMapRequestEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
parent* : Window;
window* : Window;
END;
TYPE XReparentEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
event* : Window;
window* : Window;
parent* : Window;
x*, y* : LONGINT;
overrideRedirect* : BOOLEAN;
END;
TYPE XConfigureEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
event* : Window;
window* : Window;
x*, y* : LONGINT;
width*, height* : LONGINT;
borderWidth* : LONGINT;
above* : Window;
overrideRedirect* : BOOLEAN;
END;
TYPE XGravityEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
event* : Window;
window* : Window;
x*, y* : LONGINT;
END;
TYPE XResizeRequestEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
width*, height* : LONGINT;
END;
TYPE XConfigureRequestEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
parent* : Window;
window* : Window;
x*, y* : LONGINT;
width*, height* : LONGINT;
border_width* : LONGINT;
above* : Window;
detail* : LONGINT;
valueMask* : LONGINT(*unsigned*);
END;
TYPE XCirculateEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
event* : Window;
window* : Window;
place* : LONGINT;
END;
TYPE XCirculateRequestEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
parent* : Window;
window* : Window;
place* : LONGINT;
END;
TYPE XPropertyEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
atom* : Atom;
time* : Time;
state* : LONGINT;
END;
TYPE XSelectionClearEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
selection* : Atom;
time* : Time;
END;
TYPE XSelectionRequestEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
owner* : Window;
requestor* : Window;
selection* : Atom;
target* : Atom;
property* : Atom;
time* : Time;
END;
TYPE XSelectionEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
requestor* : Window;
selection* : Atom;
target* : Atom;
property* : Atom;
time* : Time;
END;
TYPE Data40 * = ARRAY 40 OF CHAR;
Data40b* = ARRAY 20 OF CHAR;
Data40s* = ARRAY 10 OF INTEGER;
Data40l* = ARRAY 5 OF HUGEINT;
TYPE XClientMessageEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
messageType* : Atom;
format* : LONGINT;
data*: Data40;
END;
TYPE XMappingEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
window* : Window;
request* : LONGINT;
firstKeycode* : LONGINT;
count* : LONGINT;
END;
TYPE XErrorEvent * = RECORD
typ* : LONGINT;
display* : DisplayPtr;
resourceid* : XID;
serial* : LONGINT(*unsigned*);
errorCode* : CHAR(*unsigned*);
requestCode* : CHAR(*unsigned*);
minorCode* : CHAR(*unsigned*);
END;
TYPE XGenericEvent * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
extension* : LONGINT;
evtype* : LONGINT;
END;
TYPE XGenericEventCookie * = RECORD
typ* : LONGINT;
serial* : LONGINT(*unsigned*);
sendEvent* : BOOLEAN;
display* : DisplayPtr;
extension* : LONGINT;
evtype* : LONGINT;
cookie* : LONGINT(*word*);
data* : ADDRESS;
END;
CONST
NET_WM_STATE_REMOVE* = 0;
NET_WM_STATE_ADD* =1;
NET_WM_STATE_TOGGLE* = 2;
VAR
xlib: LONGINT;
OpenDisplay- : PROCEDURE { C } (CONST name: ARRAY OF CHAR): DisplayPtr;
CloseDisplay- : PROCEDURE { C } (display:DisplayPtr): LONGINT;
CreateWindow- : PROCEDURE { C } (display: DisplayPtr; parent: Window; x, y: LONGINT; width, height, border_width, depth, class: LONGINT; visual: VisualPtr; valuemask: SET; attributes: ADDRESS ): Window;
DestroyWindow-: PROCEDURE { C }(display:DisplayPtr; win: Window): LONGINT;
DisplayWidthMM-: PROCEDURE {C} ( d: DisplayPtr; screen: LONGINT ): LONGINT;
FreeColormap- : PROCEDURE { C } (display: DisplayPtr; colormap: Colormap);
XGetAtomName- : PROCEDURE { C } (display: DisplayPtr; atom: Atom): LONGINT;
GetWindowAttributes- : PROCEDURE { C } (display: DisplayPtr; win: Window; attr: ADDRESS): LONGINT;
GetWindowProperty-: PROCEDURE {C} ( d: DisplayPtr; w: Window; property: Atom;
offset, length: LONGINT; delete: Bool; reqtype: Atom; VAR typ: Atom;
VAR format, nitems, bytesafter, prop: LONGINT ): LONGINT;
GrabKeyboard-: PROCEDURE {C} (display: DisplayPtr; grabwindow: Window; ownerevents: Bool; pointermode, keyboardmode: LONGINT; time: Time): LONGINT;
GrabPointer-: PROCEDURE {C} (display:DisplayPtr; grabwindow: Window; ownerevents: Bool; eventmask: SET; pointermode, keyboardmode: LONGINT; confineto: Window; cursor: Cursor; time: Time): LONGINT;
InternAtom-: PROCEDURE {C} ( display: DisplayPtr; CONST name: ARRAY OF CHAR; onlyifexists: Bool ): Atom;
LookupKeysym- : PROCEDURE { C } ( CONST event: XKeyEvent; index: LONGINT): KeySym;
LookupString-: PROCEDURE {C} ( VAR event: XKeyEvent; VAR buf: Buffer; bufsize: LONGINT; VAR keysym: KeySym; VAR cstat: ComposeStatus ): LONGINT;
MapWindow- : PROCEDURE { C } (display: DisplayPtr; win: Window);
NextEvent-: PROCEDURE {C} ( d: DisplayPtr; VAR event: XEvent );
Pending- : PROCEDURE { C } (display: DisplayPtr): LONGINT;
RaiseWindow-: PROCEDURE { C }(display: DisplayPtr; win: Window);
RootWindow-: PROCEDURE { C }(display: DisplayPtr; screen: LONGINT): Window;
SendEvent-: PROCEDURE {C} ( d: DisplayPtr; w: Window; propagate: Bool; eventmask: SET; event: ADDRESS ): Bool;
SetStandardProperties-: PROCEDURE {C} (display: DisplayPtr; w: Window; CONST winName: ARRAY OF CHAR;
CONST iconName: ARRAY OF CHAR; iconpixmap: Pixmap; argv: POINTER TO ARRAY OF CHAR; argc: LONGINT; hints: ADDRESS);
SetWMProtocols-: PROCEDURE { C } (display: DisplayPtr; win: Window; protoclos: ADDRESS ; count: LONGINT): LONGINT;
StoreName- : PROCEDURE { C } (display: DisplayPtr; win: Window; CONST s: ARRAY OF CHAR): LONGINT;
UnmapWindow- : PROCEDURE { C } (display: DisplayPtr; win: Window);
WarpPointer- : PROCEDURE {C} (display: DisplayPtr; srcwin, destwin: Window; srcx, srcy: LONGINT; srcwidth, srcheight: LONGINT; destx, desty: LONGINT);
SendSelection-: PROCEDURE {C } ( VAR event: XSelectionRequestEvent );
ReceiveSelection-: PROCEDURE { C } ( VAR event: XSelectionEvent );
ClearSelection-: PROCEDURE { C } ;
PROCEDURE GetAtomName*(display: DisplayPtr; atom: Atom): PChar;
VAR adr, adr1: LONGINT;
name: PChar;
i, cnt: LONGINT;
ch: CHAR;
BEGIN
adr := XGetAtomName(display, atom);
cnt := 0;
adr1 := adr;
SYSTEM.GET(adr1, ch);
WHILE ch # 0X DO
INC(cnt); INC(adr1);
SYSTEM.GET(adr1, ch);
END;
IF cnt = 0 THEN X11.Free(adr); RETURN NIL; END;
adr1 := adr;
NEW(name, cnt+1);
FOR i :=0 TO cnt-1 DO
SYSTEM.GET(adr1, ch); name[i] :=ch; INC(adr1);
END;
X11.Free(adr);
RETURN name;
END GetAtomName;
PROCEDURE LoadX11Functions;
BEGIN {EXCLUSIVE}
xlib := Unix.Dlopen( Unix.libX11name, 2 );
Unix.Dlsym( xlib, "XOpenDisplay", SYSTEM.VAL( ADDRESS, OpenDisplay));
Unix.Dlsym( xlib, "XCloseDisplay", SYSTEM.VAL( ADDRESS, CloseDisplay));
Unix.Dlsym( xlib, "XCreateWindow", SYSTEM.VAL( ADDRESS, CreateWindow));
Unix.Dlsym( xlib, "XDestroyWindow", SYSTEM.VAL( ADDRESS, DestroyWindow));
Unix.Dlsym( xlib, "XDisplayWidthMM", SYSTEM.VAL( ADDRESS, DisplayWidthMM));
Unix.Dlsym( xlib, "XFreeColormap", SYSTEM.VAL( ADDRESS, FreeColormap));
Unix.Dlsym( xlib, "XGetAtomName", SYSTEM.VAL( ADDRESS, XGetAtomName));
Unix.Dlsym( xlib, "XGetWindowAttributes", SYSTEM.VAL( ADDRESS, GetWindowAttributes));
Unix.Dlsym( xlib, "XGetWindowProperty", SYSTEM.VAL( ADDRESS, GetWindowProperty));
Unix.Dlsym( xlib, "XGrabKeyboard", SYSTEM.VAL( ADDRESS, GrabKeyboard));
Unix.Dlsym( xlib, "XGrabPointer", SYSTEM.VAL( ADDRESS, GrabPointer));
Unix.Dlsym( xlib, "XInternAtom", SYSTEM.VAL( ADDRESS, InternAtom));
Unix.Dlsym( xlib, "XLookupKeysym", SYSTEM.VAL( ADDRESS, LookupKeysym));
Unix.Dlsym( xlib, "XLookupString", SYSTEM.VAL( ADDRESS, LookupString));
Unix.Dlsym( xlib, "XMapWindow", SYSTEM.VAL( ADDRESS, MapWindow));
Unix.Dlsym( xlib, "XNextEvent", SYSTEM.VAL( ADDRESS, NextEvent));
Unix.Dlsym( xlib, "XUnmapWindow", SYSTEM.VAL( ADDRESS, UnmapWindow));
Unix.Dlsym( xlib, "XPending", SYSTEM.VAL( ADDRESS, Pending));
Unix.Dlsym( xlib, "XRaiseWindow", SYSTEM.VAL( ADDRESS, RaiseWindow));
Unix.Dlsym( xlib, "XRootWindow", SYSTEM.VAL( ADDRESS, RootWindow));
Unix.Dlsym( xlib, "XSendEvent", SYSTEM.VAL( ADDRESS, SendEvent));
Unix.Dlsym( xlib, "XSetStandardProperties", SYSTEM.VAL( ADDRESS, SetStandardProperties));
Unix.Dlsym( xlib, "XSetWMProtocols", SYSTEM.VAL( ADDRESS, SetWMProtocols));
Unix.Dlsym( xlib, "XStoreName", SYSTEM.VAL( ADDRESS, StoreName));
Unix.Dlsym( xlib, "XWarpPointer", SYSTEM.VAL( ADDRESS, WarpPointer));
END LoadX11Functions;
PROCEDURE OnClose;
BEGIN {EXCLUSIVE}
IF xlib # 0 THEN
Unix.Dlclose(xlib);
Trace.String(Unix.libX11name); Trace.StringLn(' unloaded.');
END;
END OnClose;
BEGIN
LoadX11Functions;
Modules.InstallTermHandler(OnClose) ;
END X11Api.