scx/c/xlib/xlib.h

219 lines
8.6 KiB
C
Raw Normal View History

/* Copyright 2001-2003 by Norbert Freudemann, David Frese */
#ifndef _SCX_XLIB_H
#define _SCX_XLIB_H
2001-05-08 10:21:00 -04:00
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Intrinsic.h>
2001-05-08 10:21:00 -04:00
#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)
2001-05-08 10:21:00 -04:00
#define S48_INTEGER_P(x) (S48_FIXNUM_P(x) || S48_BIGNUM_P(x))
2003-04-17 10:53:27 -04:00
/* TODO: S48_x_POINTER already exitst ?!*/
#define S48_POINTER_P(x) S48_INTEGER_P(x)
#define S48_ENTER_POINTER(x) s48_enter_integer((long)x)
#define S48_EXTRACT_POINTER(x) (void*)s48_extract_integer(x)
extern s48_value s48_checked_record_ref(s48_value value, int i,
s48_value rectype);
extern int s48_list_length(s48_value list);
#define S48_EXTRACT_ENUM(x, typestr) \
s48_extract_integer(s48_checked_record_ref(x, 1, \
s48_get_imported_binding(typestr)))
2003-04-17 10:53:27 -04:00
#define S48_ENTER_ENUM(index, vvectorstr) \
S48_VECTOR_REF(S48_SHARED_BINDING_REF(s48_get_imported_binding(vvectorstr)),\
index)
2003-04-17 10:53:27 -04:00
#define S48_EXTRACT_ENUM_SET(x, typestr) s48_extract_enum_set(x, typestr)
extern unsigned long s48_extract_enum_set(s48_value v, char* typestr);
extern s48_value s48_enter_enum_set(unsigned long v, char* typestr);
2003-04-17 10:53:27 -04:00
/*** Extraction-Macros for the XIDs ********************************/
#define scx_extract_window(x) (Window)s48_extract_integer(x)
#define scx_enter_window(x) s48_enter_integer((long)x)
#define scx_extract_drawable(x) (Drawable)s48_extract_integer(x)
#define scx_enter_drawable(x) s48_enter_integer((long)x)
#define scx_extract_font(x) (Font)s48_extract_integer(x)
#define scx_enter_font(x) s48_enter_integer((long)x)
#define scx_extract_pixmap(x) (Pixmap)s48_extract_integer(x)
#define scx_enter_pixmap(x) s48_enter_integer((long)x)
#define scx_extract_cursor(x) (Cursor)s48_extract_integer(x)
#define scx_enter_cursor(x) s48_enter_integer((long)x)
#define scx_extract_colormap(x) (Colormap)s48_extract_integer(x)
#define scx_enter_colormap(x) s48_enter_integer((long)x)
#define scx_extract_gcontext(x) (GContext)s48_extract_integer(x)
#define scx_enter_gcontext(x) s48_enter_integer((long)x)
#define scx_extract_keysym(x) (GContext)s48_extract_integer(x)
#define scx_enter_keysym(x) s48_enter_integer((long)x)
2003-04-17 10:53:27 -04:00
/* other CARD32 */
#define scx_enter_atom(x) s48_enter_integer((long)x)
#define scx_extract_atom(x) (Atom)s48_extract_integer(x)
#define scx_enter_visualid(x) s48_enter_integer((long)x)
#define scx_extract_visualid(x) (VisualID)s48_extract_integer(x)
#define scx_enter_time(x) s48_enter_integer(x)
#define scx_extract_time(x) (Time)s48_extract_integer(x)
2003-04-17 10:53:27 -04:00
/* other ints */
#define scx_enter_keycode(x) s48_enter_fixnum(x)
#define scx_extract_keycode(x) (KeyCode)s48_extract_integer(x)
#define scx_extract_pixel(x) (Pixel)s48_extract_integer(x)
#define scx_enter_pixel(x) s48_enter_integer((long)x)
2003-04-17 10:53:27 -04:00
/* records */
#define scx_display s48_get_imported_binding("scx-display")
#define scx_extract_display(x) \
(Display*)s48_extract_integer(s48_checked_record_ref(x, 0, scx_display))
extern s48_value scx_enter_display(Display* dpy);
#define SCX_DISPLAY_AFTER_FUNCTION(d) \
s48_checked_record_ref(d, 14, scx_display)
#define scx_color s48_get_imported_binding("scx-color")
extern void scx_extract_color(s48_value v, XColor* c);
extern void scx_copy_color(const XColor* c, s48_value v);
extern s48_value scx_enter_color(const XColor* c);
#define scx_gc s48_get_imported_binding("scx-gc")
#define scx_extract_gc(x) \
(GC)s48_extract_integer(s48_checked_record_ref(x, 0, scx_gc))
extern s48_value scx_enter_gc(GC gc);
#define scx_fontstruct s48_get_imported_binding("scx-fontstruct")
#define scx_extract_fontstruct(x)\
(XFontStruct*)s48_extract_integer(s48_checked_record_ref(x, 0,\
scx_fontstruct))
extern s48_value scx_enter_charstruct(XCharStruct* cs);
extern s48_value scx_enter_fontstruct(XFontStruct* fs);
#define scx_screenformat s48_get_imported_binding("scx-screenformat")
#define scx_extract_screenformat(x)\
(ScreenFormat*)s48_extract_integer(s48_checked_record_ref(x, 0,\
scx_screenformat))
extern s48_value scx_enter_screenformat(ScreenFormat* sf);
#define scx_visual s48_get_imported_binding("scx-visual")
#define scx_extract_visual(x)\
(Visual*)s48_extract_integer(s48_checked_record_ref(x, 0,\
scx_visual))
extern s48_value scx_enter_visual(Visual* vis);
#define scx_screen s48_get_imported_binding("scx-screen")
#define scx_extract_screen(x)\
(Screen*)s48_extract_integer(s48_checked_record_ref(x, 0,\
scx_screen))
extern s48_value scx_enter_screen(Screen* scr);
extern void scx_extract_property(s48_value p, Atom* type, int* format,
char** data, int* nelements);
extern s48_value scx_enter_property(Atom type, int format, char* data,
int nelements);
extern scx_enter_enter_window_changes(XWindowChanges* WC, unsigned long mask);
extern unsigned long scx_extract_window_changes(s48_value changes,
XWindowChanges* WC);
extern s48_value scx_enter_x_error(XErrorEvent* xe);
extern void scx_extract_x_error(s48_value e, XErrorEvent* xe);
2003-04-17 10:53:27 -04:00
/* more types */
#define scx_extract_state(x) S48_EXTRACT_ENUM(x, "scx-state")
#define scx_enter_state(x) S48_ENTER_ENUM(x, "scx-states")
#define scx_extract_event_mask(x) S48_EXTRACT_ENUM_SET(x, "scx-event-mask")
#define scx_enter_event_mask(x) s48_enter_enum_set(x, "scx-event-mask")
#define scx_extract_gc_value(x) S48_EXTRACT_ENUM(x, "scx-gc-value")
#define scx_enter_gc_value(x) S48_ENTER_ENUM(x, "scx-gc-values")
#define scx_extract_byte_order(x) S48_EXTRACT_ENUM(x, "scx-byte-order")
#define scx_enter_byte_order(x) S48_ENTER_ENUM(x, "scx-byte-orders")
#define scx_extract_bit_order(x) S48_EXTRACT_ENUM(x, "scx-bit-order")
#define scx_enter_bit_order(x) S48_ENTER_ENUM(x, "scx-bit-orders")
#define scx_extract_bit_gravity(x) S48_EXTRACT_ENUM(x, "scx-bit-gravity")
#define scx_enter_bit_gravity(x) S48_ENTER_ENUM(x, "scx-bit-gravities")
#define scx_extract_win_gravity(x) S48_EXTRACT_ENUM(x, "scx-win-gravity")
#define scx_enter_win_gravity(x) S48_ENTER_ENUM(x, "scx-win-gravities")
#define scx_extract_event_type(x) S48_EXTRACT_ENUM(x, "scx-event-type")
#define scx_enter_event_type(x) S48_ENTER_ENUM(x, "scx-event-types")
#define scx_extract_font_direction(x) S48_EXTRACT_ENUM(x, "scx-font-direction")
#define scx_enter_font_direction(x) S48_ENTER_ENUM(x, "scx-font-directions")
#define scx_extract_state(x) S48_EXTRACT_ENUM(x, "scx-state")
#define scx_enter_state(x) S48_ENTER_ENUM(x, "scx-states")
#define scx_extract_state_set(x) S48_EXTRACT_ENUM_SET(x, "scx-state-set")
#define scx_enter_state_set(x) s48_enter_enum_set(x, "scx-state-set")
#define scx_extract_button(x) S48_EXTRACT_ENUM(x, "scx-button")
#define scx_enter_button(x) S48_ENTER_ENUM(x, "scx-buttons")
#define scx_extract_notify_mode(x) S48_EXTRACT_ENUM(x, "scx-notify-mode")
#define scx_enter_notify_mode(x) S48_ENTER_ENUM(x, "scx-notify-modes")
#define scx_extract_notify_detail(x) S48_EXTRACT_ENUM(x, "scx-notify-detail")
#define scx_enter_notify_detail(x) S48_ENTER_ENUM(x, "scx-notify-details")
#define scx_extract_visibility_state(x) \
S48_EXTRACT_ENUM(x, "scx-visibility-state")
#define scx_enter_visibility_state(x) \
S48_ENTER_ENUM(x, "scx-visibility-states")
#define scx_extract_place(x) S48_EXTRACT_ENUM(x, "scx-place")
#define scx_enter_place(x) S48_ENTER_ENUM(x, "scx-places")
#define scx_extract_property_state(x) S48_EXTRACT_ENUM(x, "scx-property-state")
#define scx_enter_property_state(x) S48_ENTER_ENUM(x, "scx-property-states")
#define scx_extract_colormap_state(x) S48_EXTRACT_ENUM(x, "scx-colormap-state")
#define scx_enter_colormap_state(x) S48_ENTER_ENUM(x, "scx-colormap-states")
#define scx_extract_mapping_request(x) \
S48_EXTRACT_ENUM(x, "scx-mapping-request")
#define scx_enter_mapping_request(x) S48_ENTER_ENUM(x, "scx-mapping-requests")
#define scx_extract_backing_store(x) S48_EXTRACT_ENUM(x, "scx-backing-store")
#define scx_enter_backing_store(x) S48_ENTER_ENUM(x, "scx-backing-stores")
#define scx_extract_map_state(x) S48_EXTRACT_ENUM(x, "scx-map-state")
#define scx_enter_map_state(x) S48_ENTER_ENUM(x, "scx-map-states")
#define scx_extract_window_class(x) S48_EXTRACT_ENUM(x, "scx-window-class")
#define scx_enter_window_class(x) S48_ENTER_ENUM(x, "scx-window-classes")
#define scx_extract_stack_mode(x) S48_EXTRACT_ENUM(x, "scx-stack-mode")
#define scx_enter_stack_mode(x) S48_ENTER_ENUM(x, "scx-stack-modes")
#define scx_extract_window_change(x) S48_EXTRACT_ENUM(x, "scx-window-change")
#define scx_enter_window_change(x) S48_ENTER_ENUM(x, "scx-window-changes")
#endif