DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 
X Version 11 (Release 5)

XCreateFontCursor(XS)


XCreateFontCursor -- create cursors

Syntax

   #include <X11/cursorfont.h>
   

Cursor XCreateFontCursor(display, shape) Display *display; unsigned int shape;

Cursor XCreatePixmapCursor(display, source, mask, foreground_color, background_color, x, y) Display *display; Pixmap source; Pixmap mask; XColor *foreground_color; XColor *background_color; unsigned int x, y;

Cursor XCreateGlyphCursor(display, source_font, mask_font, source_char, mask_char, foreground_color, background_color) Display *display; Font source_font, mask_font; unsigned int source_char, mask_char; XColor *foreground_color; XColor *background_color;

Arguments


background_color
Specifies the RGB values for the background of the source.

display
Specifies the connection to the X server.

foreground_color
Specifies the RGB values for the foreground of the source.

mask
Specifies the cursor's source bits to be displayed or None.

mask_char
Specifies the glyph character for the mask.

mask_font
Specifies the font for the mask glyph or None.

shape
Specifies the shape of the cursor.

source
Specifies the shape of the source cursor.

source_char
Specifies the character glyph for the source.

source_font
Specifies the font for the source glyph.

x
y
Specify the x and y coordinates, which indicate the hotspot relative to the source's origin.

Description

X provides a set of standard cursor shapes in a special font named cursor. Applications are encouraged to use this interface for their cursors because the font can be customized for the individual display type. The shape argument specifies which glyph of the standard fonts to use.

The hotspot comes from the information stored in the cursor font. The initial colors of a cursor are a black foreground and a white background (see XRecolorCursor(XS)).

XCreateFontCursor can generate ``BadAlloc'' and ``BadValue'' errors.

The XCreatePixmapCursor function creates a cursor and returns the cursor ID associated with it. The foreground and background RGB values must be specified using foreground_color and background_color, even if the X server only has a StaticGray or GrayScale screen. The foreground color is used for the pixels set to 1 in the source, and the background color is used for the pixels set to 0. Both source and mask, if specified, must have depth one (or a ``BadMatch'' error results) but can have any root. The mask argument defines the shape of the cursor. The pixels set to 1 in the mask define which source pixels are displayed, and the pixels set to 0 define which pixels are ignored. If no mask is given, all pixels of the source are displayed. The mask, if present, must be the same size as the pixmap defined by the source argument, or a ``BadMatch'' error results. The hotspot must be a point within the source, or a ``BadMatch'' error results.

The components of the cursor can be transformed arbitrarily to meet display limitations. The pixmaps can be freed immediately if no further explicit references to them are to be made. Subsequent drawing in the source or mask pixmap has an undefined effect on the cursor. The X server might or might not make a copy of the pixmap.

XCreatePixmapCursor can generate ``BadAlloc'' and ``BadPixmap'' errors.

The XCreateGlyphCursor function is similar to XCreatePixmapCursor except that the source and mask bitmaps are obtained from the specified font glyphs. The source_char must be a defined glyph in source_font, or a ``BadValue'' error results. If mask_font is given, mask_char must be a defined glyph in mask_font, or a ``BadValue'' error results. The mask_font and character are optional. The origins of the source_char and mask_char (if defined) glyphs are positioned coincidentally and define the hotspot. The source_char and mask_char need not have the same bounding box metrics, and there is no restriction on the placement of the hotspot relative to the bounding boxes. If no mask_char is given, all pixels of the source are displayed. You can free the fonts immediately by calling XFreeFont if no further explicit references to them are to be made.

For 2-byte matrix fonts, the 16-bit value should be formed with the byte1 member in the most-significant byte and the byte2 member in the least-significant byte.

XCreateGlyphCursor can generate ``BadAlloc'', ``BadFont'', and ``BadValue'' errors.

Diagnostics


``BadAlloc''
The server failed to allocate the requested resource or server memory.

``BadFont''
A value for a Font or GContext argument does not name a defined Font.

``BadMatch''
Some argument or pair of arguments has the correct type and range but fails to match in some other way required by the request.

``BadPixmap''
A value for a Pixmap argument does not name a defined Pixmap.

``BadValue''
Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error.

X font cursors

The following are the available cursors that can be used with XCreateFontCursor.

