Debian Codegraph @

man/Xcursor.man

raw
1 .\"
2 .\" Copyright © 2021,2024 Thomas E. Dickey
3 .\" Copyright © 2002 Keith Packard
4 .\"
5 .\" Permission to use, copy, modify, distribute, and sell this software and
6 .\" its documentation for any purpose is hereby granted without fee, provided
7 .\" that the above copyright notice appear in all copies and that both that
8 .\" copyright notice and this permission notice appear in supporting
9 .\" documentation, and that the name of the above copyright holders not be
10 .\" used in advertising or publicity pertaining to distribution of the
11 .\" software without specific, written prior permission. The above copyright
12 .\" holders make no representations about the suitability of this software for
13 .\" any purpose. It is provided "as is" without express or implied warranty.
14 .\"
15 .\" THE ABOVE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
16 .\" SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
17 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
18 .\" INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19 .\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
20 .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 .\" PERFORMANCE OF THIS SOFTWARE.
22 .\"
23 .de TA
24 .ie n .ta 0.8i 1.6i 2.4i 3.2i
25 .el .ta 0.5i 1.0i 1.5i 2.0i
26 ..
27 .de PS
28 .ns
29 .TP
30 .na
31 .nf
32 .ie n .ta 0.8i 3.0i
33 .el .ta 0.5i 2.0i
34 ..
35 .de PC
36 .sp
37 .PS
38 ..
39 .de PE
40 .br
41 .ad
42 .fi
43 .sp
44 .TA
45 ..
46 .de QS
47 .in +.2i
48 .nf
49 .na
50 .ie n .ta 1.0i 3.0i
51 .el .ta 0.6i 2.0i
52 ..
53 .de QC
54 .QS
55 .ie n .ta 2.0i 3.0i
56 .el .ta 1.6i 2.6i
57 .ft CR
58 ..
59 .de QE
60 .in -.2i
61 .ft
62 .fi
63 .ad
64 .TA
65 ..
66 .de bP
67 .ie n .IP \(bu 4
68 .el .IP \(bu 2
69 ..
70 .ie \n(.g .ds `` \(lq
71 .el .ds `` ``
72 .ie \n(.g .ds '' \(rq
73 .el .ds '' ''
74 .TH XCURSOR __libmansuffix__ __xorgversion__ "X Version 11"
75 .hy 0
76 .SH NAME
77 Xcursor \-
78 Cursor management library
79 .SH SYNOPSIS
80 .nf
81 .B #include <X11/Xcursor/Xcursor.h>
82 .fi
83 .SH DESCRIPTION
84 .B Xcursor
85 is a simple library designed to help locate and load cursors.
86 Cursors can be loaded from files or memory.
87 A library of common cursors exists which
88 map to the standard X cursor names.
89 Cursors can exist in several sizes and
90 the library automatically picks the best size.
91 .
92 .SH FUNCTIONAL OVERVIEW
93 Xcursor is built in a couple of layers; at the bottom layer is code which
94 can load cursor images from files.
95 Above that is a layer which locates
96 cursor files based on the library path and theme.
97 At the top is a layer
98 which builds cursors either out of an image loaded from a file or one of the
99 standard X cursors.
100 When using images loaded from files, Xcursor prefers
101 to use the Render extension CreateCursor request if supported by the X server.
102 Where not supported, Xcursor maps the cursor image to a standard X
103 cursor and uses the core CreateCursor request.
104 .
105 .SS "CURSOR FILES"
106 Xcursor defines a new format for cursors on disk.
107 Each file holds
108 one or more cursor images.
109 Each cursor image is tagged with a nominal size
110 so that the best size can be selected automatically.
111 Multiple cursors of
112 the same nominal size can be loaded together; applications are expected to
113 use them as an animated sequence.
114 .P
115 Cursor files are stored as a header containing a table of contents followed
116 by a sequence of chunks.
117 The table of contents indicates the type, subtype
118 and position in the file of each chunk.
119 The file header looks like:
120 .LP
121 .QS
122 \fImagic\fP\^: CARD32 "Xcur" (0x58, 0x63, 0x75, 0x72)
123 \fIheader\fP\^: CARD32 bytes in this header
124 \fIversion\fP\^: CARD32 file version number
125 \fIntoc\fP\^: CARD32 number of toc entries
126 \fItoc\fP\^: LISTofTOC table of contents
127 .QE
128 .P
129 Each table of contents entry looks like:
130 .LP
131 .QS
132 \fItype\fP\^: CARD32 entry type
133 \fIsubtype\fP\^: CARD32 type-specific label - size for images
134 \fIposition\fP\^: CARD32 absolute byte position of table in file
135 .QE
136 .P
137 Each chunk in the file has set of common header fields followed by
138 additional type-specific fields:
139 .LP
140 .QS
141 \fIheader\fP\^: CARD32 bytes in chunk header (including type-specific fields)
142 \fItype\fP\^: CARD32 must match type in TOC for this chunk
143 \fIsubtype\fP\^: CARD32 must match subtype in TOC for this chunk
144 \fIversion\fP\^: CARD32 version number for this chunk type
145 .QE
146 .P
147 There are currently two chunk types defined for cursor files; comments and
148 images.
149 Comments look like:
150 .LP
151 .QS
152 \fIheader\fP\^: 20 Comment headers are 20 bytes
153 \fItype\fP\^: 0xfffe0001 Comment type is 0xfffe0001
154 \fIsubtype\fP\^: { 1 (COPYRIGHT), 2 (LICENSE), 3 (OTHER) }
155 \fIversion\fP\^: 1
156 \fIlength\fP\^: CARD32 byte length of UTF-8 string
157 \fIstring\fP\^: LISTofCARD8 UTF-8 string
158 .QE
159 .P
160 Images look like:
161 .LP
162 .QS
163 \fIheader\fP\^: 36 Image headers are 36 bytes
164 .br
165 \fItype\fP\^: 0xfffd0002 Image type is 0xfffd0002
166 .br
167 \fIsubtype\fP\^: CARD32 Image subtype is the nominal size
168 .br
169 \fIversion\fP\^: 1
170 .br
171 \fIwidth\fP\^: CARD32 Must be less than or equal to 0x7fff
172 .br
173 \fIheight\fP\^: CARD32 Must be less than or equal to 0x7fff
174 .br
175 \fIxhot\fP\^: CARD32 Must be less than or equal to width
176 .br
177 \fIyhot\fP\^: CARD32 Must be less than or equal to height
178 .br
179 \fIdelay\fP\^: CARD32 Delay between animation frames in milliseconds
180 .br
181 \fIpixels\fP\^: LISTofCARD32 Packed ARGB format pixels
182 .QE
183 .
184 .SS THEMES
185 Xcursor (mostly) follows the freedesktop.org spec for theming icons.
186 The default search path it uses is
187 .sp
188 .RS
189 __XCURSORPATH__
190 .RE
191 .PP
192 Within each of these directories,
193 it searches for a directory using the theme name:
194 .bP
195 Within the theme directory,
196 it looks for cursor files in the \*(``cursors\*('' subdirectory.
197 .IP
198 Xcursor looks for a specific file,
199 which must be one of the cursor \fIshape\fP names,
200 e.g., as used in XcursorLibraryLoadImage or XcursorLibraryShape.
201 .bP
202 If it finds no matching cursor file in the \*(``cursors\*('' subdirectory,
203 Xcursor next looks for an \*(``index.theme\*('' file
204 in each theme directory to look for inherited themes.
205 Those are lines in this format:
206 .sp
207 .RS
208 Inherits = \fItheme-name\fP
209 .PP
210 Xcursor uses the first inherited \fItheme-name\fP,
211 ignoring others which may exist in a given \*(``index.theme\*('' file.
212 If it finds an inherited theme, Xcursor searches along the path to use
213 that as well.
214 Xcursor ignores other \fIkeys\fP in the \*(``index.theme\*('' file,
215 including \*(``Name\*('' (i.e., the name which a graphical
216 application may use as the \fIpresentation name\fP).
217 .PP
218 More than one \fItheme-name\fP may be listed on the \fBInherits=\fP line.
219 The freedesktop.org spec states that list items are separated by commas.
220 Xcursor also accepts semicolon,
221 but translates both to colon when searching the path.
222 Xcursor expects only one \fBInherits=\fP line;
223 the freedesktop.org spec is unclear whether multiple keys are allowed.
224 .RE
225 .PP
226 If no theme is set, or if no cursor is found for the specified theme
227 anywhere along the path,
228 Xcursor checks the \*(``default\*('' theme.
229 .PP
230 When Xcursor finds a cursor file, it stops searching.
231 It always uses the first cursor file found while searching along the path.
232 .
233 .SH DATATYPES
234 .
235 .TP
236 .B XcursorImage
237 holds a single cursor image in memory.
238 Each pixel in the cursor is a 32-bit
239 value containing ARGB with A in the high byte.
240 .sp
241 .QC
242 typedef struct _XcursorImage {
243 XcursorDim size; /* nominal size for matching */
244 XcursorDim width; /* actual width */
245 XcursorDim height; /* actual height */
246 XcursorDim xhot; /* hot spot x (must be inside image) */
247 XcursorDim yhot; /* hot spot y (must be inside image) */
248 XcursorPixel *pixels; /* pointer to pixels */
249 } XcursorImage;
250 .QE
251 .
252 .TP
253 .B XcursorImages
254 holds multiple XcursorImage structures.
255 They are all freed when the
256 XcursorImages is freed in XcursorImagesDestroy.
257 .sp
258 .QC
259 typedef struct _XcursorImages {
260 int nimage; /* number of images */
261 XcursorImage **images; /* array of XcursorImage pointers */
262 } XcursorImages;
263 .QE
264 .
265 .TP
266 .B XcursorCursors
267 Holds multiple Cursor objects.
268 They are all freed when the XcursorCursors is freed.
269 These are reference counted so that multiple XcursorAnimate
270 structures can use the same XcursorCursors.
271 .sp
272 .QC
273 typedef struct _XcursorCursors {
274 Display *dpy; /* Display holding cursors */
275 int ref; /* reference count */
276 int ncursor; /* number of cursors */
277 Cursor *cursors; /* array of cursors */
278 } XcursorCursors;
279 .QE
280 .
281 .TP
282 .B XcursorAnimate
283 References a set of cursors and a sequence within that set.
284 Multiple
285 XcursorAnimate structures may reference the same XcursorCursors; each
286 holds a reference which is removed when the XcursorAnimate is freed.
287 .sp
288 .QC
289 typedef struct _XcursorAnimate {
290 XcursorCursors *cursors; /* list of cursors to use */
291 int sequence; /* which cursor is next */
292 } XcursorAnimate;
293 .QE
294 .
295 .TP
296 .B XcursorFile
297 Xcursor provides an abstract API for accessing the file data.
298 Xcursor provides a stdio implementation of this abstract API; applications
299 are free to create additional implementations.
300 These functions
301 parallel the stdio functions in return value and expected argument values;
302 the read and write functions flip the arguments around to match the POSIX
303 versions.
304 .sp
305 .QC
306 typedef struct _XcursorFile {
307 void *closure;
308 int (*read) (XcursorFile *file, unsigned char *buf, int len);
309 int (*write) (XcursorFile *file, unsigned char *buf, int len);
310 int (*seek) (XcursorFile *file, long offset, int whence);
311 };
312 .QE
313 .
314 .SH FUNCTIONS
315 .
316 .SS "Object Management"
317 .PS
318 XcursorImage *XcursorImageCreate (
319 int \fIwidth\fP,
320 int \fIheight\fP)
321 .PC
322 void XcursorImageDestroy (
323 XcursorImage *\fIimage\fP)
324 .PE
325 Allocate and free images.
326 On allocation, the hotspot and the pixels are left uninitialized.
327 The size is set to the maximum of \fIwidth\fP and \fIheight\fP.
328 .
329 .PS
330 XcursorImages *XcursorImagesCreate (
331 int \fIsize\fP)
332 .PC
333 void XcursorImagesDestroy (
334 XcursorImages *\fIimages\fP)
335 .PE
336 Allocate and free arrays to hold multiple cursor images.
337 On allocation, \fInimage\fP is set to zero.
338 .
339 .PS
340 XcursorCursors *XcursorCursorsCreate (
341 Display *\fIdpy\fP,
342 int \fIsize\fP)
343 .PC
344 void XcursorCursorsDestroy (
345 XcursorCursors *\fIcursors\fP)
346 .PE
347 Allocate and free arrays to hold multiple cursors.
348 On allocation, \fIncursor\fP is set to zero, \fIref\fP is set to one.
349 .
350 .
351 .SS "Reading and writing images"
352 .
353 .PS
354 XcursorImage *XcursorXcFileLoadImage (
355 XcursorFile *\fIfile\fP,
356 int \fIsize\fP)
357 .PC
358 XcursorImages *XcursorXcFileLoadImages (
359 XcursorFile *\fIfile\fP,
360 int \fIsize\fP)
361 .PC
362 XcursorImages *XcursorXcFileLoadAllImages (
363 XcursorFile *\fIfile\fP)
364 .PC
365 XcursorBool XcursorXcFileLoad (
366 XcursorFile *\fIfile\fP,
367 XcursorComments **\fIcommentsp\fP,
368 XcursorImages **\fIimagesp\fP)
369 .PC
370 XcursorBool XcursorXcFileSave (
371 XcursorFile *\fIfile\fP,
372 const XcursorComments *\fIcomments\fP,
373 const XcursorImages *\fIimages\fP)
374 .PE
375 These read and write cursors from an XcursorFile handle.
376 After reading, the file pointer will be left at some random place in the file.
377 .
378 .PS
379 XcursorImage *XcursorFileLoadImage (
380 FILE *\fIfile\fP,
381 int \fIsize\fP)
382 .PC
383 XcursorImages *XcursorFileLoadImages (
384 FILE *\fIfile\fP,
385 int \fIsize\fP)
386 .PC
387 XcursorImages *XcursorFileLoadAllImages (
388 FILE *\fIfile\fP)
389 .PC
390 XcursorBool XcursorFileLoad (
391 FILE *\fIfile\fP,
392 XcursorComments **\fIcommentsp\fP,
393 XcursorImages **\fIimagesp\fP)
394 .PC
395 XcursorBool XcursorFileSaveImages (
396 FILE *\fIfile\fP,
397 const XcursorImages *\fIimages\fP)
398 .PC
399 XcursorBool XcursorFileSave (
400 FILE *\fIfile\fP,
401 const XcursorComments *\fIcomments\fP,
402 const XcursorImages *\fIimages\fP)
403 .PE
404 These read and write cursors from a stdio FILE handle.
405 Writing flushes before returning so that any errors should be detected.
406 .
407 .PS
408 XcursorImage *XcursorFilenameLoadImage (
409 const char *\fIfilename\fP,
410 int \fIsize\fP)
411 .PC
412 XcursorImages *XcursorFilenameLoadImages (
413 const char *\fIfilename\fP,
414 int \fIsize\fP)
415 .PC
416 XcursorImages *XcursorFilenameLoadAllImages (
417 const char *\fIfile\fP)
418 .PC
419 XcursorBool XcursorFilenameLoad (
420 const char *\fIfile\fP,
421 XcursorComments **\fIcommentsp\fP,
422 XcursorImages **\fIimagesp\fP)
423 .PC
424 XcursorBool XcursorFilenameSaveImages (
425 const char *\fIfilename\fP,
426 const XcursorImages *\fIimages\fP)
427 .PC
428 XcursorBool XcursorFilenameSave (
429 const char *\fIfile\fP,
430 const XcursorComments *\fIcomments\fP,
431 const XcursorImages *\fIimages\fP)
432 .PE
433 These parallel the stdio FILE interfaces above, but take filenames.
434 .
435 .SS "Reading library images"
436 .PS
437 XcursorImage *XcursorLibraryLoadImage (
438 const char *\fIname\fP,
439 const char *\fItheme\fP,
440 int \fIsize\fP)
441 .PC
442 XcursorImages *XcursorLibraryLoadImages (
443 const char *\fIname\fP,
444 const char *\fItheme\fP,
445 int \fIsize\fP)
446 .PE
447 These search the library path, loading the first file found
448 of the desired \fIsize\fP,
449 using a private function (XcursorScanTheme) to find the appropriate theme:
450 .RS
451 .bP
452 If \fItheme\fP is not NULL, use that.
453 .bP
454 If \fItheme\fP is NULL, or if there was no match for the desired theme,
455 use \*(``default\*('' for the theme name.
456 .bP
457 If neither search succeeds,
458 these functions return NULL.
459 .RE
460 .IP
461 The two functions differ by more than the number of images loaded:
462 .RS
463 .bP
464 XcursorLibraryLoadImage calls XcursorFileLoadImage but
465 .bP
466 XcursorLibraryLoadImages calls XcursorFileLoadImages,
467 and (on success)
468 it calls XcursorImagesSetName to associate \fIname\fP with the result.
469 .RE
470 .
471 .SS "Library attributes"
472 .PS
473 const char * XcursorLibraryPath (void)
474 .PE
475 Returns the library search path:
476 .RS
477 .bP
478 If the environment variable \fBXCURSOR_PATH\fP is set,
479 return that value.
480 .bP
481 Otherwise, return the compiled-in search path.
482 .RE
483 .
484 .PC
485 int XcursorLibraryShape (
486 const char *\fIlibrary\fP)
487 .PE
488 Search Xcursor's table of cursor font names for the given
489 \*(``shape name\*('' (\fIlibrary\fP):
490 .RS
491 .bP
492 If found, return the index into that table,
493 multiplied by two (to account for the source- and mask-values
494 used in an X cursor font).
495 .bP
496 If not found, return -1.
497 .RE
498 .
499 .SS "Cursor APIs"
500 .
501 .PS
502 Cursor XcursorFilenameLoadCursor (
503 Display *\fIdpy\fP,
504 const char *\fIfile\fP)
505 .PC
506 XcursorCursors *XcursorFilenameLoadCursors (
507 Display *\fIdpy\fP,
508 const char *\fIfile\fP)
509 .PE
510 These load cursors from the specified file.
511 .
512 .PS
513 Cursor XcursorLibraryLoadCursor (
514 Display *\fIdpy\fP,
515 const char *\fIname\fP)
516 .PC
517 XcursorCursors *XcursorLibraryLoadCursors (
518 Display *\fIdpy\fP,
519 const char *\fIname\fP)
520 .PE
521 These load cursors using the specified library \fIname\fP. The theme
522 comes from the display.
523 .
524 .PS
525 Cursor XcursorImageLoadCursor(
526 Display *\fIdpy\fP,
527 const XcursorImage *\fIimage\fP)
528 .PE
529 This creates a cursor, given the image to display.
530 It calls XcursorSupportsARGB to decide what type of cursor to create:
531 .RS
532 .bP
533 XRenderCreateCursor is used if ARGB is supported on the display, and
534 .bP
535 XCreatePixmapCursor is used otherwise.
536 .RE
537 .
538 .PC
539 Cursor XcursorImagesLoadCursor(
540 Display *\fIdpy\fP,
541 const XcursorImages *\fIimages\fP)
542 .PE
543 This provides an interface for creating animated cursors,
544 if the \fIimages\fP array contains multiple images, and
545 if XcursorSupportsAnim returns true.
546 Otherwise, it calls XcursorImageLoadCursor.
547 .
548 .PS
549 XcursorCursors *XcursorImagesLoadCursors(
550 Display *\fIdpy\fP,
551 const XcursorImages *\fIimages\fP)
552 .PE
553 This calls XcursorCursorsCreate to create an array of XcursorCursors,
554 to correspond to the XcursorImages \fIimages\fP array,
555 and uses XcursorImageLoadCursor to load the corresponding cursor data.
556 .IP
557 Normally it returns the resulting array pointer.
558 On any failure, it discards the result XcursorCursorsDestroy,
559 and returns NULL.
560 .
561 .SS "X Cursor Name APIs"
562 .
563 .PS
564 XcursorImage *XcursorShapeLoadImage (
565 unsigned int \fIshape\fP,
566 const char *\fItheme\fP,
567 int \fIsize\fP)
568 .PC
569 XcursorImages *XcursorShapeLoadImages (
570 unsigned int \fIshape\fP,
571 const char *\fItheme\fP,
572 int \fIsize\fP)
573 .PE
574 These map \fIshape\fP to a library name using the standard X cursor names and
575 then load the images.
576 .
577 .PS
578 Cursor XcursorShapeLoadCursor (
579 Display *\fIdpy\fP,
580 unsigned int \fIshape\fP)
581 .PC
582 XcursorCursors *XcursorShapeLoadCursors (
583 Display *\fIdpy\fP,
584 unsigned int \fIshape\fP)
585 .PE
586 These map \fIshape\fP to a library name and then load the cursors.
587 .
588 .SS "X Cursor Comment APIs"
589 .PS
590 XcursorComment *XcursorCommentCreate (
591 XcursorUInt \fIcomment_type\fP,
592 int \fIlength\fP)
593 .PE
594 XcursorXcFileLoad uses this function to allocate an XcursorComment
595 structure for a single cursor.
596 The \fIcomment_type\fP parameter is used as the \fIsubtype\fP field,
597 e.g., COPYRIGHT.
598 The \fIlength\fP is the number of bytes to allocate for the comment text.
599 .
600 .PS
601 void XcursorCommentDestroy(
602 XcursorComment *\fIcomment\fP)
603 .PE
604 Deallocates the given XcursorComment structure.
605 .
606 .PS
607 XcursorComments * XcursorCommentsCreate (
608 int \fIsize\fP)
609 .PE
610 XcursorXcFileLoad uses this function to allocate an index of
611 XcursorComment structure pointers.
612 The \fIsize\fP parameter tells it how many pointers will be in the index.
613 .
614 .PS
615 void XcursorCommentsDestroy (
616 XcursorComments *\fIcomments\fP)
617 .PE
618 Deallocates the given XcursorComments structure
619 as well as the XcursorComment structures which it points to.
620 .
621 .SS "Animated Cursors"
622 .PS
623 XcursorAnimate * XcursorAnimateCreate (
624 XcursorCursors *\fIcursors\fP)
625 .PE
626 Wrap the given array of cursors in a newly allocated XcursorAnimate structure,
627 which adds a sequence number used in XcursorAnimateNext.
628 .
629 .PS
630 void XcursorAnimateDestroy (
631 XcursorAnimate *\fIanimate\fP)
632 .PE
633 Discards the given \fIanimate\fP data,
634 freeing both the XcursorCursors array of cursors
635 as well as the XcursorAnimate structure.
636 .
637 .PS
638 Cursor XcursorAnimateNext (
639 XcursorAnimate *\fIanimate\fP)
640 .PE
641 Cyclically returns the next Cursor in the array,
642 incrementing the sequence number to prepare for the next call.
643 .IP
644 The caller is responsible for displaying the series of Cursor images.
645 Xcursor does not do that.
646 .
647 .SS "Glyph Cursor APIs"
648 The X11 XCreateFontCursor and XCreateGlyphCursor functions use
649 this part of the API to extend the X core cursors feature to use themes.
650 .PS
651 void XcursorImageHash (
652 XImage *\fIimage\fP,
653 unsigned char \fIhash\fP[XCURSOR_BITMAP_HASH_SIZE])
654 .PE
655 Compute a hash of the image,
656 to display when the environment variable XCURSOR_DISCOVER is set.
657 .
658 .PS
659 void XcursorImagesSetName (
660 XcursorImages *\fIimages\fP,
661 const char *\fIname\fP)
662 .PE
663 Associates the given name with the images.
664 .
665 .PS
666 void XcursorNoticeCreateBitmap (
667 Display *\fIdpy\fP,
668 Pixmap \fIpid\fP,
669 unsigned int \fIwidth\fP,
670 unsigned int \fIheight\fP)
671 .PE
672 Check if the display supports either ARGB or themes,
673 and also if the image size fits within the maximum cursor size (64 pixels).
674 If so, create a bitmap of the specified size,
675 and cache the result in Xcursor,
676 identifying it with the Pixmap-id (pid) value.
677 .
678 .PS
679 void XcursorNoticePutBitmap (
680 Display *\fIdpy\fP,
681 Drawable \fIdraw\fP,
682 XImage *\fIimage\fP)
683 .PE
684 Update the image contents in the bitmap specified by the draw value
685 (a Pixmap-id).
686 The bitmap must have been created by XcursorNoticeCreateBitmap.
687 .
688 .PS
689 Cursor XcursorTryShapeBitmapCursor (
690 Display *\fIdpy\fP,
691 Pixmap \fIsource\fP,
692 Pixmap \fImask\fP,
693 XColor *\fIforeground\fP,
694 XColor *\fIbackground\fP,
695 unsigned int \fIx\fP,
696 unsigned int \fIy\fP)
697 .PE
698 If the display supports either ARGB or themes,
699 try to load a cursor into Xcursor's cache
700 using the \fIsource\fP parameter as a Pixmap-id.
701 The source may no longer be in the cache.
702 Xcursor uses the hash value to identify the desired image.
703 .
704 .PS
705 Cursor XcursorTryShapeCursor (
706 Display *\fIdpy\fP,
707 Font \fIsource_font\fP,
708 Font \fImask_font\fP,
709 unsigned int \fIsource_char\fP,
710 unsigned int \fImask_char\fP,
711 XColor _Xconst *\fIforeground\fP,
712 XColor _Xconst *\fIbackground\fP)
713 .PE
714 If the display supports either ARGB or themes,
715 try to load a cursor into Xcursor's cache
716 using the \fIsource_char\fP parameter as a shape.
717 Using
718 .RS
719 .bP
720 the default size from XcursorGetDefaultSize,
721 .bP
722 the default theme from XcursorGetTheme, and
723 .bP
724 the \fIsource_char\fP parameter as a shape,
725 .RE
726 .IP
727 Xcursor calls XcursorShapeLoadImages to load the cursor images.
728 If successful, Xcursor uses XcursorImagesLoadCursor
729 to load the cursor information.
730 .
731 .SS "Display Information APIs"
732 .
733 .PS
734 XcursorBool XcursorSupportsARGB (
735 Display *\fIdpy\fP)
736 .PE
737 Returns true if the display supports ARGB cursors.
738 Otherwise, cursors will be mapped to a core X cursor.
739 .
740 .PS
741 XcursorBool XcursorSupportsAnim (
742 Display *\fIdpy\fP)
743 .PE
744 Returns true if the display supports animated cursors.
745 Otherwise, cursors will be mapped to a core X cursor.
746 .
747 .PS
748 XcursorBool XcursorSetDefaultSize (
749 Display *\fIdpy\fP,
750 int \fIsize\fP)
751 .PE
752 Sets the default size for cursors on the specified display.
753 When loading cursors,
754 those whose nominal size is closest to this size will be preferred.
755 .
756 .PS
757 int XcursorGetDefaultSize (
758 Display *\fIdpy\fP)
759 .PE
760 Gets the default cursor size.
761 .
762 .PS
763 XcursorBool XcursorSetResizable (
764 Display *\fIdpy\fP,
765 XcursorBool \fIresizable\fP)
766 .PE
767 Sets the current resizable-cursors state.
768 .
769 .PS
770 XcursorBool XcursorGetResizable (
771 Display *\fIdpy\fP)
772 .PE
773 Gets the current resizable-cursors state.
774 .
775 .
776 .PS
777 XcursorBool XcursorSetTheme (
778 Display *\fIdpy\fP,
779 const char *\fItheme\fP)
780 .PE
781 Sets the current theme name.
782 .
783 .PS
784 char *XcursorGetTheme (
785 Display *\fIdpy\fP)
786 .PE
787 Gets the current theme name.
788 .
789 .PC
790 XcursorBool XcursorGetThemeCore (
791 Display *\fIdpy\fP)
792 .PC
793 XcursorBool XcursorSetThemeCore (
794 Display *\fIdpy\fP,
795 XcursorBool \fItheme_core\fP)
796 .PE
797 Get or set property which tells Xcursor whether to
798 enable themes for core cursors.
799 .
800 .SH ENVIRONMENT
801 Environment variables can be used to override resource settings,
802 which in turn override compiled-in default values.
803 .PP
804 Some of the environment variables recognized by Xcursor are booleans,
805 specified as follows:
806 .RS 3
807 .TP 5
808 \fItrue\fP for \*(``t\*('', \*(``1\*('', \*(``y\*('' or \*(``on\*(''
809 .TP 5
810 \fIfalse\fP for \*(``f\*('', \*(``0\*('', \*(``n\*('' or \*(``off\*(''
811 .RE
812 .PP
813 Xcursor ignores other values for these booleans.
814 .TP 15
815 .B HOME
816 Xcursor interprets \*(``~\*('' in the search list as the home directory,
817 using this variable rather than the password database.
818 .TP 15
819 .B XCURSOR_ANIM
820 If the display supports the Render CreateCursor request,
821 and the Render feature is enabled,
822 disable \fIanimated\fP cursors if the environment variable is \fIfalse\fP.
823 .IP
824 If the environment variable is not given,
825 Xcursor uses the resource \fBXcursor.anim\fP.
826 .TP 15
827 .B XCURSOR_CORE
828 If the display supports the Render CreateCursor request
829 disable the Render feature if the environment variable is \fIfalse\fP.
830 .IP
831 If the environment variable is not given,
832 Xcursor uses the resource \fBXcursor.core\fP.
833 .TP 15
834 .B XCURSOR_DISCOVER
835 If the variable is set, Xcursor turns on a logging feature.
836 It displays the hash value and the image so that users can see which
837 cursor name is associated with each image.
838 .IP
839 There is no corresponding resource setting.
840 .TP 15
841 .B XCURSOR_DITHER
842 This variable sets the desired \fIdither\fP.
843 .IP
844 If the environment variable is not given,
845 Xcursor uses the resource \fBXcursor.dither\fP.
846 .IP
847 If neither environment variable or resource is found,
848 Xcursor uses \*(``threshold\*(''
849 .IP
850 These are the recognized values:
851 .RS 18
852 .TP 5
853 .B diffuse
854 .TP 5
855 .B median
856 .TP 5
857 .B ordered
858 .TP 5
859 .B threshold
860 .RE
861 .TP 15
862 .B XCURSOR_PATH
863 This variable sets the list of paths in which to search for cursors,
864 rather than the compiled-in default list.
865 .IP
866 Directories in this path are separated by colons (:).
867 .TP 15
868 .B XCURSOR_RESIZED
869 Enables automatic resizing of cursors to improve their displayed size
870 if the environment variable is \fItrue\fP.
871 .IP
872 If the environment variable is not given,
873 Xcursor tries the \fBXcursor.resized\fP resource.
874 .TP 15
875 .B XCURSOR_SIZE
876 This variable sets the desired cursor size, in pixels.
877 .IP
878 If the environment variable is not given,
879 Xcursor tries the \fBXcursor.size\fP resource.
880 .IP
881 If no size is given, whether by environment variable or resource setting,
882 Xcursor next tries the \fBXft.dpi\fP resource setting to guess
883 the size of a 16-point cursor.
884 .IP
885 Finally, if \fBXft.dpi\fP is not set,
886 Xcursor uses the display height,
887 dividing by 48 (assuming that the height is 768).
888 .TP 15
889 .B XCURSOR_THEME
890 This variable selects the desired \fItheme\fP.
891 .IP
892 If the environment variable is not given,
893 Xcursor tries the \fBXcursor.theme\fP resource.
894 .IP
895 If neither environment variable or resource is found,
896 Xcursor uses the \fIdefault\fP theme.
897 .TP 15
898 .B XCURSOR_THEME_CORE
899 Enables themes for core cursors if the environment variable is \fItrue\fP.
900 .IP
901 If the environment variable is not given,
902 Xcursor tries the \fBXcursor.theme_core\fP resource.
903 .IP
904 An application can enable or disable themes using XcursorSetThemeCore.
905 .
906 .SH CAVEATS
907 .B Xcursor
908 will probably change radically in the future; weak attempts will be made to
909 retain some level of source-file compatibility.
910 .
911 .SH AUTHORS
912 Keith Packard
913 Thomas E. Dickey
914 .
915 .SH SEE ALSO
916 .na
917 XCreateRenderCursor(__libmansuffix__),
918 XCreatePixmapCursor(__libmansuffix__), and
919 XCreateFontCursor(__libmansuffix__)
920 .ad
921 .PP
922 as well as
923 .IP
924 \fIIcon Theme Specification\fP
925 .br
926 https://specifications.freedesktop.org/icon-theme-spec/