From def9eb131a25b00aa0cdd02f920943376f24f64a Mon Sep 17 00:00:00 2001 From: frese Date: Mon, 30 Jul 2001 14:22:22 +0000 Subject: [PATCH] fixed AList_To_XWindowAttributes, changed all function from returning lists to returning vectors. --- c/xlib/window.c | 60 +++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/c/xlib/window.c b/c/xlib/window.c index 595b258..7a79445 100644 --- a/c/xlib/window.c +++ b/c/xlib/window.c @@ -178,14 +178,15 @@ s48_value Configure_Window (s48_value Xwindow, s48_value Xdisplay, s48_value alist) { unsigned long mask = 0; XWindowChanges WC; - s48_value l; + s48_value l, p; char* cname; int cvalue; s48_value name, value; for (l = alist; !S48_NULL_P(l); l = S48_CDR(l)) { - name = S48_CAR(l); - value = S48_CDR(l); + p = S48_CAR(l); + name = S48_CAR(p); + value = S48_CDR(p); cname = s48_extract_string(S48_SYMBOL_TO_STRING(name)); cvalue = (int)s48_extract_integer(value); // only ints here @@ -277,19 +278,20 @@ s48_value Query_Tree (s48_value Xwindow, s48_value Xdisplay) { XQueryTree (EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow), &root, &parent, &children, &n); - S48_GC_PROTECT_2 (v, ret); + ret = s48_make_vector(3, S48_FALSE); + v = S48_FALSE; - ret = S48_NULL; + S48_GC_PROTECT_2 (v, ret); // vector of child-windows v = s48_make_vector (n, S48_FALSE); for (i = 0; i < n; i++) { S48_VECTOR_SET(v, i, ENTER_WINDOW(children[i])); } - ret = s48_cons(v, ret); - ret = s48_cons(ENTER_WINDOW(parent), ret); - ret = s48_cons(ENTER_WINDOW(root), ret); + S48_VECTOR_SET(ret, 0, ENTER_WINDOW(root)); + S48_VECTOR_SET(ret, 1, ENTER_WINDOW(parent)); + S48_VECTOR_SET(ret, 2, v); S48_GC_UNPROTECT(); return ret; @@ -300,7 +302,7 @@ s48_value Translate_Coordinates (s48_value Xdisplay, s48_value srcXwindow, s48_value dstXwindow) { int rx, ry; Window child; - s48_value l; + s48_value v = S48_FALSE; S48_DECLARE_GC_PROTECT(1); @@ -312,20 +314,20 @@ s48_value Translate_Coordinates (s48_value Xdisplay, s48_value srcXwindow, &rx, &ry, &child)) return S48_FALSE; - S48_GC_PROTECT_1 (l); + S48_GC_PROTECT_1 (v); + + v = s48_make_vector(3, S48_FALSE); + S48_VECTOR_SET(v, 0, s48_enter_integer(rx)); + S48_VECTOR_SET(v, 1, s48_enter_integer(ry)); + S48_VECTOR_SET(v, 2, ENTER_WINDOW(child)); - l = S48_NULL; - l = s48_cons( ENTER_WINDOW(child), l ); - l = s48_cons( s48_enter_integer(ry), l ); - l = s48_cons( s48_enter_integer(rx), l ); - S48_GC_UNPROTECT(); - return l; + return v; } s48_value Query_Pointer (s48_value Xdisplay, s48_value Xwindow) { - s48_value l; + s48_value v; Bool ret; Window root, child; int r_x, r_y, x, y; @@ -335,20 +337,20 @@ s48_value Query_Pointer (s48_value Xdisplay, s48_value Xwindow) { ret = XQueryPointer (EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow), &root, &child, &r_x, &r_y, &x, &y, &mask); - S48_GC_PROTECT_1(l); + v = s48_make_vector(8, S48_FALSE); + S48_GC_PROTECT_1(v); + + S48_VECTOR_SET(v, 0, s48_enter_integer(x)); + S48_VECTOR_SET(v, 1, s48_enter_integer(y)); + S48_VECTOR_SET(v, 2, ret ? S48_TRUE : S48_FALSE); + S48_VECTOR_SET(v, 3, ENTER_WINDOW(root)); + S48_VECTOR_SET(v, 4, s48_enter_integer(r_x)); + S48_VECTOR_SET(v, 5, s48_enter_integer(r_y)); + S48_VECTOR_SET(v, 6, ENTER_WINDOW(child)); + S48_VECTOR_SET(v, 7, Bits_To_Symbols ((unsigned long)mask, State_Syms)); - l = S48_NULL; - l = s48_cons(Bits_To_Symbols ((unsigned long)mask, State_Syms), l); - l = s48_cons(ENTER_WINDOW(child), l); - l = s48_cons(s48_enter_integer(r_y), l); - l = s48_cons(s48_enter_integer(r_x), l); - l = s48_cons(ENTER_WINDOW(root), l); - l = ret ? S48_TRUE : S48_FALSE; - l = s48_cons(s48_enter_integer(y), l); - l = s48_cons(s48_enter_integer(x), l); - S48_GC_UNPROTECT(); - return l; + return v; } s48_value Get_Geometry(s48_value Xdisplay, s48_value Xdrawable) {