1XCreateFontCursor(3)            XLIB FUNCTIONS            XCreateFontCursor(3)
2
3
4

NAME

6       XCreateFontCursor,  XCreatePixmapCursor,  XCreateGlyphCursor  -  create
7       cursors
8

SYNTAX

10       #include <X11/cursorfont.h>
11
12       Cursor XCreateFontCursor(Display *display, unsigned int shape);
13
14       Cursor  XCreatePixmapCursor(Display  *display,  Pixmap  source,  Pixmap
15              mask,  XColor  *foreground_color,  XColor *background_color, un‐
16              signed int x, unsigned int y);
17
18       Cursor  XCreateGlyphCursor(Display  *display,  Font  source_font,  Font
19              mask_font,  unsigned  int  source_char,  unsigned int mask_char,
20              XColor  _Xconst   *foreground_color,   XColor   _Xconst   *back‐
21              ground_color);
22

ARGUMENTS

24       background_color
25                 Specifies the RGB values for the background of the source.
26
27       display   Specifies the connection to the X server.
28
29       foreground_color
30                 Specifies the RGB values for the foreground of the source.
31
32       mask      Specifies the cursor's source bits to be displayed or None.
33
34       mask_char Specifies the glyph character for the mask.
35
36       mask_font Specifies the font for the mask glyph or None.
37
38       shape     Specifies the shape of the cursor.
39
40       source    Specifies the shape of the source cursor.
41
42       source_char
43                 Specifies the character glyph for the source.
44
45       source_font
46                 Specifies the font for the source glyph.
47
48       x
49       y         Specify  the  x and y coordinates, which indicate the hotspot
50                 relative to the source's origin.
51

DESCRIPTION

53       X provides a set of standard cursor shapes in a special font named cur‐
54       sor.   Applications are encouraged to use this interface for their cur‐
55       sors because the font can be  customized  for  the  individual  display
56       type.   The  shape argument specifies which glyph of the standard fonts
57       to use.
58
59       The hotspot comes from the information stored in the cursor font.   The
60       initial  colors  of  a  cursor are a black foreground and a white back‐
61       ground (see XRecolorCursor).
62
63       XCreateFontCursor can generate BadAlloc and BadValue errors.
64
65       The XCreatePixmapCursor function creates a cursor and returns the  cur‐
66       sor  ID  associated  with it.  The foreground and background RGB values
67       must be specified using foreground_color and background_color, even  if
68       the X server only has a StaticGray or GrayScale screen.  The foreground
69       color is used for the pixels set to 1 in the source, and the background
70       color is used for the pixels set to 0.  Both source and mask, if speci‐
71       fied, must have depth one (or a BadMatch error results)  but  can  have
72       any root.  The mask argument defines the shape of the cursor.  The pix‐
73       els set to 1 in the mask define which source pixels are displayed,  and
74       the  pixels  set  to  0 define which pixels are ignored.  If no mask is
75       given, all pixels of the source are displayed.  The mask,  if  present,
76       must  be the same size as the pixmap defined by the source argument, or
77       a BadMatch error results.  The hotspot  must  be  a  point  within  the
78       source, or a BadMatch error results.
79
80       The  components  of  the  cursor can be transformed arbitrarily to meet
81       display limitations.  The pixmaps can be freed immediately if  no  fur‐
82       ther explicit references to them are to be made.  Subsequent drawing in
83       the source or mask pixmap has an undefined effect on the cursor.  The X
84       server might or might not make a copy of the pixmap.
85
86       XCreatePixmapCursor can generate BadAlloc and BadPixmap errors.
87
88       The  XCreateGlyphCursor  function is similar to XCreatePixmapCursor ex‐
89       cept that the source and mask bitmaps are obtained from  the  specified
90       font  glyphs.   The source_char must be a defined glyph in source_font,
91       or a BadValue error results.  If mask_font is given, mask_char must  be
92       a  defined  glyph  in  mask_font,  or  a  BadValue  error results.  The
93       mask_font and character are optional.  The origins of  the  source_char
94       and  mask_char  (if defined) glyphs are positioned coincidently and de‐
95       fine the hotspot.  The source_char and mask_char need not have the same
96       bounding  box  metrics, and there is no restriction on the placement of
97       the hotspot relative to the bounding boxes.  If no mask_char is  given,
98       all pixels of the source are displayed.  You can free the fonts immedi‐
99       ately by calling XFreeFont if no further explicit  references  to  them
100       are to be made.
101
102       For  2-byte  matrix  fonts,  the 16-bit value should be formed with the
103       byte1 member in the most significant byte and the byte2 member  in  the
104       least significant byte.
105
106       XCreateGlyphCursor can generate BadAlloc, BadFont, and BadValue errors.
107

DIAGNOSTICS

109       BadAlloc  The  server  failed  to  allocate  the  requested resource or
110                 server memory.
111
112       BadFont   A value for a Font or GContext argument does not name  a  de‐
113                 fined Font.
114
115       BadMatch  Some  argument  or pair of arguments has the correct type and
116                 range but fails to match in some other way  required  by  the
117                 request.
118
119       BadPixmap A value for a Pixmap argument does not name a defined Pixmap.
120
121       BadValue  Some numeric value falls outside the range of values accepted
122                 by the request.  Unless a specific range is specified for  an
123                 argument,  the  full  range defined by the argument's type is
124                 accepted.  Any argument defined as a set of alternatives  can
125                 generate this error.
126

SEE ALSO

128       XDefineCursor(3), XLoadFont(3), XRecolorCursor(3)
129       Xlib - C Language X Interface
130
131
132
133X Version 11                     libX11 1.8.1             XCreateFontCursor(3)
Impressum