New upstream version 3.5.99.27
This commit is contained in:
32
nx-X11/lib/include/Makefile.am
Normal file
32
nx-X11/lib/include/Makefile.am
Normal file
@@ -0,0 +1,32 @@
|
||||
NULL =
|
||||
|
||||
x11includedir=${includedir}/nx-X11
|
||||
x11include_HEADERS= \
|
||||
X11/XKBlib.h \
|
||||
X11/Xcms.h \
|
||||
X11/Xlib.h \
|
||||
X11/Xlibint.h \
|
||||
X11/Xlocale.h \
|
||||
X11/Xresource.h \
|
||||
X11/Xutil.h \
|
||||
X11/cursorfont.h \
|
||||
X11/Xregion.h \
|
||||
X11/ImUtil.h \
|
||||
$(NULL)
|
||||
|
||||
nodist_x11include_HEADERS=\
|
||||
X11/XlibConf.h
|
||||
|
||||
xtransincludedir=${includedir}/nx-X11/Xtrans
|
||||
xtransinclude_HEADERS = \
|
||||
xtrans/Xtransint.h \
|
||||
xtrans/Xtrans.h \
|
||||
xtrans/Xtranslcl.c \
|
||||
xtrans/transport.c \
|
||||
xtrans/Xtrans.c \
|
||||
xtrans/Xtranssock.c \
|
||||
xtrans/Xtransutil.c \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST = \
|
||||
X11/XlibConf.h.in
|
||||
1
nx-X11/lib/include/X11/.gitignore
vendored
Normal file
1
nx-X11/lib/include/X11/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
XlibConf.h
|
||||
31
nx-X11/lib/include/X11/ImUtil.h
Normal file
31
nx-X11/lib/include/X11/ImUtil.h
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
#if !defined(_X11_IMUTIL_H_) && !defined(_IM_UTIL_H_)
|
||||
#define _X11_IMUTIL_H_
|
||||
#define _IMUTIL_H_
|
||||
|
||||
extern int
|
||||
_XGetScanlinePad(
|
||||
Display *dpy,
|
||||
int depth);
|
||||
|
||||
extern int
|
||||
_XGetBitsPerPixel(
|
||||
Display *dpy,
|
||||
int depth);
|
||||
|
||||
extern int
|
||||
_XSetImage(
|
||||
XImage *srcimg,
|
||||
XImage *dstimg,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
extern int
|
||||
_XReverse_Bytes(
|
||||
unsigned char *bpt,
|
||||
int nb);
|
||||
extern void
|
||||
_XInitImageFuncPtrs(
|
||||
XImage *image);
|
||||
|
||||
#endif /* !defined(_X11_IMUTIL_H_) && !defined(_IM_UTIL_H_) */
|
||||
1150
nx-X11/lib/include/X11/XKBlib.h
Normal file
1150
nx-X11/lib/include/X11/XKBlib.h
Normal file
File diff suppressed because it is too large
Load Diff
816
nx-X11/lib/include/X11/Xcms.h
Normal file
816
nx-X11/lib/include/X11/Xcms.h
Normal file
@@ -0,0 +1,816 @@
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#if !defined(_X11_XCMS_H_) && !defined(_XCMS_H_)
|
||||
#define _X11_XCMS_H_
|
||||
#define _XCMS_H_
|
||||
|
||||
#include <nx-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 /* !defined(_X11_XCMS_H_) && !defined(_XCMS_H_) */
|
||||
4046
nx-X11/lib/include/X11/Xlib.h
Normal file
4046
nx-X11/lib/include/X11/Xlib.h
Normal file
File diff suppressed because it is too large
Load Diff
37
nx-X11/lib/include/X11/XlibConf.h.in
Normal file
37
nx-X11/lib/include/X11/XlibConf.h.in
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright © 2005 Keith Packard
|
||||
*
|
||||
* 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, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD 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 _XLIBCONF_H_
|
||||
#define _XLIBCONF_H_
|
||||
/*
|
||||
* This header file exports defines necessary to correctly
|
||||
* use Xlibint.h both inside Xlib and by external libraries
|
||||
* such as extensions.
|
||||
*/
|
||||
|
||||
/* Threading support? */
|
||||
#undef XTHREADS
|
||||
|
||||
/* Use multi-threaded libc functions? */
|
||||
#undef XUSE_MTSAFE_API
|
||||
|
||||
#endif /* _XLIBCONF_H_ */
|
||||
1489
nx-X11/lib/include/X11/Xlibint.h
Normal file
1489
nx-X11/lib/include/X11/Xlibint.h
Normal file
File diff suppressed because it is too large
Load Diff
38
nx-X11/lib/include/X11/Xlocale.h
Normal file
38
nx-X11/lib/include/X11/Xlocale.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
|
||||
Copyright 1991, 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.
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(_X11_XLOCALE_H_) && !defined(_XLOCALE_H_)
|
||||
#define _X11_XLOCALE_H_
|
||||
#define _XLOCALE_H_
|
||||
|
||||
#include <nx-X11/Xfuncproto.h>
|
||||
#include <nx-X11/Xosdefs.h>
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#endif /* !defined(_X11_XLOCALE_H_) && !defined(_XLOCALE_H_) */
|
||||
191
nx-X11/lib/include/X11/Xregion.h
Normal file
191
nx-X11/lib/include/X11/Xregion.h
Normal file
@@ -0,0 +1,191 @@
|
||||
/************************************************************************
|
||||
|
||||
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.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(_X11_XREGION_H_) && !defined(_XREGION_H)
|
||||
#define _X11_XREGION_H_
|
||||
#define _XREGION_H
|
||||
|
||||
typedef struct {
|
||||
short x1, x2, y1, y2;
|
||||
} Box, BOX, BoxRec, *BoxPtr;
|
||||
|
||||
typedef struct {
|
||||
short x, y, width, height;
|
||||
}RECTANGLE, RectangleRec, *RectanglePtr;
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define MAXSHORT 32767
|
||||
#define MINSHORT -MAXSHORT
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* clip region
|
||||
*/
|
||||
|
||||
typedef struct _XRegion {
|
||||
long size;
|
||||
long numRects;
|
||||
BOX *rects;
|
||||
BOX extents;
|
||||
} REGION;
|
||||
|
||||
/* Xutil.h contains the declaration:
|
||||
* typedef struct _XRegion *Region;
|
||||
*/
|
||||
|
||||
/* 1 if two BOXs overlap.
|
||||
* 0 if two BOXs do not overlap.
|
||||
* Remember, x2 and y2 are not in the region
|
||||
*/
|
||||
#define EXTENTCHECK(r1, r2) \
|
||||
((r1)->x2 > (r2)->x1 && \
|
||||
(r1)->x1 < (r2)->x2 && \
|
||||
(r1)->y2 > (r2)->y1 && \
|
||||
(r1)->y1 < (r2)->y2)
|
||||
|
||||
/*
|
||||
* update region extents
|
||||
*/
|
||||
#define EXTENTS(r,idRect){\
|
||||
if((r)->x1 < (idRect)->extents.x1)\
|
||||
(idRect)->extents.x1 = (r)->x1;\
|
||||
if((r)->y1 < (idRect)->extents.y1)\
|
||||
(idRect)->extents.y1 = (r)->y1;\
|
||||
if((r)->x2 > (idRect)->extents.x2)\
|
||||
(idRect)->extents.x2 = (r)->x2;\
|
||||
if((r)->y2 > (idRect)->extents.y2)\
|
||||
(idRect)->extents.y2 = (r)->y2;\
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see if there is enough memory in the present region.
|
||||
*/
|
||||
#define MEMCHECK(reg, rect, firstrect){\
|
||||
if ((reg)->numRects >= ((reg)->size - 1)){\
|
||||
BoxPtr tmpRect = Xrealloc ((firstrect), \
|
||||
(2 * (sizeof(BOX)) * ((reg)->size))); \
|
||||
if (tmpRect == NULL) \
|
||||
return(0);\
|
||||
(firstrect) = tmpRect; \
|
||||
(reg)->size *= 2;\
|
||||
(rect) = &(firstrect)[(reg)->numRects];\
|
||||
}\
|
||||
}
|
||||
|
||||
/* this routine checks to see if the previous rectangle is the same
|
||||
* or subsumes the new rectangle to add.
|
||||
*/
|
||||
|
||||
#define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\
|
||||
(!(((Reg)->numRects > 0)&&\
|
||||
((R-1)->y1 == (Ry1)) &&\
|
||||
((R-1)->y2 == (Ry2)) &&\
|
||||
((R-1)->x1 <= (Rx1)) &&\
|
||||
((R-1)->x2 >= (Rx2))))
|
||||
|
||||
/* add a rectangle to the given Region */
|
||||
#define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\
|
||||
if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\
|
||||
CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
|
||||
(r)->x1 = (rx1);\
|
||||
(r)->y1 = (ry1);\
|
||||
(r)->x2 = (rx2);\
|
||||
(r)->y2 = (ry2);\
|
||||
EXTENTS((r), (reg));\
|
||||
(reg)->numRects++;\
|
||||
(r)++;\
|
||||
}\
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* add a rectangle to the given Region */
|
||||
#define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\
|
||||
if ((rx1 < rx2) && (ry1 < ry2) &&\
|
||||
CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
|
||||
(r)->x1 = (rx1);\
|
||||
(r)->y1 = (ry1);\
|
||||
(r)->x2 = (rx2);\
|
||||
(r)->y2 = (ry2);\
|
||||
(reg)->numRects++;\
|
||||
(r)++;\
|
||||
}\
|
||||
}
|
||||
|
||||
#define EMPTY_REGION(pReg) pReg->numRects = 0
|
||||
|
||||
#define REGION_NOT_EMPTY(pReg) pReg->numRects
|
||||
|
||||
#define INBOX(r, x, y) \
|
||||
( ( ((r).x2 > x)) && \
|
||||
( ((r).x1 <= x)) && \
|
||||
( ((r).y2 > y)) && \
|
||||
( ((r).y1 <= y)) )
|
||||
|
||||
/*
|
||||
* number of points to buffer before sending them off
|
||||
* to scanlines() : Must be an even number
|
||||
*/
|
||||
#define NUMPTSTOBUFFER 200
|
||||
|
||||
/*
|
||||
* used to allocate buffers for points and link
|
||||
* the buffers together
|
||||
*/
|
||||
typedef struct _POINTBLOCK {
|
||||
XPoint pts[NUMPTSTOBUFFER];
|
||||
struct _POINTBLOCK *next;
|
||||
} POINTBLOCK;
|
||||
|
||||
#endif /* !defined(_X11_XREGION_H_) && !defined(_XREGION_H) */
|
||||
359
nx-X11/lib/include/X11/Xresource.h
Normal file
359
nx-X11/lib/include/X11/Xresource.h
Normal file
@@ -0,0 +1,359 @@
|
||||
|
||||
/***********************************************************
|
||||
|
||||
Copyright 1987, 1988, 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, 1988 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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#if !defined(_X11_XRESOURCE_H_) && !defined(_XRESOURCE_H_)
|
||||
#define _X11_XRESOURCE_H_
|
||||
#define _XRESOURCE_H_
|
||||
|
||||
#ifndef _XP_PRINT_SERVER_
|
||||
#include <nx-X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************
|
||||
****************************************************************
|
||||
*** ***
|
||||
*** ***
|
||||
*** X Resource Manager Intrinsics ***
|
||||
*** ***
|
||||
*** ***
|
||||
****************************************************************
|
||||
****************************************************************/
|
||||
|
||||
_XFUNCPROTOBEGIN
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Memory Management
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
extern char *Xpermalloc(
|
||||
unsigned int /* size */
|
||||
);
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Quark Management
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
typedef int XrmQuark, *XrmQuarkList;
|
||||
#define NULLQUARK ((XrmQuark) 0)
|
||||
|
||||
typedef char *XrmString;
|
||||
#define NULLSTRING ((XrmString) 0)
|
||||
|
||||
/* find quark for string, create new quark if none already exists */
|
||||
extern XrmQuark XrmStringToQuark(
|
||||
_Xconst char* /* string */
|
||||
);
|
||||
|
||||
extern XrmQuark XrmPermStringToQuark(
|
||||
_Xconst char* /* string */
|
||||
);
|
||||
|
||||
/* find string for quark */
|
||||
extern XrmString XrmQuarkToString(
|
||||
XrmQuark /* quark */
|
||||
);
|
||||
|
||||
extern XrmQuark XrmUniqueQuark(
|
||||
void
|
||||
);
|
||||
|
||||
#define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0)
|
||||
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Conversion of Strings to Lists
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList;
|
||||
|
||||
extern void XrmStringToQuarkList(
|
||||
_Xconst char* /* string */,
|
||||
XrmQuarkList /* quarks_return */
|
||||
);
|
||||
|
||||
extern void XrmStringToBindingQuarkList(
|
||||
_Xconst char* /* string */,
|
||||
XrmBindingList /* bindings_return */,
|
||||
XrmQuarkList /* quarks_return */
|
||||
);
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Name and Class lists.
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
typedef XrmQuark XrmName;
|
||||
typedef XrmQuarkList XrmNameList;
|
||||
#define XrmNameToString(name) XrmQuarkToString(name)
|
||||
#define XrmStringToName(string) XrmStringToQuark(string)
|
||||
#define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name)
|
||||
|
||||
typedef XrmQuark XrmClass;
|
||||
typedef XrmQuarkList XrmClassList;
|
||||
#define XrmClassToString(c_class) XrmQuarkToString(c_class)
|
||||
#define XrmStringToClass(c_class) XrmStringToQuark(c_class)
|
||||
#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class)
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Resource Representation Types and Values
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
typedef XrmQuark XrmRepresentation;
|
||||
#define XrmStringToRepresentation(string) XrmStringToQuark(string)
|
||||
#define XrmRepresentationToString(type) XrmQuarkToString(type)
|
||||
|
||||
typedef struct {
|
||||
unsigned int size;
|
||||
XPointer addr;
|
||||
} XrmValue, *XrmValuePtr;
|
||||
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Resource Manager Functions
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
typedef struct _XrmHashBucketRec *XrmHashBucket;
|
||||
typedef XrmHashBucket *XrmHashTable;
|
||||
typedef XrmHashTable XrmSearchList[];
|
||||
typedef struct _XrmHashBucketRec *XrmDatabase;
|
||||
|
||||
|
||||
extern void XrmDestroyDatabase(
|
||||
XrmDatabase /* database */
|
||||
);
|
||||
|
||||
extern void XrmQPutResource(
|
||||
XrmDatabase* /* database */,
|
||||
XrmBindingList /* bindings */,
|
||||
XrmQuarkList /* quarks */,
|
||||
XrmRepresentation /* type */,
|
||||
XrmValue* /* value */
|
||||
);
|
||||
|
||||
extern void XrmPutResource(
|
||||
XrmDatabase* /* database */,
|
||||
_Xconst char* /* specifier */,
|
||||
_Xconst char* /* type */,
|
||||
XrmValue* /* value */
|
||||
);
|
||||
|
||||
extern void XrmQPutStringResource(
|
||||
XrmDatabase* /* database */,
|
||||
XrmBindingList /* bindings */,
|
||||
XrmQuarkList /* quarks */,
|
||||
_Xconst char* /* value */
|
||||
);
|
||||
|
||||
extern void XrmPutStringResource(
|
||||
XrmDatabase* /* database */,
|
||||
_Xconst char* /* specifier */,
|
||||
_Xconst char* /* value */
|
||||
);
|
||||
|
||||
extern void XrmPutLineResource(
|
||||
XrmDatabase* /* database */,
|
||||
_Xconst char* /* line */
|
||||
);
|
||||
|
||||
extern Bool XrmQGetResource(
|
||||
XrmDatabase /* database */,
|
||||
XrmNameList /* quark_name */,
|
||||
XrmClassList /* quark_class */,
|
||||
XrmRepresentation* /* quark_type_return */,
|
||||
XrmValue* /* value_return */
|
||||
);
|
||||
|
||||
extern Bool XrmGetResource(
|
||||
XrmDatabase /* database */,
|
||||
_Xconst char* /* str_name */,
|
||||
_Xconst char* /* str_class */,
|
||||
char** /* str_type_return */,
|
||||
XrmValue* /* value_return */
|
||||
);
|
||||
|
||||
extern Bool XrmQGetSearchList(
|
||||
XrmDatabase /* database */,
|
||||
XrmNameList /* names */,
|
||||
XrmClassList /* classes */,
|
||||
XrmSearchList /* list_return */,
|
||||
int /* list_length */
|
||||
);
|
||||
|
||||
extern Bool XrmQGetSearchResource(
|
||||
XrmSearchList /* list */,
|
||||
XrmName /* name */,
|
||||
XrmClass /* class */,
|
||||
XrmRepresentation* /* type_return */,
|
||||
XrmValue* /* value_return */
|
||||
);
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Resource Database Management
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
#ifndef _XP_PRINT_SERVER_
|
||||
|
||||
extern void XrmSetDatabase(
|
||||
Display* /* display */,
|
||||
XrmDatabase /* database */
|
||||
);
|
||||
|
||||
extern XrmDatabase XrmGetDatabase(
|
||||
Display* /* display */
|
||||
);
|
||||
|
||||
#endif /* !_XP_PRINT_SERVER_ */
|
||||
|
||||
extern XrmDatabase XrmGetFileDatabase(
|
||||
_Xconst char* /* filename */
|
||||
);
|
||||
|
||||
extern Status XrmCombineFileDatabase(
|
||||
_Xconst char* /* filename */,
|
||||
XrmDatabase* /* target */,
|
||||
Bool /* override */
|
||||
);
|
||||
|
||||
extern XrmDatabase XrmGetStringDatabase(
|
||||
_Xconst char* /* data */ /* null terminated string */
|
||||
);
|
||||
|
||||
extern void XrmPutFileDatabase(
|
||||
XrmDatabase /* database */,
|
||||
_Xconst char* /* filename */
|
||||
);
|
||||
|
||||
extern void XrmMergeDatabases(
|
||||
XrmDatabase /* source_db */,
|
||||
XrmDatabase* /* target_db */
|
||||
);
|
||||
|
||||
extern void XrmCombineDatabase(
|
||||
XrmDatabase /* source_db */,
|
||||
XrmDatabase* /* target_db */,
|
||||
Bool /* override */
|
||||
);
|
||||
|
||||
#define XrmEnumAllLevels 0
|
||||
#define XrmEnumOneLevel 1
|
||||
|
||||
extern Bool XrmEnumerateDatabase(
|
||||
XrmDatabase /* db */,
|
||||
XrmNameList /* name_prefix */,
|
||||
XrmClassList /* class_prefix */,
|
||||
int /* mode */,
|
||||
Bool (*)(
|
||||
XrmDatabase* /* db */,
|
||||
XrmBindingList /* bindings */,
|
||||
XrmQuarkList /* quarks */,
|
||||
XrmRepresentation* /* type */,
|
||||
XrmValue* /* value */,
|
||||
XPointer /* closure */
|
||||
) /* proc */,
|
||||
XPointer /* closure */
|
||||
);
|
||||
|
||||
extern const char *XrmLocaleOfDatabase(
|
||||
XrmDatabase /* database */
|
||||
);
|
||||
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Command line option mapping to resource entries
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
typedef enum {
|
||||
XrmoptionNoArg, /* Value is specified in OptionDescRec.value */
|
||||
XrmoptionIsArg, /* Value is the option string itself */
|
||||
XrmoptionStickyArg, /* Value is characters immediately following option */
|
||||
XrmoptionSepArg, /* Value is next argument in argv */
|
||||
XrmoptionResArg, /* Resource and value in next argument in argv */
|
||||
XrmoptionSkipArg, /* Ignore this option and the next argument in argv */
|
||||
XrmoptionSkipLine, /* Ignore this option and the rest of argv */
|
||||
XrmoptionSkipNArgs /* Ignore this option and the next
|
||||
OptionDescRes.value arguments in argv */
|
||||
} XrmOptionKind;
|
||||
|
||||
typedef struct {
|
||||
char *option; /* Option abbreviation in argv */
|
||||
char *specifier; /* Resource specifier */
|
||||
XrmOptionKind argKind; /* Which style of option it is */
|
||||
XPointer value; /* Value to provide if XrmoptionNoArg */
|
||||
} XrmOptionDescRec, *XrmOptionDescList;
|
||||
|
||||
|
||||
extern void XrmParseCommand(
|
||||
XrmDatabase* /* database */,
|
||||
XrmOptionDescList /* table */,
|
||||
int /* table_count */,
|
||||
_Xconst char* /* name */,
|
||||
int* /* argc_in_out */,
|
||||
char** /* argv_in_out */
|
||||
);
|
||||
|
||||
_XFUNCPROTOEND
|
||||
|
||||
#endif /* !defined(_X11_XRESOURCE_H_) && !defined(_XRESOURCE_H_) */
|
||||
/* DON'T ADD STUFF AFTER THIS #endif */
|
||||
839
nx-X11/lib/include/X11/Xutil.h
Normal file
839
nx-X11/lib/include/X11/Xutil.h
Normal file
@@ -0,0 +1,839 @@
|
||||
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#if !defined(_X11_XUTIL_H_) && !defined(_XUTIL_H_)
|
||||
#define _X11_XUTIL_H_
|
||||
#define _XUTIL_H_
|
||||
|
||||
/* You must include <X11/Xlib.h> before including this file */
|
||||
#include <nx-X11/Xlib.h>
|
||||
#include <nx-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 /* !defined(_X11_XUTIL_H_) && !defined(_XUTIL_H_) */
|
||||
112
nx-X11/lib/include/X11/cursorfont.h
Normal file
112
nx-X11/lib/include/X11/cursorfont.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(_X11_CURSORFONT_H_) && !defined(_cursorfont_h_)
|
||||
#define _X11_CURSORFONT_H_
|
||||
#define _cursorfont_h_
|
||||
|
||||
#define XC_num_glyphs 154
|
||||
#define XC_X_cursor 0
|
||||
#define XC_arrow 2
|
||||
#define XC_based_arrow_down 4
|
||||
#define XC_based_arrow_up 6
|
||||
#define XC_boat 8
|
||||
#define XC_bogosity 10
|
||||
#define XC_bottom_left_corner 12
|
||||
#define XC_bottom_right_corner 14
|
||||
#define XC_bottom_side 16
|
||||
#define XC_bottom_tee 18
|
||||
#define XC_box_spiral 20
|
||||
#define XC_center_ptr 22
|
||||
#define XC_circle 24
|
||||
#define XC_clock 26
|
||||
#define XC_coffee_mug 28
|
||||
#define XC_cross 30
|
||||
#define XC_cross_reverse 32
|
||||
#define XC_crosshair 34
|
||||
#define XC_diamond_cross 36
|
||||
#define XC_dot 38
|
||||
#define XC_dotbox 40
|
||||
#define XC_double_arrow 42
|
||||
#define XC_draft_large 44
|
||||
#define XC_draft_small 46
|
||||
#define XC_draped_box 48
|
||||
#define XC_exchange 50
|
||||
#define XC_fleur 52
|
||||
#define XC_gobbler 54
|
||||
#define XC_gumby 56
|
||||
#define XC_hand1 58
|
||||
#define XC_hand2 60
|
||||
#define XC_heart 62
|
||||
#define XC_icon 64
|
||||
#define XC_iron_cross 66
|
||||
#define XC_left_ptr 68
|
||||
#define XC_left_side 70
|
||||
#define XC_left_tee 72
|
||||
#define XC_leftbutton 74
|
||||
#define XC_ll_angle 76
|
||||
#define XC_lr_angle 78
|
||||
#define XC_man 80
|
||||
#define XC_middlebutton 82
|
||||
#define XC_mouse 84
|
||||
#define XC_pencil 86
|
||||
#define XC_pirate 88
|
||||
#define XC_plus 90
|
||||
#define XC_question_arrow 92
|
||||
#define XC_right_ptr 94
|
||||
#define XC_right_side 96
|
||||
#define XC_right_tee 98
|
||||
#define XC_rightbutton 100
|
||||
#define XC_rtl_logo 102
|
||||
#define XC_sailboat 104
|
||||
#define XC_sb_down_arrow 106
|
||||
#define XC_sb_h_double_arrow 108
|
||||
#define XC_sb_left_arrow 110
|
||||
#define XC_sb_right_arrow 112
|
||||
#define XC_sb_up_arrow 114
|
||||
#define XC_sb_v_double_arrow 116
|
||||
#define XC_shuttle 118
|
||||
#define XC_sizing 120
|
||||
#define XC_spider 122
|
||||
#define XC_spraycan 124
|
||||
#define XC_star 126
|
||||
#define XC_target 128
|
||||
#define XC_tcross 130
|
||||
#define XC_top_left_arrow 132
|
||||
#define XC_top_left_corner 134
|
||||
#define XC_top_right_corner 136
|
||||
#define XC_top_side 138
|
||||
#define XC_top_tee 140
|
||||
#define XC_trek 142
|
||||
#define XC_ul_angle 144
|
||||
#define XC_umbrella 146
|
||||
#define XC_ur_angle 148
|
||||
#define XC_watch 150
|
||||
#define XC_xterm 152
|
||||
|
||||
#endif /* !defined(_X11_CURSORFONT_H_) && !defined(_cursorfont_h_) */
|
||||
1369
nx-X11/lib/include/xtrans/Xtrans.c
Normal file
1369
nx-X11/lib/include/xtrans/Xtrans.c
Normal file
File diff suppressed because it is too large
Load Diff
426
nx-X11/lib/include/xtrans/Xtrans.h
Normal file
426
nx-X11/lib/include/xtrans/Xtrans.h
Normal file
@@ -0,0 +1,426 @@
|
||||
/*
|
||||
|
||||
Copyright 1993, 1994, 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 1993, 1994 NCR Corporation - Dayton, Ohio, USA
|
||||
*
|
||||
* 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 NCR not be used in advertising
|
||||
* or publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. NCR makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL NCR 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 _XTRANS_H_
|
||||
#define _XTRANS_H_
|
||||
|
||||
#include <nx-X11/Xfuncproto.h>
|
||||
#include <nx-X11/Xos.h>
|
||||
#include <nx-X11/Xmd.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
/* Not all clients make use of all provided statics */
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set the functions names according to where this code is being compiled.
|
||||
*/
|
||||
|
||||
#ifdef X11_t
|
||||
#define TRANS(func) _X11Trans##func
|
||||
#ifdef XTRANSDEBUG
|
||||
static const char *__xtransname = "_X11Trans";
|
||||
#endif
|
||||
#endif /* X11_t */
|
||||
|
||||
#ifdef XSERV_t
|
||||
#define TRANS(func) _XSERVTrans##func
|
||||
#ifdef XTRANSDEBUG
|
||||
static const char *__xtransname = "_XSERVTrans";
|
||||
#endif
|
||||
#define X11_t
|
||||
#endif /* XSERV_t */
|
||||
|
||||
#ifdef XIM_t
|
||||
#define TRANS(func) _XimXTrans##func
|
||||
#ifdef XTRANSDEBUG
|
||||
static const char *__xtransname = "_XimTrans";
|
||||
#endif
|
||||
#endif /* XIM_t */
|
||||
|
||||
#ifdef FS_t
|
||||
#define TRANS(func) _FSTrans##func
|
||||
#ifdef XTRANSDEBUG
|
||||
static const char *__xtransname = "_FSTrans";
|
||||
#endif
|
||||
#endif /* FS_t */
|
||||
|
||||
#ifdef FONT_t
|
||||
#define TRANS(func) _FontTrans##func
|
||||
#ifdef XTRANSDEBUG
|
||||
static const char *__xtransname = "_FontTrans";
|
||||
#endif
|
||||
#endif /* FONT_t */
|
||||
|
||||
#ifdef ICE_t
|
||||
#define TRANS(func) _IceTrans##func
|
||||
#ifdef XTRANSDEBUG
|
||||
static const char *__xtransname = "_IceTrans";
|
||||
#endif
|
||||
#endif /* ICE_t */
|
||||
|
||||
#if !defined(TRANS)
|
||||
#define TRANS(func) _XTrans##func
|
||||
#ifdef XTRANSDEBUG
|
||||
static const char *__xtransname = "_XTrans";
|
||||
#endif
|
||||
#endif /* !TRANS */
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Create a single address structure that can be used wherever
|
||||
* an address structure is needed. struct sockaddr is not big enough
|
||||
* to hold a sockadd_un, so we create this definition to have a single
|
||||
* structure that is big enough for all the structures we might need.
|
||||
*
|
||||
* This structure needs to be independent of the socket/TLI interface used.
|
||||
*/
|
||||
|
||||
#if defined(IPv6) && defined(AF_INET6)
|
||||
typedef struct sockaddr_storage Xtransaddr;
|
||||
#else
|
||||
#define XTRANS_MAX_ADDR_LEN 128 /* large enough to hold sun_path */
|
||||
|
||||
typedef struct {
|
||||
unsigned char addr[XTRANS_MAX_ADDR_LEN];
|
||||
} Xtransaddr;
|
||||
#endif
|
||||
|
||||
#ifdef LONG64
|
||||
typedef int BytesReadable_t;
|
||||
#else
|
||||
typedef long BytesReadable_t;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(WIN32) || defined(USG)
|
||||
|
||||
/*
|
||||
* TRANS(Readv) and TRANS(Writev) use struct iovec, normally found
|
||||
* in Berkeley systems in <sys/uio.h>. See the readv(2) and writev(2)
|
||||
* manual pages for details.
|
||||
*/
|
||||
|
||||
struct iovec {
|
||||
caddr_t iov_base;
|
||||
int iov_len;
|
||||
};
|
||||
|
||||
#else
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
typedef struct _XtransConnInfo *XtransConnInfo;
|
||||
|
||||
|
||||
/*
|
||||
* Transport Option definitions
|
||||
*/
|
||||
|
||||
#define TRANS_NONBLOCKING 1
|
||||
#define TRANS_CLOSEONEXEC 2
|
||||
|
||||
|
||||
/*
|
||||
* Return values of Connect (0 is success)
|
||||
*/
|
||||
|
||||
#define TRANS_CONNECT_FAILED -1
|
||||
#define TRANS_TRY_CONNECT_AGAIN -2
|
||||
#define TRANS_IN_PROGRESS -3
|
||||
|
||||
|
||||
/*
|
||||
* Return values of CreateListener (0 is success)
|
||||
*/
|
||||
|
||||
#define TRANS_CREATE_LISTENER_FAILED -1
|
||||
#define TRANS_ADDR_IN_USE -2
|
||||
|
||||
|
||||
/*
|
||||
* Return values of Accept (0 is success)
|
||||
*/
|
||||
|
||||
#define TRANS_ACCEPT_BAD_MALLOC -1
|
||||
#define TRANS_ACCEPT_FAILED -2
|
||||
#define TRANS_ACCEPT_MISC_ERROR -3
|
||||
|
||||
|
||||
/*
|
||||
* ResetListener return values
|
||||
*/
|
||||
|
||||
#define TRANS_RESET_NOOP 1
|
||||
#define TRANS_RESET_NEW_FD 2
|
||||
#define TRANS_RESET_FAILURE 3
|
||||
|
||||
|
||||
/*
|
||||
* Function prototypes for the exposed interface
|
||||
*/
|
||||
|
||||
void TRANS(FreeConnInfo) (
|
||||
XtransConnInfo /* ciptr */
|
||||
);
|
||||
|
||||
#ifdef TRANS_CLIENT
|
||||
|
||||
XtransConnInfo TRANS(OpenCOTSClient)(
|
||||
const char * /* address */
|
||||
);
|
||||
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
|
||||
XtransConnInfo TRANS(OpenCOTSServer)(
|
||||
const char * /* address */
|
||||
);
|
||||
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
#ifdef TRANS_REOPEN
|
||||
|
||||
XtransConnInfo TRANS(ReopenCOTSServer)(
|
||||
int, /* trans_id */
|
||||
int, /* fd */
|
||||
const char * /* port */
|
||||
);
|
||||
|
||||
int TRANS(GetReopenInfo)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
int *, /* trans_id */
|
||||
int *, /* fd */
|
||||
char ** /* port */
|
||||
);
|
||||
|
||||
#endif /* TRANS_REOPEN */
|
||||
|
||||
|
||||
int TRANS(SetOption)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
int, /* option */
|
||||
int /* arg */
|
||||
);
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
|
||||
int TRANS(CreateListener)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
const char *, /* port */
|
||||
unsigned int /* flags */
|
||||
);
|
||||
|
||||
int TRANS(Received) (
|
||||
const char* /* protocol*/
|
||||
);
|
||||
|
||||
int TRANS(NoListen) (
|
||||
const char* /* protocol*/
|
||||
);
|
||||
|
||||
int TRANS(Listen) (
|
||||
const char* /* protocol*/
|
||||
);
|
||||
|
||||
int TRANS(IsListening) (
|
||||
const char* /* protocol*/
|
||||
);
|
||||
|
||||
int TRANS(ResetListener)(
|
||||
XtransConnInfo /* ciptr */
|
||||
);
|
||||
|
||||
XtransConnInfo TRANS(Accept)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
int * /* status */
|
||||
);
|
||||
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
#ifdef TRANS_CLIENT
|
||||
|
||||
int TRANS(Connect)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
const char * /* address */
|
||||
);
|
||||
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
int TRANS(BytesReadable)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
BytesReadable_t * /* pend */
|
||||
);
|
||||
|
||||
int TRANS(Read)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
char *, /* buf */
|
||||
int /* size */
|
||||
);
|
||||
|
||||
int TRANS(Write)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
char *, /* buf */
|
||||
int /* size */
|
||||
);
|
||||
|
||||
int TRANS(Readv)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
struct iovec *, /* buf */
|
||||
int /* size */
|
||||
);
|
||||
|
||||
int TRANS(Writev)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
struct iovec *, /* buf */
|
||||
int /* size */
|
||||
);
|
||||
|
||||
int TRANS(SendFd) (XtransConnInfo ciptr, int fd, int do_close);
|
||||
|
||||
int TRANS(RecvFd) (XtransConnInfo ciptr);
|
||||
|
||||
int TRANS(Disconnect)(
|
||||
XtransConnInfo /* ciptr */
|
||||
);
|
||||
|
||||
int TRANS(Close)(
|
||||
XtransConnInfo /* ciptr */
|
||||
);
|
||||
|
||||
int TRANS(CloseForCloning)(
|
||||
XtransConnInfo /* ciptr */
|
||||
);
|
||||
|
||||
int TRANS(IsLocal)(
|
||||
XtransConnInfo /* ciptr */
|
||||
);
|
||||
|
||||
#ifdef NX_TRANS_SOCKET
|
||||
/* needed for pre-xcb libX11 as we have in NX */
|
||||
int TRANS(GetMyAddr)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
int *, /* familyp */
|
||||
int *, /* addrlenp */
|
||||
Xtransaddr ** /* addrp */
|
||||
);
|
||||
#endif
|
||||
|
||||
int TRANS(GetPeerAddr)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
int *, /* familyp */
|
||||
int *, /* addrlenp */
|
||||
Xtransaddr ** /* addrp */
|
||||
);
|
||||
|
||||
int TRANS(GetConnectionNumber)(
|
||||
XtransConnInfo /* ciptr */
|
||||
);
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
|
||||
int TRANS(MakeAllCOTSServerListeners)(
|
||||
const char *, /* port */
|
||||
int *, /* partial */
|
||||
int *, /* count_ret */
|
||||
XtransConnInfo ** /* ciptrs_ret */
|
||||
);
|
||||
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
|
||||
/*
|
||||
* Function Prototypes for Utility Functions.
|
||||
*/
|
||||
|
||||
#ifdef X11_t
|
||||
|
||||
int TRANS(ConvertAddress)(
|
||||
int *, /* familyp */
|
||||
int *, /* addrlenp */
|
||||
Xtransaddr ** /* addrp */
|
||||
);
|
||||
|
||||
#endif /* X11_t */
|
||||
|
||||
#ifdef ICE_t
|
||||
|
||||
char *
|
||||
TRANS(GetMyNetworkId)(
|
||||
XtransConnInfo /* ciptr */
|
||||
);
|
||||
|
||||
char *
|
||||
TRANS(GetPeerNetworkId)(
|
||||
XtransConnInfo /* ciptr */
|
||||
);
|
||||
|
||||
#endif /* ICE_t */
|
||||
|
||||
int
|
||||
TRANS(GetHostname) (
|
||||
char * /* buf */,
|
||||
int /* maxlen */
|
||||
);
|
||||
|
||||
#if defined(WIN32) && defined(TCPCONN)
|
||||
int TRANS(WSAStartup)();
|
||||
#endif
|
||||
|
||||
#endif /* _XTRANS_H_ */
|
||||
433
nx-X11/lib/include/xtrans/Xtransint.h
Normal file
433
nx-X11/lib/include/xtrans/Xtransint.h
Normal file
@@ -0,0 +1,433 @@
|
||||
/*
|
||||
|
||||
Copyright 1993, 1994, 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 1993, 1994 NCR Corporation - Dayton, Ohio, USA
|
||||
*
|
||||
* 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 NCR not be used in advertising
|
||||
* or publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. NCR makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL NCR 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 _XTRANSINT_H_
|
||||
#define _XTRANSINT_H_
|
||||
|
||||
/*
|
||||
* XTRANSDEBUG will enable the PRMSG() macros used in the X Transport
|
||||
* Interface code. Each use of the PRMSG macro has a level associated with
|
||||
* it. XTRANSDEBUG is defined to be a level. If the invocation level is =<
|
||||
* the value of XTRANSDEBUG, then the message will be printed out to stderr.
|
||||
* Recommended levels are:
|
||||
*
|
||||
* XTRANSDEBUG=1 Error messages
|
||||
* XTRANSDEBUG=2 API Function Tracing
|
||||
* XTRANSDEBUG=3 All Function Tracing
|
||||
* XTRANSDEBUG=4 printing of intermediate values
|
||||
* XTRANSDEBUG=5 really detailed stuff
|
||||
#define XTRANSDEBUG 2
|
||||
*
|
||||
* Defining XTRANSDEBUGTIMESTAMP will cause printing timestamps with each
|
||||
* message.
|
||||
*/
|
||||
|
||||
#if !defined(XTRANSDEBUG) && defined(XTRANS_TRANSPORT_C)
|
||||
# define XTRANSDEBUG 1
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
# define _WILLWINSOCK_
|
||||
#endif
|
||||
|
||||
#include "Xtrans.h"
|
||||
|
||||
#ifndef _X_UNUSED /* Defined in Xfuncproto.h in xproto >= 7.0.22 */
|
||||
# define _X_UNUSED /* */
|
||||
#endif
|
||||
|
||||
#ifdef XTRANSDEBUG
|
||||
# include <stdio.h>
|
||||
#endif /* XTRANSDEBUG */
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef WIN32
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
|
||||
/*
|
||||
* Moved the setting of NEED_UTSNAME to this header file from Xtrans.c,
|
||||
* to avoid a race condition. JKJ (6/5/97)
|
||||
*/
|
||||
|
||||
# if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SVR4) || defined(__SCO__)
|
||||
# ifndef NEED_UTSNAME
|
||||
# define NEED_UTSNAME
|
||||
# endif
|
||||
# include <sys/utsname.h>
|
||||
# endif
|
||||
|
||||
# define ESET(val) errno = val
|
||||
# define EGET() errno
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
# include <limits.h> /* for USHRT_MAX */
|
||||
|
||||
# define ESET(val) WSASetLastError(val)
|
||||
# define EGET() WSAGetLastError()
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef X11_t
|
||||
#define X_TCP_PORT 6000
|
||||
#endif
|
||||
|
||||
#if XTRANS_SEND_FDS
|
||||
|
||||
struct _XtransConnFd {
|
||||
struct _XtransConnFd *next;
|
||||
int fd;
|
||||
int do_close;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
struct _XtransConnInfo {
|
||||
struct _Xtransport *transptr;
|
||||
int index;
|
||||
char *priv;
|
||||
int flags;
|
||||
int fd;
|
||||
char *port;
|
||||
int family;
|
||||
char *addr;
|
||||
int addrlen;
|
||||
char *peeraddr;
|
||||
int peeraddrlen;
|
||||
struct _XtransConnFd *recv_fds;
|
||||
struct _XtransConnFd *send_fds;
|
||||
};
|
||||
|
||||
#define XTRANS_OPEN_COTS_CLIENT 1
|
||||
#define XTRANS_OPEN_COTS_SERVER 2
|
||||
|
||||
typedef struct _Xtransport {
|
||||
const char *TransName;
|
||||
int flags;
|
||||
|
||||
#ifdef TRANS_CLIENT
|
||||
|
||||
XtransConnInfo (*OpenCOTSClient)(
|
||||
struct _Xtransport *, /* transport */
|
||||
const char *, /* protocol */
|
||||
const char *, /* host */
|
||||
const char * /* port */
|
||||
);
|
||||
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
const char ** nolisten;
|
||||
XtransConnInfo (*OpenCOTSServer)(
|
||||
struct _Xtransport *, /* transport */
|
||||
const char *, /* protocol */
|
||||
const char *, /* host */
|
||||
const char * /* port */
|
||||
);
|
||||
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
#ifdef TRANS_REOPEN
|
||||
|
||||
XtransConnInfo (*ReopenCOTSServer)(
|
||||
struct _Xtransport *, /* transport */
|
||||
int, /* fd */
|
||||
const char * /* port */
|
||||
);
|
||||
|
||||
#endif /* TRANS_REOPEN */
|
||||
|
||||
|
||||
int (*SetOption)(
|
||||
XtransConnInfo, /* connection */
|
||||
int, /* option */
|
||||
int /* arg */
|
||||
);
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
/* Flags */
|
||||
# define ADDR_IN_USE_ALLOWED 1
|
||||
|
||||
int (*CreateListener)(
|
||||
XtransConnInfo, /* connection */
|
||||
const char *, /* port */
|
||||
unsigned int /* flags */
|
||||
);
|
||||
|
||||
int (*ResetListener)(
|
||||
XtransConnInfo /* connection */
|
||||
);
|
||||
|
||||
XtransConnInfo (*Accept)(
|
||||
XtransConnInfo, /* connection */
|
||||
int * /* status */
|
||||
);
|
||||
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
#ifdef TRANS_CLIENT
|
||||
|
||||
int (*Connect)(
|
||||
XtransConnInfo, /* connection */
|
||||
const char *, /* host */
|
||||
const char * /* port */
|
||||
);
|
||||
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
int (*BytesReadable)(
|
||||
XtransConnInfo, /* connection */
|
||||
BytesReadable_t * /* pend */
|
||||
);
|
||||
|
||||
int (*Read)(
|
||||
XtransConnInfo, /* connection */
|
||||
char *, /* buf */
|
||||
int /* size */
|
||||
);
|
||||
|
||||
int (*Write)(
|
||||
XtransConnInfo, /* connection */
|
||||
char *, /* buf */
|
||||
int /* size */
|
||||
);
|
||||
|
||||
int (*Readv)(
|
||||
XtransConnInfo, /* connection */
|
||||
struct iovec *, /* buf */
|
||||
int /* size */
|
||||
);
|
||||
|
||||
int (*Writev)(
|
||||
XtransConnInfo, /* connection */
|
||||
struct iovec *, /* buf */
|
||||
int /* size */
|
||||
);
|
||||
|
||||
#if XTRANS_SEND_FDS
|
||||
int (*SendFd)(
|
||||
XtransConnInfo, /* connection */
|
||||
int, /* fd */
|
||||
int /* do_close */
|
||||
);
|
||||
|
||||
int (*RecvFd)(
|
||||
XtransConnInfo /* connection */
|
||||
);
|
||||
#endif
|
||||
|
||||
int (*Disconnect)(
|
||||
XtransConnInfo /* connection */
|
||||
);
|
||||
|
||||
int (*Close)(
|
||||
XtransConnInfo /* connection */
|
||||
);
|
||||
|
||||
int (*CloseForCloning)(
|
||||
XtransConnInfo /* connection */
|
||||
);
|
||||
|
||||
} Xtransport;
|
||||
|
||||
|
||||
typedef struct _Xtransport_table {
|
||||
Xtransport *transport;
|
||||
int transport_id;
|
||||
} Xtransport_table;
|
||||
|
||||
|
||||
/*
|
||||
* Flags for the flags member of Xtransport.
|
||||
*/
|
||||
|
||||
#define TRANS_ALIAS (1<<0) /* record is an alias, don't create server */
|
||||
#define TRANS_LOCAL (1<<1) /* local transport */
|
||||
#define TRANS_DISABLED (1<<2) /* Don't open this one */
|
||||
#define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */
|
||||
#define TRANS_NOUNLINK (1<<4) /* Don't unlink transport endpoints */
|
||||
#define TRANS_ABSTRACT (1<<5) /* Use abstract sockets if available */
|
||||
#define TRANS_NOXAUTH (1<<6) /* Don't verify authentication (because it's secure some other way at the OS layer) */
|
||||
#define TRANS_RECEIVED (1<<7) /* The fd for this has already been opened by someone else. */
|
||||
|
||||
/* Flags to preserve when setting others */
|
||||
#define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT)
|
||||
|
||||
#ifdef XTRANS_TRANSPORT_C /* only provide static function prototypes when
|
||||
building the transport.c file that has them in */
|
||||
|
||||
#ifdef __clang__
|
||||
/* Not all clients make use of all provided statics */
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* readv() and writev() don't exist or don't work correctly on some
|
||||
* systems, so they may be emulated.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt)
|
||||
|
||||
static int TRANS(ReadV)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
struct iovec *, /* iov */
|
||||
int /* iovcnt */
|
||||
);
|
||||
|
||||
#else
|
||||
|
||||
#define READV(ciptr, iov, iovcnt) readv(ciptr->fd, iov, iovcnt)
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt)
|
||||
|
||||
static int TRANS(WriteV)(
|
||||
XtransConnInfo, /* ciptr */
|
||||
struct iovec *, /* iov */
|
||||
int /* iovcnt */
|
||||
);
|
||||
|
||||
#else
|
||||
|
||||
#define WRITEV(ciptr, iov, iovcnt) writev(ciptr->fd, iov, iovcnt)
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#if defined(X11_t)
|
||||
static int is_numeric (
|
||||
const char * /* str */
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
static int trans_mkdir (
|
||||
const char *, /* path */
|
||||
int /* mode */
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Some XTRANSDEBUG stuff
|
||||
*/
|
||||
|
||||
#ifdef XTRANSDEBUG
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
* The X server provides ErrorF() & VErrorF(), for other software that uses
|
||||
* xtrans, we provide our own simple versions.
|
||||
*/
|
||||
# if defined(XSERV_t) && defined(TRANS_SERVER)
|
||||
# include "os.h"
|
||||
# else
|
||||
static inline void _X_ATTRIBUTE_PRINTF(1, 0)
|
||||
VErrorF(const char *f, va_list args)
|
||||
{
|
||||
vfprintf(stderr, f, args);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
static inline void _X_ATTRIBUTE_PRINTF(1, 2)
|
||||
ErrorF(const char *f, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, f);
|
||||
VErrorF(f, args);
|
||||
va_end(args);
|
||||
}
|
||||
# endif /* xserver */
|
||||
#endif /* XTRANSDEBUG */
|
||||
|
||||
static inline void _X_ATTRIBUTE_PRINTF(2, 3)
|
||||
prmsg(int lvl, const char *f, ...)
|
||||
{
|
||||
#ifdef XTRANSDEBUG
|
||||
va_list args;
|
||||
|
||||
va_start(args, f);
|
||||
if (lvl <= XTRANSDEBUG) {
|
||||
int saveerrno = errno;
|
||||
|
||||
ErrorF("%s", __xtransname);
|
||||
VErrorF(f, args);
|
||||
|
||||
# ifdef XTRANSDEBUGTIMESTAMP
|
||||
{
|
||||
struct timeval tp;
|
||||
gettimeofday(&tp, 0);
|
||||
ErrorF("timestamp (ms): %d\n",
|
||||
tp.tv_sec * 1000 + tp.tv_usec / 1000);
|
||||
}
|
||||
# endif
|
||||
errno = saveerrno;
|
||||
}
|
||||
va_end(args);
|
||||
#endif /* XTRANSDEBUG */
|
||||
}
|
||||
|
||||
#endif /* XTRANS_TRANSPORT_C */
|
||||
|
||||
#endif /* _XTRANSINT_H_ */
|
||||
2486
nx-X11/lib/include/xtrans/Xtranslcl.c
Normal file
2486
nx-X11/lib/include/xtrans/Xtranslcl.c
Normal file
File diff suppressed because it is too large
Load Diff
3342
nx-X11/lib/include/xtrans/Xtranssock.c
Normal file
3342
nx-X11/lib/include/xtrans/Xtranssock.c
Normal file
File diff suppressed because it is too large
Load Diff
639
nx-X11/lib/include/xtrans/Xtransutil.c
Normal file
639
nx-X11/lib/include/xtrans/Xtransutil.c
Normal file
@@ -0,0 +1,639 @@
|
||||
/*
|
||||
|
||||
Copyright 1993, 1994, 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 1993, 1994 NCR Corporation - Dayton, Ohio, USA
|
||||
*
|
||||
* 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 NCR not be used in advertising
|
||||
* or publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. NCR makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* NCRS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL NCR 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* These are some utility functions created for convenience or to provide
|
||||
* an interface that is similar to an existing interface. These are built
|
||||
* only using the Transport Independant API, and have no knowledge of
|
||||
* the internal implementation.
|
||||
*/
|
||||
|
||||
#ifdef XTHREADS
|
||||
#include <X11/Xthreads.h>
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/Xwinsock.h>
|
||||
#endif
|
||||
|
||||
#ifdef X11_t
|
||||
|
||||
/*
|
||||
* These values come from X.h and Xauth.h, and MUST match them. Some
|
||||
* of these values are also defined by the ChangeHost protocol message.
|
||||
*/
|
||||
|
||||
#define FamilyInternet 0 /* IPv4 */
|
||||
#define FamilyDECnet 1
|
||||
#define FamilyChaos 2
|
||||
#define FamilyInternet6 6
|
||||
#define FamilyAmoeba 33
|
||||
#define FamilyLocalHost 252
|
||||
#define FamilyKrb5Principal 253
|
||||
#define FamilyNetname 254
|
||||
#define FamilyLocal 256
|
||||
#define FamilyWild 65535
|
||||
|
||||
/*
|
||||
* TRANS(ConvertAddress) converts a sockaddr based address to an
|
||||
* X authorization based address. Some of this is defined as part of
|
||||
* the ChangeHost protocol. The rest is just done in a consistent manner.
|
||||
*/
|
||||
|
||||
int
|
||||
TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
|
||||
|
||||
{
|
||||
|
||||
prmsg(2,"ConvertAddress(%d,%d,%p)\n",*familyp,*addrlenp,(void *) *addrp);
|
||||
|
||||
switch( *familyp )
|
||||
{
|
||||
#if defined(TCPCONN)
|
||||
case AF_INET:
|
||||
{
|
||||
/*
|
||||
* Check for the BSD hack localhost address 127.0.0.1.
|
||||
* In this case, we are really FamilyLocal.
|
||||
*/
|
||||
|
||||
struct sockaddr_in saddr;
|
||||
int len = sizeof(saddr.sin_addr.s_addr);
|
||||
char *cp = (char *) &saddr.sin_addr.s_addr;
|
||||
|
||||
memcpy (&saddr, *addrp, sizeof (struct sockaddr_in));
|
||||
|
||||
if ((len == 4) && (cp[0] == 127) && (cp[1] == 0) &&
|
||||
(cp[2] == 0) && (cp[3] == 1))
|
||||
{
|
||||
*familyp=FamilyLocal;
|
||||
}
|
||||
else
|
||||
{
|
||||
*familyp=FamilyInternet;
|
||||
*addrlenp=len;
|
||||
memcpy(*addrp,&saddr.sin_addr,len);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(IPv6) && defined(AF_INET6)
|
||||
case AF_INET6:
|
||||
{
|
||||
struct sockaddr_in6 saddr6;
|
||||
|
||||
memcpy (&saddr6, *addrp, sizeof (struct sockaddr_in6));
|
||||
|
||||
if (IN6_IS_ADDR_LOOPBACK(&saddr6.sin6_addr))
|
||||
{
|
||||
*familyp=FamilyLocal;
|
||||
}
|
||||
else if (IN6_IS_ADDR_V4MAPPED(&(saddr6.sin6_addr))) {
|
||||
char *cp = (char *) &saddr6.sin6_addr.s6_addr[12];
|
||||
|
||||
if ((cp[0] == 127) && (cp[1] == 0) &&
|
||||
(cp[2] == 0) && (cp[3] == 1))
|
||||
{
|
||||
*familyp=FamilyLocal;
|
||||
}
|
||||
else
|
||||
{
|
||||
*familyp=FamilyInternet;
|
||||
*addrlenp = sizeof (struct in_addr);
|
||||
memcpy(*addrp,cp,*addrlenp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*familyp=FamilyInternet6;
|
||||
*addrlenp=sizeof(saddr6.sin6_addr);
|
||||
memcpy(*addrp,&saddr6.sin6_addr,sizeof(saddr6.sin6_addr));
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* IPv6 */
|
||||
#endif /* defined(TCPCONN) */
|
||||
|
||||
|
||||
#if defined(UNIXCONN) || defined(LOCALCONN)
|
||||
case AF_UNIX:
|
||||
{
|
||||
*familyp=FamilyLocal;
|
||||
break;
|
||||
}
|
||||
#endif /* defined(UNIXCONN) || defined(LOCALCONN) */
|
||||
|
||||
#if (defined(__SCO__) || defined(__UNIXWARE__)) && defined(LOCALCONN)
|
||||
case 0:
|
||||
{
|
||||
*familyp=FamilyLocal;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
prmsg(1,"ConvertAddress: Unknown family type %d\n",
|
||||
*familyp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (*familyp == FamilyLocal)
|
||||
{
|
||||
/*
|
||||
* In the case of a local connection, we need to get the
|
||||
* host name for authentication.
|
||||
*/
|
||||
|
||||
char hostnamebuf[256];
|
||||
int len = TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf);
|
||||
|
||||
if (len > 0) {
|
||||
if (*addrp && *addrlenp < (len + 1))
|
||||
{
|
||||
free (*addrp);
|
||||
*addrp = NULL;
|
||||
}
|
||||
if (!*addrp)
|
||||
*addrp = malloc (len + 1);
|
||||
if (*addrp) {
|
||||
strcpy ((char *) *addrp, hostnamebuf);
|
||||
*addrlenp = len;
|
||||
} else {
|
||||
*addrlenp = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*addrp)
|
||||
free (*addrp);
|
||||
*addrp = NULL;
|
||||
*addrlenp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* X11_t */
|
||||
|
||||
#ifdef ICE_t
|
||||
|
||||
/* Needed for _XGethostbyaddr usage in TRANS(GetPeerNetworkId) */
|
||||
# if defined(TCPCONN) || defined(UNIXCONN)
|
||||
# define X_INCLUDE_NETDB_H
|
||||
# define XOS_USE_NO_LOCKING
|
||||
# include <X11/Xos_r.h>
|
||||
# endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
char *
|
||||
TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
|
||||
|
||||
{
|
||||
int family = ciptr->family;
|
||||
char *addr = ciptr->addr;
|
||||
char hostnamebuf[256];
|
||||
char *networkId = NULL;
|
||||
const char *transName = ciptr->transptr->TransName;
|
||||
|
||||
if (gethostname (hostnamebuf, sizeof (hostnamebuf)) < 0)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
switch (family)
|
||||
{
|
||||
#if defined(UNIXCONN) || defined(LOCALCONN)
|
||||
case AF_UNIX:
|
||||
{
|
||||
struct sockaddr_un *saddr = (struct sockaddr_un *) addr;
|
||||
networkId = malloc (3 + strlen (transName) +
|
||||
strlen (hostnamebuf) + strlen (saddr->sun_path));
|
||||
sprintf (networkId, "%s/%s:%s", transName,
|
||||
hostnamebuf, saddr->sun_path);
|
||||
break;
|
||||
}
|
||||
#endif /* defined(UNIXCONN) || defined(LOCALCONN) */
|
||||
|
||||
#if defined(TCPCONN)
|
||||
case AF_INET:
|
||||
#if defined(IPv6) && defined(AF_INET6)
|
||||
case AF_INET6:
|
||||
#endif
|
||||
{
|
||||
struct sockaddr_in *saddr = (struct sockaddr_in *) addr;
|
||||
#if defined(IPv6) && defined(AF_INET6)
|
||||
struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) addr;
|
||||
#endif
|
||||
int portnum;
|
||||
char portnumbuf[10];
|
||||
|
||||
|
||||
#if defined(IPv6) && defined(AF_INET6)
|
||||
if (family == AF_INET6)
|
||||
portnum = ntohs (saddr6->sin6_port);
|
||||
else
|
||||
#endif
|
||||
portnum = ntohs (saddr->sin_port);
|
||||
|
||||
snprintf (portnumbuf, sizeof(portnumbuf), "%d", portnum);
|
||||
networkId = malloc (3 + strlen (transName) +
|
||||
strlen (hostnamebuf) + strlen (portnumbuf));
|
||||
sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, portnumbuf);
|
||||
break;
|
||||
}
|
||||
#endif /* defined(TCPCONN) */
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return (networkId);
|
||||
}
|
||||
|
||||
#include <setjmp.h>
|
||||
static jmp_buf env;
|
||||
|
||||
#ifdef SIGALRM
|
||||
static volatile int nameserver_timedout = 0;
|
||||
|
||||
static void
|
||||
nameserver_lost(int sig _X_UNUSED)
|
||||
{
|
||||
nameserver_timedout = 1;
|
||||
longjmp (env, -1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#endif /* SIGALARM */
|
||||
|
||||
|
||||
char *
|
||||
TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
|
||||
|
||||
{
|
||||
int family = ciptr->family;
|
||||
char *peer_addr = ciptr->peeraddr;
|
||||
char *hostname;
|
||||
char addrbuf[256];
|
||||
const char *addr = NULL;
|
||||
|
||||
switch (family)
|
||||
{
|
||||
case AF_UNSPEC:
|
||||
#if defined(UNIXCONN) || defined(LOCALCONN)
|
||||
case AF_UNIX:
|
||||
{
|
||||
if (gethostname (addrbuf, sizeof (addrbuf)) == 0)
|
||||
addr = addrbuf;
|
||||
break;
|
||||
}
|
||||
#endif /* defined(UNIXCONN) || defined(LOCALCONN) */
|
||||
|
||||
#if defined(TCPCONN)
|
||||
case AF_INET:
|
||||
#if defined(IPv6) && defined(AF_INET6)
|
||||
case AF_INET6:
|
||||
#endif
|
||||
{
|
||||
struct sockaddr_in *saddr = (struct sockaddr_in *) peer_addr;
|
||||
#if defined(IPv6) && defined(AF_INET6)
|
||||
struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) peer_addr;
|
||||
#endif
|
||||
char *address;
|
||||
int addresslen;
|
||||
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
|
||||
_Xgethostbynameparams hparams;
|
||||
#endif
|
||||
struct hostent * volatile hostp = NULL;
|
||||
|
||||
#if defined(IPv6) && defined(AF_INET6)
|
||||
if (family == AF_INET6)
|
||||
{
|
||||
address = (char *) &saddr6->sin6_addr;
|
||||
addresslen = sizeof (saddr6->sin6_addr);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
address = (char *) &saddr->sin_addr;
|
||||
addresslen = sizeof (saddr->sin_addr);
|
||||
}
|
||||
|
||||
#ifdef SIGALRM
|
||||
/*
|
||||
* gethostbyaddr can take a LONG time if the host does not exist.
|
||||
* Assume that if it does not respond in NAMESERVER_TIMEOUT seconds
|
||||
* that something is wrong and do not make the user wait.
|
||||
* gethostbyaddr will continue after a signal, so we have to
|
||||
* jump out of it.
|
||||
*/
|
||||
|
||||
nameserver_timedout = 0;
|
||||
signal (SIGALRM, nameserver_lost);
|
||||
alarm (4);
|
||||
if (setjmp(env) == 0) {
|
||||
#endif
|
||||
hostp = _XGethostbyaddr (address, addresslen, family, hparams);
|
||||
#ifdef SIGALRM
|
||||
}
|
||||
alarm (0);
|
||||
#endif
|
||||
if (hostp != NULL)
|
||||
addr = hostp->h_name;
|
||||
else
|
||||
#if defined(IPv6) && defined(AF_INET6)
|
||||
addr = inet_ntop (family, address, addrbuf, sizeof (addrbuf));
|
||||
#else
|
||||
addr = inet_ntoa (saddr->sin_addr);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
#endif /* defined(TCPCONN) */
|
||||
|
||||
|
||||
default:
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
hostname = malloc (strlen (ciptr->transptr->TransName) + strlen (addr) + 2);
|
||||
strcpy (hostname, ciptr->transptr->TransName);
|
||||
strcat (hostname, "/");
|
||||
if (addr)
|
||||
strcat (hostname, addr);
|
||||
|
||||
return (hostname);
|
||||
}
|
||||
|
||||
#endif /* ICE_t */
|
||||
|
||||
|
||||
#if defined(WIN32) && defined(TCPCONN)
|
||||
int
|
||||
TRANS(WSAStartup) (void)
|
||||
{
|
||||
static WSADATA wsadata;
|
||||
|
||||
prmsg (2,"WSAStartup()\n");
|
||||
|
||||
if (!wsadata.wVersion && WSAStartup(MAKEWORD(2,2), &wsadata))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(X11_t)
|
||||
static int
|
||||
is_numeric (const char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (int) strlen (str); i++)
|
||||
if (!isdigit (str[i]))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if !defined(S_IFLNK) && !defined(S_ISLNK)
|
||||
#undef lstat
|
||||
#define lstat(a,b) stat(a,b)
|
||||
#endif
|
||||
|
||||
#define FAIL_IF_NOMODE 1
|
||||
#define FAIL_IF_NOT_ROOT 2
|
||||
#define WARN_NO_ACCESS 4
|
||||
|
||||
/*
|
||||
* We make the assumption that when the 'sticky' (t) bit is requested
|
||||
* it's not save if the directory has non-root ownership or the sticky
|
||||
* bit cannot be set and fail.
|
||||
*/
|
||||
static int
|
||||
trans_mkdir(const char *path, int mode)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (lstat(path, &buf) != 0) {
|
||||
if (errno != ENOENT) {
|
||||
prmsg(1, "mkdir: ERROR: (l)stat failed for %s (%d)\n",
|
||||
path, errno);
|
||||
return -1;
|
||||
}
|
||||
/* Dir doesn't exist. Try to create it */
|
||||
|
||||
#if !defined(WIN32) && !defined(__CYGWIN__)
|
||||
/*
|
||||
* 'sticky' bit requested: assume application makes
|
||||
* certain security implications. If effective user ID
|
||||
* is != 0: fail as we may not be able to meet them.
|
||||
*/
|
||||
if (geteuid() != 0) {
|
||||
if (mode & 01000) {
|
||||
prmsg(1, "mkdir: ERROR: euid != 0,"
|
||||
"directory %s will not be created.\n",
|
||||
path);
|
||||
#ifdef FAIL_HARD
|
||||
return -1;
|
||||
#endif
|
||||
} else {
|
||||
prmsg(1, "mkdir: Cannot create %s with root ownership\n",
|
||||
path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
if (mkdir(path, mode) == 0) {
|
||||
if (chmod(path, mode)) {
|
||||
prmsg(1, "mkdir: ERROR: Mode of %s should be set to %04o\n",
|
||||
path, mode);
|
||||
#ifdef FAIL_HARD
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
if (mkdir(path) == 0) {
|
||||
#endif
|
||||
} else {
|
||||
prmsg(1, "mkdir: ERROR: Cannot create %s\n",
|
||||
path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
if (S_ISDIR(buf.st_mode)) {
|
||||
int updateOwner = 0;
|
||||
int updateMode = 0;
|
||||
int updatedOwner = 0;
|
||||
int updatedMode = 0;
|
||||
int status = 0;
|
||||
/* Check if the directory's ownership is OK. */
|
||||
if (buf.st_uid != 0)
|
||||
updateOwner = 1;
|
||||
|
||||
/*
|
||||
* Check if the directory's mode is OK. An exact match isn't
|
||||
* required, just a mode that isn't more permissive than the
|
||||
* one requested.
|
||||
*/
|
||||
if ((~mode) & 0077 & buf.st_mode)
|
||||
updateMode = 1;
|
||||
|
||||
/*
|
||||
* If the directory is not writeable not everybody may
|
||||
* be able to create sockets. Therefore warn if mode
|
||||
* cannot be fixed.
|
||||
*/
|
||||
if ((~buf.st_mode) & 0022 & mode) {
|
||||
updateMode = 1;
|
||||
status |= WARN_NO_ACCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* If 'sticky' bit is requested fail if owner isn't root
|
||||
* as we assume the caller makes certain security implications
|
||||
*/
|
||||
if (mode & 01000) {
|
||||
status |= FAIL_IF_NOT_ROOT;
|
||||
if (!(buf.st_mode & 01000)) {
|
||||
status |= FAIL_IF_NOMODE;
|
||||
updateMode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAS_FCHOWN
|
||||
/*
|
||||
* If fchown(2) and fchmod(2) are available, try to correct the
|
||||
* directory's owner and mode. Otherwise it isn't safe to attempt
|
||||
* to do this.
|
||||
*/
|
||||
if (updateMode || updateOwner) {
|
||||
int fd = -1;
|
||||
struct stat fbuf;
|
||||
if ((fd = open(path, O_RDONLY)) != -1) {
|
||||
if (fstat(fd, &fbuf) == -1) {
|
||||
prmsg(1, "mkdir: ERROR: fstat failed for %s (%d)\n",
|
||||
path, errno);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* Verify that we've opened the same directory as was
|
||||
* checked above.
|
||||
*/
|
||||
if (!S_ISDIR(fbuf.st_mode) ||
|
||||
buf.st_dev != fbuf.st_dev ||
|
||||
buf.st_ino != fbuf.st_ino) {
|
||||
prmsg(1, "mkdir: ERROR: inode for %s changed\n",
|
||||
path);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
if (updateOwner && fchown(fd, 0, 0) == 0)
|
||||
updatedOwner = 1;
|
||||
if (updateMode && fchmod(fd, mode) == 0)
|
||||
updatedMode = 1;
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (updateOwner && !updatedOwner) {
|
||||
#ifdef FAIL_HARD
|
||||
if (status & FAIL_IF_NOT_ROOT) {
|
||||
prmsg(1, "mkdir: ERROR: Owner of %s must be set to root\n",
|
||||
path);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#if !defined(__APPLE_CC__) && !defined(__CYGWIN__)
|
||||
prmsg(1, "mkdir: Owner of %s should be set to root\n",
|
||||
path);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (updateMode && !updatedMode) {
|
||||
#ifdef FAIL_HARD
|
||||
if (status & FAIL_IF_NOMODE) {
|
||||
prmsg(1, "mkdir: ERROR: Mode of %s must be set to %04o\n",
|
||||
path, mode);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
prmsg(1, "mkdir: Mode of %s should be set to %04o\n",
|
||||
path, mode);
|
||||
if (status & WARN_NO_ACCESS) {
|
||||
prmsg(1, "mkdir: this may cause subsequent errors\n");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* In all other cases, fail */
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* TRANS_SERVER */
|
||||
74
nx-X11/lib/include/xtrans/transport.c
Normal file
74
nx-X11/lib/include/xtrans/transport.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
|
||||
Copyright 1993, 1994, 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 1993, 1994 NCR Corporation - Dayton, Ohio, USA
|
||||
*
|
||||
* 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 NCR not be used in advertising
|
||||
* or publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. NCR makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL NCR 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.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define XTRANS_TRANSPORT_C /* used to flag Xtransint.h that it's being used
|
||||
here, not just #included in another file */
|
||||
|
||||
#include "Xtransint.h"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#ifdef LOCALCONN
|
||||
#include "Xtranslcl.c"
|
||||
#endif
|
||||
#if defined(TCPCONN) || defined(UNIXCONN)
|
||||
#include "Xtranssock.c"
|
||||
#endif
|
||||
#include "Xtrans.c"
|
||||
#include "Xtransutil.c"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
Reference in New Issue
Block a user