Cursor.c revision 61b2299d
1/* $Xorg: Cursor.c,v 1.4 2001/02/09 02:03:32 xorgcvs Exp $ */ 2/* 3 4Copyright 1987, 1998 The Open Group 5 6Permission to use, copy, modify, distribute, and sell this software and its 7documentation for any purpose is hereby granted without fee, provided that 8the above copyright notice appear in all copies and that both that 9copyright notice and this permission notice appear in supporting 10documentation. 11 12The above copyright notice and this permission notice shall be included in 13all copies or substantial portions of the Software. 14 15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 22Except as contained in this notice, the name of The Open Group shall not be 23used in advertising or otherwise to promote the sale, use or other dealings 24in this Software without prior written authorization from The Open Group. 25 26*/ 27/* $XFree86: xc/lib/X11/Cursor.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */ 28 29#ifdef HAVE_CONFIG_H 30#include <config.h> 31#endif 32#include "Xlibint.h" 33static XColor _Xconst foreground = { 0, 0, 0, 0 }; /* black */ 34static XColor _Xconst background = { 0, 65535, 65535, 65535 }; /* white */ 35 36Cursor XCreateFontCursor( 37 Display *dpy, 38 unsigned int which) 39{ 40 /* 41 * the cursor font contains the shape glyph followed by the mask 42 * glyph; so character position 0 contains a shape, 1 the mask for 0, 43 * 2 a shape, etc. <X11/cursorfont.h> contains hash define names 44 * for all of these. 45 */ 46 47 if (dpy->cursor_font == None) { 48 dpy->cursor_font = XLoadFont (dpy, CURSORFONT); 49 if (dpy->cursor_font == None) return None; 50 } 51 52 return XCreateGlyphCursor (dpy, dpy->cursor_font, dpy->cursor_font, 53 which, which + 1, &foreground, &background); 54} 55 56