#define XC_X_cursor 0 #define XC_ll_angle 76
#define XC_arrow 2 #define XC_lr_angle 78
#define XC_based_arrow_down 4 #define XC_man 80
#define XC_based_arrow_up 6 #define XC_middlebutton 82
#define XC_boat 8 #define XC_mouse 84
#define XC_bogosity 10 #define XC_pencil 86
#define XC_bottom_left_corner 12 #define XC_pirate 88
#define XC_bottom_right_corner 14 #define XC_plus 90
#define XC_bottom_side 16 #define XC_question_arrow 92
#define XC_bottom_tee 18 #define XC_right_ptr 94
#define XC_box_spiral 20 #define XC_right_side 96
#define XC_center_ptr 22 #define XC_right_tee 98
#define XC_circle 24 #define XC_rightbutton 100
#define XC_clock 26 #define XC_rtl_logo 102
#define XC_coffee_mug 28 #define XC_sailboat 104
#define XC_cross 30 #define XC_sb_down_arrow 106
#define XC_cross_reverse 32 #define XC_sb_h_double_arrow 108
#define XC_crosshair 34 #define XC_sb_left_arrow 110
#define XC_diamond_cross 36 #define XC_sb_right_arrow 112
#define XC_dot 38 #define XC_sb_up_arrow 114
#define XC_dot_box_mask 40 #define XC_sb_v_double_arrow 116
#define XC_double_arrow 42 #define XC_shuttle 118
#define XC_draft_large 44 #define XC_sizing 120
#define XC_draft_small 46 #define XC_spider 122
#define XC_draped_box 48 #define XC_spraycan 124
#define XC_exchange 50 #define XC_star 126
#define XC_fleur 52 #define XC_target 128
#define XC_gobbler 54 #define XC_tcross 130
#define XC_gumby 56 #define XC_top_left_arrow 132
#define XC_hand1 58 #define XC_top_left_corner 134
#define XC_hand2 60 #define XC_top_right_corner 136
#define XC_heart 62 #define XC_top_side 138
#define XC_icon 64 #define XC_top_tee 140
#define XC_iron_cross 66 #define XC_trek 142
#define XC_left_ptr 68 #define XC_ul_angle 144
#define XC_left_side 70 #define XC_umbrella 146
#define XC_left_tee 72 #define XC_ur_angle 148
#define XC_leftbutton 74 #define XC_watch 150
  #define XC_xterm 152

 +----------------------------------+----------------------------------+
 |#define XC_X_cursor 0             | #define XC_ll_angle 76           |
 +----------------------------------+----------------------------------+
 |#define XC_arrow 2                | #define XC_lr_angle 78           |
 +----------------------------------+----------------------------------+
 |#define XC_based_arrow_down 4     | #define XC_man 80                |
 +----------------------------------+----------------------------------+
 |#define XC_based_arrow_up 6       | #define XC_middlebutton 82       |
 +----------------------------------+----------------------------------+
 |#define XC_boat 8                 | #define XC_mouse 84              |
 +----------------------------------+----------------------------------+
 |#define XC_bogosity 10            | #define XC_pencil 86             |
 +----------------------------------+----------------------------------+
 |#define XC_bottom_left_corner 12  | #define XC_pirate 88             |
 +----------------------------------+----------------------------------+
 |#define XC_bottom_right_corner 14 | #define XC_plus 90               |
 +----------------------------------+----------------------------------+
 |#define XC_bottom_side 16         | #define XC_question_arrow 92     |
 +----------------------------------+----------------------------------+
 |#define XC_bottom_tee 18          | #define XC_right_ptr 94          |
 +----------------------------------+----------------------------------+
 |#define XC_box_spiral 20          | #define XC_right_side 96         |
 +----------------------------------+----------------------------------+
 |#define XC_center_ptr 22          | #define XC_right_tee 98          |
 +----------------------------------+----------------------------------+
 |#define XC_circle 24              | #define XC_rightbutton 100       |
 +----------------------------------+----------------------------------+
 |#define XC_clock 26               | #define XC_rtl_logo 102          |
 +----------------------------------+----------------------------------+
 |#define XC_coffee_mug 28          | #define XC_sailboat 104          |
 +----------------------------------+----------------------------------+
 |#define XC_cross 30               | #define XC_sb_down_arrow 106     |
 +----------------------------------+----------------------------------+
 |#define XC_cross_reverse 32       | #define XC_sb_h_double_arrow 108 |
 +----------------------------------+----------------------------------+
 |#define XC_crosshair 34           | #define XC_sb_left_arrow 110     |
 +----------------------------------+----------------------------------+
 |#define XC_diamond_cross 36       | #define XC_sb_right_arrow 112    |
 +----------------------------------+----------------------------------+
 |#define XC_dot 38                 | #define XC_sb_up_arrow 114       |
 +----------------------------------+----------------------------------+
 |#define XC_dot_box_mask 40        | #define XC_sb_v_double_arrow 116 |
 +----------------------------------+----------------------------------+
 |#define XC_double_arrow 42        | #define XC_shuttle 118           |
 +----------------------------------+----------------------------------+
 |#define XC_draft_large 44         | #define XC_sizing 120            |
 +----------------------------------+----------------------------------+
 |#define XC_draft_small 46         | #define XC_spider 122            |
 +----------------------------------+----------------------------------+
 |#define XC_draped_box 48          | #define XC_spraycan 124          |
 +----------------------------------+----------------------------------+
 |#define XC_exchange 50            | #define XC_star 126              |
 +----------------------------------+----------------------------------+
 |#define XC_fleur 52               | #define XC_target 128            |
 +----------------------------------+----------------------------------+
 |#define XC_gobbler 54             | #define XC_tcross 130            |
 +----------------------------------+----------------------------------+
 |#define XC_gumby 56               | #define XC_top_left_arrow 132    |
 +----------------------------------+----------------------------------+
 |#define XC_hand1 58               | #define XC_top_left_corner 134   |
 +----------------------------------+----------------------------------+
 |#define XC_hand2 60               | #define XC_top_right_corner 136  |
 +----------------------------------+----------------------------------+
 |#define XC_heart 62               | #define XC_top_side 138          |
 +----------------------------------+----------------------------------+
 |#define XC_icon 64                | #define XC_top_tee 140           |
 +----------------------------------+----------------------------------+
 |#define XC_iron_cross 66          | #define XC_trek 142              |
 +----------------------------------+----------------------------------+
 |#define XC_left_ptr 68            | #define XC_ul_angle 144          |
 +----------------------------------+----------------------------------+
 |#define XC_left_side 70           | #define XC_umbrella 146          |
 +----------------------------------+----------------------------------+
 |#define XC_left_tee 72            | #define XC_ur_angle 148          |
 +----------------------------------+----------------------------------+
 |#define XC_leftbutton 74          | #define XC_watch 150             |
 +----------------------------------+----------------------------------+
 |                                  | #define XC_xterm 152             |
 +----------------------------------+----------------------------------+

See also

XDefineCursor(XS), XLoadFont(XS), XRecolorCursor(XS)
Xlib - C Language X Interface
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003