#ifndef WH_LX_H_bae2ca4c_ #define WH_LX_H_bae2ca4c_ #include typedef unsigned int LX_XID; typedef unsigned int LX_KEYSYM; /* * 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. */ typedef unsigned char LX_KEYCODE; typedef unsigned int LX_IMAGE_BYTE_ORDER; #define LX_IBO_LSBFirst 0x20000001 #define LX_IBO_MSBFirst 0x20000002 typedef unsigned int LX_BITMAP_BIT_ORDER; #define LX_BBO_LeastSignificant 0x20000003 #define LX_BBO_MostSignificant 0x20000004 typedef unsigned int LX_WINDOW_CLASS; #define LX_WCLASS_InputOutput 0x20000005 #define LX_WCLASS_InputOnly 0x20000006 #define LX_WCLASS_CopyFromParent 0x20000007 #define LX__WCLASS_Error 0x20000019 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 #define LX__GRAVITY_Error 0x20000022 typedef unsigned int LX_BACKINGSTORE; #define LX_BACKINGSTORE_NotUseful 0x2000001d #define LX_BACKINGSTORE_WhenMapped 0x2000001e #define LX_BACKINGSTORE_Always 0x2000001f #define LX__BACKINGSTORE_Error 0x20000023 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 #define LX__GCFUNCTION_Error 0x2000002c typedef unsigned int LX_GCLINESTYLE; #define LX_GCLINESTYLE_Solid 0x2000002d #define LX_GCLINESTYLE_OnOffDash 0x2000002e #define LX_GCLINESTYLE_DoubleDash 0x2000002f #define LX__GCLINESTYLE_Error 0x20000040 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 #define LX__GCCAPSTYLE_Error 0x20000045 typedef unsigned int LX_GCJOINSTYLE; #define LX_GCJOINSTYLE_Miter 0x20000046 #define LX_GCJOINSTYLE_Round 0x20000047 #define LX_GCJOINSTYLE_Bevel 0x20000048 #define LX__GCJOINSTYLE_Error 0x20000049 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 #define LX__GCFILLSTYLE_Error 0x2000004e typedef unsigned int LX_GCFILLRULE; #define LX_GCFILLRULE_EvenOdd 0x2000004f #define LX_GCFILLRULE_Winding 0x20000050 #define LX__GCFILLRULE_Error 0x20000051 typedef unsigned int LX_GCSUBWINDOWMODE; #define LX_GCSUBWINDOWMODE_ClipByChildren 0x20000052 #define LX_GCSUBWINDOWMODE_IncludeInferiors 0x20000053 #define LX__GCSUBWINDOWMODE_Error 0x20000054 typedef unsigned int LX_GCARCMODE; #define LX_GCARCMODE_Chord 0x20000055 #define LX_GCARCMODE_PieSlice 0x20000056 #define LX__GCARCMODE_Error 0x20000057 typedef unsigned int LX_OPEN_STATUS; #define LX_OPENSTATUS_failed 0x20000028 #define LX_OPENSTATUS_worked 0x20000029 typedef unsigned int LX_COORDMODE; #define LX_COORDMODE_Origin 0x20000058 #define LX_COORDMODE_Previous 0x20000059 typedef unsigned int LX_MAPSTATE; #define LX_MAPSTATE_Unmapped 0x2000005a #define LX_MAPSTATE_Unviewable 0x2000005b #define LX_MAPSTATE_Viewable 0x2000005c #define LX__MAPSTATE_Error 0x2000005d typedef unsigned int LX_FORCESCREENSAVER; #define LX_FORCESCREENSAVER_Reset 0x2000005e #define LX_FORCESCREENSAVER_Activate 0x2000005f typedef unsigned int LX_ATOM; #define LX_ATOM_None 0x20000060 #define LX_ATOM_AnyPropertyType 0x20000061 typedef unsigned int LX_CLOSEDOWNMODE; #define LX_CLOSEDOWNMODE_Destroy 0x20000063 #define LX_CLOSEDOWNMODE_RetainPermanent 0x20000064 #define LX_CLOSEDOWNMODE_RetainTemporary 0x20000065 typedef unsigned int LX_ACCESSCONTROL; #define LX_ACCESSCONTROL_Disable 0x20000066 #define LX_ACCESSCONTROL_Enable 0x20000067 #define LX__ACCESSCONTROL_Error 0x20000068 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 typedef unsigned int LX_CHANGEHOSTSMODE; #define LX_CHANGEHOSTSMODE_Insert 0x2000006f #define LX_CHANGEHOSTSMODE_Delete 0x20000070 typedef unsigned int LX_SSBLANKING; #define LX_SSBLANKING_No 0x20000071 #define LX_SSBLANKING_Yes 0x20000072 #define LX_SSBLANKING_Default 0x20000073 #define LX__SSBLANKING_Error 0x20000074 typedef unsigned int LX_SSEXPOSURES; #define LX_SSEXPOSURES_No 0x20000075 #define LX_SSEXPOSURES_Yes 0x20000076 #define LX_SSEXPOSURES_Default 0x20000077 #define LX__SSEXPOSURES_Error 0x20000078 typedef unsigned int LX_KBCTLLEDACTION; #define LX_KBCTLLEDACTION_Off 0x20000079 #define LX_KBCTLLEDACTION_On 0x2000007a typedef unsigned int LX_KBCTLREPEATACTION; #define LX_KBCTLREPEATACTION_Off 0x2000007b #define LX_KBCTLREPEATACTION_On 0x2000007c #define LX_KBCTLREPEATACTION_Default 0x2000007d typedef unsigned int LX_SIZECLASS; #define LX_SIZECLASS_Cursor 0x2000007e #define LX_SIZECLASS_Tile 0x2000007f #define LX_SIZECLASS_Stipple 0x20000080 typedef unsigned int LX_IMAGEFORMAT; #define LX_IMAGEFORMAT_Bitmap 0x20000083 #define LX_IMAGEFORMAT_XYPixmap 0x20000084 #define LX_IMAGEFORMAT_ZPixmap 0x20000085 typedef unsigned int LX_SHAPECLASS; #define LX_SHAPECLASS_Complex 0x20000086 #define LX_SHAPECLASS_Nonconvex 0x20000087 #define LX_SHAPECLASS_Convex 0x20000088 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 #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 /* * Typs 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. */ // Used to represent a line segment for, eg, lx_PolySegment. typedef struct lx_segment LX_SEGMENT; struct lx_segment { int x1; int y1; int x2; int y2; } ; // Used to represent a point for, eg, lx_PolyPoint. typedef struct lx_point LX_POINT; struct lx_point { int x; int y; } ; // Used to represent an arc for, eg, lx_PolyFillArc. typedef struct lx_arc LX_ARC; struct lx_arc { int x; int y; int w; int h; int a1; int a2; } ; // Used to represent a rectangle for, eg, lx_PolyFillRectangle. typedef struct lx_rectangle LX_RECTANGLE; struct lx_rectangle { int x; int y; int w; int h; } ; typedef struct lx_window_attributes LX_WINDOW_ATTRIBUTES; struct lx_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; } ; 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; } ; typedef struct lx_pointercontrol LX_POINTERCONTROL; // Set a value to -1 for the default // If ACCEL isn't set, ignore numerator/denominator // If THRESH isn't set, ignore threshold struct lx_pointercontrol { unsigned int flags; #define LX_POINTERCONTROL_ACCEL 0x00000001 #define LX_POINTERCONTROL_THRESH 0x00000002 int numerator; int denominator; int threshold; } ; 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]; } ; typedef struct lx_rgb LX_RGB; struct lx_rgb { unsigned int r; unsigned int g; unsigned int b; } ; typedef struct lx_rgbpf LX_RGBPF; struct lx_rgbpf { unsigned int r; unsigned int g; unsigned int b; unsigned int pixel; unsigned int flags; } ; 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 } ; 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 } ; /* * An X error. See below about error handling. */ typedef enum { LXXE_Request = 1, LXXE_Value, LXXE_Window, LXXE_Pixmap, LXXE_Atom, LXXE_Cursor, LXXE_Font, LXXE_Match, LXXE_Drawable, LXXE_Access, LXXE_Alloc, LXXE_Colormap, LXXE_GContext, LXXE_IDChoice, LXXE_Name, LXXE_Length, LXXE_Implementation, LXXE_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 LXXE_Request struct { unsigned int seq; unsigned int value; unsigned int opc_major; unsigned int opc_minor; } value; // if LXXE_Value struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } window; // if LXXE_Window struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } pixmap; // if LXXE_Pixmap struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } atom; // if LXXE_Atom struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } cursor; // if LXXE_Cursor struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } font; // if LXXE_Font struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } match; // if LXXE_Match struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } drawable; // if LXXE_Drawable struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } access; // if LXXE_Access struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } alloc; // if LXXE_Alloc struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } colormap; // if LXXE_Colormap struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } gcontext; // if LXXE_GContext struct { unsigned int seq; unsigned int id; unsigned int opc_major; unsigned int opc_minor; } idchoice; // if LXXE_IDChoice; struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } name; // if LXXE_Name struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } length; // if LXXE_Length struct { unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } implementation; // if LXXE_Implementation struct { unsigned int type; unsigned int seq; unsigned int opc_major; unsigned int opc_minor; } other; // if LXXE_Other } u; } ; /* * A library-internal error. See below about error handling. * * LXLE_NOMEM * Out of memory (eg, malloc() failed). * LXLE_SYSERR * Error from a syscall, with errno. * LXLE_OSLIBERR * Error from an OS library call, potentially with message. * LXLE_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. * LXLE_NO_DISPLAY * lx_open was passed no display string and thre was no $DISPLAY * in the environment. * LXLE_BAD_DISPLAY * The display string to lx_open (either passed in or from * $DISPLAY) was erroneous in some way. * LXLE_UNX_EOF * The library got an unexpected EOF on the X connection. * LXLE_ALL_FAIL * lx_open ran out of addresses to try without getting a * connection. u.all_fail.msg may have a helpful message. * LXLE_PROTO_ERR * The library got an X protocol error. u.proto_err.msg briefly * states the error. * LXLE_REJECTED * The X server rejected the connection. u.rejected.msg is the * message the server returned. */ typedef enum { LXLE_NOMEM = 1, LXLE_SYSERR, LXLE_OSLIBERR, LXLE_BAD_CALL, LXLE_NO_DISPLAY, LXLE_BAD_DISPLAY, LXLE_UNX_EOF, LXLE_ALL_FAIL, LXLE_PROTO_ERR, LXLE_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 LXLE_NOMEM struct { // syscall which returned error const char *call; // errno returned int err; } syserr; // for LXLE_SYSERR struct { // library call which returned error const char *call; // message, nil if none const char *msg; } osliberr; // for LXLE_OSLIBERR struct { // API function which was called wrong const char *fn; } bad_call; // for LXLE_BAD_CALL // nothing for LXLE_NO_DISPLAY // nothing for LXLE_BAD_DISPLAY // nothing for LXLE_UNX_EOF struct { const char *msg; } all_fail; // for LXLE_ALL_FAIL struct { const char *msg; } proto_err; // for LXLE_PROTO_ERR struct { const char *msg; } rejected; // for LXLE_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. * * 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. 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. * * LX_X_ERR_CRASH * Print a description of the error to stderr and exit(1). * * If no X error callback is set, it is as if one were which did * nothing but return LX_X_ERR_CRASH. * * 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 tset firing 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 LXLE_BAD_CALL handler returns, the * bad call is ignored, as if it had not been made at all. * * If no library error callback is set, the library supplies one which * prints a message to stderr and exits with code 1. * * 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. * * When a connection is first created, its error handlers are unset. * 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. */ 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 *); /* * There are various internal functions prototyped here as well, * typically because they are part of the implementation behind a * macro. Any name lx__* or LX__* should be considered an internal * interface, 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). * * loop is the AIO_LOOP the library is to use for this connection. * This may be nil, in which case the library uses the global loop. * * cbarg is a pointer, opaque to the library, which is passaed 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_drop on all * pending LX_OPs on it. */ extern void lx_close(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. An example of an open-loop request might be * CreateWindow; an example of a response-expected request might be * GetWindowAttributes. * * For open-loop requests, the call (eg, lx_CreateWindow) returns the * results, if any, immediately (eg, an LX_XID for lx_CreateWindow, or * nothing for lx_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 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, percent extern void lx_Bell(LX_CONN *, int); // conn, focusp, revertp extern LX_OP *lx_GetInputFocus(LX_CONN *, LX_XID *, LX_XID *); // conn, parent, x, y, w, h, bw, dp, class, vis, ... extern LX_XID lx_CreateWindow(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, visual, window, alloc extern LX_XID lx_CreateColormap(LX_CONN *, LX_XID, LX_XID, LX_XID); // conn, window extern void lx_MapWindow(LX_CONN *, LX_XID); // 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, drawable, ... extern LX_XID lx_CreateGC(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 // conn, drawable, gc, nseg, segments extern void lx_PolySegment(LX_CONN *, LX_XID, LX_XID, int, const LX_SEGMENT *); // conn, gc, ... // varargs are the same as for lx_CreateGC extern void lx_ChangeGC(LX_CONN *, LX_XID, ...); // conn, drawable, depth, width, height extern LX_XID lx_CreatePixmap(LX_CONN *, LX_XID, unsigned int, unsigned 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, window, ... // varargs are the same as for lx_CreateWindow extern void lx_ChangeWindowAttributes(LX_CONN *, LX_XID, ...); // conn, window, attrs extern LX_OP *lx_GetWindowAttributes(LX_CONN *, LX_XID, LX_WINDOW_ATTRIBUTES *); // conn, window extern void lx_DestroyWindow(LX_CONN *, LX_XID); // conn extern void lx_NoOperation(LX_CONN *); // 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, num, keycodesp // keycodesp must point to 8*num LX_KeyCodes extern void lx_SetModifierMapping(LX_CONN *, int, const LX_KEYCODE *); // 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, mapping // mapping must point to num unsigned chars extern void lx_SetPointerMapping(LX_CONN *, int, const unsigned char *); // conn, mode extern void lx_ForceScreenSaver(LX_CONN *, LX_FORCESCREENSAVER); // conn, window, delta, nprop, props extern void lx_RotateProperties(LX_CONN *, LX_XID, int, int, const LX_ATOM *); // conn, resource extern void lx_KillClient(LX_CONN *, LX_XID); // conn, mode extern void lx_SetCloseDownMode(LX_CONN *, LX_CLOSEDOWNMODE); // conn, mode extern void lx_SetAccessControl(LX_CONN *, LX_ACCESSCONTROL); // conn, accctl, list // See also the lx_hostlist_* functions. extern LX_OP *lx_ListHosts(LX_CONN *, LX_ACCESSCONTROL *, LX_HOSTLIST **); // conn, mode, type, datalen, data extern void lx_ChangeHosts(LX_CONN *, LX_CHANGEHOSTSMODE, LX_HOSTTYPE, int, const void *); // conn, status extern LX_OP *lx_GetScreenSaver(LX_CONN *, LX_SCREENSAVER *); // conn, status extern void lx_SetScreenSaver(LX_CONN *, const LX_SCREENSAVER *); // conn, status extern LX_OP *lx_GetPointerControl(LX_CONN *, LX_POINTERCONTROL *); // conn, status extern void lx_ChangePointerControl(LX_CONN *, const LX_POINTERCONTROL *); // conn, status extern LX_OP *lx_GetKeyboardControl(LX_CONN *, LX_KEYBOARDCONTROL *); // conn, ... extern void lx_ChangeKeyboardControl(LX_CONN *, ...); #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, 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, first, keycodes, symspercode, syms extern void lx_ChangeKeyboardMapping(LX_CONN *, int, int, int, const LX_KEYSYM *); // conn, namesp // See also the lx_strlist_* functions extern LX_OP *lx_ListExtensions(LX_CONN *, LX_STRLIST **listp); // 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, drawable, class, w, h, rwp, rhp extern LX_OP *lx_QueryBestSize(LX_CONN *, LX_XID, LX_SIZECLASS, int, int, int *, int *); // 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, cursor extern void lx_FreeCursor(LX_CONN *, LX_XID); // conn, srcfont, maskfont, srcchar, maskchar, fr, fg, fb, br, bg, bb extern void lx_CreateGlyphCursor(LX_CONN *, LX_XID, LX_XID, int, int, int, int, int, int, int, int); // conn, srcfont, maskfont, srcchar, maskchar, fg, bg extern void lx_CreateGlyphCursor_rgb(LX_CONN *, LX_XID, LX_XID, int, int, LX_RGB, LX_RGB); // conn, src, mask, fr, fg, fb, br, bg, bb, hotx, hoty extern void lx_CreateCursor(LX_CONN *, LX_XID, LX_XID, int, int, int, int, int, int, int, int); // conn, src, mask, fg, bg, hotx, hoty extern void lx_CreateCursor_rgb(LX_CONN *, LX_XID, LX_XID, LX_RGB, LX_RGB, int, int); // 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, 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, 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, num, items extern void lx_StoreColors(LX_CONN *, LX_XID, int, const LX_RGBPF *); // conn, cmap, planes, npix, pixv extern void lx_FreeColors(LX_CONN *, LX_XID, unsigned int, int, const 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, contig, cols, planes, pixp, planep extern LX_OP *lx_AllocColorCells(LX_CONN *, LX_XID, int, int, 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, window, listp // See also the lx_XIDlist_* functions extern LX_OP *lx_ListInstalledColormaps(LX_CONN *, LX_XID, LX_XIDLIST **); // conn, cmap extern void lx_UninstallColormap(LX_CONN *, LX_XID); // conn, cmap extern void lx_InstallColormap(LX_CONN *, LX_XID); // conn, old extern LX_XID lx_CopyColormapAndFree(LX_CONN *, LX_XID); // conn, cmap extern void lx_FreeColormap(LX_CONN *, LX_XID); // 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, 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, nitems, items extern void lx_PolyText16(LX_CONN *, LX_XID, LX_XID, int, int, int, const LX_TEXTITEM16 *); // 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, 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, 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, gc, narcs, arcs extern void lx_PolyFillArc(LX_CONN *, LX_XID, LX_XID, int, const LX_ARC *); // conn, drawable, gc, nrects, rects extern void lx_PolyFillRectangle(LX_CONN *, LX_XID, LX_XID, int, const LX_RECTANGLE *); // 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, narcs, arcs extern void lx_PolyArc(LX_CONN *, LX_XID, LX_XID, int, const LX_ARC *); // conn, drawable, gc, nrects, rects extern void lx_PolyRectangle(LX_CONN *, LX_XID, LX_XID, int, const LX_RECTANGLE *); // conn, drawable, gc, coordmode, npts, pts extern void lx_PolyLine(LX_CONN *, LX_XID, LX_XID, LX_COORDMODE, int, const LX_POINT *); // 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, 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, window, x, y, w, h, exposures extern void lx_ClearArea(LX_CONN *, LX_XID, int, int, int, int, int); // conn, gc extern void lx_FreeGC(LX_CONN *, LX_XID); // conn, gc, xo, yo, nrects, rects, ordering extern void lx_SetClipRectangle(LX_CONN *, LX_XID, int, int, int, const LX_RECTANGLE *, LX_RECTORDER); // conn, gc, offset, ndash, dashes extern void lx_SetDashes(LX_CONN *, LX_XID, int, int, const unsigned char *); // conn, src, dst, mask // mask uses LX_GCM_* bits extern void lx_CopyGC(LX_CONN *, LX_XID, LX_XID, unsigned int); // conn, pixmap extern void lx_FreePixmap(LX_CONN *, LX_XID); // conn, pathp extern LX_OP *lx_GetFontPath(LX_CONN *, LX_STRLIST **); // 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, pattern, maxnames, listp // XXX Do we want an interface supporting NULs in path names? extern LX_OP *lx_ListFonts(LX_CONN *, const char *, int, LX_STRLIST **); // conn, font extern void lx_CloseFont(LX_CONN *, LX_XID); // conn, name // XXX Do we want an interface supporting NULs in font names? extern LX_XID lx_OpenFont(LX_CONN *, const char *); /* * 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 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); // 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 // 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 // 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_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 the request 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 about op. 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(). * * 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. * * 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 and lx_op_drop 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_set_udata(LX_OP *, void *); extern void *lx_op_udata(LX_OP *); /* * 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. */ 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); /* * lx_abort() is a somewhat odd case. It is an interface which lx * calls but the user will, optionally, provide. It is called in a * few circumstances that should never happen, such as when the * application has misused an API or 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_END (-1765) /* * 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) /* * 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) /* * 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_fn_opencbarg(void (*)(void *, LX_OPEN_STATUS)))(void *, LX_OPEN_STATUS); LX__EXTERN_INLINE void (*lx__cvt_fn_opencbarg(void (*arg)(void *, LX_OPEN_STATUS)))(void *, LX_OPEN_STATUS) { 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); } /* * 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__WCLASS_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 LX__GRAVITY_Error 0x20000023 LX__BACKINGSTORE_Error 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__GCFUNCTION_Error 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 LX__GCLINESTYLE_Error 0x20000041 LX_GCCAPSTYLE_NotLast 0x20000042 LX_GCCAPSTYLE_Butt 0x20000043 LX_GCCAPSTYLE_Round 0x20000044 LX_GCCAPSTYLE_Projecting 0x20000045 LX__GCCAPSTYLE_Error 0x20000046 LX_GCJOINSTYLE_Miter 0x20000047 LX_GCJOINSTYLE_Round 0x20000048 LX_GCJOINSTYLE_Bevel 0x20000049 LX__GCJOINSTYLE_Error 0x2000004a LX_GCFILLSTYLE_Solid 0x2000004b LX_GCFILLSTYLE_Tiled 0x2000004c LX_GCFILLSTYLE_Stippled 0x2000004d LX_GCFILLSTYLE_OpaqueStippled 0x2000004e LX__GCFILLSTYLE_Error 0x2000004f LX_GCFILLRULE_EvenOdd 0x20000050 LX_GCFILLRULE_Winding 0x20000051 LX__GCFILLRULE_Error 0x20000052 LX_GCSUBWINDOWMODE_ClipByChildren 0x20000053 LX_GCSUBWINDOWMODE_IncludeInferiors 0x20000054 LX__GCSUBWINDOWMODE_Error 0x20000055 LX_GCARCMODE_Chord 0x20000056 LX_GCARCMODE_PieSlice 0x20000057 LX__GCARCMODE_Error 0x20000058 LX_COORDMODE_Origin 0x20000059 LX_COORDMODE_Previous 0x2000005a LX_MAPSTATE_Unmapped 0x2000005b LX_MAPSTATE_Unviewable 0x2000005c LX_MAPSTATE_Viewable 0x2000005d LX__MAPSTATE_Error 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 LX__ACCESSCONTROL_Error 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 LX__SSBLANKING_Error 0x20000075 LX_SSEXPOSURES_No 0x20000076 LX_SSEXPOSURES_Yes 0x20000077 LX_SSEXPOSURES_Default 0x20000078 LX__SSEXPOSURES_Error 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 */ #endif