2001-05-08 10:21:00 -04:00
|
|
|
#include "xlib.h"
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Iconify_Window(s48_value display, s48_value w, s48_value scr) {
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(display, w, scr);
|
2003-03-10 21:47:38 -05:00
|
|
|
if (!XIconifyWindow(scx_extract_display(display),
|
|
|
|
scx_extract_window(w),
|
|
|
|
s48_extract_integer(scr)))
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_FALSE);
|
|
|
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Withdraw_Window(s48_value display, s48_value w, s48_value scr) {
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(display, w, scr);
|
2003-03-10 21:47:38 -05:00
|
|
|
if (!XWithdrawWindow(scx_extract_display(display),
|
|
|
|
scx_extract_window(w),
|
|
|
|
s48_extract_integer(scr)))
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_FALSE);
|
|
|
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Reconfigure_Wm_Window(s48_value dpy, s48_value w, s48_value scr,
|
|
|
|
s48_value conf) {
|
2001-08-22 07:57:51 -04:00
|
|
|
XWindowChanges WC;
|
2003-05-02 08:51:03 -04:00
|
|
|
unsigned long mask;
|
|
|
|
S48_DECLARE_GC_PROTECT_4(dpy, w, scr, conf);
|
|
|
|
mask = scx_extract_window_changes(conf, &WC);
|
2001-05-08 10:21:00 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
if (!XReconfigureWMWindow(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(w),
|
|
|
|
s48_extract_integer(scr),
|
|
|
|
mask, &WC))
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_FALSE);
|
|
|
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Get_Wm_Command(s48_value dpy, s48_value w) {
|
|
|
|
int i, ac;
|
|
|
|
char** av;
|
|
|
|
s48_value ret = S48_NULL;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(dpy, w, ret);
|
2001-05-08 10:21:00 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
if (!XGetCommand (scx_extract_display(dpy),
|
|
|
|
scx_extract_window(w),
|
|
|
|
&av, &ac))
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_FALSE);
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
for (i = ac-1; i >= 0; i--)
|
|
|
|
ret = s48_cons(s48_enter_string(av[i]), ret);
|
|
|
|
if (av != NULL) XFreeStringList(av);
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(ret);
|
2001-08-22 07:57:51 -04:00
|
|
|
}
|
2001-05-08 10:21:00 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Set_Wm_Command(s48_value dpy, s48_value w, s48_value cmd) {
|
|
|
|
int i, n = s48_list_length(cmd);
|
|
|
|
char *argv[n];
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(dpy, w, cmd);
|
2003-03-10 21:47:38 -05:00
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
argv[i] = s48_extract_string(S48_CAR(cmd));
|
|
|
|
cmd = S48_CDR(cmd);
|
2001-08-22 07:57:51 -04:00
|
|
|
}
|
2003-03-10 21:47:38 -05:00
|
|
|
XSetCommand(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(w),
|
|
|
|
argv, n);
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
2001-08-22 07:57:51 -04:00
|
|
|
}
|
2001-05-08 10:21:00 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Get_Wm_Protocols(s48_value display, s48_value w) {
|
2001-08-22 07:57:51 -04:00
|
|
|
Atom *p;
|
|
|
|
int i, n;
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value ret = S48_NULL;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(display, w, ret);
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
if (!XGetWMProtocols (scx_extract_display(display),
|
|
|
|
scx_extract_window(w), &p, &n))
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_FALSE);
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
for (i = n-1; i >= 0; i--)
|
|
|
|
ret = s48_cons(scx_enter_atom(p[i]), ret);
|
|
|
|
XFree((char *)p);
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(ret);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Set_Wm_Protocols (s48_value display, s48_value w, s48_value v) {
|
|
|
|
int i, n = s48_list_length(v);
|
2001-08-22 07:57:51 -04:00
|
|
|
Atom p[n];
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(display, w, v);
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
p[i] = scx_extract_atom(S48_CAR(v));
|
|
|
|
v = S48_CDR(v);
|
|
|
|
}
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
if (!XSetWMProtocols (scx_extract_display(display),
|
|
|
|
scx_extract_window(w),
|
2001-08-22 07:57:51 -04:00
|
|
|
p, n))
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_FALSE);
|
2003-03-10 21:47:38 -05:00
|
|
|
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Get_Wm_Class (s48_value display, s48_value w) {
|
2003-05-02 08:51:03 -04:00
|
|
|
s48_value ret = S48_FALSE, x = S48_FALSE;
|
2001-08-22 07:57:51 -04:00
|
|
|
XClassHint c;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_4(display, w, ret, x);
|
2001-08-22 07:57:51 -04:00
|
|
|
|
|
|
|
c.res_name = c.res_class = 0;
|
2003-03-10 21:47:38 -05:00
|
|
|
if (!XGetClassHint(scx_extract_display(display),
|
|
|
|
scx_extract_window(w), &c))
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_FALSE);
|
2003-03-10 21:47:38 -05:00
|
|
|
|
2003-05-02 08:51:03 -04:00
|
|
|
ret = s48_enter_string(c.res_class);
|
|
|
|
ret = s48_cons(s48_enter_string(c.res_name), ret);
|
2003-03-10 21:47:38 -05:00
|
|
|
XFree(c.res_name);
|
|
|
|
XFree(c.res_class);
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(ret);
|
2001-08-22 07:57:51 -04:00
|
|
|
}
|
2001-05-08 10:21:00 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Set_Wm_Class(s48_value dpy, s48_value w, s48_value name,
|
|
|
|
s48_value class) {
|
2001-08-22 07:57:51 -04:00
|
|
|
XClassHint c;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_4(dpy, w, name, class);
|
2001-08-22 07:57:51 -04:00
|
|
|
c.res_name = s48_extract_string(name);
|
|
|
|
c.res_class = s48_extract_string(class);
|
2003-03-10 21:47:38 -05:00
|
|
|
XSetClassHint(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(dpy),
|
|
|
|
&c);
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-04-25 14:52:58 -04:00
|
|
|
s48_value scx_initial_state_binding = S48_FALSE;
|
|
|
|
#define scx_extract_initial_state(x) \
|
|
|
|
S48_EXTRACT_ENUM(x, scx_initial_state_binding)
|
|
|
|
s48_value scx_initial_states_binding = S48_FALSE;
|
|
|
|
#define scx_enter_initial_state(x) \
|
|
|
|
S48_ENTER_ENUM(x, scx_initial_states_binding)
|
|
|
|
|
|
|
|
s48_value scx_wm_hint_binding = S48_FALSE;
|
|
|
|
#define scx_extract_wm_hint(x) S48_EXTRACT_ENUM(x, scx_wm_hint_binding)
|
|
|
|
s48_value scx_wm_hints_binding = S48_FALSE;
|
|
|
|
#define scx_enter_wm_hint(x) S48_ENTER_ENUM(x, scx_wm_hints_binding)
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_enter_wm_hint_alist(XWMHints* p) {
|
|
|
|
s48_value res = S48_NULL, t = S48_FALSE;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_2(res, t);
|
2003-03-10 21:47:38 -05:00
|
|
|
if (p->flags & InputHint) {
|
|
|
|
t = scx_enter_wm_hint(0); t = s48_cons(t, S48_ENTER_BOOLEAN(p->input));
|
|
|
|
res = s48_cons(t, res);
|
|
|
|
}
|
|
|
|
if (p->flags & StateHint) {
|
|
|
|
t = scx_enter_wm_hint(1);
|
|
|
|
t = s48_cons(t, scx_enter_initial_state(p->initial_state));
|
|
|
|
res = s48_cons(t, res);
|
|
|
|
}
|
|
|
|
if (p->flags & IconPixmapHint) {
|
|
|
|
t = scx_enter_wm_hint(2);
|
|
|
|
t = s48_cons(t, scx_enter_pixmap(p->icon_pixmap));
|
|
|
|
res = s48_cons(t, res);
|
|
|
|
}
|
|
|
|
if (p->flags & IconWindowHint) {
|
|
|
|
t = scx_enter_wm_hint(3);
|
|
|
|
t = s48_cons(t, scx_enter_window(p->icon_window));
|
|
|
|
res = s48_cons(t, res);
|
2002-04-26 04:22:46 -04:00
|
|
|
}
|
2003-03-10 21:47:38 -05:00
|
|
|
if (p->flags & IconPositionHint) {
|
|
|
|
t = s48_enter_integer(p->icon_y);
|
|
|
|
t = s48_cons(s48_enter_integer(p->icon_x), t);
|
|
|
|
t = s48_cons(scx_enter_wm_hint(4), t);
|
|
|
|
res = s48_cons(t, res);
|
|
|
|
}
|
|
|
|
if (p->flags & IconMaskHint) {
|
|
|
|
t = scx_enter_wm_hint(5);
|
|
|
|
t = s48_cons(t, scx_enter_pixmap(p->icon_mask));
|
|
|
|
res = s48_cons(t, res);
|
|
|
|
}
|
|
|
|
if (p->flags & WindowGroupHint) {
|
|
|
|
t = scx_enter_wm_hint(6);
|
|
|
|
t = s48_cons(t, scx_enter_window(p->window_group));
|
|
|
|
res = s48_cons(t, res);
|
|
|
|
}
|
|
|
|
t = scx_enter_wm_hint(8);
|
|
|
|
t = s48_cons(t, S48_ENTER_BOOLEAN(p->flags & XUrgencyHint));
|
|
|
|
res = s48_cons(t, res);
|
2001-10-09 11:27:30 -04:00
|
|
|
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(res);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
void scx_extract_wm_hint_alist(s48_value alist, XWMHints* p) {
|
2003-05-02 08:51:03 -04:00
|
|
|
s48_value v = S48_FALSE;
|
|
|
|
S48_DECLARE_GC_PROTECT_2(alist, v);
|
2003-03-10 21:47:38 -05:00
|
|
|
p->flags = 0;
|
|
|
|
while (alist != S48_NULL) {
|
|
|
|
int h = scx_extract_wm_hint(S48_CAR(S48_CAR(alist)));
|
2003-05-02 08:51:03 -04:00
|
|
|
v = S48_CDR(S48_CAR(alist));
|
2003-03-13 08:47:17 -05:00
|
|
|
p->flags |= (1L << h);
|
|
|
|
switch (1L << h) {
|
|
|
|
case InputHint:
|
2003-03-10 21:47:38 -05:00
|
|
|
p->input = S48_EXTRACT_BOOLEAN(v);
|
|
|
|
break;
|
2003-03-13 08:47:17 -05:00
|
|
|
case StateHint:
|
2003-03-10 21:47:38 -05:00
|
|
|
p->initial_state = scx_extract_initial_state(v);
|
|
|
|
break;
|
2003-03-13 08:47:17 -05:00
|
|
|
case IconPixmapHint:
|
2003-03-10 21:47:38 -05:00
|
|
|
p->icon_pixmap = scx_extract_pixmap(v);
|
|
|
|
break;
|
2003-03-13 08:47:17 -05:00
|
|
|
case IconWindowHint:
|
2003-03-10 21:47:38 -05:00
|
|
|
p->icon_window = scx_extract_window(v);
|
|
|
|
break;
|
2003-03-13 08:47:17 -05:00
|
|
|
case IconPositionHint:
|
2003-03-10 21:47:38 -05:00
|
|
|
p->icon_x = s48_extract_integer(S48_CAR(v));
|
|
|
|
p->icon_y = s48_extract_integer(S48_CDR(v));
|
|
|
|
break;
|
2003-03-13 08:47:17 -05:00
|
|
|
case IconMaskHint:
|
2003-03-10 21:47:38 -05:00
|
|
|
p->icon_mask = scx_extract_pixmap(v);
|
|
|
|
break;
|
2003-03-13 08:47:17 -05:00
|
|
|
case WindowGroupHint:
|
2003-03-10 21:47:38 -05:00
|
|
|
p->window_group = scx_extract_window(v);
|
|
|
|
break;
|
2003-03-13 08:47:17 -05:00
|
|
|
case XUrgencyHint:
|
|
|
|
if (v == S48_FALSE)
|
|
|
|
p->flags &= ~XUrgencyHint;
|
2003-03-10 21:47:38 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
alist = S48_CDR(alist);
|
2001-08-22 07:57:51 -04:00
|
|
|
}
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_UNPROTECT();
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Get_Wm_Hints(s48_value dpy, s48_value w) {
|
|
|
|
XWMHints* p;
|
|
|
|
s48_value res = S48_NULL;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(dpy, w, res);
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
p = XGetWMHints(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(w));
|
2003-05-02 08:51:03 -04:00
|
|
|
if (p == NULL)
|
|
|
|
S48_GC_RETURN(S48_FALSE);
|
|
|
|
res = scx_enter_wm_hint_alist(p);
|
|
|
|
XFree(p);
|
|
|
|
S48_GC_RETURN(res);
|
2003-03-10 21:47:38 -05:00
|
|
|
}
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Set_Wm_Hints (s48_value dpy, s48_value w, s48_value hints) {
|
|
|
|
XWMHints WMH;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(dpy, w, hints);
|
2003-05-04 11:19:39 -04:00
|
|
|
scx_extract_wm_hint_alist(hints, &WMH);
|
2003-05-02 08:51:03 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
XSetWMHints(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(w),
|
|
|
|
&WMH);
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Get_Transient_For(s48_value dpy, s48_value w) {
|
2001-08-22 07:57:51 -04:00
|
|
|
Window win;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_2(dpy, w);
|
2003-03-10 21:47:38 -05:00
|
|
|
if (!XGetTransientForHint(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(w),
|
2001-08-22 07:57:51 -04:00
|
|
|
&win))
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_FALSE);
|
|
|
|
S48_GC_RETURN(scx_enter_window(win));
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 07:57:51 -04:00
|
|
|
s48_value scx_Set_Transient_For(s48_value dpy, s48_value w, s48_value pw) {
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(dpy, w, pw);
|
2003-03-10 21:47:38 -05:00
|
|
|
XSetTransientForHint(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(w),
|
|
|
|
scx_extract_window(pw));
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Get_Text_Property(s48_value dpy, s48_value w, s48_value a) {
|
|
|
|
XTextProperty ret;
|
|
|
|
s48_value res = S48_FALSE;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_4(dpy, w, a, res);
|
2003-03-10 21:47:38 -05:00
|
|
|
if (!XGetTextProperty (scx_extract_display(dpy),
|
|
|
|
scx_extract_window(w),
|
|
|
|
&ret,
|
|
|
|
scx_extract_atom(a)))
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_FALSE);
|
2003-03-10 21:47:38 -05:00
|
|
|
res = scx_enter_property(ret.encoding, ret.format, ret.value, ret.nitems);
|
|
|
|
XFree(ret.value);
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(res);
|
2003-03-10 21:47:38 -05:00
|
|
|
}
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Set_Text_Property(s48_value dpy, s48_value w, s48_value prop,
|
|
|
|
s48_value a) {
|
|
|
|
XTextProperty p;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_4(dpy, w, prop, a);
|
2003-03-10 21:47:38 -05:00
|
|
|
scx_extract_property(prop, &p.encoding, &p.format,
|
|
|
|
(char**)&p.value,
|
|
|
|
(int*)&p.nitems);
|
|
|
|
XSetTextProperty(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(w),
|
|
|
|
&p, scx_extract_atom(a));
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
2003-03-10 21:47:38 -05:00
|
|
|
}
|
- changed variable arguments and return values in set-wm-hints!,
get-wm-hints, set-wm-normal-hints!, get-wm-normal-hints,
create-gcontext, change-gcontext, get-visual-info,
change-window-attributes, get-window-attributes, configure-window,
create-window to use an enumerated type instead of symbols.
- renamed functions in xlib-client (e.g. wm-hints to get-wm-hints).
2002-01-06 11:53:13 -05:00
|
|
|
|
2003-04-25 14:52:58 -04:00
|
|
|
s48_value scx_size_hint_binding = S48_FALSE;
|
|
|
|
#define scx_extract_size_hint(h) S48_EXTRACT_ENUM(h, scx_size_hint_binding)
|
|
|
|
s48_value scx_size_hints_binding = S48_FALSE;
|
|
|
|
#define scx_enter_size_hint(h) S48_ENTER_ENUM(h, scx_size_hints_binding)
|
2003-03-10 21:47:38 -05:00
|
|
|
|
|
|
|
s48_value scx_enter_size_hint_alist(XSizeHints* sh) {
|
|
|
|
int i;
|
|
|
|
s48_value res = S48_NULL, v = S48_FALSE, t = S48_FALSE;
|
|
|
|
S48_DECLARE_GC_PROTECT(3);
|
|
|
|
S48_GC_PROTECT_3(res, v, t);
|
|
|
|
for (i = 0; i < 10; i++) {
|
|
|
|
if (sh->flags & (1L << i)) {
|
|
|
|
switch (1L << i) {
|
|
|
|
case USPosition: case PPosition:
|
|
|
|
v = s48_enter_integer(sh->x);
|
|
|
|
v = s48_cons(v, s48_enter_integer(sh->y));
|
|
|
|
break;
|
|
|
|
case USSize: case PSize:
|
|
|
|
v = s48_enter_integer(sh->width);
|
|
|
|
v = s48_cons(v, s48_enter_integer(sh->height));
|
|
|
|
break;
|
|
|
|
case PMinSize:
|
|
|
|
v = s48_enter_integer(sh->min_width);
|
|
|
|
v = s48_cons(v, s48_enter_integer(sh->min_height));
|
|
|
|
break;
|
|
|
|
case PMaxSize:
|
|
|
|
v = s48_enter_integer(sh->max_width);
|
2003-04-22 17:55:26 -04:00
|
|
|
v = s48_cons(v, s48_enter_integer(sh->max_height));
|
2003-03-10 21:47:38 -05:00
|
|
|
break;
|
|
|
|
case PResizeInc:
|
|
|
|
v = s48_enter_integer(sh->width_inc);
|
|
|
|
v = s48_cons(v, s48_enter_integer(sh->height_inc));
|
|
|
|
break;
|
|
|
|
case PAspect:
|
|
|
|
v = s48_enter_integer(sh->min_aspect.x);
|
|
|
|
v = s48_cons(v, s48_enter_integer(sh->min_aspect.y));
|
|
|
|
t = s48_enter_integer(sh->max_aspect.x);
|
|
|
|
t = s48_cons(t, s48_enter_integer(sh->max_aspect.y));
|
|
|
|
v = s48_cons(v, t);
|
|
|
|
break;
|
|
|
|
case PBaseSize:
|
|
|
|
v = s48_enter_integer(sh->base_width);
|
|
|
|
v = s48_cons(v, s48_enter_integer(sh->base_height));
|
|
|
|
break;
|
|
|
|
case PWinGravity:
|
|
|
|
v = scx_enter_win_gravity(sh->win_gravity);
|
|
|
|
break;
|
|
|
|
default: v = S48_FALSE;
|
|
|
|
}
|
|
|
|
t = scx_enter_size_hint(i);
|
|
|
|
t = s48_cons(t, v);
|
|
|
|
res = s48_cons(t, res);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
S48_GC_UNPROTECT();
|
|
|
|
return res;
|
|
|
|
}
|
2002-02-08 12:09:43 -05:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
void scx_extract_size_hint_alist(s48_value l, XSizeHints* sh) {
|
2003-05-02 08:51:03 -04:00
|
|
|
s48_value v = S48_FALSE;
|
|
|
|
S48_DECLARE_GC_PROTECT_2(l, v);
|
2003-03-10 21:47:38 -05:00
|
|
|
sh->flags = 0;
|
|
|
|
for (; l != S48_NULL; l = S48_CDR(l)) {
|
|
|
|
int m = scx_extract_size_hint(S48_CAR(S48_CAR(l)));
|
2003-05-02 08:51:03 -04:00
|
|
|
v = S48_CDR(S48_CAR(l));
|
2003-03-10 21:47:38 -05:00
|
|
|
sh->flags |= (1L << m);
|
|
|
|
switch (1L << m) {
|
|
|
|
case USPosition: case PPosition:
|
|
|
|
sh->x = s48_extract_integer(S48_CAR(v));
|
|
|
|
sh->y = s48_extract_integer(S48_CDR(v));
|
|
|
|
break;
|
|
|
|
case USSize: case PSize:
|
|
|
|
sh->width = s48_extract_integer(S48_CAR(v));
|
|
|
|
sh->height = s48_extract_integer(S48_CDR(v));
|
|
|
|
break;
|
|
|
|
case PMinSize:
|
|
|
|
sh->min_width = s48_extract_integer(S48_CAR(v));
|
|
|
|
sh->min_height = s48_extract_integer(S48_CDR(v));
|
|
|
|
break;
|
|
|
|
case PMaxSize:
|
|
|
|
sh->max_width = s48_extract_integer(S48_CAR(v));
|
|
|
|
sh->max_height = s48_extract_integer(S48_CDR(v));
|
|
|
|
break;
|
|
|
|
case PResizeInc:
|
|
|
|
sh->width_inc = s48_extract_integer(S48_CAR(v));
|
|
|
|
sh->height_inc = s48_extract_integer(S48_CDR(v));
|
|
|
|
break;
|
|
|
|
case PAspect:
|
|
|
|
sh->min_aspect.x = s48_extract_integer(S48_CAR(S48_CAR(v)));
|
|
|
|
sh->min_aspect.y = s48_extract_integer(S48_CDR(S48_CAR(v)));
|
|
|
|
sh->max_aspect.x = s48_extract_integer(S48_CAR(S48_CDR(v)));
|
|
|
|
sh->max_aspect.y = s48_extract_integer(S48_CDR(S48_CDR(v)));
|
|
|
|
break;
|
|
|
|
case PBaseSize:
|
|
|
|
sh->base_width = s48_extract_integer(S48_CAR(v));
|
|
|
|
sh->base_height = s48_extract_integer(S48_CDR(v));
|
|
|
|
break;
|
|
|
|
case PWinGravity:
|
|
|
|
sh->win_gravity = scx_extract_win_gravity(v);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_UNPROTECT();
|
2003-03-10 21:47:38 -05:00
|
|
|
}
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Get_Wm_Normal_Hints(s48_value dpy, s48_value win) {
|
|
|
|
XSizeHints SH;
|
|
|
|
long supplied_by_user;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_2(dpy, win);
|
2003-03-10 21:47:38 -05:00
|
|
|
if (!XGetWMNormalHints(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(win),
|
|
|
|
&SH, &supplied_by_user))
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_FALSE);
|
2003-04-17 10:53:27 -04:00
|
|
|
/* ignoring supplied_by_user ... ?! */
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(scx_enter_size_hint_alist(&SH));
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 07:57:51 -04:00
|
|
|
s48_value scx_Set_Wm_Normal_Hints(s48_value dpy, s48_value win,
|
- changed variable arguments and return values in set-wm-hints!,
get-wm-hints, set-wm-normal-hints!, get-wm-normal-hints,
create-gcontext, change-gcontext, get-visual-info,
change-window-attributes, get-window-attributes, configure-window,
create-window to use an enumerated type instead of symbols.
- renamed functions in xlib-client (e.g. wm-hints to get-wm-hints).
2002-01-06 11:53:13 -05:00
|
|
|
s48_value hints) {
|
2001-08-22 07:57:51 -04:00
|
|
|
XSizeHints SH;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(dpy, win, hints);
|
2003-03-10 21:47:38 -05:00
|
|
|
scx_extract_size_hint_alist(hints, &SH);
|
- changed variable arguments and return values in set-wm-hints!,
get-wm-hints, set-wm-normal-hints!, get-wm-normal-hints,
create-gcontext, change-gcontext, get-visual-info,
change-window-attributes, get-window-attributes, configure-window,
create-window to use an enumerated type instead of symbols.
- renamed functions in xlib-client (e.g. wm-hints to get-wm-hints).
2002-01-06 11:53:13 -05:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
XSetWMNormalHints(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(win),
|
|
|
|
&SH);
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
2003-03-10 21:47:38 -05:00
|
|
|
}
|
|
|
|
|
2003-04-25 14:52:58 -04:00
|
|
|
s48_value scx_icon_size_binding = S48_FALSE;
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_enter_icon_size(XIconSize* is) {
|
2003-04-25 14:52:58 -04:00
|
|
|
s48_value res = s48_make_record(scx_icon_size_binding);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
|
|
S48_GC_PROTECT_1(res);
|
|
|
|
S48_RECORD_SET(res, 0, s48_enter_integer(is->min_width));
|
|
|
|
S48_RECORD_SET(res, 1, s48_enter_integer(is->min_height));
|
|
|
|
S48_RECORD_SET(res, 2, s48_enter_integer(is->max_width));
|
|
|
|
S48_RECORD_SET(res, 3, s48_enter_integer(is->max_height));
|
|
|
|
S48_RECORD_SET(res, 4, s48_enter_integer(is->width_inc));
|
|
|
|
S48_RECORD_SET(res, 5, s48_enter_integer(is->height_inc));
|
|
|
|
S48_GC_UNPROTECT();
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
void scx_extract_icon_size(s48_value r, XIconSize* is) {
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_1(r);
|
2003-04-25 14:52:58 -04:00
|
|
|
s48_check_record_type(r, scx_icon_size_binding);
|
2003-03-10 21:47:38 -05:00
|
|
|
is->min_width = s48_extract_integer(S48_RECORD_REF(r, 0));
|
|
|
|
is->min_height = s48_extract_integer(S48_RECORD_REF(r, 1));
|
|
|
|
is->max_width = s48_extract_integer(S48_RECORD_REF(r, 2));
|
|
|
|
is->max_height = s48_extract_integer(S48_RECORD_REF(r, 3));
|
|
|
|
is->width_inc = s48_extract_integer(S48_RECORD_REF(r, 4));
|
|
|
|
is->height_inc = s48_extract_integer(S48_RECORD_REF(r, 5));
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_UNPROTECT();
|
2003-03-10 21:47:38 -05:00
|
|
|
}
|
2002-02-08 12:09:43 -05:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Get_Icon_Sizes(s48_value dpy, s48_value w) {
|
|
|
|
XIconSize *p;
|
|
|
|
int i, n;
|
|
|
|
s48_value v = S48_NULL;
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(dpy, w, v);
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
if (!XGetIconSizes (scx_extract_display(dpy),
|
|
|
|
scx_extract_window(w),
|
|
|
|
&p, &n))
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_FALSE);
|
2003-03-10 21:47:38 -05:00
|
|
|
|
|
|
|
for (i = n-1; i >= 0; i--)
|
|
|
|
v = s48_cons(scx_enter_icon_size(&p[i]), v);
|
|
|
|
XFree((char *)p);
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(v);
|
2003-03-10 21:47:38 -05:00
|
|
|
}
|
2001-08-22 07:57:51 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Set_Icon_Sizes(s48_value dpy, s48_value w, s48_value v) {
|
|
|
|
int i, n = s48_list_length(v);
|
|
|
|
XIconSize p[n];
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_DECLARE_GC_PROTECT_3(dpy, w, v);
|
2003-03-10 21:47:38 -05:00
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
scx_extract_icon_size(S48_CAR(v), &p[i]);
|
|
|
|
v = S48_CDR(v);
|
|
|
|
}
|
|
|
|
XSetIconSizes(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(w),
|
|
|
|
p, n);
|
2003-05-02 08:51:03 -04:00
|
|
|
S48_GC_RETURN(S48_UNSPECIFIC);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 07:57:51 -04:00
|
|
|
scx_init_client() {
|
2003-04-25 14:52:58 -04:00
|
|
|
SCX_PRO_IMP(scx_icon_size_binding, "scx-icon-size");
|
|
|
|
SCX_PRO_IMP(scx_initial_state_binding, "scx-initial-state");
|
|
|
|
SCX_PRO_IMP(scx_initial_states_binding, "scx-initial-states");
|
|
|
|
SCX_PRO_IMP(scx_wm_hint_binding, "scx-wm-hint");
|
|
|
|
SCX_PRO_IMP(scx_wm_hints_binding, "scx-wm-hints");
|
|
|
|
SCX_PRO_IMP(scx_size_hint_binding, "scx-size-hint");
|
|
|
|
SCX_PRO_IMP(scx_size_hints_binding, "scx-size-hints");
|
|
|
|
|
2001-08-22 07:57:51 -04:00
|
|
|
S48_EXPORT_FUNCTION(scx_Iconify_Window);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Withdraw_Window);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Reconfigure_Wm_Window);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_EXPORT_FUNCTION(scx_Get_Wm_Command);
|
2001-08-22 07:57:51 -04:00
|
|
|
S48_EXPORT_FUNCTION(scx_Get_Text_Property);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Text_Property);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_EXPORT_FUNCTION(scx_Get_Wm_Protocols);
|
2001-08-22 07:57:51 -04:00
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Wm_Protocols);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_EXPORT_FUNCTION(scx_Get_Wm_Class);
|
2001-08-22 07:57:51 -04:00
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Wm_Class);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Wm_Command);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_EXPORT_FUNCTION(scx_Get_Wm_Hints);
|
2001-08-22 07:57:51 -04:00
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Wm_Hints);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_EXPORT_FUNCTION(scx_Get_Transient_For);
|
2001-08-22 07:57:51 -04:00
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Transient_For);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_EXPORT_FUNCTION(scx_Get_Wm_Normal_Hints);
|
2001-08-22 07:57:51 -04:00
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Wm_Normal_Hints);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_EXPORT_FUNCTION(scx_Get_Icon_Sizes);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Icon_Sizes);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|