1X11::CursorFont(3)    User Contributed Perl Documentation   X11::CursorFont(3)
2
3
4

NAME

6       X11::CursorFont - cursor font glyph names and numbers
7

SYNOPSIS

9        use X11::CursorFont '%CURSOR_GLYPH';
10        my $num = $CURSOR_GLYPH{'fleur'};               # is 52
11        my $name = $X11::CursorFont::CURSOR_NAME[52];   # is "fleur"
12

DESCRIPTION

14       This is the names and numbers of the glyphs in the X11 cursor font
15       which contains various standard mouse pointer cursors.
16
17       %CURSOR_GLYPH maps a glyph name to its character number in the font,
18
19           $CURSOR_GLYPH{'fleur'}     # is 52
20
21       @CURSOR_NAME conversely is indexed by character number and gives the
22       glyph name,
23
24           $CURSOR_NAME[52]           # is "fleur"
25
26       Each glyph has an associated mask at character number glyph+1 which is
27       the shape of the cursor (the displayed vs transparent pixels).  So the
28       character numbers are always even and in @CURSOR_NAME only the even
29       character positions have names.
30
31       The cursor images can be viewed with the usual "xfd" font display
32       program,
33
34            xfd -fn cursor
35
36       The names are per the Xlib /usr/include/X11/cursorfont.h file, without
37       the "XC_" prefixes.  The full list is
38
39           Name                  Number
40
41           X_cursor                0    default fat X
42           arrow                   2
43           based_arrow_down        4
44           based_arrow_up          6
45           boat                    8
46           bogosity               10
47           bottom_left_corner     12
48           bottom_right_corner    14
49           bottom_side            16
50           bottom_tee             18
51           box_spiral             20    a square spiral
52           center_ptr             22
53           circle                 24
54           clock                  26
55           coffee_mug             28
56           cross                  30
57           cross_reverse          32
58           crosshair              34    "+" shape
59           diamond_cross          36
60           dot                    38
61           dotbox                 40
62           double_arrow           42
63           draft_large            44
64           draft_small            46
65           draped_box             48
66           exchange               50
67           fleur                  52
68           gobbler                54
69           gumby                  56
70           hand1                  58
71           hand2                  60
72           heart                  62
73           icon                   64
74           iron_cross             66
75           left_ptr               68
76           left_side              70
77           left_tee               72
78           leftbutton             74
79           ll_angle               76
80           lr_angle               78
81           man                    80
82           middlebutton           82
83           mouse                  84
84           pencil                 86
85           pirate                 88    skull and crossbones
86           plus                   90
87           question_arrow         92
88           right_ptr              94
89           right_side             96
90           right_tee              98
91           rightbutton           100
92           rtl_logo              102
93           sailboat              104
94           sb_down_arrow         106
95           sb_h_double_arrow     108
96           sb_left_arrow         110
97           sb_right_arrow        112
98           sb_up_arrow           114
99           sb_v_double_arrow     116
100           shuttle               118
101           sizing                120
102           spider                122
103           spraycan              124
104           star                  126
105           target                128
106           tcross                130
107           top_left_arrow        132
108           top_left_corner       134
109           top_right_corner      136
110           top_side              138
111           top_tee               140
112           trek                  142
113           ul_angle              144
114           umbrella              146
115           ur_angle              148
116           watch                 150    a good "busy" indicator
117           xterm                 152    a vertical insertion bar
118
119       "X_cursor" is the usual default when the server first starts or when
120       the root window is set to cursor "None".
121

VARIABLES

123       %X11::CursorFont::CURSOR_GLYPH
124           A mapping of glyph name to cursor font character number.
125
126       @X11::CursorFont::CURSOR_NAME
127           A table of cursor font character number to glyph name.
128

EXPORTS

130       Nothing is exported by default, but %CURSOR_GLYPH and @CURSOR_NAME can
131       be selected in usual "Exporter" style (see Exporter),
132
133           use X11::CursorFont '%CURSOR_GLYPH', '@CURSOR_NAME';
134

EXAMPLE

136       To create a cursor from a desired glyph,
137
138           my $cursor_name = 'spraycan';
139           my $cursor_glyph = $CURSOR_GLYPH{$cursor_name}; # number
140
141           my $cursor_font = $X->new_rsrc;
142           $X->OpenFont ($cursor_font, "cursor"); # cursor font
143
144           my $cursor = $X->new_rsrc;
145           $X->CreateGlyphCursor
146                  ($cursor,
147                   $cursor_font,  # font
148                   $cursor_font,  # mask font
149                   $cursor_glyph,      # glyph
150                   $cursor_glyph + 1,  # and its mask
151                   0,0,0,                  # foreground, black
152                   0xFFFF,0xFFFF,0xFFFF);  # background, white
153
154           $X->CloseFont ($cursor_font);
155
156           # then use $cursor with CreateWindow or ChangeWindowAttributes
157           #       cursor => $cursor
158
159       The $cursor_font could be kept open if used repeatedly.  Opening and
160       closing isn't a round-trip, so an open when needed may be enough.
161
162       Any RGB colours can be given in "CreateGlyphCursor()", but actual
163       appearance on screen will be limited by the hardware.
164
165       All cursors in the core protocol are two-colours with pixels fully
166       opaque or fully transparent as per this create.  The RENDER extension,
167       when available, can make multi-colour and partial transparency if
168       desired (see X11::Protocol::Ext::RENDER).
169

SEE ALSO

171       X11::Protocol, X11::KeySyms
172
173       /usr/include/X11/cursorfont.h and listing in the Xlib manual appendix B
174       ("http://www.x.org/docs/X11/" or
175       /usr/share/doc/libx11-dev/libX11.txt.gz).
176
177       Xlib Xmu "XmuCursorNameToIndex()" ("http://www.x.org/docs/Xmu/" or
178       /usr/share/doc/libxmu-headers/Xmu.txt.gz)
179
180       xfd(1) to display the cursor font.
181
182       xsetroot(1) to change the root window cursor.
183

HOME PAGE

185       <http://user42.tuxfamily.org/x11-protocol-other/index.html>
186

LICENSE

188       Copyright 2011, 2012, 2013, 2014, 2017 Kevin Ryde
189
190       X11-Protocol-Other is free software; you can redistribute it and/or
191       modify it under the terms of the GNU General Public License as
192       published by the Free Software Foundation; either version 3, or (at
193       your option) any later version.
194
195       X11-Protocol-Other is distributed in the hope that it will be useful,
196       but WITHOUT ANY WARRANTY; without even the implied warranty of
197       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
198       General Public License for more details.
199
200       You should have received a copy of the GNU General Public License along
201       with X11-Protocol-Other.  If not, see <http://www.gnu.org/licenses/>.
202
203
204
205perl v5.30.0                      2019-07-26                X11::CursorFont(3)
Impressum