#ifndef WH_LX_H_7f497c18_ #define WH_LX_H_7f497c18_ // Copyright status: this file is in the public domain. // TODO: // Implement struct variant of ChangeKeyboardControl #include typedef unsigned int LX_XID; typedef unsigned int LX_KEYSYM; /* * Words with differing USA/British spelling, such as color/colour, are * spelt with the USA spellings, here, because those are the spellings * used by X. For some such words, I prefer the British spellings * (most notably for X, `color' and related words such as `colormap'); * I may someday add aliases using the British spellings. * * Ideally, I'd like to set things up so that (to pick an example) * LX_WCLASS is the type of a window class, with values such as * LX_WCLASS_InputOutput and LX_WCLASS_InputOnly, and we get strict * typechecking from the compiler, so that passing a non-LX_WCLASS_* * value as an LX_WCLASS argument produces a type mismatch error. But * I also want LX_WCLASS_InputOutput and LX_WCLASS_InputOnly to be * compile-time constants, so they are suitable for use in switches. * * I have not come up with a way to get both. The compromise I'm * picking is to use compile-time constant values and back off to * run-time typechecking, by using values such that (for example) * LX_WCLASS_InputOutput does not equal LX_BACKINGSTORE_WhenMapped, * even though they have the same representation in the protocol, so, * while it won't be a compile-time error to pass * LX_BACKINGSTORE_WhenMapped as a window class, it will be a run-time * error. * * This is especially relevant for values that are a set of fixed * alternatives or an X ID, such as the input focus window (which is a * window ID or None or PointerRoot). * * We can pick values which are known to be disjoint from X IDs because * X IDs never have any of the 0xe0000000 bits set. * * Unfortunately, we can't do this for bitmasks (well, unless all * bitmasks put together fit in the largest unsigned integer type * available, which I think is not the case). * * Any name beginning lx_ or LX_ should be considered to belong to the * library. Any application use of such a name in a way not part of * the API produces undefined behaviour. * * The library uses various internal names, some of which end up in * this file and thus are technically visible to application code. * Any name herein which begins lx__ or LX__ is library-internal. * Such names are not documented or committed interfaces; using them * from application code is not advised, is not supported, and is very * much entirely at your own risk. */ typedef unsigned char LX_KEYCODE; /* * Image-byte-order (from connection setup). */ typedef unsigned int LX_IMAGE_BYTE_ORDER; #define LX_IBO_LSBFirst 0x20000001 #define LX_IBO_MSBFirst 0x20000002 /* * Bitmap-bit-order (from connection setup). */ typedef unsigned int LX_BITMAP_BIT_ORDER; #define LX_BBO_LeastSignificant 0x20000003 #define LX_BBO_MostSignificant 0x20000004 /* * Window class, when creating windows or querying their class, though * CopyFromParent is valid only when creating. */ typedef unsigned int LX_WINDOW_CLASS; #define LX_WCLASS_InputOutput 0x20000005 #define LX_WCLASS_InputOnly 0x20000006 #define LX_WCLASS_CopyFromParent 0x20000007 /* * Most of these are used for both bit-gravity and win-gravity, but * Forget is used only for bit-gravity and Unmap only for win-gravity. * (Arguably we should use separate values for bit-gravity and * win-gravity; I may do that in a future major revision.) */ typedef unsigned int LX_GRAVITY; #define LX_GRAVITY_NorthWest 0x2000000d #define LX_GRAVITY_North 0x2000000e #define LX_GRAVITY_NorthEast 0x2000000f #define LX_GRAVITY_West 0x20000010 #define LX_GRAVITY_Center 0x20000011 #define LX_GRAVITY_East 0x20000012 #define LX_GRAVITY_SouthWest 0x20000013 #define LX_GRAVITY_South 0x20000014 #define LX_GRAVITY_SouthEast 0x20000015 #define LX_GRAVITY_Static 0x20000016 #define LX_GRAVITY_Forget 0x20000017 #define LX_GRAVITY_Unmap 0x20000018 /* * Backing-store hint values. */ typedef unsigned int LX_BACKINGSTORE; #define LX_BACKINGSTORE_NotUseful 0x2000001d #define LX_BACKINGSTORE_WhenMapped 0x2000001e #define LX_BACKINGSTORE_Always 0x2000001f /* * GC function values. Unlike most of the liblx interface values, * there is a little bit promised about these values. Specifically, * they are chosen such that bit operations on function values work, * with __src and __dst available to represent the source and * destination respectively, *provided* that, once done with the bit * operations, you AND with __mask and then OR in __base. * LX_GCFUNCTION_norm() is a convenience macro for this, as in * * LX_GCFUNCTION_norm(LX_GCFUNCTION__src & ~LX_GCFUNCTION__dst) * * (which evaluates to the same value as LX_GCFUNCTION_AndReverse, * AndReverse being the canonical X name for the src&~dst operation). */ typedef unsigned int LX_GCFUNCTION; #define LX_GCFUNCTION__base 0x20000030 #define LX_GCFUNCTION__mask 0x0000000f #define LX_GCFUNCTION__src 0x00000003 #define LX_GCFUNCTION__dst 0x00000005 #define LX_GCFUNCTION_norm(x) (((x) & LX_GCFUNCTION__mask) | LX_GCFUNCTION__base) #define LX_GCFUNCTION_Clear 0x20000030 #define LX_GCFUNCTION_And 0x20000031 #define LX_GCFUNCTION_AndReverse 0x20000032 #define LX_GCFUNCTION_Copy 0x20000033 #define LX_GCFUNCTION_AndInverted 0x20000034 #define LX_GCFUNCTION_NoOp 0x20000035 #define LX_GCFUNCTION_Xor 0x20000036 #define LX_GCFUNCTION_Or 0x20000037 #define LX_GCFUNCTION_Nor 0x20000038 #define LX_GCFUNCTION_Equiv 0x20000039 #define LX_GCFUNCTION_Invert 0x2000003a #define LX_GCFUNCTION_OrReverse 0x2000003b #define LX_GCFUNCTION_CopyInverted 0x2000003c #define LX_GCFUNCTION_OrInverted 0x2000003d #define LX_GCFUNCTION_Nand 0x2000003e #define LX_GCFUNCTION_Set 0x2000003f /* * Line-style in GCs. */ typedef unsigned int LX_GCLINESTYLE; #define LX_GCLINESTYLE_Solid 0x2000002d #define LX_GCLINESTYLE_OnOffDash 0x2000002e #define LX_GCLINESTYLE_DoubleDash 0x2000002f /* * Cap-style in GCs. */ typedef unsigned int LX_GCCAPSTYLE; #define LX_GCCAPSTYLE_NotLast 0x20000041 #define LX_GCCAPSTYLE_Butt 0x20000042 #define LX_GCCAPSTYLE_Round 0x20000043 #define LX_GCCAPSTYLE_Projecting 0x20000044 /* * Join-style in GC. */ typedef unsigned int LX_GCJOINSTYLE; #define LX_GCJOINSTYLE_Miter 0x20000046 #define LX_GCJOINSTYLE_Round 0x20000047 #define LX_GCJOINSTYLE_Bevel 0x20000048 /* * Fill-style in GC. */ typedef unsigned int LX_GCFILLSTYLE; #define LX_GCFILLSTYLE_Solid 0x2000004a #define LX_GCFILLSTYLE_Tiled 0x2000004b #define LX_GCFILLSTYLE_Stippled 0x2000004c #define LX_GCFILLSTYLE_OpaqueStippled 0x2000004d /* * Fill-rule in GCs. */ typedef unsigned int LX_GCFILLRULE; #define LX_GCFILLRULE_EvenOdd 0x2000004f #define LX_GCFILLRULE_Winding 0x20000050 /* * Subwindow-mode in GCs. */ typedef unsigned int LX_GCSUBWINDOWMODE; #define LX_GCSUBWINDOWMODE_ClipByChildren 0x20000052 #define LX_GCSUBWINDOWMODE_IncludeInferiors 0x20000053 /* * Arc-mode in GCs. */ typedef unsigned int LX_GCARCMODE; #define LX_GCARCMODE_Chord 0x20000055 #define LX_GCARCMODE_PieSlice 0x20000056 /* * Coord-mode in requests such as PolyLine. */ typedef unsigned int LX_COORDMODE; #define LX_COORDMODE_Origin 0x20000058 #define LX_COORDMODE_Previous 0x20000059 /* * Map-state of windows. */ typedef unsigned int LX_MAPSTATE; #define LX_MAPSTATE_Unmapped 0x2000005a #define LX_MAPSTATE_Unviewable 0x2000005b #define LX_MAPSTATE_Viewable 0x2000005c /* * Operations to lx_ForceScreenSaver. */ typedef unsigned int LX_FORCESCREENSAVER; #define LX_FORCESCREENSAVER_Reset 0x2000005e #define LX_FORCESCREENSAVER_Activate 0x2000005f /* * Distinguished values for atoms. (Not the predefined atom values * specified by the protocol; those appear below.) */ typedef unsigned int LX_ATOM; #define LX_ATOM_None 0x20000060 #define LX_ATOM_AnyPropertyType 0x20000061 /* * Protocol-defined atom values. Unlike most liblx API values, these * actually are defined as the protocol-specified values. */ #define LX_ATOM_PRIMARY 1 #define LX_ATOM_SECONDARY 2 #define LX_ATOM_ARC 3 #define LX_ATOM_ATOM 4 #define LX_ATOM_BITMAP 5 #define LX_ATOM_CARDINAL 6 #define LX_ATOM_COLORMAP 7 #define LX_ATOM_CURSOR 8 #define LX_ATOM_CUT_BUFFER0 9 #define LX_ATOM_CUT_BUFFER1 10 #define LX_ATOM_CUT_BUFFER2 11 #define LX_ATOM_CUT_BUFFER3 12 #define LX_ATOM_CUT_BUFFER4 13 #define LX_ATOM_CUT_BUFFER5 14 #define LX_ATOM_CUT_BUFFER6 15 #define LX_ATOM_CUT_BUFFER7 16 #define LX_ATOM_DRAWABLE 17 #define LX_ATOM_FONT 18 #define LX_ATOM_INTEGER 19 #define LX_ATOM_PIXMAP 20 #define LX_ATOM_POINT 21 #define LX_ATOM_RECTANGLE 22 #define LX_ATOM_RESOURCE_MANGER 23 #define LX_ATOM_RGB_COLOR_MAP 24 #define LX_ATOM_RGB_BEST_MAP 25 #define LX_ATOM_RGB_BLUE_MAP 26 #define LX_ATOM_RGB_DEFAULT_MAP 27 #define LX_ATOM_RGB_GRAY_MAP 28 #define LX_ATOM_RGB_GREEN_MAP 29 #define LX_ATOM_RGB_RED_MAP 30 #define LX_ATOM_STRING 31 #define LX_ATOM_VISUALID 32 #define LX_ATOM_WINDOW 33 #define LX_ATOM_WM_COMMAND 34 #define LX_ATOM_WM_HINTS 35 #define LX_ATOM_WM_CLIENT_MACHINE 36 #define LX_ATOM_WM_ICON_NAME 37 #define LX_ATOM_WM_ICON_SIZE 38 #define LX_ATOM_WM_NAME 39 #define LX_ATOM_WM_NORMAL_HINTS 40 #define LX_ATOM_WM_SIZE_HINTS 41 #define LX_ATOM_WM_ZOOM_HINTS 42 #define LX_ATOM_MIN_SPACE 43 #define LX_ATOM_NORM_SPACE 44 #define LX_ATOM_MAX_SPACE 45 #define LX_ATOM_END_SPACE 46 #define LX_ATOM_SUPERSCRIPT_X 47 #define LX_ATOM_SUPERSCRIPT_Y 48 #define LX_ATOM_SUBSCRIPT_X 49 #define LX_ATOM_SUBSCRIPT_Y 50 #define LX_ATOM_UNDERLINE_POSITION 51 #define LX_ATOM_UNDERLINE_THICKNESS 52 #define LX_ATOM_STRIKEOUT_ASCENT 53 #define LX_ATOM_STRIKEOUT_DESCENT 54 #define LX_ATOM_ITALIC_ANGLE 55 #define LX_ATOM_X_HEIGHT 56 #define LX_ATOM_QUAD_WIDTH 57 #define LX_ATOM_WEIGHT 58 #define LX_ATOM_POINT_SIZE 59 #define LX_ATOM_RESOLUTION 60 #define LX_ATOM_COPYRIGHT 61 #define LX_ATOM_NOTICE 62 #define LX_ATOM_FONT_NAME 63 #define LX_ATOM_FAMILY_NAME 64 #define LX_ATOM_FULL_NAME 65 #define LX_ATOM_CAP_HEIGHT 66 #define LX_ATOM_WM_CLASS 67 #define LX_ATOM_WM_TRANSIENT_FOR 68 /* * Connection close-down modes. */ typedef unsigned int LX_CLOSEDOWNMODE; #define LX_CLOSEDOWNMODE_Destroy 0x20000063 #define LX_CLOSEDOWNMODE_RetainPermanent 0x20000064 #define LX_CLOSEDOWNMODE_RetainTemporary 0x20000065 /* * Access control states. */ typedef unsigned int LX_ACCESSCONTROL; #define LX_ACCESSCONTROL_Disable 0x20000066 #define LX_ACCESSCONTROL_Enable 0x20000067 /* * Host address types. All but _Error represent various host types in * the protocol; _Other is used for types other than the rest. (For * _Other, the type-specific data blob has the protocol type byte * prepended to it as the interface data blob.) _Error exists for * error returns from lx_hostlist_entry_type. */ typedef unsigned int LX_HOSTTYPE; #define LX_HOSTTYPE_IPv4 0x20000069 #define LX_HOSTTYPE_IPv6 0x2000006a #define LX_HOSTTYPE_DECnet 0x2000006b #define LX_HOSTTYPE_Chaos 0x2000006c #define LX_HOSTTYPE_Other 0x2000006d #define LX_HOSTTYPE_Error 0x2000006e /* * The mode argument to ChangeHosts operations. */ typedef unsigned int LX_CHANGEHOSTSMODE; #define LX_CHANGEHOSTSMODE_Insert 0x2000006f #define LX_CHANGEHOSTSMODE_Delete 0x20000070 /* * The mode argument to ChangeSaveSet operations. */ typedef unsigned int LX_CHANGESAVESETMODE; #define LX_CHANGESAVESETMODE_Insert 0x2000008d #define LX_CHANGESAVESETMODE_Delete 0x2000008e /* * Prefer-blanking values for the screen-saver interfaces. */ typedef unsigned int LX_SSBLANKING; #define LX_SSBLANKING_No 0x20000071 #define LX_SSBLANKING_Yes 0x20000072 #define LX_SSBLANKING_Default 0x20000073 /* * Allow-exposures values for the screen-saver interfaces. */ typedef unsigned int LX_SSEXPOSURES; #define LX_SSEXPOSURES_No 0x20000075 #define LX_SSEXPOSURES_Yes 0x20000076 #define LX_SSEXPOSURES_Default 0x20000077 /* * LED-action values to ChangeKeyboardControl operations. * * See the comment on ChangeKeyboardControl before changing this. */ typedef unsigned int LX_KBCTLLEDACTION; #define LX_KBCTLLEDACTION_Off 0x20000079 #define LX_KBCTLLEDACTION_On 0x2000007a /* * Repeat-action values to ChangeKeyboardControl operations. * * See the comment on ChangeKeyboardControl before changing this. */ typedef unsigned int LX_KBCTLREPEATACTION; #define LX_KBCTLREPEATACTION_Off 0x2000007b #define LX_KBCTLREPEATACTION_On 0x2000007c #define LX_KBCTLREPEATACTION_Default 0x2000007d /* * Size classes to QueryBestSize operations. */ typedef unsigned int LX_SIZECLASS; #define LX_SIZECLASS_Cursor 0x2000007e #define LX_SIZECLASS_Tile 0x2000007f #define LX_SIZECLASS_Stipple 0x20000080 /* * Image format values for the image interfaces. */ typedef unsigned int LX_IMAGEFORMAT; #define LX_IMAGEFORMAT_Bitmap 0x20000083 #define LX_IMAGEFORMAT_XYPixmap 0x20000084 #define LX_IMAGEFORMAT_ZPixmap 0x20000085 /* * Shape class values for, eg, FillPoly operations. */ typedef unsigned int LX_SHAPECLASS; #define LX_SHAPECLASS_Complex 0x20000086 #define LX_SHAPECLASS_Nonconvex 0x20000087 #define LX_SHAPECLASS_Convex 0x20000088 /* * Rectangle ordering values for, eg, SetClipRectangles operations. */ typedef unsigned int LX_RECTORDER; #define LX_RECTORDER_UnSorted 0x20000089 #define LX_RECTORDER_YSorted 0x2000008a #define LX_RECTORDER_YXSorted 0x2000008b #define LX_RECTORDER_YXBanded 0x2000008c /* * Operations for CirculateWindow operations. */ typedef unsigned int LX_CIRCULATE; #define LX_CIRCULATE_RaiseLowest 0x2000008f #define LX_CIRCULATE_LowerHighest 0x20000090 /* * Stacking modes for, eg, ConfigureWindow operations. */ typedef unsigned int LX_STACKMODE; #define LX_STACKMODE_Above 0x20000091 #define LX_STACKMODE_Below 0x20000092 #define LX_STACKMODE_TopIf 0x20000093 #define LX_STACKMODE_BottomIf 0x20000094 #define LX_STACKMODE_Opposite 0x20000095 /* * Operations on properties. */ typedef unsigned int LX_PROPERTYMODE; #define LX_PROPERTYMODE_Replace 0x20000096 #define LX_PROPERTYMODE_Prepend 0x20000097 #define LX_PROPERTYMODE_Append 0x20000098 /* * Grab modes. */ typedef unsigned int LX_GRABMODE; #define LX_GRABMODE_Synchronous 0x20000099 #define LX_GRABMODE_Asynchronous 0x2000009a /* * Grab stati. */ typedef unsigned int LX_GRABSTATUS; #define LX_GRABSTATUS_Success 0x2000009b #define LX_GRABSTATUS_AlreadyGrabbed 0x2000009c #define LX_GRABSTATUS_InvalidTime 0x2000009d #define LX_GRABSTATUS_NotViewable 0x2000009e #define LX_GRABSTATUS_Frozen 0x2000009f /* * Allow-events operations. */ typedef unsigned int LX_ALLOWMODE; #define LX_ALLOWMODE_AsyncPointer 0x200000a1 #define LX_ALLOWMODE_SyncPointer 0x200000a2 #define LX_ALLOWMODE_ReplayPointer 0x200000a3 #define LX_ALLOWMODE_AsyncKeyboard 0x200000a4 #define LX_ALLOWMODE_SyncKeyboard 0x200000a5 #define LX_ALLOWMODE_ReplayKeyboard 0x200000a6 #define LX_ALLOWMODE_AsyncBoth 0x200000a7 #define LX_ALLOWMODE_SyncBoth 0x200000a8 /* * Text directions. */ typedef unsigned int LX_TEXTDIRECTION; #define LX_TEXTDIRECTION_LeftToRight 0x200000a9 #define LX_TEXTDIRECTION_RightToLeft 0x200000aa /* * Detail values in MotionNotify events. */ typedef unsigned int LX_MOTIONDETAIL; #define LX_MOTIONDETAIL_Normal 0x200000ac #define LX_MOTIONDETAIL_Hint 0x200000ad /* * Detail values in EnterNotify and LeaveNotifiy events. */ typedef unsigned int LX_ENTERLEAVEDETAIL; #define LX_ENTERLEAVEDETAIL_Ancestor 0x200000af #define LX_ENTERLEAVEDETAIL_Virtual 0x200000b0 #define LX_ENTERLEAVEDETAIL_Inferior 0x200000b1 #define LX_ENTERLEAVEDETAIL_Nonlinear 0x200000b2 #define LX_ENTERLEAVEDETAIL_NonlinearVirtual 0x200000b3 /* * Mode values in EnterNotify and LeaveNotifiy events. */ typedef unsigned int LX_ENTERLEAVEMODE; #define LX_ENTERLEAVEMODE_Normal 0x200000b4 #define LX_ENTERLEAVEMODE_Grab 0x200000b5 #define LX_ENTERLEAVEMODE_Ungrab 0x200000b6 /* * Detail values in focus events. */ typedef unsigned int LX_FOCUSDETAIL; #define LX_FOCUSDETAIL_Ancestor 0x200000b7 #define LX_FOCUSDETAIL_Virtual 0x200000b8 #define LX_FOCUSDETAIL_Inferior 0x200000b9 #define LX_FOCUSDETAIL_Nonlinear 0x200000ba #define LX_FOCUSDETAIL_NonlinearVirtual 0x200000bb #define LX_FOCUSDETAIL_Pointer 0x200000bc #define LX_FOCUSDETAIL_PointerRoot 0x200000bd #define LX_FOCUSDETAIL_None 0x200000be /* * Mode values in focus events. */ typedef unsigned int LX_FOCUSMODE; #define LX_FOCUSMODE_Normal 0x200000bf #define LX_FOCUSMODE_Grab 0x200000c0 #define LX_FOCUSMODE_Ungrab 0x200000c1 #define LX_FOCUSMODE_WhileGrabbed 0x200000c2 /* * State values in visibility events. */ typedef unsigned int LX_VISIBILITYSTATE; #define LX_VISIBILITYSTATE_Unobscured 0x200000c3 #define LX_VISIBILITYSTATE_PartiallyObscured 0x200000c4 #define LX_VISIBILITYSTATE_FullyObscured 0x200000c5 /* * Place values in window-circulate events. */ typedef unsigned int LX_CIRCULATEPLACE; #define LX_CIRCULATEPLACE_Top 0x200000c6 #define LX_CIRCULATEPLACE_Bottom 0x200000c7 /* * State values in property events. */ typedef unsigned int LX_PROPERTYSTATE; #define LX_PROPERTYSTATE_NewValue 0x200000c8 #define LX_PROPERTYSTATE_Deleted 0x200000c9 /* * State values in colormap events. */ typedef unsigned int LX_COLORMAPSTATE; #define LX_COLORMAPSTATE_Uninstalled 0x200000ca #define LX_COLORMAPSTATE_Installed 0x200000cb /* * Request values in MappingNotify events. */ typedef unsigned int LX_MAPPINGREQUEST; #define LX_MAPPINGREQUEST_Modifier 0x200000cc #define LX_MAPPINGREQUEST_Keyboard 0x200000cd #define LX_MAPPINGREQUEST_Pointer 0x200000ce /* * Return status values from SetModifierMapping or SetPointerMapping. */ typedef unsigned int LX_MAPPINGSTATUS; #define LX_MAPPINGSTATUS_Success 0x200000d1 #define LX_MAPPINGSTATUS_Busy 0x200000d2 #define LX_MAPPINGSTATUS_Failed 0x200000d3 // SetModifierMapping only /* * Event state masks in, eg, KeyPress events. * * At the moment, these values equal the corresponding protocol values. * It is a bug to depend on that, though. */ #define LX_EVS_Shift 0x0001 #define LX_EVS_Lock 0x0002 #define LX_EVS_Control 0x0004 #define LX_EVS_Mod1 0x0008 #define LX_EVS_Mod2 0x0010 #define LX_EVS_Mod3 0x0020 #define LX_EVS_Mod4 0x0040 #define LX_EVS_Mod5 0x0080 #define LX_EVS_Button1 0x0100 #define LX_EVS_Button2 0x0200 #define LX_EVS_Button3 0x0400 #define LX_EVS_Button4 0x0800 #define LX_EVS_Button5 0x1000 /* * Value-mask bits in ConfigureRequest events. * * At the moment, these values equal the corresponding protocol values. * It is a bug to depend on that, though. */ #define LX_CONFIGUREREQUEST_X 0x00000001 #define LX_CONFIGUREREQUEST_Y 0x00000002 #define LX_CONFIGUREREQUEST_Width 0x00000004 #define LX_CONFIGUREREQUEST_Height 0x00000008 #define LX_CONFIGUREREQUEST_BorderWidth 0x00000010 #define LX_CONFIGUREREQUEST_Sibling 0x00000020 #define LX_CONFIGUREREQUEST_StackMode 0x00000040 /* * Mask bits for the struct variants of CreateGC and ChangeGC. * * At the moment, these values (except _PUSH) equal the corresponding * protocol values. It is a bug to depend on that, though. */ #define LX_GCM_Function 0x00000001 #define LX_GCM_PlaneMask 0x00000002 #define LX_GCM_Foreground 0x00000004 #define LX_GCM_Background 0x00000008 #define LX_GCM_LineWidth 0x00000010 #define LX_GCM_LineStyle 0x00000020 #define LX_GCM_CapStyle 0x00000040 #define LX_GCM_JoinStyle 0x00000080 #define LX_GCM_FillStyle 0x00000100 #define LX_GCM_FillRule 0x00000200 #define LX_GCM_Tile 0x00000400 #define LX_GCM_Stipple 0x00000800 #define LX_GCM_TileStipXOrigin 0x00001000 #define LX_GCM_TileStipYOrigin 0x00002000 #define LX_GCM_Font 0x00004000 #define LX_GCM_SubwindowMode 0x00008000 #define LX_GCM_GraphicsExposures 0x00010000 #define LX_GCM_ClipXOrigin 0x00020000 #define LX_GCM_ClipYOrigin 0x00040000 #define LX_GCM_ClipMask 0x00080000 #define LX_GCM_DashOffset 0x00100000 #define LX_GCM_Dashes 0x00200000 #define LX_GCM_ArcMode 0x00400000 // For lx_ChangeSGC_attr #define LX_GCM_PUSH 0x80000000 /* * Mask bits for the struct variant of, eg, CreateWindow. * * At the moment, these values equal the corresponding protocol values. * It is a bug to depend on that, though. */ #define LX_SWM_BackPixmap 0x00000001 #define LX_SWM_BackPixel 0x00000002 #define LX_SWM_BorderPixmap 0x00000004 #define LX_SWM_BorderPixel 0x00000008 #define LX_SWM_BitGravity 0x00000010 #define LX_SWM_WinGravity 0x00000020 #define LX_SWM_BackingStore 0x00000040 #define LX_SWM_BackingPlanes 0x00000080 #define LX_SWM_BackingPixel 0x00000100 #define LX_SWM_OverrideRedirect 0x00000200 #define LX_SWM_SaveUnder 0x00000400 #define LX_SWM_EventMask 0x00000800 #define LX_SWM_DontPropagate 0x00001000 #define LX_SWM_Colormap 0x00002000 #define LX_SWM_Cursor 0x00004000 /* * Event mask bits. * * At the moment, these values equal the corresponding protocol values. * It is a bug to depend on that, though. */ #define LX_EM_KeyPress 0x00000001 #define LX_EM_KeyRelease 0x00000002 #define LX_EM_ButtonPress 0x00000004 #define LX_EM_ButtonRelease 0x00000008 #define LX_EM_EnterWindow 0x00000010 #define LX_EM_LeaveWindow 0x00000020 #define LX_EM_PointerMotion 0x00000040 #define LX_EM_PointerMotionHint 0x00000080 #define LX_EM_Button1Motion 0x00000100 #define LX_EM_Button2Motion 0x00000200 #define LX_EM_Button3Motion 0x00000400 #define LX_EM_Button4Motion 0x00000800 #define LX_EM_Button5Motion 0x00001000 #define LX_EM_ButtonMotion 0x00002000 #define LX_EM_KeymapState 0x00004000 #define LX_EM_Exposure 0x00008000 #define LX_EM_VisibilityChange 0x00010000 #define LX_EM_StructureNotify 0x00020000 #define LX_EM_ResizeRedirect 0x00040000 #define LX_EM_SubstructureNotify 0x00080000 #define LX_EM_SubstructureRedirect 0x00100000 #define LX_EM_FocusChange 0x00200000 #define LX_EM_PropertyChange 0x00400000 #define LX_EM_ColormapChange 0x00800000 #define LX_EM_OwnerGrabButton 0x01000000 /* * Event types. * * At the moment, these values equal the corresponding protocol values. * It is a bug to depend on that, though. */ #define LX_EV_KeyPress 2 #define LX_EV_KeyRelease 3 #define LX_EV_ButtonPress 4 #define LX_EV_ButtonRelease 5 #define LX_EV_MotionNotify 6 #define LX_EV_EnterNotify 7 #define LX_EV_LeaveNotify 8 #define LX_EV_FocusIn 9 #define LX_EV_FocusOut 10 #define LX_EV_KeymapNotify 11 #define LX_EV_Expose 12 #define LX_EV_GraphicsExposure 13 #define LX_EV_NoExposure 14 #define LX_EV_VisibilityNotify 15 #define LX_EV_CreateNotify 16 #define LX_EV_DestroyNotify 17 #define LX_EV_UnmapNotify 18 #define LX_EV_MapNotify 19 #define LX_EV_MapRequest 20 #define LX_EV_ReparentNotify 21 #define LX_EV_ConfigureNotify 22 #define LX_EV_ConfigureRequest 23 #define LX_EV_GravityNotify 24 #define LX_EV_ResizeRequest 25 #define LX_EV_CirculateNotify 26 #define LX_EV_CirculateRequest 27 #define LX_EV_PropertyNotify 28 #define LX_EV_SelectionClear 29 #define LX_EV_SelectionRequest 30 #define LX_EV_SelectionNotify 31 #define LX_EV_ColormapNotify 32 #define LX_EV_ClientMessage 33 #define LX_EV_MappingNotify 34 /* * Types which are opaque to application code. */ typedef struct lx_conn LX_CONN; typedef struct lx_op LX_OP; typedef struct lx_hostlist LX_HOSTLIST; typedef struct lx_strlist LX_STRLIST; typedef struct lx_XIDlist LX_XIDLIST; /* * Library types which are _not_ opaque to application code. */ /* * Time values such as are used in, eg, grabs. * * CurrentTime is zero at the protocol level. Arguably the API value * should be nonzero. So far I've felt that the error-checking that * would bring isn't worth the code complexity. */ typedef unsigned int LX_TIME; #define LX_TIME_CurrentTime 0 /* * Events are represented as a discriminated union. The type is * LX_EVENT, with the discriminant called type. Each event type name * provides both the name of the per-type member and the name of the * struct for that type. For example, KeyPress events use * LX_EVENT_KeyPress as the KeyPress-specific struct, and the * discriminated union member name is called KeyPress. * * There is one other non-discriminated member in LX_EVENT, since there * is one other attribute of events which applies to all events: the * "came from a SendEvent request" bit. */ typedef struct lx_event_KeyPress LX_EVENT_KeyPress; struct lx_event_KeyPress { unsigned char keycode; unsigned short int seq; LX_TIME time; LX_XID rootw; LX_XID eventw; LX_XID childw; int rootx; int rooty; int eventx; int eventy; unsigned int state; int samescreen; } ; typedef struct lx_event_KeyRelease LX_EVENT_KeyRelease; struct lx_event_KeyRelease { unsigned char keycode; unsigned short int seq; LX_TIME time; LX_XID rootw; LX_XID eventw; LX_XID childw; int rootx; int rooty; int eventx; int eventy; unsigned int state; int samescreen; } ; typedef struct lx_event_ButtonPress LX_EVENT_ButtonPress; struct lx_event_ButtonPress { unsigned char button; unsigned short int seq; LX_TIME time; LX_XID rootw; LX_XID eventw; LX_XID childw; int rootx; int rooty; int eventx; int eventy; unsigned int state; int samescreen; } ; typedef struct lx_event_ButtonRelease LX_EVENT_ButtonRelease; struct lx_event_ButtonRelease { unsigned char button; unsigned short int seq; LX_TIME time; LX_XID rootw; LX_XID eventw; LX_XID childw; int rootx; int rooty; int eventx; int eventy; unsigned int state; int samescreen; } ; typedef struct lx_event_MotionNotify LX_EVENT_MotionNotify; struct lx_event_MotionNotify { LX_MOTIONDETAIL detail; unsigned short int seq; LX_TIME time; LX_XID rootw; LX_XID eventw; LX_XID childw; int rootx; int rooty; int eventx; int eventy; unsigned int state; int samescreen; } ; typedef struct lx_event_EnterNotify LX_EVENT_EnterNotify; struct lx_event_EnterNotify { LX_ENTERLEAVEDETAIL detail; unsigned short int seq; LX_TIME time; LX_XID rootw; LX_XID eventw; LX_XID childw; int rootx; int rooty; int eventx; int eventy; unsigned int state; LX_ENTERLEAVEMODE mode; int samescreen; int focus; } ; typedef struct lx_event_LeaveNotify LX_EVENT_LeaveNotify; struct lx_event_LeaveNotify { LX_ENTERLEAVEDETAIL detail; unsigned short int seq; LX_TIME time; LX_XID rootw; LX_XID eventw; LX_XID childw; int rootx; int rooty; int eventx; int eventy; unsigned int state; LX_ENTERLEAVEMODE mode; int samescreen; int focus; } ; typedef struct lx_event_FocusIn LX_EVENT_FocusIn; struct lx_event_FocusIn { LX_FOCUSDETAIL detail; unsigned short int seq; LX_XID eventw; LX_FOCUSMODE mode; } ; typedef struct lx_event_FocusOut LX_EVENT_FocusOut; struct lx_event_FocusOut { LX_FOCUSDETAIL detail; unsigned short int seq; LX_XID eventw; LX_FOCUSMODE mode; } ; typedef struct lx_event_KeymapNotify LX_EVENT_KeymapNotify; struct lx_event_KeymapNotify { unsigned char map[31]; } ; typedef struct lx_event_Expose LX_EVENT_Expose; struct lx_event_Expose { unsigned short int seq; LX_XID eventw; unsigned int x; unsigned int y; unsigned int w; unsigned int h; unsigned int count; } ; typedef struct lx_event_GraphicsExposure LX_EVENT_GraphicsExposure; struct lx_event_GraphicsExposure { unsigned short int seq; LX_XID drawable; unsigned int x; unsigned int y; unsigned int w; unsigned int h; unsigned int minor_opc; unsigned int count; unsigned int major_opc; } ; typedef struct lx_event_NoExposure LX_EVENT_NoExposure; struct lx_event_NoExposure { unsigned short int seq; LX_XID drawable; unsigned int minor_opc; unsigned int major_opc; } ; typedef struct lx_event_VisibilityNotify LX_EVENT_VisibilityNotify; struct lx_event_VisibilityNotify { unsigned short int seq; LX_XID window; LX_VISIBILITYSTATE state; } ; typedef struct lx_event_CreateNotify LX_EVENT_CreateNotify; struct lx_event_CreateNotify { unsigned short int seq; LX_XID parent; LX_XID window; int x; int y; unsigned int w; unsigned int h; unsigned int borderwidth; int override_redirect; } ; typedef struct lx_event_DestroyNotify LX_EVENT_DestroyNotify; struct lx_event_DestroyNotify { unsigned short int seq; LX_XID eventw; LX_XID window; } ; typedef struct lx_event_UnmapNotify LX_EVENT_UnmapNotify; struct lx_event_UnmapNotify { unsigned short int seq; LX_XID eventw; LX_XID window; int from_configure; } ; typedef struct lx_event_MapNotify LX_EVENT_MapNotify; struct lx_event_MapNotify { unsigned short int seq; LX_XID eventw; LX_XID window; int override_redirect; } ; typedef struct lx_event_MapRequest LX_EVENT_MapRequest; struct lx_event_MapRequest { unsigned short int seq; LX_XID parent; LX_XID window; } ; typedef struct lx_event_ReparentNotify LX_EVENT_ReparentNotify; struct lx_event_ReparentNotify { unsigned short int seq; LX_XID eventw; LX_XID window; LX_XID parent; int x; int y; int override_redirect; } ; typedef struct lx_event_ConfigureNotify LX_EVENT_ConfigureNotify; struct lx_event_ConfigureNotify { unsigned short int seq; LX_XID eventw; LX_XID window; LX_XID above_sibling; int x; int y; unsigned int w; unsigned int h; unsigned int borderwidth; int override_redirect; } ; typedef struct lx_event_ConfigureRequest LX_EVENT_ConfigureRequest; struct lx_event_ConfigureRequest { LX_STACKMODE stackmode; unsigned short int seq; LX_XID parent; LX_XID window; LX_XID sibling; int x; int y; unsigned int w; unsigned int h; unsigned int borderwidth; unsigned int mask; // LX_CONFIGUREREQUEST_* bits } ; typedef struct lx_event_GravityNotify LX_EVENT_GravityNotify; struct lx_event_GravityNotify { unsigned short int seq; LX_XID eventw; LX_XID window; int x; int y; } ; typedef struct lx_event_ResizeRequest LX_EVENT_ResizeRequest; struct lx_event_ResizeRequest { unsigned short int seq; LX_XID window; unsigned int w; unsigned int h; } ; typedef struct lx_event_CirculateNotify LX_EVENT_CirculateNotify; struct lx_event_CirculateNotify { unsigned short int seq; LX_XID eventw; LX_XID window; LX_CIRCULATEPLACE place; } ; typedef struct lx_event_CirculateRequest LX_EVENT_CirculateRequest; struct lx_event_CirculateRequest { unsigned short int seq; LX_XID parent; LX_XID window; LX_CIRCULATEPLACE place; } ; typedef struct lx_event_PropertyNotify LX_EVENT_PropertyNotify; struct lx_event_PropertyNotify { unsigned short int seq; LX_XID window; LX_ATOM atom; LX_TIME time; LX_PROPERTYSTATE state; } ; typedef struct lx_event_SelectionClear LX_EVENT_SelectionClear; struct lx_event_SelectionClear { unsigned short int seq; LX_TIME time; LX_XID owner; LX_XID selection; } ; typedef struct lx_event_SelectionRequest LX_EVENT_SelectionRequest; struct lx_event_SelectionRequest { unsigned short int seq; LX_TIME time; LX_XID owner; LX_XID requestor; LX_ATOM selection; LX_ATOM target; LX_ATOM property; } ; typedef struct lx_event_SelectionNotify LX_EVENT_SelectionNotify; struct lx_event_SelectionNotify { unsigned short int seq; LX_TIME time; LX_XID requestor; LX_ATOM selection; LX_ATOM target; LX_ATOM property; } ; typedef struct lx_event_ColormapNotify LX_EVENT_ColormapNotify; struct lx_event_ColormapNotify { unsigned short int seq; LX_XID window; LX_XID colormap; int new; LX_COLORMAPSTATE state; } ; typedef struct lx_event_ClientMessage LX_EVENT_ClientMessage; struct lx_event_ClientMessage { int format; unsigned short int seq; LX_XID window; LX_XID type; union { unsigned char data8[20]; unsigned short int data16[10]; unsigned int data32[5]; } u; } ; typedef struct lx_event_MappingNotify LX_EVENT_MappingNotify; struct lx_event_MappingNotify { unsigned short int seq; LX_MAPPINGREQUEST request; unsigned int first_keycode; unsigned int count; } ; typedef struct lx_event LX_EVENT; struct lx_event { int type; int send_event; union { LX_EVENT_KeyPress KeyPress; LX_EVENT_KeyRelease KeyRelease; LX_EVENT_ButtonPress ButtonPress; LX_EVENT_ButtonRelease ButtonRelease; LX_EVENT_MotionNotify MotionNotify; LX_EVENT_EnterNotify EnterNotify; LX_EVENT_LeaveNotify LeaveNotify; LX_EVENT_FocusIn FocusIn; LX_EVENT_FocusOut FocusOut; LX_EVENT_KeymapNotify KeymapNotify; LX_EVENT_Expose Expose; LX_EVENT_GraphicsExposure GraphicsExposure; LX_EVENT_NoExposure NoExposure; LX_EVENT_VisibilityNotify VisibilityNotify; LX_EVENT_CreateNotify CreateNotify; LX_EVENT_DestroyNotify DestroyNotify; LX_EVENT_UnmapNotify UnmapNotify; LX_EVENT_MapNotify MapNotify; LX_EVENT_MapRequest MapRequest; LX_EVENT_ReparentNotify ReparentNotify; LX_EVENT_ConfigureNotify ConfigureNotify; LX_EVENT_ConfigureRequest ConfigureRequest; LX_EVENT_GravityNotify GravityNotify; LX_EVENT_ResizeRequest ResizeRequest; LX_EVENT_CirculateNotify CirculateNotify; LX_EVENT_CirculateRequest CirculateRequest; LX_EVENT_PropertyNotify PropertyNotify; LX_EVENT_SelectionClear SelectionClear; LX_EVENT_SelectionRequest SelectionRequest; LX_EVENT_SelectionNotify SelectionNotify; LX_EVENT_ColormapNotify ColormapNotify; LX_EVENT_ClientMessage ClientMessage; LX_EVENT_MappingNotify MappingNotify; } u; } ; /* * Description of a Visual, a la Xlib's XVisualInfo. */ typedef unsigned int LX_VISUALCLASS; #define LX_VISUALCLASS_StaticColor 0x200000d8 #define LX_VISUALCLASS_PseudoColor 0x200000d9 #define LX_VISUALCLASS_StaticGray 0x200000da #define LX_VISUALCLASS_GrayScale 0x200000db #define LX_VISUALCLASS_TrueColor 0x200000dc #define LX_VISUALCLASS_DirectColor 0x200000dd // de and df not used; decomposed grayscale does not make sense. #define LX_VISUALCLASS_dynamic(vc) ((vc) & 1) #define LX_VISUALCLASS_grayscale(vc) ((vc) & 2) typedef unsigned int LX_PRIMARY; typedef struct lx_visinfo LX_VISINFO; struct lx_visinfo { int key; LX_XID id; unsigned int screen; unsigned int depth; LX_VISUALCLASS class; LX_PRIMARY r; LX_PRIMARY g; LX_PRIMARY b; unsigned int mapsize; unsigned int bits_per_rgb; } ; /* * Scan Visual info. This is the closest thing to Xlib's * XGetVisualInfo. * * For each LX_VISINFO available on the connection, this calls the * specified callback function with the specified argument and the * LX_VISINFO pointer. The callback returns int; if it returns a * negative value, lx_map_visuals returns that value immediately, * without making any further callbacks. If none of the calls return * negative values, lx_map_visuals returns the sum of all the return * values. * * The library promises that the LX_VISINFOs pointed to will exist * until the LX_CONN is closed. * * Nothing is promised about what order the callbacks are made for the * LX_VISINFOs, not even that the order used by one call bears any * relation to the order used by another. */ extern int lx_map_visuals(LX_CONN *, int (*)(void *, const LX_VISINFO *), void *); /* * It is possible to associate arbitrary-data pointers with each * LX_CONN. * * These data pointers are named by non-negative ints. There is a * (program-global) registry of these ints; each LX_CONN conceptually * has an array of these pointers, one for each possible non-negative * int value, initially all nil. There are calls to get a new index * into the array (one of the "ints" above) and to get and set a given * index's pointer for a given LX_CONN. For brevity, in the * documentation below, these pointers are called "connpriv" pointers, * and the integer subscripts into that array are called "index" * values. (This facility is modeled loosely after the * device-privates mechanisms in the MIT sample X server.) * * Closing an LX_CONN does not do anything in particular with any * connpriv pointers which may be attached to it. * * The API promises that an index can fit into an int and is never * negative. It does not promise anything else; for example, there is * no promise that they are _small_ integers. * * The API represents connpriv pointers as void *. * * Specifically: * * int lx_new_conn_private(void) * Returns a new index; all LX_CONNs' connprivs for this * index are initially nil. * * void *lx_get_private(LX_CONN *xc, int x) * Returns xc's connpriv for index x. * * void *lx_set_private(LX_CONN *xc, int x, void *v) * Sets xc's connpriv for index x to v, returning the * previous connpriv pointer for xc and x. * * It is possible for lx_set_private to run out of memory. This is * reflected as an LX_LE_NOMEM error on the LX_CONN. * * It is a catastrophic application error to call lx_get_private or * lx_set_private with an index not previously returned by * lx_new_conn_private. The library's reaction to such calls is * undefined. */ extern int lx_new_conn_private(void); extern void *lx_get_private(LX_CONN *, int); extern void *lx_set_private(LX_CONN *, int, void *); /* * Font information. * * LX_FONTINFO is per-font information. LX_CHARINFO serves two * purposes. One is as per-character information for fonts; the other * is to represent the same information for a whole string of * characters in calls such as QueryTextExtents8. * * lx_priv is library-private info. Library code that uses * LX_FONTINFOs may use the public struct members or may use the * private info; if application code changes any of the public * members, it must call lx_fontinfo_recache for the library to udpate * its cached info. If creating an LX_FONTINFO on its own, the * appropriate thing to do with lx_priv is to set it to nil; * lx_fontinfo_recache will then allocate private data as appropriate * and compute anything relevant. lx_fontinfo_recache may be * relatively expensive; it should be called sparingly, preferably * only when necessary. * * When the library creates an LX_FONTINFO, it, the propnames vector, * the propvalues vector, and the charinfos vector are each * individually malloc()ed. To free an LX_FONTINFO allocated by the * library, or manually allocated equivalently, use * lx_fontinfo_free(). To free just the lx_priv library-private data * (such as before freeing an LX_FONTINFO allocated some other way), * use lx_fontinfo_free_priv(); this leaves the priv pointer nil, * suitable for another lx_fontinfo_recache call if it isn't to be * freed. * * lx_fontinfo_charinfo takes an LX_FONTINFO * and a character index * and returns a pointer to the LX_CHARINFO data for that character. * This is provided to free applications from knowing the (relatively * complex) rules for locating the relevant LX_CHARINFO. Note that * the returned LX_CHARINFO pointer is consted; it must not be written * through, since under some circumstances it may be shared among * multiple character indices. The behaviour of this call is * undefined if the character index is out of the range 0..65535. For * any in-range character index for which no info is available, it * will return nil. */ typedef struct lx_fontinfo LX_FONTINFO; typedef struct lx_charinfo LX_CHARINFO; struct lx_charinfo { int lbearing; int rbearing; int width; int ascent; int descent; unsigned int attr; } ; struct lx_fontinfo { LX_CHARINFO minbounds; LX_CHARINFO maxbounds; unsigned int minb1; unsigned int maxb1; unsigned int mincb2; unsigned int maxcb2; unsigned int defchar; unsigned int nprops; LX_XID *propnames; unsigned int *propvalues; LX_TEXTDIRECTION dir; int all_chars_exist; int font_ascent; int font_descent; int ncharinfo; LX_CHARINFO *charinfos; void *lx_priv; } ; extern void lx_fontinfo_recache(LX_FONTINFO *); extern const LX_CHARINFO *lx_fontinfo_charinfo(const LX_FONTINFO *, unsigned int); extern void lx_fontinfo_free(LX_FONTINFO *); extern void lx_fontinfo_free_priv(LX_FONTINFO *); /* * A time-and-coordinates triple, such as is used for motion event * history. */ typedef struct lx_timecoord LX_TIMECOORD; struct lx_timecoord { LX_TIME time; int x; int y; } ; /* * A line segment, for calls such as PolySegment. */ typedef struct lx_segment LX_SEGMENT; struct lx_segment { int x1; int y1; int x2; int y2; } ; /* * A point, for calls such as PolyPoint. */ typedef struct lx_point LX_POINT; struct lx_point { int x; int y; } ; /* * An arc, for calls such as PolyArc. */ typedef struct lx_arc LX_ARC; struct lx_arc { int x; int y; int w; int h; int a1; int a2; } ; /* * A rectangle, for calls such as PolyRectangle. */ typedef struct lx_rectangle LX_RECTANGLE; struct lx_rectangle { int x; int y; int w; int h; } ; /* * Gettable window attributes, for GetWindowAttributes operations. */ typedef struct lx_get_window_attributes LX_GET_WINDOW_ATTRIBUTES; struct lx_get_window_attributes { unsigned int backing_store; LX_XID visual; unsigned int class; LX_GRAVITY bit_gravity; LX_GRAVITY win_gravity; unsigned int backing_planes; unsigned int backing_pixel; int save_under; int cmap_installed; LX_MAPSTATE map_state; int override_redirect; LX_XID colormap; unsigned int all_events; unsigned int our_events; unsigned int dont_propagate; } ; /* * Settable window attributes, for calls such as the attribute-struct * variant of CreateWindow. */ typedef struct lx_set_window_attributes LX_SET_WINDOW_ATTRIBUTES; struct lx_set_window_attributes { LX_XID background_pixmap; unsigned int background_pixel; LX_XID border_pixmap; unsigned int border_pixel; LX_GRAVITY bit_gravity; LX_GRAVITY win_gravity; LX_BACKINGSTORE backing_store; unsigned int backing_planes; unsigned int backing_pixel; int override_redirect; int save_under; unsigned int event_mask; unsigned int dont_propagate; LX_XID colormap; LX_XID cursor; } ; /* * More window attributes, this time the ones which can be affected by * ConfigureWindow requests. */ typedef struct lx_cfg_window_attributes LX_CFG_WINDOW_ATTRIBUTES; struct lx_cfg_window_attributes { int x; int y; int w; int h; int border_width; LX_XID sibling; LX_STACKMODE stack_mode; } ; /* * GC attributes, such as for lx_ChangeGC_attr(). */ typedef struct lx_gc_attributes LX_GC_ATTRIBUTES; struct lx_gc_attributes { LX_GCFUNCTION function; unsigned int plane_mask; unsigned int foreground; unsigned int background; unsigned int line_width; LX_GCLINESTYLE line_style; // LX_GCLINESTYLE_* LX_GCCAPSTYLE cap_style; // LX_GCCAPSTYLE_* LX_GCJOINSTYLE join_style; // LX_GCJOINSTYLE_* LX_GCFILLSTYLE fill_style; // LX_GCFILLSTYLE_* LX_GCFILLRULE fill_rule; // LX_GCFILLRULE_* LX_XID tile; LX_XID stipple; int tile_stip_x_origin; int tile_stip_y_origin; LX_XID font; LX_GCSUBWINDOWMODE subwindow_mode; // LX_GCSUBWINDOWMODE_* int graphics_exposures; int clip_x_origin; int clip_y_origin; LX_XID clip_mask; unsigned int dash_offset; unsigned int dashes; LX_GCARCMODE arc_mode; // LX_GCARCMODE_* } ; /* * Screen saver attributes, for, eg, SetScreenSaver operations. */ typedef struct lx_screensaver LX_SCREENSAVER; struct lx_screensaver { int timeout; // -1 for default int interval; // -1 for default LX_SSBLANKING prefer_blanking; LX_SSEXPOSURES allow_exposures; } ; /* * The information returned by GetGeometry requests. */ typedef struct lx_get_geometry LX_GET_GEOMETRY; struct lx_get_geometry { LX_XID root; int depth; int x; int y; int w; int h; int borderwidth; } ; /* * Pointer control values. In the application->library direction, * flags indicates which values are meaningful: if _ACCEL isn't set, * numerator and denominator are meaningless and ignored; if _THRESH * isn't set, threshold is meaningless and ignored. Trying to set a * value to -1 sets it to the (server-specific) default value. In the * library->application direction, both flag bits are set, not because * they might not be but rather to make it easier to copy the struct * and pass it back later. */ typedef struct lx_pointercontrol LX_POINTERCONTROL; struct lx_pointercontrol { unsigned int flags; #define LX_POINTERCONTROL_ACCEL 0x00000001 #define LX_POINTERCONTROL_THRESH 0x00000002 int numerator; int denominator; int threshold; } ; /* * Keyboard control values. This struct is presently used by nothing * but GetKeyboardControl, but if a struct variant of * ChangeKeyboardControl is implemented, it too will presumably use * this. */ typedef struct lx_keyboardcontrol LX_KEYBOARDCONTROL; struct lx_keyboardcontrol { unsigned int clickpercent; unsigned int bellpercent; unsigned int bellpitch; unsigned int bellduration; unsigned int leds; int global_repeat; unsigned char key_repeat[32]; } ; /* * An RGB triple packaged up into a struct, for the _rgb variants of * some color-using calls. The values here take on the 0-65535 range * used by the protocol. */ typedef struct lx_rgb LX_RGB; struct lx_rgb { unsigned int r; unsigned int g; unsigned int b; } ; /* * An RGB triple and an associated pixel. The flags field uses the * LX_DO_* values defined below to indicate which primaries to use in * certain calls. */ typedef struct lx_rgbpf LX_RGBPF; struct lx_rgbpf { unsigned int r; unsigned int g; unsigned int b; unsigned int pixel; unsigned int flags; } ; /* * A 16-bit text item, for some 16-bit-text calls, eg PolyText16. */ typedef struct lx_textitem16 LX_TEXTITEM16; struct lx_textitem16 { const unsigned short int *text; int nchars; int delta; LX_XID font; // LX_FONT_None -> no change } ; /* * A 8-bit text item, for some 8-bit-text calls, eg PolyText8. */ typedef struct lx_textitem8 LX_TEXTITEM8; struct lx_textitem8 { const unsigned char *text; int nchars; int delta; LX_XID font; // LX_FONT_None -> no change } ; /* * The return type from the QueryPointer variant which uses a struct * return type instead of individual pointers. */ typedef struct lx_querypointer_status LX_QUERYPOINTER_STATUS; struct lx_querypointer_status { int samescreen; LX_XID root; LX_XID child; int rootx; int rooty; int winx; int winy; unsigned int mask; } ; /* * Distinguished values for button numbers for, eg, GrabButton. * * Arguably this should be LX_BUTTON_Any, with a value different from * the protocol value. */ #define LX_AnyButton 0 /* * Distinguished values for keycodes for, eg, GrabKey. * * Arguably this should be LX_KEY_Any, with a value different from the * protocol value. */ #define LX_AnyKey 0 /* * Special values for modifier masks for, eg, GrabButton. When not * using AnyModifier, such masks use the LX_EVS_* bits. * * Arguably this should have an LX_EVS_ name. */ #define LX_AnyModifier 0x8000 /* * An X error. See below for further discussion of error handling. * * X errors are represented with a discriminated union; the discrimnant * is the error type. Each error type has an arm of the union named * after the error type - for example, a Value error will be * represented with type set to LX_XE_Value and the error-specific * information in the .u.value sub-struct. * * LX_X_ERR_TYPE is the error type. These mostly match the protocol * values at this writing, but this is specifically not promised. * LX_XE_Other is used to represent an error the library doesn't * recognize; the error-specific variant for this type includes just * the data present for all errors (sequence number and major and * minor opcode values) plus the on-wire error type value. */ typedef enum { LX_XE_Request = 1, LX_XE_Value, LX_XE_Window, LX_XE_Pixmap, LX_XE_Atom, LX_XE_Cursor, LX_XE_Font, LX_XE_Match, LX_XE_Drawable, LX_XE_Access, LX_XE_Alloc, LX_XE_Colormap, LX_XE_GContext, LX_XE_IDChoice, LX_XE_Name, LX_XE_Length, LX_XE_Implementation, LX_XE_Other, } LX_X_ERR_TYPE; typedef struct lx_X_err LX_X_ERR; struct lx_X_err { LX_X_ERR_TYPE type; union { struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } request; // if LX_XE_Request struct { unsigned int seq; unsigned int value; unsigned int opc_major; unsigned int opc_minor; } value; // if LX_XE_Value struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } window; // if LX_XE_Window struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } pixmap; // if LX_XE_Pixmap struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } atom; // if LX_XE_Atom struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } cursor; // if LX_XE_Cursor struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } font; // if LX_XE_Font struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } match; // if LX_XE_Match struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } drawable; // if LX_XE_Drawable struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } access; // if LX_XE_Access struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } alloc; // if LX_XE_Alloc struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } colormap; // if LX_XE_Colormap struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } gcontext; // if LX_XE_GContext struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } idchoice; // if LX_XE_IDChoice; struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } name; // if LX_XE_Name struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } length; // if LX_XE_Length struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } implementation; // if LX_XE_Implementation struct { unsigned int type; unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } other; // if LX_XE_Other } u; } ; /* * A library-internal error. See below for further discussion of error * handling. Such an error is represented as a discrimnated union. * The discrimnant is the error type, one of the LX_LE_* values (see * below for descriptions); most types have a per-type struct in the * union which gives more detail. * * LX_LE_NOMEM * Out of memory (eg, malloc() failed). * LX_LE_SYSERR * Error from a syscall, with errno. * LX_LE_OSLIBERR * Error from an OS library call, potentially with message. * LX_LE_BAD_CALL * Some API function was called incorrectly. This is an * application failure. u.bad_call.fn is the name of the * incorrectly-called API function. * LX_LE_NO_DISPLAY * lx_open was passed no display string and thre was no $DISPLAY * in the environment. * LX_LE_BAD_DISPLAY * The display string to lx_open (either passed in or from * $DISPLAY) was erroneous in some way. * LX_LE_UNX_EOF * The library got an unexpected EOF on the X connection. * LX_LE_ALL_FAIL * lx_open ran out of addresses to try without getting a * connection. u.all_fail.msg has a possibly-helpful message. * LX_LE_PROTO_ERR * The library got an X protocol error. u.proto_err.msg briefly * states the error. * LX_LE_REJECTED * The X server rejected the connection. u.rejected.msg is the * message the server returned. */ typedef enum { LX_LE_NOMEM = 1, LX_LE_SYSERR, LX_LE_OSLIBERR, LX_LE_BAD_CALL, LX_LE_NO_DISPLAY, LX_LE_BAD_DISPLAY, LX_LE_NO_SCREEN, LX_LE_UNX_EOF, LX_LE_ALL_FAIL, LX_LE_PROTO_ERR, LX_LE_REJECTED, } LX_LIB_ERR_TYPE; typedef struct lx_lib_err LX_LIB_ERR; struct lx_lib_err { LX_LIB_ERR_TYPE type; union { // nothing for LX_LE_NOMEM struct { // syscall which returned error const char *call; // errno returned int err; } syserr; // for LX_LE_SYSERR struct { // library call which returned error const char *call; // message, nil if none const char *msg; } osliberr; // for LX_LE_OSLIBERR struct { // API function which was called wrong const char *fn; } bad_call; // for LX_LE_BAD_CALL // nothing for LX_LE_NO_DISPLAY // nothing for LX_LE_BAD_DISPLAY // nothing for LX_LE_NO_SCREEN // nothing for LX_LE_UNX_EOF struct { const char *msg; } all_fail; // for LX_LE_ALL_FAIL struct { const char *msg; } proto_err; // for LX_LE_PROTO_ERR struct { const char *msg; } rejected; // for LX_LE_REJECTED } u; } ; /* * Error handling, the bane of many APIs. We deal with errors via * callbacks. Each connection has two error callbacks, an X error * callback and a library error callback. There is also the ability * to attach error handlers to specific operations; see lx_op_err for * that. * * Generally (see exceptions below), the X error callback is called * when an X error is received. It gets the relevant LX_CONN * and an * LX_X_ERR *, which is a discriminated union holding the unpacked X * error packet (see above). It must return an LX_X_ERR_ACTION, one * of * * LX_X_ERR_IGNORE * Ignore the X error event. Carry on as though it had * not been received at all; the application either has * done or will do anything relevant. * * LX_X_ERR_CRASH * Print a description of the error to stderr and exit(1). * * If it returns anything else, the library's behaviour is undefined. * * The library error callback is called when a locally-detected error * is discovered by the library. This can be anything from a * can't-happen test firing in the library code to an I/O error to an * incorrect application call. The library error callback gets the * relevant LX_CONN * and an LX_LIB_ERR value describing the error. * (lx_open has its own, different, error handling mechanisms, because * it can encounter errors when it doesn't have an LX_CONN * at all.) * It returns void; if it returns, the library unwinds far enough to * return to the application, but in most cases the LX_CONN is no * longer usable and there is nothing useful to do but lx_close it. * There is one exception; if an LX_LE_BAD_CALL handler returns, the * bad call is ignored, as if it had not been made at all. * * Error handlers must never throw out. Doing so may leave things in * an inconsistent state, leading to indeterminate later trouble. * * In all cases, the LX_X_ERR or LX_LIB_ERR object pointed to (and * anything it in turn points to) may go invalid as soon as the * handler returns. Any data to be saved from it must be copied * within the handler. * * As indicated by the `const' qualifier in the types, below, error * handlers must never try to modify the error events. Doing so * produces undefined behaviour from the library. * * A newly-opened connection's error handlers are set to internal * default handlers. The default X error handler does nothing but * return LX_X_ERR_CRASH; the default library error handler just * prints a message to stderr and exits with code 1. These default * handlers are accessible under the names lx_default_X_err and * lx_default_lib_err, which are exported for the sake of things such * as setting debugger breakpoints on them. Additionally, each of the * default handlers' first action is to call lx_default_err, which * does nothing; it exists so that a single debugger breakpoint can * trip on either error. * * They can be set with lx_err_set_X() and lx_err_set_lib(), each of * which returns the previously set handler. Passing in a nil pointer * is equivalent to passing in the original library-provided default * function pointer. (The actual function pointer can be obtained by * saving the `previously set handler' return value from one of these * functions when the previous handler is the default handler.) * * The type of an X error handler pointer is * LX_X_ERR_ACTION (*)(LX_CONN *, const LX_X_ERR *). * * The type of a library-internal error handler pointer is * void (*)(LX_CONN *, const LX_LIB_ERR *). */ typedef enum { LX_X_ERR_IGNORE = 1, LX_X_ERR_CRASH, } LX_X_ERR_ACTION; extern LX_X_ERR_ACTION (*lx_err_set_X(LX_CONN *, LX_X_ERR_ACTION (*)(LX_CONN *, const LX_X_ERR *)))(LX_CONN *, const LX_X_ERR *); extern void (*lx_err_set_lib(LX_CONN *, void (*)(LX_CONN *, const LX_LIB_ERR *)))(LX_CONN *, const LX_LIB_ERR *); extern LX_X_ERR_ACTION lx_default_X_err(LX_CONN *, const LX_X_ERR *); extern void lx_default_lib_err(LX_CONN *, const LX_LIB_ERR *); extern void lx_default_err(void); /* * There are various internal functions prototyped in this file also, * typically because they are part of the implementation behind a * macro. Any name lx__* or LX__*, as noted above, is internal, not * part of the interface contract and not to be used directly. */ /* * Open a new connection. Arglist: * * const char *dispname, * void (*err)(const LX_LIB_ERR *, void *), * void (*done)(LX_CONN *, void *), * AIO_LOOP *loop, * void *cbarg, * unsigned int flags * * dispname is a string is of the form * lhs:rhs * where lhs is one of * hostname * numeric-v4-address * [address-literal] * the four-character string "unix" * the zero-length string * and rhs is one of * D * D.S * (D and S are decimal integers) * * err is a function which is called on error. It gets passed an * LX_LIB_ERR pointer and the cbarg value (see below). This pointer * may be nil, in which case the library provides a default which * prints a suitable message to stderr and exits with status 1. As * for calls to the library error handler (see above), the LX_LIB_ERR * pointer must be considered invalid once the handler returns. * * done is a function which is called on success. It gets the * resulting LX_CONN pointer and the cbarg value (see below). This * pointer must not be nil. * * loop is the AIO_LOOP the library is to use for this connection (see * the libaio documentation). This may be nil, in which case the * library uses the global loop. * * cbarg is a pointer, opaque to the library, which is passed to err or * done, whichever gets called. * * flags is zero or more of the LX_OPENF_* flag bits: * * LX_OPENF_NO_PREAMBLE * By default, the library automatically does some initial * protocol exchanges (such as querying and, if supported, * enabling BIG_REQUESTS) as part of the connection open. * Specifying this suppresses these; the only protocol * done as part of open is then just the strict minimum. * LX_OPENF_DEBUG * Turns on internal debugging code. What there is and * what it does is not documented here; it is there to * help debug the library, so UTSL. * * Note that err and done may be called from within lx_open(); it is an * error to assume that they will not be called until later. */ extern void lx_open( const char *, void (*)(const LX_LIB_ERR *, void *), void (*)(LX_CONN *, void *), AIO_LOOP *, void *, unsigned int ); #define LX_OPENF_NO_PREAMBLE 0x00000001 #define LX_OPENF_DEBUG 0x00000002 /* * lx_close closes an X connection. This implies lx_op_abort on all * pending LX_OPs on it. */ extern void lx_close(LX_CONN *); /* * lx_drop summarily drops everything related to a connection. This is * suitable for, for example, use in a newly-forked child. Everything * is simply freed; no callbacks are called. Any file descriptors are * closed unceremoniously. */ extern void lx_drop(LX_CONN *); /* * User data. Each LX_CONN has a void * user data pointer. This is * set to nil when the connection is created and can be set by * lx_set_udata and get by lx_get_udata, but is otherwise not used by * the library at all. */ extern void lx_set_udata(LX_CONN *, void *); extern void *lx_get_udata(LX_CONN *); /* * There are two general paradigms for requests: open-loop and * response-expected. Which paradigm applies depends on the request. * As an example of an open-loop request, consider MapWindow; as * example of a response-expected request, consider QueryPointer. * * For open-loop requests, the call (eg, CreateWindow) returns the * results, if any, immediately (eg, an LX_XID for CreateWindow, or * nothing for Bell) and there is no way to tell when it has * completed, except indirectly, such as by a later response-expected * request's response arriving. (For applications that want to do * such a thing deliberately, GetInputFocus is the canonical request; * it forces a server round-trip and is cheap.) * * For response-expected requests, the call returns an LX_OP pointer, * which can be passed to various calls, such as lx_op_callback, to do * useful things with the pending request. */ // conn, parent, x, y, w, h, bw, dp, class, vis, ... extern LX_XID lx_CreateWindow_va(LX_CONN *, LX_XID, int, int, unsigned int, unsigned int, unsigned int, int, LX_WINDOW_CLASS, LX_XID, ...); #define LX_CWV_BackPixmap(pm) LX__CWV_BackPixmap, lx__cvt_LX_XID((pm)) #define LX_CWV_BackPixel(pix) LX__CWV_BackPixel, lx__cvt_pixel((pix)) #define LX_CWV_BorderPixmap(pm) LX__CWV_BorderPixmap, lx__cvt_LX_XID((pm)) #define LX_CWV_BorderPixel(pix) LX__CWV_BorderPixel, lx__cvt_pixel((pix)) #define LX_CWV_BitGravity(g) LX__CWV_BitGravity, lx__cvt_LX_XID((g)) #define LX_CWV_WinGravity(g) LX__CWV_WinGravity, lx__cvt_LX_XID((g)) #define LX_CWV_BackingStore(bs) LX__CWV_BackingStore, lx__cvt_LX_XID((bs)) #define LX_CWV_BackingPlanes(bp) LX__CWV_BackingPlanes, lx__cvt_pixel((bp)) #define LX_CWV_BackingPixel(bp) LX__CWV_BackingPixel, lx__cvt_pixel((bp)) #define LX_CWV_OverrideRedirect(or) LX__CWV_OverrideRedirect, lx__cvt_bool((or)) #define LX_CWV_SaveUnder(su) LX__CWV_SaveUnder, lx__cvt_bool((su)) #define LX_CWV_EventMask(em) LX__CWV_EventMask, lx__cvt_mask((em)) #define LX_CWV_DontPropagate(dp) LX__CWV_DontPropagate, lx__cvt_eventmask((dp)) #define LX_CWV_Colormap(cmap) LX__CWV_Colormap, lx__cvt_LX_XID((cmap)) #define LX_CWV_Cursor(curs) LX__CWV_Cursor, lx__cvt_LX_XID((curs)) #define LX_CWV_END LX__CWV_END // conn, parent, x, y, w, h, bw, dp, class, vis, mask, attr // mask uses LX_SWM_* values extern LX_XID lx_CreateWindow_attr(LX_CONN *, LX_XID, int, int, unsigned int, unsigned int, unsigned int, int, LX_WINDOW_CLASS, LX_XID, unsigned int, const LX_SET_WINDOW_ATTRIBUTES *); // conn, window, ... // varargs are the same as for lx_CreateWindow_va extern void lx_ChangeWindowAttributes_va(LX_CONN *, LX_XID, ...); // conn, window, mask, attr // mask uses LX_SWM_* values extern void lx_ChangeWindowAttributes_attr(LX_CONN *, LX_XID, unsigned int, const LX_SET_WINDOW_ATTRIBUTES *); // conn, window, attrs extern LX_OP *lx_GetWindowAttributes(LX_CONN *, LX_XID, LX_GET_WINDOW_ATTRIBUTES *); // conn, window extern void lx_DestroyWindow(LX_CONN *, LX_XID); // conn, window extern void lx_DestroySubwindows(LX_CONN *, LX_XID); // conn, window, mode extern void lx_ChangeSaveSet(LX_CONN *, LX_XID, LX_CHANGESAVESETMODE); // conn, window, parent, x, y extern void lx_ReparentWindow(LX_CONN *, LX_XID, LX_XID, int, int); // conn, window extern void lx_MapWindow(LX_CONN *, LX_XID); // conn, window extern void lx_MapSubwindows(LX_CONN *, LX_XID); // conn, window extern void lx_UnmapWindow(LX_CONN *, LX_XID); // conn, window extern void lx_UnmapSubwindows(LX_CONN *, LX_XID); // conn, window, ... extern void lx_ConfigureWindow_va(LX_CONN *, LX_XID, ...); #define LX_CWV_X(x) LX__CWV_X, lx__cvt_int((x)) #define LX_CWV_Y(y) LX__CWV_Y, lx__cvt_int((y)) #define LX_CWV_W(w) LX__CWV_W, lx__cvt_int((w)) #define LX_CWV_H(h) LX__CWV_H, lx__cvt_int((h)) #define LX_CWV_BorderWidth(bw) LX__CWV_BorderWidth, lx__cvt_int((bw)) #define LX_CWV_Sibling(sib) LX__CWV_Sibling, lx__cvt_LX_XID((sib)) #define LX_CWV_StackMode(sm) LX__CWV_StackMode, lx__cvt_LX_XID((sm)) // LX_CWV_END already defined above // conn, window, mask, attr extern void lx_ConfigureWindow_attr(LX_CONN *, LX_XID, unsigned int, const LX_CFG_WINDOW_ATTRIBUTES *); // conn, window, direction extern void lx_CirculateWindow(LX_CONN *, LX_XID, LX_CIRCULATE); // conn, drawable, geomp extern LX_OP *lx_GetGeometry(LX_CONN *, LX_XID, LX_GET_GEOMETRY *); // conn, window, rootp, parentp, childrenp // See also the lx_XIDlist_* functions extern LX_OP *lx_QueryTree(LX_CONN *, LX_XID, LX_XID *, LX_XID *, LX_XIDLIST **); // conn, only-if-exists, name, len, atomp // len==-1 means use strlen(name) extern LX_OP *lx_InternAtom(LX_CONN *, int, const char *, int, LX_ATOM *); // conn, atom, lenp, textp // *textp will have a trailing '\0' appended, not counted in *lenp // *textp freeable with free() extern LX_OP *lx_GetAtomName(LX_CONN *, LX_ATOM, int *, char **); // conn, window, property, type, format, mode, data, len // len is in format-sized units extern void lx_ChangeProperty(LX_CONN *, LX_XID, LX_ATOM, LX_ATOM, int, LX_PROPERTYMODE, const void *, int); // conn, window, property extern void lx_DeleteProperty(LX_CONN *, LX_XID, LX_ATOM); // conn, window, property, type, offset, len, delete, formatp, typep, afterp, lenp, valuep // *valuep freeable with free() extern LX_OP *lx_GetProperty(LX_CONN *, LX_XID, LX_ATOM, LX_ATOM, unsigned int, unsigned int, int, int *, LX_ATOM *, unsigned int *, int *, void **); // conn, window, listp // See also the lx_XIDlist_* functions extern LX_OP *lx_ListProperties(LX_CONN *, LX_XID, LX_XIDLIST **); // conn, selection, window, time extern void lx_SetSelectionOwner(LX_CONN *, LX_ATOM, LX_XID, LX_TIME); // conn, selection, ownerp extern LX_OP *lx_GetSelectionOwner(LX_CONN *, LX_ATOM, LX_XID *); // conn, requestor, selection, target, property, time extern void lx_ConvertSelection(LX_CONN *, LX_XID, LX_ATOM, LX_ATOM, LX_ATOM, LX_TIME); // conn, dest, prop, emask, event extern void lx_SendEvent(LX_CONN *, LX_XID, int, unsigned int, const LX_EVENT *); // conn, grabwin, ownerevents, eventmask, ptrmode, kbdmode, confine, cursor, time, statusp extern LX_OP *lx_GrabPointer(LX_CONN *, LX_XID, int, unsigned int, LX_GRABMODE, LX_GRABMODE, LX_XID, LX_XID, LX_TIME, LX_GRABSTATUS *); // conn, time extern void lx_UngrabPointer(LX_CONN *, LX_TIME); // conn, button, modifiers, grabwin, ownerevents, mask, ptrmode, kbdmode, confine, cursor extern void lx_GrabButton(LX_CONN *, int, unsigned int, LX_XID, int, unsigned int, LX_GRABMODE, LX_GRABMODE, LX_XID, LX_XID); // conn, button, modifiers, grabwin extern void lx_UngrabButton(LX_CONN *, int, unsigned int, LX_XID); // conn, eventmask, cursor, time) extern void lx_ChangeActivePointerGrab(LX_CONN *, unsigned int, LX_XID, LX_TIME); // conn, grabwin, ownerevents, ptrmode, kbdmode, time, statusp extern LX_OP *lx_GrabKeyboard(LX_CONN *, LX_XID, int, LX_GRABMODE, LX_GRABMODE, LX_TIME, LX_GRABSTATUS *); // conn, time extern void lx_UngrabKeyboard(LX_CONN *, LX_TIME); // conn, keycode, modifiers, grabwin, ownerevents, ptrmode, kbdmode extern void lx_GrabKey(LX_CONN *, unsigned int, unsigned int, LX_XID, int, LX_GRABMODE, LX_GRABMODE); // conn, keycode, modifiers, grabwin extern void lx_UngrabKey(LX_CONN *, unsigned int, unsigned int, LX_XID); // conn, mode, time extern void lx_AllowEvents(LX_CONN *, LX_ALLOWMODE, LX_TIME); // conn extern void lx_GrabServer(LX_CONN *); // conn extern void lx_UngrabServer(LX_CONN *); // conn, window, samescreenp, rootp, childp, rxp, ryp, wxp, wyp, maskp extern LX_OP *lx_QueryPointer(LX_CONN *, LX_XID, int *, LX_XID *, LX_XID *, int *, int *, int *, int *, unsigned int *); // conn, window, statusp extern LX_OP *lx_QueryPointer_status(LX_CONN *, LX_XID, LX_QUERYPOINTER_STATUS *); // conn, window, start, stop, nevp, evp // *evp freeable with free() extern LX_OP *lx_GetMotionEvents(LX_CONN *, LX_XID, LX_TIME, LX_TIME, int *, LX_TIMECOORD **); // conn, srcwin, dstwin, sx, sy, samescreenp, dxp, dyp, childp extern LX_OP *lx_TranslateCoordinates(LX_CONN *, LX_XID, LX_XID, int, int, int *, int *, int *, LX_XID *); // conn, srcwin, dstwin, srcx, srcy, srcw, srch, dstx, dsty extern void lx_WarpPointer(LX_CONN *, LX_XID, LX_XID, int, int, int, int, int, int); // conn, focus, revert, time // revert, and non-window values for focus, use LX_FOCUS_* values extern void lx_SetInputFocus(LX_CONN *, LX_XID, LX_XID, LX_TIME); // conn, focusp, revertp extern LX_OP *lx_GetInputFocus(LX_CONN *, LX_XID *, LX_XID *); // conn, statep // statep points to (at least) 32 unsigned chars extern LX_OP *lx_QueryKeymap(LX_CONN *, unsigned char *); // conn, name // XXX Do we want an interface supporting NULs in font names? extern LX_XID lx_OpenFont(LX_CONN *, const char *); // conn, font extern void lx_CloseFont(LX_CONN *, LX_XID); // conn, fontable, infop extern LX_OP *lx_QueryFont(LX_CONN *, LX_XID, LX_FONTINFO **); // conn, fontable, str, len, dirp, ascp, descp, overallp // len==-1 means use strlen(str) extern LX_OP *lx_QueryTextExtents8(LX_CONN *, LX_XID, const unsigned char *, int, LX_TEXTDIRECTION *, int *, int *, LX_CHARINFO *); // conn, fontable, str, len, dirp, ascp, descp, overallp // len is in characters, not chars extern LX_OP *lx_QueryTextExtents16(LX_CONN *, LX_XID, const unsigned short int *, int, LX_TEXTDIRECTION *, int *, int *, LX_CHARINFO *); // conn, pattern, maxnames, listp // XXX Do we want an interface supporting NULs in patterns? // XXX Do we want an interface supporting NULs in path names? extern LX_OP *lx_ListFonts(LX_CONN *, const char *, int, LX_STRLIST **); // conn, pattern, maxnames, eachcb, cbarg // XXX Do we want an interface supporting NULs in patterns? // XXX Do we want an interface supporting NULs in path names? // eachcb is called for each font and takes ownership of its arguments // string arg is freeable with free() // for info arg, see LX_FONTINFO comment extern LX_OP *lx_ListFontsWithInfo(LX_CONN *, const char *, int, void (*)(char *, LX_FONTINFO *, void *), void *); // conn, nstrs, strs // XXX Do we want an interface supporting NULs in path list entries? extern void lx_SetFontPath(LX_CONN *, int, const char * const *); // conn, pathp extern LX_OP *lx_GetFontPath(LX_CONN *, LX_STRLIST **); // conn, drawable, depth, width, height extern LX_XID lx_CreatePixmap(LX_CONN *, LX_XID, unsigned int, unsigned int, unsigned int); // conn, pixmap extern void lx_FreePixmap(LX_CONN *, LX_XID); // conn, drawable, ... extern LX_XID lx_CreateGC_va(LX_CONN *, LX_XID, ...); #define LX_GCV_Function(f) LX__GCV_Function, lx__cvt_LX_XID((f)) #define LX_GCV_PlaneMask(pm) LX__GCV_PlaneMask, lx__cvt_mask((pm)) #define LX_GCV_Foreground(pix) LX__GCV_Foreground, lx__cvt_pixel((pix)) #define LX_GCV_Background(pix) LX__GCV_Background, lx__cvt_pixel((pix)) #define LX_GCV_LineWidth(w) LX__GCV_LineWidth, lx__cvt_uint((w)) #define LX_GCV_LineStyle(ls) LX__GCV_LineStyle, lx__cvt_LX_XID((ls)) #define LX_GCV_CapStyle(cs) LX__GCV_CapStyle, lx__cvt_LX_XID((cs)) #define LX_GCV_JoinStyle(js) LX__GCV_JoinStyle, lx__cvt_LX_XID((js)) #define LX_GCV_FillStyle(fs) LX__GCV_FillStyle, lx__cvt_LX_XID((fs)) #define LX_GCV_FillRule(fr) LX__GCV_FillRule, lx__cvt_LX_XID((fr)) #define LX_GCV_Tile(pm) LX__GCV_Tile, lx__cvt_LX_XID((pm)) #define LX_GCV_Stipple(pm) LX__GCV_Stipple, lx__cvt_LX_XID((pm)) #define LX_GCV_TileStipXOrigin(xo) LX__GCV_TileStipXOrigin, lx__cvt_int((xo)) #define LX_GCV_TileStipYOrigin(yo) LX__GCV_TileStipYOrigin, lx__cvt_int((yo)) #define LX_GCV_Font(f) LX__GCV_Font, lx__cvt_LX_XID((f)) #define LX_GCV_SubwindowMode(sm) LX__GCV_SubwindowMode, lx__cvt_LX_XID((sm)) #define LX_GCV_GraphicsExposures(gx) LX__GCV_GraphicsExposures, lx__cvt_bool((gx)) #define LX_GCV_ClipXOrigin(cxo) LX__GCV_ClipXOrigin, lx__cvt_int((cxo)) #define LX_GCV_ClipYOrigin(cyo) LX__GCV_ClipYOrigin, lx__cvt_int((cyo)) #define LX_GCV_ClipMask(pm) LX__GCV_ClipMask, lx__cvt_LX_XID((pm)) #define LX_GCV_DashOffset(do) LX__GCV_DashOffset, lx__cvt_uint((do)) #define LX_GCV_Dashes(dl) LX__GCV_DashList, lx__cvt_uint((dl)) #define LX_GCV_ArcMode(am) LX__GCV_ArcMode, lx__cvt_LX_XID((am)) #define LX_GCV_END LX__GCV_END #define LX_GCV_PUSH LX__GCV_PUSH // conn, drawable, mask, attr extern LX_XID lx_CreateGC_attr(LX_CONN *, LX_XID, unsigned int, const LX_GC_ATTRIBUTES *); // conn, gc, ... // varargs are the same as for lx_CreateGC_va extern void lx_ChangeGC_va(LX_CONN *, LX_XID, ...); // conn, gc, mask, attr extern void lx_ChangeGC_attr(LX_CONN *, LX_XID, unsigned int, const LX_GC_ATTRIBUTES *); // conn, src, dst, mask // mask uses LX_GCM_* bits extern void lx_CopyGC(LX_CONN *, LX_XID, LX_XID, unsigned int); // conn, gc, offset, ndash, dashes extern void lx_SetDashes(LX_CONN *, LX_XID, int, int, const unsigned char *); // conn, gc, xo, yo, nrects, rects, ordering extern void lx_SetClipRectangles(LX_CONN *, LX_XID, int, int, int, const LX_RECTANGLE *, LX_RECTORDER); // conn, gc extern void lx_FreeGC(LX_CONN *, LX_XID); // conn, window, x, y, w, h, exposures extern void lx_ClearArea(LX_CONN *, LX_XID, int, int, int, int, int); // conn, srcd, dstd, gc, sx, sy, dx, dy, w, h extern void lx_CopyArea(LX_CONN *, LX_XID, LX_XID, LX_XID, int, int, int, int, int, int); // conn, srcd, dstd, gc, sx, sy, dx, dy, w, h, bit extern void lx_CopyPlane(LX_CONN *, LX_XID, LX_XID, LX_XID, int, int, int, int, int, int, unsigned int); // conn, drawable, gc, coord-mode, npts, points extern void lx_PolyPoint(LX_CONN *, LX_XID, LX_XID, LX_COORDMODE, int, const LX_POINT *); // conn, drawable, gc, coordmode, npts, pts extern void lx_PolyLine(LX_CONN *, LX_XID, LX_XID, LX_COORDMODE, int, const LX_POINT *); // conn, drawable, gc, nseg, segments extern void lx_PolySegment(LX_CONN *, LX_XID, LX_XID, int, const LX_SEGMENT *); // conn, drawable, gc, nrects, rects extern void lx_PolyRectangle(LX_CONN *, LX_XID, LX_XID, int, const LX_RECTANGLE *); // conn, drawable, gc, narcs, arcs extern void lx_PolyArc(LX_CONN *, LX_XID, LX_XID, int, const LX_ARC *); // conn, drawable, gc, shape, coordmode, npts, pts extern void lx_FillPoly(LX_CONN *, LX_XID, LX_XID, LX_SHAPECLASS, LX_COORDMODE, int, const LX_POINT *); // conn, drawable, gc, nrects, rects extern void lx_PolyFillRectangle(LX_CONN *, LX_XID, LX_XID, int, const LX_RECTANGLE *); // conn, drawable, gc, narcs, arcs extern void lx_PolyFillArc(LX_CONN *, LX_XID, LX_XID, int, const LX_ARC *); // conn, drawable, gc, format, depth, w, h, dstx, dsty, leftpad, datalen, data extern void lx_PutImage(LX_CONN *, LX_XID, LX_XID, LX_IMAGEFORMAT, int, int, int, int, int, int, int, const void *); // conn, drawable, format, x, y, int w, int h, planes, depthp, visualp, sizep, bitsp // *bitsp freeable with free() extern LX_OP *lx_GetImage(LX_CONN *, LX_XID, LX_IMAGEFORMAT, int, int, int, int, unsigned int, int *, LX_XID *, int *, void **); // conn, drawable, gc, x, y, nitems, items extern void lx_PolyText8(LX_CONN *, LX_XID, LX_XID, int, int, int, const LX_TEXTITEM8 *); // conn, drawable, gc, x, y, nitems, items extern void lx_PolyText16(LX_CONN *, LX_XID, LX_XID, int, int, int, const LX_TEXTITEM16 *); // conn, drawable, gc, x, y, string, len // len==-1 means use strlen(string) extern void lx_ImageText8(LX_CONN *, LX_XID, LX_XID, int, int, const unsigned char *, int); // conn, drawable, gc, x, y, string, len extern void lx_ImageText16(LX_CONN *, LX_XID, LX_XID, int, int, const unsigned short int *, int); // conn, visual, window, alloc extern LX_XID lx_CreateColormap(LX_CONN *, LX_XID, LX_XID, LX_XID); // conn, cmap extern void lx_FreeColormap(LX_CONN *, LX_XID); // conn, old extern LX_XID lx_CopyColormapAndFree(LX_CONN *, LX_XID); // conn, cmap extern void lx_InstallColormap(LX_CONN *, LX_XID); // conn, cmap extern void lx_UninstallColormap(LX_CONN *, LX_XID); // conn, window, listp // See also the lx_XIDlist_* functions extern LX_OP *lx_ListInstalledColormaps(LX_CONN *, LX_XID, LX_XIDLIST **); // conn, cmap, r, g, b, pix, actr, actg, actb extern LX_OP *lx_AllocColor(LX_CONN *, LX_XID, unsigned int, unsigned int, unsigned int, unsigned int *, unsigned int *, unsigned int *, unsigned int *); // conn, cmap, name, len, pixp, xrp, xgp, xbp, vrp, vgp, vbp // len==-1 means use strlen(name) extern LX_OP *lx_AllocNamedColor(LX_CONN *, LX_XID, const char *, int, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *); // conn, cmap, name, len, pixp, xp, vp // len==-1 means use strlen(name) extern LX_OP *lx_AllocNamedColor_rgb(LX_CONN *, LX_XID, const char *, int, unsigned int *, LX_RGB *, LX_RGB *); // conn, cmap, contig, cols, planes, pixp, planep extern LX_OP *lx_AllocColorCells(LX_CONN *, LX_XID, int, int, int, unsigned int *, unsigned int *); // conn, cmap, contig, ncol, nr, ng, nb, pixp, rmp, gmp, bmp extern LX_OP *lx_AllocColorPlanes(LX_CONN *, LX_XID, int, int, int, int, int, unsigned int *, unsigned int *, unsigned int *, unsigned int *); // conn, cmap, planes, npix, pixv extern void lx_FreeColors(LX_CONN *, LX_XID, unsigned int, int, const unsigned int *); // conn, cmap, num, items extern void lx_StoreColors(LX_CONN *, LX_XID, int, const LX_RGBPF *); // conn, cmap, pixel, name, len, doflags // len==-1 means use strlen(name); doflags uses LX_DO_* extern void lx_StoreNamedColor(LX_CONN *, LX_XID, unsigned int, const char *, int, unsigned int); // conn, cmap, npix, pixels, rgbp // rgbp must point to at least npix LX_RGBs extern LX_OP *lx_QueryColors(LX_CONN *, LX_XID, int, const unsigned int *, LX_RGB *); // conn, cmap, name, len, xrp, xgp, xbp, vrp, vgp, vbp // len==-1 means use strlen(name) extern LX_OP *lx_LookupColor(LX_CONN *, LX_XID, const char *, int, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *); // conn, cmap, name, len, xp, vp // len==-1 means use strlen(name) extern LX_OP *lx_LookupColor_rgb(LX_CONN *, LX_XID, const char *, int, LX_RGB *, LX_RGB *); // conn, src, mask, fr, fg, fb, br, bg, bb, hotx, hoty extern LX_XID lx_CreateCursor(LX_CONN *, LX_XID, LX_XID, int, int, int, int, int, int, int, int); // conn, src, mask, fg, bg, hotx, hoty extern LX_XID lx_CreateCursor_rgb(LX_CONN *, LX_XID, LX_XID, LX_RGB, LX_RGB, int, int); // conn, srcfont, maskfont, srcchar, maskchar, fr, fg, fb, br, bg, bb extern LX_XID lx_CreateGlyphCursor(LX_CONN *, LX_XID, LX_XID, int, int, int, int, int, int, int, int); // conn, srcfont, maskfont, srcchar, maskchar, fg, bg extern LX_XID lx_CreateGlyphCursor_rgb(LX_CONN *, LX_XID, LX_XID, int, int, LX_RGB, LX_RGB); // conn, cursor extern void lx_FreeCursor(LX_CONN *, LX_XID); // conn, cursor, fr, fg, fb, br, bg, bb extern void lx_RecolorCursor(LX_CONN *, LX_XID, int, int, int, int, int, int); // conn, cursor, fg, bg extern void lx_RecolorCursor_rgb(LX_CONN *, LX_XID, LX_RGB, LX_RGB); // conn, drawable, class, w, h, rwp, rhp extern LX_OP *lx_QueryBestSize(LX_CONN *, LX_XID, LX_SIZECLASS, int, int, int *, int *); // conn, name, len, presentp, majorp, eventbasep, errorbasep // len==-1 means use strlen(name) // if !*presentp the other return values are meaningless extern LX_OP *lx_QueryExtension(LX_CONN *, const char *, int, int *, int *, int *, int *); // conn, namesp // See also the lx_strlist_* functions extern LX_OP *lx_ListExtensions(LX_CONN *, LX_STRLIST **); // conn, first, keycodes, symspercode, syms extern void lx_ChangeKeyboardMapping(LX_CONN *, int, int, int, const LX_KEYSYM *); // conn, minkeycode, count, symspercodep, keysymsp // LX_KEYSYM vector is allocated by the library, freeable with free() extern LX_OP *lx_GetKeyboardMapping(LX_CONN *, int, int, int *, LX_KEYSYM **); // conn, ... extern void lx_ChangeKeyboardControl_va(LX_CONN *, ...); // LED and Repeat depend on LX_KBCTLLEDACTION and LX_KBCTLREPEATACTION // being typedeffed the same as LX_XID. #define LX_KCV_KeyClickPercent(p) LX__KCV_KeyClickPercent, lx__cvt_int((p)) #define LX_KCV_BellPercent(p) LX__KCV_BellPercent, lx__cvt_int((p)) #define LX_KCV_BellPitch(p) LX__KCV_BellPitch, lx__cvt_int((p)) #define LX_KCV_BellDuration(d) LX__KCV_BellDuration, lx__cvt_int((d)) #define LX_KCV_LED(led,action) LX__KCV_LED, lx__cvt_int((led)), lx__LX_XID((action)) #define LX_KCV_AllLED(action) LX__KCV_LED, (-1), lx__LX_XID((action)) #define LX_KCV_Repeat(key,action) LX__KCV_Repeat, lx__cvt_int((key)), lx__LX_XID((action)) #define LX_KCV_GlobalRepeat(action) LX__KCV_Repeat, (-1), lx__LX_XID((action)) #define LX_KCV_END LX__KCV_END // conn, status extern LX_OP *lx_GetKeyboardControl(LX_CONN *, LX_KEYBOARDCONTROL *); // conn, percent extern void lx_Bell(LX_CONN *, int); // conn, status extern void lx_ChangePointerControl(LX_CONN *, const LX_POINTERCONTROL *); // conn, status extern LX_OP *lx_GetPointerControl(LX_CONN *, LX_POINTERCONTROL *); // conn, status extern void lx_SetScreenSaver(LX_CONN *, const LX_SCREENSAVER *); // conn, status extern LX_OP *lx_GetScreenSaver(LX_CONN *, LX_SCREENSAVER *); // conn, mode, type, datalen, data extern void lx_ChangeHosts(LX_CONN *, LX_CHANGEHOSTSMODE, LX_HOSTTYPE, int, const void *); // conn, accctl, list // See also the lx_hostlist_* functions. extern LX_OP *lx_ListHosts(LX_CONN *, LX_ACCESSCONTROL *, LX_HOSTLIST **); // conn, mode extern void lx_SetAccessControl(LX_CONN *, LX_ACCESSCONTROL); // conn, mode extern void lx_SetCloseDownMode(LX_CONN *, LX_CLOSEDOWNMODE); // conn, resource extern void lx_KillClient(LX_CONN *, LX_XID); // conn, window, delta, nprop, props extern void lx_RotateProperties(LX_CONN *, LX_XID, int, int, const LX_ATOM *); // conn, mode extern void lx_ForceScreenSaver(LX_CONN *, LX_FORCESCREENSAVER); // conn, num, mapping, statusp // mapping must point to num unsigned chars extern LX_OP *lx_SetPointerMapping(LX_CONN *, int, const unsigned char *, LX_MAPPINGSTATUS *); // conn, nump, mapping // mapping must point to enough unsigned chars (255 are always enough) extern LX_OP *lx_GetPointerMapping(LX_CONN *, int *, unsigned char *); // conn, num, keycodesp, statusp // keycodesp must point to 8*num LX_KeyCodes extern LX_OP *lx_SetModifierMapping(LX_CONN *, int, const LX_KEYCODE *, LX_MAPPINGSTATUS *); // conn, nump, keycodesp // keycodesp must point to enough space (2048 LX_KEYCODEs is always enough) extern LX_OP *lx_GetModifierMapping(LX_CONN *, int *, LX_KEYCODE *); // conn extern void lx_NoOperation(LX_CONN *); /* * There are also a few functions which are conceptually like requests * but which are handled entirely within the library. */ // return number of screens // conn extern int lx_nscreens(LX_CONN *); // return default screen number // conn extern int lx_default_screen(LX_CONN *); // return minimum keycode from setup, -1 on error // conn extern int lx_min_keycode(LX_CONN *); // return maximum keycode from setup, -1 on error // conn extern int lx_max_keycode(LX_CONN *); // return root window of screen N (LX_WINDOW_None if error) // conn, N extern LX_XID lx_root(LX_CONN *, int); // return depth of root window of screen N (-1 if error) // conn, N extern int lx_root_depth(LX_CONN *, int); // return visual of root window of screen N (LX_VISUAL_None if error) // conn, N extern LX_XID lx_root_visual(LX_CONN *, int); // return default colormap of screen N (LX_COLORMAP_None if error) // conn, N extern LX_XID lx_root_colormap(LX_CONN *, int); // return width in pixels of screen N (0 if error) // conn, N extern unsigned int lx_root_width(LX_CONN *, int); // return height in pixels of screen N (0 if error) // conn, N extern unsigned int lx_root_height(LX_CONN *, int); /* * Convenience routines. */ /* * SGC operations. An SGC is a GC plus a client-side shadow; the * shadow is used to optimize away `changes' that don't actually do * anything. * * There are operations parallel to lx_CreateGC_va, lx_CreateGC_attr, * lx_ChangeGC_va, lx_ChangeGC_attr, lx_CopyGC, and lx_FreeGC, plus a * call which returns the GC for an SGC (pushing any pending shadow * changes). lx_SGC_GC has error cases, which cause it to return * LX_GC_None. * * Note that SGCs are *created* lazily. In particular, it is point of * first use, not point of creation, at which the drawable must be * valid. To force creation, call lx_SGC_GC. */ typedef LX_XID LX_SGC; /* * Args the same as their GC analogs, except that, for lx_ChangeSGC_*, * the change can be pushed immediately. To do this, for * lx_ChangeSGC_attr, set the LX_GCM_PUSH bit in the mask; for * lx_ChangeSGC_va, terminate the list with LX_GCV_PUSH instead of * LX_GCV_END. When this is done, they return whatever lx_SGC_GC * returns after the changes; otherwise, their return values are * undefined (the returned value will be something that can be stored * in an LX_XID, and it will be a valid LX_XID value from a C * perspective, but the only other thing that is promised is that it * will not be LX_XID_Error). * * Under some error conditions, lx_ChangeSGC_* can return prematurely. * When this happens, they return generate a bad-call error and, if * its handler returns, they return LX_XID_Error. * * Because they already return something, lx_CreateSGC_* have no * auto-push facility. */ extern LX_SGC lx_CreateSGC_va(LX_CONN *, LX_XID, ...); extern LX_SGC lx_CreateSGC_attr(LX_CONN *, LX_XID, unsigned int, const LX_GC_ATTRIBUTES *); extern LX_XID lx_ChangeSGC_va(LX_CONN *, LX_SGC, ...); extern LX_XID lx_ChangeSGC_attr(LX_CONN *, LX_SGC, unsigned int, const LX_GC_ATTRIBUTES *); // Two variants, the same as lx_CopyGC except for the LX_SGC args. // There is no CopyGCtoSGC; there is no request to get a GC's values. // There is no CopyGCtoGC; that's just a plain CopyGC request. extern void lx_CopySGCtoGC(LX_CONN *, LX_SGC, LX_XID, unsigned int); extern void lx_CopySGCtoSGC(LX_CONN *, LX_SGC, LX_SGC, unsigned int); // Analog to lx_FreeGC extern void lx_FreeSGC(LX_CONN *, LX_SGC); // Return the GC, eg for use in graphics calls // Also flushes any pending changes extern LX_XID lx_SGC_GC(LX_CONN *, LX_SGC); /* * lx_lookup_color() is just like lx_LookupColor, and * lx_lookup_color_rgb() is just like lx_LookupColor_rgb, except that * they (a) handle #rgb, #rrggbb, #rrrgggbbb, and #rrrrggggbbbb * internally rather than querying the server, (b) don't take * arguments returning visual values (because a server roundtrip may * not happen at all), (c) take an additional pointer-to-int which * receives a success boolean (true for success, false for failure), * and (d) trap Name errors (reflected to the API as failure) from any * LookupColor request they do. */ extern LX_OP *lx_lookup_color(LX_CONN *, LX_XID, const char *, int, unsigned int *, unsigned int *, unsigned int *, int *); extern LX_OP *lx_lookup_color_rgb(LX_CONN *, LX_XID, const char *, int, LX_RGB *, int *); /* * Keyboard mapping utilities. * * These routines associate keyboard mapping state with each LX_CONN * (using a connection-private index). * * Call lx_kbmap_setup on the LX_CONN. When LX_OP returned by * lx_kbmap_setup completes, it is ready to process events. For any * MappingNotify event received, pass it to lx_kbmap_update. To map a * keystroke event to a string, call lx_kbmap_string. * * LX_OP *lx_kbmap_setup(LX_CONN *xc) * Starts the initialization process for xc. When the * requests are complete, the LX_OP returned will finish. * * void lx_kbmap_update(LX_CONN *xc, const LX_EVENT_MappingNotify *) * Updates internal state according to the MappingNotify * event. * * LX_KEYSYM lx_kbmap_keysym(LX_CONN *xc, unsigned char kc, unsigned int st); * Maps a keystroke, keycode kc with state st, to a * keysym. If none can be determined, LX_KEYSYM_NoSymbol * is returned. * * int lx_kbmap_string(LX_CONN *xc, unsigned char kc, * unsigned int st, unsigned char str[LX_KBMAP_MAX_STRING], * LX_KEYSYM *sym) * Maps a keystroke, keycode kc with state st, to a * string. The string is stored through str and the * length is returned; LX_KBMAP_MAX_STRING is large enough * to hold the longest string it can return. (The length * is returned rather than NUL-terminating the string * because NUL can appear in the string.) * * If sym is non-nil, the relevant keysym is stored * through it. If it is nil, the keysym is not stored * anywhere. This store is always done, even when the * returned string is zero-length; if no keysym can be * determined, the keysym stored is LX_KEYSYM_NoSymbol. * * Note that lx_kbmap_string has no way to return the encoding of the * returned string. In principle it could do so, or there could be a * call to control which encoding to return. But, until and unless we * have a client that is prepared to handle something other than octet * strings in an unspecified encoding, lx_kbmap_string handles just * Latin-1. (My preferred evolution would be to return a string of * Unicode codepoints rather than supporting things like 8859-7 or * KOI-8 or whatever. I18n is messy.) * * lx_kbmap_setup must be called first; calling any of the others on an * LX_CONN on which lx_kbmap_setup hasn't been called produces * undefined behaviour. However, the LX_OP returned by lx_kbmap_setup * does not need to have completed before calling the other routines. * lx_kbmap_update should be called with any MappingNotify events * received after lx_kbmap_setup is called, whether or not the LX_OP * has completed. Before the LX_OP completes, all keystrokes will map * to keysym NoSymbol and a zero-length string. * * Keysym values are defined via the #include, below, of lx-keysyms.h. */ extern LX_OP *lx_kbmap_setup(LX_CONN *); extern void lx_kbmap_update(LX_CONN *, const LX_EVENT_MappingNotify *); extern LX_KEYSYM lx_kbmap_keysym(LX_CONN *, unsigned char, unsigned int); extern int lx_kbmap_string(LX_CONN *, unsigned char, unsigned int, unsigned char *, LX_KEYSYM *); #define LX_KBMAP_MAX_STRING 16 /* * Batching wrappers. * * These wrappers specify drawing single objects, but they collapse * multiple calls with the same drawable and GC into a single protocol * request (eg, multiple lx_draw_line calls can, under certain * circumstances, be batched into a single PolySegment protocol * request). * * Specifically, the calls and their underlying protocol requests: * * lx_draw_line (PolySegment) * lx_draw_point (PolyPoint) * lx_draw_rectangle (PolyRectangle) * lx_fill_arc (PolyFillArc) * lx_fill_rectangle (PolyFillRectangle) * * This implementation misses some opportunities for batching. For * example, a CreateWindow request could, in theory, be inserted into * a batch of any of the above calls without harm. We are * conservative in this regard; any request-generating call that isn't * made through these routines is considered to break batching. (This * includes calls to the routine underlying the batch; for example, an * lx_PolyPoint call will break a batch of lx_draw_point calls even if * it uses the same drawable and gc as the batch.) */ // conn, drawable, gc, x1, y1, x2, y2 extern void lx_draw_line(LX_CONN *, LX_XID, LX_XID, int, int, int, int); // conn, drawable, gc, x, y extern void lx_draw_point(LX_CONN *, LX_XID, LX_XID, int, int); // conn, drawable, gc, x, y, w, h extern void lx_draw_rectangle(LX_CONN *, LX_XID, LX_XID, int, int, int, int); // conn, drawable, gc, x, y, w, h, a1, a2 extern void lx_fill_arc(LX_CONN *, LX_XID, LX_XID, int, int, unsigned int, unsigned int, int, int); // conn, drawable, gc, x, y, w, h extern void lx_fill_rectangle(LX_CONN *, LX_XID, LX_XID, int, int, int, int); /* * Geometry string parsing. * * X geometry specs consist of an optional size followed by an optional * position; in regex syntax * * ([0-9]+x[0-9]+)?([-+]-?[0-9]+-?[0-9]+)? * * We extend this somewhat, allowing each number to replaced by a dot: * * (([0-9]+|\.)x([0-9]+|\.))?([-+](-?[0-9]+|\.)[-+](-?[0-9]+|\.))? * * A . means "unspecified", thus permitting (for example) overriding * the width without also overriding the height. * * Such things as terminal-emulator multiplication of width and height * values by the character cell size, if appropriate for the * application in question, must be handled elsewhere, typically by * the caller - see lx_apply_geometry. * * int lx_parse_geometry(const char *str, LX_GEOMETRY *gp) * * Parses a geometry spec string. * * str is the geometry spec. It may be nil, which is semantically * equivalent to a zero-length string (either one means no * specification for geometry). * * On success, the parsed geometry is written through gp, and * lx_parse_geometry returns 0. On failure, one of the * LX_GEOM_ERR_* values (see below) is returned. In the error * case, it is specifically unspecified which, if any, fields of * *gp have been written; for any that have, what value(s) were * written is also unspecified. * * int lx_apply_geometry(const LX_GEOMETRY *gp, int pw, int ph, int bw, int *xp, int *yp, int *wp, int *hp) * * Applies a parsed geometry spec. * * gp is the parsed geometry, such as is produced by * lx_parse_geometry (possibly modified, eg by a terminal emulator * that wants to multiply the width and height values by character * cell sizes). * * pw and ph are the width and height values that negative * position values are to be interpreted relative to (typically, a * parent window size). * * bw is the border width. This is needed because geometry specs * describe the size of the window _excluding_ its border, but the * position is specified in terms of the window _including_ its * border. * * xp, yp, wp, and hp point to the location and size to be used. * Depending on the geometry spec, zero or more of these are * overwritten with values computed from the geometry spec and, in * some cases, the pw and ph values. These are program-specified * defaults on input; on output, they are the input values, as * modified by the geometry spec. (Out-of-range values on input * may or may not be detected, but the library does promise that * any value which is written will be written with an in-range value.) * * On success, returns 0. On error, returns an LX_GEOM_ERR_* * value. On error, it is specifically undefined which, if any, * of the xp/yp/wp/hp values are written through; if any are, what * values are written is also undefined. * * The fields of LX_GEOMETRY are: * * x, y, w, h * int. These are position and size values. The + or - * before position values does not affect the values' * sign. See also flags and the examples, below. For * lx_parse_geometry, fields corresponding to flag bits * which are not set may or may not be written; for * lx_apply_geometry, fields corresponding to flag bits * which are not set will be ignored. * flags * unsigned int. Flag bits: * * LX_GEOM_PX * A "positive" X position was specified. * LX_GEOM_PY * A "positive" Y position was specified. * LX_GEOM_NX * A "negative" X position was specified. * LX_GEOM_NY * A "negative" Y position was specified. * LX_GEOM_W * A width was specified. * LX_GEOM_H * A height was specified. * * Two flag bits are provided for each position value * because the (optional) sign of the number is distinct * from the (required) sign specifying whether it is * interpreted relative to the left/top (+) or * right/bottom (-) edge of the containing space. (For * example, semantically, +0+0 is different from -0-0, and * +100+0, -100+0, +-100+0, and --100+0 are all * different.) * * Error values (the library promises that these values are negative * compile-time constants which can be stored in an int, but does not * promise more than that): * * LX_GEOM_ERR_SYNTAX * (lx_parse_geometry only.) The input string did not fit * the syntax. * * LX_GEOM_ERR_RANGE * Some value was out of range. For lx_parse_geometry, * it must be a value in the string; for * lx_apply_geometry, it can be in *gp, pw, or ph, or can * be a value computed from (in-range) input values. * (lx_parse_geometry will not generate out-of-range * values in non-error cases, but the LX_GEOMETRY may not * come directly from lx_parse_geometry, and position * specs with a - before them can lead to out-of-range * computed values.) * * The valid ranges are the ones imposed by the X * protocol: for X and Y positions, [-32768..32767]; for * widths and heights, [1..65535]. * * For lx_apply_geometry, if the input values are out of * range but the values which would be computed based on * them are in range, it is undefined whether an error * occurs or the in-range computed value is stored without * error, but it will be one of the two. * * LX_GEOM_ERR_INVALID * Returned when the input LX_GEOMETRY is invalid for a * reason other than a value being out of range (for * example, if it has both LX_GEOM_PX and LX_GEOM_NX set * in its flags field). * * There is also LX_GEOM_ERR_NONE, a convenience definition, defined as * zero (indicating success from routines which return error values). * * Non-negative non-zero values will never be returned as geometry * routine errors; the application may use such values any way it * finds convenient (for example, as `impossible' flag values). */ typedef struct lx_geometry LX_GEOMETRY; struct lx_geometry { int x; int y; int w; int h; unsigned int flags; #define LX_GEOM_PX 0x000001 #define LX_GEOM_PY 0x000002 #define LX_GEOM_NX 0x000004 #define LX_GEOM_NY 0x000008 #define LX_GEOM_W 0x000010 #define LX_GEOM_H 0x000020 } ; extern int lx_parse_geometry(const char *, LX_GEOMETRY *); extern int lx_apply_geometry(const LX_GEOMETRY *, int, int, int, int *, int *, int *, int *); /* * Text convenience functions. * * LX_CHARINFO lx_text_extents_8(const LX_FONTINFO *fi, const unsigned char *str, int len) * * This is much the same as lx_QueryTextExtents8, but uses a * client-side LX_FONTINFO instead of a server roundtrip. * * fi is of course the font info. * * str is the string; len is its length. As a convenience when * working with NUL-terminated strings, if len is -1, strlen(str) * is used as the length. * * The LX_CHARINFO describing the string is returned. The attr * value is zero. * * For a zero-length string, the returned values are all zero, * even though for some of them (eg, ascent) this is not * conceptually ideal. */ extern LX_CHARINFO lx_text_extents_8(const LX_FONTINFO *, const unsigned char *, int); /* * Some things can take an X resource ID or certain distinguished * values. (An example is the keyboard input focus, which can be a * window, PointerRoot, or None.) We define constants for these, with * values unrelated to their protocol values. (See the top-of-file * comment for discussion of why the use of unrelated values.) */ // Distinguished values for input focus #define LX_FOCUS_None 0x20000008 #define LX_FOCUS_PointerRoot 0x20000009 #define LX_FOCUS_Parent 0x2000000a // Distinguished values for window IDs #define LX_WINDOW_None 0x2000000b #define LX_WINDOW_PointerWindow 0x200000cf #define LX_WINDOW_InputFocus 0x200000d0 // Distinguished values for pixmap IDs #define LX_PIXMAP_None 0x2000001a #define LX_PIXMAP_ParentRelative 0x2000001b #define LX_PIXMAP_CopyFromParent 0x2000001c // Distinguished values for visual IDs #define LX_VISUAL_None 0x2000000c #define LX_VISUAL_CopyFromParent 0x20000024 // Distinguished values for colormap IDs #define LX_COLORMAP_CopyFromParent 0x20000020 #define LX_COLORMAP_None 0x20000027 // Distinguished values for cursor IDs #define LX_CURSOR_None 0x20000021 // Distinguished values for CreateColormap alloc #define LX_AllocNone 0x20000025 #define LX_AllocAll 0x20000026 // Distinguished values for GC IDs #define LX_GC_None 0x2000002a // Distinguished values for GC clip-mask #define LX_GCCLIPMASK_None 0x2000002b // Distinguished values for KillClient #define LX_KILLCLIENT_AllTemporary 0x20000062 // Distinguished values for font IDs #define LX_FONT_None 0x20000081 // Distinguished values for generic resource IDs #define LX_XID_Error 0x20000082 // Distinguished values for LX_SGC #define LX_SGC_None 0x2000002c // Flag bits for colormap operations #define LX_DO_R 0x01 #define LX_DO_G 0x02 #define LX_DO_B 0x04 #define LX_DO_ALL (LX_DO_R|LX_DO_G|LX_DO_B) /* * Handling for operations in progress. As outlined above, such * operations return LX_OP pointers. Every LX_OP pointer must * eventually be disposed of by one of: * * - Passing it to lx_op_drop. * - Passing it to lx_op_abort. * - Passing it to lx_op_callback without the LX_OP_KEEP flag. * - Calling lx_close on its XCONN pointer. * * The calls are: * * void lx_op_callback(LX_OP *op, void (*cb)(void *), void *arg, unsigned int flags) * Sets a callback and argument to be called when op completes. * See below for flags. If the LX_OP has already completed, this * calls the callback (and, if no LX_OP_KEEP, disposes of the * LX_OP) from within lx_op_callback. * * int lx_op_test(LX_OP *op) * Tests whether op has completed, returning 0 if it has not * completed or 1 if it has. * * void lx_op_drop(LX_OP *op) * Indicates that the application no longer cares to hear * explicitly about op's completion. This also revokes any * lx_op_callback on this op. The LX_OP must not be used after * this call returns; it goes invalid at some indeterminate (from * the caller's point of view) time after entry to lx_op_drop(). * * Any output arguments passed to the relevant call will still be * written as normal; the only thing lx_op_drop does is cause no * explicit notification of completion. (Compare to lx_op_abort.) * * void lx_op_abort(LX_OP *op) * Indicates that the application no longer cares about op at all. * This has the effects of lx_op_drop, but also cancels writing of * any output arguments which were passed to the relevant call. * (An internal version of the LX_OP is kept around internally to * the library, but only reason for doing even this much is to * handle the reply when it arrives.) * * If the request has already completed and results returned, this * simply drops the LX_OP, like lx_op_drop. But any results not * yet written before the lx_op_abort call will not be written * anywhere. * * void lx_op_set_udata(LX_OP *op, void *udata) * Sets op's user data pointer to udata. * * void *lx_op_udata(LX_OP *op) * Returns op's user data pointer. * * LX_OP_ERR_SETTING lx_op_err(LX_OP *op, int (*handler)(LX_CONN *, LX_OP *, const LX_X_ERR *, void *), void *) * LX_OP_ERR_SETTING lx_op_err_setting(LX_OP *op, LX_OP_ERR_SETTING) * Sets the LX_OP's error handler, returning the previous handler. * The default is for this handler is nil (and "the previous * handler" is nil if it is still set to the default); setting it * to nil restores the default behaviour. When an X error is * received in apparent response to a request (that is, when the * error's last-request-serial value matches the request's * serial), that request corresponds to an LX_OP, and that LX_OP * has an error handler set, the error handler is called. It is * then expected to inspect the error. The error may or may not * be generated in response to the request, and, even if it is, it * may or may not be appropriate to handle it as an error response * to the request. (For example, an AllocColor request can * generate an Alloc error, which is usually best handled as a * failure return in the API, or a Colormap error, which is * usually best handled as an ordinary X error.) * * If the error should be considered a response to the request, * the error handler should take whatever action is appropriate * and return nonzero; in this case, the error is dropped and the * LX_OP is considered to have completed. The callback set with * lx_op_callback, if any, will be called after the error handler * returns but before any other library actions are taken. (The * error handler usually will set some data structure so the * completion callback will know the error occurred, but nothing * of the sort is enforced; it is up to application logic.) * * If the error should not be considered a response to the * request, the error handler should return zero; in this case, * the error-handling logic proceeds as if the error handler * hadn't been registered at all. * * An LX_OP_ERR_SETTING encapsulates the function-and-argument * pair used for this. lx_op_err and lx_op_err_setting are * identical except that the one takes separate arguments for the * function pointer and the argument, while the other takes an * LX_OP_ERR_SETTING struct. * * For lx_op_callback, the flags argument selects optional behaviour: * * LX_OP_KEEP * By default, lx_op_callback performs the equivalent of * lx_op_drop on the LX_OP once it completes. If * LX_OP_KEEP is set in the flags word, the LX_OP remains * valid. (To dispose of an LX_OP that is done but which * was kept this way, use lx_op_drop().) * * lx_op_callback, lx_op_drop, and lx_op_abort will accept a nil LX_OP * pointer; they do nothing in this case. (This is to tolerate cases * where request calls return a nil pointer; while that happens only * on error, some applications may want to handle such errors.) */ #define LX_OP_KEEP 0x00000001 extern void lx_op_callback(LX_OP *, void (*)(void *), void *, unsigned int); extern int lx_op_test(LX_OP *); extern void lx_op_drop(LX_OP *); extern void lx_op_abort(LX_OP *); extern void lx_op_set_udata(LX_OP *, void *); extern void *lx_op_udata(LX_OP *); typedef struct lx_op_err_setting LX_OP_ERR_SETTING; struct lx_op_err_setting { int (*fn)(LX_CONN *, LX_OP *, const LX_X_ERR *, void *); void *arg; } ; extern LX_OP_ERR_SETTING lx_op_err(LX_OP *, int (*)(LX_CONN *, LX_OP *, const LX_X_ERR *, void *), void *); extern LX_OP_ERR_SETTING lx_op_err_setting(LX_OP *, LX_OP_ERR_SETTING); /* * Handling for host lists. * * Host lists are, conceptually, lists of host addresses. They are * stored in an opaque type LX_HOSTLIST. Such lists are created by * lx_ListHosts and freed by lx_hostlist_free. Each entry on the list * consists of a type and a data blob; the size of the data blob can * vary from entry to entry, though for most types it depends on only * the type. * * Given a host list, lx_hostlist_entries returns the number of entries * on it. For N from 0 to one less than that number, * lx_hostlist_entry_type returns the entry's type, * lx_hostlist_entry_size returns its size, and lx_hostlist_entry_data * returns a pointer to its data. If passed an out-of-range index, * lx_hostlist_entry_type returns LX_HOSTTYPE_Error, * lx_hostlist_entry_size returns -1, and lx_hostlist_entry_data * returns a nil pointer. * * It is up to the application to interpret the data appropriately for * the type. * * Host type LX_HOSTTYPE_Other is used for unrecognized host types. * The host type on the wire appears as an additional byte at the * beginning of the data, with the size accordingly increased by one. */ extern void lx_hostlist_free(LX_HOSTLIST *); extern int lx_hostlist_entries(const LX_HOSTLIST *); extern LX_HOSTTYPE lx_hostlist_entry_type(const LX_HOSTLIST *, int); extern int lx_hostlist_entry_size(const LX_HOSTLIST *, int); extern const void *lx_hostlist_entry_data(const LX_HOSTLIST *, int); /* * Handling for string lists. * * String lists are, conceptually, lists of strings (eg, extension * names). They are stored in an opaque type LX_STRLIST. Such lists * are created by lx_ListExtensions and similar functions and freed by * lx_strlist_free. Each entry on the list consists of a length and a * string; the length can vary from entry to entry. * * Given a string list, lx_strlist_entries returns the number of entries * on it. For N from 0 to one less than that number, * lx_strlist_entry_len returns the entry's length and * lx_strlist_entry_data returns a pointer to its string. The string * will have a '\0' appended to what the server returned; it is not * included in the length. If passed an out-of-range index, * lx_strlist_entry_len returns -1 and lx_strlist_entry_data returns a * nil pointer. */ extern void lx_strlist_free(LX_STRLIST *); extern int lx_strlist_entries(const LX_STRLIST *); extern int lx_strlist_entry_len(const LX_STRLIST *, int); extern const void *lx_strlist_entry_data(const LX_STRLIST *, int); /* * Handling for resource ID lists. * * Resource ID lists are, conceptually, lists of LX_XIDs (eg, windows). * They are stored in an opaque type LX_XIDLIST. Such lists are * created by lx_ListInstalledColormaps and similar functions and * freed by lx_XIDlist_free. Each entry on the list consists of a * resource ID, an LX_XID. * * Given a resource ID list, lx_XIDlist_entries returns the number of * entries on it. For N from 0 to one less than that number, * lx_XIDlist_entry_id returns the entry's ID. If passed an * out-of-range index, lx_XIDlist_entry_id returns LX_XID_Error. */ extern void lx_XIDlist_free(LX_XIDLIST *); extern int lx_XIDlist_entries(const LX_XIDLIST *); extern LX_XID lx_XIDlist_entry_id(const LX_XIDLIST *, int); /* * Event handlers. * * As implied by the consts, the handler must not modify the event. */ extern void (*lx_set_event_handler(LX_CONN *, void (*)(LX_CONN *, const LX_EVENT *)))(LX_CONN *, const LX_EVENT *); /* * Resource manager interfaces. * * The resource manager is a database mapping sequences of resource * names to strings, with some degree of fuzzy matching for queries. * We don't duplicate Xlib in detail, but we do the same thing to the * extent that, for example, .Xdefaults files and query strings are * (by intent, at least) compatible. * * The Xlib doc gives this description of a resource line (BNF syntax * slightly fixed up): * * ResourceLine = Comment | ResourceSpec * Comment = "!" string | * ResourceSpec = WhiteSpace ResourceName WhiteSpace ":" WhiteSpace value * ResourceName = [Binding] ComponentName ( Binding ComponentName ) * * Binding = "." | "*" * WhiteSpace = ( " " | "\t" ) * * ComponentName = ( "a"-"z" | "A"-"Z" | "0"-"9" | "_" | "-" ) * * value = string * string = ( ) * * * Query strings must use a Binding of ., never *. Xlib actually * implements something a bit more liberal: * * Binding = ( "." | "*" ) + * * which carries the semantics of * if any * is given or . if not. (I * don't know why this was done; I conjecture it's to cater to human * tendencies to, for example, write "app.*.font" to refer to the font * resource at any level under app, what could equivalently be written * "app*font".) We do likewise. . is so-called `tight' binding; * is * `loose'. The difference is that loose binding can match any * sequence of names; a resource spec "foo*foreground" can match a * query for "foo.foreground", but it can also match * "foo.widget.foreground" or "foo.commands.gutters.foreground". * * Matching returns the most specific match's value. Rules (again, * quoting from the Xlib doc): * * 1. The attribute of the name and class must match. For * example, queries for: * * xterm.scrollbar.background(name) * XTerm.Scrollbar.Background(class) * * will not match the following database entry: * * xterm.scrollbar:on * * 2. Database entries with name or class prefixed by a period * (.) are more specific than those prefixed by an asterisk * (*). For example, the entry xterm.geometry is more * specific than the entry xterm*geometry. * * 3. Names are more specific than classes. For example, the * entry ``*scrollbar.background'' is more specific than the * entry ``*Scrollbar.Background''. * * 4. Specifying a name or class is more specific than omitting * either. For example, the entry ``Scrollbar*Background'' * is more specific than the entry ``*Background''. * * 5. Left components are more specific than right components. * For example, ``*vt100*background'' is more specific than * the entry ``*scrollbar*background'' for the query * ``.vt100.scrollbar.background''. * * 6. If neither a period (.) nor an asterisk (*) is specified * at the beginning, a period (.) is implicit. For example, * ``xterm.background'' is identical to * ``.xterm.background''. * * For compatibility's sake, we implement the same rules. */ /* * Xlib provides a way (`quark's) to intern ComponentName strings, to * speed up searches. We provide a similar facility in the form of * LX_QUARKs. LX_NOQUARK is used to indicate the absence of a quark; * this is not currently used, but is intended for possible future use * cases such as interning a string for which no quark exists with * create set false (there is currently no string-to-quark routine * that has a create flag). LX_ERRQUARK is used for error cases, such * as trying to intern a quark for a string containing characters not * valid in a quark string. * * Note that there is no guarantee that, even for exactly the same * sequence of calls by exactly the same program, the same quark * values will be returned for different runs. Except for LX_NOQUARK * and LX_ERRQUARK, it is a bug to attempt to use quark values in a * process other than the one they were created in (this includes * using them in the child after a fork). */ typedef unsigned int LX_QUARK; #define LX_NOQUARK (~0U) #define LX_ERRQUARK (~1U) /* * Some interfaces work with lists of pairs. An * LX_BOUNDQUARK is one such pair; an LX_BINDING represents the * binding portion of one. */ typedef enum { LX_BIND_TIGHT = 1, LX_BIND_LOOSE, } LX_BINDING; typedef struct lx_boundquark LX_BOUNDQUARK; struct lx_boundquark { LX_BINDING b; LX_QUARK q; } ; /* * LX_DB is an opaque type representing a database of resources. A * pointer-to-LX_DB is our analog of Xlib's XrmDatabase (XrmDatabase * is a pointer under the hood). */ typedef struct lx_db LX_DB; /* * LX_DBVAL represents a database value returned by a lookup. As a * convenience for the common case of string values, .s[.l] is always * '\0' (this means that .s is never nil for non-error cases). * * When representing error cases, such as looking up a nonexistent * entry, .s is nil and .l is -1. * * .s is consted because returned database values are always owned by * the resource manager. When passing values in, separate arguments * are used, not an LX_DBVAL. */ typedef struct lx_dbval LX_DBVAL; struct lx_dbval { const char *s; int l; } ; /* * LX_DB_ITER is an opaque type for iterations. LX_DB_ITERSTAT is the * return type of lx_db_iter_next. (See the descriptions, below, of * lx_db_iter_start, lx_db_iter_next, and lx_db_iter_done for more.) */ typedef struct lx_db_iter LX_DB_ITER; typedef enum { LX_DB_ITER_NORMAL = 1, LX_DB_ITER_DONE, LX_DB_ITER_OVERFLOW, LX_DB_ITER_SKIP, } LX_DB_ITERSTAT; /* * Allocate and return a quark that does not correspond to any * resource-manager string. (This is the analog of Xlib's * XrmUniqueQuark.) * * See the caution, above, in the general discussion of quarks. */ extern LX_QUARK lx_new_quark(void); /* * Look up the quark for a string. * * LX_QUARK lx_quark_for_string(const char *str, int len) * * If the string contains any character not permitted in * resource-manager names, returns LX_ERRQUARK. Otherwise, if a quark * for this string already exists, returns it. Otherwise, creates a * new quark for the string and returns it. The argument string never * needs to remain valid after lx_quark_for_string returns. * * As a convenience when using NUL-terminated strings, if len is -1 * then strlen(str) is used instead. * * See the caution, above, in the general discussion of quarks. */ extern LX_QUARK lx_quark_for_string(const char *, int); /* * Look up the string for a quark. * * const char *lx_string_for_quark(LX_QUARK q) * * If q does not correspond to a created quark, or is a value created * by lx_new_quark(), returns nil. (This includes LX_NOQUARK and * LX_ERRQUARK.) Otherwise, returns q's string. The returned string * is owned by the resource manager, must not be freed or written to * by the caller, and remains valid "forever", for the lifetime of the * process. */ extern const char *lx_string_for_quark(LX_QUARK); /* * Convert a resource string to an LX_BOUNDQUARK list. * * int lx_rm_bq_string(const char *s, int l, LX_BOUNDQUARK *bqv, int bqn) * * Converts string (pointer s, length l) to a vector of LX_BOUNDQUARKs, * which are stored through bqv, which points to bqn LX_BOUNDQUARKs. * The return value is the number of components found in the string. * On errors, such as a syntax error in the string, returns -1; in * this case; it is undefined which, if any, of the LX_BOUNDQUARKs are * modified, nor what values are written to any that are. * * If s contains enough components to overflow bqv (ie, more than bqn * of them), the pairs after the first bqn of them are * not written anywhere (and indeed it is not defined which, if any, * of the corresponding quarks are actually created if they don't * already exist), but the return value is still correct; this can be * used to, for example, lazily allocate destination arrays. * * The argument string does not need to remain valid after * lx_rm_bq_string returns. * * As a convenience for the common case of C strings, if l is -1, * strlen(s) is used isntead. */ extern int lx_rm_bq_string(const char *, int, LX_BOUNDQUARK *, int); /* * Convert a resource entry name string to an LX_QUARK list. * * int lx_rm_q_string(const char *s, int l, LX_QUARK *qv, int qn) * * This is just like lx_rm_bq_string except that (a) it requires that * all bindings be tight (. rather than *) and it doesn't return the * LX_BINDINGs (since they'd be constant). Overflow, memory * lifetime, and convenience length are all as for lx_rm_bq_string. */ extern int lx_rm_q_string(const char *, int, LX_QUARK *, int); /* * Resource database routines. */ /* * LX_DB *lx_db_new(void) * Returns a new database containing nothing. */ extern LX_DB *lx_db_new(void); /* * void lx_db_done(LX_DB *) * * Destroys the database, freeing all entries in it and all memory * used by it. If the argument is nil, does nothing. */ extern void lx_db_done(LX_DB *); /* * int lx_db_putq(LX_DB *db, const LX_BOUNDQUARK *bq, int bqn, const void *val, int vallen, unsigned int flags) * * This is the most fundamental (and usually fastest) routine for * altering databases. In all cases, bq and bqn describe the * lookup key to be manipulated. The return value is usually 0 if * it did nothing, 1 if it modified the database, or -1 in error * cases; some flags can modify this (see below). As a * convenience when using NUL-terminated strings as values, if * vallen is -1 and the operation needs, or might need, the value, * strlen(val) is used as the length. bqn<1 and vallen<-1 are * always errors * * Undefined bits set in flags is always an error. * * If flags includes LX_DB_PUTQ_DELETE, it is an error if there * are any other bits set in flags, and any entry in the database * for that bq/bqn is removed. val and vallen are ignored (except * that vallen<-1 is still an error). * * Otherwise, if flags includes LX_DB_PUTQ_PROBE, it is an error * if there are any other bits set in flags. Otherwise, the * database is never changed, and the return value is 1 if there * is an entry for bq/bqn or 0 if not. val and vallen are ignored * (except that vallen<-1 is still an error). * * Otherwise, an entry is potentially inserted or modified. * * If flags includes LX_DB_PUTQ_NOTIFX and the database contains * any entry for bq/bqn, nothing happens (and 0 is returned). If * flags includes LX_DB_PUTQ_NOTIFNX and the database does not * contain any entry for bq/bqn, nothing happens (and 0 is * returned). (These are "not if exists" and "not if doesn't * exist", respectively. They can be used to support "change iff * it exists" and "insert iff it doesn't already exist".) If both * are specified, the logically consistent thing happens: nothing * is done regardless. If neither is specified, the operation * below always happens. * * Otherwise, an entry is created or replaced. If the database * contains no entry for bq/bqn, one is created with val/vallen as * its value; otherwise, the existing entry has its value replaced * with val/vallen. (Replacing the value of an existing entry is * considered a change, even if the new value is identical to the * old.) * * The memory pointed to by bq and val does not need to remain * valid after lx_db_putq returns. */ extern int lx_db_putq(LX_DB *, const LX_BOUNDQUARK *, int, const void *, int, unsigned int); #define LX_DB_PUTQ_DELETE 0x00000001 #define LX_DB_PUTQ_PROBE 0x00000002 #define LX_DB_PUTQ_NOTIFX 0x00000004 #define LX_DB_PUTQ_NOTIFNX 0x00000008 /* * LX_DBVAL lx_db_getq(LX_DB *db, const LX_BOUNDQUARK *bq, int bqn) * This looks up bq/bqn in the database, returning the value found * as an LX_DBVAL. If there is no such entry, returns . * This looks up only the exact bq/bqn given. It is not what you * want for normal queries; for those, see lx_db_query. * * On success, the memory pointed to by the returned LX_DBVAL * remains valid until the relevant entry is removed or has its * value changed (or the database is destroyed). * * The memory pointed to by bq does not need to remain valid after * lx_db_getq returns. */ extern LX_DBVAL lx_db_getq(LX_DB *, const LX_BOUNDQUARK *, int); /* * LX_DBVAL lx_db_query(LX_DB *db, const LX_QUARK *nqv, const LX_QUARK *cqv, int qn) * This performs a query, looking in db for an entry matching name * nqv/qn, class cqv/qn. The most specific value (in the sense * described above) found is returned, or if no match is * found. Note there is only one length value, which describes * both quark vectors. * * Return memory lifetime is as for lx_db_getq(). The memory * pointed to by nqv and cqv does not need to remain valid after * lx_db_query returns. */ extern LX_DBVAL lx_db_query(LX_DB *, const LX_QUARK *, const LX_QUARK *, int); /* * Create a database from a string, specified as pointer-and-length. * * LX_DB *lx_db_from_string(const char *s, int l, unsigned int flags, ...) * * This breaks s at newlines, processing lines according to the * ResourceLine definition above. There does not need to be a final * trailing newline. As a convenience, if l is -1, strlen(s) is used * as the length. flags specifies various flags, some of which * involve additional arguments. When multiple flags involving * arguments are given, the additional arguments appear in the arglist * in the same order as the flags are listed here. * * LX_DB_IGNORE_ERR * No additional args. * Normally, errors cause lx_db_from_string to return nil. * With this flag, they cause any erroneous lines to be * ignored; the returned database is formed from the * non-erroneous lines (if any). * * LX_DB_ERR_COUNT * Additional args: one int *. * A count of errors encountered is written through the * int *. (If LX_DB_IGNORE_ERR is not also set, this * number will be at most one, since in that case * processing stops at the first error encounterd.) * * Undefined flag bits set in flags are always an error, returning nil. * * If the string includes no lines with data on them (ie, no non-blank, * non-comment, and if LX_DB_IGNORE_ERR non-erroneous lines), the * resulting database will be empty. * * If the data specifies the same lookup key multiple times, it is * specifically not defined which value gets used. * * The argument string does not need to remain valid after * lx_db_from_string returns. */ extern LX_DB *lx_db_from_string(const char *, int, unsigned int, ...); #define LX_DB_IGNORE_ERR 0x00000001 #define LX_DB_ERR_COUNT 0x00000002 /* * Create a database from the contents of a file, specified as a * pathname. * * LX_DB *lx_db_from_file(const char *p, unsigned int flags, ...) * * This is semantically equivalent to lx_db_from_string on the file's * contents, with flags and all later args simply passed along, though * it is not necessarily implemented that way. * * The argument string does not need to remain valid after * lx_db_from_file returns. */ extern LX_DB *lx_db_from_file(const char *, unsigned int, ...); /* * Merge two databases. * * void lx_db_merge(LX_DB *tdb, LX_DB *fdb) * * This merges all entries from fdb into tdb, replacing any conflicting * entries. After this operation, fdb is left valid but empty, a * state equivalent to having just been returned by lx_db_new. * * fdb may be nil, in which case this does nothing. */ extern void lx_db_merge(LX_DB *, LX_DB *); /* * Iterate over all entries in a database, callback style. * * int lx_db_map(LX_DB *db, int (*cb)(void *, const LX_BOUNDQUARK *bqv, int nbq, const LX_DBVAL *val), void *cbarg) * * This calls cb for each entry in db (or at least potentially; it may * skip some - see below). If any callback returns a negative value, * lx_db_map returns that same value immediately, without processing * further or making any more callbacks. If that never happens, * lx_db_map returns the sum of the values returned by all the * callbacks. (If the database has no entries, lx_db_map returns 0 * without calling the callback at all.) * * Each call to the callback gets cbarg as its first argument (this * pointer is opaque to the resource manager code; it is used only for * passing to the callback). The second and third arguments describe * the key, as an LX_BOUNDQUARK vector and length. The final arg is * the associated value, as an LX_DBVAL. As the const qualifiers * imply, the callback must not write to any of these; furthermore, * with one exception, the pointed-to memory is not promised to remain * valid past the time the callback returns. That exception is that * the value data, the bytes val->s points to, remain valid until the * relevant database entry is removed or has its value changed, or the * database is destroyed. * * If the callback modifies the database and returns a negative value, * the modification remains and lx_db_map returns per the above spec. * If the callback modifies the database and returns a non-negative * value, what happens is undefined. * * Nothing is promised about what order database entries are processed * in. */ extern int lx_db_map(LX_DB *, int (*)(void *, const LX_BOUNDQUARK *, int, const LX_DBVAL *), void *); /* * Iterate over all entries in a database, call-driven style. * * LX_DB_ITER *lx_db_iter_start(LX_DB *db) * LX_DB_ITERSTAT lx_db_iter_next(LX_DB_ITER *i, LX_BOUNDQUARK *bq, int *bqn, LX_DBVAL *val) * void lx_db_iter_done(LX_DB_ITER *i) * * lx_db_iter_start starts an iteration over db's entries. LX_DB_ITER * is an opaque type encapsulating the iterator state. Call * lx_db_iter_next to get the next entry, lx_db_iter_done when done. * (There is no requirement that the iteration finish before calling * lx_db_iter_done.) * * lx_db_iter_next returns the next entry in the database. bqn is a * value-result parameter. When nonnegative on entry, it points to * the number of LX_BOUNDQUARKs bq points to; in some cases, it is * written through (see below). If the iteration has reached the end * of the available entries, it returns LX_DB_ITER_DONE and does * nothing else (ignoring bq, bqn, and val). Otherwise, if *bqn is * negative on entry, it ignores bq and val, advances the iteration, * and returns LX_DB_ITER_SKIP. Otherwise, if the next entry * overflows bq/bqn, lx_db_iter_next sets *bqn to the number of * LX_BOUNDQUARKs needed to handle the entry, does not store anything * through bq or val, does not advance the iteration, and returns * LX_DB_ITER_OVERFLOW. Otherwise (the usual case), it writes the * quarks and bindings through bq, the number of them through bqn, the * value through val (or .s=nil,.l=-1 if there is no value for that * node), advances the iteration, and returns LX_DB_ITER_NORMAL. In * the LX_DB_ITER_NORMAL case, the memory pointed to by val->s, when * non-nil, remains valid until the relevant entry is removed from the * database or has its value changed, or the database is destroyed. * * lx_db_iter_done shuts down the iteration, disposing of the * LX_DB_ITER, which must not be used further. * * If a database is modified or destroyed while an LX_DB_ITER is in * active on it (ie, returned by lx_db_iter_start but not yet passed * to lx_db_iter_done), then, after the modification or destruction, * the result of calling lx_db_iter_next on that LX_DB_ITER is * undefined, but it is safe to call lx_db_iter_done on it. * * The order in which the entries in a database are visited is * specifically not promised. */ extern LX_DB_ITER *lx_db_iter_start(LX_DB *); extern LX_DB_ITERSTAT lx_db_iter_next(LX_DB_ITER *, LX_BOUNDQUARK *, int *, LX_DBVAL *); extern void lx_db_iter_done(LX_DB_ITER *); /* * lx_abort() is a somewhat odd case. It is an interface which lx * calls but the application can, optionally, provide. It is called * in a few circumstances that should never happen, such as when the * library bugchecks. If the application defines lx_abort(), the * library will call it in these circumstances. Otherwise, it will * call a version of its own which calls abort(). * * lx_abort() normally should not return. If it ever does, the library * tries to do something reasonable, but no promises are made about * precisely what. */ extern void lx_abort(void); /* * Implementation support for the LX_OPEN_* macros. */ #define LX__OPEN_END (-1700) #define LX__OPEN_ERR (-1701) #define LX__OPEN_CB (-1702) #define LX__OPEN_USE_LOOP (-1703) #define LX__OPEN_NO_PREAMBLE (-1704) #define LX__OPEN_DEBUG (-1705) /* * Implementation support for the LX_CWV_* macros. */ #define LX__CWV_BackPixmap (-1750) #define LX__CWV_BackPixel (-1751) #define LX__CWV_BorderPixmap (-1752) #define LX__CWV_BorderPixel (-1753) #define LX__CWV_BitGravity (-1754) #define LX__CWV_WinGravity (-1755) #define LX__CWV_BackingStore (-1756) #define LX__CWV_BackingPlanes (-1757) #define LX__CWV_BackingPixel (-1758) #define LX__CWV_OverrideRedirect (-1759) #define LX__CWV_SaveUnder (-1760) #define LX__CWV_EventMask (-1761) #define LX__CWV_DontPropagate (-1762) #define LX__CWV_Colormap (-1763) #define LX__CWV_Cursor (-1764) #define LX__CWV_X (-1765) #define LX__CWV_Y (-1766) #define LX__CWV_W (-1767) #define LX__CWV_H (-1768) #define LX__CWV_BorderWidth (-1769) #define LX__CWV_Sibling (-1770) #define LX__CWV_StackMode (-1771) #define LX__CWV_END (-1772) /* * Implementation support for the LX_GCV_* macros. */ #define LX__GCV_Function (-1800) #define LX__GCV_PlaneMask (-1801) #define LX__GCV_Foreground (-1802) #define LX__GCV_Background (-1803) #define LX__GCV_LineWidth (-1804) #define LX__GCV_LineStyle (-1805) #define LX__GCV_CapStyle (-1806) #define LX__GCV_JoinStyle (-1807) #define LX__GCV_FillStyle (-1808) #define LX__GCV_FillRule (-1809) #define LX__GCV_Tile (-1810) #define LX__GCV_Stipple (-1811) #define LX__GCV_TileStipXOrigin (-1812) #define LX__GCV_TileStipYOrigin (-1813) #define LX__GCV_Font (-1814) #define LX__GCV_SubwindowMode (-1815) #define LX__GCV_GraphicsExposures (-1816) #define LX__GCV_ClipXOrigin (-1817) #define LX__GCV_ClipYOrigin (-1818) #define LX__GCV_ClipMask (-1819) #define LX__GCV_DashOffset (-1820) #define LX__GCV_Dashes (-1821) #define LX__GCV_ArcMode (-1822) #define LX__GCV_END (-1823) #define LX__GCV_PUSH (-1824) /* * Implementation support for the LX_KCV_* macros. */ #define LX__KCV_KeyClickPercent (-1850) #define LX__KCV_BellPercent (-1851) #define LX__KCV_BellPitch (-1852) #define LX__KCV_BellDuration (-1853) #define LX__KCV_LED (-1854) #define LX__KCV_Repeat (-1855) #define LX__KCV_END (-1856) /* * Geometry utility routine errors. */ #define LX_GEOM_ERR_NONE 0 #define LX_GEOM_ERR_SYNTAX (-1900) #define LX_GEOM_ERR_RANGE (-1901) #define LX_GEOM_ERR_INVALID (-1902) /* * Arglist converters. */ #ifndef LX__EXTERN_INLINE #define LX__EXTERN_INLINE extern inline #endif extern char **lx__cvt_char_p_p(char **); LX__EXTERN_INLINE char **lx__cvt_char_p_p(char **arg) { return(arg); } extern void *lx__cvt_void_p(void *); LX__EXTERN_INLINE void *lx__cvt_void_p(void *arg) { return(arg); } extern int lx__cvt_int(int); LX__EXTERN_INLINE int lx__cvt_int(int arg) { return(arg); } extern AIO_LOOP *lx__cvt_AIO_LOOP_p(AIO_LOOP *); LX__EXTERN_INLINE AIO_LOOP *lx__cvt_AIO_LOOP_p(AIO_LOOP *arg) { return(arg); } extern unsigned long int lx__cvt_LX_XID(LX_XID); LX__EXTERN_INLINE unsigned long int lx__cvt_LX_XID(LX_XID arg) { return(arg); } extern int lx__cvt_bool(int); LX__EXTERN_INLINE int lx__cvt_bool(int arg) { return(arg); } extern unsigned int lx__cvt_mask(unsigned int); LX__EXTERN_INLINE unsigned int lx__cvt_mask(unsigned int arg) { return(arg); } extern unsigned int lx__cvt_pixel(unsigned int); LX__EXTERN_INLINE unsigned int lx__cvt_pixel(unsigned int arg) { return(arg); } /* * Keysym values. These mirror MIT X's . I'm not * fond of some things it does (such as having both "Ukranian" and * "Ukrainian" names for some - but only some - characters), but * trivial source-code mapping between Xlib and lx wins out. :-þ */ #include "lx-keysyms.h" /* * Reverse mapping for 0x20000000-and-up values. This is here to serve * as a registry, to make it harder to accidentally allocate the same * value to multiple names. * 0x20000001 LX_IBO_LSBFirst 0x20000002 LX_IBO_MSBFirst 0x20000003 LX_BBO_LeastSignificant 0x20000004 LX_BBO_MostSignificant 0x20000005 LX_WCLASS_InputOutput 0x20000006 LX_WCLASS_InputOnly 0x20000007 LX_WCLASS_CopyFromParent 0x20000008 LX_FOCUS_None 0x20000009 LX_FOCUS_PointerRoot 0x2000000a LX_FOCUS_Parent 0x2000000b LX_WINDOW_None 0x2000000c LX_VISUAL_None 0x2000000d LX_GRAVITY_NorthWest 0x2000000e LX_GRAVITY_North 0x2000000f LX_GRAVITY_NorthEast 0x20000010 LX_GRAVITY_West 0x20000011 LX_GRAVITY_Center 0x20000012 LX_GRAVITY_East 0x20000013 LX_GRAVITY_SouthWest 0x20000014 LX_GRAVITY_South 0x20000015 LX_GRAVITY_SouthEast 0x20000016 LX_GRAVITY_Static 0x20000017 LX_GRAVITY_Forget 0x20000018 LX_GRAVITY_Unmap 0x20000019 LX__map_error 0x2000001a LX_PIXMAP_None 0x2000001b LX_PIXMAP_ParentRelative 0x2000001c LX_PIXMAP_CopyFromParent 0x2000001d LX_BACKINGSTORE_NotUseful 0x2000001e LX_BACKINGSTORE_WhenMapped 0x2000001f LX_BACKINGSTORE_Always 0x20000020 LX_COLORMAP_CopyFromParent 0x20000021 LX_CURSOR_None 0x20000022 (hole) 0x20000023 (hole) 0x20000024 LX_VISUAL_CopyFromParent 0x20000025 LX_AllocNone 0x20000026 LX_AllocAll 0x20000027 LX_COLORMAP_None 0x20000028 LX_OPENSTATUS_failed 0x20000029 LX_OPENSTATUS_worked 0x2000002a LX_GC_None 0x2000002b LX_GCCLIPMASK_None 0x2000002c LX_SGC_None 0x2000002d LX_GCLINESTYLE_Solid 0x2000002e LX_GCLINESTYLE_OnOffDash 0x2000002f LX_GCLINESTYLE_DoubleDash 0x20000030 LX_GCFUNCTION_Clear 0x20000031 LX_GCFUNCTION_And 0x20000032 LX_GCFUNCTION_AndReverse 0x20000033 LX_GCFUNCTION_Copy 0x20000034 LX_GCFUNCTION_AndInverted 0x20000035 LX_GCFUNCTION_NoOp 0x20000036 LX_GCFUNCTION_Xor 0x20000037 LX_GCFUNCTION_Or 0x20000038 LX_GCFUNCTION_Nor 0x20000039 LX_GCFUNCTION_Equiv 0x2000003a LX_GCFUNCTION_Invert 0x2000003b LX_GCFUNCTION_OrReverse 0x2000003c LX_GCFUNCTION_CopyInverted 0x2000003d LX_GCFUNCTION_OrInverted 0x2000003e LX_GCFUNCTION_Nand 0x2000003f LX_GCFUNCTION_Set 0x20000040 (hole) 0x20000041 LX_GCCAPSTYLE_NotLast 0x20000042 LX_GCCAPSTYLE_Butt 0x20000043 LX_GCCAPSTYLE_Round 0x20000044 LX_GCCAPSTYLE_Projecting 0x20000045 (hole) 0x20000046 LX_GCJOINSTYLE_Miter 0x20000047 LX_GCJOINSTYLE_Round 0x20000048 LX_GCJOINSTYLE_Bevel 0x20000049 (hole) 0x2000004a LX_GCFILLSTYLE_Solid 0x2000004b LX_GCFILLSTYLE_Tiled 0x2000004c LX_GCFILLSTYLE_Stippled 0x2000004d LX_GCFILLSTYLE_OpaqueStippled 0x2000004e (hole) 0x2000004f LX_GCFILLRULE_EvenOdd 0x20000050 LX_GCFILLRULE_Winding 0x20000051 (hole) 0x20000052 LX_GCSUBWINDOWMODE_ClipByChildren 0x20000053 LX_GCSUBWINDOWMODE_IncludeInferiors 0x20000054 (hole) 0x20000055 LX_GCARCMODE_Chord 0x20000056 LX_GCARCMODE_PieSlice 0x20000057 (hole) 0x20000058 LX_COORDMODE_Origin 0x20000059 LX_COORDMODE_Previous 0x2000005a LX_MAPSTATE_Unmapped 0x2000005b LX_MAPSTATE_Unviewable 0x2000005c LX_MAPSTATE_Viewable 0x2000005d (hole) 0x2000005e LX_FORCESCREENSAVER_Reset 0x2000005f LX_FORCESCREENSAVER_Activate 0x20000060 LX_ATOM_None 0x20000061 LX_ATOM_AnyPropertyType 0x20000062 LX_KILLCLIENT_AllTemporary 0x20000063 LX_CLOSEDOWNMODE_Destroy 0x20000064 LX_CLOSEDOWNMODE_RetainPermanent 0x20000065 LX_CLOSEDOWNMODE_RetainTemporary 0x20000066 LX_ACCESSCONTROL_Disable 0x20000067 LX_ACCESSCONTROL_Enable 0x20000068 (hole) 0x20000069 LX_HOSTTYPE_IPv4 0x2000006a LX_HOSTTYPE_IPv6 0x2000006b LX_HOSTTYPE_DECnet 0x2000006c LX_HOSTTYPE_Chaos 0x2000006d LX_HOSTTYPE_Other 0x2000006e LX_HOSTTYPE_Error 0x2000006f LX_CHANGEHOSTSMODE_Insert 0x20000070 LX_CHANGEHOSTSMODE_Delete 0x20000071 LX_SSBLANKING_No 0x20000072 LX_SSBLANKING_Yes 0x20000073 LX_SSBLANKING_Default 0x20000074 (hole) 0x20000075 LX_SSEXPOSURES_No 0x20000076 LX_SSEXPOSURES_Yes 0x20000077 LX_SSEXPOSURES_Default 0x20000078 (hole) 0x20000079 LX_KBCTLLEDACTION_Off 0x2000007a LX_KBCTLLEDACTION_On 0x2000007b LX_KBCTLREPEATACTION_Off 0x2000007c LX_KBCTLREPEATACTION_On 0x2000007d LX_KBCTLREPEATACTION_Default 0x2000007e LX_SIZECLASS_Cursor 0x2000007f LX_SIZECLASS_Tile 0x20000080 LX_SIZECLASS_Stipple 0x20000081 LX_FONT_None 0x20000082 LX_XID_Error 0x20000083 LX_IMAGEFORMAT_Bitmap 0x20000084 LX_IMAGEFORMAT_XYPixmap 0x20000085 LX_IMAGEFORMAT_ZPixmap 0x20000086 LX_SHAPECLASS_Complex 0x20000087 LX_SHAPECLASS_Nonconvex 0x20000088 LX_SHAPECLASS_Convex 0x20000089 LX_RECTORDER_UnSorted 0x2000008a LX_RECTORDER_YSorted 0x2000008b LX_RECTORDER_YXSorted 0x2000008c LX_RECTORDER_YXBanded 0x2000008d LX_CHANGESAVESETMODE_Insert 0x2000008e LX_CHANGESAVESETMODE_Delete 0x2000008f LX_CIRCULATE_RaiseLowest 0x20000090 LX_CIRCULATE_LowerHighest 0x20000091 LX_STACKMODE_Above 0x20000092 LX_STACKMODE_Below 0x20000093 LX_STACKMODE_TopIf 0x20000094 LX_STACKMODE_BottomIf 0x20000095 LX_STACKMODE_Opposite 0x20000096 LX_PROPERTYMODE_Replace 0x20000097 LX_PROPERTYMODE_Prepend 0x20000098 LX_PROPERTYMODE_Append 0x20000099 LX_GRABMODE_Synchronous 0x2000009a LX_GRABMODE_Asynchronous 0x2000009b LX_GRABSTATUS_Succses 0x2000009c LX_GRABSTATUS_AlreadyGrabbed 0x2000009d LX_GRABSTATUS_InvalidTime 0x2000009e LX_GRABSTATUS_NotViewable 0x2000009f LX_GRABSTATUS_Frozen 0x200000a0 (hole) 0x200000a1 LX_ALLOWMODE_AsyncPointer 0x200000a2 LX_ALLOWMODE_SyncPointer 0x200000a3 LX_ALLOWMODE_ReplayPointer 0x200000a4 LX_ALLOWMODE_AsyncKeyboard 0x200000a5 LX_ALLOWMODE_SyncKeyboard 0x200000a6 LX_ALLOWMODE_ReplayKeyboard 0x200000a7 LX_ALLOWMODE_AsyncBoth 0x200000a8 LX_ALLOWMODE_SyncBoth 0x200000a9 LX_TEXTDIRECTION_LeftToRight 0x200000aa LX_TEXTDIRECTION_RightToLeft 0x200000ab (hole) 0x200000ac LX_MOTIONDETAIL_Normal 0x200000ad LX_MOTIONDETAIL_Hint 0x200000ae (hole) 0x200000af LX_ENTERLEAVEDETAIL_Ancestor 0x200000b0 LX_ENTERLEAVEDETAIL_Virtual 0x200000b1 LX_ENTERLEAVEDETAIL_Inferior 0x200000b2 LX_ENTERLEAVEDETAIL_Nonlinear 0x200000b3 LX_ENTERLEAVEDETAIL_NonlinearVirtual 0x200000b4 LX_ENTERLEAVEMODE_Normal 0x200000b5 LX_ENTERLEAVEMODE_Grab 0x200000b6 LX_ENTERLEAVEMODE_Ungrab 0x200000b7 LX_FOCUSDETAIL_Ancestor 0x200000b8 LX_FOCUSDETAIL_Virtual 0x200000b9 LX_FOCUSDETAIL_Inferior 0x200000ba LX_FOCUSDETAIL_Nonlinear 0x200000bb LX_FOCUSDETAIL_NonlinearVirtual 0x200000bc LX_FOCUSDETAIL_Pointer 0x200000bd LX_FOCUSDETAIL_PointerRoot 0x200000be LX_FOCUSDETAIL_None 0x200000bf LX_FOCUSMODE_Normal 0x200000c0 LX_FOCUSMODE_Grab 0x200000c1 LX_FOCUSMODE_Ungrab 0x200000c2 LX_FOCUSMODE_WhileGrabbed 0x200000c3 LX_VISIBILITYSTATE_Unobscured 0x200000c4 LX_VISIBILITYSTATE_PartiallyObscured 0x200000c5 LX_VISIBILITYSTATE_FullyObscured 0x200000c6 LX_CIRCULATEPLACE_Top 0x200000c7 LX_CIRCULATEPLACE_Bottom 0x200000c8 LX_PROPERTYSTATE_NewValue 0x200000c9 LX_PROPERTYSTATE_Deleted 0x200000ca LX_COLORMAPSTATE_Uninstalled 0x200000cb LX_COLORMAPSTATE_Installed 0x200000cc LX_MAPPINGREQUEST_Modifier 0x200000cd LX_MAPPINGREQUEST_Keyboard 0x200000ce LX_MAPPINGREQUEST_Pointer 0x200000cf LX_WINDOW_PointerWindow 0x200000d0 LX_WINDOW_InputFocus 0x200000d1 LX_MAPPINGSTATUS_Success 0x200000d2 LX_MAPPINGSTATUS_Busy 0x200000d3 LX_MAPPINGSTATUS_Failed 0x200000d4 (hole) 0x200000d5 (hole) 0x200000d6 (hole) 0x200000d7 (hole) 0x200000d8 LX_VISUALCLASS_StaticColor 0x200000d9 LX_VISUALCLASS_PseudoColor 0x200000da LX_VISUALCLASS_StaticGray 0x200000db LX_VISUALCLASS_GrayScale 0x200000dc LX_VISUALCLASS_TrueColor 0x200000dd LX_VISUALCLASS_DirectColor 0x200000de (nonexistent LX_VisualClass) 0x200000df (nonexistent LX_VisualClass) 0x40000000-0x4fffffff allocated to extensions 0x40000000-0x400000ff allocated to SHAPE */ #endif