diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-07-04 08:10:31 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-07-04 08:10:31 +0000 |
commit | e24a82532822f3ba768040970102f96251283b59 (patch) | |
tree | 329393c72aa64c6ed0f6545c628e2dcee178df45 /lib/libXcursor | |
parent | 3f117c4114d8349c6fb662baee17ad257a95f36f (diff) |
Uodate libXcursor to version 1.2.1
Bug fixes and documentation improvements
Diffstat (limited to 'lib/libXcursor')
-rw-r--r-- | lib/libXcursor/COPYING | 2 | ||||
-rw-r--r-- | lib/libXcursor/ChangeLog | 375 | ||||
-rw-r--r-- | lib/libXcursor/Makefile.in | 7 | ||||
-rw-r--r-- | lib/libXcursor/README.md | 2 | ||||
-rw-r--r-- | lib/libXcursor/aclocal.m4 | 16 | ||||
-rw-r--r-- | lib/libXcursor/configure | 44 | ||||
-rw-r--r-- | lib/libXcursor/configure.ac | 6 | ||||
-rw-r--r-- | lib/libXcursor/include/X11/Xcursor/Xcursor.h.in | 3 | ||||
-rw-r--r-- | lib/libXcursor/man/Makefile.am | 70 | ||||
-rw-r--r-- | lib/libXcursor/man/Makefile.in | 71 | ||||
-rw-r--r-- | lib/libXcursor/man/Xcursor.man | 1081 | ||||
-rw-r--r-- | lib/libXcursor/src/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libXcursor/src/cursor.c | 87 | ||||
-rw-r--r-- | lib/libXcursor/src/display.c | 10 | ||||
-rw-r--r-- | lib/libXcursor/src/file.c | 80 | ||||
-rw-r--r-- | lib/libXcursor/src/library.c | 155 | ||||
-rw-r--r-- | lib/libXcursor/src/xlib.c | 10 |
17 files changed, 1510 insertions, 510 deletions
diff --git a/lib/libXcursor/COPYING b/lib/libXcursor/COPYING index 8d01a81ac..6d9f423cd 100644 --- a/lib/libXcursor/COPYING +++ b/lib/libXcursor/COPYING @@ -1,4 +1,4 @@ -Copyright © 2002 Keith Packard +Copyright © 2002 Keith Packard Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that diff --git a/lib/libXcursor/ChangeLog b/lib/libXcursor/ChangeLog index 5fdff0e01..0572a6c60 100644 --- a/lib/libXcursor/ChangeLog +++ b/lib/libXcursor/ChangeLog @@ -1,3 +1,372 @@ +commit 27adb16027fa99d83818a0ed9f6623cb03f0c574 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Apr 3 09:55:44 2022 -0700 + + libXcursor 1.2.1 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit e864ad83068016c121962a0bbe8dde26755bf26f +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Apr 3 09:43:29 2022 -0700 + + gitlab CI: add a basic build test + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit f0d8a59186d415101040e7761b6cc6adfce36c5d +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Apr 3 09:22:14 2022 -0700 + + Build xz tarballs instead of bzip2 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit d223fce4c7b2792ccc32e4b68090ac2d92d49f09 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Apr 3 09:21:29 2022 -0700 + + Fix spelling/wording issues + + Found by using: + codespell --builtin clear,rare,usage,informal,code,names + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 66accad188420c40f0d62b409bfd2af605bb6f05 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Apr 3 09:19:14 2022 -0700 + + Convert COPYING from ISO-8859-1 to UTF-8 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 801925839d26e7c8d942c5e02c4897652ead26c8 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu May 6 20:10:41 2021 -0400 + + more cppcheck-style fixes + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit f807ac9c786714ef4e86ad7edfa60f92baf0b4a6 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon May 3 20:25:43 2021 -0400 + + cppcheck style-fixes + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 13ca987eafed426d5347bafdf274ad59e2641650 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue May 4 04:20:14 2021 -0400 + + mention "Inherits=" lists + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 6edf1caf6fe6826b3727ab19ba9e4d7ad163a48e +Author: Tobias Stoeckmann <tobias@stoeckmann.org> +Date: Tue May 4 18:30:53 2021 +0200 + + fix XcursorTheme loop regression + + Handle themes with multiple inherit entries. Although the previous + commit keeped track of inherited themes, it only handled multiple theme + entries on the highest level. + + This fix unconditionally checks if the next upper level contains a line. + If it does, it processes contained themes (i.e. the current theme had an + inherited entry in its index file). + + If the upper level has no more themes, it goes down a level and + processes the next theme there. If no next theme exists, it moves down + another level and so on until it reaches level 0, i.e. the initially + supplied theme. + + The lowest level (d = 0) is treated specially because we must not modify + the supplied theme, which could happen when calling _XcursorNextPath. + + Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> + +commit b47ca9858ee11bdbd08f1e31102116ff51cb6be5 +Author: Tobias Stoeckmann <tobias@stoeckmann.org> +Date: Sun May 2 16:00:25 2021 +0200 + + Handle more theme loop situations + + This is a follow up for commit f64a8cc1a65dcad4294e2988b402a34175019663 + resulting from https://bugs.freedesktop.org/show_bug.cgi?id=3603 + + The current loop detection only works for direct self references but not + for transitive ones. Limiting the inheritance depth fixes this issue as + suggested by Keith Packard. + + I avoided the introduction of a recursion function. Instead I modified + XcursorScanTheme to work iterative. + + The current recursion code adds the "Inherits=..." line to heap and has + an iteration variable to go through all themes listed in that line per + recursion. This is covered with the newly introduced XcursorInherit + struct with its fields "line" and "theme". Since "theme" points into + "line", only "line" has to be freed eventually. + + If a fixed inheritage limit of 32 is reached, the code stops processing + and returns NULL. It also returns NULL if it detects the initial theme + in one of the inheritages to break the loop early on. + + Last but not least I removed the printf statement. The only situation in + which libXcursor writes to stdout is when it is explicitly requested. + + Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> + +commit 403bb32d5fb0dbb9e83ec7a5743b2fee75445ea7 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Mar 19 17:08:42 2021 -0400 + + eliminate special escaping for "/*" which produces look-alike Unicode for + newer groff (making select/paste useless), but is not necessary with + groff, mandoc or Solaris 10 nroff. + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 1ab5ffa9e394bf51f90893210fc6f1e3849891ab +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Mar 18 10:29:49 2021 -0400 + + fix a typo and a style issue + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 9898afadfbe000159cbaaa0c4dc11c1fb09bde5b +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Mar 17 19:07:19 2021 -0400 + + update copyright notice + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit d64dda62def8318ddf613918f6b7a652aafb1471 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Mar 17 18:52:16 2021 -0400 + + fix raggedy prototypes and structure declarations using tabstops in appropriate macros + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 8560016436dc521b373c5bb25860e009fa4e291d +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Mar 16 20:36:15 2021 -0400 + + document the API called from libX11 + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit bacd41c0c068c5f55b635a4887b4185ad2e3ea10 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Mar 16 19:34:51 2021 -0400 + + document the cursor-comments functions + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 821254578e15440d2177fff0b61f73590ae29869 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Mar 16 18:21:47 2021 -0400 + + document the animation support functions + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 2695829868243d41db5b47c9269423caca8dd1b4 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Mar 16 18:00:22 2021 -0400 + + improve explanation of Xcursor's search algorithm + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 80cd802e0c2bf3af730dc7f852cb80c713e9db6c +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Mar 16 16:40:03 2021 -0400 + + start on the animated cursors; fixup whitespace + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 36650c9455428f007f4feb682ecbc9385e31ce71 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Mar 16 15:52:39 2021 -0400 + + update ".so" links, and fix a special case for "const char *" in parsing function-names + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 23a0faa12948bfd9cc18ecb95025007c9261c2dd +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Mar 16 04:25:38 2021 -0400 + + document the cursor-load functions + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 5b15abee96488c4771228ac6020c67c0d59d5100 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Mar 16 03:58:23 2021 -0400 + + add see-also section + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 8ca8885d3153d6091e7c7b0a8c9510cd487cd583 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Mar 15 20:24:39 2021 -0400 + + document the library-attributes + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 61adeda1d32b1f298551d51616286bff104fcd69 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Mar 15 19:49:27 2021 -0400 + + document the theme_core setter/getter functions + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit f5b6dc1af2398ce2e55d0e71d91b12e6612e1f3e +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Mar 15 19:32:12 2021 -0400 + + improve explanation for functions which load images + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit bd591012ed1521d4d6dd602f831f13bd57d6782b +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Mar 15 19:00:14 2021 -0400 + + italicize parameter names, for readability + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 438e798b34c7ef7c52455247cb5361eab728fe76 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Mar 15 18:47:03 2021 -0400 + + correct a prototype + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit a383f6cc5d64715012e7c53c70a624c303103d4d +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun Mar 14 19:24:48 2021 -0400 + + further formatting fixes. added script to create/find ".so" files which are missing + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 1fd32263c0d11310b7d04f34f43051f802cc8ea7 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun Mar 14 17:18:59 2021 -0400 + + make the function-prototypes easier to read, by eliminating hyphenation and filling + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 979809b752773eacba6737095b1a4174cd5cf744 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Mar 11 20:17:08 2021 -0500 + + document the other environment variables + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit fb377b9a71dbc0a6d52d61eed4d47f99bb06d584 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Mar 11 18:28:05 2021 -0500 + + amend that... + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 362fdcfc3ed7fd0841c48c2a7b6f3fc3af5d5cdb +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Mar 11 18:26:48 2021 -0500 + + add check in case the image size is 0x0 + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 09f69a8829fea8939afda32fe4f25f1eda57085d +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Mar 11 18:04:23 2021 -0500 + + fix stricter gcc warnings using casts + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 152f8e45db1d2cceeceac6ae8dafb9b48d20d8e8 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Mar 11 17:24:36 2021 -0500 + + fix stricter gcc warnings using casts + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 628cde0575a1e3819e73fa631d6532f9f5409e14 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Mar 11 17:18:31 2021 -0500 + + fix stricter gcc warnings by changing the type for the loop variable to + match the type of the loop limit + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit ce907e36e0869a4fcf89e2aeaa4d9d0cb52d7644 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Mar 11 04:14:45 2021 -0500 + + quiet warnings for unused parameters + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 7623dae73c71fd3bfc2b820e6c98eb99b36dba44 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Mar 10 19:41:43 2021 -0500 + + fix a missing initializer + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit cea72e14274d3288b641e14f6cf1171b97485790 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Mar 10 19:36:04 2021 -0500 + + quiet normal gcc warnings using casts (no object change) + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 204b6f130858ef038832887ea10488e7aed711a6 +Author: Valentin <vakevk+git@gmail.com> +Date: Sun Aug 30 15:37:19 2020 +0200 + + Fix undefined behavior + + Without the casts the bytes accesses get converted to int. but int is + not guaranteed to be 4 bytes large. Even when it is 4 bytes large + `bytes[3] << 24` does not fit because int is signed. + +commit 448398a3b97a77648e90cc993597bafb2ad95eac +Author: Valentin <vakevk+git@gmail.com> +Date: Sun Aug 30 15:35:16 2020 +0200 + + Use fixed size integer type + + This type is meant to be 4 bytes large as seen in _XcursorReadUInt which + always reads 4 bytes. An unsigned int is often 4 bytes large but this + isnt' guaranteed so it is cleaner to use the exact type we want. + commit b84b5d100f193fda0630c4d6fa889cd3e05ca033 Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Sun Mar 10 17:36:26 2019 -0700 @@ -927,19 +1296,19 @@ Date: Mon Jun 13 16:44:53 2005 +0000 Bug #1043: Fix leak when creating animated cursors. commit 89e52cde6eaf5e2d46198ee2fa16b67ef7e1dd32 -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Wed Jun 8 20:51:37 2005 +0000 Remove experiment with calling the man page file 4x commit 5589b4f6a36f2c039adc81fa4d406574eeef35b3 -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Wed Jun 8 20:44:18 2005 +0000 Remove all the not found with pkgconfig stuff commit 4070c0af6c7bfe12218181d56e8e3cbb86006d27 -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Wed Jun 8 19:15:43 2005 +0000 - Add Xcursor build system diff --git a/lib/libXcursor/Makefile.in b/lib/libXcursor/Makefile.in index 946961455..45ca44014 100644 --- a/lib/libXcursor/Makefile.in +++ b/lib/libXcursor/Makefile.in @@ -187,9 +187,9 @@ am__relativize = \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" -DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz GZIP_ENV = --best -DIST_TARGETS = dist-bzip2 dist-gzip +DIST_TARGETS = dist-xz dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -329,6 +329,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -643,6 +644,7 @@ distdir: $(DISTFILES) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) + dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) @@ -650,7 +652,6 @@ dist-bzip2: distdir dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) - dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) diff --git a/lib/libXcursor/README.md b/lib/libXcursor/README.md index 3765f3c0e..53be44430 100644 --- a/lib/libXcursor/README.md +++ b/lib/libXcursor/README.md @@ -6,7 +6,7 @@ Xorg mailing list: https://lists.x.org/mailman/listinfo/xorg -The master development code repository can be found at: +The primary development code repository can be found at: https://gitlab.freedesktop.org/xorg/lib/libXcursor diff --git a/lib/libXcursor/aclocal.m4 b/lib/libXcursor/aclocal.m4 index e7052124f..ff9ff5994 100644 --- a/lib/libXcursor/aclocal.m4 +++ b/lib/libXcursor/aclocal.m4 @@ -8606,9 +8606,9 @@ m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) -dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29.1) -dnl +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> dnl @@ -8649,7 +8649,7 @@ dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29.1]) +[m4_define([PKG_MACROS_VERSION], [0.29.2]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ @@ -8750,7 +8750,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no -AC_MSG_CHECKING([for $1]) +AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) @@ -8760,11 +8760,11 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs @@ -8781,7 +8781,7 @@ installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full diff --git a/lib/libXcursor/configure b/lib/libXcursor/configure index 591f56e62..4282e98b3 100644 --- a/lib/libXcursor/configure +++ b/lib/libXcursor/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libXcursor 1.2.0. +# Generated by GNU Autoconf 2.69 for libXcursor 1.2.1. # # Report bugs to <https://gitlab.freedesktop.org/xorg/lib/libXcursor/issues>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libXcursor' PACKAGE_TARNAME='libXcursor' -PACKAGE_VERSION='1.2.0' -PACKAGE_STRING='libXcursor 1.2.0' +PACKAGE_VERSION='1.2.1' +PACKAGE_STRING='libXcursor 1.2.1' PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/lib/libXcursor/issues' PACKAGE_URL='' @@ -763,6 +763,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -855,6 +856,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1107,6 +1109,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1244,7 +1255,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1357,7 +1368,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libXcursor 1.2.0 to adapt to many kinds of systems. +\`configure' configures libXcursor 1.2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1397,6 +1408,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1427,7 +1439,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libXcursor 1.2.0:";; + short | recursive ) echo "Configuration of libXcursor 1.2.1:";; esac cat <<\_ACEOF @@ -1558,7 +1570,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libXcursor configure 1.2.0 +libXcursor configure 1.2.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1973,7 +1985,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libXcursor $as_me 1.2.0, which was +It was created by libXcursor $as_me 1.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4116,7 +4128,7 @@ fi # Define the identity of the package. PACKAGE='libXcursor' - VERSION='1.2.0' + VERSION='1.2.1' cat >>confdefs.h <<_ACEOF @@ -17773,11 +17785,11 @@ fi -# Obtain compiler/linker options for depedencies +# Obtain compiler/linker options for dependencies pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XCURSOR" >&5 -$as_echo_n "checking for XCURSOR... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xrender >= 0.8.2 xfixes x11 fixesproto" >&5 +$as_echo_n "checking for xrender >= 0.8.2 xfixes x11 fixesproto... " >&6; } if test -n "$XCURSOR_CFLAGS"; then pkg_cv_XCURSOR_CFLAGS="$XCURSOR_CFLAGS" @@ -17817,7 +17829,7 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -17844,7 +17856,7 @@ Alternatively, you may set the environment variables XCURSOR_CFLAGS and XCURSOR_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} @@ -18512,7 +18524,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libXcursor $as_me 1.2.0, which was +This file was extended by libXcursor $as_me 1.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18578,7 +18590,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libXcursor config.status 1.2.0 +libXcursor config.status 1.2.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/lib/libXcursor/configure.ac b/lib/libXcursor/configure.ac index 5d11f79f0..3d713cda2 100644 --- a/lib/libXcursor/configure.ac +++ b/lib/libXcursor/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.60]) # This is the package version number, not the shared library # version. This version number will be substituted into Xcursor.h # -AC_INIT([libXcursor], [1.2.0], +AC_INIT([libXcursor], [1.2.1], [https://gitlab.freedesktop.org/xorg/lib/libXcursor/issues],[libXcursor]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h include/X11/Xcursor/Xcursor.h]) @@ -36,7 +36,7 @@ AC_CONFIG_HEADERS([config.h include/X11/Xcursor/Xcursor.h]) AC_USE_SYSTEM_EXTENSIONS # Initialize Automake -AM_INIT_AUTOMAKE([foreign dist-bzip2]) +AM_INIT_AUTOMAKE([foreign dist-xz]) # Initialize libtool AC_PROG_LIBTOOL @@ -78,7 +78,7 @@ AC_ARG_WITH(cursorpath, [XCURSORPATH=$DEF_CURSORPATH]) AC_SUBST([XCURSORPATH]) -# Obtain compiler/linker options for depedencies +# Obtain compiler/linker options for dependencies PKG_CHECK_MODULES(XCURSOR, xrender >= 0.8.2 xfixes x11 fixesproto) AC_DEFINE(HAVE_XFIXES, 1, [Define to 1 if you have Xfixes]) diff --git a/lib/libXcursor/include/X11/Xcursor/Xcursor.h.in b/lib/libXcursor/include/X11/Xcursor/Xcursor.h.in index 1a1438634..36400bf8c 100644 --- a/lib/libXcursor/include/X11/Xcursor/Xcursor.h.in +++ b/lib/libXcursor/include/X11/Xcursor/Xcursor.h.in @@ -23,11 +23,12 @@ #ifndef _XCURSOR_H_ #define _XCURSOR_H_ #include <stdio.h> +#include <stdint.h> #include <X11/Xfuncproto.h> #include <X11/Xlib.h> typedef int XcursorBool; -typedef unsigned int XcursorUInt; +typedef uint32_t XcursorUInt; typedef XcursorUInt XcursorDim; typedef XcursorUInt XcursorPixel; diff --git a/lib/libXcursor/man/Makefile.am b/lib/libXcursor/man/Makefile.am index f3f459949..3f5498539 100644 --- a/lib/libXcursor/man/Makefile.am +++ b/lib/libXcursor/man/Makefile.am @@ -5,37 +5,65 @@ libman_PRE = \ $(Xcursor_shadows:=.man) Xcursor_shadows = \ - XcursorImageCreate \ - XcursorImageDestroy \ - XcursorImagesCreate \ - XcursorImagesDestroy \ + XcursorAnimateCreate \ + XcursorAnimateDestroy \ + XcursorAnimateNext \ + XcursorCommentCreate \ + XcursorCommentDestroy \ + XcursorCommentsCreate \ + XcursorCommentsDestroy \ XcursorCursorsCreate \ XcursorCursorsDestroy \ - XcursorXcFileLoadImage \ - XcursorXcFileLoadImages \ - XcursorXcFileLoadAllImages \ - XcursorXcFileLoad \ - XcursorXcFileSave \ + XcursorFileLoad \ + XcursorFileLoadAllImages \ + XcursorFileLoadImage \ + XcursorFileLoadImages \ + XcursorFileSave \ + XcursorFileSaveImages \ + XcursorFilenameLoad \ + XcursorFilenameLoadAllImages \ + XcursorFilenameLoadCursor \ + XcursorFilenameLoadCursors \ XcursorFilenameLoadImage \ XcursorFilenameLoadImages \ - XcursorFilenameLoadAllImages \ - XcursorFilenameLoad \ - XcursorFilenameSaveImages \ XcursorFilenameSave \ - XcursorLibraryLoadImage \ - XcursorLibraryLoadImages \ - XcursorFilenameLoadCursor \ + XcursorFilenameSaveImages \ + XcursorGetDefaultSize \ + XcursorGetTheme \ + XcursorGetThemeCore \ + XcursorImageCreate \ + XcursorImageDestroy \ + XcursorImageHash \ + XcursorImageLoadCursor \ + XcursorImagesCreate \ + XcursorImagesDestroy \ + XcursorImagesLoadCursor \ + XcursorImagesLoadCursors \ + XcursorImagesSetName \ XcursorLibraryLoadCursor \ XcursorLibraryLoadCursors \ - XcursorShapeLoadImage \ - XcursorShapeLoadImages \ + XcursorLibraryLoadImage \ + XcursorLibraryLoadImages \ + XcursorLibraryPath \ + XcursorLibraryShape \ + XcursorNoticeCreateBitmap \ + XcursorNoticePutBitmap \ + XcursorSetDefaultSize \ + XcursorSetTheme \ + XcursorSetThemeCore \ XcursorShapeLoadCursor \ XcursorShapeLoadCursors \ + XcursorShapeLoadImage \ + XcursorShapeLoadImages \ XcursorSupportsARGB \ - XcursorSetDefaultSize \ - XcursorGetDefaultSize \ - XcursorSetTheme \ - XcursorGetTheme + XcursorSupportsAnim \ + XcursorTryShapeBitmapCursor \ + XcursorTryShapeCursor \ + XcursorXcFileLoad \ + XcursorXcFileLoadAllImages \ + XcursorXcFileLoadImage \ + XcursorXcFileLoadImages \ + XcursorXcFileSave libman_DATA = $(libman_PRE:man=@LIB_MAN_SUFFIX@) diff --git a/lib/libXcursor/man/Makefile.in b/lib/libXcursor/man/Makefile.in index 09c209ec5..3d747ce61 100644 --- a/lib/libXcursor/man/Makefile.in +++ b/lib/libXcursor/man/Makefile.in @@ -249,6 +249,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -263,37 +264,65 @@ libman_PRE = \ $(Xcursor_shadows:=.man) Xcursor_shadows = \ - XcursorImageCreate \ - XcursorImageDestroy \ - XcursorImagesCreate \ - XcursorImagesDestroy \ + XcursorAnimateCreate \ + XcursorAnimateDestroy \ + XcursorAnimateNext \ + XcursorCommentCreate \ + XcursorCommentDestroy \ + XcursorCommentsCreate \ + XcursorCommentsDestroy \ XcursorCursorsCreate \ XcursorCursorsDestroy \ - XcursorXcFileLoadImage \ - XcursorXcFileLoadImages \ - XcursorXcFileLoadAllImages \ - XcursorXcFileLoad \ - XcursorXcFileSave \ + XcursorFileLoad \ + XcursorFileLoadAllImages \ + XcursorFileLoadImage \ + XcursorFileLoadImages \ + XcursorFileSave \ + XcursorFileSaveImages \ + XcursorFilenameLoad \ + XcursorFilenameLoadAllImages \ + XcursorFilenameLoadCursor \ + XcursorFilenameLoadCursors \ XcursorFilenameLoadImage \ XcursorFilenameLoadImages \ - XcursorFilenameLoadAllImages \ - XcursorFilenameLoad \ - XcursorFilenameSaveImages \ XcursorFilenameSave \ - XcursorLibraryLoadImage \ - XcursorLibraryLoadImages \ - XcursorFilenameLoadCursor \ + XcursorFilenameSaveImages \ + XcursorGetDefaultSize \ + XcursorGetTheme \ + XcursorGetThemeCore \ + XcursorImageCreate \ + XcursorImageDestroy \ + XcursorImageHash \ + XcursorImageLoadCursor \ + XcursorImagesCreate \ + XcursorImagesDestroy \ + XcursorImagesLoadCursor \ + XcursorImagesLoadCursors \ + XcursorImagesSetName \ XcursorLibraryLoadCursor \ XcursorLibraryLoadCursors \ - XcursorShapeLoadImage \ - XcursorShapeLoadImages \ + XcursorLibraryLoadImage \ + XcursorLibraryLoadImages \ + XcursorLibraryPath \ + XcursorLibraryShape \ + XcursorNoticeCreateBitmap \ + XcursorNoticePutBitmap \ + XcursorSetDefaultSize \ + XcursorSetTheme \ + XcursorSetThemeCore \ XcursorShapeLoadCursor \ XcursorShapeLoadCursors \ + XcursorShapeLoadImage \ + XcursorShapeLoadImages \ XcursorSupportsARGB \ - XcursorSetDefaultSize \ - XcursorGetDefaultSize \ - XcursorSetTheme \ - XcursorGetTheme + XcursorSupportsAnim \ + XcursorTryShapeBitmapCursor \ + XcursorTryShapeCursor \ + XcursorXcFileLoad \ + XcursorXcFileLoadAllImages \ + XcursorXcFileLoadImage \ + XcursorXcFileLoadImages \ + XcursorXcFileSave libman_DATA = $(libman_PRE:man=@LIB_MAN_SUFFIX@) EXTRA_DIST = $(libman_PRE) diff --git a/lib/libXcursor/man/Xcursor.man b/lib/libXcursor/man/Xcursor.man index 4f01c7ed7..84980ce20 100644 --- a/lib/libXcursor/man/Xcursor.man +++ b/lib/libXcursor/man/Xcursor.man @@ -1,384 +1,903 @@ .\" +.\" Copyright © 2021 Thomas E. Dickey .\" Copyright © 2002 Keith Packard .\" -.\" Permission to use, copy, modify, distribute, and sell this software and its -.\" documentation for any purpose is hereby granted without fee, provided that -.\" the above copyright notice appear in all copies and that both that +.\" Permission to use, copy, modify, distribute, and sell this software and +.\" its documentation for any purpose is hereby granted without fee, provided +.\" that the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting -.\" documentation, and that the name of Keith Packard not be used in -.\" advertising or publicity pertaining to distribution of the software without -.\" specific, written prior permission. Keith Packard makes no -.\" representations about the suitability of this software for any purpose. It -.\" is provided "as is" without express or implied warranty. +.\" documentation, and that the name of the above copyright holders not be +.\" used in advertising or publicity pertaining to distribution of the +.\" software without specific, written prior permission. The above copyright +.\" holders make no representations about the suitability of this software for +.\" any purpose. It is provided "as is" without express or implied warranty. .\" -.\" KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -.\" EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR -.\" CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -.\" DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +.\" THE ABOVE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +.\" SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, +.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, +.\" INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.de TQ -.br +.de TA +.ie n .ta 0.8i 1.6i 2.4i 3.2i +.el .ta 0.5i 1.0i 1.5i 2.0i +.. +.de PS +.sp .ns .TP \\$1 +.na +.nf +.ie n .ta 0.8i 3.0i +.el .ta 0.5i 2.0i +.. +.de PE +.br +.ad +.fi +.sp +.TA +.. +.de QS +.in +.2i +.nf +.na +.ie n .ta 1.0i 3.0i +.el .ta 0.6i 2.0i +.. +.de QC +.QS +.ie n .ta 2.0i 3.0i +.el .ta 1.6i 2.6i +.ft CR +.. +.de QE +.in -.2i +.ft +.fi +.ad +.TA +.. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 .. -.TH XCURSOR __libmansuffix__ __xorgversion__ "Keith Packard" - +.ie \n(.g .ds `` \(lq +.el .ds `` `` +.ie \n(.g .ds '' \(rq +.el .ds '' '' +.TH XCURSOR __libmansuffix__ __xorgversion__ "X Version 11" +.hy 0 .SH NAME -XCURSOR \- Cursor management library - +Xcursor \- Cursor management library +. .SH SYNOPSIS .nf .B #include <X11/Xcursor/Xcursor.h> .fi .SH DESCRIPTION .B Xcursor -is a simple library designed to help locate and load cursors. Cursors can -be loaded from files or memory. A library of common cursors exists which -map to the standard X cursor names. Cursors can exist in several sizes and +is a simple library designed to help locate and load cursors. +Cursors can be loaded from files or memory. +A library of common cursors exists which +map to the standard X cursor names. +Cursors can exist in several sizes and the library automatically picks the best size. - +. .SH FUNCTIONAL OVERVIEW Xcursor is built in a couple of layers; at the bottom layer is code which -can load cursor images from files. Above that is a layer which locates -cursor files based on the library path and theme. At the top is a layer +can load cursor images from files. +Above that is a layer which locates +cursor files based on the library path and theme. +At the top is a layer which builds cursors either out of an image loaded from a file or one of the -standard X cursors. When using images loaded from files, Xcursor prefers -to use the Render extension CreateCursor request if supported by the X -server. Where not supported, Xcursor maps the cursor image to a standard X +standard X cursors. +When using images loaded from files, Xcursor prefers +to use the Render extension CreateCursor request if supported by the X server. +Where not supported, Xcursor maps the cursor image to a standard X cursor and uses the core CreateCursor request. - +. .SS CURSOR FILES -Xcursor defines a new format for cursors on disk. Each file holds -one or more cursor images. Each cursor image is tagged with a nominal size -so that the best size can be selected automatically. Multiple cursors of +Xcursor defines a new format for cursors on disk. +Each file holds +one or more cursor images. +Each cursor image is tagged with a nominal size +so that the best size can be selected automatically. +Multiple cursors of the same nominal size can be loaded together; applications are expected to use them as an animated sequence. .P Cursor files are stored as a header containing a table of contents followed -by a sequence of chunks. The table of contents indicates the type, subtype -and position in the file of each chunk. The file header looks like: +by a sequence of chunks. +The table of contents indicates the type, subtype +and position in the file of each chunk. +The file header looks like: .LP -.in +.2i -\fImagic\fP\^: CARD32 'Xcur' (0x58, 0x63, 0x75, 0x72) -.br -\fIheader\fP\^: CARD32 bytes in this header -.br -\fIversion\fP\^: CARD32 file version number -.br -\fIntoc\fP\^: CARD32 number of toc entries -.br -\fItoc\fP\^: LISTofTOC table of contents +.QS +\fImagic\fP\^: CARD32 "Xcur" (0x58, 0x63, 0x75, 0x72) +\fIheader\fP\^: CARD32 bytes in this header +\fIversion\fP\^: CARD32 file version number +\fIntoc\fP\^: CARD32 number of toc entries +\fItoc\fP\^: LISTofTOC table of contents .in -.2i .P Each table of contents entry looks like: .LP -.in +.2i -\fItype\fP\^: CARD32 entry type -.br -\fIsubtype\fP\^: CARD32 type-specific label - size for images -.br -\fIposition\fP\^: CARD32 absolute byte position of table in file -.in -.2i +.QS +\fItype\fP\^: CARD32 entry type +\fIsubtype\fP\^: CARD32 type-specific label - size for images +\fIposition\fP\^: CARD32 absolute byte position of table in file +.QE .P .P Each chunk in the file has set of common header fields followed by additional type-specific fields: .LP -.in +.2i -\fIheader\fP\^: CARD32 bytes in chunk header (including type-specific fields) -.br -\fItype\fP\^: CARD32 must match type in TOC for this chunk -.br -\fIsubtype\fP\^: CARD32 must match subtype in TOC for this chunk -.br -\fIversion\fP\^: CARD32 version number for this chunk type -.in -.2i +.QS +\fIheader\fP\^: CARD32 bytes in chunk header (including type-specific fields) +\fItype\fP\^: CARD32 must match type in TOC for this chunk +\fIsubtype\fP\^: CARD32 must match subtype in TOC for this chunk +\fIversion\fP\^: CARD32 version number for this chunk type +.QE .P There are currently two chunk types defined for cursor files; comments and -images. Comments look like: +images. +Comments look like: .LP -.in +.2i -\fIheader\fP\^: 20 Comment headers are 20 bytes -.br -\fItype\fP\^: 0xfffe0001 Comment type is 0xfffe0001 -.br -\fIsubtype\fP\^: { 1 (COPYRIGHT), 2 (LICENSE), 3 (OTHER) } -.br -\fIversion\fP\^: 1 -.br -\fIlength\fP\^: CARD32 byte length of UTF-8 string -.br -\fIstring\fP\^: LISTofCARD8 UTF-8 string -.in -.2i +.QS +\fIheader\fP\^: 20 Comment headers are 20 bytes +\fItype\fP\^: 0xfffe0001 Comment type is 0xfffe0001 +\fIsubtype\fP\^: { 1 (COPYRIGHT), 2 (LICENSE), 3 (OTHER) } +\fIversion\fP\^: 1 +\fIlength\fP\^: CARD32 byte length of UTF-8 string +\fIstring\fP\^: LISTofCARD8 UTF-8 string +.QE .P Images look like: .LP -.in +.2i -\fIheader\fP\^: 36 Image headers are 36 bytes +.QS +\fIheader\fP\^: 36 Image headers are 36 bytes .br -\fItype\fP\^: 0xfffd0002 Image type is 0xfffd0002 +\fItype\fP\^: 0xfffd0002 Image type is 0xfffd0002 .br -\fIsubtype\fP\^: CARD32 Image subtype is the nominal size +\fIsubtype\fP\^: CARD32 Image subtype is the nominal size .br -\fIversion\fP\^: 1 +\fIversion\fP\^: 1 .br -\fIwidth\fP\^: CARD32 Must be less than or equal to 0x7fff +\fIwidth\fP\^: CARD32 Must be less than or equal to 0x7fff .br -\fIheight\fP\^: CARD32 Must be less than or equal to 0x7fff +\fIheight\fP\^: CARD32 Must be less than or equal to 0x7fff .br -\fIxhot\fP\^: CARD32 Must be less than or equal to width +\fIxhot\fP\^: CARD32 Must be less than or equal to width .br -\fIyhot\fP\^: CARD32 Must be less than or equal to height +\fIyhot\fP\^: CARD32 Must be less than or equal to height .br -\fIdelay\fP\^: CARD32 Delay between animation frames in milliseconds +\fIdelay\fP\^: CARD32 Delay between animation frames in milliseconds .br -\fIpixels\fP\^: LISTofCARD32 Packed ARGB format pixels -.in -.2i - +\fIpixels\fP\^: LISTofCARD32 Packed ARGB format pixels +.QE +. .SS THEMES -Xcursor (mostly) follows the freedesktop.org spec for theming icons. The -default search path it uses is __XCURSORPATH__. Within each of these -directories, it searches for a directory using the theme name. Within the -theme directory, it looks for cursor files in the 'cursors' subdirectory. -It uses the first cursor file found along the path. +Xcursor (mostly) follows the freedesktop.org spec for theming icons. +The default search path it uses is +.sp +.RS +__XCURSORPATH__ +.RE .PP -If necessary, Xcursor also looks for a "index.theme" file in each theme -directory to find inherited themes and searches along the path for those -themes as well. +Within each of these directories, +it searches for a directory using the theme name: +.bP +Within the theme directory, +it looks for cursor files in the \*(``cursors\*('' subdirectory. +.IP +Xcursor looks for a specific file, +which must be one of the cursor \fIshape\fP names, +e.g., as used in XcursorLibraryLoadImage or XcursorLibraryShape. +.bP +If it finds no matching cursor file in the \*(``cursors\*('' subdirectory, +Xcursor next looks for an \*(``index.theme\*('' file +in each theme directory to look for inherited themes. +Those are lines in this format: +.sp +.RS +Inherits = \fItheme-name\fP +.PP +Xcursor uses the first inherited \fItheme-name\fP, +ignoring others which may exist in a given \*(``index.theme\*('' file. +If it finds an inherited theme, Xcursor searches along the path to use +that as well. +Xcursor ignores other \fIkeys\fP in the \*(``index.theme\*('' file, +including \*(``Name\*('' (i.e., the name which a graphical +application may use as the \fIpresentation name\fP). +.PP +More than one \fItheme-name\fP may be listed on the \fBInherits=\fP line. +The freedesktop.org spec states that list items are separated by commas. +Xcursor also accepts semicolon, +but translates both to colon when searching the path. +Xcursor expects only one \fBInherits=\fP line; +the freedesktop.org spec is unclear whether multiple keys are allowed. +.RE .PP -If no theme is set, or if no cursor is found for the specified theme, -Xcursor checks the "default" theme. - +If no theme is set, or if no cursor is found for the specified theme +anywhere along the path, +Xcursor checks the \*(``default\*('' theme. +.PP +When Xcursor finds a cursor file, it stops searching. +It always uses the first cursor file found while searching along the path. +. .SH DATATYPES - +. .TP .B XcursorImage -holds a single cursor image in memory. Each pixel in the cursor is a 32-bit +holds a single cursor image in memory. +Each pixel in the cursor is a 32-bit value containing ARGB with A in the high byte. .sp -.nf -.ft CR - typedef struct _XcursorImage { - XcursorDim size; /\(** nominal size for matching */ - XcursorDim width; /\(** actual width */ - XcursorDim height; /\(** actual height */ - XcursorDim xhot; /\(** hot spot x (must be inside image) */ - XcursorDim yhot; /\(** hot spot y (must be inside image) */ - XcursorPixel *pixels; /\(** pointer to pixels */ - } XcursorImage; -.ft -.fi - +.QC +typedef struct _XcursorImage { + XcursorDim size; /* nominal size for matching */ + XcursorDim width; /* actual width */ + XcursorDim height; /* actual height */ + XcursorDim xhot; /* hot spot x (must be inside image) */ + XcursorDim yhot; /* hot spot y (must be inside image) */ + XcursorPixel *pixels; /* pointer to pixels */ +} XcursorImage; +.QE +. .TP .B XcursorImages -holds multiple XcursorImage structures. They're all freed when the -XcursorImages is freed. +holds multiple XcursorImage structures. +They are all freed when the +XcursorImages is freed in XcursorImagesDestroy. .sp -.nf -.ft CR - typedef struct _XcursorImages { - int nimage; /\(** number of images */ - XcursorImage **images; /\(** array of XcursorImage pointers */ - } XcursorImages; -.ft -.fi - +.QC +typedef struct _XcursorImages { + int nimage; /* number of images */ + XcursorImage **images; /* array of XcursorImage pointers */ +} XcursorImages; +.QE +. .TP .B XcursorCursors -Holds multiple Cursor objects. They're all freed when the XcursorCursors is -freed. These are reference counted so that multiple XcursorAnimate +Holds multiple Cursor objects. +They are all freed when the XcursorCursors is freed. +These are reference counted so that multiple XcursorAnimate structures can use the same XcursorCursors. .sp -.nf -.ft CR - typedef struct _XcursorCursors { - Display *dpy; /\(** Display holding cursors */ - int ref; /\(** reference count */ - int ncursor; /\(** number of cursors */ - Cursor *cursors; /\(** array of cursors */ - } XcursorCursors; -.ft -.fi - +.QC +typedef struct _XcursorCursors { + Display *dpy; /* Display holding cursors */ + int ref; /* reference count */ + int ncursor; /* number of cursors */ + Cursor *cursors; /* array of cursors */ +} XcursorCursors; +.QE +. .TP .B XcursorAnimate -References a set of cursors and a sequence within that set. Multiple +References a set of cursors and a sequence within that set. +Multiple XcursorAnimate structures may reference the same XcursorCursors; each holds a reference which is removed when the XcursorAnimate is freed. .sp -.nf -.ft CR - typedef struct _XcursorAnimate { - XcursorCursors *cursors; /\(** list of cursors to use */ - int sequence; /\(** which cursor is next */ - } XcursorAnimate; -.ft -.fi - +.QC +typedef struct _XcursorAnimate { + XcursorCursors *cursors; /* list of cursors to use */ + int sequence; /* which cursor is next */ +} XcursorAnimate; +.QE +. .TP .B XcursorFile -Xcursor provides an abstract API for accessing the file data. Xcursor -provides a stdio implementation of this abstract API; applications -are free to create additional implementations. These functions +Xcursor provides an abstract API for accessing the file data. +Xcursor provides a stdio implementation of this abstract API; applications +are free to create additional implementations. +These functions parallel the stdio functions in return value and expected argument values; the read and write functions flip the arguments around to match the POSIX versions. .sp -.nf -.ft CR - typedef struct _XcursorFile { - void *closure; - int (*read) (XcursorFile *file, unsigned char *buf, int len); - int (*write) (XcursorFile *file, unsigned char *buf, int len); - int (*seek) (XcursorFile *file, long offset, int whence); - }; -.ft +.QC +typedef struct _XcursorFile { + void *closure; + int (*read) (XcursorFile *file, unsigned char *buf, int len); + int (*write) (XcursorFile *file, unsigned char *buf, int len); + int (*seek) (XcursorFile *file, long offset, int whence); +}; +.QE .fi - +. .SH FUNCTIONS - +. .SS Object Management -.TP -XcursorImage *XcursorImageCreate (int width, int height) -.TQ -void XcursorImageDestroy (XcursorImage *image) -Allocate and free images. On allocation, the hotspot and the pixels are -left uninitialized. The size is set to the maximum of width and height. - -.TP -XcursorImages *XcursorImagesCreate (int size) -.TQ -void XcursorImagesDestroy (XcursorImages *images) -Allocate and free arrays to hold multiple cursor images. On allocation, -nimage is set to zero. - -.TP -XcursorCursors *XcursorCursorsCreate (Display *dpy, int size) -.TQ -void XcursorCursorsDestroy (XcursorCursors *cursors) -Allocate and free arrays to hold multiple cursors. On allocation, -ncursor is set to zero, ref is set to one. - +.PS +XcursorImage *XcursorImageCreate ( + int \fIwidth\fP, + int \fIheight\fP) +.PS +void XcursorImageDestroy ( + XcursorImage *\fIimage\fP) +.PE +Allocate and free images. +On allocation, the hotspot and the pixels are left uninitialized. +The size is set to the maximum of \fIwidth\fP and \fIheight\fP. +. +.PS +XcursorImages *XcursorImagesCreate ( + int \fIsize\fP) +.PS +void XcursorImagesDestroy ( + XcursorImages *\fIimages\fP) +.PE +Allocate and free arrays to hold multiple cursor images. +On allocation, \fInimage\fP is set to zero. +. +.PS +XcursorCursors *XcursorCursorsCreate ( + Display *\fIdpy\fP, + int \fIsize\fP) +.PS +void XcursorCursorsDestroy ( + XcursorCursors *\fIcursors\fP) +.PE +Allocate and free arrays to hold multiple cursors. +On allocation, \fIncursor\fP is set to zero, \fIref\fP is set to one. +. +. .SS Reading and writing images. - -.TP -XcursorImage *XcursorXcFileLoadImage (XcursorFile *file, int size) -.TQ -XcursorImages *XcursorXcFileLoadImages (XcursorFile *file, int size) -.TQ -XcursorImages *XcursorXcFileLoadAllImages (XcursorFile *file) -.TQ -XcursorBool XcursorXcFileLoad (XcursorFile *file, XcursorComments **commentsp, XcursorImages **imagesp) -.TQ -XcursorBool XcursorXcFileSave (XcursorFile *file, const XcursorComments *comments, const XcursorImages *images) -These read and write cursors from an XcursorFile handle. After reading, the -file pointer will be left at some random place in the file. - -.TP -XcursorImage *XcursorFileLoadImage (FILE *file, int size) -.TQ -XcursorImages *XcursorFileLoadImages (FILE *file, int size) -.TQ -XcursorImages *XcursorFileLoadAllImages (FILE *file) -.TQ -XcursorBool XcursorFileLoad (FILE *file, XcursorComments **commentsp, XcursorImages **imagesp) -.TQ -XcursorBool XcursorFileSaveImages (FILE *file, const XcursorImages *images) -.TQ -XcursorBool XcursorFileSave (FILE * file, const XcursorComments *comments, const XcursorImages *images) -These read and write cursors from a stdio FILE handle. Writing flushes -before returning so that any errors should be detected. - -.TP -XcursorImage *XcursorFilenameLoadImage (const char *filename, int size) -.TQ -XcursorImages *XcursorFilenameLoadImages (const char *filename, int size) -.TQ -XcursorImages *XcursorFilenameLoadAllImages (FILE *file) -.TQ -XcursorBool XcursorFilenameLoad (const char *file, XcursorComments **commentsp, XcursorImages **imagesp) -.TQ -XcursorBool XcursorFilenameSaveImages (const char *filename, const XcursorImages *images) -.TQ -XcursorBool XcursorFilenameSave (const char *file, const XcursorComments *comments, const XcursorImages *images) +. +.PS +XcursorImage *XcursorXcFileLoadImage ( + XcursorFile *\fIfile\fP, + int \fIsize\fP) +.PS +XcursorImages *XcursorXcFileLoadImages ( + XcursorFile *\fIfile\fP, + int \fIsize\fP) +.PS +XcursorImages *XcursorXcFileLoadAllImages ( + XcursorFile *\fIfile\fP) +.PS +XcursorBool XcursorXcFileLoad ( + XcursorFile *\fIfile\fP, + XcursorComments **\fIcommentsp\fP, + XcursorImages **\fIimagesp\fP) +.PS +XcursorBool XcursorXcFileSave ( + XcursorFile *\fIfile\fP, + const XcursorComments *\fIcomments\fP, + const XcursorImages *\fIimages\fP) +.PE +These read and write cursors from an XcursorFile handle. +After reading, the file pointer will be left at some random place in the file. +. +.PS +XcursorImage *XcursorFileLoadImage ( + FILE *\fIfile\fP, + int \fIsize\fP) +.PS +XcursorImages *XcursorFileLoadImages ( + FILE *\fIfile\fP, + int \fIsize\fP) +.PS +XcursorImages *XcursorFileLoadAllImages ( + FILE *\fIfile\fP) +.PS +XcursorBool XcursorFileLoad ( + FILE *\fIfile\fP, + XcursorComments **\fIcommentsp\fP, + XcursorImages **\fIimagesp\fP) +.PS +XcursorBool XcursorFileSaveImages ( + FILE *\fIfile\fP, + const XcursorImages *\fIimages\fP) +.PS +XcursorBool XcursorFileSave ( + FILE *\fIfile\fP, + const XcursorComments *\fIcomments\fP, + const XcursorImages *\fIimages\fP) +.PE +These read and write cursors from a stdio FILE handle. +Writing flushes before returning so that any errors should be detected. +. +.PS +XcursorImage *XcursorFilenameLoadImage ( + const char *\fIfilename\fP, + int \fIsize\fP) +.PS +XcursorImages *XcursorFilenameLoadImages ( + const char *\fIfilename\fP, + int \fIsize\fP) +.PS +XcursorImages *XcursorFilenameLoadAllImages ( + const char *\fIfile\fP) +.PS +XcursorBool XcursorFilenameLoad ( + const char *\fIfile\fP, + XcursorComments **\fIcommentsp\fP, + XcursorImages **\fIimagesp\fP) +.PS +XcursorBool XcursorFilenameSaveImages ( + const char *\fIfilename\fP, + const XcursorImages *\fIimages\fP) +.PS +XcursorBool XcursorFilenameSave ( + const char *\fIfile\fP, + const XcursorComments *\fIcomments\fP, + const XcursorImages *\fIimages\fP) +.PE These parallel the stdio FILE interfaces above, but take filenames. - +. .SS Reading library images -.TP -XcursorImage *XcursorLibraryLoadImage (const char *name, const char *theme, int size) -.TQ -XcursorImages *XcursorLibraryLoadImages (const char *name, const char *theme, int size) -These search the library path, loading the first file found. If 'theme' is -not NULL, these functions first try appending -theme to name and then -name alone. - +.PS +XcursorImage *XcursorLibraryLoadImage ( + const char *\fIname\fP, + const char *\fItheme\fP, + int \fIsize\fP) +.PS +XcursorImages *XcursorLibraryLoadImages ( + const char *\fIname\fP, + const char *\fItheme\fP, + int \fIsize\fP) +.PE +These search the library path, loading the first file found +of the desired \fIsize\fP, +using a private function (XcursorScanTheme) to find the appropriate theme: +.RS +.bP +If \fItheme\fP is not NULL, use that. +.bP +If \fItheme\fP is NULL, or if there was no match for the desired theme, +use \*(``default\*('' for the theme name. +.bP +If neither search succeeds, +these functions return NULL. +.RE +.IP +The two functions differ by more than the number of images loaded: +.RS +.bP +XcursorLibraryLoadImage calls XcursorFileLoadImage but +.bP +XcursorLibraryLoadImages calls XcursorFileLoadImages, +and (on success) +it calls XcursorImagesSetName to associate \fIname\fP with the result. +.RE +. +.SS Library attributes +.PS +const char * XcursorLibraryPath (void) +.PE +Returns the library search path: +.RS +.bP +If the environment variable \fBXCURSOR_PATH\fP is set, +return that value. +.bP +Otherwise, return the compiled-in search path. +.RE +. +.PS +int XcursorLibraryShape ( + const char *\fIlibrary\fP) +.PE +Search Xcursor's table of cursor font names for the given +\*(``shape name\*('' (\fIlibrary\fP): +.RS +.bP +If found, return the index into that table, +multiplied by two (to account for the source- and mask-values +used in an X cursor font). +.bP +If not found, return -1. +.RE +. .SS Cursor APIs - -.TP -Cursor XcursorFilenameLoadCursor (Display *dpy, const char *file) -.TQ -XcursorCursors *XcursorFilenameLoadCursors (Display *dpy, const char *file) +. +.PS +Cursor XcursorFilenameLoadCursor ( + Display *\fIdpy\fP, + const char *\fIfile\fP) +.PS +XcursorCursors *XcursorFilenameLoadCursors ( + Display *\fIdpy\fP, + const char *\fIfile\fP) +.PE These load cursors from the specified file. - -.TP -Cursor XcursorLibraryLoadCursor (Display *dpy, const char *name) -.TQ -XcursorCursors *XcursorLibraryLoadCursors (Display *dpy, const char *name) -These load cursors using the specified library name. The theme +. +.PS +Cursor XcursorLibraryLoadCursor ( + Display *\fIdpy\fP, + const char *\fIname\fP) +.PS +XcursorCursors *XcursorLibraryLoadCursors ( + Display *\fIdpy\fP, + const char *\fIname\fP) +.PE +These load cursors using the specified library \fIname\fP. The theme comes from the display. - +. +.PS +Cursor XcursorImageLoadCursor( + Display *\fIdpy\fP, + const XcursorImage *\fIimage\fP) +.PE +This creates a cursor, given the image to display. +It calls XcursorSupportsARGB to decide what type of cursor to create: +.RS +.bP +XRenderCreateCursor is used if ARGB is supported on the display, and +.bP +XCreatePixmapCursor is used otherwise. +.RE +. +.PS +Cursor XcursorImagesLoadCursor( + Display *\fIdpy\fP, + const XcursorImages *\fIimages\fP) +.PE +This provides an interface for creating animated cursors, +if the \fIimages\fP array contains multiple images, and +if XcursorSupportsAnim returns true. +Otherwise, it calls XcursorImageLoadCursor. +. +.PS +XcursorCursors *XcursorImagesLoadCursors( + Display *\fIdpy\fP, + const XcursorImages *\fIimages\fP) +.PE +This calls XcursorCursorsCreate to create an array of XcursorCursors, +to correspond to the XcursorImages \fIimages\fP array, +and uses XcursorImageLoadCursor to load the corresponding cursor data. +.IP +Normally it returns the resulting array pointer. +On any failure, it discards the result XcursorCursorsDestroy, +and returns NULL. +. .SS X Cursor Name APIs - -.TP -XcursorImage *XcursorShapeLoadImage (unsigned int shape, const char *theme, int size) -.TQ -XcursorImages *XcursorShapeLoadImages (unsigned int shape, const char *theme, int size) -These map 'shape' to a library name using the standard X cursor names and +. +.PS +XcursorImage *XcursorShapeLoadImage ( + unsigned int \fIshape\fP, + const char *\fItheme\fP, + int \fIsize\fP) +.PS +XcursorImages *XcursorShapeLoadImages ( + unsigned int \fIshape\fP, + const char *\fItheme\fP, + int \fIsize\fP) +.PE +These map \fIshape\fP to a library name using the standard X cursor names and then load the images. - -.TP -Cursor XcursorShapeLoadCursor (Display *dpy, unsigned int shape) -.TQ -XcursorCursors *XcursorShapeLoadCursors (Display *dpy, unsigned int shape) -These map 'shape' to a library name and then load the cursors. - +. +.PS +Cursor XcursorShapeLoadCursor ( + Display *\fIdpy\fP, + unsigned int \fIshape\fP) +.PS +XcursorCursors *XcursorShapeLoadCursors ( + Display *\fIdpy\fP, + unsigned int \fIshape\fP) +.PE +These map \fIshape\fP to a library name and then load the cursors. +. +.SS X Cursor Comment APIs +.PS +XcursorComment *XcursorCommentCreate ( + XcursorUInt \fIcomment_type\fP, + int \fIlength\fP) +.PE +XcursorXcFileLoad uses this function to allocate an XcursorComment +structure for a single cursor. +The \fIcomment_type\fP parameter is used as the \fIsubtype\fP field, +e.g., COPYRIGHT. +The \fIlength\fP is the number of bytes to allocate for the comment text. +. +.PS +void XcursorCommentDestroy( + XcursorComment *\fIcomment\fP) +.PE +Deallocates the given XcursorComment structure. +. +.PS +XcursorComments * XcursorCommentsCreate ( + int \fIsize\fP) +.PE +XcursorXcFileLoad uses this function to allocate an index of +XcursorComment structure pointers. +The \fIsize\fP parameter tells it how many pointers will be in the index. +. +.PS +void XcursorCommentsDestroy ( + XcursorComments *\fIcomments\fP) +.PE +Deallocates the given XcursorComments structure +as well as the XcursorComment structures which it points to. +. +.SS Animated Cursors +.PS +XcursorAnimate * XcursorAnimateCreate ( + XcursorCursors *\fIcursors\fP) +.PE +Wrap the given array of cursors in a newly allocated XcursorAnimate structure, +which adds a sequence number used in XcursorAnimateNext. +. +.PS +void XcursorAnimateDestroy ( + XcursorAnimate *\fIanimate\fP) +.PE +Discards the given \fIanimate\fP data, +freeing both the XcursorCursors array of cursors +as well as the XcursorAnimate structure. +. +.PS +Cursor XcursorAnimateNext ( + XcursorAnimate *\fIanimate\fP) +.PE +Cyclically returns the next Cursor in the array, +incrementing the sequence number to prepare for the next call. +.IP +The caller is responsible for displaying the series of Cursor images. +Xcursor does not do that. +. +.SS Glyph Cursor APIs +The X11 XCreateFontCursor and XCreateGlyphCursor functions use +this part of the API to extend the X core cursors feature to use themes. +.PS +void XcursorImageHash ( + XImage *\fIimage\fP, + unsigned char \fIhash\fP[XCURSOR_BITMAP_HASH_SIZE]) +.PE +Compute a hash of the image, +to display when the environment variable XCURSOR_DISCOVER is set. +. +.PS +void XcursorImagesSetName ( + XcursorImages *\fIimages\fP, + const char *\fIname\fP) +.PE +Associates the given name with the images. +. +.PS +void XcursorNoticeCreateBitmap ( + Display *\fIdpy\fP, + Pixmap \fIpid\fP, + unsigned int \fIwidth\fP, + unsigned int \fIheight\fP) +.PE +Check if the display supports either ARGB or themes, +and also if the image size fits within the maximum cursor size (64 pixels). +If so, create a bitmap of the specified size, +and cache the result in Xcursor, +identifying it with the Pixmap-id (pid) value. +. +.PS +void XcursorNoticePutBitmap ( + Display *\fIdpy\fP, + Drawable \fIdraw\fP, + XImage *\fIimage\fP) +.PE +Update the image contents in the bitmap specified by the draw value +(a Pixmap-id). +The bitmap must have been created by XcursorNoticeCreateBitmap. +. +.PS +Cursor XcursorTryShapeBitmapCursor ( + Display *\fIdpy\fP, + Pixmap \fIsource\fP, + Pixmap \fImask\fP, + XColor *\fIforeground\fP, + XColor *\fIbackground\fP, + unsigned int \fIx\fP, + unsigned int \fIy\fP) +.PE +If the display supports either ARGB or themes, +try to load a cursor into Xcursor's cache +using the \fIsource\fP parameter as a Pixmap-id. +The source may no longer be in the cache. +Xcursor uses the hash value to identify the desired image. +. +.PS +Cursor XcursorTryShapeCursor ( + Display *\fIdpy\fP, + Font \fIsource_font\fP, + Font \fImask_font\fP, + unsigned int \fIsource_char\fP, + unsigned int \fImask_char\fP, + XColor _Xconst *\fIforeground\fP, + XColor _Xconst *\fIbackground\fP) +.PE +If the display supports either ARGB or themes, +try to load a cursor into Xcursor's cache +using the \fIsource_char\fP parameter as a shape. +Using +.RS +.bP +the default size from XcursorGetDefaultSize, +.bP +the default theme from XcursorGetTheme, and +.bP +the \fIsource_char\fP parameter as a shape, +.RE +.IP +Xcursor calls XcursorShapeLoadImages to load the cursor images. +If successful, Xcursor uses XcursorImagesLoadCursor +to load the cursor information. +. .SS Display Information APIs - -.TP -XcursorBool XcursorSupportsARGB (Display *dpy) -Returns whether the display supports ARGB cursors or whether cursors will be -mapped to a core X cursor. - -.TP -XcursorBool XcursorSetDefaultSize (Display *dpy, int size) -Sets the default size for cursors on the specified display. When loading -cursors, those whose nominal size is closest to this size will be preferred. - -.TP -int XcursorGetDefaultSize (Display *dpy) +. +.PS +XcursorBool XcursorSupportsARGB ( + Display *\fIdpy\fP) +.PE +Returns true if the display supports ARGB cursors. +Otherwise, cursors will be mapped to a core X cursor. +. +.PS +XcursorBool XcursorSupportsAnim ( + Display *\fIdpy\fP) +.PE +Returns true if the display supports animated cursors. +Otherwise, cursors will be mapped to a core X cursor. +. +.PS +XcursorBool XcursorSetDefaultSize ( + Display *\fIdpy\fP, + int \fIsize\fP) +.PE +Sets the default size for cursors on the specified display. +When loading cursors, +those whose nominal size is closest to this size will be preferred. +. +.PS +int XcursorGetDefaultSize ( + Display *\fIdpy\fP) +.PE Gets the default cursor size. - -.TP -XcursorBool XcursorSetTheme (Display *dpy, const char *theme) +. +.PS +XcursorBool XcursorSetTheme ( + Display *\fIdpy\fP, + const char *\fItheme\fP) +.PE Sets the current theme name. - -.TP -char *XcursorGetTheme (Display *dpy) +. +.PS +char *XcursorGetTheme ( + Display *\fIdpy\fP) +.PE Gets the current theme name. - +. +.PS +XcursorBool XcursorGetThemeCore ( + Display *\fIdpy\fP) +.PS +XcursorBool XcursorSetThemeCore ( + Display *\fIdpy\fP, + XcursorBool \fItheme_core\fP) +.PE +Get or set property which tells Xcursor whether to +enable themes for core cursors. +. .SH "ENVIRONMENT VARIABLES" +Environment variables can be used to override resource settings, +which in turn override compiled-in default values. +.PP +Some of the environment variables recognized by Xcursor are booleans, +specified as follows: +.RS 3 +.TP 5 +\fItrue\fP for \*(``t\*('', \*(``1\*('', \*(``y\*('' or \*(``on\*('' +.TP 5 +\fIfalse\fP for \*(``f\*('', \*(``0\*('', \*(``n\*('' or \*(``off\*('' +.RE +.PP +Xcursor ignores other values for these booleans. +.TP 15 +.B HOME +Xcursor interprets \*(``~\*('' in the search list as the home directory, +using this variable rather than the password database. +.TP 15 +.B XCURSOR_ANIM +If the display supports the Render CreateCursor request, +and the Render feature is enabled, +disable \fIanimated\fP cursors if the environment variable is \fIfalse\fP. +.IP +If the environment variable is not given, +Xcursor uses the resource \fBXcursor.anim\fP. +.TP 15 +.B XCURSOR_CORE +If the display supports the Render CreateCursor request +disable the Render feature if the environment variable is \fIfalse\fP. +.IP +If the environment variable is not given, +Xcursor uses the resource \fBXcursor.core\fP. +.TP 15 +.B XCURSOR_DISCOVER +If the variable is set, Xcursor turns on a logging feature. +It displays the hash value and the image so that users can see which +cursor name is associated with each image. +.IP +There is no corresponding resource setting. +.TP 15 +.B XCURSOR_DITHER +This variable sets the desired \fIdither\fP. +.IP +If the environment variable is not given, +Xcursor uses the resource \fBXcursor.dither\fP. +.IP +If neither environment variable or resource is found, +Xcursor uses \*(``threshold\*('' +.IP +These are the recognized values: +.RS 18 +.TP 5 +.B diffuse +.TP 5 +.B median +.TP 5 +.B ordered +.TP 5 +.B threshold +.RE .TP 15 .B XCURSOR_PATH -This variable sets the list of paths to look for cursors in. +This variable sets the list of paths in which to search for cursors, +rather than the compiled-in default list. +.IP Directories in this path are separated by colons (:). - +.TP 15 +.B XCURSOR_SIZE +This variable sets the desired cursor size, in pixels. +.IP +If the environment variable is not given, +Xcursor tries the \fBXcursor.size\fP resource. +.IP +If no size is given, whether by environment variable or resource setting, +Xcursor next tries the \fBXft.dpi\fP resource setting to guess +the size of a 16-point cursor. +.IP +Finally, if \fBXft.dpi\fP is not set, +Xcursor uses the display height, +dividing by 48 (assuming that the height is 768). +.TP 15 +.B XCURSOR_THEME +This variable selects the desired \fItheme\fP. +.IP +If the environment variable is not given, +Xcursor tries the \fBXcursor.theme\fP resource. +.IP +If neither environment variable or resource is found, +Xcursor uses the \fIdefault\fP theme. +.TP 15 +.B XCURSOR_THEME_CORE +Enables themes for core cursors if the environment variable is \fItrue\fP. +.IP +If the environment variable is not given, +Xcursor tries the \fBXcursor.theme_core\fP resource. +.IP +An application can enable or disable themes using XcursorSetThemeCore. +. +.SH SEE ALSO +.na +XCreateRenderCursor(__libmansuffix__), +XCreatePixmapCursor(__libmansuffix__), and +XCreateFontCursor(__libmansuffix__) +.ad +.PP +as well as +.IP +\fIIcon Theme Specification\fP +.br +https://specifications.freedesktop.org/icon-theme-spec/ +. .SH RESTRICTIONS .B Xcursor will probably change radically in the future; weak attempts will be made to retain some level of source-file compatibility. - +. .SH AUTHOR Keith Packard diff --git a/lib/libXcursor/src/Makefile.in b/lib/libXcursor/src/Makefile.in index 7c05ec807..39bda2009 100644 --- a/lib/libXcursor/src/Makefile.in +++ b/lib/libXcursor/src/Makefile.in @@ -285,6 +285,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/lib/libXcursor/src/cursor.c b/lib/libXcursor/src/cursor.c index 23c32837e..8dd61a0b1 100644 --- a/lib/libXcursor/src/cursor.c +++ b/lib/libXcursor/src/cursor.c @@ -30,7 +30,7 @@ XcursorCursorsCreate (Display *dpy, int size) XcursorCursors *cursors; cursors = malloc (sizeof (XcursorCursors) + - size * sizeof (Cursor)); + (size_t) size * sizeof (Cursor)); if (!cursors) return NULL; cursors->ref = 1; @@ -91,6 +91,7 @@ XcursorAnimateNext (XcursorAnimate *animate) return cursor; } +#if RENDER_MAJOR > 0 || RENDER_MINOR >= 5 static int nativeByteOrder (void) { @@ -98,6 +99,7 @@ nativeByteOrder (void) return (*((char *) &x) == 1) ? LSBFirst : MSBFirst; } +#endif static XcursorUInt _XcursorPixelBrightness (XcursorPixel p) @@ -124,7 +126,7 @@ _XcursorDivideAlpha (XcursorUInt value, XcursorUInt alpha) value = value * 255 / alpha; if (value > 255) value = 255; - return value | (value << 8); + return (unsigned short) (value | (value << 8)); } static void @@ -194,6 +196,8 @@ _XcursorCompareBlue (const void *a, const void *b) return (int) (((*ap >> 0) & 0xff) - ((*bp >> 0) & 0xff)); } +#define ScaledPixels(c,n) ((c)/(XcursorPixel)(n)) + static XcursorPixel _XcursorAverageColor (XcursorPixel *pixels, int npixels) { @@ -212,7 +216,10 @@ _XcursorAverageColor (XcursorPixel *pixels, int npixels) green += (p >> 8) & 0xff; blue += (p >> 0) & 0xff; } - return (0xffU << 24) | ((red/npixels) << 16) | ((green/npixels) << 8) | (blue/npixels); + return (0xffU << 24) + | (ScaledPixels(red, npixels) << 16) + | (ScaledPixels(green, npixels) << 8) + | ScaledPixels(blue, npixels); } typedef struct XcursorCoreCursor { @@ -258,7 +265,7 @@ _XcursorHeckbertMedianCut (const XcursorImage *image, XcursorCoreCursor *core) pc = colors; max_blue = max_green = max_red = 0; min_blue = min_green = min_red = 255; - n = npixels; + n = (int) npixels; while (n--) { p = *po++; @@ -285,7 +292,7 @@ _XcursorHeckbertMedianCut (const XcursorImage *image, XcursorCoreCursor *core) p = 0; *pn++ = p; } - ncolors = pc - colors; + ncolors = (int) (pc - colors); /* * Compute longest dimension and sort @@ -297,7 +304,7 @@ _XcursorHeckbertMedianCut (const XcursorImage *image, XcursorCoreCursor *core) compare = _XcursorCompareRed; else compare = _XcursorCompareBlue; - qsort (colors, ncolors, sizeof (XcursorPixel), compare); + qsort (colors, (size_t) ncolors, sizeof (XcursorPixel), compare); /* * Compute average colors on both sides of the cut */ @@ -309,8 +316,8 @@ _XcursorHeckbertMedianCut (const XcursorImage *image, XcursorCoreCursor *core) * Select best color for each pixel */ pn = pixels; - for (y = 0; y < image->height; y++) - for (x = 0; x < image->width; x++) + for (y = 0; (unsigned) y < image->height; y++) + for (x = 0; (unsigned) x < image->width; x++) { p = *pn++; if (p & 0xff000000) @@ -359,12 +366,12 @@ _XcursorBayerOrderedDither (const XcursorImage *image, XcursorCoreCursor *core) XcursorPixel a, i, d; pixel = image->pixels; - for (y = 0; y < image->height; y++) - for (x = 0; x < image->width; x++) + for (y = 0; (unsigned) y < image->height; y++) + for (x = 0; (unsigned) x < image->width; x++) { p = *pixel++; - a = ((p >> 24) * DITHER_SIZE + 127) / 255; - i = (_XcursorPixelBrightness (p) * DITHER_SIZE + 127) / 255; + a = (XcursorPixel) (((p >> 24) * DITHER_SIZE + 127) / 255); + i = (XcursorPixel) ((_XcursorPixelBrightness (p) * DITHER_SIZE + 127) / 255); d = orderedDither[y&(DITHER_DIM-1)][x&(DITHER_DIM-1)]; if (a > d) { @@ -398,9 +405,9 @@ _XcursorFloydSteinberg (const XcursorImage *image, XcursorCoreCursor *core) unsigned int npixels = image->width * image->height; int n; int right = 1; - int belowLeft = image->width - 1; - int below = image->width; - int belowRight = image->width + 1; + int belowLeft = (int) (image->width - 1); + int below = (int) image->width; + int belowRight = (int) (image->width + 1); int iError, aError; int iErrorRight, aErrorRight; int iErrorBelowLeft, aErrorBelowLeft; @@ -420,10 +427,10 @@ _XcursorFloydSteinberg (const XcursorImage *image, XcursorCoreCursor *core) pixel = image->pixels; iP = iPicture; aP = aPicture; - n = npixels; + n = (int) npixels; max_inten = 0; min_inten = 0xff; - while (n--) + while (n-- > 0) { p = *pixel++; *aP++ = (int) (p >> 24); @@ -438,8 +445,8 @@ _XcursorFloydSteinberg (const XcursorImage *image, XcursorCoreCursor *core) iP = iPicture; aP = aPicture; mean_inten = (max_inten + min_inten + 1) >> 1; - for (y = 0; y < image->height; y++) - for (x = 0; x < image->width; x++) + for (y = 0; (unsigned) y < image->height; y++) + for (x = 0; (unsigned) x < image->width; x++) { aR = *aP; iR = *iP; @@ -475,12 +482,12 @@ _XcursorFloydSteinberg (const XcursorImage *image, XcursorCoreCursor *core) aErrorBelow = (aError * 5) >> 4; aErrorBelowRight = (aError - aErrorRight - aErrorBelowLeft - aErrorBelow); - if (x < image->width - 1) + if (x < ((int)image->width - 1)) { iP[right] += iErrorRight; aP[right] += aErrorRight; } - if (y < image->height - 1) + if (y < ((int)image->height - 1)) { if (x) { @@ -489,7 +496,7 @@ _XcursorFloydSteinberg (const XcursorImage *image, XcursorCoreCursor *core) } iP[below] += iErrorBelow; aP[below] += aErrorBelow; - if (x < image->width - 1) + if (x < ((int)image->width - 1)) { iP[belowRight] += iErrorBelowRight; aP[belowRight] += aErrorBelowRight; @@ -501,10 +508,10 @@ _XcursorFloydSteinberg (const XcursorImage *image, XcursorCoreCursor *core) free (iPicture); core->on_color.red = core->on_color.green = - core->on_color.blue = (min_inten | min_inten << 8); + core->on_color.blue = (unsigned short) (min_inten | min_inten << 8); core->off_color.red = core->off_color.green = - core->off_color.blue = (max_inten | max_inten << 8); + core->off_color.blue = (unsigned short) (max_inten | max_inten << 8); return True; } @@ -518,8 +525,8 @@ _XcursorThreshold (const XcursorImage *image, XcursorCoreCursor *core) * Draw the image, picking black for dark pixels and white for light */ pixel = image->pixels; - for (y = 0; y < image->height; y++) - for (x = 0; x < image->width; x++) + for (y = 0; (unsigned) y < image->height; y++) + for (x = 0; (unsigned) x < image->width; x++) { p = *pixel++; if ((p >> 24) >= 0x80) @@ -560,8 +567,8 @@ XcursorImageLoadCursor (Display *dpy, const XcursorImage *image) GC gc; XRenderPictFormat *format; - ximage.width = image->width; - ximage.height = image->height; + ximage.width = (int) image->width; + ximage.height = (int) image->height; ximage.xoffset = 0; ximage.format = ZPixmap; ximage.data = (char *) image->pixels; @@ -571,7 +578,7 @@ XcursorImageLoadCursor (Display *dpy, const XcursorImage *image) ximage.bitmap_pad = 32; ximage.depth = 32; ximage.bits_per_pixel = 32; - ximage.bytes_per_line = image->width * 4; + ximage.bytes_per_line = (int) (image->width * 4); ximage.red_mask = 0xff0000; ximage.green_mask = 0x00ff00; ximage.blue_mask = 0x0000ff; @@ -608,12 +615,12 @@ XcursorImageLoadCursor (Display *dpy, const XcursorImage *image) 0, NULL, image->width, image->height, 32, 0); core.src_image->data = Xmalloc (image->height * - core.src_image->bytes_per_line); + (unsigned) core.src_image->bytes_per_line); core.msk_image = XCreateImage (dpy, NULL, 1, ZPixmap, 0, NULL, image->width, image->height, 32, 0); core.msk_image->data = Xmalloc (image->height * - core.msk_image->bytes_per_line); + (unsigned) core.msk_image->bytes_per_line); switch (info->dither) { case XcursorDitherThreshold: @@ -708,7 +715,7 @@ XcursorImagesLoadCursor (Display *dpy, const XcursorImages *images) if (!cursors) return 0; - anim = malloc (cursors->ncursor * sizeof (XAnimCursor)); + anim = malloc ((size_t) cursors->ncursor * sizeof (XAnimCursor)); if (!anim) { XcursorCursorsDestroy (cursors); @@ -777,11 +784,11 @@ _XcursorCreateGlyphCursor(Display *dpy, LockDisplay(dpy); GetReq(CreateGlyphCursor, req); - cid = req->cid = XAllocID(dpy); - req->source = source_font; - req->mask = mask_font; - req->sourceChar = source_char; - req->maskChar = mask_char; + cid = req->cid = (CARD32) XAllocID(dpy); + req->source = (CARD32) source_font; + req->mask = (CARD32) mask_font; + req->sourceChar = (CARD16) source_char; + req->maskChar = (CARD16) mask_char; req->foreRed = foreground->red; req->foreGreen = foreground->green; req->foreBlue = foreground->blue; @@ -800,8 +807,10 @@ _XcursorCreateGlyphCursor(Display *dpy, Cursor _XcursorCreateFontCursor (Display *dpy, unsigned int shape) { - static XColor _Xconst foreground = { 0, 0, 0, 0 }; /* black */ - static XColor _Xconst background = { 0, 65535, 65535, 65535 }; /* white */ +#define DATA(c) { 0UL, c, c, c, 0, 0 } + static XColor _Xconst foreground = DATA(0); /* black */ + static XColor _Xconst background = DATA(65535); /* white */ +#undef DATA /* * the cursor font contains the shape glyph followed by the mask diff --git a/lib/libXcursor/src/display.c b/lib/libXcursor/src/display.c index 77dd325ed..a61b5fd4e 100644 --- a/lib/libXcursor/src/display.c +++ b/lib/libXcursor/src/display.c @@ -50,6 +50,8 @@ _XcursorCloseDisplay (Display *dpy, XExtCodes *codes) { XcursorDisplayInfo *info, **prev; + (void) codes; /* UNUSED */ + /* * Unhook from the global list */ @@ -70,20 +72,20 @@ _XcursorCloseDisplay (Display *dpy, XExtCodes *codes) static int _XcursorDefaultParseBool (char *v) { - char c0, c1; + char c0; c0 = *v; if (isupper ((int)c0)) - c0 = tolower (c0); + c0 = (char) tolower (c0); if (c0 == 't' || c0 == 'y' || c0 == '1') return 1; if (c0 == 'f' || c0 == 'n' || c0 == '0') return 0; if (c0 == 'o') { - c1 = v[1]; + char c1 = v[1]; if (isupper ((int)c1)) - c1 = tolower (c1); + c1 = (char) tolower (c1); if (c1 == 'n') return 1; if (c1 == 'f') diff --git a/lib/libXcursor/src/file.c b/lib/libXcursor/src/file.c index da1627734..dacbf5cf8 100644 --- a/lib/libXcursor/src/file.c +++ b/lib/libXcursor/src/file.c @@ -35,14 +35,14 @@ XcursorImageCreate (int width, int height) return NULL; image = malloc (sizeof (XcursorImage) + - width * height * sizeof (XcursorPixel)); + (size_t) (width * height) * sizeof (XcursorPixel)); if (!image) return NULL; image->version = XCURSOR_IMAGE_VERSION; image->pixels = (XcursorPixel *) (image + 1); - image->size = width > height ? width : height; - image->width = width; - image->height = height; + image->size = (XcursorDim) (width > height ? width : height); + image->width = (XcursorDim) width; + image->height = (XcursorDim) height; image->delay = 0; return image; } @@ -59,7 +59,7 @@ XcursorImagesCreate (int size) XcursorImages *images; images = malloc (sizeof (XcursorImages) + - size * sizeof (XcursorImage *)); + (size_t) size * sizeof (XcursorImage *)); if (!images) return NULL; images->nimage = 0; @@ -109,7 +109,7 @@ XcursorCommentCreate (XcursorUInt comment_type, int length) if (length < 0 || length > XCURSOR_COMMENT_MAX_LEN) return NULL; - comment = malloc (sizeof (XcursorComment) + length + 1); + comment = malloc (sizeof (XcursorComment) + (size_t) length + 1); if (!comment) return NULL; comment->version = XCURSOR_COMMENT_VERSION; @@ -131,7 +131,7 @@ XcursorCommentsCreate (int size) XcursorComments *comments; comments = malloc (sizeof (XcursorComments) + - size * sizeof (XcursorComment *)); + (size_t) size * sizeof (XcursorComment *)); if (!comments) return NULL; comments->ncomment = 0; @@ -161,11 +161,12 @@ _XcursorReadUInt (XcursorFile *file, XcursorUInt *u) return XcursorFalse; if ((*file->read) (file, bytes, 4) != 4) - return XcursorFalse; - *u = ((bytes[0] << 0) | - (bytes[1] << 8) | - (bytes[2] << 16) | - (bytes[3] << 24)); + return XcursorFalse; + + *u = ((XcursorUInt)(bytes[0]) << 0) | + ((XcursorUInt)(bytes[1]) << 8) | + ((XcursorUInt)(bytes[2]) << 16) | + ((XcursorUInt)(bytes[3]) << 24); return XcursorTrue; } @@ -185,10 +186,10 @@ _XcursorWriteUInt (XcursorFile *file, XcursorUInt u) if (!file) return XcursorFalse; - bytes[0] = u; - bytes[1] = u >> 8; - bytes[2] = u >> 16; - bytes[3] = u >> 24; + bytes[0] = (unsigned char)(u); + bytes[1] = (unsigned char)(u >> 8); + bytes[2] = (unsigned char)(u >> 16); + bytes[3] = (unsigned char)(u >> 24); if ((*file->write) (file, bytes, 4) != 4) return XcursorFalse; return XcursorTrue; @@ -232,7 +233,7 @@ _XcursorReadFileHeader (XcursorFile *file) { XcursorFileHeader head, *fileHeader; XcursorUInt skip; - int n; + XcursorUInt n; if (!file) return NULL; @@ -285,7 +286,7 @@ _XcursorFileHeaderLength (XcursorFileHeader *fileHeader) static XcursorBool _XcursorWriteFileHeader (XcursorFile *file, XcursorFileHeader *fileHeader) { - int toc; + XcursorUInt toc; if (!file || !fileHeader) return XcursorFalse; @@ -374,7 +375,7 @@ _XcursorFindBestSize (XcursorFileHeader *fileHeader, XcursorDim size, int *nsizesp) { - int n; + XcursorUInt n; int nsizes = 0; XcursorDim bestSize = 0; XcursorDim thisSize; @@ -404,7 +405,7 @@ _XcursorFindImageToc (XcursorFileHeader *fileHeader, XcursorDim size, int count) { - int toc; + XcursorUInt toc; XcursorDim thisSize; if (!fileHeader) @@ -423,7 +424,7 @@ _XcursorFindImageToc (XcursorFileHeader *fileHeader, } if (toc == fileHeader->ntoc) return -1; - return toc; + return (int) toc; } static XcursorImage * @@ -462,7 +463,7 @@ _XcursorReadImage (XcursorFile *file, return NULL; /* Create the image and initialize it */ - image = XcursorImageCreate (head.width, head.height); + image = XcursorImageCreate ((int) head.width, (int) head.height); if (image == NULL) return NULL; if (chunkHeader.version < image->version) @@ -471,7 +472,7 @@ _XcursorReadImage (XcursorFile *file, image->xhot = head.xhot; image->yhot = head.yhot; image->delay = head.delay; - n = image->width * image->height; + n = (int) (image->width * image->height); p = image->pixels; while (n--) { @@ -538,7 +539,7 @@ _XcursorWriteImage (XcursorFile *file, return XcursorFalse; /* write the image */ - n = image->width * image->height; + n = (int) (image->width * image->height); p = image->pixels; while (n--) { @@ -567,10 +568,10 @@ _XcursorReadComment (XcursorFile *file, /* read extra comment header fields */ if (!_XcursorReadUInt (file, &length)) return NULL; - comment = XcursorCommentCreate (chunkHeader.subtype, length); + comment = XcursorCommentCreate (chunkHeader.subtype, (int) length); if (!comment) return NULL; - if (!_XcursorReadBytes (file, comment->comment, length)) + if (!_XcursorReadBytes (file, comment->comment, (int) length)) { XcursorCommentDestroy (comment); return NULL; @@ -582,7 +583,7 @@ _XcursorReadComment (XcursorFile *file, static XcursorUInt _XcursorCommentLength (XcursorComment *comment) { - return XCURSOR_COMMENT_HEADER_LEN + strlen (comment->comment); + return XCURSOR_COMMENT_HEADER_LEN + (XcursorUInt) strlen (comment->comment); } static XcursorBool @@ -597,7 +598,7 @@ _XcursorWriteComment (XcursorFile *file, if (!file || !fileHeader || !comment || !comment->comment) return XcursorFalse; - length = strlen (comment->comment); + length = (XcursorUInt) strlen (comment->comment); /* sanity check data */ if (length > XCURSOR_COMMENT_MAX_LEN) @@ -616,7 +617,7 @@ _XcursorWriteComment (XcursorFile *file, if (!_XcursorWriteUInt (file, length)) return XcursorFalse; - if (!_XcursorWriteBytes (file, comment->comment, length)) + if (!_XcursorWriteBytes (file, comment->comment, (int) length)) return XcursorFalse; return XcursorTrue; } @@ -654,7 +655,6 @@ XcursorXcFileLoadImages (XcursorFile *file, int size) int nsize; XcursorImages *images; int n; - int toc; if (!file || size < 0) return NULL; @@ -675,7 +675,7 @@ XcursorXcFileLoadImages (XcursorFile *file, int size) } for (n = 0; n < nsize; n++) { - toc = _XcursorFindImageToc (fileHeader, bestSize, n); + int toc = _XcursorFindImageToc (fileHeader, bestSize, n); if (toc < 0) break; images->images[images->nimage] = _XcursorReadImage (file, fileHeader, @@ -700,8 +700,8 @@ XcursorXcFileLoadAllImages (XcursorFile *file) XcursorImage *image; XcursorImages *images; int nimage; - int n; - int toc; + XcursorUInt n; + XcursorUInt toc; if (!file) return NULL; @@ -728,7 +728,7 @@ XcursorXcFileLoadAllImages (XcursorFile *file) { switch (fileHeader->tocs[toc].type) { case XCURSOR_IMAGE_TYPE: - image = _XcursorReadImage (file, fileHeader, toc); + image = _XcursorReadImage (file, fileHeader, (int) toc); if (image) { images->images[images->nimage] = image; @@ -758,7 +758,7 @@ XcursorXcFileLoad (XcursorFile *file, XcursorImage *image; XcursorComment *comment; XcursorComments *comments; - int toc; + XcursorUInt toc; if (!file) return 0; @@ -791,7 +791,7 @@ XcursorXcFileLoad (XcursorFile *file, { switch (fileHeader->tocs[toc].type) { case XCURSOR_COMMENT_TYPE: - comment = _XcursorReadComment (file, fileHeader, toc); + comment = _XcursorReadComment (file, fileHeader, (int) toc); if (comment) { comments->comments[comments->ncomment] = comment; @@ -799,7 +799,7 @@ XcursorXcFileLoad (XcursorFile *file, } break; case XCURSOR_IMAGE_TYPE: - image = _XcursorReadImage (file, fileHeader, toc); + image = _XcursorReadImage (file, fileHeader, (int) toc); if (image) { images->images[images->nimage] = image; @@ -835,7 +835,7 @@ XcursorXcFileSave (XcursorFile *file, if (!file || !comments || !images) return XcursorFalse; - fileHeader = _XcursorFileHeaderCreate (comments->ncomment + images->nimage); + fileHeader = _XcursorFileHeaderCreate ((XcursorUInt) (comments->ncomment + images->nimage)); if (!fileHeader) return XcursorFalse; @@ -903,14 +903,14 @@ static int _XcursorStdioFileRead (XcursorFile *file, unsigned char *buf, int len) { FILE *f = file->closure; - return fread (buf, 1, len, f); + return (int) fread (buf, 1, (size_t) len, f); } static int _XcursorStdioFileWrite (XcursorFile *file, unsigned char *buf, int len) { FILE *f = file->closure; - return fwrite (buf, 1, len, f); + return (int) fwrite (buf, 1, (size_t) len, f); } static int diff --git a/lib/libXcursor/src/library.c b/lib/libXcursor/src/library.c index 364703d3a..c8fa2c54b 100644 --- a/lib/libXcursor/src/library.c +++ b/lib/libXcursor/src/library.c @@ -32,6 +32,11 @@ #define XCURSORPATH "~/.local/share/icons:~/.icons:/usr/share/icons:/usr/share/pixmaps:"ICONDIR #endif +typedef struct XcursorInherit { + char *line; + const char *theme; +} XcursorInherit; + const char * XcursorLibraryPath (void) { @@ -58,15 +63,15 @@ _XcursorAddPathElt (char *path, const char *elt, int len) pathlen++; } if (len == -1) - len = strlen (elt); + len = (int) strlen (elt); /* strip leading slashes */ while (len && elt[0] == '/') { elt++; len--; } - strncpy (path + pathlen, elt, len); - path[pathlen + len] = '\0'; + strncpy (path + pathlen, elt, (size_t) len); + path[pathlen + (size_t) len] = '\0'; } static char * @@ -82,19 +87,19 @@ _XcursorBuildThemeDir (const char *dir, const char *theme) int len; if (!dir || !theme) - return NULL; + return NULL; colon = strchr (dir, ':'); if (!colon) colon = dir + strlen (dir); - dirlen = colon - dir; + dirlen = (int) (colon - dir); tcolon = strchr (theme, ':'); if (!tcolon) tcolon = theme + strlen (theme); - themelen = tcolon - theme; + themelen = (int) (tcolon - theme); home = NULL; homelen = 0; @@ -103,7 +108,7 @@ _XcursorBuildThemeDir (const char *dir, const char *theme) home = getenv ("HOME"); if (!home) return NULL; - homelen = strlen (home); + homelen = (int) strlen (home); dir++; dirlen--; } @@ -114,7 +119,7 @@ _XcursorBuildThemeDir (const char *dir, const char *theme) */ len = 1 + homelen + 1 + dirlen + 1 + themelen + 1; - full = malloc (len); + full = malloc ((size_t)len); if (!full) return NULL; full[0] = '\0'; @@ -132,7 +137,7 @@ _XcursorBuildFullname (const char *dir, const char *subdir, const char *file) char *full; if (!dir || !subdir || !file) - return NULL; + return NULL; full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1); if (!full) @@ -165,7 +170,7 @@ _XcursorThemeInherits (const char *full) FILE *f; if (!full) - return NULL; + return NULL; f = fopen (full, "r"); if (f) @@ -175,7 +180,6 @@ _XcursorThemeInherits (const char *full) if (!strncmp (line, "Inherits", 8)) { char *l = line + 8; - char *r; while (*l == ' ') l++; if (*l != '=') continue; l++; @@ -183,7 +187,7 @@ _XcursorThemeInherits (const char *full) result = malloc (strlen (l) + 1); if (result) { - r = result; + char *r = result; while (*l) { while (XcursorSep(*l) || XcursorWhite (*l)) l++; @@ -206,19 +210,20 @@ _XcursorThemeInherits (const char *full) } #define XCURSOR_SCAN_CORE ((FILE *) 1) +#define MAX_INHERITS_DEPTH 32 static FILE * XcursorScanTheme (const char *theme, const char *name) { - FILE *f = NULL; - char *full; - char *dir; - const char *path; - char *inherits = NULL; - const char *i; + FILE *f = NULL; + char *full; + char *dir; + const char *path; + XcursorInherit inherits[MAX_INHERITS_DEPTH + 1]; + int d; if (!theme || !name) - return NULL; + return NULL; /* * XCURSOR_CORE_THEME is a magic name; cursors from the core set @@ -228,46 +233,72 @@ XcursorScanTheme (const char *theme, const char *name) */ if (!strcmp (theme, XCURSOR_CORE_THEME) && XcursorLibraryShape (name) >= 0) return XCURSOR_SCAN_CORE; - /* - * Scan this theme - */ - for (path = XcursorLibraryPath (); - path && f == NULL; - path = _XcursorNextPath (path)) + + memset (inherits, 0, sizeof (inherits)); + + d = 0; + inherits[d].theme = theme; + + while (f == NULL && d >= 0 && inherits[d].theme != NULL) { - dir = _XcursorBuildThemeDir (path, theme); - if (dir) + /* + * Scan this theme + */ + for (path = XcursorLibraryPath (); + path && f == NULL; + path = _XcursorNextPath (path)) { - full = _XcursorBuildFullname (dir, "cursors", name); - if (full) + dir = _XcursorBuildThemeDir (path, inherits[d].theme); + if (dir) { - f = fopen (full, "r"); - free (full); - } - if (!f && !inherits) - { - full = _XcursorBuildFullname (dir, "", "index.theme"); + full = _XcursorBuildFullname (dir, "cursors", name); if (full) { - inherits = _XcursorThemeInherits (full); + f = fopen (full, "r"); free (full); } + if (!f && inherits[d + 1].line == NULL) + { + if (d + 1 >= MAX_INHERITS_DEPTH) + { + free (dir); + goto finish; + } + full = _XcursorBuildFullname (dir, "", "index.theme"); + if (full) + { + inherits[d + 1].line = _XcursorThemeInherits (full); + inherits[d + 1].theme = inherits[d + 1].line; + free (full); + } + } + free (dir); } - free (dir); } + + d++; + while (d > 0 && inherits[d].theme == NULL) + { + free (inherits[d].line); + inherits[d].line = NULL; + + if (--d == 0) + inherits[d].theme = NULL; + else + inherits[d].theme = _XcursorNextPath (inherits[d].theme); + } + + /* + * Detect and break self reference loop early on. + */ + if (inherits[d].theme != NULL && strcmp (inherits[d].theme, theme) == 0) + break; } - /* - * Recurse to scan inherited themes - */ - for (i = inherits; i && f == NULL; i = _XcursorNextPath (i)) - { - if (strcmp(i, theme) != 0) - f = XcursorScanTheme (i, name); - else - printf("Not calling XcursorScanTheme because of circular dependency: %s. %s", i, name); - } - if (inherits != NULL) - free (inherits); + +finish: + for (d = 1; d <= MAX_INHERITS_DEPTH; d++) + free (inherits[d].line); + return f; } @@ -278,15 +309,13 @@ XcursorLibraryLoadImage (const char *file, const char *theme, int size) XcursorImage *image = NULL; if (!file) - return NULL; + return NULL; if (theme) f = XcursorScanTheme (theme, file); if (!f) f = XcursorScanTheme ("default", file); - if (f == XCURSOR_SCAN_CORE) - return NULL; - if (f) + if (f != NULL && f != XCURSOR_SCAN_CORE) { image = XcursorFileLoadImage (f, size); fclose (f); @@ -301,15 +330,13 @@ XcursorLibraryLoadImages (const char *file, const char *theme, int size) XcursorImages *images = NULL; if (!file) - return NULL; + return NULL; if (theme) f = XcursorScanTheme (theme, file); if (!f) f = XcursorScanTheme ("default", file); - if (f == XCURSOR_SCAN_CORE) - return NULL; - if (f) + if (f != NULL && f != XCURSOR_SCAN_CORE) { images = XcursorFileLoadImages (f, size); if (images) @@ -328,14 +355,14 @@ XcursorLibraryLoadCursor (Display *dpy, const char *file) Cursor cursor; if (!file) - return 0; + return 0; if (!images) { int id = XcursorLibraryShape (file); if (id >= 0) - return _XcursorCreateFontCursor (dpy, id); + return _XcursorCreateFontCursor (dpy, (unsigned) id); else return 0; } @@ -356,7 +383,7 @@ XcursorLibraryLoadCursors (Display *dpy, const char *file) XcursorCursors *cursors; if (!file) - return NULL; + return NULL; if (!images) { @@ -367,7 +394,7 @@ XcursorLibraryLoadCursors (Display *dpy, const char *file) cursors = XcursorCursorsCreate (dpy, 1); if (cursors) { - cursors->cursors[0] = _XcursorCreateFontCursor (dpy, id); + cursors->cursors[0] = _XcursorCreateFontCursor (dpy, (unsigned) id); if (cursors->cursors[0] == None) { XcursorCursorsDestroy (cursors); @@ -529,15 +556,13 @@ int XcursorLibraryShape (const char *library) { int low, high; - int mid; - int c; low = 0; high = NUM_STANDARD_NAMES - 1; while (low < high - 1) { - mid = (low + high) >> 1; - c = strcmp (library, STANDARD_NAME (mid)); + int mid = (low + high) >> 1; + int c = strcmp (library, STANDARD_NAME (mid)); if (c == 0) return (mid << 1); if (c > 0) diff --git a/lib/libXcursor/src/xlib.c b/lib/libXcursor/src/xlib.c index 15716b2de..63f0225fe 100644 --- a/lib/libXcursor/src/xlib.c +++ b/lib/libXcursor/src/xlib.c @@ -32,7 +32,6 @@ _XcursorFontIsCursor (Display *dpy, Font font) XcursorDisplayInfo *info; XcursorBool ret; XFontStruct *fs; - int n; Atom cursor; if (!dpy || !font) @@ -57,6 +56,7 @@ _XcursorFontIsCursor (Display *dpy, Font font) fs = XQueryFont (dpy, font); if (fs) { + int n; cursor = XInternAtom (dpy, "cursor", False); for (n = 0; n < fs->n_properties; n++) if (fs->properties[n].name == XA_FONT) @@ -291,7 +291,7 @@ XcursorImageHash (XImage *image, if (bit_swap) t = _reverse_byte[t]; if (t) - hash[(i++) & (XCURSOR_BITMAP_HASH_SIZE - 1)] ^= RotByte (t, y & 7); + hash[(i++) & (XCURSOR_BITMAP_HASH_SIZE - 1)] ^= (unsigned char) RotByte (t, y & 7); } line += image->bytes_per_line; } @@ -336,7 +336,7 @@ XcursorNoticePutBitmap (Display *dpy, /* * Make sure the image fills the bitmap */ - if (image->width != bmi->width || image->height != bmi->height) + if (image->width != (int)bmi->width || image->height != (int)bmi->height) { bmi->bitmap = 0; return; @@ -403,6 +403,10 @@ XcursorTryShapeBitmapCursor (Display *dpy, int i; Cursor cursor; + (void) mask; /* UNUSED */ + (void) x; /* UNUSED */ + (void) y; /* UNUSED */ + if (!dpy || !foreground || !background) return 0; |