MODULE X11Api;
IMPORT
X11, Unix, Modules, SYSTEM;
TYPE
ADDRESS*= SYSTEM.ADDRESS;
PChar* = POINTER TO ARRAY OF CHAR;
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* = RECORD
composePtr*: LONGINT;
charsMatched*: LONGINT;
END ;
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* = 0H; KeyPressMask* = 1H; KeyReleaseMask* = 2H;
ButtonPressMask* = 4H; ButtonReleaseMask* = 8H; EnterWindowMask* = 10H;
LeaveWindowMask* = 20H; PointerMotionMask* = 40H; PointerMotionHintMask* = 80H;
Button1MotionMask* = 100H; Button2MotionMask* = 200H; Button3MotionMask* = 400H;
Button4MotionMask* = 800H; Button5MotionMask* = 1000H; ButtonMotionMask* = 2000H;
KeymapStateMask* = 4000H; ExposureMask* = 8000H; VisibilityChangeMask* = 10000H;
StructureNotifyMask* = 20000H; ResizeRedirectMask* = 40000H; SubstructureNotifyMask* = 80000H;
SubstructureRedirectMask* = 100000H; FocusChangeMask * = 200000H; PropertyChangeMask* = 400000H;
ColormapChangeMask* = 800000H; OwnerGrabButtonMask* = 1000000H;
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* = 0; LockMask* = 1; ControlMask* = 2;
Mod1Mask* = 3; Mod2Mask* = 4; Mod3Mask* = 5;
Mod4Mask* = 6; Mod5Mask* = 7;
ShiftMapIndex* = 0; LockMapIndex* = 1; ControlMapIndex* = 2;
Mod1MapIndex* = 3; Mod2MapIndex* = 4; Mod3MapIndex* = 5;
Mod4MapIndex* = 6; Mod5MapIndex* = 7;
Button1Mask* = 8; Button2Mask* = 9; Button3Mask* = 10;
Button4Mask* = 11; Button5Mask* = 12;
AnyModifier* = 15;
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* = 1H; CWBackPixel* = 2H; CWBorderPixmap* = 4H; CWBorderPixel* = 8H;
CWBitGravity* = 10H; CWWinGravity* = 20H; CWBackingStore* = 40H; CWBackingPlanes* = 80;
CWBackingPixel* = 100H; CWOverrideRedirect* = 200H; CWSaveUnder* =400H; CWEventMask* =800H;
CWDontPropagate* =1000H; CWColormap* = 2000H; CWCursor* =4000H;
CWX* = 1H; CWY* = 2H; CWWidth* = 4H; CWHeight* = 8H; CWBorderWidth* = 10H;
CWSibling* = 20H; CWStackMode* = 40H;
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* = 1H; DoGreen* = 2H; DoBlue* = 4H;
CursorShape* = 0;
TileShape* = 1;
StippleShape* = 2;
AutoRepeatModeOff*= 0; AutoRepeatModeOn* = 1; AutoRepeatModeDefault* = 2;
LedModeOff* = 0; LedModeOn* = 1;
KBKeyClickPercent* = 1H; KBBellPercent* = 2H; KBBellPitch* = 4H; KBBellDuration* = 8H;
KBLed* = 10H; KBLedMode* = 20H; KBKey* = 40H; KBAutoRepeatMode* = 80;
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;
CONST
XC_num_glyphs* = 154;
XC_X_cursor* = 0; XC_arrow* = 2; XC_based_arrow_down* = 4; XC_based_arrow_up* = 6;
XC_boat* = 8; XC_bogosity* = 10; XC_bottom_left_corner* = 12; XC_bottom_right_corner* = 14;
XC_bottom_side* = 16; XC_bottom_tee* = 18; XC_box_spiral* = 20; XC_center_ptr* = 22;
XC_circle* = 24; XC_clock* = 26; XC_coffee_mug* = 28; XC_cross* = 30; XC_cross_reverse* = 32;
XC_crosshair* = 34; XC_diamond_cross* = 36; XC_dot* = 38; XC_dotbox* = 40; XC_double_arrow* = 42;
XC_draft_large* = 44; XC_draft_small* = 46; XC_draped_box* = 48; XC_exchange* = 50;
XC_fleur* = 52; XC_gobbler* = 54; XC_gumby* = 56; XC_hand1* = 58; XC_hand2* = 60;
XC_heart* = 62; XC_icon* = 64; XC_iron_cross* = 66; XC_left_ptr* = 68; XC_left_side* = 70;
XC_left_tee* = 72; XC_leftbutton* = 74; XC_ll_angle* = 76; XC_lr_angle* = 78; XC_man* = 80;
XC_middlebutton* = 82; XC_mouse* = 84; XC_pencil* = 86; XC_pirate* = 88; XC_plus* = 90;
XC_question_arrow* = 92; XC_right_ptr* = 94; XC_right_side* = 96; XC_right_tee* = 98;
XC_rightbutton* = 100; XC_rtl_logo* = 102; XC_sailboat* = 104; XC_sb_down_arrow* = 106;
XC_sb_h_double_arrow* = 108; XC_sb_left_arrow* = 110; XC_sb_right_arrow* = 112;
XC_sb_up_arrow* = 114; XC_sb_v_double_arrow* = 116; XC_shuttle* = 118; XC_sizing* = 120;
XC_spider* = 122; XC_spraycan* = 124; XC_star* = 126; XC_target* = 128; XC_tcross* = 130;
XC_top_left_arrow* = 132; XC_top_left_corner* = 134; XC_top_right_corner* = 136;
XC_top_side* = 138; XC_top_tee* = 140; XC_trek* = 142; XC_ul_angle* = 144;
XC_umbrella* = 146; XC_ur_angle* = 148; XC_watch* = 150; XC_xterm* = 152;
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*: LONGINT;
doNotPropagateMask*: LONGINT;
overrideRedirect*: BOOLEAN;
colormap*: Colormap;
cursor*: Cursor ;
END ;
XWindowAttributes* = RECORD
x*, y*: LONGINT;
width*, height*: LONGINT;
borderWidth*: 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*: LONGINT;
yourEventMask*: LONGINT;
doNotPropagateMask*: LONGINT;
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;
borderWidth*: LONGINT;
sibling* : Window;
stackMode*: LONGINT;
END;
TYPE DataAspect*=RECORD
x*: LONGINT;
y*: LONGINT;
END;
TYPE XSizeHints* = RECORD
flags*: LONGINT;
x*, y*: LONGINT;
width*, height*: LONGINT;
minWidth*, minHeight*: LONGINT;
maxWidth*, maxHeight*: LONGINT;
widthInc*, heightInc*: LONGINT;
maxAspect*, minAspect*: DataAspect;
baseWidth*, baseHeight*: LONGINT;
winGravity*: LONGINT;
END;
CONST
USPosition * = 1H;
USSize * = 2H;
PPosition * = 4H;
PSize * = 8H;
PMinSize * = 10H;
PMaxSize * = 20H;
PResizeInc * = 40H;
PAspect * = 80H;
PBaseSize * = 100H;
PWinGravity * = 200H;
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;
borderWidth* : 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, borderWidth, depth, class: LONGINT; visual: VisualPtr; valuemask: LONGINT; VAR attributes: XSetWindowAttributes ): Window;
DestroyWindow-: PROCEDURE {C}(display:DisplayPtr; win: Window): LONGINT;
DisplayWidthMM-: PROCEDURE {C} (d: DisplayPtr; screen: LONGINT ): LONGINT;
FreeColormap- : PROCEDURE {C} (display: DisplayPtr; colormap: Colormap);
FreeCursor- : PROCEDURE {C} (display: DisplayPtr; cursor: Cursor);
XGetAtomName- : PROCEDURE {C} (display: DisplayPtr; atom: Atom): LONGINT;
GetWindowAttributes- : PROCEDURE {C} (display: DisplayPtr; win: Window; VAR attr: XWindowAttributes): 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: LONGINT; 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: ARRAY OF CHAR; 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: LONGINT; event: ADDRESS ): Bool;
SetNormalHints-: PROCEDURE {C} (d: DisplayPtr; w: Window; VAR hints: XSizeHints);
GetNormalHints-: PROCEDURE {C} (d: DisplayPtr; w: Window; VAR hints: XSizeHints): Status;
SetStandardProperties-: PROCEDURE {C} (display: DisplayPtr; w: Window; CONST winName: ARRAY OF CHAR;
CONST iconName: ARRAY OF CHAR; iconpixmap: Pixmap; argv: ADDRESS; argc: LONGINT; VAR hints: XSizeHints);
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 (VAR event: XSelectionRequestEvent );
ReceiveSelection*: PROCEDURE (VAR event: XSelectionEvent );
ClearSelection*: PROCEDURE ;
CheckTypedEvent-: PROCEDURE {C} (display: DisplayPtr; eventType: LONGINT; VAR event: XEvent): Bool;
CheckMaskEvent-: PROCEDURE {C} (display: DisplayPtr; eventMask: LONGINT; VAR event: XEvent): Bool;
CheckTypedWindowEvent-: PROCEDURE {C} (display: DisplayPtr; window: Window; eventType: LONGINT; VAR event: XEvent): Bool;
CheckWindowEvent-: PROCEDURE {C} (display: DisplayPtr; window: Window; eventMask: LONGINT; VAR event: XEvent): Bool;
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
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, "XFreeCursor", SYSTEM.VAL( ADDRESS, FreeCursor));
Unix.Dlsym( xlib, "XGetAtomName", SYSTEM.VAL( ADDRESS, XGetAtomName));
Unix.Dlsym( xlib, "XGetNormalHints", SYSTEM.VAL( ADDRESS, GetNormalHints));
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, "XSetNormalHints", SYSTEM.VAL( ADDRESS, SetNormalHints));
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));
Unix.Dlsym( xlib, "XCheckTypedEvent", SYSTEM.VAL( ADDRESS, CheckTypedEvent));
Unix.Dlsym( xlib, "XCheckMaskEvent", SYSTEM.VAL( ADDRESS, CheckMaskEvent));
Unix.Dlsym( xlib, "XCheckTypedWindowEvent", SYSTEM.VAL( ADDRESS, CheckTypedWindowEvent));
Unix.Dlsym( xlib, "XCheckWindowEvent", SYSTEM.VAL( ADDRESS, CheckWindowEvent));
END LoadX11Functions;
PROCEDURE OnClose;
BEGIN
IF xlib # 0 THEN
Unix.Dlclose(xlib);
END;
END OnClose;
BEGIN
LoadX11Functions;
Modules.InstallTermHandler(OnClose) ;
END X11Api.