This file documents the liblx routines for core requests. Most requests have one routine; a few have more (typically because certain information can be provided in more than one way, such as an RGB triple being provided as a struct or as three arguments). The first argument to all of these is an LX_CONN *. This is always the connection the request is made on; this is rarely-to-never specifically mentioned. Most of these do not give full details here; see the X protocol documentation for them. For example, there are various interactions among the arguments to CreateWindow requests, few-to-none of which are documented here. (I intend to write more extensive documentation for these; this is a preliminary version.) A `drawable' means either a window or a pixmap; many requests can operate on either. For the routines returning an LX_OP *, see pending-operations for more. Routines that return data through pointer arguments accept nil pointers for these arguments; when this is done, the information that would normally be written through that argument is not saved anywhere. (When it would normally be allocated data such as a struct or a data buffer, the memory either is freed within liblx or isn't allocated at all.) **** THIS FILE IS STILL BEING WRITTEN **** lx_AllocColor ------------- LX_OP *lx_AllocColor(LX_CONN *conn, LX_XID cm, unsigned int r, unsigned int g, unsigned int b, unsigned int *pix, unsigned int *actr, unsigned int *actg, unsigned int *actb) Issues an AllocColor request, allocating a read-only colormap cell in cm, storing the closest values to (r,g,b) that the hardware provides. The resulting pixel value is written through pix and the actual RGB values used are written through actr, actg, and actb, at some popint after entry to lx_AllocColor and before the returned LX_OP completes. lx_AllocColorCells ------------------ LX_OP *lx_AllocColorCells(LX_CONN *conn, LX_XID cm, int contig, int ncols, int nplanes, unsigned int *pixp, unsigned int *planesp) Issues an AllocColorCells request, allocating writable colormap cells in the colormap cm. ncols must be postive and nplanes must be nonnegative. ncols pixels and nplanes planes will be returned; no plane will have any bits in common with any other plane, nor with any of the pixels, so by ORing together one pixel value with some subset of the planes, ncols*(1<>3, with a 0 bit corresponding to a released key and a 1 bit corresponding to a pressed key. This fetches the logical state of the keyboard, which may lag the physical state if keyboard event processing is frozen. The writes happen at some point after entry ot lx_QueryKeymap and before the returned LX_OP completes. lx_QueryPointer, lx_QueryPointer_status --------------- ---------------------- extern LX_OP *lx_QueryPointer(LX_CONN *conn, LX_XID win, int *samescreenp, LX_XID *rootp, LX_XID *childp, int *rxp, int *ryp, int *wxp, int *wyp, unsigned int *maskp) extern LX_OP *lx_QueryPointer_status(LX_CONN *conn, LX_XID win, LX_QUERYPOINTER_STATUS *statp) Issues a QueryPointer request, querying the current pointer location. win is the window the query is issued with respect to. For lx_QueryPointer, the returned values are written through the arguments after win; for lx_QueryPointer_status, the returned values are written into the struct pointed to by statp. In either case, these writes occur at some point after entry to lx_QueryPointer or lx_QueryPointer_status and before the returned LX_OP completes. lx_QueryTextExtents8, lx_QueryTextExtents16 -------------------- --------------------- LX_OP *lx_QueryTextExtents8(LX_CONN *conn, LX_XID fid, const unsigned char *str, int slen, LX_TEXTDIRECTION *dirp, int *ascp, int *dscp, LX_CHARINFO *overallp) LX_OP *lx_QueryTextExtents16(LX_CONN *conn, LX_XID fid, const unsigned short int *str, int slen, LX_TEXTDIRECTION *dirp, int *ascp, int *dscp, LX_CHARINFO *overallp) Issues a QueryTextExtents request to determine the metrics for a string when drawn in a particular font. fid is the font ID (or a GC ID, in which case the GC's current font is used). str is the string, of length slen; as a convenience, if slen is -1 for lx_QueryTextExtents8, strlen(str) is used in its stead (lx_QueryTextExtents16 has nothing similar). The returned values are written through dirp (the font's draw-direction hint), ascp (the font's ascent value), dscp (the font's descent value), and overallp (the metrics for the string), at some point after entry to lx_QueryTextExtents8 or lx_QueryTextExtents16 and before the returned LX_OP completes. lx_QueryTextExtents8 is limited to 8-bit characters, with only the low 256 characters in the font accessible. lx_QueryTextExtents16 can access all 65536 possible characters. (X fonts cannot support more than 65536 characters in a font.) For lx_QueryTextExtents16, slen is in characters, not bytes. lx_QueryTree ------------ LX_OP *lx_QueryTree(LX_CONN *conn, LX_XID win, LX_XID *rootp, LX_XID *parentp, LX_XIDLIST **kidsp) Issues a QueryTree request for win. The returned information is written through rootp, parentp, and/or kidsp at some point after entry to lx_QueryTree and before the returned LX_OP completes. See also the lx_XIDlist_* functions. Any of rootp, parentp, and/or kidsp may be nil, in which case the corresponding information is not returned. lx_RecolorCursor, lx_RecolorCursor_rgb ---------------- -------------------- void lx_RecolorCursor(LX_CONN *conn, LX_XID curs, int fr, int fg, int fb, int br, int bg, int bb) void lx_RecolorCursor_rgb(LX_CONN *conn, LX_XID curs, LX_RGB frgb, LX_RGB brgb) Issues a RecolorCursor request, which changes curs's colours. The new foreground colour is (fr,fg,fb) for lx_RecolorCursor or frgb for lx_RecolorCursor_rgb; similarly, the background is (br,bg,bb) or brgb. If the cursor is being displayed on its screen, the change is visible as soon as the request is handled. lx_ReparentWindow ----------------- void lx_ReparentWindow(LX_CONN *conn, LX_XID win, LX_XID newparent, int x, int y) Issues a ReparentWindow request, reparenting win so its new parent is newparent. x and y specify its position in the new parent (given as the upper-left corner of the outside of the window's border). lx_SendEvent ------------ void lx_SendEvent(LX_CONN *conn, LX_XID dst, int prop, unsigned int mask, const LX_EVENT *ev) Issues a SendEvent request. This causes the server to send the event on to the client that created dst (or, if dst is LX_WINDOW_PointerWindow or LX_WINDOW_InputFocus, a window determined dynamically from the pointer position or the inpout focus). (prop, here, stands for `propagate', not `property'.) lx_SetClipRectangles -------------------- void lx_SetClipRectangles(LX_CONN *conn, LX_XID gc, int xo, int yo, int nr, const LX_RECTANGLE *rv, LX_RECTORDER ro) Issues a SetClipRectangles request. This changes gc's clip-mask, but specifies it as a list of rectangles rather than as a pixmap. See gc for more. lx_SetDashes ------------ void lx_SetDashes(LX_CONN *conn, LX_XID gc, int offset, int ndash, const unsigned char *dashes) Issues a SetDashes request, changing the dash settings for a GC. This is like using lx_ChangeGC_* to modify the dash settings, except it offers more flexibility. See gc for more. lx_SetFontPath -------------- void lx_SetFontPath(LX_CONN *conn, int nstrs, const char * const *strs) Issues a SetFontPath request, resetting the font search path. The font path consists of a sequence of zero or more strings; in this API, they are NUL-terminated strings, passed as an array via strs, with nstrs giving the number of them. (If nstrs is zero, strs is not used.) The interpretation of these strings is server-dependent, but typically they are directories which fonts are sought for in. One side effect of this operation is that the server is required to flush all cached information it may have about fonts which currently have no explicit resource IDs associated with them. lx_SetInputFocus ---------------- void lx_SetInputFocus(LX_CONN *conn, LX_XID fwin, LX_XID revto, LX_TIME ts) Issues a SetInputFocus request, to set the keyboard focus. fwin is the focus window, LX_FOCUS_PointerRoot, or LX_FOCUS_None; revto is the revert-to setting and can be LX_FOCUS_None, LX_FOCUS_PointerRoot, or LX_FOCUS_Parent. ts is a timestamp, used to resolve races. lx_SetSelectionOwner -------------------- void lx_SetSelectionOwner(LX_CONN *conn, LX_ATOM sel, LX_XID win, LX_TIME ts) Issues a SetSelectionOwner request. sel is the selection, win is the new owner window (or LX_WINDOW_None for no owner), and ts is the timestamp (or LX_TIME_CurrentTime). lx_StoreColors -------------- void lx_StoreColors(LX_CONN *conn, LX_XID cmap, int nc, const LX_RGBPF *cv) Issues a StoreColors request to change the RGB entries for colormap cells in cmap. The request attempts to change nc colormap cells, where the cells themselves, and the values to store in them, are pointed to by cv. All the changes requested which do not produce errors take place, even if one or more of the requested changes produces an error. Each change takes the form of an LX_RGBPF, which consists of r, g, and b values (each in the usual 0-65535 range), a pixel value, and flag bits indicating which of the three primaries are to have their values actually changed. The flag bits use the LX_DO_R, LX_DO_G, and LX_DO_B bits; as a convenience, LX_DO_ALL is defined to be all three bits. If the colormap is installed for its screen, the changes take effect as soon as the request is processed by the server. A Value error results if a pixel value is not a valid colormap cell index for cmap. An Access error results from an attempt to modify a colormap cell which is read-only or unallocated. If more than one change produces an error, which one gets reported is arbitrary. lx_StoreNamedColor ------------------ void lx_StoreNamedColor(LX_CONN *conn, LX_XID cmap, unsigned int pix, const char *name, int namelen, unsigned int doflags) Issues a StoreNamedColor request for cmap. This looks up the named color with respect to cmap's screen and then does the equivalent of a StoreColors, storing the resulting values into colormap cell pix with flags doflags. name and namelen are the color name; the protocol document says that this name "should use the ISO Latin-1 encoding, and uppercase and lowercase do not matter", but is silent on what happens if this `should' is violated. A Name error results if the name is not recognized by the server; Access and Value errors can occur as described for StoreColors (see lx_StoreColors) for the effective single-cell store. lx_TranslateCoordinates ----------------------- LX_OP *lx_TranslateCoordinates(LX_CONN *conn, LX_XID srcwin, LX_XID dstwin, int sx, int sy, int *samescreenp, int *dxp, int *dyp, LX_XID *childp) Issues a TranslateCoordinates request, to translate a location (sx,sy) relative to srcwin into a location relative to dstwin. If srcwin and dstwin are on different screens, *samescreenp is written with zero and *dxp, *dup, and *childp may or may not be written through; if they are, the values written are undefined. If srcwin and dstwin are on the same screen, *samescreenp is written with a nonzero value and the coordinates relative to dstwin are written through *dxp and *dyp. If the location is within a mapped child of dstwin, *childp is written with that child; otherwise, it is written with LX_WINDOW_None. The writes happen at some point after entry to lx_TranslateCoordinates and before the returned LX_OP completes. lx_UngrabButton --------------- void lx_UngrabButton(LX_CONN *conn, int btn, unsigned int mods, LX_XID grabwin) Issues an UngrabButton request, revoking any passive grab (see lx_GrabButton) by this client with the same button, modifiers, and grab window. lx_UngrabKey ------------ void lx_UngrabKey(LX_CONN *conn, unsigned int kc, unsigned int mods, LX_XID grabwin) Issues an UngrabKey request, revoking any passive grab (see lx_GrabKey) by this client with the same keycode, modifiers, and grab window. lx_UngrabKeyboard ----------------- void lx_UngrabKeyboard(LX_CONN *conn, LX_TIME ts) Issues an UngrabKeyboard request with timestamp ts, releasing any keyboard grab by this client. lx_UngrabPointer ---------------- void lx_UngrabPointer(LX_CONN *conn, LX_TIME ts) Issues an UngrabPointer request with timestamp ts, releasing any pointer grab by this client. lx_UngrabServer --------------- void lx_UngrabServer(LX_CONN *conn) Issues an UngrabServer request, releasing the server after an lx_GrabServer. lx_UninstallColormap -------------------- void lx_UninstallColormap(LX_CONN *conn, LX_XID cm) Issues an UninstallColormap request, removing cm from the required list for its screen, if it's there (see lx_InstallColormap for a discussion of the required list). This may lead to various colormaps being installed or uninstalled on the screen; except that the required list must remain installed, which ones get installed or uninstalled is server-dependent. Whenever a colormap actually gets installed or uninstalled, a ColormapNotify event is generated on every window whose colormap it is. lx_UnmapSubwindows ------------------ void lx_UnmapSubwindows(LX_CONN *conn, LX_XID win) Issues an UnmapSubwindows request for win, unmapping all its subwindows. This is (usually) more efficient than unmapping the subwindows individually, because some of the work needs to be done only once. lx_UnmapWindow -------------- void lx_UnmapWindow(LX_CONN *conn, LX_XID win) Issues an UnmapWindow request for win. lx_WarpPointer -------------- void lx_WarpPointer(LX_CONN *conn, LX_XID srcwin, LX_XID dstwin, int srcx, int srcy, int srcw, int srch, int dstx, int dsty) Issues a WarpPointer request, to moves the pointer. If dstwin is LX_WINDOW_None, the pointer is moved by deltas (dstx,dsty) relative to its current position. Otherwise, the pointer is moved to absolute position (dstx,dsty) relative to dstwin's origin. If srcwin is LX_WINDOW_None, the move always happens, if srcwin is not None, it must be a window, and the move happens only if the pointer is within the rectangle defined by srcx, srcy, srcw, and srch relative to srcwin's origin. If srcw is zero, it is replaced with srcwin's width minus srcx; if srch is zero, it is replaced with srcwin's height minus srcy. All effects that confine the pointer (such as active pointer grabs) still apply. // 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 // mapping must point to num unsigned chars extern void lx_SetPointerMapping(LX_CONN *, int, const unsigned char *); // 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 // keycodesp must point to 8*num LX_KeyCodes extern void lx_SetModifierMapping(LX_CONN *, int, const LX_KEYCODE *); // 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 *);