scx/c/xlib/cursor.c

94 lines
3.0 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;
2003-05-02 09:06:50 -04:00
S48_DECLARE_GC_PROTECT_7(display, src, mask, foreground, background, x, y);
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));
2003-05-02 09:06:50 -04:00
S48_GC_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;
2003-05-02 09:06:50 -04:00
S48_DECLARE_GC_PROTECT_7(display, src_font, mask_font, srcc, maskc,
foreground, background);
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);
2003-05-02 09:06:50 -04:00
S48_GC_RETURN(scx_enter_cursor(xc));
}
s48_value scx_Create_Font_Cursor(s48_value display, s48_value shape) {
2003-05-02 09:06:50 -04:00
Cursor xc;
S48_DECLARE_GC_PROTECT_2(display, shape);
xc = XCreateFontCursor(scx_extract_display(display),
s48_extract_integer(shape));
S48_GC_RETURN(scx_enter_cursor(xc));
}
s48_value scx_Define_Cursor(s48_value display, s48_value window,
s48_value cursor) {
2003-05-02 09:06:50 -04:00
S48_DECLARE_GC_PROTECT_3(display, window, cursor);
XDefineCursor(scx_extract_display(display), scx_extract_window(window),
scx_extract_cursor(cursor));
2003-05-02 09:06:50 -04:00
S48_GC_RETURN(S48_UNSPECIFIC);
2001-07-30 10:11:41 -04:00
}
s48_value scx_Undefine_Cursor(s48_value display, s48_value window) {
2003-05-02 09:06:50 -04:00
S48_DECLARE_GC_PROTECT_2(display, window);
XUndefineCursor(scx_extract_display(display),
scx_extract_window(window));
2003-05-02 09:06:50 -04:00
S48_GC_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;
2003-05-02 09:06:50 -04:00
S48_DECLARE_GC_PROTECT_4(display, cursor, foreground, background);
scx_extract_color(foreground, &f);
scx_extract_color(background, &b);
XRecolorCursor(scx_extract_display(display),
scx_extract_cursor(cursor),
&f, &b);
2003-05-02 09:06:50 -04:00
S48_GC_RETURN(S48_UNSPECIFIC);
}
s48_value scx_Free_Cursor(s48_value display, s48_value cursor) {
2003-05-02 09:06:50 -04:00
S48_DECLARE_GC_PROTECT_2(display, cursor);
XFreeCursor(scx_extract_display(display),
scx_extract_cursor(cursor));
2003-05-02 09:06:50 -04:00
S48_GC_RETURN(S48_UNSPECIFIC);
2001-07-30 10:11:41 -04:00
}
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
}