NAME
X11::CursorFont - cursor font glyph names and numbers
SYNOPSIS
use X11::CursorFont '%CURSOR_GLYPH';my $num = $CURSOR_GLYPH{'fleur'}; # is 52my $name = $X11::CursorFont::CURSOR_NAME[52]; # is "fleur"
DESCRIPTION
This is the names and numbers of the glyphs in the X11 cursor font which contains various standard mouse pointer cursors.
%CURSOR_GLYPH maps a glyph name to its character number in the font,
$CURSOR_GLYPH{'fleur'} # is 52
@CURSOR_NAME conversely is indexed by character number and gives the glyph name,
$CURSOR_NAME[52] # is "fleur"
Each glyph has an associated mask at character number glyph+1 which is the shape of the cursor (the displayed vs transparent pixels). So the character numbers are always even and in @CURSOR_NAME only the even character positions have names.
The cursor images can be viewed with the usual "xfd" font display program,
xfd -fn cursor
The names are per the Xlib /usr/include/X11/cursorfont.h file, without the "XC_" prefixes. The full list is
Name NumberX_cursor 0 default fat Xarrow 2based_arrow_down 4based_arrow_up 6boat 8bogosity 10bottom_left_corner 12bottom_right_corner 14bottom_side 16bottom_tee 18box_spiral 20 a square spiralcenter_ptr 22circle 24clock 26coffee_mug 28cross 30cross_reverse 32crosshair 34 "+" shapediamond_cross 36dot 38dotbox 40double_arrow 42draft_large 44draft_small 46draped_box 48exchange 50fleur 52gobbler 54gumby 56hand1 58hand2 60heart 62icon 64iron_cross 66left_ptr 68left_side 70left_tee 72leftbutton 74ll_angle 76lr_angle 78man 80middlebutton 82mouse 84pencil 86pirate 88 skull and crossbonesplus 90question_arrow 92right_ptr 94right_side 96right_tee 98rightbutton 100rtl_logo 102sailboat 104sb_down_arrow 106sb_h_double_arrow 108sb_left_arrow 110sb_right_arrow 112sb_up_arrow 114sb_v_double_arrow 116shuttle 118sizing 120spider 122spraycan 124star 126target 128tcross 130top_left_arrow 132top_left_corner 134top_right_corner 136top_side 138top_tee 140trek 142ul_angle 144umbrella 146ur_angle 148watch 150 a good "busy" indicatorxterm 152 a vertical insertion bar
"X_cursor" is the usual default when the server first starts or when the root window is set to cursor "None".
VARIABLES
- %X11::CursorFont::CURSOR_GLYPH
-
A mapping of glyph name to cursor font character number.
- @X11::CursorFont::CURSOR_NAME
-
A table of cursor font character number to glyph name.
EXPORTS
Nothing is exported by default, but %CURSOR_GLYPH and @CURSOR_NAME can be selected in usual "Exporter" style (see Exporter),
use X11::CursorFont '%CURSOR_GLYPH', '@CURSOR_NAME';
EXAMPLE
To create a cursor from a desired glyph,
my $cursor_name = 'spraycan';my $cursor_glyph = $CURSOR_GLYPH{$cursor_name}; # numbermy $cursor_font = $X->new_rsrc;$X->OpenFont ($cursor_font, "cursor"); # cursor fontmy $cursor = $X->new_rsrc;$X->CreateGlyphCursor($cursor,$cursor_font, # font$cursor_font, # mask font$cursor_glyph, # glyph$cursor_glyph + 1, # and its mask0,0,0, # foreground, black0xFFFF,0xFFFF,0xFFFF); # background, white$X->CloseFont ($cursor_font);# then use $cursor with CreateWindow or ChangeWindowAttributes# cursor => $cursor
The $cursor_font could be kept open if used repeatedly. Opening and closing isn't a round-trip, so an open when needed may be enough.
Any RGB colours can be given in CreateGlyphCursor(), but actual appearance on screen will be limited by the hardware.
All cursors in the core protocol are two-colours with pixels fully opaque or fully transparent as per this create. The RENDER extension, when available, can make multi-colour and partial transparency if desired (see X11::Protocol::Ext::RENDER).
SEE ALSO
X11::Protocol, X11::KeySyms
/usr/include/X11/cursorfont.h and listing in the Xlib manual appendix B ("http://www.x.org/docs/X11/" or /usr/share/doc/libx11-dev/libX11.txt.gz).
Xlib Xmu XmuCursorNameToIndex() ("http://www.x.org/docs/Xmu/" or /usr/share/doc/libxmu-headers/Xmu.txt.gz)
xfd(1) to display the cursor font.
xsetroot(1) to change the root window cursor.
HOME PAGE
<http://user42.tuxfamily.org/x11-protocol-other/index.html>
LICENSE
Copyright 2011, 2012, 2013, 2014, 2017 Kevin Ryde
X11-Protocol-Other is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
X11-Protocol-Other is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with X11-Protocol-Other. If not, see <http://www.gnu.org/licenses/>.