|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _XUTIL_H_ |
|
#define _XUTIL_H_ |
|
|
|
|
|
|
|
#if defined(MAC_OSX_TK) |
|
# define Region XRegion |
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#define NoValue 0x0000 |
|
#define XValue 0x0001 |
|
#define YValue 0x0002 |
|
#define WidthValue 0x0004 |
|
#define HeightValue 0x0008 |
|
#define AllValues 0x000F |
|
#define XNegative 0x0010 |
|
#define YNegative 0x0020 |
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
long flags; |
|
int x, y; |
|
int width, height; |
|
int min_width, min_height; |
|
int max_width, max_height; |
|
int width_inc, height_inc; |
|
struct { |
|
int x; |
|
int y; |
|
} min_aspect, max_aspect; |
|
int base_width, base_height; |
|
int win_gravity; |
|
} XSizeHints; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define USPosition (1L << 0) |
|
#define USSize (1L << 1) |
|
|
|
#define PPosition (1L << 2) |
|
#define PSize (1L << 3) |
|
#define PMinSize (1L << 4) |
|
#define PMaxSize (1L << 5) |
|
#define PResizeInc (1L << 6) |
|
#define PAspect (1L << 7) |
|
#define PBaseSize (1L << 8) |
|
#define PWinGravity (1L << 9) |
|
|
|
|
|
#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect) |
|
|
|
|
|
|
|
typedef struct { |
|
long flags; |
|
Bool input; |
|
|
|
int initial_state; |
|
Pixmap icon_pixmap; |
|
Window icon_window; |
|
int icon_x, icon_y; |
|
Pixmap icon_mask; |
|
XID window_group; |
|
|
|
} 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 WithdrawnState 0 |
|
#define NormalState 1 |
|
#define IconicState 3 |
|
|
|
|
|
|
|
|
|
#define DontCareState 0 |
|
#define ZoomState 2 |
|
#define InactiveState 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
unsigned char *value; |
|
Atom encoding; |
|
int format; |
|
unsigned long nitems; |
|
} XTextProperty; |
|
|
|
#define XNoMemory -1 |
|
#define XLocaleNotSupported -2 |
|
#define XConverterNotFound -3 |
|
|
|
typedef enum { |
|
XStringStyle, |
|
XCompoundTextStyle, |
|
XTextStyle, |
|
XStdICCTextStyle |
|
} 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; |
|
|
|
|
|
|
|
|
|
|
|
#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))) |
|
|
|
|
|
|
|
|
|
typedef struct _XComposeStatus { |
|
XPointer compose_ptr; |
|
int chars_matched; |
|
} XComposeStatus; |
|
|
|
|
|
|
|
|
|
#define IsKeypadKey(keysym) \ |
|
(((unsigned)(keysym) >= XK_KP_Space) && ((unsigned)(keysym) <= XK_KP_Equal)) |
|
|
|
#define IsCursorKey(keysym) \ |
|
(((unsigned)(keysym) >= XK_Home) && ((unsigned)(keysym) < XK_Select)) |
|
|
|
#define IsPFKey(keysym) \ |
|
(((unsigned)(keysym) >= XK_KP_F1) && ((unsigned)(keysym) <= XK_KP_F4)) |
|
|
|
#define IsFunctionKey(keysym) \ |
|
(((unsigned)(keysym) >= XK_F1) && ((unsigned)(keysym) <= XK_F35)) |
|
|
|
#define IsMiscFunctionKey(keysym) \ |
|
(((unsigned)(keysym) >= XK_Select) && ((unsigned)(keysym) <= XK_Break)) |
|
|
|
#define IsModifierKey(keysym) \ |
|
((((unsigned)(keysym) >= XK_Shift_L) && ((unsigned)(keysym) <= XK_Hyper_R)) \ |
|
|| ((unsigned)(keysym) == XK_Mode_switch) \ |
|
|| ((unsigned)(keysym) == XK_Num_Lock)) |
|
|
|
|
|
|
|
typedef struct _XRegion *Region; |
|
|
|
|
|
|
|
#define RectangleOut 0 |
|
#define RectangleIn 1 |
|
#define RectanglePart 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
Visual *visual; |
|
VisualID visualid; |
|
int screen; |
|
int depth; |
|
#if defined(__cplusplus) || defined(c_plusplus) |
|
int c_class; |
|
#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 |
|
|
|
|
|
|
|
|
|
|
|
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; |
|
XID killid; |
|
} XStandardColormap; |
|
|
|
#define ReleaseByFreeingColormap ((XID) 1L) |
|
|
|
|
|
|
|
|
|
|
|
#define BitmapSuccess 0 |
|
#define BitmapOpenFailed 1 |
|
#define BitmapFileInvalid 2 |
|
#define BitmapNoMemory 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define XCSUCCESS 0 |
|
#define XCNOMEM 1 |
|
#define XCNOENT 2 |
|
|
|
typedef int XContext; |
|
|
|
#define XUniqueContext() ((XContext) XrmUniqueQuark()) |
|
#define XStringToContext(string) ((XContext) XrmStringToQuark(string)) |
|
|
|
_XFUNCPROTOBEGIN |
|
|
|
|
|
|
|
extern XClassHint *XAllocClassHint ( |
|
#if NeedFunctionPrototypes |
|
void |
|
#endif |
|
); |
|
|
|
extern XIconSize *XAllocIconSize ( |
|
#if NeedFunctionPrototypes |
|
void |
|
#endif |
|
); |
|
|
|
extern XSizeHints *XAllocSizeHints ( |
|
#if NeedFunctionPrototypes |
|
void |
|
#endif |
|
); |
|
|
|
extern XStandardColormap *XAllocStandardColormap ( |
|
#if NeedFunctionPrototypes |
|
void |
|
#endif |
|
); |
|
|
|
extern XWMHints *XAllocWMHints ( |
|
#if NeedFunctionPrototypes |
|
void |
|
#endif |
|
); |
|
|
|
extern void XClipBox( |
|
#if NeedFunctionPrototypes |
|
Region , |
|
XRectangle* |
|
#endif |
|
); |
|
|
|
extern Region XCreateRegion( |
|
#if NeedFunctionPrototypes |
|
void |
|
#endif |
|
); |
|
|
|
extern char *XDefaultString( |
|
#if NeedFunctionPrototypes |
|
void |
|
#endif |
|
); |
|
|
|
extern int XDeleteContext( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
XID , |
|
XContext |
|
#endif |
|
); |
|
|
|
extern void XDestroyRegion( |
|
#if NeedFunctionPrototypes |
|
Region |
|
#endif |
|
); |
|
|
|
extern Bool XEmptyRegion( |
|
#if NeedFunctionPrototypes |
|
Region |
|
#endif |
|
); |
|
|
|
extern Bool XEqualRegion( |
|
#if NeedFunctionPrototypes |
|
Region , |
|
Region |
|
#endif |
|
); |
|
|
|
extern int XFindContext( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
XID , |
|
XContext , |
|
XPointer* |
|
#endif |
|
); |
|
|
|
extern Status XGetClassHint( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XClassHint* |
|
#endif |
|
); |
|
|
|
extern Status XGetIconSizes( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XIconSize** , |
|
int* |
|
#endif |
|
); |
|
|
|
extern Status XGetNormalHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XSizeHints* |
|
#endif |
|
); |
|
|
|
extern Status XGetRGBColormaps( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XStandardColormap** , |
|
int* , |
|
Atom |
|
#endif |
|
); |
|
|
|
extern Status XGetSizeHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XSizeHints* , |
|
Atom |
|
#endif |
|
); |
|
|
|
extern Status XGetStandardColormap( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XStandardColormap* , |
|
Atom |
|
#endif |
|
); |
|
|
|
extern Status XGetTextProperty( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XTextProperty* , |
|
Atom |
|
#endif |
|
); |
|
|
|
|
|
extern Status XGetWMClientMachine( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XTextProperty* |
|
#endif |
|
); |
|
|
|
extern XWMHints *XGetWMHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window |
|
#endif |
|
); |
|
|
|
extern Status XGetWMIconName( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XTextProperty* |
|
#endif |
|
); |
|
|
|
extern Status XGetWMName( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XTextProperty* |
|
#endif |
|
); |
|
|
|
extern Status XGetWMNormalHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XSizeHints* , |
|
long* |
|
#endif |
|
); |
|
|
|
extern Status XGetWMSizeHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XSizeHints* , |
|
long* , |
|
Atom |
|
#endif |
|
); |
|
|
|
extern Status XGetZoomHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XSizeHints* |
|
#endif |
|
); |
|
|
|
extern void XIntersectRegion( |
|
#if NeedFunctionPrototypes |
|
Region , |
|
Region , |
|
Region |
|
#endif |
|
); |
|
|
|
extern int XLookupString( |
|
#if NeedFunctionPrototypes |
|
XKeyEvent* , |
|
char* , |
|
int , |
|
KeySym* , |
|
XComposeStatus* |
|
#endif |
|
); |
|
|
|
extern Status XMatchVisualInfo( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
int , |
|
int , |
|
int , |
|
XVisualInfo* |
|
#endif |
|
); |
|
|
|
extern int XOffsetRegion( |
|
#if NeedFunctionPrototypes |
|
Region , |
|
int , |
|
int |
|
#endif |
|
); |
|
|
|
extern Bool XPointInRegion( |
|
#if NeedFunctionPrototypes |
|
Region , |
|
int , |
|
int |
|
#endif |
|
); |
|
|
|
extern Region XPolygonRegion( |
|
#if NeedFunctionPrototypes |
|
XPoint* , |
|
int , |
|
int |
|
#endif |
|
); |
|
|
|
extern int XRectInRegion( |
|
#if NeedFunctionPrototypes |
|
Region , |
|
int , |
|
int , |
|
unsigned int , |
|
unsigned int |
|
#endif |
|
); |
|
|
|
extern int XSaveContext( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
XID , |
|
XContext , |
|
_Xconst char* |
|
#endif |
|
); |
|
|
|
extern void XSetClassHint( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XClassHint* |
|
#endif |
|
); |
|
|
|
extern void XSetIconSizes( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XIconSize* , |
|
int |
|
#endif |
|
); |
|
|
|
extern void XSetNormalHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XSizeHints* |
|
#endif |
|
); |
|
|
|
extern void XSetRGBColormaps( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XStandardColormap* , |
|
int , |
|
Atom |
|
#endif |
|
); |
|
|
|
extern void XSetSizeHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XSizeHints* , |
|
Atom |
|
#endif |
|
); |
|
|
|
extern void XSetStandardProperties( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
_Xconst char* , |
|
_Xconst char* , |
|
Pixmap , |
|
char** , |
|
int , |
|
XSizeHints* |
|
#endif |
|
); |
|
|
|
extern void XSetTextProperty( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XTextProperty* , |
|
Atom |
|
#endif |
|
); |
|
|
|
extern void XSetWMHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XWMHints* |
|
#endif |
|
); |
|
|
|
extern void XSetWMIconName( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XTextProperty* |
|
#endif |
|
); |
|
|
|
extern void XSetWMName( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XTextProperty* |
|
#endif |
|
); |
|
|
|
extern void XSetWMNormalHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XSizeHints* |
|
#endif |
|
); |
|
|
|
extern void XSetWMProperties( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XTextProperty* , |
|
XTextProperty* , |
|
char** , |
|
int , |
|
XSizeHints* , |
|
XWMHints* , |
|
XClassHint* |
|
#endif |
|
); |
|
|
|
extern void XmbSetWMProperties( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
_Xconst char* , |
|
_Xconst char* , |
|
char** , |
|
int , |
|
XSizeHints* , |
|
XWMHints* , |
|
XClassHint* |
|
#endif |
|
); |
|
|
|
extern void XSetWMSizeHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XSizeHints* , |
|
Atom |
|
#endif |
|
); |
|
|
|
extern void XSetRegion( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
GC , |
|
Region |
|
#endif |
|
); |
|
|
|
extern void XSetStandardColormap( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XStandardColormap* , |
|
Atom |
|
#endif |
|
); |
|
|
|
extern void XSetZoomHints( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
Window , |
|
XSizeHints* |
|
#endif |
|
); |
|
|
|
extern void XShrinkRegion( |
|
#if NeedFunctionPrototypes |
|
Region , |
|
int , |
|
int |
|
#endif |
|
); |
|
|
|
extern void XSubtractRegion( |
|
#if NeedFunctionPrototypes |
|
Region , |
|
Region , |
|
Region |
|
#endif |
|
); |
|
|
|
extern int XmbTextListToTextProperty( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
char** , |
|
int , |
|
XICCEncodingStyle , |
|
XTextProperty* |
|
#endif |
|
); |
|
|
|
extern int XwcTextListToTextProperty( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
wchar_t** , |
|
int , |
|
XICCEncodingStyle , |
|
XTextProperty* |
|
#endif |
|
); |
|
|
|
extern void XwcFreeStringList( |
|
#if NeedFunctionPrototypes |
|
wchar_t** |
|
#endif |
|
); |
|
|
|
extern Status XTextPropertyToStringList( |
|
#if NeedFunctionPrototypes |
|
XTextProperty* , |
|
char*** , |
|
int* |
|
#endif |
|
); |
|
|
|
extern int XmbTextPropertyToTextList( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
XTextProperty* , |
|
char*** , |
|
int* |
|
#endif |
|
); |
|
|
|
extern int XwcTextPropertyToTextList( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
XTextProperty* , |
|
wchar_t*** , |
|
int* |
|
#endif |
|
); |
|
|
|
extern void XUnionRectWithRegion( |
|
#if NeedFunctionPrototypes |
|
XRectangle* , |
|
Region , |
|
Region |
|
#endif |
|
); |
|
|
|
extern int XUnionRegion( |
|
#if NeedFunctionPrototypes |
|
Region , |
|
Region , |
|
Region |
|
#endif |
|
); |
|
|
|
extern int XWMGeometry( |
|
#if NeedFunctionPrototypes |
|
Display* , |
|
int , |
|
_Xconst char* , |
|
_Xconst char* , |
|
unsigned int , |
|
XSizeHints* , |
|
int* , |
|
int* , |
|
int* , |
|
int* , |
|
int* |
|
#endif |
|
); |
|
|
|
extern void XXorRegion( |
|
#if NeedFunctionPrototypes |
|
Region , |
|
Region , |
|
Region |
|
#endif |
|
); |
|
|
|
_XFUNCPROTOEND |
|
|
|
#if defined(MAC_OSX_TK) |
|
# undef Region |
|
#endif |
|
|
|
#endif |
|
|