2003-03-10 21:47:38 -05:00
|
|
|
/* Copyright 2001-2003 by Norbert Freudemann, David Frese */
|
|
|
|
|
2001-05-08 10:21:00 -04:00
|
|
|
#include "xlib.h"
|
2003-03-10 21:47:38 -05:00
|
|
|
|
|
|
|
s48_value scx_Reparent_Window(s48_value display, s48_value window,
|
|
|
|
s48_value parent, s48_value x, s48_value y) {
|
|
|
|
XReparentWindow(scx_extract_display(display),
|
|
|
|
scx_extract_window(window),
|
|
|
|
scx_extract_window(parent),
|
|
|
|
(int)s48_extract_integer(x), (int)s48_extract_integer(y));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Install_Colormap(s48_value display, s48_value colormap) {
|
|
|
|
XInstallColormap(scx_extract_display(display),
|
|
|
|
scx_extract_colormap(colormap));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Uninstall_Colormap(s48_value display, s48_value colormap) {
|
|
|
|
XUninstallColormap(scx_extract_display(display),
|
|
|
|
scx_extract_colormap(colormap));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_List_Installed_Colormaps(s48_value display, s48_value window) {
|
2001-07-31 09:15:32 -04:00
|
|
|
int i, n;
|
|
|
|
Colormap *ret;
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value l = S48_NULL;
|
2001-07-31 09:15:32 -04:00
|
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
ret = XListInstalledColormaps(scx_extract_display(display),
|
|
|
|
scx_extract_window(window),
|
2001-07-31 09:15:32 -04:00
|
|
|
&n);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_GC_PROTECT_1(l);
|
|
|
|
for (i = n-1; i >= 0; i--)
|
|
|
|
l = s48_cons(scx_enter_colormap(ret[i]), l);
|
|
|
|
XFree((char*)ret);
|
2001-07-31 09:15:32 -04:00
|
|
|
S48_GC_UNPROTECT();
|
2003-03-10 21:47:38 -05:00
|
|
|
return l;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-04-25 14:52:58 -04:00
|
|
|
s48_value scx_revert_to_binding = S48_FALSE;
|
|
|
|
s48_value scx_revert_tos_binding = S48_FALSE;
|
|
|
|
#define scx_extract_revert_to(x) S48_EXTRACT_ENUM(x, scx_revert_to_binding)
|
|
|
|
#define scx_enter_revert_to(x) S48_ENTER_ENUM(x, scx_revert_tos_binding)
|
2003-03-10 21:47:38 -05:00
|
|
|
|
|
|
|
s48_value scx_Set_Input_Focus(s48_value display, s48_value window,
|
2002-02-08 12:09:43 -05:00
|
|
|
s48_value revert_to, s48_value time) {
|
2003-03-10 21:47:38 -05:00
|
|
|
XSetInputFocus(scx_extract_display(display), scx_extract_window(window),
|
|
|
|
scx_extract_revert_to(revert_to),
|
|
|
|
scx_extract_time(time));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Get_Input_Focus(s48_value display) {
|
2001-07-31 09:15:32 -04:00
|
|
|
Window win;
|
|
|
|
int revert_to;
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value v = S48_FALSE;
|
2001-07-31 09:15:32 -04:00
|
|
|
S48_DECLARE_GC_PROTECT(1);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_GC_PROTECT_1(v);
|
|
|
|
XGetInputFocus(scx_extract_display(display), &win, &revert_to);
|
|
|
|
v = scx_enter_revert_to(revert_to);
|
|
|
|
v = s48_cons(scx_enter_window(win), v);
|
2001-07-31 09:15:32 -04:00
|
|
|
S48_GC_UNPROTECT();
|
2003-03-10 21:47:38 -05:00
|
|
|
return v;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
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) {
|
|
|
|
XWarpPointer(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(src), scx_extract_window(dst),
|
|
|
|
(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));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Bell(s48_value display, s48_value percent) {
|
|
|
|
XBell(scx_extract_display(display), s48_extract_integer(percent));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Set_Access_Control(s48_value display, s48_value on) {
|
|
|
|
XSetAccessControl(scx_extract_display(display), !S48_FALSE_P(on));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-04-25 14:52:58 -04:00
|
|
|
s48_value scx_save_set_binding = S48_FALSE;
|
|
|
|
#define scx_extract_save_set(x) S48_EXTRACT_ENUM(x, scx_save_set_binding)
|
2003-03-10 21:47:38 -05:00
|
|
|
|
|
|
|
s48_value scx_Change_Save_Set(s48_value display, s48_value win,
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value mode) {
|
2003-03-10 21:47:38 -05:00
|
|
|
XChangeSaveSet(scx_extract_display(display), scx_extract_window(win),
|
|
|
|
scx_extract_save_set(mode));
|
|
|
|
return S48_UNSPECIFIC;
|
|
|
|
}
|
|
|
|
|
2003-04-25 14:52:58 -04:00
|
|
|
s48_value scx_close_down_mode_binding = S48_FALSE;
|
2003-03-10 21:47:38 -05:00
|
|
|
#define scx_extract_close_down_mode(x) \
|
2003-04-25 14:52:58 -04:00
|
|
|
S48_EXTRACT_ENUM(x, scx_close_down_mode_binding)
|
2003-03-10 21:47:38 -05:00
|
|
|
|
|
|
|
s48_value scx_Set_Close_Down_Mode(s48_value display, s48_value mode) {
|
|
|
|
XSetCloseDownMode(scx_extract_display(display),
|
|
|
|
scx_extract_close_down_mode(mode));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Kill_Client(s48_value display, s48_value xid) {
|
|
|
|
XKillClient(scx_extract_display(display), (XID)s48_extract_integer(xid));
|
2001-07-31 09:15:32 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Get_Pointer_Mapping(s48_value display) {
|
2001-07-31 09:15:32 -04:00
|
|
|
unsigned char map[256];
|
|
|
|
int i, n;
|
|
|
|
s48_value ret;
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
n = XGetPointerMapping (scx_extract_display(display), map, 256);
|
|
|
|
ret = s48_make_vector(n, S48_NULL);
|
2001-07-31 09:15:32 -04:00
|
|
|
for (i = 0; i < n; i++)
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_VECTOR_SET(ret, i, s48_enter_integer(map[i]));
|
2001-07-31 09:15:32 -04:00
|
|
|
return ret;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Set_Pointer_Mapping(s48_value display, 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));
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
ret = XSetPointerMapping(scx_extract_display(display), 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) {
|
2003-04-25 14:52:58 -04:00
|
|
|
SCX_PRO_IMP(scx_revert_to_binding, "scx-revert-to");
|
|
|
|
SCX_PRO_IMP(scx_revert_tos_binding, "scx-revert-tos");
|
|
|
|
SCX_PRO_IMP(scx_save_set_binding, "scx-save-set");
|
|
|
|
SCX_PRO_IMP(scx_close_down_mode_binding, "scx-close-down-mode");
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
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);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_EXPORT_FUNCTION(scx_Get_Input_Focus);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Warp_Pointer);
|
2001-07-31 10:51:21 -04:00
|
|
|
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);
|
2003-03-10 21:47:38 -05:00
|
|
|
S48_EXPORT_FUNCTION(scx_Kill_Client);
|
2001-07-31 10:51:21 -04:00
|
|
|
S48_EXPORT_FUNCTION(scx_Get_Pointer_Mapping);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Set_Pointer_Mapping);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|