aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-14 15:37:02 +0100
committermarha <marha@users.sourceforge.net>2013-01-14 15:37:02 +0100
commit7fbec6dbb6e061fe5b8c592dd602cf4b4c65155a (patch)
treedd2308d9cfdd45694f5c70aa7246ffe75a336ba5
parentc67a0f76ca34e441a817a7cdf261f496f3b3f2d6 (diff)
downloadvcxsrv-7fbec6dbb6e061fe5b8c592dd602cf4b4c65155a.tar.gz
vcxsrv-7fbec6dbb6e061fe5b8c592dd602cf4b4c65155a.tar.bz2
vcxsrv-7fbec6dbb6e061fe5b8c592dd602cf4b4c65155a.zip
Synchronised files
-rw-r--r--X11/Xcms.h1618
-rw-r--r--X11/Xdmcp.h362
-rw-r--r--X11/Xlib.h12
-rw-r--r--X11/Xlibint.h2756
-rw-r--r--X11/Xutil.h1664
-rw-r--r--xorg-server/glx/glprocs.h18
6 files changed, 3236 insertions, 3194 deletions
diff --git a/X11/Xcms.h b/X11/Xcms.h
index 327fdc1f7..663185410 100644
--- a/X11/Xcms.h
+++ b/X11/Xcms.h
@@ -1,803 +1,815 @@
-
-/*
- * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
- * All Rights Reserved
- *
- * This file is a component of an X Window System-specific implementation
- * of Xcms based on the TekColor Color Management System. Permission is
- * hereby granted to use, copy, modify, sell, and otherwise distribute this
- * software and its documentation for any purpose and without fee, provided
- * that this copyright, permission, and disclaimer notice is reproduced in
- * all copies of this software and in supporting documentation. TekColor
- * is a trademark of Tektronix, Inc.
- *
- * Tektronix makes no representation about the suitability of this software
- * for any purpose. It is provided "as is" and with all faults.
- *
- * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
- * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
- *
- *
- * DESCRIPTION
- * Public include file for X Color Management System
- */
-#ifndef _X11_XCMS_H_
-#define _X11_XCMS_H_
-
-#include <X11/Xlib.h>
-
- /*
- * XCMS Status Values
- */
-#define XcmsFailure 0
-#define XcmsSuccess 1
-#define XcmsSuccessWithCompression 2
-
- /*
- * Color Space Format ID's
- * Color Space ID's are of XcmsColorFormat type.
- *
- * bit 31
- * 0 == Device-Independent
- * 1 == Device-Dependent
- *
- * bit 30:
- * 0 == Registered with X Consortium
- * 1 == Unregistered
- */
-#define XcmsUndefinedFormat (XcmsColorFormat)0x00000000
-#define XcmsCIEXYZFormat (XcmsColorFormat)0x00000001
-#define XcmsCIEuvYFormat (XcmsColorFormat)0x00000002
-#define XcmsCIExyYFormat (XcmsColorFormat)0x00000003
-#define XcmsCIELabFormat (XcmsColorFormat)0x00000004
-#define XcmsCIELuvFormat (XcmsColorFormat)0x00000005
-#define XcmsTekHVCFormat (XcmsColorFormat)0x00000006
-#define XcmsRGBFormat (XcmsColorFormat)0x80000000
-#define XcmsRGBiFormat (XcmsColorFormat)0x80000001
-
- /*
- * State of XcmsPerScrnInfo
- */
-#define XcmsInitNone 0x00 /* no initialization attempted */
-#define XcmsInitSuccess 0x01 /* initialization successful */
-#define XcmsInitFailure 0xff /* failure, use defaults */
-
-#define DisplayOfCCC(ccc) ((ccc)->dpy)
-#define ScreenNumberOfCCC(ccc) ((ccc)->screenNumber)
-#define VisualOfCCC(ccc) ((ccc)->visual)
-#define ClientWhitePointOfCCC(ccc) (&(ccc)->clientWhitePt)
-#define ScreenWhitePointOfCCC(ccc) (&(ccc)->pPerScrnInfo->screenWhitePt)
-#define FunctionSetOfCCC(ccc) ((ccc)->pPerScrnInfo->functionSet)
-
-typedef unsigned long XcmsColorFormat; /* Color Space Format ID */
-
-typedef double XcmsFloat;
-
- /*
- * Device RGB
- */
-typedef struct {
- unsigned short red; /* scaled from 0x0000 to 0xffff */
- unsigned short green; /* scaled from 0x0000 to 0xffff */
- unsigned short blue; /* scaled from 0x0000 to 0xffff */
-} XcmsRGB;
-
- /*
- * RGB Intensity
- */
-typedef struct {
- XcmsFloat red; /* 0.0 - 1.0 */
- XcmsFloat green; /* 0.0 - 1.0 */
- XcmsFloat blue; /* 0.0 - 1.0 */
-} XcmsRGBi;
-
- /*
- * CIE XYZ
- */
-typedef struct {
- XcmsFloat X;
- XcmsFloat Y;
- XcmsFloat Z;
-} XcmsCIEXYZ;
-
- /*
- * CIE u'v'Y
- */
-typedef struct {
- XcmsFloat u_prime; /* 0.0 - 1.0 */
- XcmsFloat v_prime; /* 0.0 - 1.0 */
- XcmsFloat Y; /* 0.0 - 1.0 */
-} XcmsCIEuvY;
-
- /*
- * CIE xyY
- */
-typedef struct {
- XcmsFloat x; /* 0.0 - 1.0 */
- XcmsFloat y; /* 0.0 - 1.0 */
- XcmsFloat Y; /* 0.0 - 1.0 */
-} XcmsCIExyY;
-
- /*
- * CIE L*a*b*
- */
-typedef struct {
- XcmsFloat L_star; /* 0.0 - 100.0 */
- XcmsFloat a_star;
- XcmsFloat b_star;
-} XcmsCIELab;
-
- /*
- * CIE L*u*v*
- */
-typedef struct {
- XcmsFloat L_star; /* 0.0 - 100.0 */
- XcmsFloat u_star;
- XcmsFloat v_star;
-} XcmsCIELuv;
-
- /*
- * TekHVC
- */
-typedef struct {
- XcmsFloat H; /* 0.0 - 360.0 */
- XcmsFloat V; /* 0.0 - 100.0 */
- XcmsFloat C; /* 0.0 - 100.0 */
-} XcmsTekHVC;
-
- /*
- * PAD
- */
-typedef struct {
- XcmsFloat pad0;
- XcmsFloat pad1;
- XcmsFloat pad2;
- XcmsFloat pad3;
-} XcmsPad;
-
-
- /*
- * XCMS Color Structure
- */
-typedef struct {
- union {
- XcmsRGB RGB;
- XcmsRGBi RGBi;
- XcmsCIEXYZ CIEXYZ;
- XcmsCIEuvY CIEuvY;
- XcmsCIExyY CIExyY;
- XcmsCIELab CIELab;
- XcmsCIELuv CIELuv;
- XcmsTekHVC TekHVC;
- XcmsPad Pad;
- } spec; /* the color specification */
- unsigned long pixel; /* pixel value (as needed) */
- XcmsColorFormat format; /* the specification format */
-} XcmsColor;
-
-
- /*
- * XCMS Per Screen related data
- */
-
-typedef struct _XcmsPerScrnInfo {
- XcmsColor screenWhitePt; /* Screen White point */
- XPointer functionSet; /* pointer to Screen Color Characterization */
- /* Function Set structure */
- XPointer screenData; /* pointer to corresponding Screen Color*/
- /* Characterization Data */
- unsigned char state; /* XcmsInitNone, XcmsInitSuccess, XcmsInitFailure */
- char pad[3];
-} XcmsPerScrnInfo;
-
-typedef struct _XcmsCCC *XcmsCCC;
-
-typedef Status (*XcmsCompressionProc)( /* Gamut Compression Proc */
- XcmsCCC /* ccc */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- unsigned int /* index */,
- Bool* /* compression_flags_return */
-);
-
-typedef Status (*XcmsWhiteAdjustProc)( /* White Point Adjust Proc */
- XcmsCCC /* ccc */,
- XcmsColor* /* initial_white_point*/,
- XcmsColor* /* target_white_point*/,
- XcmsColorFormat /* target_format */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- Bool* /* compression_flags_return */
-);
-
- /*
- * XCMS Color Conversion Context
- */
-typedef struct _XcmsCCC {
- Display *dpy; /* X Display */
- int screenNumber; /* X screen number */
- Visual *visual; /* X Visual */
- XcmsColor clientWhitePt; /* Client White Point */
- XcmsCompressionProc gamutCompProc; /* Gamut Compression Function */
- XPointer gamutCompClientData; /* Gamut Comp Func Client Data */
- XcmsWhiteAdjustProc whitePtAdjProc; /* White Point Adjustment Function */
- XPointer whitePtAdjClientData; /* White Pt Adj Func Client Data */
- XcmsPerScrnInfo *pPerScrnInfo; /* pointer to per screen information */
- /* associated with the above display */
- /* screenNumber */
-} XcmsCCCRec;
-
-typedef Status (*XcmsScreenInitProc)( /* Screen Initialization Proc */
- Display* /* dpy */,
- int /* screen_number */,
- XcmsPerScrnInfo* /* screen_info */
-);
-
-typedef void (*XcmsScreenFreeProc)(
- XPointer /* screenData */
-);
-
- /*
- * Function List Pointer -- pointer to an array of function pointers.
- * The end of list is indicated by a NULL pointer.
- */
-/*
- * XXX: The use of the XcmsConversionProc type is broken. The
- * device-independent colour conversion code uses it as:
-
-typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, XcmsColor *,
- unsigned int);
-
- * while the device-dependent code uses it as:
-
-typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, unsigned int,
- Bool *);
-
- * Until this is reworked, it's probably best to leave it unprotoized.
- * The code works regardless.
- */
-typedef Status (*XcmsDDConversionProc)( /* using device-dependent version */
- XcmsCCC /* ccc */,
- XcmsColor* /* pcolors_in_out */,
- unsigned int /* ncolors */,
- Bool* /* pCompressed */
- );
-
-typedef Status (*XcmsDIConversionProc)( /* using device-independent version */
- XcmsCCC /* ccc */,
- XcmsColor* /* white_point */,
- XcmsColor* /* pcolors_in_out */,
- unsigned int /* ncolors */
- );
-
-typedef XcmsDIConversionProc XcmsConversionProc;
-typedef XcmsConversionProc *XcmsFuncListPtr;
-
-typedef int (*XcmsParseStringProc)( /* Color String Parsing Proc */
- char* /* color_string */,
- XcmsColor* /* color_return */
-);
-
- /*
- * Color Space -- per Color Space related data (Device-Independent
- * or Device-Dependent)
- */
-typedef struct _XcmsColorSpace {
- const char *prefix; /* Prefix of string format. */
- XcmsColorFormat id; /* Format ID number. */
- XcmsParseStringProc parseString;
- /* String format parsing function */
- XcmsFuncListPtr to_CIEXYZ; /* Pointer to an array of function */
- /* pointers such that when the */
- /* functions are executed in sequence */
- /* will convert a XcmsColor structure */
- /* from this color space to CIEXYZ */
- /* space. */
- XcmsFuncListPtr from_CIEXYZ;/* Pointer to an array of function */
- /* pointers such that when the */
- /* functions are executed in sequence */
- /* will convert a XcmsColor structure */
- /* from CIEXYZ space to this color */
- /* space. */
- int inverse_flag; /* If 1, indicates that for 0 <= i < n */
- /* where n is the number of function */
- /* pointers in the lists to_CIEXYZ */
- /* and from_CIEXYZ; for each function */
- /* to_CIEXYZ[i] its inverse function */
- /* is from_CIEXYZ[n - i]. */
-
-} XcmsColorSpace;
-
- /*
- * Screen Color Characterization Function Set -- per device class
- * color space conversion functions.
- */
-typedef struct _XcmsFunctionSet {
- XcmsColorSpace **DDColorSpaces;
- /* Pointer to an array of pointers to */
- /* Device-DEPENDENT color spaces */
- /* understood by this SCCFuncSet. */
- XcmsScreenInitProc screenInitProc;
- /* Screen initialization function that */
- /* reads Screen Color Characterization*/
- /* Data off properties on the screen's*/
- /* root window. */
- XcmsScreenFreeProc screenFreeProc;
- /* Function that frees the SCCData */
- /* structures. */
-} XcmsFunctionSet;
-
-_XFUNCPROTOBEGIN
-
-extern Status XcmsAddColorSpace (
- XcmsColorSpace* /* pColorSpace */
-);
-
-extern Status XcmsAddFunctionSet (
- XcmsFunctionSet* /* functionSet */
-);
-
-extern Status XcmsAllocColor (
- Display* /* dpy */,
- Colormap /* colormap */,
- XcmsColor* /* color_in_out */,
- XcmsColorFormat /* result_format */
-);
-
-extern Status XcmsAllocNamedColor (
- Display* /* dpy */,
- Colormap /* colormap */,
- _Xconst char* /* color_string */,
- XcmsColor* /* color_scrn_return */,
- XcmsColor* /* color_exact_return */,
- XcmsColorFormat /* result_format */
-);
-
-extern XcmsCCC XcmsCCCOfColormap (
- Display* /* dpy */,
- Colormap /* colormap */
-);
-
-extern Status XcmsCIELabClipab(
- XcmsCCC /* ccc */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- unsigned int /* index */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsCIELabClipL(
- XcmsCCC /* ccc */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- unsigned int /* index */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsCIELabClipLab(
- XcmsCCC /* ccc */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- unsigned int /* index */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsCIELabQueryMaxC (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue_angle */,
- XcmsFloat /* L_star */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsCIELabQueryMaxL (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue_angle */,
- XcmsFloat /* chroma */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsCIELabQueryMaxLC (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue_angle */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsCIELabQueryMinL (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue_angle */,
- XcmsFloat /* chroma */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsCIELabToCIEXYZ (
- XcmsCCC /* ccc */,
- XcmsColor* /* white_point */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */
-);
-
-extern Status XcmsCIELabWhiteShiftColors(
- XcmsCCC /* ccc */,
- XcmsColor* /* initial_white_point*/,
- XcmsColor* /* target_white_point*/,
- XcmsColorFormat /* target_format */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsCIELuvClipL(
- XcmsCCC /* ccc */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- unsigned int /* index */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsCIELuvClipLuv(
- XcmsCCC /* ccc */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- unsigned int /* index */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsCIELuvClipuv(
- XcmsCCC /* ccc */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- unsigned int /* index */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsCIELuvQueryMaxC (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue_angle */,
- XcmsFloat /* L_star */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsCIELuvQueryMaxL (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue_angle */,
- XcmsFloat /* chroma */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsCIELuvQueryMaxLC (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue_angle */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsCIELuvQueryMinL (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue_angle */,
- XcmsFloat /* chroma */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsCIELuvToCIEuvY (
- XcmsCCC /* ccc */,
- XcmsColor* /* white_point */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */
-);
-
-extern Status XcmsCIELuvWhiteShiftColors(
- XcmsCCC /* ccc */,
- XcmsColor* /* initial_white_point*/,
- XcmsColor* /* target_white_point*/,
- XcmsColorFormat /* target_format */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsCIEXYZToCIELab (
- XcmsCCC /* ccc */,
- XcmsColor* /* white_point */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */
-);
-
-extern Status XcmsCIEXYZToCIEuvY (
- XcmsCCC /* ccc */,
- XcmsColor* /* white_point */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */
-);
-
-extern Status XcmsCIEXYZToCIExyY (
- XcmsCCC /* ccc */,
- XcmsColor* /* white_point */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */
-);
-
-extern Status XcmsCIEXYZToRGBi (
- XcmsCCC /* ccc */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsCIEuvYToCIELuv (
- XcmsCCC /* ccc */,
- XcmsColor* /* white_point */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */
-);
-
-extern Status XcmsCIEuvYToCIEXYZ (
- XcmsCCC /* ccc */,
- XcmsColor* /* white_point */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */
-);
-
-extern Status XcmsCIEuvYToTekHVC (
- XcmsCCC /* ccc */,
- XcmsColor* /* white_point */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */
-);
-
-extern Status XcmsCIExyYToCIEXYZ (
- XcmsCCC /* ccc */,
- XcmsColor* /* white_point */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */
-);
-
-extern XcmsColor *XcmsClientWhitePointOfCCC (
- XcmsCCC /* ccc */
-);
-
-extern Status XcmsConvertColors (
- XcmsCCC /* ccc */,
- XcmsColor* /* colorArry_in_out */,
- unsigned int /* nColors */,
- XcmsColorFormat /* targetFormat */,
- Bool* /* compArry_return */
-);
-
-extern XcmsCCC XcmsCreateCCC (
- Display* /* dpy */,
- int /* screenNumber */,
- Visual* /* visual */,
- XcmsColor* /* clientWhitePt */,
- XcmsCompressionProc /* gamutCompProc */,
- XPointer /* gamutCompClientData */,
- XcmsWhiteAdjustProc /* whitePtAdjProc */,
- XPointer /* whitePtAdjClientData */
-);
-
-extern XcmsCCC XcmsDefaultCCC (
- Display* /* dpy */,
- int /* screenNumber */
-);
-
-extern Display *XcmsDisplayOfCCC (
- XcmsCCC /* ccc */
-);
-
-extern XcmsColorFormat XcmsFormatOfPrefix (
- char* /* prefix */
-);
-
-extern void XcmsFreeCCC (
- XcmsCCC /* ccc */
-);
-
-extern Status XcmsLookupColor (
- Display* /* dpy */,
- Colormap /* colormap */,
- _Xconst char* /* color_string */,
- XcmsColor* /* pColor_exact_in_out */,
- XcmsColor* /* pColor_scrn_in_out */,
- XcmsColorFormat /* result_format */
-);
-
-extern char *XcmsPrefixOfFormat (
- XcmsColorFormat /* id */
-);
-
-extern Status XcmsQueryBlack (
- XcmsCCC /* ccc */,
- XcmsColorFormat /* target_format */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsQueryBlue (
- XcmsCCC /* ccc */,
- XcmsColorFormat /* target_format */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsQueryColor (
- Display* /* dpy */,
- Colormap /* colormap */,
- XcmsColor* /* pColor_in_out */,
- XcmsColorFormat /* result_format */
-);
-
-extern Status XcmsQueryColors (
- Display* /* dpy */,
- Colormap /* colormap */,
- XcmsColor* /* colorArry_in_out */,
- unsigned int /* nColors */,
- XcmsColorFormat /* result_format */
-);
-
-extern Status XcmsQueryGreen (
- XcmsCCC /* ccc */,
- XcmsColorFormat /* target_format */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsQueryRed (
- XcmsCCC /* ccc */,
- XcmsColorFormat /* target_format */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsQueryWhite (
- XcmsCCC /* ccc */,
- XcmsColorFormat /* target_format */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsRGBiToCIEXYZ (
- XcmsCCC /* ccc */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsRGBiToRGB (
- XcmsCCC /* ccc */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsRGBToRGBi (
- XcmsCCC /* ccc */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */,
- Bool* /* compression_flags_return */
-);
-
-extern int XcmsScreenNumberOfCCC (
- XcmsCCC /* ccc */
-);
-
-extern XcmsColor *XcmsScreenWhitePointOfCCC (
- XcmsCCC /* ccc */
-);
-
-extern XcmsCCC XcmsSetCCCOfColormap(
- Display* /* dpy */,
- Colormap /* colormap */,
- XcmsCCC /* ccc */
-);
-
-extern XcmsCompressionProc XcmsSetCompressionProc (
- XcmsCCC /* ccc */,
- XcmsCompressionProc /* compression_proc */,
- XPointer /* client_data */
-);
-
-extern XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc (
- XcmsCCC /* ccc */,
- XcmsWhiteAdjustProc /* white_adjust_proc */,
- XPointer /* client_data */
-);
-
-extern Status XcmsSetWhitePoint (
- XcmsCCC /* ccc */,
- XcmsColor* /* color */
-);
-
-extern Status XcmsStoreColor (
- Display* /* dpy */,
- Colormap /* colormap */,
- XcmsColor* /* pColor_in */
-);
-
-extern Status XcmsStoreColors (
- Display* /* dpy */,
- Colormap /* colormap */,
- XcmsColor* /* colorArry_in */,
- unsigned int /* nColors */,
- Bool* /* compArry_return */
-);
-
-extern Status XcmsTekHVCClipC(
- XcmsCCC /* ccc */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- unsigned int /* index */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsTekHVCClipV(
- XcmsCCC /* ccc */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- unsigned int /* index */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsTekHVCClipVC(
- XcmsCCC /* ccc */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- unsigned int /* index */,
- Bool* /* compression_flags_return */
-);
-
-extern Status XcmsTekHVCQueryMaxC (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue */,
- XcmsFloat /* value */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsTekHVCQueryMaxV (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue */,
- XcmsFloat /* chroma */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsTekHVCQueryMaxVC (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsTekHVCQueryMaxVSamples (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue */,
- XcmsColor* /* colors_return */,
- unsigned int /* nsamples */
-);
-
-extern Status XcmsTekHVCQueryMinV (
- XcmsCCC /* ccc */,
- XcmsFloat /* hue */,
- XcmsFloat /* chroma */,
- XcmsColor* /* color_return */
-);
-
-extern Status XcmsTekHVCToCIEuvY (
- XcmsCCC /* ccc */,
- XcmsColor* /* white_point */,
- XcmsColor* /* colors */,
- unsigned int /* ncolors */
-);
-
-extern Status XcmsTekHVCWhiteShiftColors(
- XcmsCCC /* ccc */,
- XcmsColor* /* initial_white_point*/,
- XcmsColor* /* target_white_point*/,
- XcmsColorFormat /* target_format */,
- XcmsColor* /* colors_in_out */,
- unsigned int /* ncolors */,
- Bool* /* compression_flags_return */
-);
-
-extern Visual *XcmsVisualOfCCC (
- XcmsCCC /* ccc */
-);
-
-_XFUNCPROTOEND
-
-#endif /* _X11_XCMS_H_ */
+
+/*
+ * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
+ * All Rights Reserved
+ *
+ * This file is a component of an X Window System-specific implementation
+ * of Xcms based on the TekColor Color Management System. Permission is
+ * hereby granted to use, copy, modify, sell, and otherwise distribute this
+ * software and its documentation for any purpose and without fee, provided
+ * that this copyright, permission, and disclaimer notice is reproduced in
+ * all copies of this software and in supporting documentation. TekColor
+ * is a trademark of Tektronix, Inc.
+ *
+ * Tektronix makes no representation about the suitability of this software
+ * for any purpose. It is provided "as is" and with all faults.
+ *
+ * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
+ * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
+ *
+ *
+ * DESCRIPTION
+ * Public include file for X Color Management System
+ */
+#ifndef _X11_XCMS_H_
+#define _X11_XCMS_H_
+
+#include <X11/Xlib.h>
+
+/* The Xcms structs are full of implicit padding to properly align members.
+ We can't clean that up without breaking ABI, so tell clang not to bother
+ complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+ /*
+ * XCMS Status Values
+ */
+#define XcmsFailure 0
+#define XcmsSuccess 1
+#define XcmsSuccessWithCompression 2
+
+ /*
+ * Color Space Format ID's
+ * Color Space ID's are of XcmsColorFormat type.
+ *
+ * bit 31
+ * 0 == Device-Independent
+ * 1 == Device-Dependent
+ *
+ * bit 30:
+ * 0 == Registered with X Consortium
+ * 1 == Unregistered
+ */
+#define XcmsUndefinedFormat (XcmsColorFormat)0x00000000
+#define XcmsCIEXYZFormat (XcmsColorFormat)0x00000001
+#define XcmsCIEuvYFormat (XcmsColorFormat)0x00000002
+#define XcmsCIExyYFormat (XcmsColorFormat)0x00000003
+#define XcmsCIELabFormat (XcmsColorFormat)0x00000004
+#define XcmsCIELuvFormat (XcmsColorFormat)0x00000005
+#define XcmsTekHVCFormat (XcmsColorFormat)0x00000006
+#define XcmsRGBFormat (XcmsColorFormat)0x80000000
+#define XcmsRGBiFormat (XcmsColorFormat)0x80000001
+
+ /*
+ * State of XcmsPerScrnInfo
+ */
+#define XcmsInitNone 0x00 /* no initialization attempted */
+#define XcmsInitSuccess 0x01 /* initialization successful */
+#define XcmsInitFailure 0xff /* failure, use defaults */
+
+#define DisplayOfCCC(ccc) ((ccc)->dpy)
+#define ScreenNumberOfCCC(ccc) ((ccc)->screenNumber)
+#define VisualOfCCC(ccc) ((ccc)->visual)
+#define ClientWhitePointOfCCC(ccc) (&(ccc)->clientWhitePt)
+#define ScreenWhitePointOfCCC(ccc) (&(ccc)->pPerScrnInfo->screenWhitePt)
+#define FunctionSetOfCCC(ccc) ((ccc)->pPerScrnInfo->functionSet)
+
+typedef unsigned long XcmsColorFormat; /* Color Space Format ID */
+
+typedef double XcmsFloat;
+
+ /*
+ * Device RGB
+ */
+typedef struct {
+ unsigned short red; /* scaled from 0x0000 to 0xffff */
+ unsigned short green; /* scaled from 0x0000 to 0xffff */
+ unsigned short blue; /* scaled from 0x0000 to 0xffff */
+} XcmsRGB;
+
+ /*
+ * RGB Intensity
+ */
+typedef struct {
+ XcmsFloat red; /* 0.0 - 1.0 */
+ XcmsFloat green; /* 0.0 - 1.0 */
+ XcmsFloat blue; /* 0.0 - 1.0 */
+} XcmsRGBi;
+
+ /*
+ * CIE XYZ
+ */
+typedef struct {
+ XcmsFloat X;
+ XcmsFloat Y;
+ XcmsFloat Z;
+} XcmsCIEXYZ;
+
+ /*
+ * CIE u'v'Y
+ */
+typedef struct {
+ XcmsFloat u_prime; /* 0.0 - 1.0 */
+ XcmsFloat v_prime; /* 0.0 - 1.0 */
+ XcmsFloat Y; /* 0.0 - 1.0 */
+} XcmsCIEuvY;
+
+ /*
+ * CIE xyY
+ */
+typedef struct {
+ XcmsFloat x; /* 0.0 - 1.0 */
+ XcmsFloat y; /* 0.0 - 1.0 */
+ XcmsFloat Y; /* 0.0 - 1.0 */
+} XcmsCIExyY;
+
+ /*
+ * CIE L*a*b*
+ */
+typedef struct {
+ XcmsFloat L_star; /* 0.0 - 100.0 */
+ XcmsFloat a_star;
+ XcmsFloat b_star;
+} XcmsCIELab;
+
+ /*
+ * CIE L*u*v*
+ */
+typedef struct {
+ XcmsFloat L_star; /* 0.0 - 100.0 */
+ XcmsFloat u_star;
+ XcmsFloat v_star;
+} XcmsCIELuv;
+
+ /*
+ * TekHVC
+ */
+typedef struct {
+ XcmsFloat H; /* 0.0 - 360.0 */
+ XcmsFloat V; /* 0.0 - 100.0 */
+ XcmsFloat C; /* 0.0 - 100.0 */
+} XcmsTekHVC;
+
+ /*
+ * PAD
+ */
+typedef struct {
+ XcmsFloat pad0;
+ XcmsFloat pad1;
+ XcmsFloat pad2;
+ XcmsFloat pad3;
+} XcmsPad;
+
+
+ /*
+ * XCMS Color Structure
+ */
+typedef struct {
+ union {
+ XcmsRGB RGB;
+ XcmsRGBi RGBi;
+ XcmsCIEXYZ CIEXYZ;
+ XcmsCIEuvY CIEuvY;
+ XcmsCIExyY CIExyY;
+ XcmsCIELab CIELab;
+ XcmsCIELuv CIELuv;
+ XcmsTekHVC TekHVC;
+ XcmsPad Pad;
+ } spec; /* the color specification */
+ unsigned long pixel; /* pixel value (as needed) */
+ XcmsColorFormat format; /* the specification format */
+} XcmsColor;
+
+
+ /*
+ * XCMS Per Screen related data
+ */
+
+typedef struct _XcmsPerScrnInfo {
+ XcmsColor screenWhitePt; /* Screen White point */
+ XPointer functionSet; /* pointer to Screen Color Characterization */
+ /* Function Set structure */
+ XPointer screenData; /* pointer to corresponding Screen Color*/
+ /* Characterization Data */
+ unsigned char state; /* XcmsInitNone, XcmsInitSuccess, XcmsInitFailure */
+ char pad[3];
+} XcmsPerScrnInfo;
+
+typedef struct _XcmsCCC *XcmsCCC;
+
+typedef Status (*XcmsCompressionProc)( /* Gamut Compression Proc */
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ unsigned int /* index */,
+ Bool* /* compression_flags_return */
+);
+
+typedef Status (*XcmsWhiteAdjustProc)( /* White Point Adjust Proc */
+ XcmsCCC /* ccc */,
+ XcmsColor* /* initial_white_point*/,
+ XcmsColor* /* target_white_point*/,
+ XcmsColorFormat /* target_format */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ Bool* /* compression_flags_return */
+);
+
+ /*
+ * XCMS Color Conversion Context
+ */
+typedef struct _XcmsCCC {
+ Display *dpy; /* X Display */
+ int screenNumber; /* X screen number */
+ Visual *visual; /* X Visual */
+ XcmsColor clientWhitePt; /* Client White Point */
+ XcmsCompressionProc gamutCompProc; /* Gamut Compression Function */
+ XPointer gamutCompClientData; /* Gamut Comp Func Client Data */
+ XcmsWhiteAdjustProc whitePtAdjProc; /* White Point Adjustment Function */
+ XPointer whitePtAdjClientData; /* White Pt Adj Func Client Data */
+ XcmsPerScrnInfo *pPerScrnInfo; /* pointer to per screen information */
+ /* associated with the above display */
+ /* screenNumber */
+} XcmsCCCRec;
+
+typedef Status (*XcmsScreenInitProc)( /* Screen Initialization Proc */
+ Display* /* dpy */,
+ int /* screen_number */,
+ XcmsPerScrnInfo* /* screen_info */
+);
+
+typedef void (*XcmsScreenFreeProc)(
+ XPointer /* screenData */
+);
+
+ /*
+ * Function List Pointer -- pointer to an array of function pointers.
+ * The end of list is indicated by a NULL pointer.
+ */
+/*
+ * XXX: The use of the XcmsConversionProc type is broken. The
+ * device-independent colour conversion code uses it as:
+
+typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, XcmsColor *,
+ unsigned int);
+
+ * while the device-dependent code uses it as:
+
+typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, unsigned int,
+ Bool *);
+
+ * Until this is reworked, it's probably best to leave it unprotoized.
+ * The code works regardless.
+ */
+typedef Status (*XcmsDDConversionProc)( /* using device-dependent version */
+ XcmsCCC /* ccc */,
+ XcmsColor* /* pcolors_in_out */,
+ unsigned int /* ncolors */,
+ Bool* /* pCompressed */
+ );
+
+typedef Status (*XcmsDIConversionProc)( /* using device-independent version */
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* pcolors_in_out */,
+ unsigned int /* ncolors */
+ );
+
+typedef XcmsDIConversionProc XcmsConversionProc;
+typedef XcmsConversionProc *XcmsFuncListPtr;
+
+typedef int (*XcmsParseStringProc)( /* Color String Parsing Proc */
+ char* /* color_string */,
+ XcmsColor* /* color_return */
+);
+
+ /*
+ * Color Space -- per Color Space related data (Device-Independent
+ * or Device-Dependent)
+ */
+typedef struct _XcmsColorSpace {
+ const char *prefix; /* Prefix of string format. */
+ XcmsColorFormat id; /* Format ID number. */
+ XcmsParseStringProc parseString;
+ /* String format parsing function */
+ XcmsFuncListPtr to_CIEXYZ; /* Pointer to an array of function */
+ /* pointers such that when the */
+ /* functions are executed in sequence */
+ /* will convert a XcmsColor structure */
+ /* from this color space to CIEXYZ */
+ /* space. */
+ XcmsFuncListPtr from_CIEXYZ;/* Pointer to an array of function */
+ /* pointers such that when the */
+ /* functions are executed in sequence */
+ /* will convert a XcmsColor structure */
+ /* from CIEXYZ space to this color */
+ /* space. */
+ int inverse_flag; /* If 1, indicates that for 0 <= i < n */
+ /* where n is the number of function */
+ /* pointers in the lists to_CIEXYZ */
+ /* and from_CIEXYZ; for each function */
+ /* to_CIEXYZ[i] its inverse function */
+ /* is from_CIEXYZ[n - i]. */
+
+} XcmsColorSpace;
+
+ /*
+ * Screen Color Characterization Function Set -- per device class
+ * color space conversion functions.
+ */
+typedef struct _XcmsFunctionSet {
+ XcmsColorSpace **DDColorSpaces;
+ /* Pointer to an array of pointers to */
+ /* Device-DEPENDENT color spaces */
+ /* understood by this SCCFuncSet. */
+ XcmsScreenInitProc screenInitProc;
+ /* Screen initialization function that */
+ /* reads Screen Color Characterization*/
+ /* Data off properties on the screen's*/
+ /* root window. */
+ XcmsScreenFreeProc screenFreeProc;
+ /* Function that frees the SCCData */
+ /* structures. */
+} XcmsFunctionSet;
+
+_XFUNCPROTOBEGIN
+
+extern Status XcmsAddColorSpace (
+ XcmsColorSpace* /* pColorSpace */
+);
+
+extern Status XcmsAddFunctionSet (
+ XcmsFunctionSet* /* functionSet */
+);
+
+extern Status XcmsAllocColor (
+ Display* /* dpy */,
+ Colormap /* colormap */,
+ XcmsColor* /* color_in_out */,
+ XcmsColorFormat /* result_format */
+);
+
+extern Status XcmsAllocNamedColor (
+ Display* /* dpy */,
+ Colormap /* colormap */,
+ _Xconst char* /* color_string */,
+ XcmsColor* /* color_scrn_return */,
+ XcmsColor* /* color_exact_return */,
+ XcmsColorFormat /* result_format */
+);
+
+extern XcmsCCC XcmsCCCOfColormap (
+ Display* /* dpy */,
+ Colormap /* colormap */
+);
+
+extern Status XcmsCIELabClipab(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ unsigned int /* index */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsCIELabClipL(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ unsigned int /* index */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsCIELabClipLab(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ unsigned int /* index */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsCIELabQueryMaxC (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue_angle */,
+ XcmsFloat /* L_star */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsCIELabQueryMaxL (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue_angle */,
+ XcmsFloat /* chroma */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsCIELabQueryMaxLC (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue_angle */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsCIELabQueryMinL (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue_angle */,
+ XcmsFloat /* chroma */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsCIELabToCIEXYZ (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+);
+
+extern Status XcmsCIELabWhiteShiftColors(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* initial_white_point*/,
+ XcmsColor* /* target_white_point*/,
+ XcmsColorFormat /* target_format */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsCIELuvClipL(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ unsigned int /* index */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsCIELuvClipLuv(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ unsigned int /* index */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsCIELuvClipuv(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ unsigned int /* index */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsCIELuvQueryMaxC (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue_angle */,
+ XcmsFloat /* L_star */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsCIELuvQueryMaxL (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue_angle */,
+ XcmsFloat /* chroma */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsCIELuvQueryMaxLC (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue_angle */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsCIELuvQueryMinL (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue_angle */,
+ XcmsFloat /* chroma */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsCIELuvToCIEuvY (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+);
+
+extern Status XcmsCIELuvWhiteShiftColors(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* initial_white_point*/,
+ XcmsColor* /* target_white_point*/,
+ XcmsColorFormat /* target_format */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsCIEXYZToCIELab (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+);
+
+extern Status XcmsCIEXYZToCIEuvY (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+);
+
+extern Status XcmsCIEXYZToCIExyY (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+);
+
+extern Status XcmsCIEXYZToRGBi (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsCIEuvYToCIELuv (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+);
+
+extern Status XcmsCIEuvYToCIEXYZ (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+);
+
+extern Status XcmsCIEuvYToTekHVC (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+);
+
+extern Status XcmsCIExyYToCIEXYZ (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+);
+
+extern XcmsColor *XcmsClientWhitePointOfCCC (
+ XcmsCCC /* ccc */
+);
+
+extern Status XcmsConvertColors (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colorArry_in_out */,
+ unsigned int /* nColors */,
+ XcmsColorFormat /* targetFormat */,
+ Bool* /* compArry_return */
+);
+
+extern XcmsCCC XcmsCreateCCC (
+ Display* /* dpy */,
+ int /* screenNumber */,
+ Visual* /* visual */,
+ XcmsColor* /* clientWhitePt */,
+ XcmsCompressionProc /* gamutCompProc */,
+ XPointer /* gamutCompClientData */,
+ XcmsWhiteAdjustProc /* whitePtAdjProc */,
+ XPointer /* whitePtAdjClientData */
+);
+
+extern XcmsCCC XcmsDefaultCCC (
+ Display* /* dpy */,
+ int /* screenNumber */
+);
+
+extern Display *XcmsDisplayOfCCC (
+ XcmsCCC /* ccc */
+);
+
+extern XcmsColorFormat XcmsFormatOfPrefix (
+ char* /* prefix */
+);
+
+extern void XcmsFreeCCC (
+ XcmsCCC /* ccc */
+);
+
+extern Status XcmsLookupColor (
+ Display* /* dpy */,
+ Colormap /* colormap */,
+ _Xconst char* /* color_string */,
+ XcmsColor* /* pColor_exact_in_out */,
+ XcmsColor* /* pColor_scrn_in_out */,
+ XcmsColorFormat /* result_format */
+);
+
+extern char *XcmsPrefixOfFormat (
+ XcmsColorFormat /* id */
+);
+
+extern Status XcmsQueryBlack (
+ XcmsCCC /* ccc */,
+ XcmsColorFormat /* target_format */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsQueryBlue (
+ XcmsCCC /* ccc */,
+ XcmsColorFormat /* target_format */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsQueryColor (
+ Display* /* dpy */,
+ Colormap /* colormap */,
+ XcmsColor* /* pColor_in_out */,
+ XcmsColorFormat /* result_format */
+);
+
+extern Status XcmsQueryColors (
+ Display* /* dpy */,
+ Colormap /* colormap */,
+ XcmsColor* /* colorArry_in_out */,
+ unsigned int /* nColors */,
+ XcmsColorFormat /* result_format */
+);
+
+extern Status XcmsQueryGreen (
+ XcmsCCC /* ccc */,
+ XcmsColorFormat /* target_format */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsQueryRed (
+ XcmsCCC /* ccc */,
+ XcmsColorFormat /* target_format */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsQueryWhite (
+ XcmsCCC /* ccc */,
+ XcmsColorFormat /* target_format */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsRGBiToCIEXYZ (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsRGBiToRGB (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsRGBToRGBi (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */,
+ Bool* /* compression_flags_return */
+);
+
+extern int XcmsScreenNumberOfCCC (
+ XcmsCCC /* ccc */
+);
+
+extern XcmsColor *XcmsScreenWhitePointOfCCC (
+ XcmsCCC /* ccc */
+);
+
+extern XcmsCCC XcmsSetCCCOfColormap(
+ Display* /* dpy */,
+ Colormap /* colormap */,
+ XcmsCCC /* ccc */
+);
+
+extern XcmsCompressionProc XcmsSetCompressionProc (
+ XcmsCCC /* ccc */,
+ XcmsCompressionProc /* compression_proc */,
+ XPointer /* client_data */
+);
+
+extern XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc (
+ XcmsCCC /* ccc */,
+ XcmsWhiteAdjustProc /* white_adjust_proc */,
+ XPointer /* client_data */
+);
+
+extern Status XcmsSetWhitePoint (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* color */
+);
+
+extern Status XcmsStoreColor (
+ Display* /* dpy */,
+ Colormap /* colormap */,
+ XcmsColor* /* pColor_in */
+);
+
+extern Status XcmsStoreColors (
+ Display* /* dpy */,
+ Colormap /* colormap */,
+ XcmsColor* /* colorArry_in */,
+ unsigned int /* nColors */,
+ Bool* /* compArry_return */
+);
+
+extern Status XcmsTekHVCClipC(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ unsigned int /* index */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsTekHVCClipV(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ unsigned int /* index */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsTekHVCClipVC(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ unsigned int /* index */,
+ Bool* /* compression_flags_return */
+);
+
+extern Status XcmsTekHVCQueryMaxC (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue */,
+ XcmsFloat /* value */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsTekHVCQueryMaxV (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue */,
+ XcmsFloat /* chroma */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsTekHVCQueryMaxVC (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsTekHVCQueryMaxVSamples (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue */,
+ XcmsColor* /* colors_return */,
+ unsigned int /* nsamples */
+);
+
+extern Status XcmsTekHVCQueryMinV (
+ XcmsCCC /* ccc */,
+ XcmsFloat /* hue */,
+ XcmsFloat /* chroma */,
+ XcmsColor* /* color_return */
+);
+
+extern Status XcmsTekHVCToCIEuvY (
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+);
+
+extern Status XcmsTekHVCWhiteShiftColors(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* initial_white_point*/,
+ XcmsColor* /* target_white_point*/,
+ XcmsColorFormat /* target_format */,
+ XcmsColor* /* colors_in_out */,
+ unsigned int /* ncolors */,
+ Bool* /* compression_flags_return */
+);
+
+extern Visual *XcmsVisualOfCCC (
+ XcmsCCC /* ccc */
+);
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XCMS_H_ */
diff --git a/X11/Xdmcp.h b/X11/Xdmcp.h
index 7148c7afb..0b531de78 100644
--- a/X11/Xdmcp.h
+++ b/X11/Xdmcp.h
@@ -1,181 +1,181 @@
-/*
- * Copyright 1989 Network Computing Devices, Inc., Mountain View, California.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of N.C.D. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. N.C.D. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- */
-
-#ifndef _XDMCP_H_
-#define _XDMCP_H_
-
-#include <X11/Xmd.h>
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-#define XDM_PROTOCOL_VERSION 1
-#define XDM_UDP_PORT 177
-
-/* IANA has assigned FF0X:0:0:0:0:0:0:12B as the permanently assigned
- * multicast addresses for XDMCP, where X in the prefix may be replaced
- * by any valid scope identifier, such as 1 for Node-Local, 2 for Link-Local,
- * 5 for Site-Local, and so on. We set the default here to the Link-Local
- * version to most closely match the old IPv4 subnet broadcast behavior.
- * Both xdm and X -query allow specifying a different address if a different
- * scope is defined.
- */
-#define XDM_DEFAULT_MCAST_ADDR6 "ff02:0:0:0:0:0:0:12b"
-
-#define XDM_MAX_MSGLEN 8192
-#define XDM_MIN_RTX 2
-#define XDM_MAX_RTX 32
-#define XDM_RTX_LIMIT 7
-#define XDM_KA_RTX_LIMIT 4
-#define XDM_DEF_DORMANCY (3 * 60) /* 3 minutes */
-#define XDM_MAX_DORMANCY (24 * 60 * 60) /* 24 hours */
-
-typedef enum {
- BROADCAST_QUERY = 1, QUERY, INDIRECT_QUERY, FORWARD_QUERY,
- WILLING, UNWILLING, REQUEST, ACCEPT, DECLINE, MANAGE, REFUSE,
- FAILED, KEEPALIVE, ALIVE
-} xdmOpCode;
-
-typedef enum {
- XDM_QUERY, XDM_BROADCAST, XDM_INDIRECT, XDM_COLLECT_QUERY,
- XDM_COLLECT_BROADCAST_QUERY, XDM_COLLECT_INDIRECT_QUERY,
- XDM_START_CONNECTION, XDM_AWAIT_REQUEST_RESPONSE,
- XDM_AWAIT_MANAGE_RESPONSE, XDM_MANAGE, XDM_RUN_SESSION, XDM_OFF,
- XDM_AWAIT_USER_INPUT, XDM_KEEPALIVE, XDM_AWAIT_ALIVE_RESPONSE,
-#if defined(IPv6) && defined(AF_INET6)
- XDM_MULTICAST, XDM_COLLECT_MULTICAST_QUERY,
-#endif
- XDM_KEEP_ME_LAST
-} xdmcp_states;
-
-#ifdef NOTDEF
-/* table of hosts */
-
-#define XDM_MAX_STR_LEN 21
-#define XDM_MAX_HOSTS 20
-struct xdm_host_table {
- struct sockaddr_in sockaddr;
- char name[XDM_MAX_STR_LEN];
- char status[XDM_MAX_STR_LEN];
-};
-#endif /* NOTDEF */
-
-typedef CARD8 *CARD8Ptr;
-typedef CARD16 *CARD16Ptr;
-typedef CARD32 *CARD32Ptr;
-
-typedef struct _ARRAY8 {
- CARD16 length;
- CARD8Ptr data;
-} ARRAY8, *ARRAY8Ptr;
-
-typedef struct _ARRAY16 {
- CARD8 length;
- CARD16Ptr data;
-} ARRAY16, *ARRAY16Ptr;
-
-typedef struct _ARRAY32 {
- CARD8 length;
- CARD32Ptr data;
-} ARRAY32, *ARRAY32Ptr;
-
-typedef struct _ARRAYofARRAY8 {
- CARD8 length;
- ARRAY8Ptr data;
-} ARRAYofARRAY8, *ARRAYofARRAY8Ptr;
-
-typedef struct _XdmcpHeader {
- CARD16 version, opcode, length;
-} XdmcpHeader, *XdmcpHeaderPtr;
-
-typedef struct _XdmcpBuffer {
- BYTE *data;
- int size; /* size of buffer pointed by to data */
- int pointer; /* current index into data */
- int count; /* bytes read from network into data */
-} XdmcpBuffer, *XdmcpBufferPtr;
-
-typedef struct _XdmAuthKey {
- BYTE data[8];
-} XdmAuthKeyRec, *XdmAuthKeyPtr;
-
-
-/* implementation-independent network address structure.
- Equiv to sockaddr* for sockets and netbuf* for STREAMS. */
-
-typedef char *XdmcpNetaddr;
-
-extern int XdmcpWriteARRAY16(XdmcpBufferPtr buffer, const ARRAY16Ptr array);
-extern int XdmcpWriteARRAY32(XdmcpBufferPtr buffer, const ARRAY32Ptr array);
-extern int XdmcpWriteARRAY8(XdmcpBufferPtr buffer, const ARRAY8Ptr array);
-extern int XdmcpWriteARRAYofARRAY8(XdmcpBufferPtr buffer, const ARRAYofARRAY8Ptr array);
-extern int XdmcpWriteCARD16(XdmcpBufferPtr buffer, unsigned value);
-extern int XdmcpWriteCARD32(XdmcpBufferPtr buffer, unsigned value);
-extern int XdmcpWriteCARD8(XdmcpBufferPtr buffer, unsigned value);
-extern int XdmcpWriteHeader(XdmcpBufferPtr buffer, const XdmcpHeaderPtr header);
-
-extern int XdmcpFlush(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr to, int tolen);
-
-extern int XdmcpReadARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array);
-extern int XdmcpReadARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array);
-extern int XdmcpReadARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array);
-extern int XdmcpReadARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array);
-extern int XdmcpReadCARD16(XdmcpBufferPtr buffer, CARD16Ptr valuep);
-extern int XdmcpReadCARD32(XdmcpBufferPtr buffer, CARD32Ptr valuep);
-extern int XdmcpReadCARD8(XdmcpBufferPtr buffer, CARD8Ptr valuep);
-extern int XdmcpReadHeader(XdmcpBufferPtr buffer, XdmcpHeaderPtr header);
-
-extern int XdmcpFill(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen);
-
-extern int XdmcpReadRemaining(const XdmcpBufferPtr buffer);
-
-extern void XdmcpDisposeARRAY8(ARRAY8Ptr array);
-extern void XdmcpDisposeARRAY16(ARRAY16Ptr array);
-extern void XdmcpDisposeARRAY32(ARRAY32Ptr array);
-extern void XdmcpDisposeARRAYofARRAY8(ARRAYofARRAY8Ptr array);
-
-extern int XdmcpCopyARRAY8(const ARRAY8Ptr src, ARRAY8Ptr dst);
-
-extern int XdmcpARRAY8Equal(const ARRAY8Ptr array1, const ARRAY8Ptr array2);
-
-extern void XdmcpGenerateKey (XdmAuthKeyPtr key);
-extern void XdmcpIncrementKey (XdmAuthKeyPtr key);
-extern void XdmcpDecrementKey (XdmAuthKeyPtr key);
-#ifdef HASXDMAUTH
-extern void XdmcpWrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
-extern void XdmcpUnwrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-extern int XdmcpCompareKeys (const XdmAuthKeyPtr a, const XdmAuthKeyPtr b);
-
-extern int XdmcpAllocARRAY16 (ARRAY16Ptr array, int length);
-extern int XdmcpAllocARRAY32 (ARRAY32Ptr array, int length);
-extern int XdmcpAllocARRAY8 (ARRAY8Ptr array, int length);
-extern int XdmcpAllocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
-
-extern int XdmcpReallocARRAY16 (ARRAY16Ptr array, int length);
-extern int XdmcpReallocARRAY32 (ARRAY32Ptr array, int length);
-extern int XdmcpReallocARRAY8 (ARRAY8Ptr array, int length);
-extern int XdmcpReallocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
-
-_XFUNCPROTOEND
-
-#endif /* _XDMCP_H_ */
+/*
+ * Copyright 1989 Network Computing Devices, Inc., Mountain View, California.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of N.C.D. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. N.C.D. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ */
+
+#ifndef _XDMCP_H_
+#define _XDMCP_H_
+
+#include <X11/Xmd.h>
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+#define XDM_PROTOCOL_VERSION 1
+#define XDM_UDP_PORT 177
+
+/* IANA has assigned FF0X:0:0:0:0:0:0:12B as the permanently assigned
+ * multicast addresses for XDMCP, where X in the prefix may be replaced
+ * by any valid scope identifier, such as 1 for Node-Local, 2 for Link-Local,
+ * 5 for Site-Local, and so on. We set the default here to the Link-Local
+ * version to most closely match the old IPv4 subnet broadcast behavior.
+ * Both xdm and X -query allow specifying a different address if a different
+ * scope is defined.
+ */
+#define XDM_DEFAULT_MCAST_ADDR6 "ff02:0:0:0:0:0:0:12b"
+
+#define XDM_MAX_MSGLEN 8192
+#define XDM_MIN_RTX 2
+#define XDM_MAX_RTX 32
+#define XDM_RTX_LIMIT 7
+#define XDM_KA_RTX_LIMIT 4
+#define XDM_DEF_DORMANCY (3 * 60) /* 3 minutes */
+#define XDM_MAX_DORMANCY (24 * 60 * 60) /* 24 hours */
+
+typedef enum {
+ BROADCAST_QUERY = 1, QUERY, INDIRECT_QUERY, FORWARD_QUERY,
+ WILLING, UNWILLING, REQUEST, ACCEPT, DECLINE, MANAGE, REFUSE,
+ FAILED, KEEPALIVE, ALIVE
+} xdmOpCode;
+
+typedef enum {
+ XDM_QUERY, XDM_BROADCAST, XDM_INDIRECT, XDM_COLLECT_QUERY,
+ XDM_COLLECT_BROADCAST_QUERY, XDM_COLLECT_INDIRECT_QUERY,
+ XDM_START_CONNECTION, XDM_AWAIT_REQUEST_RESPONSE,
+ XDM_AWAIT_MANAGE_RESPONSE, XDM_MANAGE, XDM_RUN_SESSION, XDM_OFF,
+ XDM_AWAIT_USER_INPUT, XDM_KEEPALIVE, XDM_AWAIT_ALIVE_RESPONSE,
+#if defined(IPv6) && defined(AF_INET6)
+ XDM_MULTICAST, XDM_COLLECT_MULTICAST_QUERY,
+#endif
+ XDM_KEEP_ME_LAST
+} xdmcp_states;
+
+#ifdef NOTDEF
+/* table of hosts */
+
+#define XDM_MAX_STR_LEN 21
+#define XDM_MAX_HOSTS 20
+struct xdm_host_table {
+ struct sockaddr_in sockaddr;
+ char name[XDM_MAX_STR_LEN];
+ char status[XDM_MAX_STR_LEN];
+};
+#endif /* NOTDEF */
+
+typedef CARD8 *CARD8Ptr;
+typedef CARD16 *CARD16Ptr;
+typedef CARD32 *CARD32Ptr;
+
+typedef struct _ARRAY8 {
+ CARD16 length;
+ CARD8Ptr data;
+} ARRAY8, *ARRAY8Ptr;
+
+typedef struct _ARRAY16 {
+ CARD8 length;
+ CARD16Ptr data;
+} ARRAY16, *ARRAY16Ptr;
+
+typedef struct _ARRAY32 {
+ CARD8 length;
+ CARD32Ptr data;
+} ARRAY32, *ARRAY32Ptr;
+
+typedef struct _ARRAYofARRAY8 {
+ CARD8 length;
+ ARRAY8Ptr data;
+} ARRAYofARRAY8, *ARRAYofARRAY8Ptr;
+
+typedef struct _XdmcpHeader {
+ CARD16 version, opcode, length;
+} XdmcpHeader, *XdmcpHeaderPtr;
+
+typedef struct _XdmcpBuffer {
+ BYTE *data;
+ int size; /* size of buffer pointed by to data */
+ int pointer; /* current index into data */
+ int count; /* bytes read from network into data */
+} XdmcpBuffer, *XdmcpBufferPtr;
+
+typedef struct _XdmAuthKey {
+ BYTE data[8];
+} XdmAuthKeyRec, *XdmAuthKeyPtr;
+
+
+/* implementation-independent network address structure.
+ Equiv to sockaddr* for sockets. */
+
+typedef char *XdmcpNetaddr;
+
+extern int XdmcpWriteARRAY16(XdmcpBufferPtr buffer, const ARRAY16Ptr array);
+extern int XdmcpWriteARRAY32(XdmcpBufferPtr buffer, const ARRAY32Ptr array);
+extern int XdmcpWriteARRAY8(XdmcpBufferPtr buffer, const ARRAY8Ptr array);
+extern int XdmcpWriteARRAYofARRAY8(XdmcpBufferPtr buffer, const ARRAYofARRAY8Ptr array);
+extern int XdmcpWriteCARD16(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteCARD32(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteCARD8(XdmcpBufferPtr buffer, unsigned value);
+extern int XdmcpWriteHeader(XdmcpBufferPtr buffer, const XdmcpHeaderPtr header);
+
+extern int XdmcpFlush(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr to, int tolen);
+
+extern int XdmcpReadARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array);
+extern int XdmcpReadARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array);
+extern int XdmcpReadARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array);
+extern int XdmcpReadARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array);
+extern int XdmcpReadCARD16(XdmcpBufferPtr buffer, CARD16Ptr valuep);
+extern int XdmcpReadCARD32(XdmcpBufferPtr buffer, CARD32Ptr valuep);
+extern int XdmcpReadCARD8(XdmcpBufferPtr buffer, CARD8Ptr valuep);
+extern int XdmcpReadHeader(XdmcpBufferPtr buffer, XdmcpHeaderPtr header);
+
+extern int XdmcpFill(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen);
+
+extern int XdmcpReadRemaining(const XdmcpBufferPtr buffer);
+
+extern void XdmcpDisposeARRAY8(ARRAY8Ptr array);
+extern void XdmcpDisposeARRAY16(ARRAY16Ptr array);
+extern void XdmcpDisposeARRAY32(ARRAY32Ptr array);
+extern void XdmcpDisposeARRAYofARRAY8(ARRAYofARRAY8Ptr array);
+
+extern int XdmcpCopyARRAY8(const ARRAY8Ptr src, ARRAY8Ptr dst);
+
+extern int XdmcpARRAY8Equal(const ARRAY8Ptr array1, const ARRAY8Ptr array2);
+
+extern void XdmcpGenerateKey (XdmAuthKeyPtr key);
+extern void XdmcpIncrementKey (XdmAuthKeyPtr key);
+extern void XdmcpDecrementKey (XdmAuthKeyPtr key);
+#ifdef HASXDMAUTH
+extern void XdmcpWrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
+extern void XdmcpUnwrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes);
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+
+extern int XdmcpCompareKeys (const XdmAuthKeyPtr a, const XdmAuthKeyPtr b);
+
+extern int XdmcpAllocARRAY16 (ARRAY16Ptr array, int length);
+extern int XdmcpAllocARRAY32 (ARRAY32Ptr array, int length);
+extern int XdmcpAllocARRAY8 (ARRAY8Ptr array, int length);
+extern int XdmcpAllocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
+
+extern int XdmcpReallocARRAY16 (ARRAY16Ptr array, int length);
+extern int XdmcpReallocARRAY32 (ARRAY32Ptr array, int length);
+extern int XdmcpReallocARRAY8 (ARRAY8Ptr array, int length);
+extern int XdmcpReallocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length);
+
+_XFUNCPROTOEND
+
+#endif /* _XDMCP_H_ */
diff --git a/X11/Xlib.h b/X11/Xlib.h
index 3a73d7b83..112b85a94 100644
--- a/X11/Xlib.h
+++ b/X11/Xlib.h
@@ -81,6 +81,14 @@ _Xmblen(
November 2000. Its presence is indicated through the following macro. */
#define X_HAVE_UTF8_STRING 1
+/* The Xlib structs are full of implicit padding to properly align members.
+ We can't clean that up without breaking ABI, so tell clang not to bother
+ complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
typedef char *XPointer;
typedef int Bool;
@@ -4019,6 +4027,10 @@ extern void XFreeEventData(
XGenericEventCookie* /* cookie*/
);
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
_XFUNCPROTOEND
#endif /* _X11_XLIB_H_ */
diff --git a/X11/Xlibint.h b/X11/Xlibint.h
index 15b16f9fe..03856a671 100644
--- a/X11/Xlibint.h
+++ b/X11/Xlibint.h
@@ -1,1372 +1,1384 @@
-
-/*
-
-Copyright 1984, 1985, 1987, 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-#ifndef _X11_XLIBINT_H_
-#define _X11_XLIBINT_H_ 1
-
-/*
- * Xlibint.h - Header definition and support file for the internal
- * support routines used by the C subroutine interface
- * library (Xlib) to the X Window System.
- *
- * Warning, there be dragons here....
- */
-
-#include <X11/Xlib.h>
-#include <X11/Xproto.h> /* to declare xEvent */
-#include <X11/XlibConf.h> /* for configured options like XTHREADS */
-
-#ifdef WIN32
-#define _XFlush _XFlushIt
-#endif
-
-/*
- * If your BytesReadable correctly detects broken connections, then
- * you should NOT define XCONN_CHECK_FREQ.
- */
-#ifndef XCONN_CHECK_FREQ
-#define XCONN_CHECK_FREQ 256
-#endif
-
-struct _XGC
-{
- XExtData *ext_data; /* hook for extension to hang data */
- GContext gid; /* protocol ID for graphics context */
- Bool rects; /* boolean: TRUE if clipmask is list of rectangles */
- Bool dashes; /* boolean: TRUE if dash-list is really a list */
- unsigned long dirty;/* cache dirty bits */
- XGCValues values; /* shadow structure of values */
-};
-
-struct _XDisplay
-{
- XExtData *ext_data; /* hook for extension to hang data */
- struct _XFreeFuncs *free_funcs; /* internal free functions */
- int fd; /* Network socket. */
- int conn_checker; /* ugly thing used by _XEventsQueued */
- int proto_major_version;/* maj. version of server's X protocol */
- int proto_minor_version;/* minor version of server's X protocol */
- char *vendor; /* vendor of the server hardware */
- XID resource_base; /* resource ID base */
- XID resource_mask; /* resource ID mask bits */
- XID resource_id; /* allocator current ID */
- int resource_shift; /* allocator shift to correct bits */
- XID (*resource_alloc)( /* allocator function */
- struct _XDisplay*
- );
- int byte_order; /* screen byte order, LSBFirst, MSBFirst */
- int bitmap_unit; /* padding and data requirements */
- int bitmap_pad; /* padding requirements on bitmaps */
- int bitmap_bit_order; /* LeastSignificant or MostSignificant */
- int nformats; /* number of pixmap formats in list */
- ScreenFormat *pixmap_format; /* pixmap format list */
- int vnumber; /* Xlib's X protocol version number. */
- int release; /* release of the server */
- struct _XSQEvent *head, *tail; /* Input event queue. */
- int qlen; /* Length of input event queue */
- unsigned long last_request_read; /* seq number of last event read */
- unsigned long request; /* sequence number of last request. */
- char *last_req; /* beginning of last request, or dummy */
- char *buffer; /* Output buffer starting address. */
- char *bufptr; /* Output buffer index pointer. */
- char *bufmax; /* Output buffer maximum+1 address. */
- unsigned max_request_size; /* maximum number 32 bit words in request*/
- struct _XrmHashBucketRec *db;
- int (*synchandler)( /* Synchronization handler */
- struct _XDisplay*
- );
- char *display_name; /* "host:display" string used on this connect*/
- int default_screen; /* default screen for operations */
- int nscreens; /* number of screens on this server*/
- Screen *screens; /* pointer to list of screens */
- unsigned long motion_buffer; /* size of motion buffer */
- volatile unsigned long flags; /* internal connection flags */
- int min_keycode; /* minimum defined keycode */
- int max_keycode; /* maximum defined keycode */
- KeySym *keysyms; /* This server's keysyms */
- XModifierKeymap *modifiermap; /* This server's modifier keymap */
- int keysyms_per_keycode;/* number of rows */
- char *xdefaults; /* contents of defaults from server */
- char *scratch_buffer; /* place to hang scratch buffer */
- unsigned long scratch_length; /* length of scratch buffer */
- int ext_number; /* extension number on this display */
- struct _XExten *ext_procs; /* extensions initialized on this display */
- /*
- * the following can be fixed size, as the protocol defines how
- * much address space is available.
- * While this could be done using the extension vector, there
- * may be MANY events processed, so a search through the extension
- * list to find the right procedure for each event might be
- * expensive if many extensions are being used.
- */
- Bool (*event_vec[128])( /* vector for wire to event */
- Display * /* dpy */,
- XEvent * /* re */,
- xEvent * /* event */
- );
- Status (*wire_vec[128])( /* vector for event to wire */
- Display * /* dpy */,
- XEvent * /* re */,
- xEvent * /* event */
- );
- KeySym lock_meaning; /* for XLookupString */
- struct _XLockInfo *lock; /* multi-thread state, display lock */
- struct _XInternalAsync *async_handlers; /* for internal async */
- unsigned long bigreq_size; /* max size of big requests */
- struct _XLockPtrs *lock_fns; /* pointers to threads functions */
- void (*idlist_alloc)( /* XID list allocator function */
- Display * /* dpy */,
- XID * /* ids */,
- int /* count */
- );
- /* things above this line should not move, for binary compatibility */
- struct _XKeytrans *key_bindings; /* for XLookupString */
- Font cursor_font; /* for XCreateFontCursor */
- struct _XDisplayAtoms *atoms; /* for XInternAtom */
- unsigned int mode_switch; /* keyboard group modifiers */
- unsigned int num_lock; /* keyboard numlock modifiers */
- struct _XContextDB *context_db; /* context database */
- Bool (**error_vec)( /* vector for wire to error */
- Display * /* display */,
- XErrorEvent * /* he */,
- xError * /* we */
- );
- /*
- * Xcms information
- */
- struct {
- XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */
- XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */
- XPointer perVisualIntensityMaps;
- /* linked list of XcmsIntensityMap */
- } cms;
- struct _XIMFilter *im_filters;
- struct _XSQEvent *qfree; /* unallocated event queue elements */
- unsigned long next_event_serial_num; /* inserted into next queue elt */
- struct _XExten *flushes; /* Flush hooks */
- struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */
- int im_fd_length; /* number of im_fd_info */
- struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */
- int watcher_count; /* number of conn_watchers */
- XPointer filedes; /* struct pollfd cache for _XWaitForReadable */
- int (*savedsynchandler)( /* user synchandler when Xlib usurps */
- Display * /* dpy */
- );
- XID resource_max; /* allocator max ID */
- int xcmisc_opcode; /* major opcode for XC-MISC */
- struct _XkbInfoRec *xkb_info; /* XKB info */
- struct _XtransConnInfo *trans_conn; /* transport connection object */
- struct _X11XCBPrivate *xcb; /* XCB glue private data */
-
- /* Generic event cookie handling */
- unsigned int next_cookie; /* next event cookie */
- /* vector for wire to generic event, index is (extension - 128) */
- Bool (*generic_event_vec[128])(
- Display * /* dpy */,
- XGenericEventCookie * /* Xlib event */,
- xEvent * /* wire event */);
- /* vector for event copy, index is (extension - 128) */
- Bool (*generic_event_copy_vec[128])(
- Display * /* dpy */,
- XGenericEventCookie * /* in */,
- XGenericEventCookie * /* out*/);
- void *cookiejar; /* cookie events returned but not claimed */
-};
-
-#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
-
-/*
- * define the following if you want the Data macro to be a procedure instead
- */
-#ifdef CRAY
-#define DataRoutineIsProcedure
-#endif /* CRAY */
-
-#ifndef _XEVENT_
-/*
- * _QEvent datatype for use in input queueing.
- */
-typedef struct _XSQEvent
-{
- struct _XSQEvent *next;
- XEvent event;
- unsigned long qserial_num; /* so multi-threaded code can find new ones */
-} _XQEvent;
-#endif
-
-#include <X11/Xproto.h>
-#ifdef __sgi
-#define _SGI_MP_SOURCE /* turn this on to get MP safe errno */
-#endif
-#include <errno.h>
-#define _XBCOPYFUNC _Xbcopy
-#include <X11/Xfuncs.h>
-#include <X11/Xosdefs.h>
-
-/* Utek leaves kernel macros around in include files (bleah) */
-#ifdef dirty
-#undef dirty
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-/*
- * The following definitions can be used for locking requests in multi-threaded
- * address spaces.
- */
-#ifdef XTHREADS
-/* Author: Stephen Gildea, MIT X Consortium
- *
- * declarations for C Threads locking
- */
-
-typedef struct _LockInfoRec *LockInfoPtr;
-
-/* interfaces for locking.c */
-struct _XLockPtrs {
- /* used by all, including extensions; do not move */
- void (*lock_display)(
- Display *dpy
-#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
- , char *file
- , int line
-#endif
- );
- void (*unlock_display)(
- Display *dpy
-#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
- , char *file
- , int line
-#endif
- );
-};
-
-#ifdef WIN32
-#ifdef LIB11_DLL
-#define X11_EXTERN __declspec(dllexport) extern
-#else
-#define X11_EXTERN __declspec(dllimport) extern
-#endif
-#else
-#define X11_EXTERN extern
-#endif
-
-
-/* in XlibInt.c */
-X11_EXTERN void (*_XCreateMutex_fn)(
- LockInfoPtr /* lock */
-);
-X11_EXTERN void (*_XFreeMutex_fn)(
- LockInfoPtr /* lock */
-);
-X11_EXTERN void (*_XLockMutex_fn)(
- LockInfoPtr /* lock */
-#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
- , char * /* file */
- , int /* line */
-#endif
-);
-X11_EXTERN void (*_XUnlockMutex_fn)(
- LockInfoPtr /* lock */
-#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
- , char * /* file */
- , int /* line */
-#endif
-);
-
-X11_EXTERN LockInfoPtr _Xglobal_lock;
-
-#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
-#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__)
-#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__)
-#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__)
-#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__)
-#else
-/* used everywhere, so must be fast if not using threads */
-#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d)
-#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d)
-#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock)
-#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock)
-#endif
-#define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock);
-#define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock);
-
-#else /* XTHREADS */
-#define LockDisplay(dis)
-#define _XLockMutex(lock)
-#define _XUnlockMutex(lock)
-#define UnlockDisplay(dis)
-#define _XCreateMutex(lock)
-#define _XFreeMutex(lock)
-#endif
-
-#define Xfree(ptr) free((ptr))
-
-/*
- * Note that some machines do not return a valid pointer for malloc(0), in
- * which case we provide an alternate under the control of the
- * define MALLOC_0_RETURNS_NULL. This is necessary because some
- * Xlib code expects malloc(0) to return a valid pointer to storage.
- */
-#if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__)
-
-# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size)))
-# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size)))
-# define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize))
-
-#else
-
-# define Xmalloc(size) malloc((size))
-# define Xrealloc(ptr, size) realloc((ptr), (size))
-# define Xcalloc(nelem, elsize) calloc((nelem), (elsize))
-
-#endif
-
-#include <stddef.h>
-
-#define LOCKED 1
-#define UNLOCKED 0
-
-#ifndef BUFSIZE
-#define BUFSIZE 2048 /* X output buffer size. */
-#endif
-#ifndef PTSPERBATCH
-#define PTSPERBATCH 1024 /* point batching */
-#endif
-#ifndef WLNSPERBATCH
-#define WLNSPERBATCH 50 /* wide line batching */
-#endif
-#ifndef ZLNSPERBATCH
-#define ZLNSPERBATCH 1024 /* thin line batching */
-#endif
-#ifndef WRCTSPERBATCH
-#define WRCTSPERBATCH 10 /* wide line rectangle batching */
-#endif
-#ifndef ZRCTSPERBATCH
-#define ZRCTSPERBATCH 256 /* thin line rectangle batching */
-#endif
-#ifndef FRCTSPERBATCH
-#define FRCTSPERBATCH 256 /* filled rectangle batching */
-#endif
-#ifndef FARCSPERBATCH
-#define FARCSPERBATCH 256 /* filled arc batching */
-#endif
-#ifndef CURSORFONT
-#define CURSORFONT "cursor" /* standard cursor fonts */
-#endif
-
-/*
- * Display flags
- */
-#define XlibDisplayIOError (1L << 0)
-#define XlibDisplayClosing (1L << 1)
-#define XlibDisplayNoXkb (1L << 2)
-#define XlibDisplayPrivSync (1L << 3)
-#define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */
-#define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */
-#define XlibDisplayReply (1L << 5) /* in _XReply */
-#define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */
-#define XlibDisplayDfltRMDB (1L << 7) /* mark if RM db from XGetDefault */
-
-/*
- * X Protocol packetizing macros.
- */
-
-/* Need to start requests on 64 bit word boundaries
- * on a CRAY computer so add a NoOp (127) if needed.
- * A character pointer on a CRAY computer will be non-zero
- * after shifting right 61 bits of it is not pointing to
- * a word boundary.
- */
-#ifdef WORD64
-#define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\
- dpy->last_req = dpy->bufptr;\
- *(dpy->bufptr) = X_NoOperation;\
- *(dpy->bufptr+1) = 0;\
- *(dpy->bufptr+2) = 0;\
- *(dpy->bufptr+3) = 1;\
- dpy->request++;\
- dpy->bufptr += 4;\
- }
-#else /* else does not require alignment on 64-bit boundaries */
-#define WORD64ALIGN
-#endif /* WORD64 */
-
-/**
- * Return a len-sized request buffer for the request type. This function may
- * flush the output queue.
- *
- * @param dpy The display connection
- * @param type The request type
- * @param len Length of the request in bytes
- *
- * @returns A pointer to the request buffer with a few default values
- * initialized.
- */
-extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
-
-/* GetReqSized is the same as GetReq but allows the caller to specify the
- * size in bytes. 'sz' must be a multiple of 4! */
-
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define GetReqSized(name, sz, req) \
- req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz)
-#else
-#define GetReqSized(name, sz, req) \
- req = (x/**/name/**/Req *) _XGetRequest(dpy, X_/**/name, sz)
-#endif
-
-
-/*
- * GetReq - Get the next available X request packet in the buffer and
- * return it.
- *
- * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc.
- * "req" is the name of the request pointer.
- *
- */
-
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define GetReq(name, req) \
- GetReqSized(name, SIZEOF(x##name##Req), req)
-#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
-#define GetReq(name, req) \
- GetReqSized(name, SIZEOF(x/**/name/**/Req), req)
-#endif
-
-/* GetReqExtra is the same as GetReq, but allocates "n" additional
- bytes after the request. "n" must be a multiple of 4! */
-
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define GetReqExtra(name, n, req) \
- GetReqSized(name, SIZEOF(x##name##Req) + n, req)
-#else
-#define GetReqExtra(name, n, req) \
- GetReqSized(name, SIZEOF(x/**/name/**/Req) + n, req)
-#endif
-
-
-/*
- * GetResReq is for those requests that have a resource ID
- * (Window, Pixmap, GContext, etc.) as their single argument.
- * "rid" is the name of the resource.
- */
-
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define GetResReq(name, rid, req) \
- req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \
- req->id = (rid)
-#else
-#define GetResReq(name, rid, req) \
- req = (xResourceReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xResourceReq)); \
- req->id = (rid)
-#endif
-
-/*
- * GetEmptyReq is for those requests that have no arguments
- * at all.
- */
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define GetEmptyReq(name, req) \
- req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq))
-#else
-#define GetEmptyReq(name, req) \
- req = (xReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xReq))
-#endif
-
-#ifdef WORD64
-#define MakeBigReq(req,n) \
- { \
- char _BRdat[4]; \
- unsigned long _BRlen = req->length - 1; \
- req->length = 0; \
- memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \
- memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
- memcpy(((char *)req) + 4, _BRdat, 4); \
- Data32(dpy, (long *)&_BRdat, 4); \
- }
-#else
-#ifdef LONG64
-#define MakeBigReq(req,n) \
- { \
- CARD64 _BRdat; \
- CARD32 _BRlen = req->length - 1; \
- req->length = 0; \
- _BRdat = ((CARD32 *)req)[_BRlen]; \
- memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
- ((CARD32 *)req)[1] = _BRlen + n + 2; \
- Data32(dpy, &_BRdat, 4); \
- }
-#else
-#define MakeBigReq(req,n) \
- { \
- CARD32 _BRdat; \
- CARD32 _BRlen = req->length - 1; \
- req->length = 0; \
- _BRdat = ((CARD32 *)req)[_BRlen]; \
- memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
- ((CARD32 *)req)[1] = _BRlen + n + 2; \
- Data32(dpy, &_BRdat, 4); \
- }
-#endif
-#endif
-
-#ifndef __clang_analyzer__
-#define SetReqLen(req,n,badlen) \
- if ((req->length + n) > (unsigned)65535) { \
- if (dpy->bigreq_size) { \
- MakeBigReq(req,n) \
- } else { \
- n = badlen; \
- req->length += n; \
- } \
- } else \
- req->length += n
-#else
-#define SetReqLen(req,n,badlen) \
- req->length += n
-#endif
-
-#define SyncHandle() \
- if (dpy->synchandler) (*dpy->synchandler)(dpy)
-
-extern void _XFlushGCCache(Display *dpy, GC gc);
-#define FlushGC(dpy, gc) \
- if ((gc)->dirty) _XFlushGCCache((dpy), (gc))
-/*
- * Data - Place data in the buffer and pad the end to provide
- * 32 bit word alignment. Transmit if the buffer fills.
- *
- * "dpy" is a pointer to a Display.
- * "data" is a pinter to a data buffer.
- * "len" is the length of the data buffer.
- */
-#ifndef DataRoutineIsProcedure
-#define Data(dpy, data, len) {\
- if (dpy->bufptr + (len) <= dpy->bufmax) {\
- memcpy(dpy->bufptr, data, (int)len);\
- dpy->bufptr += ((len) + 3) & ~3;\
- } else\
- _XSend(dpy, data, len);\
- }
-#endif /* DataRoutineIsProcedure */
-
-
-/* Allocate bytes from the buffer. No padding is done, so if
- * the length is not a multiple of 4, the caller must be
- * careful to leave the buffer aligned after sending the
- * current request.
- *
- * "type" is the type of the pointer being assigned to.
- * "ptr" is the pointer being assigned to.
- * "n" is the number of bytes to allocate.
- *
- * Example:
- * xTextElt *elt;
- * BufAlloc (xTextElt *, elt, nbytes)
- */
-
-#define BufAlloc(type, ptr, n) \
- if (dpy->bufptr + (n) > dpy->bufmax) \
- _XFlush (dpy); \
- ptr = (type) dpy->bufptr; \
- memset(ptr, '\0', n); \
- dpy->bufptr += (n);
-
-#ifdef WORD64
-#define Data16(dpy, data, len) _XData16(dpy, (short *)data, len)
-#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
-#else
-#define Data16(dpy, data, len) Data((dpy), (char *)(data), (len))
-#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
-#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
-#ifdef LONG64
-#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
-extern int _XData32(
- Display *dpy,
- register long *data,
- unsigned len
-);
-extern void _XRead32(
- Display *dpy,
- register long *data,
- long len
-);
-#else
-#define Data32(dpy, data, len) Data((dpy), (char *)(data), (len))
-#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
-#endif
-#endif /* not WORD64 */
-
-#define PackData16(dpy,data,len) Data16 (dpy, data, len)
-#define PackData32(dpy,data,len) Data32 (dpy, data, len)
-
-/* Xlib manual is bogus */
-#define PackData(dpy,data,len) PackData16 (dpy, data, len)
-
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-
-#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
- (((cs)->rbearing|(cs)->lbearing| \
- (cs)->ascent|(cs)->descent) == 0))
-
-/*
- * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit
- * character. If the character is in the column and exists, then return the
- * appropriate metrics (note that fonts with common per-character metrics will
- * return min_bounds). If none of these hold true, try again with the default
- * char.
- */
-#define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \
-{ \
- cs = def; \
- if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
- if (fs->per_char == NULL) { \
- cs = &fs->min_bounds; \
- } else { \
- cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
- if (CI_NONEXISTCHAR(cs)) cs = def; \
- } \
- } \
-}
-
-#define CI_GET_DEFAULT_INFO_1D(fs,cs) \
- CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs)
-
-
-
-/*
- * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and
- * column. This is used for fonts that have more than row zero.
- */
-#define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \
-{ \
- cs = def; \
- if (row >= fs->min_byte1 && row <= fs->max_byte1 && \
- col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
- if (fs->per_char == NULL) { \
- cs = &fs->min_bounds; \
- } else { \
- cs = &fs->per_char[((row - fs->min_byte1) * \
- (fs->max_char_or_byte2 - \
- fs->min_char_or_byte2 + 1)) + \
- (col - fs->min_char_or_byte2)]; \
- if (CI_NONEXISTCHAR(cs)) cs = def; \
- } \
- } \
-}
-
-#define CI_GET_DEFAULT_INFO_2D(fs,cs) \
-{ \
- unsigned int r = (fs->default_char >> 8); \
- unsigned int c = (fs->default_char & 0xff); \
- CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \
-}
-
-
-#ifdef MUSTCOPY
-
-/* for when 32-bit alignment is not good enough */
-#define OneDataCard32(dpy,dstaddr,srcvar) \
- { dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); }
-
-#else
-
-/* srcvar must be a variable for large architecture version */
-#define OneDataCard32(dpy,dstaddr,srcvar) \
- { *(CARD32 *)(dstaddr) = (srcvar); }
-
-#endif /* MUSTCOPY */
-
-typedef struct _XInternalAsync {
- struct _XInternalAsync *next;
- /*
- * handler arguments:
- * rep is the generic reply that caused this handler
- * to be invoked. It must also be passed to _XGetAsyncReply.
- * buf and len are opaque values that must be passed to
- * _XGetAsyncReply or _XGetAsyncData.
- * data is the closure stored in this struct.
- * The handler returns True iff it handled this reply.
- */
- Bool (*handler)(
- Display* /* dpy */,
- xReply* /* rep */,
- char* /* buf */,
- int /* len */,
- XPointer /* data */
- );
- XPointer data;
-} _XAsyncHandler;
-
-typedef struct _XAsyncEState {
- unsigned long min_sequence_number;
- unsigned long max_sequence_number;
- unsigned char error_code;
- unsigned char major_opcode;
- unsigned short minor_opcode;
- unsigned char last_error_received;
- int error_count;
-} _XAsyncErrorState;
-
-extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler);
-#define DeqAsyncHandler(dpy,handler) { \
- if (dpy->async_handlers == (handler)) \
- dpy->async_handlers = (handler)->next; \
- else \
- _XDeqAsyncHandler(dpy, handler); \
- }
-
-typedef void (*FreeFuncType) (
- Display* /* display */
-);
-
-typedef int (*FreeModmapType) (
- XModifierKeymap* /* modmap */
-);
-
-/*
- * This structure is private to the library.
- */
-typedef struct _XFreeFuncs {
- FreeFuncType atoms; /* _XFreeAtomTable */
- FreeModmapType modifiermap; /* XFreeModifiermap */
- FreeFuncType key_bindings; /* _XFreeKeyBindings */
- FreeFuncType context_db; /* _XFreeContextDB */
- FreeFuncType defaultCCCs; /* _XcmsFreeDefaultCCCs */
- FreeFuncType clientCmaps; /* _XcmsFreeClientCmaps */
- FreeFuncType intensityMaps; /* _XcmsFreeIntensityMaps */
- FreeFuncType im_filters; /* _XFreeIMFilters */
- FreeFuncType xkb; /* _XkbFreeInfo */
-} _XFreeFuncRec;
-
-/* types for InitExt.c */
-typedef int (*CreateGCType) (
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-);
-
-typedef int (*CopyGCType)(
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-);
-
-typedef int (*FlushGCType) (
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-);
-
-typedef int (*FreeGCType) (
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-);
-
-typedef int (*CreateFontType) (
- Display* /* display */,
- XFontStruct* /* fs */,
- XExtCodes* /* codes */
-);
-
-typedef int (*FreeFontType) (
- Display* /* display */,
- XFontStruct* /* fs */,
- XExtCodes* /* codes */
-);
-
-typedef int (*CloseDisplayType) (
- Display* /* display */,
- XExtCodes* /* codes */
-);
-
-typedef int (*ErrorType) (
- Display* /* display */,
- xError* /* err */,
- XExtCodes* /* codes */,
- int* /* ret_code */
-);
-
-typedef char* (*ErrorStringType) (
- Display* /* display */,
- int /* code */,
- XExtCodes* /* codes */,
- char* /* buffer */,
- int /* nbytes */
-);
-
-typedef void (*PrintErrorType)(
- Display* /* display */,
- XErrorEvent* /* ev */,
- void* /* fp */
-);
-
-typedef void (*BeforeFlushType)(
- Display* /* display */,
- XExtCodes* /* codes */,
- _Xconst char* /* data */,
- long /* len */
-);
-
-/*
- * This structure is private to the library.
- */
-typedef struct _XExten { /* private to extension mechanism */
- struct _XExten *next; /* next in list */
- XExtCodes codes; /* public information, all extension told */
- CreateGCType create_GC; /* routine to call when GC created */
- CopyGCType copy_GC; /* routine to call when GC copied */
- FlushGCType flush_GC; /* routine to call when GC flushed */
- FreeGCType free_GC; /* routine to call when GC freed */
- CreateFontType create_Font; /* routine to call when Font created */
- FreeFontType free_Font; /* routine to call when Font freed */
- CloseDisplayType close_display; /* routine to call when connection closed */
- ErrorType error; /* who to call when an error occurs */
- ErrorStringType error_string; /* routine to supply error string */
- char *name; /* name of this extension */
- PrintErrorType error_values; /* routine to supply error values */
- BeforeFlushType before_flush; /* routine to call when sending data */
- struct _XExten *next_flush; /* next in list of those with flushes */
-} _XExtension;
-
-/* extension hooks */
-
-#ifdef DataRoutineIsProcedure
-extern void Data(Display *dpy, char *data, long len);
-#endif
-extern int _XError(
- Display* /* dpy */,
- xError* /* rep */
-);
-extern int _XIOError(
- Display* /* dpy */
-) _X_NORETURN;
-X11_EXTERN int (*_XIOErrorFunction)(
- Display* /* dpy */
-);
-X11_EXTERN int (*_XErrorFunction)(
- Display* /* dpy */,
- XErrorEvent* /* error_event */
-);
-extern void _XEatData(
- Display* /* dpy */,
- unsigned long /* n */
-);
-extern char *_XAllocScratch(
- Display* /* dpy */,
- unsigned long /* nbytes */
-);
-extern char *_XAllocTemp(
- Display* /* dpy */,
- unsigned long /* nbytes */
-);
-extern void _XFreeTemp(
- Display* /* dpy */,
- char* /* buf */,
- unsigned long /* nbytes */
-);
-extern Visual *_XVIDtoVisual(
- Display* /* dpy */,
- VisualID /* id */
-);
-extern unsigned long _XSetLastRequestRead(
- Display* /* dpy */,
- xGenericReply* /* rep */
-);
-extern int _XGetHostname(
- char* /* buf */,
- int /* maxlen */
-);
-extern Screen *_XScreenOfWindow(
- Display* /* dpy */,
- Window /* w */
-);
-extern Bool _XAsyncErrorHandler(
- Display* /* dpy */,
- xReply* /* rep */,
- char* /* buf */,
- int /* len */,
- XPointer /* data */
-);
-extern char *_XGetAsyncReply(
- Display* /* dpy */,
- char* /* replbuf */,
- xReply* /* rep */,
- char* /* buf */,
- int /* len */,
- int /* extra */,
- Bool /* discard */
-);
-extern void _XGetAsyncData(
- Display* /* dpy */,
- char * /* data */,
- char * /* buf */,
- int /* len */,
- int /* skip */,
- int /* datalen */,
- int /* discardtotal */
-);
-extern void _XFlush(
- Display* /* dpy */
-);
-extern int _XEventsQueued(
- Display* /* dpy */,
- int /* mode */
-);
-extern void _XReadEvents(
- Display* /* dpy */
-);
-extern int _XRead(
- Display* /* dpy */,
- char* /* data */,
- long /* size */
-);
-extern void _XReadPad(
- Display* /* dpy */,
- char* /* data */,
- long /* size */
-);
-extern void _XSend(
- Display* /* dpy */,
- _Xconst char* /* data */,
- long /* size */
-);
-extern Status _XReply(
- Display* /* dpy */,
- xReply* /* rep */,
- int /* extra */,
- Bool /* discard */
-);
-extern void _XEnq(
- Display* /* dpy */,
- xEvent* /* event */
-);
-extern void _XDeq(
- Display* /* dpy */,
- _XQEvent* /* prev */,
- _XQEvent* /* qelt */
-);
-
-extern Bool _XUnknownWireEvent(
- Display* /* dpy */,
- XEvent* /* re */,
- xEvent* /* event */
-);
-
-extern Bool _XUnknownWireEventCookie(
- Display* /* dpy */,
- XGenericEventCookie* /* re */,
- xEvent* /* event */
-);
-
-extern Bool _XUnknownCopyEventCookie(
- Display* /* dpy */,
- XGenericEventCookie* /* in */,
- XGenericEventCookie* /* out */
-);
-
-extern Status _XUnknownNativeEvent(
- Display* /* dpy */,
- XEvent* /* re */,
- xEvent* /* event */
-);
-
-extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event);
-extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we);
-extern Bool _XPollfdCacheInit(Display *dpy);
-extern void _XPollfdCacheAdd(Display *dpy, int fd);
-extern void _XPollfdCacheDel(Display *dpy, int fd);
-extern XID _XAllocID(Display *dpy);
-extern void _XAllocIDs(Display *dpy, XID *ids, int count);
-
-extern int _XFreeExtData(
- XExtData* /* extension */
-);
-
-extern int (*XESetCreateGC(
- Display* /* display */,
- int /* extension */,
- int (*) (
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
- ) /* proc */
-))(
- Display*, GC, XExtCodes*
-);
-
-extern int (*XESetCopyGC(
- Display* /* display */,
- int /* extension */,
- int (*) (
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
- ) /* proc */
-))(
- Display*, GC, XExtCodes*
-);
-
-extern int (*XESetFlushGC(
- Display* /* display */,
- int /* extension */,
- int (*) (
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
- ) /* proc */
-))(
- Display*, GC, XExtCodes*
-);
-
-extern int (*XESetFreeGC(
- Display* /* display */,
- int /* extension */,
- int (*) (
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
- ) /* proc */
-))(
- Display*, GC, XExtCodes*
-);
-
-extern int (*XESetCreateFont(
- Display* /* display */,
- int /* extension */,
- int (*) (
- Display* /* display */,
- XFontStruct* /* fs */,
- XExtCodes* /* codes */
- ) /* proc */
-))(
- Display*, XFontStruct*, XExtCodes*
-);
-
-extern int (*XESetFreeFont(
- Display* /* display */,
- int /* extension */,
- int (*) (
- Display* /* display */,
- XFontStruct* /* fs */,
- XExtCodes* /* codes */
- ) /* proc */
-))(
- Display*, XFontStruct*, XExtCodes*
-);
-
-extern int (*XESetCloseDisplay(
- Display* /* display */,
- int /* extension */,
- int (*) (
- Display* /* display */,
- XExtCodes* /* codes */
- ) /* proc */
-))(
- Display*, XExtCodes*
-);
-
-extern int (*XESetError(
- Display* /* display */,
- int /* extension */,
- int (*) (
- Display* /* display */,
- xError* /* err */,
- XExtCodes* /* codes */,
- int* /* ret_code */
- ) /* proc */
-))(
- Display*, xError*, XExtCodes*, int*
-);
-
-extern char* (*XESetErrorString(
- Display* /* display */,
- int /* extension */,
- char* (*) (
- Display* /* display */,
- int /* code */,
- XExtCodes* /* codes */,
- char* /* buffer */,
- int /* nbytes */
- ) /* proc */
-))(
- Display*, int, XExtCodes*, char*, int
-);
-
-extern void (*XESetPrintErrorValues (
- Display* /* display */,
- int /* extension */,
- void (*)(
- Display* /* display */,
- XErrorEvent* /* ev */,
- void* /* fp */
- ) /* proc */
-))(
- Display*, XErrorEvent*, void*
-);
-
-extern Bool (*XESetWireToEvent(
- Display* /* display */,
- int /* event_number */,
- Bool (*) (
- Display* /* display */,
- XEvent* /* re */,
- xEvent* /* event */
- ) /* proc */
-))(
- Display*, XEvent*, xEvent*
-);
-
-extern Bool (*XESetWireToEventCookie(
- Display* /* display */,
- int /* extension */,
- Bool (*) (
- Display* /* display */,
- XGenericEventCookie* /* re */,
- xEvent* /* event */
- ) /* proc */
-))(
- Display*, XGenericEventCookie*, xEvent*
-);
-
-extern Bool (*XESetCopyEventCookie(
- Display* /* display */,
- int /* extension */,
- Bool (*) (
- Display* /* display */,
- XGenericEventCookie* /* in */,
- XGenericEventCookie* /* out */
- ) /* proc */
-))(
- Display*, XGenericEventCookie*, XGenericEventCookie*
-);
-
-
-extern Status (*XESetEventToWire(
- Display* /* display */,
- int /* event_number */,
- Status (*) (
- Display* /* display */,
- XEvent* /* re */,
- xEvent* /* event */
- ) /* proc */
-))(
- Display*, XEvent*, xEvent*
-);
-
-extern Bool (*XESetWireToError(
- Display* /* display */,
- int /* error_number */,
- Bool (*) (
- Display* /* display */,
- XErrorEvent* /* he */,
- xError* /* we */
- ) /* proc */
-))(
- Display*, XErrorEvent*, xError*
-);
-
-extern void (*XESetBeforeFlush(
- Display* /* display */,
- int /* error_number */,
- void (*) (
- Display* /* display */,
- XExtCodes* /* codes */,
- _Xconst char* /* data */,
- long /* len */
- ) /* proc */
-))(
- Display*, XExtCodes*, _Xconst char*, long
-);
-
-/* internal connections for IMs */
-
-typedef void (*_XInternalConnectionProc)(
- Display* /* dpy */,
- int /* fd */,
- XPointer /* call_data */
-);
-
-
-extern Status _XRegisterInternalConnection(
- Display* /* dpy */,
- int /* fd */,
- _XInternalConnectionProc /* callback */,
- XPointer /* call_data */
-);
-
-extern void _XUnregisterInternalConnection(
- Display* /* dpy */,
- int /* fd */
-);
-
-extern void _XProcessInternalConnection(
- Display* /* dpy */,
- struct _XConnectionInfo* /* conn_info */
-);
-
-/* Display structure has pointers to these */
-
-struct _XConnectionInfo { /* info from _XRegisterInternalConnection */
- int fd;
- _XInternalConnectionProc read_callback;
- XPointer call_data;
- XPointer *watch_data; /* set/used by XConnectionWatchProc */
- struct _XConnectionInfo *next;
-};
-
-struct _XConnWatchInfo { /* info from XAddConnectionWatch */
- XConnectionWatchProc fn;
- XPointer client_data;
- struct _XConnWatchInfo *next;
-};
-
-#ifdef __UNIXOS2__
-extern char* __XOS2RedirRoot(
- char*
-);
-#endif
-
-extern int _XTextHeight(
- XFontStruct* /* font_struct */,
- _Xconst char* /* string */,
- int /* count */
-);
-
-extern int _XTextHeight16(
- XFontStruct* /* font_struct */,
- _Xconst XChar2b* /* string */,
- int /* count */
-);
-
-#if defined(WIN32)
-
-extern int _XOpenFile(
- _Xconst char* /* path */,
- int /* flags */
-);
-
-extern int _XOpenFileMode(
- _Xconst char* /* path */,
- int /* flags */,
- mode_t /* mode */
-);
-
-extern void* _XFopenFile(
- _Xconst char* /* path */,
- _Xconst char* /* mode */
-);
-
-extern int _XAccessFile(
- _Xconst char* /* path */
-);
-#else
-#define _XOpenFile(path,flags) open(path,flags)
-#define _XOpenFileMode(path,flags,mode) open(path,flags,mode)
-#define _XFopenFile(path,mode) fopen(path,mode)
-#endif
-
-/* EvToWire.c */
-extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event);
-
-extern int _XF86LoadQueryLocaleFont(
- Display* /* dpy */,
- _Xconst char* /* name*/,
- XFontStruct** /* xfp*/,
- Font* /* fidp */
-);
-
-extern void _XProcessWindowAttributes (
- register Display *dpy,
- xChangeWindowAttributesReq *req,
- register unsigned long valuemask,
- register XSetWindowAttributes *attributes);
-
-extern int _XDefaultError(
- Display *dpy,
- XErrorEvent *event);
-
-extern int _XDefaultIOError(
- Display *dpy);
-
-extern void _XSetClipRectangles (
- register Display *dpy,
- GC gc,
- int clip_x_origin, int clip_y_origin,
- XRectangle *rectangles,
- int n,
- int ordering);
-
-Status _XGetWindowAttributes(
- register Display *dpy,
- Window w,
- XWindowAttributes *attr);
-
-int _XPutBackEvent (
- register Display *dpy,
- register XEvent *event);
-
-extern Bool _XIsEventCookie(
- Display *dpy,
- XEvent *ev);
-
-extern void _XFreeEventCookies(
- Display *dpy);
-
-extern void _XStoreEventCookie(
- Display *dpy,
- XEvent *ev);
-
-extern Bool _XFetchEventCookie(
- Display *dpy,
- XGenericEventCookie *ev);
-
-extern Bool _XCopyEventCookie(
- Display *dpy,
- XGenericEventCookie *in,
- XGenericEventCookie *out);
-
-/* lcFile.c */
-
-extern void xlocaledir(
- char *buf,
- int buf_len
-);
-
-_XFUNCPROTOEND
-
-#endif /* _X11_XLIBINT_H_ */
+
+/*
+
+Copyright 1984, 1985, 1987, 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifndef _X11_XLIBINT_H_
+#define _X11_XLIBINT_H_ 1
+
+/*
+ * Xlibint.h - Header definition and support file for the internal
+ * support routines used by the C subroutine interface
+ * library (Xlib) to the X Window System.
+ *
+ * Warning, there be dragons here....
+ */
+
+#include <X11/Xlib.h>
+#include <X11/Xproto.h> /* to declare xEvent */
+#include <X11/XlibConf.h> /* for configured options like XTHREADS */
+
+/* The Xlib structs are full of implicit padding to properly align members.
+ We can't clean that up without breaking ABI, so tell clang not to bother
+ complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+#ifdef WIN32
+#define _XFlush _XFlushIt
+#endif
+
+/*
+ * If your BytesReadable correctly detects broken connections, then
+ * you should NOT define XCONN_CHECK_FREQ.
+ */
+#ifndef XCONN_CHECK_FREQ
+#define XCONN_CHECK_FREQ 256
+#endif
+
+struct _XGC
+{
+ XExtData *ext_data; /* hook for extension to hang data */
+ GContext gid; /* protocol ID for graphics context */
+ Bool rects; /* boolean: TRUE if clipmask is list of rectangles */
+ Bool dashes; /* boolean: TRUE if dash-list is really a list */
+ unsigned long dirty;/* cache dirty bits */
+ XGCValues values; /* shadow structure of values */
+};
+
+struct _XDisplay
+{
+ XExtData *ext_data; /* hook for extension to hang data */
+ struct _XFreeFuncs *free_funcs; /* internal free functions */
+ int fd; /* Network socket. */
+ int conn_checker; /* ugly thing used by _XEventsQueued */
+ int proto_major_version;/* maj. version of server's X protocol */
+ int proto_minor_version;/* minor version of server's X protocol */
+ char *vendor; /* vendor of the server hardware */
+ XID resource_base; /* resource ID base */
+ XID resource_mask; /* resource ID mask bits */
+ XID resource_id; /* allocator current ID */
+ int resource_shift; /* allocator shift to correct bits */
+ XID (*resource_alloc)( /* allocator function */
+ struct _XDisplay*
+ );
+ int byte_order; /* screen byte order, LSBFirst, MSBFirst */
+ int bitmap_unit; /* padding and data requirements */
+ int bitmap_pad; /* padding requirements on bitmaps */
+ int bitmap_bit_order; /* LeastSignificant or MostSignificant */
+ int nformats; /* number of pixmap formats in list */
+ ScreenFormat *pixmap_format; /* pixmap format list */
+ int vnumber; /* Xlib's X protocol version number. */
+ int release; /* release of the server */
+ struct _XSQEvent *head, *tail; /* Input event queue. */
+ int qlen; /* Length of input event queue */
+ unsigned long last_request_read; /* seq number of last event read */
+ unsigned long request; /* sequence number of last request. */
+ char *last_req; /* beginning of last request, or dummy */
+ char *buffer; /* Output buffer starting address. */
+ char *bufptr; /* Output buffer index pointer. */
+ char *bufmax; /* Output buffer maximum+1 address. */
+ unsigned max_request_size; /* maximum number 32 bit words in request*/
+ struct _XrmHashBucketRec *db;
+ int (*synchandler)( /* Synchronization handler */
+ struct _XDisplay*
+ );
+ char *display_name; /* "host:display" string used on this connect*/
+ int default_screen; /* default screen for operations */
+ int nscreens; /* number of screens on this server*/
+ Screen *screens; /* pointer to list of screens */
+ unsigned long motion_buffer; /* size of motion buffer */
+ volatile unsigned long flags; /* internal connection flags */
+ int min_keycode; /* minimum defined keycode */
+ int max_keycode; /* maximum defined keycode */
+ KeySym *keysyms; /* This server's keysyms */
+ XModifierKeymap *modifiermap; /* This server's modifier keymap */
+ int keysyms_per_keycode;/* number of rows */
+ char *xdefaults; /* contents of defaults from server */
+ char *scratch_buffer; /* place to hang scratch buffer */
+ unsigned long scratch_length; /* length of scratch buffer */
+ int ext_number; /* extension number on this display */
+ struct _XExten *ext_procs; /* extensions initialized on this display */
+ /*
+ * the following can be fixed size, as the protocol defines how
+ * much address space is available.
+ * While this could be done using the extension vector, there
+ * may be MANY events processed, so a search through the extension
+ * list to find the right procedure for each event might be
+ * expensive if many extensions are being used.
+ */
+ Bool (*event_vec[128])( /* vector for wire to event */
+ Display * /* dpy */,
+ XEvent * /* re */,
+ xEvent * /* event */
+ );
+ Status (*wire_vec[128])( /* vector for event to wire */
+ Display * /* dpy */,
+ XEvent * /* re */,
+ xEvent * /* event */
+ );
+ KeySym lock_meaning; /* for XLookupString */
+ struct _XLockInfo *lock; /* multi-thread state, display lock */
+ struct _XInternalAsync *async_handlers; /* for internal async */
+ unsigned long bigreq_size; /* max size of big requests */
+ struct _XLockPtrs *lock_fns; /* pointers to threads functions */
+ void (*idlist_alloc)( /* XID list allocator function */
+ Display * /* dpy */,
+ XID * /* ids */,
+ int /* count */
+ );
+ /* things above this line should not move, for binary compatibility */
+ struct _XKeytrans *key_bindings; /* for XLookupString */
+ Font cursor_font; /* for XCreateFontCursor */
+ struct _XDisplayAtoms *atoms; /* for XInternAtom */
+ unsigned int mode_switch; /* keyboard group modifiers */
+ unsigned int num_lock; /* keyboard numlock modifiers */
+ struct _XContextDB *context_db; /* context database */
+ Bool (**error_vec)( /* vector for wire to error */
+ Display * /* display */,
+ XErrorEvent * /* he */,
+ xError * /* we */
+ );
+ /*
+ * Xcms information
+ */
+ struct {
+ XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */
+ XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */
+ XPointer perVisualIntensityMaps;
+ /* linked list of XcmsIntensityMap */
+ } cms;
+ struct _XIMFilter *im_filters;
+ struct _XSQEvent *qfree; /* unallocated event queue elements */
+ unsigned long next_event_serial_num; /* inserted into next queue elt */
+ struct _XExten *flushes; /* Flush hooks */
+ struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */
+ int im_fd_length; /* number of im_fd_info */
+ struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */
+ int watcher_count; /* number of conn_watchers */
+ XPointer filedes; /* struct pollfd cache for _XWaitForReadable */
+ int (*savedsynchandler)( /* user synchandler when Xlib usurps */
+ Display * /* dpy */
+ );
+ XID resource_max; /* allocator max ID */
+ int xcmisc_opcode; /* major opcode for XC-MISC */
+ struct _XkbInfoRec *xkb_info; /* XKB info */
+ struct _XtransConnInfo *trans_conn; /* transport connection object */
+ struct _X11XCBPrivate *xcb; /* XCB glue private data */
+
+ /* Generic event cookie handling */
+ unsigned int next_cookie; /* next event cookie */
+ /* vector for wire to generic event, index is (extension - 128) */
+ Bool (*generic_event_vec[128])(
+ Display * /* dpy */,
+ XGenericEventCookie * /* Xlib event */,
+ xEvent * /* wire event */);
+ /* vector for event copy, index is (extension - 128) */
+ Bool (*generic_event_copy_vec[128])(
+ Display * /* dpy */,
+ XGenericEventCookie * /* in */,
+ XGenericEventCookie * /* out*/);
+ void *cookiejar; /* cookie events returned but not claimed */
+};
+
+#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
+
+/*
+ * define the following if you want the Data macro to be a procedure instead
+ */
+#ifdef CRAY
+#define DataRoutineIsProcedure
+#endif /* CRAY */
+
+#ifndef _XEVENT_
+/*
+ * _QEvent datatype for use in input queueing.
+ */
+typedef struct _XSQEvent
+{
+ struct _XSQEvent *next;
+ XEvent event;
+ unsigned long qserial_num; /* so multi-threaded code can find new ones */
+} _XQEvent;
+#endif
+
+#include <X11/Xproto.h>
+#ifdef __sgi
+#define _SGI_MP_SOURCE /* turn this on to get MP safe errno */
+#endif
+#include <errno.h>
+#define _XBCOPYFUNC _Xbcopy
+#include <X11/Xfuncs.h>
+#include <X11/Xosdefs.h>
+
+/* Utek leaves kernel macros around in include files (bleah) */
+#ifdef dirty
+#undef dirty
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+/*
+ * The following definitions can be used for locking requests in multi-threaded
+ * address spaces.
+ */
+#ifdef XTHREADS
+/* Author: Stephen Gildea, MIT X Consortium
+ *
+ * declarations for C Threads locking
+ */
+
+typedef struct _LockInfoRec *LockInfoPtr;
+
+/* interfaces for locking.c */
+struct _XLockPtrs {
+ /* used by all, including extensions; do not move */
+ void (*lock_display)(
+ Display *dpy
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+ , char *file
+ , int line
+#endif
+ );
+ void (*unlock_display)(
+ Display *dpy
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+ , char *file
+ , int line
+#endif
+ );
+};
+
+#ifdef WIN32
+#ifdef LIB11_DLL
+#define X11_EXTERN __declspec(dllexport) extern
+#else
+#define X11_EXTERN __declspec(dllimport) extern
+#endif
+#else
+#define X11_EXTERN extern
+#endif
+
+
+/* in XlibInt.c */
+X11_EXTERN void (*_XCreateMutex_fn)(
+ LockInfoPtr /* lock */
+);
+X11_EXTERN void (*_XFreeMutex_fn)(
+ LockInfoPtr /* lock */
+);
+X11_EXTERN void (*_XLockMutex_fn)(
+ LockInfoPtr /* lock */
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+ , char * /* file */
+ , int /* line */
+#endif
+);
+X11_EXTERN void (*_XUnlockMutex_fn)(
+ LockInfoPtr /* lock */
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+ , char * /* file */
+ , int /* line */
+#endif
+);
+
+X11_EXTERN LockInfoPtr _Xglobal_lock;
+
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__)
+#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__)
+#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__)
+#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__)
+#else
+/* used everywhere, so must be fast if not using threads */
+#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d)
+#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d)
+#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock)
+#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock)
+#endif
+#define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock);
+#define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock);
+
+#else /* XTHREADS */
+#define LockDisplay(dis)
+#define _XLockMutex(lock)
+#define _XUnlockMutex(lock)
+#define UnlockDisplay(dis)
+#define _XCreateMutex(lock)
+#define _XFreeMutex(lock)
+#endif
+
+#define Xfree(ptr) free((ptr))
+
+/*
+ * Note that some machines do not return a valid pointer for malloc(0), in
+ * which case we provide an alternate under the control of the
+ * define MALLOC_0_RETURNS_NULL. This is necessary because some
+ * Xlib code expects malloc(0) to return a valid pointer to storage.
+ */
+#if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__)
+
+# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size)))
+# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size)))
+# define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize))
+
+#else
+
+# define Xmalloc(size) malloc((size))
+# define Xrealloc(ptr, size) realloc((ptr), (size))
+# define Xcalloc(nelem, elsize) calloc((nelem), (elsize))
+
+#endif
+
+#include <stddef.h>
+
+#define LOCKED 1
+#define UNLOCKED 0
+
+#ifndef BUFSIZE
+#define BUFSIZE 2048 /* X output buffer size. */
+#endif
+#ifndef PTSPERBATCH
+#define PTSPERBATCH 1024 /* point batching */
+#endif
+#ifndef WLNSPERBATCH
+#define WLNSPERBATCH 50 /* wide line batching */
+#endif
+#ifndef ZLNSPERBATCH
+#define ZLNSPERBATCH 1024 /* thin line batching */
+#endif
+#ifndef WRCTSPERBATCH
+#define WRCTSPERBATCH 10 /* wide line rectangle batching */
+#endif
+#ifndef ZRCTSPERBATCH
+#define ZRCTSPERBATCH 256 /* thin line rectangle batching */
+#endif
+#ifndef FRCTSPERBATCH
+#define FRCTSPERBATCH 256 /* filled rectangle batching */
+#endif
+#ifndef FARCSPERBATCH
+#define FARCSPERBATCH 256 /* filled arc batching */
+#endif
+#ifndef CURSORFONT
+#define CURSORFONT "cursor" /* standard cursor fonts */
+#endif
+
+/*
+ * Display flags
+ */
+#define XlibDisplayIOError (1L << 0)
+#define XlibDisplayClosing (1L << 1)
+#define XlibDisplayNoXkb (1L << 2)
+#define XlibDisplayPrivSync (1L << 3)
+#define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */
+#define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */
+#define XlibDisplayReply (1L << 5) /* in _XReply */
+#define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */
+#define XlibDisplayDfltRMDB (1L << 7) /* mark if RM db from XGetDefault */
+
+/*
+ * X Protocol packetizing macros.
+ */
+
+/* Need to start requests on 64 bit word boundaries
+ * on a CRAY computer so add a NoOp (127) if needed.
+ * A character pointer on a CRAY computer will be non-zero
+ * after shifting right 61 bits of it is not pointing to
+ * a word boundary.
+ */
+#ifdef WORD64
+#define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\
+ dpy->last_req = dpy->bufptr;\
+ *(dpy->bufptr) = X_NoOperation;\
+ *(dpy->bufptr+1) = 0;\
+ *(dpy->bufptr+2) = 0;\
+ *(dpy->bufptr+3) = 1;\
+ dpy->request++;\
+ dpy->bufptr += 4;\
+ }
+#else /* else does not require alignment on 64-bit boundaries */
+#define WORD64ALIGN
+#endif /* WORD64 */
+
+/**
+ * Return a len-sized request buffer for the request type. This function may
+ * flush the output queue.
+ *
+ * @param dpy The display connection
+ * @param type The request type
+ * @param len Length of the request in bytes
+ *
+ * @returns A pointer to the request buffer with a few default values
+ * initialized.
+ */
+extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
+
+/* GetReqSized is the same as GetReq but allows the caller to specify the
+ * size in bytes. 'sz' must be a multiple of 4! */
+
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define GetReqSized(name, sz, req) \
+ req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz)
+#else
+#define GetReqSized(name, sz, req) \
+ req = (x/**/name/**/Req *) _XGetRequest(dpy, X_/**/name, sz)
+#endif
+
+
+/*
+ * GetReq - Get the next available X request packet in the buffer and
+ * return it.
+ *
+ * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc.
+ * "req" is the name of the request pointer.
+ *
+ */
+
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define GetReq(name, req) \
+ GetReqSized(name, SIZEOF(x##name##Req), req)
+#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
+#define GetReq(name, req) \
+ GetReqSized(name, SIZEOF(x/**/name/**/Req), req)
+#endif
+
+/* GetReqExtra is the same as GetReq, but allocates "n" additional
+ bytes after the request. "n" must be a multiple of 4! */
+
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define GetReqExtra(name, n, req) \
+ GetReqSized(name, SIZEOF(x##name##Req) + n, req)
+#else
+#define GetReqExtra(name, n, req) \
+ GetReqSized(name, SIZEOF(x/**/name/**/Req) + n, req)
+#endif
+
+
+/*
+ * GetResReq is for those requests that have a resource ID
+ * (Window, Pixmap, GContext, etc.) as their single argument.
+ * "rid" is the name of the resource.
+ */
+
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define GetResReq(name, rid, req) \
+ req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \
+ req->id = (rid)
+#else
+#define GetResReq(name, rid, req) \
+ req = (xResourceReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xResourceReq)); \
+ req->id = (rid)
+#endif
+
+/*
+ * GetEmptyReq is for those requests that have no arguments
+ * at all.
+ */
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define GetEmptyReq(name, req) \
+ req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq))
+#else
+#define GetEmptyReq(name, req) \
+ req = (xReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xReq))
+#endif
+
+#ifdef WORD64
+#define MakeBigReq(req,n) \
+ { \
+ char _BRdat[4]; \
+ unsigned long _BRlen = req->length - 1; \
+ req->length = 0; \
+ memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \
+ memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
+ memcpy(((char *)req) + 4, _BRdat, 4); \
+ Data32(dpy, (long *)&_BRdat, 4); \
+ }
+#else
+#ifdef LONG64
+#define MakeBigReq(req,n) \
+ { \
+ CARD64 _BRdat; \
+ CARD32 _BRlen = req->length - 1; \
+ req->length = 0; \
+ _BRdat = ((CARD32 *)req)[_BRlen]; \
+ memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
+ ((CARD32 *)req)[1] = _BRlen + n + 2; \
+ Data32(dpy, &_BRdat, 4); \
+ }
+#else
+#define MakeBigReq(req,n) \
+ { \
+ CARD32 _BRdat; \
+ CARD32 _BRlen = req->length - 1; \
+ req->length = 0; \
+ _BRdat = ((CARD32 *)req)[_BRlen]; \
+ memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
+ ((CARD32 *)req)[1] = _BRlen + n + 2; \
+ Data32(dpy, &_BRdat, 4); \
+ }
+#endif
+#endif
+
+#ifndef __clang_analyzer__
+#define SetReqLen(req,n,badlen) \
+ if ((req->length + n) > (unsigned)65535) { \
+ if (dpy->bigreq_size) { \
+ MakeBigReq(req,n) \
+ } else { \
+ n = badlen; \
+ req->length += n; \
+ } \
+ } else \
+ req->length += n
+#else
+#define SetReqLen(req,n,badlen) \
+ req->length += n
+#endif
+
+#define SyncHandle() \
+ if (dpy->synchandler) (*dpy->synchandler)(dpy)
+
+extern void _XFlushGCCache(Display *dpy, GC gc);
+#define FlushGC(dpy, gc) \
+ if ((gc)->dirty) _XFlushGCCache((dpy), (gc))
+/*
+ * Data - Place data in the buffer and pad the end to provide
+ * 32 bit word alignment. Transmit if the buffer fills.
+ *
+ * "dpy" is a pointer to a Display.
+ * "data" is a pinter to a data buffer.
+ * "len" is the length of the data buffer.
+ */
+#ifndef DataRoutineIsProcedure
+#define Data(dpy, data, len) {\
+ if (dpy->bufptr + (len) <= dpy->bufmax) {\
+ memcpy(dpy->bufptr, data, (int)len);\
+ dpy->bufptr += ((len) + 3) & ~3;\
+ } else\
+ _XSend(dpy, data, len);\
+ }
+#endif /* DataRoutineIsProcedure */
+
+
+/* Allocate bytes from the buffer. No padding is done, so if
+ * the length is not a multiple of 4, the caller must be
+ * careful to leave the buffer aligned after sending the
+ * current request.
+ *
+ * "type" is the type of the pointer being assigned to.
+ * "ptr" is the pointer being assigned to.
+ * "n" is the number of bytes to allocate.
+ *
+ * Example:
+ * xTextElt *elt;
+ * BufAlloc (xTextElt *, elt, nbytes)
+ */
+
+#define BufAlloc(type, ptr, n) \
+ if (dpy->bufptr + (n) > dpy->bufmax) \
+ _XFlush (dpy); \
+ ptr = (type) dpy->bufptr; \
+ memset(ptr, '\0', n); \
+ dpy->bufptr += (n);
+
+#ifdef WORD64
+#define Data16(dpy, data, len) _XData16(dpy, (short *)data, len)
+#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
+#else
+#define Data16(dpy, data, len) Data((dpy), (char *)(data), (len))
+#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
+#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
+#ifdef LONG64
+#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
+extern int _XData32(
+ Display *dpy,
+ register long *data,
+ unsigned len
+);
+extern void _XRead32(
+ Display *dpy,
+ register long *data,
+ long len
+);
+#else
+#define Data32(dpy, data, len) Data((dpy), (char *)(data), (len))
+#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
+#endif
+#endif /* not WORD64 */
+
+#define PackData16(dpy,data,len) Data16 (dpy, data, len)
+#define PackData32(dpy,data,len) Data32 (dpy, data, len)
+
+/* Xlib manual is bogus */
+#define PackData(dpy,data,len) PackData16 (dpy, data, len)
+
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+
+#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
+ (((cs)->rbearing|(cs)->lbearing| \
+ (cs)->ascent|(cs)->descent) == 0))
+
+/*
+ * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit
+ * character. If the character is in the column and exists, then return the
+ * appropriate metrics (note that fonts with common per-character metrics will
+ * return min_bounds). If none of these hold true, try again with the default
+ * char.
+ */
+#define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \
+{ \
+ cs = def; \
+ if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
+ if (fs->per_char == NULL) { \
+ cs = &fs->min_bounds; \
+ } else { \
+ cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
+ if (CI_NONEXISTCHAR(cs)) cs = def; \
+ } \
+ } \
+}
+
+#define CI_GET_DEFAULT_INFO_1D(fs,cs) \
+ CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs)
+
+
+
+/*
+ * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and
+ * column. This is used for fonts that have more than row zero.
+ */
+#define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \
+{ \
+ cs = def; \
+ if (row >= fs->min_byte1 && row <= fs->max_byte1 && \
+ col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
+ if (fs->per_char == NULL) { \
+ cs = &fs->min_bounds; \
+ } else { \
+ cs = &fs->per_char[((row - fs->min_byte1) * \
+ (fs->max_char_or_byte2 - \
+ fs->min_char_or_byte2 + 1)) + \
+ (col - fs->min_char_or_byte2)]; \
+ if (CI_NONEXISTCHAR(cs)) cs = def; \
+ } \
+ } \
+}
+
+#define CI_GET_DEFAULT_INFO_2D(fs,cs) \
+{ \
+ unsigned int r = (fs->default_char >> 8); \
+ unsigned int c = (fs->default_char & 0xff); \
+ CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \
+}
+
+
+#ifdef MUSTCOPY
+
+/* for when 32-bit alignment is not good enough */
+#define OneDataCard32(dpy,dstaddr,srcvar) \
+ { dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); }
+
+#else
+
+/* srcvar must be a variable for large architecture version */
+#define OneDataCard32(dpy,dstaddr,srcvar) \
+ { *(CARD32 *)(dstaddr) = (srcvar); }
+
+#endif /* MUSTCOPY */
+
+typedef struct _XInternalAsync {
+ struct _XInternalAsync *next;
+ /*
+ * handler arguments:
+ * rep is the generic reply that caused this handler
+ * to be invoked. It must also be passed to _XGetAsyncReply.
+ * buf and len are opaque values that must be passed to
+ * _XGetAsyncReply or _XGetAsyncData.
+ * data is the closure stored in this struct.
+ * The handler returns True iff it handled this reply.
+ */
+ Bool (*handler)(
+ Display* /* dpy */,
+ xReply* /* rep */,
+ char* /* buf */,
+ int /* len */,
+ XPointer /* data */
+ );
+ XPointer data;
+} _XAsyncHandler;
+
+typedef struct _XAsyncEState {
+ unsigned long min_sequence_number;
+ unsigned long max_sequence_number;
+ unsigned char error_code;
+ unsigned char major_opcode;
+ unsigned short minor_opcode;
+ unsigned char last_error_received;
+ int error_count;
+} _XAsyncErrorState;
+
+extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler);
+#define DeqAsyncHandler(dpy,handler) { \
+ if (dpy->async_handlers == (handler)) \
+ dpy->async_handlers = (handler)->next; \
+ else \
+ _XDeqAsyncHandler(dpy, handler); \
+ }
+
+typedef void (*FreeFuncType) (
+ Display* /* display */
+);
+
+typedef int (*FreeModmapType) (
+ XModifierKeymap* /* modmap */
+);
+
+/*
+ * This structure is private to the library.
+ */
+typedef struct _XFreeFuncs {
+ FreeFuncType atoms; /* _XFreeAtomTable */
+ FreeModmapType modifiermap; /* XFreeModifiermap */
+ FreeFuncType key_bindings; /* _XFreeKeyBindings */
+ FreeFuncType context_db; /* _XFreeContextDB */
+ FreeFuncType defaultCCCs; /* _XcmsFreeDefaultCCCs */
+ FreeFuncType clientCmaps; /* _XcmsFreeClientCmaps */
+ FreeFuncType intensityMaps; /* _XcmsFreeIntensityMaps */
+ FreeFuncType im_filters; /* _XFreeIMFilters */
+ FreeFuncType xkb; /* _XkbFreeInfo */
+} _XFreeFuncRec;
+
+/* types for InitExt.c */
+typedef int (*CreateGCType) (
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+);
+
+typedef int (*CopyGCType)(
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+);
+
+typedef int (*FlushGCType) (
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+);
+
+typedef int (*FreeGCType) (
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+);
+
+typedef int (*CreateFontType) (
+ Display* /* display */,
+ XFontStruct* /* fs */,
+ XExtCodes* /* codes */
+);
+
+typedef int (*FreeFontType) (
+ Display* /* display */,
+ XFontStruct* /* fs */,
+ XExtCodes* /* codes */
+);
+
+typedef int (*CloseDisplayType) (
+ Display* /* display */,
+ XExtCodes* /* codes */
+);
+
+typedef int (*ErrorType) (
+ Display* /* display */,
+ xError* /* err */,
+ XExtCodes* /* codes */,
+ int* /* ret_code */
+);
+
+typedef char* (*ErrorStringType) (
+ Display* /* display */,
+ int /* code */,
+ XExtCodes* /* codes */,
+ char* /* buffer */,
+ int /* nbytes */
+);
+
+typedef void (*PrintErrorType)(
+ Display* /* display */,
+ XErrorEvent* /* ev */,
+ void* /* fp */
+);
+
+typedef void (*BeforeFlushType)(
+ Display* /* display */,
+ XExtCodes* /* codes */,
+ _Xconst char* /* data */,
+ long /* len */
+);
+
+/*
+ * This structure is private to the library.
+ */
+typedef struct _XExten { /* private to extension mechanism */
+ struct _XExten *next; /* next in list */
+ XExtCodes codes; /* public information, all extension told */
+ CreateGCType create_GC; /* routine to call when GC created */
+ CopyGCType copy_GC; /* routine to call when GC copied */
+ FlushGCType flush_GC; /* routine to call when GC flushed */
+ FreeGCType free_GC; /* routine to call when GC freed */
+ CreateFontType create_Font; /* routine to call when Font created */
+ FreeFontType free_Font; /* routine to call when Font freed */
+ CloseDisplayType close_display; /* routine to call when connection closed */
+ ErrorType error; /* who to call when an error occurs */
+ ErrorStringType error_string; /* routine to supply error string */
+ char *name; /* name of this extension */
+ PrintErrorType error_values; /* routine to supply error values */
+ BeforeFlushType before_flush; /* routine to call when sending data */
+ struct _XExten *next_flush; /* next in list of those with flushes */
+} _XExtension;
+
+/* extension hooks */
+
+#ifdef DataRoutineIsProcedure
+extern void Data(Display *dpy, char *data, long len);
+#endif
+extern int _XError(
+ Display* /* dpy */,
+ xError* /* rep */
+);
+extern int _XIOError(
+ Display* /* dpy */
+) _X_NORETURN;
+X11_EXTERN int (*_XIOErrorFunction)(
+ Display* /* dpy */
+);
+X11_EXTERN int (*_XErrorFunction)(
+ Display* /* dpy */,
+ XErrorEvent* /* error_event */
+);
+extern void _XEatData(
+ Display* /* dpy */,
+ unsigned long /* n */
+);
+extern char *_XAllocScratch(
+ Display* /* dpy */,
+ unsigned long /* nbytes */
+);
+extern char *_XAllocTemp(
+ Display* /* dpy */,
+ unsigned long /* nbytes */
+);
+extern void _XFreeTemp(
+ Display* /* dpy */,
+ char* /* buf */,
+ unsigned long /* nbytes */
+);
+extern Visual *_XVIDtoVisual(
+ Display* /* dpy */,
+ VisualID /* id */
+);
+extern unsigned long _XSetLastRequestRead(
+ Display* /* dpy */,
+ xGenericReply* /* rep */
+);
+extern int _XGetHostname(
+ char* /* buf */,
+ int /* maxlen */
+);
+extern Screen *_XScreenOfWindow(
+ Display* /* dpy */,
+ Window /* w */
+);
+extern Bool _XAsyncErrorHandler(
+ Display* /* dpy */,
+ xReply* /* rep */,
+ char* /* buf */,
+ int /* len */,
+ XPointer /* data */
+);
+extern char *_XGetAsyncReply(
+ Display* /* dpy */,
+ char* /* replbuf */,
+ xReply* /* rep */,
+ char* /* buf */,
+ int /* len */,
+ int /* extra */,
+ Bool /* discard */
+);
+extern void _XGetAsyncData(
+ Display* /* dpy */,
+ char * /* data */,
+ char * /* buf */,
+ int /* len */,
+ int /* skip */,
+ int /* datalen */,
+ int /* discardtotal */
+);
+extern void _XFlush(
+ Display* /* dpy */
+);
+extern int _XEventsQueued(
+ Display* /* dpy */,
+ int /* mode */
+);
+extern void _XReadEvents(
+ Display* /* dpy */
+);
+extern int _XRead(
+ Display* /* dpy */,
+ char* /* data */,
+ long /* size */
+);
+extern void _XReadPad(
+ Display* /* dpy */,
+ char* /* data */,
+ long /* size */
+);
+extern void _XSend(
+ Display* /* dpy */,
+ _Xconst char* /* data */,
+ long /* size */
+);
+extern Status _XReply(
+ Display* /* dpy */,
+ xReply* /* rep */,
+ int /* extra */,
+ Bool /* discard */
+);
+extern void _XEnq(
+ Display* /* dpy */,
+ xEvent* /* event */
+);
+extern void _XDeq(
+ Display* /* dpy */,
+ _XQEvent* /* prev */,
+ _XQEvent* /* qelt */
+);
+
+extern Bool _XUnknownWireEvent(
+ Display* /* dpy */,
+ XEvent* /* re */,
+ xEvent* /* event */
+);
+
+extern Bool _XUnknownWireEventCookie(
+ Display* /* dpy */,
+ XGenericEventCookie* /* re */,
+ xEvent* /* event */
+);
+
+extern Bool _XUnknownCopyEventCookie(
+ Display* /* dpy */,
+ XGenericEventCookie* /* in */,
+ XGenericEventCookie* /* out */
+);
+
+extern Status _XUnknownNativeEvent(
+ Display* /* dpy */,
+ XEvent* /* re */,
+ xEvent* /* event */
+);
+
+extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event);
+extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we);
+extern Bool _XPollfdCacheInit(Display *dpy);
+extern void _XPollfdCacheAdd(Display *dpy, int fd);
+extern void _XPollfdCacheDel(Display *dpy, int fd);
+extern XID _XAllocID(Display *dpy);
+extern void _XAllocIDs(Display *dpy, XID *ids, int count);
+
+extern int _XFreeExtData(
+ XExtData* /* extension */
+);
+
+extern int (*XESetCreateGC(
+ Display* /* display */,
+ int /* extension */,
+ int (*) (
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+ ) /* proc */
+))(
+ Display*, GC, XExtCodes*
+);
+
+extern int (*XESetCopyGC(
+ Display* /* display */,
+ int /* extension */,
+ int (*) (
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+ ) /* proc */
+))(
+ Display*, GC, XExtCodes*
+);
+
+extern int (*XESetFlushGC(
+ Display* /* display */,
+ int /* extension */,
+ int (*) (
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+ ) /* proc */
+))(
+ Display*, GC, XExtCodes*
+);
+
+extern int (*XESetFreeGC(
+ Display* /* display */,
+ int /* extension */,
+ int (*) (
+ Display* /* display */,
+ GC /* gc */,
+ XExtCodes* /* codes */
+ ) /* proc */
+))(
+ Display*, GC, XExtCodes*
+);
+
+extern int (*XESetCreateFont(
+ Display* /* display */,
+ int /* extension */,
+ int (*) (
+ Display* /* display */,
+ XFontStruct* /* fs */,
+ XExtCodes* /* codes */
+ ) /* proc */
+))(
+ Display*, XFontStruct*, XExtCodes*
+);
+
+extern int (*XESetFreeFont(
+ Display* /* display */,
+ int /* extension */,
+ int (*) (
+ Display* /* display */,
+ XFontStruct* /* fs */,
+ XExtCodes* /* codes */
+ ) /* proc */
+))(
+ Display*, XFontStruct*, XExtCodes*
+);
+
+extern int (*XESetCloseDisplay(
+ Display* /* display */,
+ int /* extension */,
+ int (*) (
+ Display* /* display */,
+ XExtCodes* /* codes */
+ ) /* proc */
+))(
+ Display*, XExtCodes*
+);
+
+extern int (*XESetError(
+ Display* /* display */,
+ int /* extension */,
+ int (*) (
+ Display* /* display */,
+ xError* /* err */,
+ XExtCodes* /* codes */,
+ int* /* ret_code */
+ ) /* proc */
+))(
+ Display*, xError*, XExtCodes*, int*
+);
+
+extern char* (*XESetErrorString(
+ Display* /* display */,
+ int /* extension */,
+ char* (*) (
+ Display* /* display */,
+ int /* code */,
+ XExtCodes* /* codes */,
+ char* /* buffer */,
+ int /* nbytes */
+ ) /* proc */
+))(
+ Display*, int, XExtCodes*, char*, int
+);
+
+extern void (*XESetPrintErrorValues (
+ Display* /* display */,
+ int /* extension */,
+ void (*)(
+ Display* /* display */,
+ XErrorEvent* /* ev */,
+ void* /* fp */
+ ) /* proc */
+))(
+ Display*, XErrorEvent*, void*
+);
+
+extern Bool (*XESetWireToEvent(
+ Display* /* display */,
+ int /* event_number */,
+ Bool (*) (
+ Display* /* display */,
+ XEvent* /* re */,
+ xEvent* /* event */
+ ) /* proc */
+))(
+ Display*, XEvent*, xEvent*
+);
+
+extern Bool (*XESetWireToEventCookie(
+ Display* /* display */,
+ int /* extension */,
+ Bool (*) (
+ Display* /* display */,
+ XGenericEventCookie* /* re */,
+ xEvent* /* event */
+ ) /* proc */
+))(
+ Display*, XGenericEventCookie*, xEvent*
+);
+
+extern Bool (*XESetCopyEventCookie(
+ Display* /* display */,
+ int /* extension */,
+ Bool (*) (
+ Display* /* display */,
+ XGenericEventCookie* /* in */,
+ XGenericEventCookie* /* out */
+ ) /* proc */
+))(
+ Display*, XGenericEventCookie*, XGenericEventCookie*
+);
+
+
+extern Status (*XESetEventToWire(
+ Display* /* display */,
+ int /* event_number */,
+ Status (*) (
+ Display* /* display */,
+ XEvent* /* re */,
+ xEvent* /* event */
+ ) /* proc */
+))(
+ Display*, XEvent*, xEvent*
+);
+
+extern Bool (*XESetWireToError(
+ Display* /* display */,
+ int /* error_number */,
+ Bool (*) (
+ Display* /* display */,
+ XErrorEvent* /* he */,
+ xError* /* we */
+ ) /* proc */
+))(
+ Display*, XErrorEvent*, xError*
+);
+
+extern void (*XESetBeforeFlush(
+ Display* /* display */,
+ int /* error_number */,
+ void (*) (
+ Display* /* display */,
+ XExtCodes* /* codes */,
+ _Xconst char* /* data */,
+ long /* len */
+ ) /* proc */
+))(
+ Display*, XExtCodes*, _Xconst char*, long
+);
+
+/* internal connections for IMs */
+
+typedef void (*_XInternalConnectionProc)(
+ Display* /* dpy */,
+ int /* fd */,
+ XPointer /* call_data */
+);
+
+
+extern Status _XRegisterInternalConnection(
+ Display* /* dpy */,
+ int /* fd */,
+ _XInternalConnectionProc /* callback */,
+ XPointer /* call_data */
+);
+
+extern void _XUnregisterInternalConnection(
+ Display* /* dpy */,
+ int /* fd */
+);
+
+extern void _XProcessInternalConnection(
+ Display* /* dpy */,
+ struct _XConnectionInfo* /* conn_info */
+);
+
+/* Display structure has pointers to these */
+
+struct _XConnectionInfo { /* info from _XRegisterInternalConnection */
+ int fd;
+ _XInternalConnectionProc read_callback;
+ XPointer call_data;
+ XPointer *watch_data; /* set/used by XConnectionWatchProc */
+ struct _XConnectionInfo *next;
+};
+
+struct _XConnWatchInfo { /* info from XAddConnectionWatch */
+ XConnectionWatchProc fn;
+ XPointer client_data;
+ struct _XConnWatchInfo *next;
+};
+
+#ifdef __UNIXOS2__
+extern char* __XOS2RedirRoot(
+ char*
+);
+#endif
+
+extern int _XTextHeight(
+ XFontStruct* /* font_struct */,
+ _Xconst char* /* string */,
+ int /* count */
+);
+
+extern int _XTextHeight16(
+ XFontStruct* /* font_struct */,
+ _Xconst XChar2b* /* string */,
+ int /* count */
+);
+
+#if defined(WIN32)
+
+extern int _XOpenFile(
+ _Xconst char* /* path */,
+ int /* flags */
+);
+
+extern int _XOpenFileMode(
+ _Xconst char* /* path */,
+ int /* flags */,
+ mode_t /* mode */
+);
+
+extern void* _XFopenFile(
+ _Xconst char* /* path */,
+ _Xconst char* /* mode */
+);
+
+extern int _XAccessFile(
+ _Xconst char* /* path */
+);
+#else
+#define _XOpenFile(path,flags) open(path,flags)
+#define _XOpenFileMode(path,flags,mode) open(path,flags,mode)
+#define _XFopenFile(path,mode) fopen(path,mode)
+#endif
+
+/* EvToWire.c */
+extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event);
+
+extern int _XF86LoadQueryLocaleFont(
+ Display* /* dpy */,
+ _Xconst char* /* name*/,
+ XFontStruct** /* xfp*/,
+ Font* /* fidp */
+);
+
+extern void _XProcessWindowAttributes (
+ register Display *dpy,
+ xChangeWindowAttributesReq *req,
+ register unsigned long valuemask,
+ register XSetWindowAttributes *attributes);
+
+extern int _XDefaultError(
+ Display *dpy,
+ XErrorEvent *event);
+
+extern int _XDefaultIOError(
+ Display *dpy);
+
+extern void _XSetClipRectangles (
+ register Display *dpy,
+ GC gc,
+ int clip_x_origin, int clip_y_origin,
+ XRectangle *rectangles,
+ int n,
+ int ordering);
+
+Status _XGetWindowAttributes(
+ register Display *dpy,
+ Window w,
+ XWindowAttributes *attr);
+
+int _XPutBackEvent (
+ register Display *dpy,
+ register XEvent *event);
+
+extern Bool _XIsEventCookie(
+ Display *dpy,
+ XEvent *ev);
+
+extern void _XFreeEventCookies(
+ Display *dpy);
+
+extern void _XStoreEventCookie(
+ Display *dpy,
+ XEvent *ev);
+
+extern Bool _XFetchEventCookie(
+ Display *dpy,
+ XGenericEventCookie *ev);
+
+extern Bool _XCopyEventCookie(
+ Display *dpy,
+ XGenericEventCookie *in,
+ XGenericEventCookie *out);
+
+/* lcFile.c */
+
+extern void xlocaledir(
+ char *buf,
+ int buf_len
+);
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XLIBINT_H_ */
diff --git a/X11/Xutil.h b/X11/Xutil.h
index 134b4058c..62cdf5556 100644
--- a/X11/Xutil.h
+++ b/X11/Xutil.h
@@ -1,826 +1,838 @@
-
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifndef _X11_XUTIL_H_
-#define _X11_XUTIL_H_
-
-/* You must include <X11/Xlib.h> before including this file */
-#include <X11/Xlib.h>
-#include <X11/keysym.h>
-
-/*
- * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
- * value (x, y, width, height) was found in the parsed string.
- */
-#define NoValue 0x0000
-#define XValue 0x0001
-#define YValue 0x0002
-#define WidthValue 0x0004
-#define HeightValue 0x0008
-#define AllValues 0x000F
-#define XNegative 0x0010
-#define YNegative 0x0020
-
-/*
- * new version containing base_width, base_height, and win_gravity fields;
- * used with WM_NORMAL_HINTS.
- */
-typedef struct {
- long flags; /* marks which fields in this structure are defined */
- int x, y; /* obsolete for new window mgrs, but clients */
- int width, height; /* should set so old wm's don't mess up */
- int min_width, min_height;
- int max_width, max_height;
- int width_inc, height_inc;
- struct {
- int x; /* numerator */
- int y; /* denominator */
- } min_aspect, max_aspect;
- int base_width, base_height; /* added by ICCCM version 1 */
- int win_gravity; /* added by ICCCM version 1 */
-} XSizeHints;
-
-/*
- * The next block of definitions are for window manager properties that
- * clients and applications use for communication.
- */
-
-/* flags argument in size hints */
-#define USPosition (1L << 0) /* user specified x, y */
-#define USSize (1L << 1) /* user specified width, height */
-
-#define PPosition (1L << 2) /* program specified position */
-#define PSize (1L << 3) /* program specified size */
-#define PMinSize (1L << 4) /* program specified minimum size */
-#define PMaxSize (1L << 5) /* program specified maximum size */
-#define PResizeInc (1L << 6) /* program specified resize increments */
-#define PAspect (1L << 7) /* program specified min and max aspect ratios */
-#define PBaseSize (1L << 8) /* program specified base for incrementing */
-#define PWinGravity (1L << 9) /* program specified window gravity */
-
-/* obsolete */
-#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
-
-
-
-typedef struct {
- long flags; /* marks which fields in this structure are defined */
- Bool input; /* does this application rely on the window manager to
- get keyboard input? */
- int initial_state; /* see below */
- Pixmap icon_pixmap; /* pixmap to be used as icon */
- Window icon_window; /* window to be used as icon */
- int icon_x, icon_y; /* initial position of icon */
- Pixmap icon_mask; /* icon mask bitmap */
- XID window_group; /* id of related window group */
- /* this structure may be extended in the future */
-} XWMHints;
-
-/* definition for flags of XWMHints */
-
-#define InputHint (1L << 0)
-#define StateHint (1L << 1)
-#define IconPixmapHint (1L << 2)
-#define IconWindowHint (1L << 3)
-#define IconPositionHint (1L << 4)
-#define IconMaskHint (1L << 5)
-#define WindowGroupHint (1L << 6)
-#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
-IconPositionHint|IconMaskHint|WindowGroupHint)
-#define XUrgencyHint (1L << 8)
-
-/* definitions for initial window state */
-#define WithdrawnState 0 /* for windows that are not mapped */
-#define NormalState 1 /* most applications want to start this way */
-#define IconicState 3 /* application wants to start as an icon */
-
-/*
- * Obsolete states no longer defined by ICCCM
- */
-#define DontCareState 0 /* don't know or care */
-#define ZoomState 2 /* application wants to start zoomed */
-#define InactiveState 4 /* application believes it is seldom used; */
- /* some wm's may put it on inactive menu */
-
-
-/*
- * new structure for manipulating TEXT properties; used with WM_NAME,
- * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
- */
-typedef struct {
- unsigned char *value; /* same as Property routines */
- Atom encoding; /* prop type */
- int format; /* prop data format: 8, 16, or 32 */
- unsigned long nitems; /* number of data items in value */
-} XTextProperty;
-
-#define XNoMemory -1
-#define XLocaleNotSupported -2
-#define XConverterNotFound -3
-
-typedef enum {
- XStringStyle, /* STRING */
- XCompoundTextStyle, /* COMPOUND_TEXT */
- XTextStyle, /* text in owner's encoding (current locale)*/
- XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */
- /* The following is an XFree86 extension, introduced in November 2000 */
- XUTF8StringStyle /* UTF8_STRING */
-} XICCEncodingStyle;
-
-typedef struct {
- int min_width, min_height;
- int max_width, max_height;
- int width_inc, height_inc;
-} XIconSize;
-
-typedef struct {
- char *res_name;
- char *res_class;
-} XClassHint;
-
-#ifdef XUTIL_DEFINE_FUNCTIONS
-extern int XDestroyImage(
- XImage *ximage);
-extern unsigned long XGetPixel(
- XImage *ximage,
- int x, int y);
-extern int XPutPixel(
- XImage *ximage,
- int x, int y,
- unsigned long pixel);
-extern XImage *XSubImage(
- XImage *ximage,
- int x, int y,
- unsigned int width, unsigned int height);
-extern int XAddPixel(
- XImage *ximage,
- long value);
-#else
-/*
- * These macros are used to give some sugar to the image routines so that
- * naive people are more comfortable with them.
- */
-#define XDestroyImage(ximage) \
- ((*((ximage)->f.destroy_image))((ximage)))
-#define XGetPixel(ximage, x, y) \
- ((*((ximage)->f.get_pixel))((ximage), (x), (y)))
-#define XPutPixel(ximage, x, y, pixel) \
- ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
-#define XSubImage(ximage, x, y, width, height) \
- ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
-#define XAddPixel(ximage, value) \
- ((*((ximage)->f.add_pixel))((ximage), (value)))
-#endif
-
-/*
- * Compose sequence status structure, used in calling XLookupString.
- */
-typedef struct _XComposeStatus {
- XPointer compose_ptr; /* state table pointer */
- int chars_matched; /* match state */
-} XComposeStatus;
-
-/*
- * Keysym macros, used on Keysyms to test for classes of symbols
- */
-#define IsKeypadKey(keysym) \
- (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
-
-#define IsPrivateKeypadKey(keysym) \
- (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
-
-#define IsCursorKey(keysym) \
- (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
-
-#define IsPFKey(keysym) \
- (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
-
-#define IsFunctionKey(keysym) \
- (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
-
-#define IsMiscFunctionKey(keysym) \
- (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
-
-#ifdef XK_XKB_KEYS
-#define IsModifierKey(keysym) \
- ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
- || (((KeySym)(keysym) >= XK_ISO_Lock) && \
- ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \
- || ((KeySym)(keysym) == XK_Mode_switch) \
- || ((KeySym)(keysym) == XK_Num_Lock))
-#else
-#define IsModifierKey(keysym) \
- ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
- || ((KeySym)(keysym) == XK_Mode_switch) \
- || ((KeySym)(keysym) == XK_Num_Lock))
-#endif
-/*
- * opaque reference to Region data type
- */
-typedef struct _XRegion *Region;
-
-/* Return values from XRectInRegion() */
-
-#define RectangleOut 0
-#define RectangleIn 1
-#define RectanglePart 2
-
-
-/*
- * Information used by the visual utility routines to find desired visual
- * type from the many visuals a display may support.
- */
-
-typedef struct {
- Visual *visual;
- VisualID visualid;
- int screen;
- int depth;
-#if defined(__cplusplus) || defined(c_plusplus)
- int c_class; /* C++ */
-#else
- int class;
-#endif
- unsigned long red_mask;
- unsigned long green_mask;
- unsigned long blue_mask;
- int colormap_size;
- int bits_per_rgb;
-} XVisualInfo;
-
-#define VisualNoMask 0x0
-#define VisualIDMask 0x1
-#define VisualScreenMask 0x2
-#define VisualDepthMask 0x4
-#define VisualClassMask 0x8
-#define VisualRedMaskMask 0x10
-#define VisualGreenMaskMask 0x20
-#define VisualBlueMaskMask 0x40
-#define VisualColormapSizeMask 0x80
-#define VisualBitsPerRGBMask 0x100
-#define VisualAllMask 0x1FF
-
-/*
- * This defines a window manager property that clients may use to
- * share standard color maps of type RGB_COLOR_MAP:
- */
-typedef struct {
- Colormap colormap;
- unsigned long red_max;
- unsigned long red_mult;
- unsigned long green_max;
- unsigned long green_mult;
- unsigned long blue_max;
- unsigned long blue_mult;
- unsigned long base_pixel;
- VisualID visualid; /* added by ICCCM version 1 */
- XID killid; /* added by ICCCM version 1 */
-} XStandardColormap;
-
-#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
-
-
-/*
- * return codes for XReadBitmapFile and XWriteBitmapFile
- */
-#define BitmapSuccess 0
-#define BitmapOpenFailed 1
-#define BitmapFileInvalid 2
-#define BitmapNoMemory 3
-
-/****************************************************************
- *
- * Context Management
- *
- ****************************************************************/
-
-
-/* Associative lookup table return codes */
-
-#define XCSUCCESS 0 /* No error. */
-#define XCNOMEM 1 /* Out of memory */
-#define XCNOENT 2 /* No entry in table */
-
-typedef int XContext;
-
-#define XUniqueContext() ((XContext) XrmUniqueQuark())
-#define XStringToContext(string) ((XContext) XrmStringToQuark(string))
-
-_XFUNCPROTOBEGIN
-
-/* The following declarations are alphabetized. */
-
-extern XClassHint *XAllocClassHint (
- void
-);
-
-extern XIconSize *XAllocIconSize (
- void
-);
-
-extern XSizeHints *XAllocSizeHints (
- void
-);
-
-extern XStandardColormap *XAllocStandardColormap (
- void
-);
-
-extern XWMHints *XAllocWMHints (
- void
-);
-
-extern int XClipBox(
- Region /* r */,
- XRectangle* /* rect_return */
-);
-
-extern Region XCreateRegion(
- void
-);
-
-extern const char *XDefaultString (void);
-
-extern int XDeleteContext(
- Display* /* display */,
- XID /* rid */,
- XContext /* context */
-);
-
-extern int XDestroyRegion(
- Region /* r */
-);
-
-extern int XEmptyRegion(
- Region /* r */
-);
-
-extern int XEqualRegion(
- Region /* r1 */,
- Region /* r2 */
-);
-
-extern int XFindContext(
- Display* /* display */,
- XID /* rid */,
- XContext /* context */,
- XPointer* /* data_return */
-);
-
-extern Status XGetClassHint(
- Display* /* display */,
- Window /* w */,
- XClassHint* /* class_hints_return */
-);
-
-extern Status XGetIconSizes(
- Display* /* display */,
- Window /* w */,
- XIconSize** /* size_list_return */,
- int* /* count_return */
-);
-
-extern Status XGetNormalHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints_return */
-);
-
-extern Status XGetRGBColormaps(
- Display* /* display */,
- Window /* w */,
- XStandardColormap** /* stdcmap_return */,
- int* /* count_return */,
- Atom /* property */
-);
-
-extern Status XGetSizeHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints_return */,
- Atom /* property */
-);
-
-extern Status XGetStandardColormap(
- Display* /* display */,
- Window /* w */,
- XStandardColormap* /* colormap_return */,
- Atom /* property */
-);
-
-extern Status XGetTextProperty(
- Display* /* display */,
- Window /* window */,
- XTextProperty* /* text_prop_return */,
- Atom /* property */
-);
-
-extern XVisualInfo *XGetVisualInfo(
- Display* /* display */,
- long /* vinfo_mask */,
- XVisualInfo* /* vinfo_template */,
- int* /* nitems_return */
-);
-
-extern Status XGetWMClientMachine(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop_return */
-);
-
-extern XWMHints *XGetWMHints(
- Display* /* display */,
- Window /* w */
-);
-
-extern Status XGetWMIconName(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop_return */
-);
-
-extern Status XGetWMName(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop_return */
-);
-
-extern Status XGetWMNormalHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints_return */,
- long* /* supplied_return */
-);
-
-extern Status XGetWMSizeHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints_return */,
- long* /* supplied_return */,
- Atom /* property */
-);
-
-extern Status XGetZoomHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* zhints_return */
-);
-
-extern int XIntersectRegion(
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-);
-
-extern void XConvertCase(
- KeySym /* sym */,
- KeySym* /* lower */,
- KeySym* /* upper */
-);
-
-extern int XLookupString(
- XKeyEvent* /* event_struct */,
- char* /* buffer_return */,
- int /* bytes_buffer */,
- KeySym* /* keysym_return */,
- XComposeStatus* /* status_in_out */
-);
-
-extern Status XMatchVisualInfo(
- Display* /* display */,
- int /* screen */,
- int /* depth */,
- int /* class */,
- XVisualInfo* /* vinfo_return */
-);
-
-extern int XOffsetRegion(
- Region /* r */,
- int /* dx */,
- int /* dy */
-);
-
-extern Bool XPointInRegion(
- Region /* r */,
- int /* x */,
- int /* y */
-);
-
-extern Region XPolygonRegion(
- XPoint* /* points */,
- int /* n */,
- int /* fill_rule */
-);
-
-extern int XRectInRegion(
- Region /* r */,
- int /* x */,
- int /* y */,
- unsigned int /* width */,
- unsigned int /* height */
-);
-
-extern int XSaveContext(
- Display* /* display */,
- XID /* rid */,
- XContext /* context */,
- _Xconst char* /* data */
-);
-
-extern int XSetClassHint(
- Display* /* display */,
- Window /* w */,
- XClassHint* /* class_hints */
-);
-
-extern int XSetIconSizes(
- Display* /* display */,
- Window /* w */,
- XIconSize* /* size_list */,
- int /* count */
-);
-
-extern int XSetNormalHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints */
-);
-
-extern void XSetRGBColormaps(
- Display* /* display */,
- Window /* w */,
- XStandardColormap* /* stdcmaps */,
- int /* count */,
- Atom /* property */
-);
-
-extern int XSetSizeHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints */,
- Atom /* property */
-);
-
-extern int XSetStandardProperties(
- Display* /* display */,
- Window /* w */,
- _Xconst char* /* window_name */,
- _Xconst char* /* icon_name */,
- Pixmap /* icon_pixmap */,
- char** /* argv */,
- int /* argc */,
- XSizeHints* /* hints */
-);
-
-extern void XSetTextProperty(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop */,
- Atom /* property */
-);
-
-extern void XSetWMClientMachine(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop */
-);
-
-extern int XSetWMHints(
- Display* /* display */,
- Window /* w */,
- XWMHints* /* wm_hints */
-);
-
-extern void XSetWMIconName(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop */
-);
-
-extern void XSetWMName(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* text_prop */
-);
-
-extern void XSetWMNormalHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints */
-);
-
-extern void XSetWMProperties(
- Display* /* display */,
- Window /* w */,
- XTextProperty* /* window_name */,
- XTextProperty* /* icon_name */,
- char** /* argv */,
- int /* argc */,
- XSizeHints* /* normal_hints */,
- XWMHints* /* wm_hints */,
- XClassHint* /* class_hints */
-);
-
-extern void XmbSetWMProperties(
- Display* /* display */,
- Window /* w */,
- _Xconst char* /* window_name */,
- _Xconst char* /* icon_name */,
- char** /* argv */,
- int /* argc */,
- XSizeHints* /* normal_hints */,
- XWMHints* /* wm_hints */,
- XClassHint* /* class_hints */
-);
-
-extern void Xutf8SetWMProperties(
- Display* /* display */,
- Window /* w */,
- _Xconst char* /* window_name */,
- _Xconst char* /* icon_name */,
- char** /* argv */,
- int /* argc */,
- XSizeHints* /* normal_hints */,
- XWMHints* /* wm_hints */,
- XClassHint* /* class_hints */
-);
-
-extern void XSetWMSizeHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* hints */,
- Atom /* property */
-);
-
-extern int XSetRegion(
- Display* /* display */,
- GC /* gc */,
- Region /* r */
-);
-
-extern void XSetStandardColormap(
- Display* /* display */,
- Window /* w */,
- XStandardColormap* /* colormap */,
- Atom /* property */
-);
-
-extern int XSetZoomHints(
- Display* /* display */,
- Window /* w */,
- XSizeHints* /* zhints */
-);
-
-extern int XShrinkRegion(
- Region /* r */,
- int /* dx */,
- int /* dy */
-);
-
-extern Status XStringListToTextProperty(
- char** /* list */,
- int /* count */,
- XTextProperty* /* text_prop_return */
-);
-
-extern int XSubtractRegion(
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-);
-
-extern int XmbTextListToTextProperty(
- Display* display,
- char** list,
- int count,
- XICCEncodingStyle style,
- XTextProperty* text_prop_return
-);
-
-extern int XwcTextListToTextProperty(
- Display* display,
- wchar_t** list,
- int count,
- XICCEncodingStyle style,
- XTextProperty* text_prop_return
-);
-
-extern int Xutf8TextListToTextProperty(
- Display* display,
- char** list,
- int count,
- XICCEncodingStyle style,
- XTextProperty* text_prop_return
-);
-
-extern void XwcFreeStringList(
- wchar_t** list
-);
-
-extern Status XTextPropertyToStringList(
- XTextProperty* /* text_prop */,
- char*** /* list_return */,
- int* /* count_return */
-);
-
-extern int XmbTextPropertyToTextList(
- Display* display,
- const XTextProperty* text_prop,
- char*** list_return,
- int* count_return
-);
-
-extern int XwcTextPropertyToTextList(
- Display* display,
- const XTextProperty* text_prop,
- wchar_t*** list_return,
- int* count_return
-);
-
-extern int Xutf8TextPropertyToTextList(
- Display* display,
- const XTextProperty* text_prop,
- char*** list_return,
- int* count_return
-);
-
-extern int XUnionRectWithRegion(
- XRectangle* /* rectangle */,
- Region /* src_region */,
- Region /* dest_region_return */
-);
-
-extern int XUnionRegion(
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-);
-
-extern int XWMGeometry(
- Display* /* display */,
- int /* screen_number */,
- _Xconst char* /* user_geometry */,
- _Xconst char* /* default_geometry */,
- unsigned int /* border_width */,
- XSizeHints* /* hints */,
- int* /* x_return */,
- int* /* y_return */,
- int* /* width_return */,
- int* /* height_return */,
- int* /* gravity_return */
-);
-
-extern int XXorRegion(
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-);
-
-_XFUNCPROTOEND
-
-#endif /* _X11_XUTIL_H_ */
+
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _X11_XUTIL_H_
+#define _X11_XUTIL_H_
+
+/* You must include <X11/Xlib.h> before including this file */
+#include <X11/Xlib.h>
+#include <X11/keysym.h>
+
+/* The Xlib structs are full of implicit padding to properly align members.
+ We can't clean that up without breaking ABI, so tell clang not to bother
+ complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+/*
+ * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
+ * value (x, y, width, height) was found in the parsed string.
+ */
+#define NoValue 0x0000
+#define XValue 0x0001
+#define YValue 0x0002
+#define WidthValue 0x0004
+#define HeightValue 0x0008
+#define AllValues 0x000F
+#define XNegative 0x0010
+#define YNegative 0x0020
+
+/*
+ * new version containing base_width, base_height, and win_gravity fields;
+ * used with WM_NORMAL_HINTS.
+ */
+typedef struct {
+ long flags; /* marks which fields in this structure are defined */
+ int x, y; /* obsolete for new window mgrs, but clients */
+ int width, height; /* should set so old wm's don't mess up */
+ int min_width, min_height;
+ int max_width, max_height;
+ int width_inc, height_inc;
+ struct {
+ int x; /* numerator */
+ int y; /* denominator */
+ } min_aspect, max_aspect;
+ int base_width, base_height; /* added by ICCCM version 1 */
+ int win_gravity; /* added by ICCCM version 1 */
+} XSizeHints;
+
+/*
+ * The next block of definitions are for window manager properties that
+ * clients and applications use for communication.
+ */
+
+/* flags argument in size hints */
+#define USPosition (1L << 0) /* user specified x, y */
+#define USSize (1L << 1) /* user specified width, height */
+
+#define PPosition (1L << 2) /* program specified position */
+#define PSize (1L << 3) /* program specified size */
+#define PMinSize (1L << 4) /* program specified minimum size */
+#define PMaxSize (1L << 5) /* program specified maximum size */
+#define PResizeInc (1L << 6) /* program specified resize increments */
+#define PAspect (1L << 7) /* program specified min and max aspect ratios */
+#define PBaseSize (1L << 8) /* program specified base for incrementing */
+#define PWinGravity (1L << 9) /* program specified window gravity */
+
+/* obsolete */
+#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
+
+
+
+typedef struct {
+ long flags; /* marks which fields in this structure are defined */
+ Bool input; /* does this application rely on the window manager to
+ get keyboard input? */
+ int initial_state; /* see below */
+ Pixmap icon_pixmap; /* pixmap to be used as icon */
+ Window icon_window; /* window to be used as icon */
+ int icon_x, icon_y; /* initial position of icon */
+ Pixmap icon_mask; /* icon mask bitmap */
+ XID window_group; /* id of related window group */
+ /* this structure may be extended in the future */
+} XWMHints;
+
+/* definition for flags of XWMHints */
+
+#define InputHint (1L << 0)
+#define StateHint (1L << 1)
+#define IconPixmapHint (1L << 2)
+#define IconWindowHint (1L << 3)
+#define IconPositionHint (1L << 4)
+#define IconMaskHint (1L << 5)
+#define WindowGroupHint (1L << 6)
+#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
+IconPositionHint|IconMaskHint|WindowGroupHint)
+#define XUrgencyHint (1L << 8)
+
+/* definitions for initial window state */
+#define WithdrawnState 0 /* for windows that are not mapped */
+#define NormalState 1 /* most applications want to start this way */
+#define IconicState 3 /* application wants to start as an icon */
+
+/*
+ * Obsolete states no longer defined by ICCCM
+ */
+#define DontCareState 0 /* don't know or care */
+#define ZoomState 2 /* application wants to start zoomed */
+#define InactiveState 4 /* application believes it is seldom used; */
+ /* some wm's may put it on inactive menu */
+
+
+/*
+ * new structure for manipulating TEXT properties; used with WM_NAME,
+ * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
+ */
+typedef struct {
+ unsigned char *value; /* same as Property routines */
+ Atom encoding; /* prop type */
+ int format; /* prop data format: 8, 16, or 32 */
+ unsigned long nitems; /* number of data items in value */
+} XTextProperty;
+
+#define XNoMemory -1
+#define XLocaleNotSupported -2
+#define XConverterNotFound -3
+
+typedef enum {
+ XStringStyle, /* STRING */
+ XCompoundTextStyle, /* COMPOUND_TEXT */
+ XTextStyle, /* text in owner's encoding (current locale)*/
+ XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */
+ /* The following is an XFree86 extension, introduced in November 2000 */
+ XUTF8StringStyle /* UTF8_STRING */
+} XICCEncodingStyle;
+
+typedef struct {
+ int min_width, min_height;
+ int max_width, max_height;
+ int width_inc, height_inc;
+} XIconSize;
+
+typedef struct {
+ char *res_name;
+ char *res_class;
+} XClassHint;
+
+#ifdef XUTIL_DEFINE_FUNCTIONS
+extern int XDestroyImage(
+ XImage *ximage);
+extern unsigned long XGetPixel(
+ XImage *ximage,
+ int x, int y);
+extern int XPutPixel(
+ XImage *ximage,
+ int x, int y,
+ unsigned long pixel);
+extern XImage *XSubImage(
+ XImage *ximage,
+ int x, int y,
+ unsigned int width, unsigned int height);
+extern int XAddPixel(
+ XImage *ximage,
+ long value);
+#else
+/*
+ * These macros are used to give some sugar to the image routines so that
+ * naive people are more comfortable with them.
+ */
+#define XDestroyImage(ximage) \
+ ((*((ximage)->f.destroy_image))((ximage)))
+#define XGetPixel(ximage, x, y) \
+ ((*((ximage)->f.get_pixel))((ximage), (x), (y)))
+#define XPutPixel(ximage, x, y, pixel) \
+ ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
+#define XSubImage(ximage, x, y, width, height) \
+ ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
+#define XAddPixel(ximage, value) \
+ ((*((ximage)->f.add_pixel))((ximage), (value)))
+#endif
+
+/*
+ * Compose sequence status structure, used in calling XLookupString.
+ */
+typedef struct _XComposeStatus {
+ XPointer compose_ptr; /* state table pointer */
+ int chars_matched; /* match state */
+} XComposeStatus;
+
+/*
+ * Keysym macros, used on Keysyms to test for classes of symbols
+ */
+#define IsKeypadKey(keysym) \
+ (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
+
+#define IsPrivateKeypadKey(keysym) \
+ (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
+
+#define IsCursorKey(keysym) \
+ (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
+
+#define IsPFKey(keysym) \
+ (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
+
+#define IsFunctionKey(keysym) \
+ (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
+
+#define IsMiscFunctionKey(keysym) \
+ (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
+
+#ifdef XK_XKB_KEYS
+#define IsModifierKey(keysym) \
+ ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
+ || (((KeySym)(keysym) >= XK_ISO_Lock) && \
+ ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \
+ || ((KeySym)(keysym) == XK_Mode_switch) \
+ || ((KeySym)(keysym) == XK_Num_Lock))
+#else
+#define IsModifierKey(keysym) \
+ ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
+ || ((KeySym)(keysym) == XK_Mode_switch) \
+ || ((KeySym)(keysym) == XK_Num_Lock))
+#endif
+/*
+ * opaque reference to Region data type
+ */
+typedef struct _XRegion *Region;
+
+/* Return values from XRectInRegion() */
+
+#define RectangleOut 0
+#define RectangleIn 1
+#define RectanglePart 2
+
+
+/*
+ * Information used by the visual utility routines to find desired visual
+ * type from the many visuals a display may support.
+ */
+
+typedef struct {
+ Visual *visual;
+ VisualID visualid;
+ int screen;
+ int depth;
+#if defined(__cplusplus) || defined(c_plusplus)
+ int c_class; /* C++ */
+#else
+ int class;
+#endif
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ int colormap_size;
+ int bits_per_rgb;
+} XVisualInfo;
+
+#define VisualNoMask 0x0
+#define VisualIDMask 0x1
+#define VisualScreenMask 0x2
+#define VisualDepthMask 0x4
+#define VisualClassMask 0x8
+#define VisualRedMaskMask 0x10
+#define VisualGreenMaskMask 0x20
+#define VisualBlueMaskMask 0x40
+#define VisualColormapSizeMask 0x80
+#define VisualBitsPerRGBMask 0x100
+#define VisualAllMask 0x1FF
+
+/*
+ * This defines a window manager property that clients may use to
+ * share standard color maps of type RGB_COLOR_MAP:
+ */
+typedef struct {
+ Colormap colormap;
+ unsigned long red_max;
+ unsigned long red_mult;
+ unsigned long green_max;
+ unsigned long green_mult;
+ unsigned long blue_max;
+ unsigned long blue_mult;
+ unsigned long base_pixel;
+ VisualID visualid; /* added by ICCCM version 1 */
+ XID killid; /* added by ICCCM version 1 */
+} XStandardColormap;
+
+#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
+
+
+/*
+ * return codes for XReadBitmapFile and XWriteBitmapFile
+ */
+#define BitmapSuccess 0
+#define BitmapOpenFailed 1
+#define BitmapFileInvalid 2
+#define BitmapNoMemory 3
+
+/****************************************************************
+ *
+ * Context Management
+ *
+ ****************************************************************/
+
+
+/* Associative lookup table return codes */
+
+#define XCSUCCESS 0 /* No error. */
+#define XCNOMEM 1 /* Out of memory */
+#define XCNOENT 2 /* No entry in table */
+
+typedef int XContext;
+
+#define XUniqueContext() ((XContext) XrmUniqueQuark())
+#define XStringToContext(string) ((XContext) XrmStringToQuark(string))
+
+_XFUNCPROTOBEGIN
+
+/* The following declarations are alphabetized. */
+
+extern XClassHint *XAllocClassHint (
+ void
+);
+
+extern XIconSize *XAllocIconSize (
+ void
+);
+
+extern XSizeHints *XAllocSizeHints (
+ void
+);
+
+extern XStandardColormap *XAllocStandardColormap (
+ void
+);
+
+extern XWMHints *XAllocWMHints (
+ void
+);
+
+extern int XClipBox(
+ Region /* r */,
+ XRectangle* /* rect_return */
+);
+
+extern Region XCreateRegion(
+ void
+);
+
+extern const char *XDefaultString (void);
+
+extern int XDeleteContext(
+ Display* /* display */,
+ XID /* rid */,
+ XContext /* context */
+);
+
+extern int XDestroyRegion(
+ Region /* r */
+);
+
+extern int XEmptyRegion(
+ Region /* r */
+);
+
+extern int XEqualRegion(
+ Region /* r1 */,
+ Region /* r2 */
+);
+
+extern int XFindContext(
+ Display* /* display */,
+ XID /* rid */,
+ XContext /* context */,
+ XPointer* /* data_return */
+);
+
+extern Status XGetClassHint(
+ Display* /* display */,
+ Window /* w */,
+ XClassHint* /* class_hints_return */
+);
+
+extern Status XGetIconSizes(
+ Display* /* display */,
+ Window /* w */,
+ XIconSize** /* size_list_return */,
+ int* /* count_return */
+);
+
+extern Status XGetNormalHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints_return */
+);
+
+extern Status XGetRGBColormaps(
+ Display* /* display */,
+ Window /* w */,
+ XStandardColormap** /* stdcmap_return */,
+ int* /* count_return */,
+ Atom /* property */
+);
+
+extern Status XGetSizeHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints_return */,
+ Atom /* property */
+);
+
+extern Status XGetStandardColormap(
+ Display* /* display */,
+ Window /* w */,
+ XStandardColormap* /* colormap_return */,
+ Atom /* property */
+);
+
+extern Status XGetTextProperty(
+ Display* /* display */,
+ Window /* window */,
+ XTextProperty* /* text_prop_return */,
+ Atom /* property */
+);
+
+extern XVisualInfo *XGetVisualInfo(
+ Display* /* display */,
+ long /* vinfo_mask */,
+ XVisualInfo* /* vinfo_template */,
+ int* /* nitems_return */
+);
+
+extern Status XGetWMClientMachine(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop_return */
+);
+
+extern XWMHints *XGetWMHints(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern Status XGetWMIconName(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop_return */
+);
+
+extern Status XGetWMName(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop_return */
+);
+
+extern Status XGetWMNormalHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints_return */,
+ long* /* supplied_return */
+);
+
+extern Status XGetWMSizeHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints_return */,
+ long* /* supplied_return */,
+ Atom /* property */
+);
+
+extern Status XGetZoomHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* zhints_return */
+);
+
+extern int XIntersectRegion(
+ Region /* sra */,
+ Region /* srb */,
+ Region /* dr_return */
+);
+
+extern void XConvertCase(
+ KeySym /* sym */,
+ KeySym* /* lower */,
+ KeySym* /* upper */
+);
+
+extern int XLookupString(
+ XKeyEvent* /* event_struct */,
+ char* /* buffer_return */,
+ int /* bytes_buffer */,
+ KeySym* /* keysym_return */,
+ XComposeStatus* /* status_in_out */
+);
+
+extern Status XMatchVisualInfo(
+ Display* /* display */,
+ int /* screen */,
+ int /* depth */,
+ int /* class */,
+ XVisualInfo* /* vinfo_return */
+);
+
+extern int XOffsetRegion(
+ Region /* r */,
+ int /* dx */,
+ int /* dy */
+);
+
+extern Bool XPointInRegion(
+ Region /* r */,
+ int /* x */,
+ int /* y */
+);
+
+extern Region XPolygonRegion(
+ XPoint* /* points */,
+ int /* n */,
+ int /* fill_rule */
+);
+
+extern int XRectInRegion(
+ Region /* r */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+extern int XSaveContext(
+ Display* /* display */,
+ XID /* rid */,
+ XContext /* context */,
+ _Xconst char* /* data */
+);
+
+extern int XSetClassHint(
+ Display* /* display */,
+ Window /* w */,
+ XClassHint* /* class_hints */
+);
+
+extern int XSetIconSizes(
+ Display* /* display */,
+ Window /* w */,
+ XIconSize* /* size_list */,
+ int /* count */
+);
+
+extern int XSetNormalHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints */
+);
+
+extern void XSetRGBColormaps(
+ Display* /* display */,
+ Window /* w */,
+ XStandardColormap* /* stdcmaps */,
+ int /* count */,
+ Atom /* property */
+);
+
+extern int XSetSizeHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints */,
+ Atom /* property */
+);
+
+extern int XSetStandardProperties(
+ Display* /* display */,
+ Window /* w */,
+ _Xconst char* /* window_name */,
+ _Xconst char* /* icon_name */,
+ Pixmap /* icon_pixmap */,
+ char** /* argv */,
+ int /* argc */,
+ XSizeHints* /* hints */
+);
+
+extern void XSetTextProperty(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop */,
+ Atom /* property */
+);
+
+extern void XSetWMClientMachine(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop */
+);
+
+extern int XSetWMHints(
+ Display* /* display */,
+ Window /* w */,
+ XWMHints* /* wm_hints */
+);
+
+extern void XSetWMIconName(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop */
+);
+
+extern void XSetWMName(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop */
+);
+
+extern void XSetWMNormalHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints */
+);
+
+extern void XSetWMProperties(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* window_name */,
+ XTextProperty* /* icon_name */,
+ char** /* argv */,
+ int /* argc */,
+ XSizeHints* /* normal_hints */,
+ XWMHints* /* wm_hints */,
+ XClassHint* /* class_hints */
+);
+
+extern void XmbSetWMProperties(
+ Display* /* display */,
+ Window /* w */,
+ _Xconst char* /* window_name */,
+ _Xconst char* /* icon_name */,
+ char** /* argv */,
+ int /* argc */,
+ XSizeHints* /* normal_hints */,
+ XWMHints* /* wm_hints */,
+ XClassHint* /* class_hints */
+);
+
+extern void Xutf8SetWMProperties(
+ Display* /* display */,
+ Window /* w */,
+ _Xconst char* /* window_name */,
+ _Xconst char* /* icon_name */,
+ char** /* argv */,
+ int /* argc */,
+ XSizeHints* /* normal_hints */,
+ XWMHints* /* wm_hints */,
+ XClassHint* /* class_hints */
+);
+
+extern void XSetWMSizeHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints */,
+ Atom /* property */
+);
+
+extern int XSetRegion(
+ Display* /* display */,
+ GC /* gc */,
+ Region /* r */
+);
+
+extern void XSetStandardColormap(
+ Display* /* display */,
+ Window /* w */,
+ XStandardColormap* /* colormap */,
+ Atom /* property */
+);
+
+extern int XSetZoomHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* zhints */
+);
+
+extern int XShrinkRegion(
+ Region /* r */,
+ int /* dx */,
+ int /* dy */
+);
+
+extern Status XStringListToTextProperty(
+ char** /* list */,
+ int /* count */,
+ XTextProperty* /* text_prop_return */
+);
+
+extern int XSubtractRegion(
+ Region /* sra */,
+ Region /* srb */,
+ Region /* dr_return */
+);
+
+extern int XmbTextListToTextProperty(
+ Display* display,
+ char** list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty* text_prop_return
+);
+
+extern int XwcTextListToTextProperty(
+ Display* display,
+ wchar_t** list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty* text_prop_return
+);
+
+extern int Xutf8TextListToTextProperty(
+ Display* display,
+ char** list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty* text_prop_return
+);
+
+extern void XwcFreeStringList(
+ wchar_t** list
+);
+
+extern Status XTextPropertyToStringList(
+ XTextProperty* /* text_prop */,
+ char*** /* list_return */,
+ int* /* count_return */
+);
+
+extern int XmbTextPropertyToTextList(
+ Display* display,
+ const XTextProperty* text_prop,
+ char*** list_return,
+ int* count_return
+);
+
+extern int XwcTextPropertyToTextList(
+ Display* display,
+ const XTextProperty* text_prop,
+ wchar_t*** list_return,
+ int* count_return
+);
+
+extern int Xutf8TextPropertyToTextList(
+ Display* display,
+ const XTextProperty* text_prop,
+ char*** list_return,
+ int* count_return
+);
+
+extern int XUnionRectWithRegion(
+ XRectangle* /* rectangle */,
+ Region /* src_region */,
+ Region /* dest_region_return */
+);
+
+extern int XUnionRegion(
+ Region /* sra */,
+ Region /* srb */,
+ Region /* dr_return */
+);
+
+extern int XWMGeometry(
+ Display* /* display */,
+ int /* screen_number */,
+ _Xconst char* /* user_geometry */,
+ _Xconst char* /* default_geometry */,
+ unsigned int /* border_width */,
+ XSizeHints* /* hints */,
+ int* /* x_return */,
+ int* /* y_return */,
+ int* /* width_return */,
+ int* /* height_return */,
+ int* /* gravity_return */
+);
+
+extern int XXorRegion(
+ Region /* sra */,
+ Region /* srb */,
+ Region /* dr_return */
+);
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XUTIL_H_ */
diff --git a/xorg-server/glx/glprocs.h b/xorg-server/glx/glprocs.h
index 9eca81d47..23c6b5d74 100644
--- a/xorg-server/glx/glprocs.h
+++ b/xorg-server/glx/glprocs.h
@@ -1556,9 +1556,6 @@ static const char gl_string_table[] =
#define gl_dispatch_stub_726 mgl_dispatch_stub_726
#define gl_dispatch_stub_727 mgl_dispatch_stub_727
#define gl_dispatch_stub_728 mgl_dispatch_stub_728
-#define gl_dispatch_stub_783 mgl_dispatch_stub_783
-#define gl_dispatch_stub_784 mgl_dispatch_stub_784
-#define gl_dispatch_stub_785 mgl_dispatch_stub_785
#define gl_dispatch_stub_828 mgl_dispatch_stub_828
#define gl_dispatch_stub_829 mgl_dispatch_stub_829
#define gl_dispatch_stub_830 mgl_dispatch_stub_830
@@ -1648,9 +1645,6 @@ void GLAPIENTRY gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params
void GLAPIENTRY gl_dispatch_stub_726(GLuint id, GLenum pname, GLint64 * params);
void GLAPIENTRY gl_dispatch_stub_727(GLuint id, GLenum pname, GLuint64 * params);
void GLAPIENTRY gl_dispatch_stub_728(GLuint id, GLenum target);
-void GLAPIENTRY gl_dispatch_stub_783(GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, GLvoid * binary);
-void GLAPIENTRY gl_dispatch_stub_784(GLuint program, GLenum binaryFormat, const GLvoid * binary, GLsizei length);
-void GLAPIENTRY gl_dispatch_stub_785(GLuint program, GLenum pname, GLint value);
void GLAPIENTRY gl_dispatch_stub_828(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
void GLAPIENTRY gl_dispatch_stub_829(const GLfloat * coords);
void GLAPIENTRY gl_dispatch_stub_830(GLint x, GLint y, GLint z, GLint width, GLint height);
@@ -2506,9 +2500,9 @@ static const glprocs_table_t static_functions[] = {
NAME_FUNC_OFFSET(12765, glGetShaderPrecisionFormat, glGetShaderPrecisionFormat, NULL, 780),
NAME_FUNC_OFFSET(12792, glReleaseShaderCompiler, glReleaseShaderCompiler, NULL, 781),
NAME_FUNC_OFFSET(12816, glShaderBinary, glShaderBinary, NULL, 782),
- NAME_FUNC_OFFSET(12831, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, 783),
- NAME_FUNC_OFFSET(12850, gl_dispatch_stub_784, gl_dispatch_stub_784, NULL, 784),
- NAME_FUNC_OFFSET(12866, gl_dispatch_stub_785, gl_dispatch_stub_785, NULL, 785),
+ NAME_FUNC_OFFSET(12831, glGetProgramBinary, glGetProgramBinary, NULL, 783),
+ NAME_FUNC_OFFSET(12850, glProgramBinary, glProgramBinary, NULL, 784),
+ NAME_FUNC_OFFSET(12866, glProgramParameteri, glProgramParameteri, NULL, 785),
NAME_FUNC_OFFSET(12886, glDebugMessageCallbackARB, glDebugMessageCallbackARB, NULL, 786),
NAME_FUNC_OFFSET(12912, glDebugMessageControlARB, glDebugMessageControlARB, NULL, 787),
NAME_FUNC_OFFSET(12937, glDebugMessageInsertARB, glDebugMessageInsertARB, NULL, 788),
@@ -3140,9 +3134,9 @@ static const glprocs_table_t static_functions[] = {
NAME_FUNC_OFFSET(26039, gl_dispatch_stub_727, gl_dispatch_stub_727, NULL, 727),
NAME_FUNC_OFFSET(26064, glClearDepthf, glClearDepthf, NULL, 778),
NAME_FUNC_OFFSET(26081, glDepthRangef, glDepthRangef, NULL, 779),
- NAME_FUNC_OFFSET(26098, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, 783),
- NAME_FUNC_OFFSET(26120, gl_dispatch_stub_784, gl_dispatch_stub_784, NULL, 784),
- NAME_FUNC_OFFSET(26139, gl_dispatch_stub_785, gl_dispatch_stub_785, NULL, 785),
+ NAME_FUNC_OFFSET(26098, glGetProgramBinary, glGetProgramBinary, NULL, 783),
+ NAME_FUNC_OFFSET(26120, glProgramBinary, glProgramBinary, NULL, 784),
+ NAME_FUNC_OFFSET(26139, glProgramParameteri, glProgramParameteri, NULL, 785),
NAME_FUNC_OFFSET(26162, gl_dispatch_stub_838, gl_dispatch_stub_838, NULL, 838),
NAME_FUNC_OFFSET(26178, gl_dispatch_stub_839, gl_dispatch_stub_839, NULL, 839),
NAME_FUNC_OFFSET(26197, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 848),