scx/c/xlib/cursor.c

85 lines
2.5 KiB
C
Raw Normal View History

/* Copyright 2001-2003 by Norbert Freudemann, David Frese */
2001-05-08 10:21:00 -04:00
#include "xlib.h"
2001-07-30 10:11:41 -04:00
s48_value scx_Create_Pixmap_Cursor(s48_value display,
s48_value src, s48_value mask,
s48_value foreground,
s48_value background,
s48_value x, s48_value y) {
XColor f, b;
Cursor xc;
scx_extract_color(foreground, &f);
scx_extract_color(background, &b);
xc = XCreatePixmapCursor(scx_extract_display(display),
scx_extract_pixmap(src),
scx_extract_pixmap(mask),
&f, &b,
s48_extract_integer(x),
s48_extract_integer(y));
return scx_enter_cursor(xc);
}
s48_value scx_Create_Glyph_Cursor(s48_value display,
s48_value src_font, s48_value mask_font,
s48_value srcc, s48_value maskc,
s48_value foreground, s48_value background) {
XColor f, b;
Cursor xc;
scx_extract_color(foreground, &f);
scx_extract_color(background, &b);
xc = XCreateGlyphCursor(scx_extract_display(display),
scx_extract_font(src_font),
scx_extract_font(mask_font),
s48_extract_integer(srcc),
s48_extract_integer(maskc),
&f, &b);
return scx_enter_cursor(xc);
}
s48_value scx_Create_Font_Cursor(s48_value display, s48_value shape) {
Cursor xc = XCreateFontCursor(scx_extract_display(display),
s48_extract_integer(shape));
return scx_enter_cursor(xc);
}
s48_value scx_Define_Cursor(s48_value display, s48_value window,
s48_value cursor) {
XDefineCursor(scx_extract_display(display), scx_extract_window(window),
scx_extract_cursor(cursor));
2001-07-30 10:11:41 -04:00
return S48_UNSPECIFIC;
}
s48_value scx_Undefine_Cursor(s48_value display, s48_value window) {
XUndefineCursor(scx_extract_display(display),
scx_extract_window(window));
return S48_UNSPECIFIC;
2001-07-30 10:11:41 -04:00
}
s48_value scx_Recolor_Cursor(s48_value display, s48_value cursor,
s48_value foreground, s48_value background) {
XColor f, b;
scx_extract_color(foreground, &f);
scx_extract_color(background, &b);
XRecolorCursor(scx_extract_display(display),
scx_extract_cursor(cursor),
&f, &b);
return S48_UNSPECIFIC;
}
s48_value scx_Free_Cursor(s48_value display, s48_value cursor) {
XFreeCursor(scx_extract_display(display),
scx_extract_cursor(cursor));
2001-07-30 10:11:41 -04:00
return S48_UNSPECIFIC;
}
void scx_init_cursor(void) {
S48_EXPORT_FUNCTION(scx_Create_Pixmap_Cursor);
S48_EXPORT_FUNCTION(scx_Create_Glyph_Cursor);
S48_EXPORT_FUNCTION(scx_Create_Font_Cursor);
S48_EXPORT_FUNCTION(scx_Define_Cursor);
S48_EXPORT_FUNCTION(scx_Undefine_Cursor);
S48_EXPORT_FUNCTION(scx_Recolor_Cursor);
S48_EXPORT_FUNCTION(scx_Free_Cursor);
2001-05-08 10:21:00 -04:00
}