fixed gc protection
This commit is contained in:
parent
629bfa1d73
commit
a0a6afc820
|
@ -39,6 +39,7 @@ s48_value scx_enter_visual_info(XVisualInfo* vi) {
|
|||
|
||||
unsigned int scx_extract_visual_info(s48_value v, XVisualInfo* vi) {
|
||||
unsigned long mask = 0;
|
||||
S48_DECLARE_GC_PROTECT_1(v);
|
||||
s48_check_record_type(v, scx_visual_info_binding);
|
||||
if (!S48_FALSE_P(S48_RECORD_REF(v, 0)))
|
||||
vi->visual = scx_extract_visual(S48_RECORD_REF(v, 0));
|
||||
|
@ -78,7 +79,7 @@ unsigned int scx_extract_visual_info(s48_value v, XVisualInfo* vi) {
|
|||
vi->colormap_size = s48_extract_integer(S48_RECORD_REF(v, 10));
|
||||
mask |= VisualColormapSizeMask;
|
||||
}
|
||||
return mask;
|
||||
S48_GC_RETURN(mask);
|
||||
}
|
||||
|
||||
s48_value scx_Get_Visual_Info(s48_value display, s48_value template) {
|
||||
|
@ -87,12 +88,11 @@ s48_value scx_Get_Visual_Info(s48_value display, s48_value template) {
|
|||
XVisualInfo* vis;
|
||||
int n, i;
|
||||
s48_value l = S48_NULL;
|
||||
S48_DECLARE_GC_PROTECT(1);
|
||||
S48_DECLARE_GC_PROTECT_3(display, template, l);
|
||||
|
||||
vis = XGetVisualInfo(scx_extract_display(display),
|
||||
mask, &templ, &n);
|
||||
|
||||
S48_GC_PROTECT_1(l);
|
||||
for (i = n-1; i >= 0; i--)
|
||||
l = s48_cons(scx_enter_visual_info(&vis[i]), l);
|
||||
S48_GC_UNPROTECT();
|
||||
|
@ -102,15 +102,15 @@ s48_value scx_Get_Visual_Info(s48_value display, s48_value template) {
|
|||
s48_value scx_Match_Visual_Info(s48_value display, s48_value scrnum,
|
||||
s48_value depth, s48_value class) {
|
||||
XVisualInfo vi;
|
||||
Status r = XMatchVisualInfo(scx_extract_display(display),
|
||||
s48_extract_integer(scrnum),
|
||||
s48_extract_integer(depth),
|
||||
scx_extract_visual_class(class),
|
||||
&vi);
|
||||
if (!r)
|
||||
return S48_FALSE;
|
||||
S48_DECLARE_GC_PROTECT_4(display, scrnum, depth, class);
|
||||
if (! XMatchVisualInfo(scx_extract_display(display),
|
||||
s48_extract_integer(scrnum),
|
||||
s48_extract_integer(depth),
|
||||
scx_extract_visual_class(class),
|
||||
&vi) )
|
||||
S48_GC_RETURN(S48_FALSE);
|
||||
else
|
||||
return scx_enter_visual_info(&vi);
|
||||
S48_GC_RETURN(scx_enter_visual_info(&vi));
|
||||
}
|
||||
|
||||
s48_value scx_VisualIDFromVisual(s48_value visual) {
|
||||
|
|
133
c/xlib/window.c
133
c/xlib/window.c
|
@ -10,9 +10,11 @@ static unsigned long
|
|||
scx_extract_set_window_attribute_alist(s48_value attribs,
|
||||
XSetWindowAttributes* Xattrs) {
|
||||
unsigned long mask = 0;
|
||||
s48_value v = S48_FALSE;
|
||||
S48_DECLARE_GC_PROTECT_2(attribs, v);
|
||||
while (attribs != S48_NULL) {
|
||||
int mv = scx_extract_set_window_attribute(S48_CAR(S48_CAR(attribs)));
|
||||
s48_value v = S48_CDR(S48_CAR(attribs));
|
||||
v = S48_CDR(S48_CAR(attribs));
|
||||
attribs = S48_CDR(attribs);
|
||||
mask = mask | (1L << mv);
|
||||
switch (1L << mv) {
|
||||
|
@ -48,7 +50,7 @@ scx_extract_set_window_attribute_alist(s48_value attribs,
|
|||
Xattrs->cursor = scx_extract_cursor(v); break;
|
||||
}
|
||||
}
|
||||
return mask;
|
||||
S48_GC_RETURN(mask);
|
||||
}
|
||||
|
||||
s48_value scx_Create_Window (s48_value display, s48_value parent,
|
||||
|
@ -59,8 +61,10 @@ s48_value scx_Create_Window (s48_value display, s48_value parent,
|
|||
s48_value attribs) {
|
||||
Window win;
|
||||
XSetWindowAttributes Xattrs;
|
||||
unsigned long mask =
|
||||
scx_extract_set_window_attribute_alist(attribs, &Xattrs);
|
||||
unsigned long mask;
|
||||
S48_DECLARE_GC_PROTECT_11(display, parent, x, y, width, height, border_width,
|
||||
depth, class, visual, attribs);
|
||||
mask = scx_extract_set_window_attribute_alist(attribs, &Xattrs);
|
||||
|
||||
win = XCreateWindow(scx_extract_display(display),
|
||||
scx_extract_window(parent),
|
||||
|
@ -72,7 +76,7 @@ s48_value scx_Create_Window (s48_value display, s48_value parent,
|
|||
s48_extract_integer(depth),
|
||||
s48_extract_integer(class),
|
||||
scx_extract_visual(visual), mask, &Xattrs);
|
||||
return scx_enter_window(win);
|
||||
S48_GC_RETURN(scx_enter_window(win));
|
||||
}
|
||||
|
||||
s48_value scx_Create_Simple_Window(s48_value display, s48_value parent,
|
||||
|
@ -80,27 +84,31 @@ s48_value scx_Create_Simple_Window(s48_value display, s48_value parent,
|
|||
s48_value width, s48_value height,
|
||||
s48_value border_width, s48_value border,
|
||||
s48_value background) {
|
||||
Window win = XCreateSimpleWindow(scx_extract_display(display),
|
||||
scx_extract_window(parent),
|
||||
(int)s48_extract_integer(x),
|
||||
(int)s48_extract_integer(y),
|
||||
(int)s48_extract_integer(width),
|
||||
(int)s48_extract_integer(height),
|
||||
(int)s48_extract_integer(border_width),
|
||||
scx_extract_pixel(border),
|
||||
scx_extract_pixel(background));
|
||||
return scx_enter_window(win);
|
||||
Window win;
|
||||
S48_DECLARE_GC_PROTECT_9(display, parent, x, y, width, height, border_width,
|
||||
border, background);
|
||||
win = XCreateSimpleWindow(scx_extract_display(display),
|
||||
scx_extract_window(parent),
|
||||
(int)s48_extract_integer(x),
|
||||
(int)s48_extract_integer(y),
|
||||
(int)s48_extract_integer(width),
|
||||
(int)s48_extract_integer(height),
|
||||
(int)s48_extract_integer(border_width),
|
||||
scx_extract_pixel(border),
|
||||
scx_extract_pixel(background));
|
||||
S48_GC_RETURN(scx_enter_window(win));
|
||||
}
|
||||
|
||||
s48_value scx_Change_Window_Attributes(s48_value display, s48_value window,
|
||||
s48_value attribs) {
|
||||
XSetWindowAttributes Xattrs;
|
||||
unsigned long mask =
|
||||
scx_extract_set_window_attribute_alist(attribs, &Xattrs);
|
||||
unsigned long mask;
|
||||
S48_DECLARE_GC_PROTECT_3(display, window, attribs);
|
||||
mask = scx_extract_set_window_attribute_alist(attribs, &Xattrs);
|
||||
XChangeWindowAttributes(scx_extract_display(display),
|
||||
scx_extract_window(window),
|
||||
mask, &Xattrs);
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_enter_window_changes(XWindowChanges* WC, unsigned long mask) {
|
||||
|
@ -150,9 +158,11 @@ s48_value scx_enter_window_changes(XWindowChanges* WC, unsigned long mask) {
|
|||
unsigned long scx_extract_window_changes(s48_value changes,
|
||||
XWindowChanges* WC) {
|
||||
unsigned long mask = 0;
|
||||
s48_value v = S48_FALSE;
|
||||
S48_DECLARE_GC_PROTECT_2(changes, v);
|
||||
while (changes != S48_NULL) {
|
||||
int mv = scx_extract_window_change(S48_CAR(S48_CAR(changes)));
|
||||
s48_value v = S48_CDR(S48_CAR(changes));
|
||||
v = S48_CDR(S48_CAR(changes));
|
||||
changes = S48_CDR(changes);
|
||||
mask = mask | (1L << mv);
|
||||
switch (1L << mv) {
|
||||
|
@ -172,17 +182,19 @@ unsigned long scx_extract_window_changes(s48_value changes,
|
|||
WC->stack_mode = scx_extract_stack_mode(v); break;
|
||||
}
|
||||
}
|
||||
return mask;
|
||||
S48_GC_RETURN(mask);
|
||||
}
|
||||
|
||||
s48_value scx_Configure_Window(s48_value display, s48_value window,
|
||||
s48_value changes) {
|
||||
XWindowChanges WC;
|
||||
unsigned long mask = scx_extract_window_changes(changes, &WC);
|
||||
unsigned long mask;
|
||||
S48_DECLARE_GC_PROTECT_3(display, window, changes);
|
||||
mask = scx_extract_window_changes(changes, &WC);
|
||||
|
||||
XConfigureWindow(scx_extract_display(display), scx_extract_window(window),
|
||||
mask, &WC);
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_window_attibutes_binding = S48_FALSE;
|
||||
|
@ -220,12 +232,13 @@ s48_value scx_enter_window_attributes(XWindowAttributes* WA) {
|
|||
|
||||
s48_value scx_Get_Window_Attributes(s48_value display, s48_value window) {
|
||||
XWindowAttributes WA;
|
||||
S48_DECLARE_GC_PROTECT_2(display, window);
|
||||
if (!XGetWindowAttributes(scx_extract_display(display),
|
||||
scx_extract_window(window),
|
||||
&WA))
|
||||
return S48_FALSE;
|
||||
S48_GC_RETURN(S48_FALSE);
|
||||
else
|
||||
return scx_enter_window_attributes(&WA);
|
||||
S48_GC_RETURN(scx_enter_window_attributes(&WA));
|
||||
}
|
||||
|
||||
s48_value scx_Get_Geometry(s48_value display, s48_value drawable) {
|
||||
|
@ -233,15 +246,14 @@ s48_value scx_Get_Geometry(s48_value display, s48_value drawable) {
|
|||
Window root;
|
||||
int x, y;
|
||||
unsigned int width, height, border_width, depth;
|
||||
S48_DECLARE_GC_PROTECT(1);
|
||||
S48_DECLARE_GC_PROTECT_3(display, drawable, v);
|
||||
|
||||
if (!XGetGeometry(scx_extract_display(display),
|
||||
scx_extract_drawable(drawable),
|
||||
&root, &x, &y, &width, &height, &border_width, &depth))
|
||||
return S48_FALSE;
|
||||
S48_GC_RETURN(S48_FALSE);
|
||||
else {
|
||||
v = s48_make_vector(7, S48_FALSE);
|
||||
S48_GC_PROTECT_1(v);
|
||||
S48_VECTOR_SET(v, 0, scx_enter_window(root));
|
||||
S48_VECTOR_SET(v, 1, s48_enter_fixnum(x));
|
||||
S48_VECTOR_SET(v, 2, s48_enter_fixnum(y));
|
||||
|
@ -249,57 +261,65 @@ s48_value scx_Get_Geometry(s48_value display, s48_value drawable) {
|
|||
S48_VECTOR_SET(v, 4, s48_enter_fixnum(height));
|
||||
S48_VECTOR_SET(v, 5, s48_enter_fixnum(border_width));
|
||||
S48_VECTOR_SET(v, 6, s48_enter_fixnum(depth));
|
||||
S48_GC_UNPROTECT();
|
||||
return v;
|
||||
S48_GC_RETURN(v);
|
||||
}
|
||||
}
|
||||
|
||||
s48_value scx_Map_Window(s48_value display, s48_value window) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, window);
|
||||
XMapWindow(scx_extract_display(display), scx_extract_window(window));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Map_Raised(s48_value display, s48_value window) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, window);
|
||||
XMapRaised(scx_extract_display(display), scx_extract_window(window));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Map_Subwindows(s48_value display, s48_value window) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, window);
|
||||
XMapSubwindows(scx_extract_display(display), scx_extract_window(window));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Unmap_Window(s48_value display, s48_value window) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, window);
|
||||
XUnmapWindow(scx_extract_display(display), scx_extract_window(window));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Unmap_Subwindows(s48_value display, s48_value window) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, window);
|
||||
XUnmapSubwindows(scx_extract_display(display), scx_extract_window(window));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Destroy_Window(s48_value display, s48_value window) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, window);
|
||||
XDestroyWindow(scx_extract_display(display), scx_extract_window(window));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Destroy_Subwindows(s48_value display, s48_value window) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, window);
|
||||
XDestroySubwindows(scx_extract_display(display),
|
||||
scx_extract_window(window));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Raise_Window(s48_value display, s48_value window) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, window);
|
||||
XRaiseWindow(scx_extract_display(display),
|
||||
scx_extract_window(window));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Lower_Window(s48_value display, s48_value window) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, window);
|
||||
XLowerWindow(scx_extract_display(display),
|
||||
scx_extract_window(window));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_circulate_direction_binding = S48_FALSE;
|
||||
|
@ -308,55 +328,56 @@ s48_value scx_circulate_direction_binding = S48_FALSE;
|
|||
|
||||
s48_value scx_Circulate_Subwindows(s48_value display, s48_value window,
|
||||
s48_value dir) {
|
||||
S48_DECLARE_GC_PROTECT_3(display, window, dir);
|
||||
XCirculateSubwindows(scx_extract_display(display),
|
||||
scx_extract_window(window),
|
||||
scx_extract_direction(dir));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Restack_Windows(s48_value display, s48_value windows) {
|
||||
int i, n = s48_list_length(windows);
|
||||
Window wins[n];
|
||||
S48_DECLARE_GC_PROTECT_2(display, windows);
|
||||
for (i = n-1; i >= 0; i--) {
|
||||
wins[i] = scx_extract_window(S48_CAR(windows));
|
||||
windows = S48_CDR(windows);
|
||||
}
|
||||
XRestackWindows(scx_extract_display(display),
|
||||
wins, n);
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Clear_Area(s48_value display, s48_value window,
|
||||
s48_value x, s48_value y,
|
||||
s48_value width, s48_value height,
|
||||
s48_value exposures) {
|
||||
S48_DECLARE_GC_PROTECT_7(display, window, x, y, window, height, exposures);
|
||||
XClearArea(scx_extract_display(display), scx_extract_window(window),
|
||||
s48_extract_integer(x), s48_extract_integer(y),
|
||||
s48_extract_integer(width), s48_extract_integer(height),
|
||||
S48_EXTRACT_BOOLEAN(exposures));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Clear_Window(s48_value display, s48_value window) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, window);
|
||||
XClearWindow(scx_extract_display(display),
|
||||
scx_extract_window(window));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Query_Tree(s48_value display, s48_value window) {
|
||||
Window root, parent, *children;
|
||||
int i;
|
||||
unsigned n;
|
||||
|
||||
s48_value c = S48_NULL, res = S48_NULL;
|
||||
S48_DECLARE_GC_PROTECT(2);
|
||||
S48_DECLARE_GC_PROTECT_4(display, window, c, res);
|
||||
|
||||
if (! XQueryTree (scx_extract_display(display),
|
||||
scx_extract_window(window),
|
||||
&root, &parent, &children, &n))
|
||||
return S48_FALSE;
|
||||
|
||||
S48_GC_PROTECT_2(c, res);
|
||||
S48_GC_RETURN(S48_FALSE);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
c = s48_cons(scx_enter_window(children[i]), c);
|
||||
|
@ -366,8 +387,7 @@ s48_value scx_Query_Tree(s48_value display, s48_value window) {
|
|||
res = s48_cons(scx_enter_window(parent), res);
|
||||
res = s48_cons(scx_enter_window(root), res);
|
||||
|
||||
S48_GC_UNPROTECT();
|
||||
return res;
|
||||
S48_GC_RETURN(res);
|
||||
}
|
||||
|
||||
s48_value scx_Translate_Coordinates(s48_value display, s48_value src,
|
||||
|
@ -376,7 +396,7 @@ s48_value scx_Translate_Coordinates(s48_value display, s48_value src,
|
|||
int rx, ry;
|
||||
Window child;
|
||||
s48_value res = S48_NULL;
|
||||
S48_DECLARE_GC_PROTECT(1);
|
||||
S48_DECLARE_GC_PROTECT_6(display, src, dest, x, y, res);
|
||||
|
||||
if (!XTranslateCoordinates(scx_extract_display(display),
|
||||
scx_extract_window(src),
|
||||
|
@ -384,16 +404,13 @@ s48_value scx_Translate_Coordinates(s48_value display, s48_value src,
|
|||
(int)s48_extract_integer (x),
|
||||
(int)s48_extract_integer (y),
|
||||
&rx, &ry, &child))
|
||||
return S48_FALSE;
|
||||
|
||||
S48_GC_PROTECT_1(res);
|
||||
S48_GC_RETURN(S48_FALSE);
|
||||
|
||||
res = s48_cons(scx_enter_window(child), res);
|
||||
res = s48_cons(s48_enter_fixnum(ry), res);
|
||||
res = s48_cons(s48_enter_fixnum(rx), res);
|
||||
|
||||
S48_GC_UNPROTECT();
|
||||
return res;
|
||||
S48_GC_RETURN(res);
|
||||
}
|
||||
|
||||
s48_value scx_Query_Pointer(s48_value display, s48_value window) {
|
||||
|
@ -402,13 +419,12 @@ s48_value scx_Query_Pointer(s48_value display, s48_value window) {
|
|||
Window root, child;
|
||||
int r_x, r_y, x, y;
|
||||
unsigned int mask;
|
||||
S48_DECLARE_GC_PROTECT(1);
|
||||
S48_DECLARE_GC_PROTECT_3(display, window, v);
|
||||
|
||||
ret = XQueryPointer(scx_extract_display(display), scx_extract_window(window),
|
||||
&root, &child, &r_x, &r_y, &x, &y, &mask);
|
||||
|
||||
v = s48_make_vector(8, S48_FALSE);
|
||||
S48_GC_PROTECT_1(v);
|
||||
|
||||
S48_VECTOR_SET(v, 0, scx_enter_window(root));
|
||||
S48_VECTOR_SET(v, 1, scx_enter_window(child));
|
||||
|
@ -419,8 +435,7 @@ s48_value scx_Query_Pointer(s48_value display, s48_value window) {
|
|||
S48_VECTOR_SET(v, 6, s48_enter_integer((unsigned long)mask));
|
||||
S48_VECTOR_SET(v, 7, ret ? S48_TRUE : S48_FALSE);
|
||||
|
||||
S48_GC_UNPROTECT();
|
||||
return v;
|
||||
S48_GC_RETURN(v);
|
||||
}
|
||||
|
||||
void scx_init_window(void) {
|
||||
|
|
51
c/xlib/wm.c
51
c/xlib/wm.c
|
@ -4,40 +4,41 @@
|
|||
|
||||
s48_value scx_Reparent_Window(s48_value display, s48_value window,
|
||||
s48_value parent, s48_value x, s48_value y) {
|
||||
S48_DECLARE_GC_PROTECT_5(display, window, parent, x, y);
|
||||
XReparentWindow(scx_extract_display(display),
|
||||
scx_extract_window(window),
|
||||
scx_extract_window(parent),
|
||||
(int)s48_extract_integer(x), (int)s48_extract_integer(y));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Install_Colormap(s48_value display, s48_value colormap) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, colormap);
|
||||
XInstallColormap(scx_extract_display(display),
|
||||
scx_extract_colormap(colormap));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Uninstall_Colormap(s48_value display, s48_value colormap) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, colormap);
|
||||
XUninstallColormap(scx_extract_display(display),
|
||||
scx_extract_colormap(colormap));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_List_Installed_Colormaps(s48_value display, s48_value window) {
|
||||
int i, n;
|
||||
Colormap *ret;
|
||||
s48_value l = S48_NULL;
|
||||
S48_DECLARE_GC_PROTECT(1);
|
||||
S48_DECLARE_GC_PROTECT_3(display, window, l);
|
||||
|
||||
ret = XListInstalledColormaps(scx_extract_display(display),
|
||||
scx_extract_window(window),
|
||||
&n);
|
||||
S48_GC_PROTECT_1(l);
|
||||
for (i = n-1; i >= 0; i--)
|
||||
l = s48_cons(scx_enter_colormap(ret[i]), l);
|
||||
XFree((char*)ret);
|
||||
S48_GC_UNPROTECT();
|
||||
return l;
|
||||
S48_GC_RETURN(l);
|
||||
}
|
||||
|
||||
s48_value scx_revert_to_binding = S48_FALSE;
|
||||
|
@ -47,28 +48,29 @@ s48_value scx_revert_tos_binding = S48_FALSE;
|
|||
|
||||
s48_value scx_Set_Input_Focus(s48_value display, s48_value window,
|
||||
s48_value revert_to, s48_value time) {
|
||||
S48_DECLARE_GC_PROTECT_4(display, window, revert_to, time);
|
||||
XSetInputFocus(scx_extract_display(display), scx_extract_window(window),
|
||||
scx_extract_revert_to(revert_to),
|
||||
scx_extract_time(time));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Get_Input_Focus(s48_value display) {
|
||||
Window win;
|
||||
int revert_to;
|
||||
s48_value v = S48_FALSE;
|
||||
S48_DECLARE_GC_PROTECT(1);
|
||||
S48_GC_PROTECT_1(v);
|
||||
S48_DECLARE_GC_PROTECT_2(display, v);
|
||||
|
||||
XGetInputFocus(scx_extract_display(display), &win, &revert_to);
|
||||
v = scx_enter_revert_to(revert_to);
|
||||
v = s48_cons(scx_enter_window(win), v);
|
||||
S48_GC_UNPROTECT();
|
||||
return v;
|
||||
S48_GC_RETURN(v);
|
||||
}
|
||||
|
||||
s48_value scx_Warp_Pointer(s48_value dpy, s48_value src, s48_value dst,
|
||||
s48_value srcx, s48_value srcy, s48_value srcw,
|
||||
s48_value srch, s48_value dstx, s48_value dsty) {
|
||||
S48_DECLARE_GC_PROTECT_9(dpy, src, dst, srcx, srcy, srcw, srch, dstx, dsty);
|
||||
XWarpPointer(scx_extract_display(dpy),
|
||||
scx_extract_window(src), scx_extract_window(dst),
|
||||
(int)s48_extract_integer(srcx),
|
||||
|
@ -77,17 +79,19 @@ s48_value scx_Warp_Pointer(s48_value dpy, s48_value src, s48_value dst,
|
|||
(int)s48_extract_integer(srch),
|
||||
(int)s48_extract_integer(dstx),
|
||||
(int)s48_extract_integer(dsty));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Bell(s48_value display, s48_value percent) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, percent);
|
||||
XBell(scx_extract_display(display), s48_extract_integer(percent));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Set_Access_Control(s48_value display, s48_value on) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, on);
|
||||
XSetAccessControl(scx_extract_display(display), !S48_FALSE_P(on));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_save_set_binding = S48_FALSE;
|
||||
|
@ -95,9 +99,10 @@ s48_value scx_save_set_binding = S48_FALSE;
|
|||
|
||||
s48_value scx_Change_Save_Set(s48_value display, s48_value win,
|
||||
s48_value mode) {
|
||||
S48_DECLARE_GC_PROTECT_3(display, win, mode);
|
||||
XChangeSaveSet(scx_extract_display(display), scx_extract_window(win),
|
||||
scx_extract_save_set(mode));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_close_down_mode_binding = S48_FALSE;
|
||||
|
@ -105,38 +110,42 @@ s48_value scx_close_down_mode_binding = S48_FALSE;
|
|||
S48_EXTRACT_ENUM(x, scx_close_down_mode_binding)
|
||||
|
||||
s48_value scx_Set_Close_Down_Mode(s48_value display, s48_value mode) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, mode);
|
||||
XSetCloseDownMode(scx_extract_display(display),
|
||||
scx_extract_close_down_mode(mode));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Kill_Client(s48_value display, s48_value xid) {
|
||||
S48_DECLARE_GC_PROTECT_2(display, xid);
|
||||
XKillClient(scx_extract_display(display), (XID)s48_extract_integer(xid));
|
||||
return S48_UNSPECIFIC;
|
||||
S48_GC_RETURN(S48_UNSPECIFIC);
|
||||
}
|
||||
|
||||
s48_value scx_Get_Pointer_Mapping(s48_value display) {
|
||||
unsigned char map[256];
|
||||
int i, n;
|
||||
s48_value ret;
|
||||
s48_value ret = S48_FALSE;
|
||||
S48_DECLARE_GC_PROTECT_2(display, ret);
|
||||
|
||||
n = XGetPointerMapping (scx_extract_display(display), map, 256);
|
||||
ret = s48_make_vector(n, S48_NULL);
|
||||
for (i = 0; i < n; i++)
|
||||
S48_VECTOR_SET(ret, i, s48_enter_integer(map[i]));
|
||||
return ret;
|
||||
S48_GC_RETURN(ret);
|
||||
}
|
||||
|
||||
s48_value scx_Set_Pointer_Mapping(s48_value display, s48_value map) {
|
||||
int i, n = S48_VECTOR_LENGTH(map);
|
||||
unsigned char p[n];
|
||||
int ret;
|
||||
S48_DECLARE_GC_PROTECT_2(display, map);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
p[i] = (int)s48_extract_integer(S48_VECTOR_REF(map, i));
|
||||
|
||||
ret = XSetPointerMapping(scx_extract_display(display), p, n);
|
||||
return (ret == MappingSuccess) ? S48_TRUE : S48_FALSE;
|
||||
S48_GC_RETURN((ret == MappingSuccess) ? S48_TRUE : S48_FALSE);
|
||||
}
|
||||
|
||||
void scx_init_wm(void) {
|
||||
|
|
|
@ -41,9 +41,29 @@
|
|||
#define S48_DECLARE_GC_PROTECT_9(v0, v1, v2, v3, v4, v5, v6, v7, v8) \
|
||||
S48_DECLARE_GC_PROTECT(9); \
|
||||
S48_GC_PROTECT_9(v0, v1, v2, v3, v4, v5, v6, v7, v8)
|
||||
#define S48_DECLARE_GC_PROTECT_10(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) \
|
||||
S48_DECLARE_GC_PROTECT(10); \
|
||||
S48_GC_PROTECT_10(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9)
|
||||
#define S48_DECLARE_GC_PROTECT_11(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10)\
|
||||
S48_DECLARE_GC_PROTECT(11); \
|
||||
S48_GC_PROTECT_11(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10)
|
||||
|
||||
#define S48_GC_RETURN(v) do { S48_GC_UNPROTECT(); return(v); } while(0)
|
||||
|
||||
#define S48_GC_PROTECT_11(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) \
|
||||
(___gc_buffer[2]=(long)&(v1), \
|
||||
___gc_buffer[3]=(long)&(v2), \
|
||||
___gc_buffer[4]=(long)&(v3), \
|
||||
___gc_buffer[5]=(long)&(v4), \
|
||||
___gc_buffer[6]=(long)&(v5), \
|
||||
___gc_buffer[7]=(long)&(v6), \
|
||||
___gc_buffer[8]=(long)&(v7), \
|
||||
___gc_buffer[9]=(long)&(v8), \
|
||||
___gc_buffer[10]=(long)&(v9), \
|
||||
___gc_buffer[11]=(long)&(v10), \
|
||||
___gc_buffer[12]=(long)&(v11), \
|
||||
s48_push_gc_rootsB((char *) ___gc_buffer, 11))
|
||||
|
||||
#define S48_NULL_P(x) S48_EQ(x, S48_NULL)
|
||||
|
||||
#define S48_INTEGER_P(x) (S48_FIXNUM_P(x) || S48_BIGNUM_P(x))
|
||||
|
|
Loading…
Reference in New Issue