scx/c/xlib/util.c

74 lines
1.6 KiB
C
Raw Normal View History

2001-05-08 10:21:00 -04:00
#include "xlib.h"
2001-08-28 10:39:07 -04:00
#include "scheme48.h"
2001-05-08 10:21:00 -04:00
2001-08-28 10:39:07 -04:00
s48_value scx_Get_Default (s48_value Xdpy, s48_value program,
s48_value option) {
char* ret;
if (ret = XGetDefault (SCX_EXTRACT_DISPLAY(Xdpy),
s48_extract_string(program),
s48_extract_string(option)))
return s48_enter_string(ret);
return S48_FALSE;
2001-05-08 10:21:00 -04:00
}
2001-08-28 10:39:07 -04:00
s48_value scx_Resource_Manager_String (s48_value Xdpy) {
char* ret;
ret = XResourceManagerString (SCX_EXTRACT_DISPLAY(Xdpy));
return ret ? s48_enter_string(ret) : S48_FALSE;
2001-05-08 10:21:00 -04:00
}
2001-08-28 10:39:07 -04:00
s48_value scx_Parse_Geometry (s48_value strg) {
s48_value ret;
int x, y, res;
unsigned int w, h;
S48_DECLARE_GC_PROTECT(1);
res = XParseGeometry (s48_extract_string(strg), &x, &y, &w, &h);
S48_GC_PROTECT_1(ret);
if (res & XNegative) {
ret = s48_cons(S48_TRUE, S48_NULL);
}else{
ret = s48_cons(S48_FALSE, S48_NULL);
}
if (res & YNegative) {
ret = s48_cons(S48_TRUE, ret);
}else{
ret = s48_cons(S48_FALSE, ret);
}
if (res & XValue) {
ret = s48_cons(s48_enter_integer(x), ret);
}else{
ret = s48_cons(S48_FALSE, ret);
}
if (res & YValue) {
ret = s48_cons(s48_enter_integer(y), ret);
}else{
ret = s48_cons(S48_FALSE, ret);
}
if (res & WidthValue) {
ret = s48_cons(s48_enter_integer(w), ret);
}else{
ret = s48_cons(S48_FALSE, ret);
}
if (res & HeightValue) {
ret = s48_cons(s48_enter_integer (h), ret);
}else{
ret = s48_cons(S48_FALSE, ret);
}
S48_GC_UNPROTECT();
return ret;
2001-05-08 10:21:00 -04:00
}
2001-08-28 10:39:07 -04:00
// scx_Parse_Color is in colormap.c
void scx_init_util(void) {
S48_EXPORT_FUNCTION(scx_Get_Default);
S48_EXPORT_FUNCTION(scx_Resource_Manager_String);
S48_EXPORT_FUNCTION(scx_Parse_Geometry);
2001-05-08 10:21:00 -04:00
}