/* Copyright 2001-2003 by Norbert Freudemann, David Frese */ #include "xlib.h" 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)); return S48_UNSPECIFIC; } s48_value scx_Install_Colormap(s48_value display, s48_value colormap) { XInstallColormap(scx_extract_display(display), scx_extract_colormap(colormap)); return S48_UNSPECIFIC; } s48_value scx_Uninstall_Colormap(s48_value display, s48_value colormap) { XUninstallColormap(scx_extract_display(display), scx_extract_colormap(colormap)); return S48_UNSPECIFIC; } s48_value scx_List_Installed_Colormaps(s48_value display, s48_value window) { int i, n; Colormap *ret; s48_value l = S48_NULL; S48_DECLARE_GC_PROTECT(1); ret = XListInstalledColormaps(scx_extract_display(display), scx_extract_window(window), &n); S48_GC_PROTECT_1(l); for (i = n-1; i >= 0; i--) l = s48_cons(scx_enter_colormap(ret[i]), l); XFree((char*)ret); S48_GC_UNPROTECT(); return l; } #define scx_extract_revert_to(x) S48_EXTRACT_ENUM(x, "scx-revert-to") #define scx_enter_revert_to(x) S48_ENTER_ENUM(x, "scx-revert-tos") s48_value scx_Set_Input_Focus(s48_value display, s48_value window, s48_value revert_to, s48_value time) { XSetInputFocus(scx_extract_display(display), scx_extract_window(window), scx_extract_revert_to(revert_to), scx_extract_time(time)); return S48_UNSPECIFIC; } s48_value scx_Get_Input_Focus(s48_value display) { Window win; int revert_to; s48_value v = S48_FALSE; S48_DECLARE_GC_PROTECT(1); 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); S48_GC_UNPROTECT(); return v; } 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)); return S48_UNSPECIFIC; } s48_value scx_Bell(s48_value display, s48_value percent) { XBell(scx_extract_display(display), s48_extract_integer(percent)); return S48_UNSPECIFIC; } s48_value scx_Set_Access_Control(s48_value display, s48_value on) { XSetAccessControl(scx_extract_display(display), !S48_FALSE_P(on)); return S48_UNSPECIFIC; } #define scx_extract_save_set(x) S48_EXTRACT_ENUM(x, "scx-save-set") s48_value scx_Change_Save_Set(s48_value display, s48_value win, s48_value mode) { XChangeSaveSet(scx_extract_display(display), scx_extract_window(win), scx_extract_save_set(mode)); return S48_UNSPECIFIC; } #define scx_extract_close_down_mode(x) \ S48_EXTRACT_ENUM(x, "scx-close-down-mode") s48_value scx_Set_Close_Down_Mode(s48_value display, s48_value mode) { XSetCloseDownMode(scx_extract_display(display), scx_extract_close_down_mode(mode)); return S48_UNSPECIFIC; } s48_value scx_Kill_Client(s48_value display, s48_value xid) { XKillClient(scx_extract_display(display), (XID)s48_extract_integer(xid)); return S48_UNSPECIFIC; } s48_value scx_Get_Pointer_Mapping(s48_value display) { unsigned char map[256]; int i, n; s48_value ret; n = XGetPointerMapping (scx_extract_display(display), map, 256); 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; } s48_value scx_Set_Pointer_Mapping(s48_value display, s48_value map) { 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)); ret = XSetPointerMapping(scx_extract_display(display), p, n); return (ret == MappingSuccess) ? S48_TRUE : S48_FALSE; } 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_Get_Input_Focus); S48_EXPORT_FUNCTION(scx_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_Kill_Client); S48_EXPORT_FUNCTION(scx_Get_Pointer_Mapping); S48_EXPORT_FUNCTION(scx_Set_Pointer_Mapping); }