home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / X / XCursor.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-29  |  1.4 KB  |  40 lines

  1. /* $XConsortium: XCursor.c,v 11.14 91/01/06 11:45:02 rws Exp $ */
  2. /* Copyright    Massachusetts Institute of Technology    1987    */
  3.  
  4. /*
  5. Permission to use, copy, modify, distribute, and sell this software and its
  6. documentation for any purpose is hereby granted without fee, provided that
  7. the above copyright notice appear in all copies and that both that
  8. copyright notice and this permission notice appear in supporting
  9. documentation, and that the name of M.I.T. not be used in advertising or
  10. publicity pertaining to distribution of the software without specific,
  11. written prior permission.  M.I.T. makes no representations about the
  12. suitability of this software for any purpose.  It is provided "as is"
  13. without express or implied warranty.
  14. */
  15.  
  16. #include "Xlibint.h"
  17. static XColor foreground = { 0,    0,     0,     0  };  /* black */
  18. static XColor background = { 0, 65535, 65535, 65535 };  /* white */
  19.  
  20. Cursor XCreateFontCursor(dpy, which)
  21.     Display *dpy;
  22.     unsigned int which;
  23. {
  24.     /* 
  25.      * the cursor font contains the shape glyph followed by the mask
  26.      * glyph; so character position 0 contains a shape, 1 the mask for 0,
  27.      * 2 a shape, etc.  <X11/cursorfont.h> contains hash define names
  28.      * for all of these.
  29.      */
  30.  
  31.     if (dpy->cursor_font == None) {
  32.         dpy->cursor_font = XLoadFont (dpy, CURSORFONT);
  33.         if (dpy->cursor_font == None) return None;
  34.     }
  35.  
  36.     return XCreateGlyphCursor (dpy, dpy->cursor_font, dpy->cursor_font, 
  37.                    which, which + 1, &foreground, &background);
  38. }
  39.  
  40.