diff --git a/c/xlib/client.c b/c/xlib/client.c index 608868c..fdc30b0 100644 --- a/c/xlib/client.c +++ b/c/xlib/client.c @@ -227,25 +227,26 @@ s48_value scx_Wm_Hints (s48_value dpy, s48_value w) { p = XGetWMHints (SCX_EXTRACT_DISPLAY(dpy), SCX_EXTRACT_WINDOW(w)); //Enable_Interrupts; - res = s48_make_vector(9, S48_UNSPECIFIC); + if (p) { + res = s48_make_vector(9, S48_UNSPECIFIC); S48_GC_PROTECT_1(res); - - if (p->flags && InputHint) + + if (p->flags & InputHint) S48_VECTOR_SET(res, 0, S48_ENTER_BOOLEAN(p->input)); - if (p->flags && StateHint) + if (p->flags & StateHint) S48_VECTOR_SET(res, 1, - s48_enter_integer((unsigned long)p->initial_state)); - if (p->flags && IconPixmapHint) + s48_enter_integer(p->initial_state)); + if (p->flags & IconPixmapHint) S48_VECTOR_SET(res, 2, SCX_ENTER_PIXMAP(p->icon_pixmap)); - if (p->flags && IconWindowHint) + if (p->flags & IconWindowHint) S48_VECTOR_SET(res, 3, SCX_ENTER_WINDOW(p->icon_window)); - if (p->flags && IconPositionHint) + if (p->flags & IconPositionHint) S48_VECTOR_SET(res, 4, s48_cons(s48_enter_fixnum(p->icon_x), s48_enter_fixnum(p->icon_y))); - if (p->flags && IconMaskHint) + if (p->flags & IconMaskHint) S48_VECTOR_SET(res, 5, SCX_ENTER_PIXMAP(p->icon_mask)); - if (p->flags && WindowGroupHint) + if (p->flags & WindowGroupHint) // Elk says a window-group is a window...?? S48_VECTOR_SET(res, 6, SCX_ENTER_WINDOW(p->window_group)); S48_VECTOR_SET(res, 7, S48_ENTER_BOOLEAN(p->flags & XUrgencyHint)); @@ -253,9 +254,11 @@ s48_value scx_Wm_Hints (s48_value dpy, s48_value w) { res = s48_cons(s48_enter_integer(p->flags), res); S48_GC_UNPROTECT(); - } - XFree((char*)p); + XFree((char*)p); + } else { + res = S48_FALSE; + } return res; }