scx/c/xlib/xlib.h

254 lines
6.9 KiB
C

#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
//#undef S48_TRUE
//#undef S48_FALSE
#ifndef NeedFunctionPrototypes /* Kludge */
#error "X11 Release 3 (or earlier) no longer supported"
#endif
#if XlibSpecificationRelease >= 5
# define XLIB_RELEASE_5_OR_LATER
#endif
#if XlibSpecificationRelease >= 6
# define XLIB_RELEASE_6_OR_LATER
#endif
#include "scheme48.h"
#define S48_NULL_P(x) S48_EQ(x, S48_NULL)
#define S48_FALSE_P(x) S48_EQ(x, S48_FALSE)
/* Extraction-Macros for the new types, from their s48_value wrapping.
*/
#define EXTRACT_DISPLAY(x) (Display*)s48_extract_integer(x)
#define ENTER_DISPLAY(x) s48_enter_integer((long)x)
#define EXTRACT_WINDOW(x) (Window)s48_extract_integer(x)
#define ENTER_WINDOW(x) s48_enter_integer((long)x)
#define EXTRACT_COLOR(x) (XColor*)S48_EXTRACT_VALUE_POINTER(x, XColor)
#define EXTRACT_COLORMAP(x) (Colormap)s48_extract_integer(x)
#define ENTER_COLORMAP(x) s48_enter_integer((long)x)
#define EXTRACT_PIXEL(x) (unsigned long)s48_extract_integer(x)
#define ENTER_PIXEL(x) s48_enter_integer((long)x)
#define EXTRACT_GCONTEXT(x) (GC)s48_extract_integer(x)
#define ENTER_GCONTEXT(x) s48_enter_integer((long)x)
#define EXTRACT_PIXMAP(x) (Pixmap)s48_extract_integer(x)
#define ENTER_PIXMAP(x) s48_enter_integer((long)x)
#define EXTRACT_DRAWABLE(x) (Drawable)s48_extract_integer(x)
#define ENTER_ATOM(x) s48_enter_integer((long)x)
#define EXTRACT_ATOM(x) (Atom)s48_extract_integer(x)
#define ENTER_TIME(x) x == CurrentTime ? s48_enter_symbol("now") : s48_enter_integer(x)
#define EXTRACT_TIME(x) S48_SYMBOL_P(x) ? CurrentTime : (int)s48_extract_integer(x)
// TODO:
#define ENTER_VISUAL(x) S48_FALSE
#define ENTER_FONT(x) S48_FALSE
#define EXTRACT_FONT(x) (Font)0
/*
extern int T_Display;
extern int T_Gc;
extern int T_Pixel;
extern int T_Pixmap;
extern int T_Window;
extern int T_Font;
extern int T_Colormap;
extern int T_Color;
extern int T_Cursor;
extern int T_Atom;
#define DISPLAY(x) ((struct S_Display *)POINTER(x))
#define GCONTEXT(x) ((struct S_Gc *)POINTER(x))
#define PIXEL(x) ((struct S_Pixel *)POINTER(x))
#define PIXMAP(x) ((struct S_Pixmap *)POINTER(x))
#define WINDOW(x) ((struct S_Window *)POINTER(x))
#define FONT(x) ((struct S_Font *)POINTER(x))
#define COLORMAP(x) ((struct S_Colormap *)POINTER(x))
#define COLOR(x) ((struct S_Color *)POINTER(x))
#define CURSOR(x) ((struct S_Cursor *)POINTER(x))
#define ATOM(x) ((struct S_Atom *)POINTER(x))
struct S_Display {
s48_value after;
Display *dpy;
char free;
};
struct S_Gc {
s48_value tag;
GC gc;
Display *dpy;
char free;
};
struct S_Pixel {
s48_value tag;
unsigned long pix;
};
struct S_Pixmap {
s48_value tag;
Pixmap pm;
Display *dpy;
char free;
};
struct S_Window {
s48_value tag;
Window win;
Display *dpy;
char free;
char finalize;
};
struct S_Font {
s48_value name;
Font id;
XFontStruct *info;
Display *dpy;
};
struct S_Colormap {
s48_value tag;
Colormap cm;
Display *dpy;
char free;
};
struct S_Color {
s48_value tag;
XColor c;
};
struct S_Cursor {
s48_value tag;
Cursor cursor;
Display *dpy;
char free;
};
struct S_Atom {
s48_value tag;
Atom atom;
};
enum Type {
T_NONE,
T_INT, T_s48_extract_char, T_PIXEL, T_PIXMAP, T_BOOL, T_FONT, T_COLORMAP, T_CURSOR,
T_WINDOW, T_MASK, T_SYM, T_SHORT, T_BACKGROUND, T_BORDER
};
*/
/*
typedef struct {
char *slot;
char *name;
enum Type type;
SYMDESCR *syms;
int mask;
} RECORD;
*/
typedef struct {
Window root;
int x, y, width, height, border_width, depth;
} GEOMETRY;
typedef struct {
char *name;
unsigned long val;
} SYMDESCR;
/*
C_LINKAGE_BEGIN
extern Colormap Get_Colormap P_((Object));
extern Cursor Get_Cursor P_((Object));
extern Drawable Get_Drawable P_((Object, Display**));
extern Font Get_Font P_((Object));
extern int Get_Screen_Number P_((Display*, Object));
extern s48_value Get_Event_Args P_((XEvent*));
extern Pixmap Get_Pixmap P_((Object));
extern Time Get_Time P_((Object));
extern Window Get_Window P_((Object));
extern XColor *Get_Color P_((Object));
extern unsigned long Get_Pixel P_((Object));
extern void Destroy_Event_Args P_((Object));
extern int Encode_Event P_((Object));
extern int Match_X_Obj P_((ELLIPSIS));
extern void Open_Font_Maybe P_((Object));
extern s48_value Make_Atom P_((Atom));
extern s48_value Make_Color P_((unsigned int, unsigned int, unsigned int));
extern s48_value Make_Colormap P_((int, Display*, Colormap));
extern s48_value Make_Cursor P_((Display*, Cursor));
extern s48_value Make_Cursor_Foreign P_((Display*, Cursor));
extern s48_value Make_Display P_((int, Display*));
extern s48_value Make_Font P_((Display*, Object, Font, XFontStruct*));
extern s48_value Make_Font_Foreign P_((Display*, Object, Font, XFontStruct*));
extern s48_value Make_Gc P_((int, Display*, GC));
extern s48_value Make_Pixel P_((unsigned long));
extern s48_value Make_Pixmap P_((Display*, Pixmap));
extern s48_value Make_Pixmap_Foreign P_((Display*, Pixmap));
extern s48_value Make_Window P_((int, Display*, Window));
extern s48_value P_Close_Display P_((Object));
extern s48_value P_Close_Font P_((Object));
extern s48_value P_Destroy_Window P_((Object));
extern s48_value P_Free_Colormap P_((Object));
extern s48_value P_Free_Cursor P_((Object));
extern s48_value P_Free_Gc P_((Object));
extern s48_value P_Free_Pixmap P_((Object));
extern s48_value P_Window_Unique_Id P_((Object));
extern s48_value Record_To_Vector
P_((RECORD*, int, Object, Display*, unsigned long));
extern unsigned long Vector_To_Record P_((Object, int, Object, RECORD*));
C_LINKAGE_END
*/
/*
extern XSetWindowAttributes SWA;
extern XWindowChanges WC;
extern XGCValues GCV;
extern GEOMETRY GEO;
extern XWindowAttributes WA;
extern XFontStruct FI;
extern XCharStruct CI;
extern XWMHints WMH;
extern XSizeHints SZH;
extern Set_Attr_Size, Conf_Size, GC_Size, Geometry_Size, Win_Attr_Size,
Font_Info_Size, Char_Info_Size, Wm_Hints_Size, Size_Hints_Size;
*/
/*
extern RECORD Set_Attr_Rec[], Conf_Rec[], GC_Rec[], Geometry_Rec[],
Win_Attr_Rec[], Font_Info_Rec[], Char_Info_Rec[], Wm_Hints_Rec[],
Size_Hints_Rec[];
*/
extern SYMDESCR Func_Syms[], Bit_Grav_Syms[], Event_Syms[], Error_Syms[],
Grav_Syms[], Backing_Store_Syms[], Class_Syms[], Stack_Mode_Syms[],
Line_Style_Syms[], State_Syms[], Cap_Style_Syms[], Join_Style_Syms[],
Map_State_Syms[], Fill_Style_Syms[], Fill_Rule_Syms[], Arc_Mode_Syms[],
Subwin_Mode_Syms[], Button_Syms[], Cross_Mode_Syms[], Cross_Detail_Syms[],
Focus_Detail_Syms[], Place_Syms[], Visibility_Syms[], Prop_Syms[],
Mapping_Syms[], Direction_Syms[], Shape_Syms[], Propmode_Syms[],
Grabstatus_Syms[], Allow_Events_Syms[], Revert_Syms[], Polyshape_Syms[],
Initial_State_Syms[], Bitmapstatus_Syms[], Circulate_Syms[],
Ordering_Syms[], Byte_Order_Syms[], Saveset_Syms[], Closemode_Syms[],
Event_Mask_Syms[];
/*
extern s48_value Sym_None, Sym_Now, Sym_Char_Info, Sym_Conf;
*/