fixed gc protection
This commit is contained in:
parent
6b05d8297e
commit
87b35c474c
|
@ -3,54 +3,61 @@
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
s48_value scx_Load_Font(s48_value display, s48_value font_name) {
|
s48_value scx_Load_Font(s48_value display, s48_value font_name) {
|
||||||
return scx_enter_font(XLoadFont(scx_extract_display(display),
|
Font f;
|
||||||
s48_extract_string(font_name)));
|
S48_DECLARE_GC_PROTECT_2(display, font_name);
|
||||||
|
f = XLoadFont(scx_extract_display(display),
|
||||||
|
s48_extract_string(font_name));
|
||||||
|
S48_GC_RETURN(scx_enter_font(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Unload_Font(s48_value display, s48_value font) {
|
s48_value scx_Unload_Font(s48_value display, s48_value font) {
|
||||||
|
S48_DECLARE_GC_PROTECT_2(display, font);
|
||||||
XUnloadFont(scx_extract_display(display),
|
XUnloadFont(scx_extract_display(display),
|
||||||
scx_extract_font(font));
|
scx_extract_font(font));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Query_Font(s48_value display, s48_value font) {
|
s48_value scx_Query_Font(s48_value display, s48_value font) {
|
||||||
XFontStruct* fs = XQueryFont(scx_extract_display(display),
|
XFontStruct* fs;
|
||||||
scx_extract_font(font));
|
S48_DECLARE_GC_PROTECT_2(display, font);
|
||||||
|
fs = XQueryFont(scx_extract_display(display),
|
||||||
|
scx_extract_font(font));
|
||||||
if (fs == NULL)
|
if (fs == NULL)
|
||||||
return S48_FALSE;
|
S48_GC_RETURN(S48_FALSE);
|
||||||
else
|
else
|
||||||
return scx_enter_fontstruct(fs);
|
S48_GC_RETURN(scx_enter_fontstruct(fs));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Load_Query_Font(s48_value display, s48_value font_name) {
|
s48_value scx_Load_Query_Font(s48_value display, s48_value font_name) {
|
||||||
XFontStruct* fs = XLoadQueryFont(scx_extract_display(display),
|
XFontStruct* fs;
|
||||||
s48_extract_string(font_name));
|
S48_DECLARE_GC_PROTECT_2(display, font_name);
|
||||||
|
fs = XLoadQueryFont(scx_extract_display(display),
|
||||||
|
s48_extract_string(font_name));
|
||||||
if (fs == NULL)
|
if (fs == NULL)
|
||||||
return S48_FALSE;
|
S48_GC_RETURN(S48_FALSE);
|
||||||
else
|
else
|
||||||
return scx_enter_fontstruct(fs);
|
S48_GC_RETURN(scx_enter_fontstruct(fs));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Free_Font(s48_value display, s48_value fontstruct) {
|
s48_value scx_Free_Font(s48_value display, s48_value fontstruct) {
|
||||||
|
S48_DECLARE_GC_PROTECT_2(display, fontstruct);
|
||||||
XFreeFont(scx_extract_display(display),
|
XFreeFont(scx_extract_display(display),
|
||||||
scx_extract_fontstruct(fontstruct));
|
scx_extract_fontstruct(fontstruct));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_List_Fonts(s48_value display, s48_value pattern, s48_value max) {
|
s48_value scx_List_Fonts(s48_value display, s48_value pattern, s48_value max) {
|
||||||
s48_value res = S48_NULL;
|
s48_value res = S48_NULL;
|
||||||
int i, count;
|
int i, count;
|
||||||
char** fonts;
|
char** fonts;
|
||||||
S48_DECLARE_GC_PROTECT(1);
|
S48_DECLARE_GC_PROTECT_4(display, pattern, max, res);
|
||||||
|
|
||||||
fonts = XListFonts(scx_extract_display(display), s48_extract_string(pattern),
|
fonts = XListFonts(scx_extract_display(display), s48_extract_string(pattern),
|
||||||
s48_extract_integer(max), &count);
|
s48_extract_integer(max), &count);
|
||||||
S48_GC_PROTECT_1(res);
|
|
||||||
for (i = count; i > 0; i--)
|
for (i = count; i > 0; i--)
|
||||||
res = s48_cons(s48_enter_string(fonts[i-1]), res);
|
res = s48_cons(s48_enter_string(fonts[i-1]), res);
|
||||||
S48_GC_UNPROTECT();
|
|
||||||
XFreeFontNames(fonts);
|
XFreeFontNames(fonts);
|
||||||
return res;
|
S48_GC_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_List_Fonts_With_Info(s48_value display, s48_value pattern,
|
s48_value scx_List_Fonts_With_Info(s48_value display, s48_value pattern,
|
||||||
|
@ -59,51 +66,48 @@ s48_value scx_List_Fonts_With_Info(s48_value display, s48_value pattern,
|
||||||
int i, count;
|
int i, count;
|
||||||
char** fonts;
|
char** fonts;
|
||||||
XFontStruct* infos;
|
XFontStruct* infos;
|
||||||
S48_DECLARE_GC_PROTECT(2);
|
S48_DECLARE_GC_PROTECT_5(display, pattern, max, res, cell);
|
||||||
|
|
||||||
fonts = XListFontsWithInfo(scx_extract_display(display),
|
fonts = XListFontsWithInfo(scx_extract_display(display),
|
||||||
s48_extract_string(pattern),
|
s48_extract_string(pattern),
|
||||||
s48_extract_integer(max), &count,
|
s48_extract_integer(max), &count,
|
||||||
&infos);
|
&infos);
|
||||||
S48_GC_PROTECT_2(res, cell);
|
|
||||||
for (i = count; i > 0; i--) {
|
for (i = count; i > 0; i--) {
|
||||||
cell = scx_enter_fontstruct(&infos[i-1]);
|
cell = scx_enter_fontstruct(&infos[i-1]);
|
||||||
cell = s48_cons(s48_enter_string(fonts[i-1]), cell);
|
cell = s48_cons(s48_enter_string(fonts[i-1]), cell);
|
||||||
res = s48_cons(cell, res);
|
res = s48_cons(cell, res);
|
||||||
}
|
}
|
||||||
S48_GC_UNPROTECT();
|
|
||||||
XFreeFontNames(fonts); /* FontStructs have to be freed later */
|
XFreeFontNames(fonts); /* FontStructs have to be freed later */
|
||||||
return res;
|
S48_GC_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Set_Font_Path(s48_value display, s48_value dirs) {
|
s48_value scx_Set_Font_Path(s48_value display, s48_value dirs) {
|
||||||
int i, n = s48_list_length(dirs);
|
int i, n = s48_list_length(dirs);
|
||||||
char* sa[n];
|
char* sa[n];
|
||||||
s48_value l = dirs;
|
s48_value l = dirs;
|
||||||
|
S48_DECLARE_GC_PROTECT_3(display, dirs, l);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
sa[i] = s48_extract_string(S48_CAR(l));
|
sa[i] = s48_extract_string(S48_CAR(l));
|
||||||
l = S48_CDR(l);
|
l = S48_CDR(l);
|
||||||
}
|
}
|
||||||
XSetFontPath(scx_extract_display(display), sa, n);
|
XSetFontPath(scx_extract_display(display), sa, n);
|
||||||
|
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Get_Font_Path(s48_value display) {
|
s48_value scx_Get_Font_Path(s48_value display) {
|
||||||
int n, i;
|
int n, i;
|
||||||
char** sa;
|
char** sa;
|
||||||
s48_value res = S48_NULL;
|
s48_value res = S48_NULL;
|
||||||
S48_DECLARE_GC_PROTECT(1);
|
S48_DECLARE_GC_PROTECT_2(display, res);
|
||||||
|
|
||||||
sa = XGetFontPath(scx_extract_display(display), &n);
|
sa = XGetFontPath(scx_extract_display(display), &n);
|
||||||
|
|
||||||
S48_GC_PROTECT_1(res);
|
|
||||||
for (i = n; i > 0; i--)
|
for (i = n; i > 0; i--)
|
||||||
res = s48_cons(s48_enter_string(sa[i]), res);
|
res = s48_cons(s48_enter_string(sa[i]), res);
|
||||||
S48_GC_UNPROTECT();
|
|
||||||
XFreeFontPath(sa);
|
XFreeFontPath(sa);
|
||||||
|
|
||||||
return res;
|
S48_GC_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
|
|
|
@ -115,9 +115,11 @@ s48_value scx_enter_gc(GC gc) {
|
||||||
|
|
||||||
unsigned long scx_extract_gc_value_alist(s48_value values, XGCValues* GCV) {
|
unsigned long scx_extract_gc_value_alist(s48_value values, XGCValues* GCV) {
|
||||||
unsigned long mask = 0;
|
unsigned long mask = 0;
|
||||||
|
s48_value v = S48_FALSE;
|
||||||
|
S48_DECLARE_GC_PROTECT_2(values, v);
|
||||||
while (values != S48_NULL) {
|
while (values != S48_NULL) {
|
||||||
int mv = scx_extract_gc_value(S48_CAR(S48_CAR(values)));
|
int mv = scx_extract_gc_value(S48_CAR(S48_CAR(values)));
|
||||||
s48_value v = S48_CDR(S48_CAR(values));
|
v = S48_CDR(S48_CAR(values));
|
||||||
values = S48_CDR(values);
|
values = S48_CDR(values);
|
||||||
mask = mask | (1L << mv);
|
mask = mask | (1L << mv);
|
||||||
switch (1L << mv) {
|
switch (1L << mv) {
|
||||||
|
@ -169,11 +171,12 @@ unsigned long scx_extract_gc_value_alist(s48_value values, XGCValues* GCV) {
|
||||||
GCV->arc_mode = scx_extract_arc_mode(v); break;
|
GCV->arc_mode = scx_extract_arc_mode(v); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
S48_GC_UNPROTECT();
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static s48_value scx_enter_gc_value_alist(s48_value values, XGCValues* GCV) {
|
static s48_value scx_enter_gc_value_alist(s48_value values, XGCValues* GCV) {
|
||||||
S48_DECLARE_GC_PROTECT(1);
|
S48_DECLARE_GC_PROTECT(3);
|
||||||
s48_value res = S48_NULL;
|
s48_value res = S48_NULL;
|
||||||
s48_value v = S48_FALSE;
|
s48_value v = S48_FALSE;
|
||||||
S48_GC_PROTECT_3(res, v, values);
|
S48_GC_PROTECT_3(res, v, values);
|
||||||
|
@ -181,7 +184,7 @@ static s48_value scx_enter_gc_value_alist(s48_value values, XGCValues* GCV) {
|
||||||
int mv = scx_extract_gc_value(S48_CAR(values));
|
int mv = scx_extract_gc_value(S48_CAR(values));
|
||||||
switch (1L << mv) {
|
switch (1L << mv) {
|
||||||
case GCFunction:
|
case GCFunction:
|
||||||
v = scx_extract_gc_function(GCV->function); break;
|
v = scx_enter_gc_function(GCV->function); break;
|
||||||
case GCPlaneMask:
|
case GCPlaneMask:
|
||||||
v = scx_enter_pixel(GCV->plane_mask); break;
|
v = scx_enter_pixel(GCV->plane_mask); break;
|
||||||
case GCForeground:
|
case GCForeground:
|
||||||
|
@ -238,26 +241,31 @@ static s48_value scx_enter_gc_value_alist(s48_value values, XGCValues* GCV) {
|
||||||
s48_value scx_Create_Gc(s48_value display, s48_value drawable,
|
s48_value scx_Create_Gc(s48_value display, s48_value drawable,
|
||||||
s48_value values) {
|
s48_value values) {
|
||||||
XGCValues GCV;
|
XGCValues GCV;
|
||||||
unsigned long mask = scx_extract_gc_value_alist(values, &GCV);
|
unsigned long mask;
|
||||||
|
S48_DECLARE_GC_PROTECT_3(display, drawable, values);
|
||||||
|
mask = scx_extract_gc_value_alist(values, &GCV);
|
||||||
GC gc = XCreateGC(scx_extract_display(display),
|
GC gc = XCreateGC(scx_extract_display(display),
|
||||||
scx_extract_drawable(drawable),
|
scx_extract_drawable(drawable),
|
||||||
mask, &GCV);
|
mask, &GCV);
|
||||||
return scx_enter_gc(gc);
|
S48_GC_RETURN(scx_enter_gc(gc));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Copy_Gc(s48_value display, s48_value source, s48_value mask,
|
s48_value scx_Copy_Gc(s48_value display, s48_value source, s48_value mask,
|
||||||
s48_value dest) {
|
s48_value dest) {
|
||||||
|
S48_DECLARE_GC_PROTECT_4(display, source, mask, dest);
|
||||||
XCopyGC(scx_extract_display(display), scx_extract_gc(source),
|
XCopyGC(scx_extract_display(display), scx_extract_gc(source),
|
||||||
scx_extract_gc_value_set(mask), scx_extract_gc(dest));
|
scx_extract_gc_value_set(mask), scx_extract_gc(dest));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Change_Gc(s48_value display, s48_value gc, s48_value values) {
|
s48_value scx_Change_Gc(s48_value display, s48_value gc, s48_value values) {
|
||||||
XGCValues GCV;
|
XGCValues GCV;
|
||||||
unsigned long mask = scx_extract_gc_value_alist(values, &GCV);
|
unsigned long mask;
|
||||||
|
S48_DECLARE_GC_PROTECT_3(display, gc, values);
|
||||||
|
mask = scx_extract_gc_value_alist(values, &GCV);
|
||||||
XChangeGC(scx_extract_display(display), scx_extract_gc(gc),
|
XChangeGC(scx_extract_display(display), scx_extract_gc(gc),
|
||||||
mask, &GCV);
|
mask, &GCV);
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -272,20 +280,22 @@ s48_value scx_Get_Gc_Values(s48_value display, s48_value gc,
|
||||||
s48_value values) {
|
s48_value values) {
|
||||||
unsigned long mask = 0;
|
unsigned long mask = 0;
|
||||||
XGCValues GCV;
|
XGCValues GCV;
|
||||||
|
S48_DECLARE_GC_PROTECT_3(display, gc, values);
|
||||||
for (; values != S48_NULL; values = S48_CDR(values))
|
for (; values != S48_NULL; values = S48_CDR(values))
|
||||||
mask |= (1L << scx_extract_gc_value(S48_CAR(values)));
|
mask |= (1L << scx_extract_gc_value(S48_CAR(values)));
|
||||||
|
|
||||||
if (!XGetGCValues(scx_extract_display(display),
|
if (!XGetGCValues(scx_extract_display(display),
|
||||||
scx_extract_gc(gc),
|
scx_extract_gc(gc),
|
||||||
mask, &GCV))
|
mask, &GCV))
|
||||||
return S48_FALSE;
|
S48_GC_RETURN(S48_FALSE);
|
||||||
else
|
else
|
||||||
return scx_enter_gc_value_alist(values, &GCV);
|
S48_GC_RETURN(scx_enter_gc_value_alist(values, &GCV));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Free_Gc(s48_value display, s48_value gc) {
|
s48_value scx_Free_Gc(s48_value display, s48_value gc) {
|
||||||
|
S48_DECLARE_GC_PROTECT_2(display, gc);
|
||||||
XFreeGC(scx_extract_display(display), scx_extract_gc(gc));
|
XFreeGC(scx_extract_display(display), scx_extract_gc(gc));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_GContext_From_Gc(s48_value gc) {
|
s48_value scx_GContext_From_Gc(s48_value gc) {
|
||||||
|
@ -296,6 +306,7 @@ s48_value scx_Set_Dashes(s48_value display, s48_value gc, s48_value dashoffset,
|
||||||
s48_value dashlist) {
|
s48_value dashlist) {
|
||||||
int i, n = s48_list_length(dashlist);
|
int i, n = s48_list_length(dashlist);
|
||||||
char dl[n];
|
char dl[n];
|
||||||
|
S48_DECLARE_GC_PROTECT_4(display, gc, dashoffset, dashlist);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
dl[i] = s48_extract_integer(S48_CAR(dashlist));
|
dl[i] = s48_extract_integer(S48_CAR(dashlist));
|
||||||
dashlist = S48_CDR(dashlist);
|
dashlist = S48_CDR(dashlist);
|
||||||
|
@ -303,7 +314,7 @@ s48_value scx_Set_Dashes(s48_value display, s48_value gc, s48_value dashoffset,
|
||||||
XSetDashes(scx_extract_display(display), scx_extract_gc(gc),
|
XSetDashes(scx_extract_display(display), scx_extract_gc(gc),
|
||||||
s48_extract_integer(dashoffset),
|
s48_extract_integer(dashoffset),
|
||||||
dl, n);
|
dl, n);
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_rectangle_ordering_binding = S48_FALSE;
|
s48_value scx_rectangle_ordering_binding = S48_FALSE;
|
||||||
|
@ -315,8 +326,11 @@ s48_value scx_Set_Clip_Rectangles(s48_value display, s48_value gc,
|
||||||
s48_value rects, s48_value ordering) {
|
s48_value rects, s48_value ordering) {
|
||||||
int i, n = s48_list_length(rects);
|
int i, n = s48_list_length(rects);
|
||||||
XRectangle crects[n];
|
XRectangle crects[n];
|
||||||
|
s48_value r = S48_FALSE;
|
||||||
|
S48_DECLARE_GC_PROTECT_7(display, gc, x_origin, y_origin, rects,
|
||||||
|
ordering, r);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
s48_value r = S48_CAR(rects);
|
r = S48_CAR(rects);
|
||||||
crects[i].x = s48_extract_integer(S48_CAR(r)); r = S48_CDR(r);
|
crects[i].x = s48_extract_integer(S48_CAR(r)); r = S48_CDR(r);
|
||||||
crects[i].y = s48_extract_integer(S48_CAR(r)); r = S48_CDR(r);
|
crects[i].y = s48_extract_integer(S48_CAR(r)); r = S48_CDR(r);
|
||||||
crects[i].width = s48_extract_integer(S48_CAR(r)); r = S48_CDR(r);
|
crects[i].width = s48_extract_integer(S48_CAR(r)); r = S48_CDR(r);
|
||||||
|
@ -327,13 +341,15 @@ s48_value scx_Set_Clip_Rectangles(s48_value display, s48_value gc,
|
||||||
s48_extract_integer(x_origin),
|
s48_extract_integer(x_origin),
|
||||||
s48_extract_integer(y_origin),
|
s48_extract_integer(y_origin),
|
||||||
crects, n, scx_extract_rectangle_ordering(ordering));
|
crects, n, scx_extract_rectangle_ordering(ordering));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Query_Best_Size(s48_value screen, s48_value class,
|
s48_value scx_Query_Best_Size(s48_value screen, s48_value class,
|
||||||
s48_value width, s48_value height) {
|
s48_value width, s48_value height) {
|
||||||
unsigned int rw, rh;
|
unsigned int rw, rh;
|
||||||
Screen* s = scx_extract_screen(screen);
|
Screen* s;
|
||||||
|
S48_DECLARE_GC_PROTECT_4(screen, class, width, height);
|
||||||
|
s = scx_extract_screen(screen);
|
||||||
|
|
||||||
if (!XQueryBestSize(s->display,
|
if (!XQueryBestSize(s->display,
|
||||||
s48_extract_integer(class),
|
s48_extract_integer(class),
|
||||||
|
@ -341,9 +357,9 @@ s48_value scx_Query_Best_Size(s48_value screen, s48_value class,
|
||||||
(int)s48_extract_integer(width),
|
(int)s48_extract_integer(width),
|
||||||
(int)s48_extract_integer(height),
|
(int)s48_extract_integer(height),
|
||||||
&rw, &rh))
|
&rw, &rh))
|
||||||
return S48_FALSE;
|
S48_GC_RETURN(S48_FALSE);
|
||||||
else
|
else
|
||||||
return s48_cons(s48_enter_fixnum(rw), s48_enter_fixnum(rh));
|
S48_GC_RETURN(s48_cons(s48_enter_fixnum(rw), s48_enter_fixnum(rh)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void scx_init_gcontext(void) {
|
void scx_init_gcontext(void) {
|
||||||
|
|
|
@ -12,7 +12,10 @@ s48_value scx_Grab_Pointer(s48_value dpy, s48_value win,
|
||||||
s48_value pmode, s48_value kmode,
|
s48_value pmode, s48_value kmode,
|
||||||
s48_value confine_to, s48_value cursor,
|
s48_value confine_to, s48_value cursor,
|
||||||
s48_value time) {
|
s48_value time) {
|
||||||
int res = XGrabPointer(scx_extract_display(dpy),
|
int res;
|
||||||
|
S48_DECLARE_GC_PROTECT_9(dpy, win, ownerp, events, pmode, kmode, confine_to,
|
||||||
|
cursor, time);
|
||||||
|
res = XGrabPointer(scx_extract_display(dpy),
|
||||||
scx_extract_window(win),
|
scx_extract_window(win),
|
||||||
S48_EXTRACT_BOOLEAN(ownerp),
|
S48_EXTRACT_BOOLEAN(ownerp),
|
||||||
scx_extract_event_mask(events),
|
scx_extract_event_mask(events),
|
||||||
|
@ -21,27 +24,31 @@ s48_value scx_Grab_Pointer(s48_value dpy, s48_value win,
|
||||||
scx_extract_window(confine_to),
|
scx_extract_window(confine_to),
|
||||||
scx_extract_cursor(cursor),
|
scx_extract_cursor(cursor),
|
||||||
scx_extract_time(time));
|
scx_extract_time(time));
|
||||||
return scx_enter_grab_status(res);
|
S48_GC_RETURN(scx_enter_grab_status(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Ungrab_Pointer(s48_value dpy, s48_value time) {
|
s48_value scx_Ungrab_Pointer(s48_value dpy, s48_value time) {
|
||||||
|
S48_DECLARE_GC_PROTECT_2(dpy, time);
|
||||||
XUngrabPointer(scx_extract_display(dpy), scx_extract_time(time));
|
XUngrabPointer(scx_extract_display(dpy), scx_extract_time(time));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Change_Active_Pointer_Grab(s48_value dpy, s48_value events,
|
s48_value scx_Change_Active_Pointer_Grab(s48_value dpy, s48_value events,
|
||||||
s48_value cursor, s48_value time){
|
s48_value cursor, s48_value time){
|
||||||
|
S48_DECLARE_GC_PROTECT_4(dpy, events, cursor, time);
|
||||||
XChangeActivePointerGrab(scx_extract_display(dpy),
|
XChangeActivePointerGrab(scx_extract_display(dpy),
|
||||||
scx_extract_event_mask(events),
|
scx_extract_event_mask(events),
|
||||||
scx_extract_cursor(cursor),
|
scx_extract_cursor(cursor),
|
||||||
scx_extract_time(time));
|
scx_extract_time(time));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Grab_Button(s48_value dpy, s48_value button, s48_value mods,
|
s48_value scx_Grab_Button(s48_value dpy, s48_value button, s48_value mods,
|
||||||
s48_value win, s48_value ownerp, s48_value events,
|
s48_value win, s48_value ownerp, s48_value events,
|
||||||
s48_value pmode, s48_value kmode,
|
s48_value pmode, s48_value kmode,
|
||||||
s48_value confine_to, s48_value cursor) {
|
s48_value confine_to, s48_value cursor) {
|
||||||
|
S48_DECLARE_GC_PROTECT_10(dpy, button, mods, win, ownerp, events, pmode,
|
||||||
|
kmode, confine_to, cursor);
|
||||||
XGrabButton(scx_extract_display(dpy),
|
XGrabButton(scx_extract_display(dpy),
|
||||||
scx_extract_button(button),
|
scx_extract_button(button),
|
||||||
scx_extract_state_set(mods),
|
scx_extract_state_set(mods),
|
||||||
|
@ -52,39 +59,43 @@ s48_value scx_Grab_Button(s48_value dpy, s48_value button, s48_value mods,
|
||||||
scx_extract_grab_mode(kmode),
|
scx_extract_grab_mode(kmode),
|
||||||
scx_extract_window(confine_to),
|
scx_extract_window(confine_to),
|
||||||
scx_extract_cursor(cursor));
|
scx_extract_cursor(cursor));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Ungrab_Button(s48_value dpy, s48_value button,
|
s48_value scx_Ungrab_Button(s48_value dpy, s48_value button,
|
||||||
s48_value mods, s48_value win) {
|
s48_value mods, s48_value win) {
|
||||||
|
S48_DECLARE_GC_PROTECT_4(dpy, button, mods, win);
|
||||||
XUngrabButton(scx_extract_display(dpy),
|
XUngrabButton(scx_extract_display(dpy),
|
||||||
scx_extract_button(button),
|
scx_extract_button(button),
|
||||||
scx_extract_state_set(mods),
|
scx_extract_state_set(mods),
|
||||||
scx_extract_window(win));
|
scx_extract_window(win));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Grab_Keyboard(s48_value dpy, s48_value win, s48_value ownerp,
|
s48_value scx_Grab_Keyboard(s48_value dpy, s48_value win, s48_value ownerp,
|
||||||
s48_value pmode, s48_value kmode,
|
s48_value pmode, s48_value kmode,
|
||||||
s48_value time) {
|
s48_value time) {
|
||||||
|
S48_DECLARE_GC_PROTECT_6(dpy, win, ownerp, pmode, kmode, time);
|
||||||
int res = XGrabKeyboard( scx_extract_display(dpy),
|
int res = XGrabKeyboard( scx_extract_display(dpy),
|
||||||
scx_extract_window(win),
|
scx_extract_window(win),
|
||||||
S48_EXTRACT_BOOLEAN(ownerp),
|
S48_EXTRACT_BOOLEAN(ownerp),
|
||||||
scx_extract_grab_mode(pmode),
|
scx_extract_grab_mode(pmode),
|
||||||
scx_extract_grab_mode(kmode),
|
scx_extract_grab_mode(kmode),
|
||||||
scx_extract_time(time));
|
scx_extract_time(time));
|
||||||
return scx_enter_grab_status(res);
|
S48_GC_RETURN(scx_enter_grab_status(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Ungrab_Keyboard(s48_value dpy, s48_value time){
|
s48_value scx_Ungrab_Keyboard(s48_value dpy, s48_value time){
|
||||||
|
S48_DECLARE_GC_PROTECT_2(dpy, time);
|
||||||
XUngrabKeyboard(scx_extract_display(dpy),
|
XUngrabKeyboard(scx_extract_display(dpy),
|
||||||
scx_extract_time(time));
|
scx_extract_time(time));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Grab_Key(s48_value dpy, s48_value key, s48_value mods,
|
s48_value scx_Grab_Key(s48_value dpy, s48_value key, s48_value mods,
|
||||||
s48_value win, s48_value ownerp, s48_value pmode,
|
s48_value win, s48_value ownerp, s48_value pmode,
|
||||||
s48_value kmode) {
|
s48_value kmode) {
|
||||||
|
S48_DECLARE_GC_PROTECT_7(dpy, key, mods, win, ownerp, pmode, kmode);
|
||||||
XGrabKey(scx_extract_display(dpy),
|
XGrabKey(scx_extract_display(dpy),
|
||||||
s48_extract_integer(key),
|
s48_extract_integer(key),
|
||||||
scx_extract_state_set(mods),
|
scx_extract_state_set(mods),
|
||||||
|
@ -92,16 +103,17 @@ s48_value scx_Grab_Key(s48_value dpy, s48_value key, s48_value mods,
|
||||||
S48_EXTRACT_BOOLEAN(ownerp),
|
S48_EXTRACT_BOOLEAN(ownerp),
|
||||||
scx_extract_grab_mode(pmode),
|
scx_extract_grab_mode(pmode),
|
||||||
scx_extract_grab_mode(kmode));
|
scx_extract_grab_mode(kmode));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Ungrab_Key(s48_value dpy, s48_value key, s48_value mods,
|
s48_value scx_Ungrab_Key(s48_value dpy, s48_value key, s48_value mods,
|
||||||
s48_value win) {
|
s48_value win) {
|
||||||
|
S48_DECLARE_GC_PROTECT_4(dpy, key, mods, win);
|
||||||
XUngrabKey(scx_extract_display(dpy),
|
XUngrabKey(scx_extract_display(dpy),
|
||||||
s48_extract_integer(key),
|
s48_extract_integer(key),
|
||||||
scx_extract_state_set(mods),
|
scx_extract_state_set(mods),
|
||||||
scx_extract_window(win));
|
scx_extract_window(win));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_event_mode_binding = S48_FALSE;
|
s48_value scx_event_mode_binding = S48_FALSE;
|
||||||
|
@ -109,10 +121,11 @@ s48_value scx_event_mode_binding = S48_FALSE;
|
||||||
|
|
||||||
s48_value scx_Allow_Events(s48_value dpy, s48_value event_mode,
|
s48_value scx_Allow_Events(s48_value dpy, s48_value event_mode,
|
||||||
s48_value time) {
|
s48_value time) {
|
||||||
|
S48_DECLARE_GC_PROTECT_3(dpy, event_mode, time);
|
||||||
XAllowEvents(scx_extract_display(dpy),
|
XAllowEvents(scx_extract_display(dpy),
|
||||||
scx_extract_event_mode(event_mode),
|
scx_extract_event_mode(event_mode),
|
||||||
scx_extract_time(time));
|
scx_extract_time(time));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Grab_Server(s48_value dpy) {
|
s48_value scx_Grab_Server(s48_value dpy) {
|
||||||
|
|
|
@ -12,81 +12,92 @@ s48_value scx_Copy_Area(s48_value display, s48_value src, s48_value dest,
|
||||||
s48_value gc, s48_value srcx, s48_value srcy,
|
s48_value gc, s48_value srcx, s48_value srcy,
|
||||||
s48_value width, s48_value height, s48_value destx,
|
s48_value width, s48_value height, s48_value destx,
|
||||||
s48_value desty) {
|
s48_value desty) {
|
||||||
|
S48_DECLARE_GC_PROTECT_10(display, src, dest, gc, srcx, srcy, width, height,
|
||||||
|
destx, desty);
|
||||||
XCopyArea(scx_extract_display(display), scx_extract_drawable(src),
|
XCopyArea(scx_extract_display(display), scx_extract_drawable(src),
|
||||||
scx_extract_drawable(dest), scx_extract_gc(gc),
|
scx_extract_drawable(dest), scx_extract_gc(gc),
|
||||||
(int)s48_extract_integer(srcx), (int)s48_extract_integer(srcy),
|
(int)s48_extract_integer(srcx), (int)s48_extract_integer(srcy),
|
||||||
(int)s48_extract_integer(width), (int)s48_extract_integer(height),
|
(int)s48_extract_integer(width), (int)s48_extract_integer(height),
|
||||||
(int)s48_extract_integer(destx), (int)s48_extract_integer(desty));
|
(int)s48_extract_integer(destx), (int)s48_extract_integer(desty));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Copy_Plane(s48_value display, s48_value src, s48_value dest,
|
s48_value scx_Copy_Plane(s48_value display, s48_value src, s48_value dest,
|
||||||
s48_value gc, s48_value srcx, s48_value srcy,
|
s48_value gc, s48_value srcx, s48_value srcy,
|
||||||
s48_value width, s48_value height,
|
s48_value width, s48_value height,
|
||||||
s48_value destx, s48_value desty, s48_value plane) {
|
s48_value destx, s48_value desty, s48_value plane) {
|
||||||
|
S48_DECLARE_GC_PROTECT_11(display, src, dest, gc, srcx, srcy, width, height,
|
||||||
|
destx, desty, plane);
|
||||||
XCopyPlane(scx_extract_display(display), scx_extract_drawable(src),
|
XCopyPlane(scx_extract_display(display), scx_extract_drawable(src),
|
||||||
scx_extract_drawable(dest), scx_extract_gc(gc),
|
scx_extract_drawable(dest), scx_extract_gc(gc),
|
||||||
(int)s48_extract_integer(srcx), (int)s48_extract_integer(srcy),
|
(int)s48_extract_integer(srcx), (int)s48_extract_integer(srcy),
|
||||||
(int)s48_extract_integer(width), (int)s48_extract_integer(height),
|
(int)s48_extract_integer(width), (int)s48_extract_integer(height),
|
||||||
(int)s48_extract_integer(destx), (int)s48_extract_integer(desty),
|
(int)s48_extract_integer(destx), (int)s48_extract_integer(desty),
|
||||||
(unsigned long)s48_extract_integer(plane));
|
(unsigned long)s48_extract_integer(plane));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Draw_Point(s48_value display, s48_value drawable,
|
s48_value scx_Draw_Point(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value x, s48_value y) {
|
s48_value gc, s48_value x, s48_value y) {
|
||||||
|
S48_DECLARE_GC_PROTECT_5(display, drawable, gc, x, y);
|
||||||
XDrawPoint(scx_extract_display(display), scx_extract_drawable(drawable),
|
XDrawPoint(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), (int)s48_extract_integer(x),
|
scx_extract_gc(gc), (int)s48_extract_integer(x),
|
||||||
(int)s48_extract_integer(y));
|
(int)s48_extract_integer(y));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void List_To_XPoints(s48_value l, XPoint* p, int n) {
|
static void List_To_XPoints(s48_value l, XPoint* p, int n) {
|
||||||
int i;
|
int i;
|
||||||
|
S48_DECLARE_GC_PROTECT_1(l);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
s48_value point = S48_CAR(l);
|
s48_value point = S48_CAR(l);
|
||||||
p[i].x = (int)s48_extract_integer(S48_CAR(point));
|
p[i].x = (int)s48_extract_integer(S48_CAR(point));
|
||||||
p[i].y = (int)s48_extract_integer(S48_CDR(point));
|
p[i].y = (int)s48_extract_integer(S48_CDR(point));
|
||||||
l = S48_CDR(l);
|
l = S48_CDR(l);
|
||||||
}
|
}
|
||||||
|
S48_GC_UNPROTECT();
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Draw_Points(s48_value display, s48_value drawable,
|
s48_value scx_Draw_Points(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value points, s48_value mode) {
|
s48_value gc, s48_value points, s48_value mode) {
|
||||||
int n = s48_list_length(points);
|
int n = s48_list_length(points);
|
||||||
XPoint p[n];
|
XPoint p[n];
|
||||||
|
S48_DECLARE_GC_PROTECT_5(display, drawable, gc, points, mode);
|
||||||
List_To_XPoints(points, p, n);
|
List_To_XPoints(points, p, n);
|
||||||
XDrawPoints(scx_extract_display(display), scx_extract_drawable(drawable),
|
XDrawPoints(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), p, n,
|
scx_extract_gc(gc), p, n,
|
||||||
scx_extract_coord_mode(mode));
|
scx_extract_coord_mode(mode));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Draw_Line(s48_value display, s48_value drawable,
|
s48_value scx_Draw_Line(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value x1, s48_value y1,
|
s48_value gc, s48_value x1, s48_value y1,
|
||||||
s48_value x2, s48_value y2) {
|
s48_value x2, s48_value y2) {
|
||||||
|
S48_DECLARE_GC_PROTECT_7(display, drawable, gc, x1, y1, x2, y2);
|
||||||
XDrawLine(scx_extract_display(display),scx_extract_drawable(drawable),
|
XDrawLine(scx_extract_display(display),scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), (int)s48_extract_integer(x1),
|
scx_extract_gc(gc), (int)s48_extract_integer(x1),
|
||||||
(int)s48_extract_integer(y1), (int)s48_extract_integer(x2),
|
(int)s48_extract_integer(y1), (int)s48_extract_integer(x2),
|
||||||
(int)s48_extract_integer(y2));
|
(int)s48_extract_integer(y2));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Draw_Lines(s48_value display, s48_value drawable,
|
s48_value scx_Draw_Lines(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value points, s48_value mode) {
|
s48_value gc, s48_value points, s48_value mode) {
|
||||||
int n = s48_list_length(points);
|
int n = s48_list_length(points);
|
||||||
XPoint p[n];
|
XPoint p[n];
|
||||||
|
S48_DECLARE_GC_PROTECT_5(display, drawable, gc, points, mode);
|
||||||
List_To_XPoints(points, p, n);
|
List_To_XPoints(points, p, n);
|
||||||
XDrawLines(scx_extract_display(display), scx_extract_drawable(drawable),
|
XDrawLines(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), p, n,
|
scx_extract_gc(gc), p, n,
|
||||||
scx_extract_coord_mode(mode));
|
scx_extract_coord_mode(mode));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_segment_binding = S48_FALSE;
|
s48_value scx_segment_binding = S48_FALSE;
|
||||||
|
|
||||||
static void List_To_XSegments(s48_value l, XSegment* p, int n) {
|
static void List_To_XSegments(s48_value l, XSegment* p, int n) {
|
||||||
int i;
|
int i;
|
||||||
|
S48_DECLARE_GC_PROTECT_1(l);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
s48_value s = S48_CAR(l);
|
s48_value s = S48_CAR(l);
|
||||||
s48_check_record_type(s, scx_segment_binding);
|
s48_check_record_type(s, scx_segment_binding);
|
||||||
|
@ -96,75 +107,81 @@ static void List_To_XSegments(s48_value l, XSegment* p, int n) {
|
||||||
p[i].y2 = (int)s48_extract_integer(S48_RECORD_REF(s, 3));
|
p[i].y2 = (int)s48_extract_integer(S48_RECORD_REF(s, 3));
|
||||||
l = S48_CDR(l);
|
l = S48_CDR(l);
|
||||||
}
|
}
|
||||||
|
S48_GC_UNPROTECT();
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Draw_Segments(s48_value display, s48_value drawable,
|
s48_value scx_Draw_Segments(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value segs) {
|
s48_value gc, s48_value segs) {
|
||||||
int n = s48_list_length(segs);
|
int n = s48_list_length(segs);
|
||||||
XSegment p[n];
|
XSegment p[n];
|
||||||
|
S48_DECLARE_GC_PROTECT_4(display, drawable, gc, segs);
|
||||||
List_To_XSegments(segs, p, n);
|
List_To_XSegments(segs, p, n);
|
||||||
XDrawSegments(scx_extract_display(display), scx_extract_drawable(drawable),
|
XDrawSegments(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), p, n);
|
scx_extract_gc(gc), p, n);
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Draw_Rectangle(s48_value display, s48_value drawable,
|
s48_value scx_Draw_Rectangle(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value x, s48_value y,
|
s48_value gc, s48_value x, s48_value y,
|
||||||
s48_value width, s48_value height) {
|
s48_value width, s48_value height) {
|
||||||
|
S48_DECLARE_GC_PROTECT_7(display, drawable, gc, x, y, width, height);
|
||||||
XDrawRectangle(scx_extract_display(display), scx_extract_drawable(drawable),
|
XDrawRectangle(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc),
|
scx_extract_gc(gc),
|
||||||
(int)s48_extract_integer(x),
|
(int)s48_extract_integer(x),
|
||||||
(int)s48_extract_integer(y),
|
(int)s48_extract_integer(y),
|
||||||
(int)s48_extract_integer(width),
|
(int)s48_extract_integer(width),
|
||||||
(int)s48_extract_integer(height));
|
(int)s48_extract_integer(height));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_rectangle_binding = S48_FALSE;
|
s48_value scx_rectangle_binding = S48_FALSE;
|
||||||
|
|
||||||
static void List_To_XRectangles(s48_value l, XRectangle* p, int n) {
|
static void List_To_XRectangles(s48_value l, XRectangle* p, int n) {
|
||||||
int i;
|
int i;
|
||||||
s48_value rectype = scx_rectangle_binding;
|
S48_DECLARE_GC_PROTECT_1(l);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
s48_value r = S48_CAR(l);
|
s48_value r = S48_CAR(l);
|
||||||
s48_check_record_type(r, rectype);
|
s48_check_record_type(r, scx_rectangle_binding);
|
||||||
p[i].x = (int)s48_extract_integer(S48_RECORD_REF(r, 0));
|
p[i].x = (int)s48_extract_integer(S48_RECORD_REF(r, 0));
|
||||||
p[i].y = (int)s48_extract_integer(S48_RECORD_REF(r, 1));
|
p[i].y = (int)s48_extract_integer(S48_RECORD_REF(r, 1));
|
||||||
p[i].width = (int)s48_extract_integer(S48_RECORD_REF(r, 2));
|
p[i].width = (int)s48_extract_integer(S48_RECORD_REF(r, 2));
|
||||||
p[i].height = (int)s48_extract_integer(S48_RECORD_REF(r, 3));
|
p[i].height = (int)s48_extract_integer(S48_RECORD_REF(r, 3));
|
||||||
l = S48_CDR(l);
|
l = S48_CDR(l);
|
||||||
}
|
}
|
||||||
|
S48_GC_UNPROTECT();
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Draw_Rectangles(s48_value display, s48_value drawable,
|
s48_value scx_Draw_Rectangles(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value rects) {
|
s48_value gc, s48_value rects) {
|
||||||
int n = s48_list_length(rects);
|
int n = s48_list_length(rects);
|
||||||
XRectangle p[n];
|
XRectangle p[n];
|
||||||
|
S48_DECLARE_GC_PROTECT_4(display, drawable, gc, rects);
|
||||||
List_To_XRectangles(rects, p, n);
|
List_To_XRectangles(rects, p, n);
|
||||||
XDrawRectangles(scx_extract_display(display), scx_extract_drawable(drawable),
|
XDrawRectangles(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), p, n);
|
scx_extract_gc(gc), p, n);
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Draw_Arc(s48_value display, s48_value drawable,
|
s48_value scx_Draw_Arc(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value x, s48_value y, s48_value w,
|
s48_value gc, s48_value x, s48_value y, s48_value w,
|
||||||
s48_value h, s48_value a1, s48_value a2) {
|
s48_value h, s48_value a1, s48_value a2) {
|
||||||
|
S48_DECLARE_GC_PROTECT_9(display, drawable, gc, x, y, w, h, a1, a2);
|
||||||
XDrawArc(scx_extract_display(display), scx_extract_drawable(drawable),
|
XDrawArc(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), (int)s48_extract_integer(x),
|
scx_extract_gc(gc), (int)s48_extract_integer(x),
|
||||||
(int)s48_extract_integer(y), (int)s48_extract_integer(w),
|
(int)s48_extract_integer(y), (int)s48_extract_integer(w),
|
||||||
(int)s48_extract_integer(h), (int)s48_extract_integer(a1),
|
(int)s48_extract_integer(h), (int)s48_extract_integer(a1),
|
||||||
(int)s48_extract_integer(a2));
|
(int)s48_extract_integer(a2));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_arc_binding = S48_FALSE;
|
s48_value scx_arc_binding = S48_FALSE;
|
||||||
|
|
||||||
static void List_To_XArcs(s48_value l, XArc* p, int n) {
|
static void List_To_XArcs(s48_value l, XArc* p, int n) {
|
||||||
int i;
|
int i;
|
||||||
s48_value rectype = scx_arc_binding;
|
S48_DECLARE_GC_PROTECT_1(l);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
s48_value r = S48_CAR(l);
|
s48_value r = S48_CAR(l);
|
||||||
s48_check_record_type(r, rectype);
|
s48_check_record_type(r, scx_arc_binding);
|
||||||
p[i].x = (int)s48_extract_integer(S48_RECORD_REF(r, 0));
|
p[i].x = (int)s48_extract_integer(S48_RECORD_REF(r, 0));
|
||||||
p[i].y = (int)s48_extract_integer(S48_RECORD_REF(r, 1));
|
p[i].y = (int)s48_extract_integer(S48_RECORD_REF(r, 1));
|
||||||
p[i].width = (int)s48_extract_integer(S48_RECORD_REF(r, 2));
|
p[i].width = (int)s48_extract_integer(S48_RECORD_REF(r, 2));
|
||||||
|
@ -173,38 +190,42 @@ static void List_To_XArcs(s48_value l, XArc* p, int n) {
|
||||||
p[i].angle2 = (int)s48_extract_integer(S48_RECORD_REF(r, 5));
|
p[i].angle2 = (int)s48_extract_integer(S48_RECORD_REF(r, 5));
|
||||||
l = S48_CDR(l);
|
l = S48_CDR(l);
|
||||||
}
|
}
|
||||||
|
S48_GC_UNPROTECT();
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Draw_Arcs(s48_value display, s48_value drawable,
|
s48_value scx_Draw_Arcs(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value arcs) {
|
s48_value gc, s48_value arcs) {
|
||||||
int n = s48_list_length(arcs);
|
int n = s48_list_length(arcs);
|
||||||
XArc p[n];
|
XArc p[n];
|
||||||
|
S48_DECLARE_GC_PROTECT_4(display, drawable, gc, arcs);
|
||||||
List_To_XArcs(arcs, p, n);
|
List_To_XArcs(arcs, p, n);
|
||||||
XDrawArcs(scx_extract_display(display), scx_extract_drawable(drawable),
|
XDrawArcs(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), p, n);
|
scx_extract_gc(gc), p, n);
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Fill_Rectangle(s48_value display, s48_value drawable,
|
s48_value scx_Fill_Rectangle(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value x, s48_value y,
|
s48_value gc, s48_value x, s48_value y,
|
||||||
s48_value width, s48_value height) {
|
s48_value width, s48_value height) {
|
||||||
|
S48_DECLARE_GC_PROTECT_7(display, drawable, gc, x, y, width, height);
|
||||||
XFillRectangle(scx_extract_display(display), scx_extract_drawable(drawable),
|
XFillRectangle(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc),
|
scx_extract_gc(gc),
|
||||||
(int)s48_extract_integer(x),
|
(int)s48_extract_integer(x),
|
||||||
(int)s48_extract_integer(y),
|
(int)s48_extract_integer(y),
|
||||||
(int)s48_extract_integer(width),
|
(int)s48_extract_integer(width),
|
||||||
(int)s48_extract_integer(height));
|
(int)s48_extract_integer(height));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Fill_Rectangles(s48_value display, s48_value drawable,
|
s48_value scx_Fill_Rectangles(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value rects) {
|
s48_value gc, s48_value rects) {
|
||||||
int n = s48_list_length(rects);
|
int n = s48_list_length(rects);
|
||||||
XRectangle p[n];
|
XRectangle p[n];
|
||||||
|
S48_DECLARE_GC_PROTECT_4(display, drawable, gc, rects);
|
||||||
List_To_XRectangles(rects, p, n);
|
List_To_XRectangles(rects, p, n);
|
||||||
XFillRectangles(scx_extract_display(display), scx_extract_drawable(drawable),
|
XFillRectangles(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), p, n);
|
scx_extract_gc(gc), p, n);
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Fill_Polygon(s48_value display, s48_value drawable,
|
s48_value scx_Fill_Polygon(s48_value display, s48_value drawable,
|
||||||
|
@ -212,33 +233,36 @@ s48_value scx_Fill_Polygon(s48_value display, s48_value drawable,
|
||||||
s48_value shape, s48_value mode) {
|
s48_value shape, s48_value mode) {
|
||||||
int n = s48_list_length(points);
|
int n = s48_list_length(points);
|
||||||
XPoint p[n];
|
XPoint p[n];
|
||||||
|
S48_DECLARE_GC_PROTECT_6(display, drawable, gc, points, shape, mode);
|
||||||
List_To_XPoints(points, p, n);
|
List_To_XPoints(points, p, n);
|
||||||
XFillPolygon(scx_extract_display(display), scx_extract_drawable(drawable),
|
XFillPolygon(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), p, n,
|
scx_extract_gc(gc), p, n,
|
||||||
scx_extract_polygon_shape(shape),
|
scx_extract_polygon_shape(shape),
|
||||||
scx_extract_coord_mode(mode));
|
scx_extract_coord_mode(mode));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Fill_Arc(s48_value display, s48_value drawable,
|
s48_value scx_Fill_Arc(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value x, s48_value y, s48_value w,
|
s48_value gc, s48_value x, s48_value y, s48_value w,
|
||||||
s48_value h, s48_value a1, s48_value a2) {
|
s48_value h, s48_value a1, s48_value a2) {
|
||||||
|
S48_DECLARE_GC_PROTECT_9(display, drawable, gc, x, y, w, h, a1, a2);
|
||||||
XFillArc(scx_extract_display(display), scx_extract_drawable(drawable),
|
XFillArc(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), (int)s48_extract_integer(x),
|
scx_extract_gc(gc), (int)s48_extract_integer(x),
|
||||||
(int)s48_extract_integer(y), (int)s48_extract_integer(w),
|
(int)s48_extract_integer(y), (int)s48_extract_integer(w),
|
||||||
(int)s48_extract_integer(h), (int)s48_extract_integer(a1),
|
(int)s48_extract_integer(h), (int)s48_extract_integer(a1),
|
||||||
(int)s48_extract_integer(a2));
|
(int)s48_extract_integer(a2));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Fill_Arcs(s48_value display, s48_value drawable,
|
s48_value scx_Fill_Arcs(s48_value display, s48_value drawable,
|
||||||
s48_value gc, s48_value arcs) {
|
s48_value gc, s48_value arcs) {
|
||||||
int n = s48_list_length(arcs);
|
int n = s48_list_length(arcs);
|
||||||
XArc p[n];
|
XArc p[n];
|
||||||
|
S48_DECLARE_GC_PROTECT_4(display, drawable, gc, arcs);
|
||||||
List_To_XArcs(arcs, p, n);
|
List_To_XArcs(arcs, p, n);
|
||||||
XFillArcs(scx_extract_display(display), scx_extract_drawable(drawable),
|
XFillArcs(scx_extract_display(display), scx_extract_drawable(drawable),
|
||||||
scx_extract_gc(gc), p, n);
|
scx_extract_gc(gc), p, n);
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void scx_init_graphics(void) {
|
void scx_init_graphics(void) {
|
||||||
|
|
59
c/xlib/key.c
59
c/xlib/key.c
|
@ -7,6 +7,7 @@ s48_value scx_Change_Keyboard_Mapping(s48_value display,
|
||||||
s48_value keysyms_lists) {
|
s48_value keysyms_lists) {
|
||||||
int max = 0, n = s48_list_length(keysyms_lists), i;
|
int max = 0, n = s48_list_length(keysyms_lists), i;
|
||||||
s48_value l = keysyms_lists;
|
s48_value l = keysyms_lists;
|
||||||
|
S48_DECLARE_GC_PROTECT_3(display, first_keycode, keysyms_lists);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
int m = s48_list_length(S48_CAR(l));
|
int m = s48_list_length(S48_CAR(l));
|
||||||
if (m > max) max = m;
|
if (m > max) max = m;
|
||||||
|
@ -33,7 +34,7 @@ s48_value scx_Change_Keyboard_Mapping(s48_value display,
|
||||||
s48_extract_integer(first_keycode),
|
s48_extract_integer(first_keycode),
|
||||||
max, ks, max * n);
|
max, ks, max * n);
|
||||||
}
|
}
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Get_Keyboard_Mapping(s48_value display, s48_value first_keycode,
|
s48_value scx_Get_Keyboard_Mapping(s48_value display, s48_value first_keycode,
|
||||||
|
@ -59,7 +60,7 @@ s48_value scx_Get_Keyboard_Mapping(s48_value display, s48_value first_keycode,
|
||||||
S48_GC_UNPROTECT();
|
S48_GC_UNPROTECT();
|
||||||
|
|
||||||
XFree(ks);
|
XFree(ks);
|
||||||
return l;
|
S48_GC_RETURN(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Display_Keycodes(s48_value display) {
|
s48_value scx_Display_Keycodes(s48_value display) {
|
||||||
|
@ -70,12 +71,14 @@ s48_value scx_Display_Keycodes(s48_value display) {
|
||||||
|
|
||||||
s48_value scx_Set_Modifier_Mapping(s48_value display, s48_value modmap) {
|
s48_value scx_Set_Modifier_Mapping(s48_value display, s48_value modmap) {
|
||||||
int max = 0;
|
int max = 0;
|
||||||
s48_value l = modmap;
|
s48_value l = modmap, l2 = S48_FALSE;
|
||||||
|
S48_DECLARE_GC_PROTECT_4(display, modmap, l, l2);
|
||||||
for (; l != S48_NULL; l = S48_CDR(l)) {
|
for (; l != S48_NULL; l = S48_CDR(l)) {
|
||||||
int m = s48_list_length(S48_CDR(S48_CAR(l)));
|
int m = s48_list_length(S48_CDR(S48_CAR(l)));
|
||||||
if (m > max) max = m;
|
if (m > max) max = m;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
int res;
|
||||||
KeyCode ks[8*max];
|
KeyCode ks[8*max];
|
||||||
XModifierKeymap cmap;
|
XModifierKeymap cmap;
|
||||||
cmap.max_keypermod = max;
|
cmap.max_keypermod = max;
|
||||||
|
@ -83,7 +86,7 @@ s48_value scx_Set_Modifier_Mapping(s48_value display, s48_value modmap) {
|
||||||
|
|
||||||
for (l = modmap; l != S48_NULL; l = S48_CDR(l)) {
|
for (l = modmap; l != S48_NULL; l = S48_CDR(l)) {
|
||||||
int mod = scx_extract_state(S48_CAR(S48_CAR(l)));
|
int mod = scx_extract_state(S48_CAR(S48_CAR(l)));
|
||||||
s48_value l2 = S48_CDR(S48_CAR(l));
|
l2 = S48_CDR(S48_CAR(l));
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (j = 0; j < max; j++) {
|
for (j = 0; j < max; j++) {
|
||||||
if ((mod < 0) || (mod > 7)) continue; /* TODO: error?? */
|
if ((mod < 0) || (mod > 7)) continue; /* TODO: error?? */
|
||||||
|
@ -94,17 +97,19 @@ s48_value scx_Set_Modifier_Mapping(s48_value display, s48_value modmap) {
|
||||||
ks[mod*max + j] = 0;
|
ks[mod*max + j] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s48_enter_integer(XSetModifierMapping(scx_extract_display(display),
|
res = XSetModifierMapping(scx_extract_display(display),
|
||||||
&cmap));
|
&cmap);
|
||||||
|
S48_GC_RETURN(s48_enter_integer(res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Get_Modifier_Mapping(s48_value display) {
|
s48_value scx_Get_Modifier_Mapping(s48_value display) {
|
||||||
XModifierKeymap* km = XGetModifierMapping(scx_extract_display(display));
|
XModifierKeymap* km;
|
||||||
s48_value l = S48_NULL, l2 = S48_NULL;
|
s48_value l = S48_NULL, l2 = S48_NULL;
|
||||||
int i;
|
int i;
|
||||||
S48_DECLARE_GC_PROTECT(2);
|
S48_DECLARE_GC_PROTECT(3);
|
||||||
S48_GC_PROTECT_2(l, l2);
|
S48_GC_PROTECT_3(display, l, l2);
|
||||||
|
km = XGetModifierMapping(scx_extract_display(display));
|
||||||
for (i = 7; i >= 0; i--) {
|
for (i = 7; i >= 0; i--) {
|
||||||
int j;
|
int j;
|
||||||
l2 = S48_NULL;
|
l2 = S48_NULL;
|
||||||
|
@ -132,28 +137,39 @@ s48_value scx_Keysym_To_String(s48_value ks) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Keycode_To_Keysym(s48_value display, s48_value kc, s48_value i) {
|
s48_value scx_Keycode_To_Keysym(s48_value display, s48_value kc, s48_value i) {
|
||||||
KeySym ks = XKeycodeToKeysym(scx_extract_display(display),
|
KeySym ks;
|
||||||
s48_extract_integer(kc),
|
S48_DECLARE_GC_PROTECT_3(display, kc, i);
|
||||||
s48_extract_integer(i));
|
ks = XKeycodeToKeysym(scx_extract_display(display),
|
||||||
return scx_enter_keysym(ks);
|
s48_extract_integer(kc),
|
||||||
|
s48_extract_integer(i));
|
||||||
|
S48_GC_RETURN(scx_enter_keysym(ks));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Keysym_To_Keycode(s48_value display, s48_value ks) {
|
s48_value scx_Keysym_To_Keycode(s48_value display, s48_value ks) {
|
||||||
KeyCode kc = XKeysymToKeycode(scx_extract_display(display),
|
KeyCode kc;
|
||||||
|
S48_DECLARE_GC_PROTECT_2(display, ks);
|
||||||
|
kc = XKeysymToKeycode(scx_extract_display(display),
|
||||||
scx_extract_keysym(ks));
|
scx_extract_keysym(ks));
|
||||||
return s48_enter_integer(kc);
|
S48_GC_RETURN(s48_enter_integer(kc));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Convert_Case(s48_value keysym) {
|
s48_value scx_Convert_Case(s48_value keysym) {
|
||||||
KeySym low, up;
|
KeySym low, up;
|
||||||
|
s48_value res = S48_FALSE;
|
||||||
|
S48_DECLARE_GC_PROTECT_2(keysym, res);
|
||||||
XConvertCase(scx_extract_keysym(keysym), &low, &up);
|
XConvertCase(scx_extract_keysym(keysym), &low, &up);
|
||||||
return s48_cons(scx_enter_keysym(low), scx_enter_keysym(up));
|
res = scx_enter_keysym(up);
|
||||||
|
res = s48_cons(scx_enter_keysym(low), res);
|
||||||
|
S48_GC_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Lookup_Keysym(s48_value key_event, s48_value index) {
|
s48_value scx_Lookup_Keysym(s48_value key_event, s48_value index) {
|
||||||
XKeyEvent ke;
|
XKeyEvent ke;
|
||||||
|
s48_value res = S48_FALSE;
|
||||||
|
S48_DECLARE_GC_PROTECT_3(key_event, index, res);
|
||||||
scx_extract_key_event(key_event, &ke);
|
scx_extract_key_event(key_event, &ke);
|
||||||
return scx_enter_keysym(XLookupKeysym(&ke, s48_extract_integer(index)));
|
res = scx_enter_keysym(XLookupKeysym(&ke, s48_extract_integer(index)));
|
||||||
|
S48_GC_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Refresh_Keyboard_Mapping(s48_value mapping_event) {
|
s48_value scx_Refresh_Keyboard_Mapping(s48_value mapping_event) {
|
||||||
|
@ -169,24 +185,23 @@ s48_value scx_Lookup_String(s48_value key_event) {
|
||||||
int len;
|
int len;
|
||||||
KeySym keysym_return;
|
KeySym keysym_return;
|
||||||
s48_value res = S48_FALSE;
|
s48_value res = S48_FALSE;
|
||||||
S48_DECLARE_GC_PROTECT(1);
|
S48_DECLARE_GC_PROTECT_2(key_event, res);
|
||||||
|
|
||||||
scx_extract_key_event(key_event, &e);
|
scx_extract_key_event(key_event, &e);
|
||||||
len = XLookupString(&e, buf, 1023, &keysym_return, NULL);
|
len = XLookupString(&e, buf, 1023, &keysym_return, NULL);
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
|
|
||||||
S48_GC_PROTECT_1(res);
|
|
||||||
res = s48_enter_string(buf);
|
res = s48_enter_string(buf);
|
||||||
res = s48_cons(scx_enter_keysym(keysym_return), res);
|
res = s48_cons(scx_enter_keysym(keysym_return), res);
|
||||||
S48_GC_UNPROTECT();
|
|
||||||
|
|
||||||
return res;
|
S48_GC_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Rebind_Keysym(s48_value display, s48_value keysym,
|
s48_value scx_Rebind_Keysym(s48_value display, s48_value keysym,
|
||||||
s48_value mod_keysyms, s48_value str) {
|
s48_value mod_keysyms, s48_value str) {
|
||||||
int i, n = s48_list_length(mod_keysyms);
|
int i, n = s48_list_length(mod_keysyms);
|
||||||
KeySym mods[n];
|
KeySym mods[n];
|
||||||
|
S48_DECLARE_GC_PROTECT_4(display, keysym, mod_keysyms, str);
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
mods[i] = scx_extract_keysym(S48_CAR(mod_keysyms));
|
mods[i] = scx_extract_keysym(S48_CAR(mod_keysyms));
|
||||||
|
@ -197,7 +212,7 @@ s48_value scx_Rebind_Keysym(s48_value display, s48_value keysym,
|
||||||
mods, n,
|
mods, n,
|
||||||
(unsigned char *)s48_extract_string(str),
|
(unsigned char *)s48_extract_string(str),
|
||||||
S48_STRING_LENGTH(str));
|
S48_STRING_LENGTH(str));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
scx_init_key () {
|
scx_init_key () {
|
||||||
|
|
|
@ -4,17 +4,19 @@
|
||||||
|
|
||||||
s48_value scx_Create_Pixmap(s48_value display, s48_value drawable, s48_value w,
|
s48_value scx_Create_Pixmap(s48_value display, s48_value drawable, s48_value w,
|
||||||
s48_value h, s48_value depth) {
|
s48_value h, s48_value depth) {
|
||||||
|
S48_DECLARE_GC_PROTECT_5(display, drawable, w, h, depth);
|
||||||
Pixmap pm = XCreatePixmap(scx_extract_display(display),
|
Pixmap pm = XCreatePixmap(scx_extract_display(display),
|
||||||
scx_extract_drawable(drawable),
|
scx_extract_drawable(drawable),
|
||||||
(int)s48_extract_integer(w),
|
(int)s48_extract_integer(w),
|
||||||
(int)s48_extract_integer(h),
|
(int)s48_extract_integer(h),
|
||||||
(int)s48_extract_integer(depth));
|
(int)s48_extract_integer(depth));
|
||||||
return scx_enter_pixmap(pm);
|
S48_GC_RETURN(scx_enter_pixmap(pm));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Free_Pixmap(s48_value display, s48_value pixmap) {
|
s48_value scx_Free_Pixmap(s48_value display, s48_value pixmap) {
|
||||||
|
S48_DECLARE_GC_PROTECT_2(display, pixmap);
|
||||||
XFreePixmap(scx_extract_display(display), scx_extract_pixmap(pixmap));
|
XFreePixmap(scx_extract_display(display), scx_extract_pixmap(pixmap));
|
||||||
return S48_UNSPECIFIC;
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Read_Bitmap_File(s48_value display, s48_value drawable,
|
s48_value scx_Read_Bitmap_File(s48_value display, s48_value drawable,
|
||||||
|
@ -23,7 +25,7 @@ s48_value scx_Read_Bitmap_File(s48_value display, s48_value drawable,
|
||||||
int res, xhot, yhot;
|
int res, xhot, yhot;
|
||||||
Pixmap bitmap;
|
Pixmap bitmap;
|
||||||
s48_value ret = S48_FALSE;
|
s48_value ret = S48_FALSE;
|
||||||
S48_DECLARE_GC_PROTECT(1);
|
S48_DECLARE_GC_PROTECT_4(display, drawable, filename, ret);
|
||||||
|
|
||||||
res = XReadBitmapFile(scx_extract_display(display),
|
res = XReadBitmapFile(scx_extract_display(display),
|
||||||
scx_extract_drawable(drawable),
|
scx_extract_drawable(drawable),
|
||||||
|
@ -31,22 +33,21 @@ s48_value scx_Read_Bitmap_File(s48_value display, s48_value drawable,
|
||||||
&xhot, &yhot);
|
&xhot, &yhot);
|
||||||
|
|
||||||
if (res != BitmapSuccess)
|
if (res != BitmapSuccess)
|
||||||
return s48_enter_integer(res);
|
S48_GC_RETURN(s48_enter_integer(res));
|
||||||
|
|
||||||
S48_GC_PROTECT_1(ret);
|
|
||||||
ret = s48_cons(s48_enter_integer(yhot), S48_NULL);
|
ret = s48_cons(s48_enter_integer(yhot), S48_NULL);
|
||||||
ret = s48_cons(s48_enter_integer(xhot), ret);
|
ret = s48_cons(s48_enter_integer(xhot), ret);
|
||||||
ret = s48_cons(s48_enter_integer(height), ret);
|
ret = s48_cons(s48_enter_integer(height), ret);
|
||||||
ret = s48_cons(s48_enter_integer(width), ret);
|
ret = s48_cons(s48_enter_integer(width), ret);
|
||||||
ret = s48_cons(scx_enter_pixmap(bitmap), ret);
|
ret = s48_cons(scx_enter_pixmap(bitmap), ret);
|
||||||
S48_GC_UNPROTECT();
|
S48_GC_RETURN(ret);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Write_Bitmap_File(s48_value display, s48_value filename,
|
s48_value scx_Write_Bitmap_File(s48_value display, s48_value filename,
|
||||||
s48_value bitmap, s48_value w, s48_value h,
|
s48_value bitmap, s48_value w, s48_value h,
|
||||||
s48_value x, s48_value y) {
|
s48_value x, s48_value y) {
|
||||||
int ret;
|
int ret;
|
||||||
|
S48_DECLARE_GC_PROTECT_7(display, filename, bitmap, w, h, x, y);
|
||||||
ret = XWriteBitmapFile(scx_extract_display(display),
|
ret = XWriteBitmapFile(scx_extract_display(display),
|
||||||
s48_extract_string(filename),
|
s48_extract_string(filename),
|
||||||
scx_extract_pixmap(bitmap),
|
scx_extract_pixmap(bitmap),
|
||||||
|
@ -54,18 +55,20 @@ s48_value scx_Write_Bitmap_File(s48_value display, s48_value filename,
|
||||||
(int)s48_extract_integer(h),
|
(int)s48_extract_integer(h),
|
||||||
(int)s48_extract_integer(x),
|
(int)s48_extract_integer(x),
|
||||||
(int)s48_extract_integer(y));
|
(int)s48_extract_integer(y));
|
||||||
return s48_enter_integer(ret);
|
S48_GC_RETURN(s48_enter_integer(ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Create_Bitmap_From_Data(s48_value display, s48_value drawable,
|
s48_value scx_Create_Bitmap_From_Data(s48_value display, s48_value drawable,
|
||||||
s48_value data, s48_value w,
|
s48_value data, s48_value w,
|
||||||
s48_value h) {
|
s48_value h) {
|
||||||
Pixmap pm = XCreateBitmapFromData(scx_extract_display(display),
|
Pixmap pm;
|
||||||
scx_extract_drawable(drawable),
|
S48_DECLARE_GC_PROTECT_5(display, drawable, data, w, h);
|
||||||
s48_extract_string(data),
|
pm = XCreateBitmapFromData(scx_extract_display(display),
|
||||||
s48_extract_integer(w),
|
scx_extract_drawable(drawable),
|
||||||
s48_extract_integer(h));
|
s48_extract_string(data),
|
||||||
return scx_enter_pixmap(pm);
|
s48_extract_integer(w),
|
||||||
|
s48_extract_integer(h));
|
||||||
|
S48_GC_RETURN(scx_enter_pixmap(pm));
|
||||||
}
|
}
|
||||||
|
|
||||||
s48_value scx_Create_Pixmap_From_Bitmap_Data(s48_value display,
|
s48_value scx_Create_Pixmap_From_Bitmap_Data(s48_value display,
|
||||||
|
@ -74,15 +77,17 @@ s48_value scx_Create_Pixmap_From_Bitmap_Data(s48_value display,
|
||||||
s48_value w,s48_value h,
|
s48_value w,s48_value h,
|
||||||
s48_value f, s48_value b,
|
s48_value f, s48_value b,
|
||||||
s48_value depth) {
|
s48_value depth) {
|
||||||
Pixmap pm = XCreatePixmapFromBitmapData(scx_extract_display(display),
|
Pixmap pm;
|
||||||
scx_extract_drawable(drawable),
|
S48_DECLARE_GC_PROTECT_8(display, drawable, data, w, h, f, b, depth);
|
||||||
s48_extract_string(data),
|
pm = XCreatePixmapFromBitmapData(scx_extract_display(display),
|
||||||
(int)s48_extract_integer(w),
|
scx_extract_drawable(drawable),
|
||||||
(int)s48_extract_integer(h),
|
s48_extract_string(data),
|
||||||
scx_extract_pixel(f),
|
(int)s48_extract_integer(w),
|
||||||
scx_extract_pixel(b),
|
(int)s48_extract_integer(h),
|
||||||
(int)s48_extract_integer(depth));
|
scx_extract_pixel(f),
|
||||||
return scx_enter_pixmap(pm);
|
scx_extract_pixel(b),
|
||||||
|
(int)s48_extract_integer(depth));
|
||||||
|
S48_GC_RETURN(scx_enter_pixmap(pm));
|
||||||
}
|
}
|
||||||
|
|
||||||
void scx_init_pixmap(void) {
|
void scx_init_pixmap(void) {
|
||||||
|
|
Loading…
Reference in New Issue