2001-05-08 10:21:00 -04:00
|
|
|
#include "xlib.h"
|
2001-07-31 09:15:32 -04:00
|
|
|
#include "scheme48.h"
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Reparent_Window(s48_value Xdisplay, s48_value Xwindow,
|
2001-07-31 09:15:32 -04:00
|
|
|
s48_value Xwindow_parent, s48_value x,
|
|
|
|
s48_value y) {
|
2001-07-31 10:51:21 -04:00
|
|
|
XReparentWindow(SCX_EXTRACT_DISPLAY(Xdisplay),
|
|
|
|
SCX_EXTRACT_WINDOW(Xwindow),
|
|
|
|
SCX_EXTRACT_WINDOW(Xwindow_parent),
|
2001-07-31 09:15:32 -04:00
|
|
|
(int)s48_extract_integer (x), (int)s48_extract_integer (y));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Install_Colormap(s48_value Xdisplay, s48_value Xcolormap) {
|
|
|
|
XInstallColormap(SCX_EXTRACT_DISPLAY(Xdisplay),
|
|
|
|
SCX_EXTRACT_COLORMAP(Xcolormap));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Uninstall_Colormap(s48_value Xdisplay, s48_value Xcolormap) {
|
|
|
|
XUninstallColormap(SCX_EXTRACT_DISPLAY(Xdisplay),
|
|
|
|
SCX_EXTRACT_COLORMAP(Xcolormap));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_List_Installed_Colormaps(s48_value Xdisplay, s48_value Xwindow) {
|
2001-07-31 09:15:32 -04:00
|
|
|
int i, n;
|
|
|
|
Colormap *ret;
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value v = S48_FALSE;
|
2001-07-31 09:15:32 -04:00
|
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
ret = XListInstalledColormaps(SCX_EXTRACT_DISPLAY(Xdisplay),
|
|
|
|
SCX_EXTRACT_WINDOW(Xwindow),
|
2001-07-31 09:15:32 -04:00
|
|
|
&n);
|
|
|
|
v = s48_make_vector (n, S48_FALSE);
|
|
|
|
S48_GC_PROTECT_1 (v);
|
|
|
|
for (i = 0; i < n; i++) {
|
2001-07-31 10:51:21 -04:00
|
|
|
S48_VECTOR_SET(v, i, SCX_ENTER_COLORMAP(ret[i]));
|
2001-07-31 09:15:32 -04:00
|
|
|
}
|
|
|
|
XFree ((char *)ret);
|
|
|
|
S48_GC_UNPROTECT();
|
|
|
|
return v;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Set_Input_Focus(s48_value Xdisplay, s48_value Xwindow,
|
2001-07-31 09:15:32 -04:00
|
|
|
s48_value revert_to, s48_value time) {
|
|
|
|
Window focus = PointerRoot;
|
|
|
|
|
|
|
|
if (!S48_SYMBOL_P(Xwindow))
|
2001-07-31 10:51:21 -04:00
|
|
|
focus = SCX_EXTRACT_WINDOW(Xwindow);
|
2001-07-31 09:15:32 -04:00
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
XSetInputFocus (SCX_EXTRACT_DISPLAY(Xdisplay), focus,
|
2001-07-31 09:15:32 -04:00
|
|
|
Symbol_To_Bit (revert_to, Revert_Syms),
|
2001-07-31 10:51:21 -04:00
|
|
|
SCX_EXTRACT_TIME(time));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Input_Focus (s48_value Xdisplay) {
|
2001-07-31 09:15:32 -04:00
|
|
|
Window win;
|
|
|
|
int revert_to;
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value ret = S48_FALSE;
|
2001-07-31 09:15:32 -04:00
|
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
XGetInputFocus (SCX_EXTRACT_DISPLAY(Xdisplay), &win, &revert_to);
|
2001-07-31 09:15:32 -04:00
|
|
|
ret = s48_cons (S48_NULL, S48_NULL);
|
|
|
|
S48_GC_PROTECT_1 (ret);
|
2001-07-31 10:51:21 -04:00
|
|
|
S48_SET_CAR(ret, SCX_ENTER_WINDOW(win));
|
|
|
|
S48_SET_CDR(ret, Bit_To_Symbol((unsigned long)revert_to, Revert_Syms));
|
2001-07-31 09:15:32 -04:00
|
|
|
|
|
|
|
S48_GC_UNPROTECT();
|
|
|
|
return ret;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_General_Warp_Pointer(s48_value dpy, s48_value dst, s48_value dstx,
|
2001-07-31 09:15:32 -04:00
|
|
|
s48_value dsty, s48_value src, s48_value srcx,
|
|
|
|
s48_value srcy, s48_value srcw, s48_value srch) {
|
2001-07-31 10:51:21 -04:00
|
|
|
XWarpPointer (SCX_EXTRACT_DISPLAY(dpy),
|
|
|
|
SCX_EXTRACT_WINDOW(src), SCX_EXTRACT_WINDOW(dst),
|
2001-07-31 09:15:32 -04:00
|
|
|
(int)s48_extract_integer (srcx),
|
|
|
|
(int)s48_extract_integer (srcy),
|
|
|
|
(int)s48_extract_integer (srcw),
|
|
|
|
(int)s48_extract_integer (srch),
|
|
|
|
(int)s48_extract_integer (dstx),
|
|
|
|
(int)s48_extract_integer (dsty));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Bell(s48_value Xdisplay, s48_value percent) {
|
2001-07-31 09:15:32 -04:00
|
|
|
int p = (int)s48_extract_integer(percent);
|
2001-07-31 10:51:21 -04:00
|
|
|
XBell (SCX_EXTRACT_DISPLAY(Xdisplay), p);
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Set_Access_Control(s48_value Xdisplay, s48_value on) {
|
|
|
|
XSetAccessControl (SCX_EXTRACT_DISPLAY(Xdisplay), !S48_FALSE_P(on));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Change_Save_Set(s48_value Xdisplay, s48_value win,
|
|
|
|
s48_value mode) {
|
|
|
|
XChangeSaveSet(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(win),
|
2001-07-31 09:15:32 -04:00
|
|
|
Symbol_To_Bit(mode, Saveset_Syms));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Set_Close_Down_Mode(s48_value Xdisplay, s48_value mode) {
|
|
|
|
XSetCloseDownMode(SCX_EXTRACT_DISPLAY(Xdisplay),
|
2001-07-31 09:15:32 -04:00
|
|
|
Symbol_To_Bit (mode, Closemode_Syms));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Get_Pointer_Mapping(s48_value Xdisplay) {
|
2001-07-31 09:15:32 -04:00
|
|
|
unsigned char map[256];
|
|
|
|
int i, n;
|
|
|
|
s48_value ret;
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
n = XGetPointerMapping (SCX_EXTRACT_DISPLAY(Xdisplay), map, 256);
|
2001-07-31 09:15:32 -04:00
|
|
|
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;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Set_Pointer_Mapping (s48_value Xdisplay, s48_value map) {
|
2001-07-31 09:15:32 -04:00
|
|
|
int i, n = S48_VECTOR_LENGTH(map);
|
|
|
|
unsigned char p[n];
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
p[i] = (int)s48_extract_integer(S48_VECTOR_REF(map, i));
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
ret = XSetPointerMapping (SCX_EXTRACT_DISPLAY(Xdisplay), p, n);
|
2001-07-31 09:15:32 -04:00
|
|
|
return (ret == MappingSuccess) ? S48_TRUE : S48_FALSE;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
void scx_init_wm(void) {
|
|
|
|
S48_EXPORT_FUNCTION(scx_Reparent_Window);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Install_Colormap);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Uninstall_Colormap);
|
|
|
|
S48_EXPORT_FUNCTION(scx_List_Installed_Colormaps);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Input_Focus);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Input_Focus);
|
|
|
|
S48_EXPORT_FUNCTION(scx_General_Warp_Pointer);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Bell);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Access_Control);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Change_Save_Set);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Close_Down_Mode);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Get_Pointer_Mapping);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Pointer_Mapping);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|