/* @(#)cursor.h 9.3 88/01/19 SMI */ /* * Copyright (c) 1986 by Sun Microsystems, Inc. */ /*- Definitions pertaining to cursors cursor.h, Tue May 6 11:35:25 1986 James Gosling, Sun Microsystems */ #ifndef cs_movecursor #ifndef NEW_FONT_MAGIC #include "font.h" #endif /* The current state of the cursor */ struct cursor_state { struct canvas *canvas; /* The canvas from which cursor image comes */ /* (use scene and cdata.cursor fields) */ struct rendering_info ri; /* ri.pos == coordinates of the tip in scene */ struct spoint ul, lr; /* Upper left & lower right of bbox in scene */ short up; /* true iff the cursor is visible on the screen */ struct pixrect *old; /* The bits on the screen before the cursor got put there */ int (*went_down) (); /* Called after cursor taken down */ int (*going_up) (); /* Called before cursor put up */ short change; /* Set when there is a change in cursor state pending */ #define CURSOR_PUT_UP 0x01 /* Put up the cursor ASAP */ #define CURSOR_MOVE_PENDING 0x02 /* The cursor MIGHT have to be moved */ }; extern struct cursor_state cv_cursor; struct cursor_shape { #define CURSOR_SHAPE 0 /* "Main" cursor image index to arrays */ #define CURSOR_MASK 1 /* Mask cursor image index to arrays */ struct glyph *glyph[2]; struct color color[2]; short ropcode[2]; struct font *font; struct spoint hotspot; struct spoint size; unsigned char index[2]; /* glyph font index */ }; #define cs_cursorup() (!cv_cursor.up ? cv_cursor_up() : 0) #define cs_cursordown() (cv_cursor.up ? cv_cursor_down() : 0) #define cs_movecursor(X,Y) (cfloorfr(cv_cursor.ri.pos.x)!=(X) || cfloorfr(cv_cursor.ri.pos.y)!=(Y) \ ? (cs_cursordown(), \ (cfloorfr(cv_cursor.ri.pos.x)=(X)), \ (cfloorfr(cv_cursor.ri.pos.y)=(Y))) \ : 0) #define cs_checkcursordims(cv, x, y, w, h) \ (cv_cursor.up ? cs_checkcursor((cv), (x), (y), (w), (h)) : 0) #define cs_checkcursorshape(cv, shape) \ cs_checkcursordims((cv), (shape)->pos.x, (shape)->pos.y, \ (shape)->size.x, (shape)->size.y) #define cs_checkcursorcanvas(cv) \ cs_checkcursordims((cv),0,0,(cv)->pixrect.pr_width,(cv)->pixrect.pr_height) #ifdef cplus /* Call to initialize internals of c (gets font from gc) */ void cs_initcursor(struct graphics_context *gc, char *str, int len, struct cursor_shape *c); /* Call cs_setcursor to change a canvas' cursor */ void cs_setcursor(struct canvas *canvas, struct cursor_shape *c); /* * Call cs_setcursorcanvas when the canvas from which the cursor image is * gleaned changes. */ void cs_setcursorcanvas(struct canvas *canvas); #endif /* cplus */ #endif