sync with OpenBSD -current

This commit is contained in:
purplerain 2025-01-10 01:40:29 +00:00
parent 4b49aefbb1
commit 1fd36b57f8
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
945 changed files with 81965 additions and 59988 deletions

View file

@ -1,3 +1,210 @@
commit 8ae6cf61b18ecddf26f72a07bbfbd1ea9f022c36
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Mon Nov 4 04:06:21 2024 -0500
amend per merge_requests/22#note_2642042
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit 68fe24020cf637df092db42c79b5e7ee0c04c17b
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Mon Nov 4 04:00:20 2024 -0500
amend per merge_requests/22#note_2642034
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit 8d27f282e40f855a41de53becba07fd5a2ceee0f
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Sun Nov 3 19:05:59 2024 -0500
reduce the message-check to ignore the over-long one
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit d8b955d6b225f2dc2dcc7946fd73c87b5c9b4b2d
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Sun Nov 3 18:50:54 2024 -0500
fix overlooked compiler-warning
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit cb2d1b97c39723efd2475fd6c93089aaca560e6a
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Sun Nov 3 18:33:06 2024 -0500
add debug-trace for the configuration information
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit 304ac296f3207e46d36e0628af2702e83f6dc259
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Sun Nov 3 17:36:03 2024 -0500
ensure ncomment and nimage values are positive
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit 00a59a71994ce3e2484dc0241117d8d9a0095514
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Fri Nov 1 19:49:27 2024 -0400
changes will suggest new release
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit 83071fff3f09a3c2ff45061f6082d5d77d074073
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Thu Oct 31 20:20:09 2024 -0400
document/tidy the new set/get functions
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit fa5c5bb1bdf379e616e239e5edfac06d489d73ea
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Thu Oct 31 20:08:13 2024 -0400
document the new XCURSOR_RESIZED environment variable and resource "resized"
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit f155414617de37ab49c81f8d9fa352dc31e77d80
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Thu Oct 31 18:59:24 2024 -0400
add traces for library.c and xlib.c, also another internal function for dpy
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit fbfe95e05f6791c1f66d5f16b200c19f243454b6
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Wed Oct 30 19:16:09 2024 -0400
add debug-logging for file.c, to help with analysis
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit 8a1de722164f60aa721fdb8d70d56505e52f4bd6
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Tue Oct 29 16:53:05 2024 -0400
add/use _XcursorLibraryLoadImages to pass resized-parameter when loading
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit b00d7da27bd5dad244e076e55df27143a9a5b55f
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Tue Oct 29 16:44:17 2024 -0400
use resized-parameter where available when loading images
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit 5cb505f21e0baec05f4eaa445663bad8cc1d0e5a
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Tue Oct 29 16:36:57 2024 -0400
provide internal variants of existing functions to pass "resized" parameter
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit e7272c804610bbc61a751b6faf5744028c4e9c3f
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Tue Oct 29 16:10:51 2024 -0400
restore behavior of image-loading, provide resizing via internal function
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit 6816ed58e9217a70734137e3c934de1fa8588866
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Tue Oct 29 04:07:17 2024 -0400
add getter/setter for "resized" property
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit e5e63e2ba8395c538ca1377323bbc8879bcfd696
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Tue Oct 29 04:01:49 2024 -0400
add new property "resized" and environment "XCURSOR_RESIZED"
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit a5739d863beec78719cf1667382fc2323ff76481
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Sun Oct 27 19:17:19 2024 -0400
trim redundant code from the resize-calls
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit e1b6d3abb4bf09f42e8144e019a322a9a39e043f
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Sun Oct 27 12:49:16 2024 -0400
improve manpage formatting
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit 7e03738efd6d19c141e8a4e0a59a9b628ffa7fd8
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Sun Oct 27 10:12:52 2024 -0400
fix compiler warnings
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit b09856069ce80409c7b03f13a96584a820898bff
Author: Thomas E. Dickey <dickey@invisible-island.net>
Date: Sun Oct 27 06:40:18 2024 -0400
build-fix
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
commit dfc856124754c3638460adbecc74dfe7e41987ce
Author: Jin Liu <m.liu.jin@gmail.com>
Date: Fri Oct 11 10:51:47 2024 +0800
Remove unnecessary MIN calls
commit a21cdaf167f449f7c9eb2baab4150ea864d8c8da
Author: Jin Liu <m.liu.jin@gmail.com>
Date: Thu Oct 10 11:43:30 2024 +0800
Change all *LoadImage(..., size) APIs to always return a cursor with the requested size.
Callers of these APIs (especially on Wayland) currently uses different
strategies to scale the returned cursor to the size set by the user,
resulting in inconsistent cursor sizes and looks across different apps
and toolkits. Having the cursor scaled in libXcursor will skip app's
own scaling algorithm and guarantee a consistent look.
`*LoadAllImages()` are not changed. They still only return the sizes present
in the theme.
This change needs to be synchronized to libraries (libxcb-cursor, wayland),
toolkits (GTK), window managers / Wayland compositors (i3, wlroots) who have
a (modified) copy of libXcursor source code, in order to have a fully consistent
cursor size across all apps.
Signed-off-by: Jin Liu <m.liu.jin@gmail.com>
commit 833735e3232e28153411b3703dfe51883edf47ea
Author: Tobias Stoeckmann <tobias@stoeckmann.org>
Date: Thu Sep 12 22:23:50 2024 +0200
Ignore invalid cursor files
If a cursor file contains a header offset which is too small, ignore
the file instead of jumping to an incorrect offset.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
commit 09617bcc9a0f1b5072212da5f8fede92ab85d157
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Mar 2 12:55:30 2024 -0800

View file

@ -1,6 +1,6 @@
# $OpenBSD: Makefile.bsd-wrapper,v 1.5 2013/08/13 07:07:14 guenther Exp $
# $OpenBSD: Makefile.bsd-wrapper,v 1.6 2024/11/11 09:26:22 matthieu Exp $
SHARED_LIBS= Xcursor 5.0
SHARED_LIBS= Xcursor 5.1
CONFIGURE_ARGS+= --with-cursorpath="~/.icons:/usr/local/lib/X11/icons:/usr/local/share/icons:/usr/local/share/pixmaps:${X11BASE}/share/icons:${X11BASE}/share/pixmaps"

View file

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for libXcursor 1.2.2.
# Generated by GNU Autoconf 2.71 for libXcursor 1.2.3.
#
# Report bugs to <https://gitlab.freedesktop.org/xorg/lib/libxcursor/-/issues>.
#
@ -622,8 +622,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libXcursor'
PACKAGE_TARNAME='libXcursor'
PACKAGE_VERSION='1.2.2'
PACKAGE_STRING='libXcursor 1.2.2'
PACKAGE_VERSION='1.2.3'
PACKAGE_STRING='libXcursor 1.2.3'
PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/lib/libxcursor/-/issues'
PACKAGE_URL=''
@ -1391,7 +1391,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.2 to adapt to many kinds of systems.
\`configure' configures libXcursor 1.2.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1462,7 +1462,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libXcursor 1.2.2:";;
short | recursive ) echo "Configuration of libXcursor 1.2.3:";;
esac
cat <<\_ACEOF
@ -1593,7 +1593,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libXcursor configure 1.2.2
libXcursor configure 1.2.3
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@ -1863,7 +1863,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.2, which was
It was created by libXcursor $as_me 1.2.3, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@ -4337,7 +4337,7 @@ fi
# Define the identity of the package.
PACKAGE='libXcursor'
VERSION='1.2.2'
VERSION='1.2.3'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@ -19256,7 +19256,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.2, which was
This file was extended by libXcursor $as_me 1.2.3, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -19324,7 +19324,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
libXcursor config.status 1.2.2
libXcursor config.status 1.2.3
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"

View file

@ -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.2],
AC_INIT([libXcursor], [1.2.3],
[https://gitlab.freedesktop.org/xorg/lib/libxcursor/-/issues],
[libXcursor])
AC_CONFIG_SRCDIR([Makefile.am])

View file

@ -1,4 +1,5 @@
/*
* Copyright © 2024 Thomas E. Dickey
* Copyright © 2002 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -483,6 +484,12 @@ XcursorSetDefaultSize (Display *dpy, int size);
int
XcursorGetDefaultSize (Display *dpy);
XcursorBool
XcursorSetResizable (Display *dpy, XcursorBool flag);
XcursorBool
XcursorGetResizable (Display *dpy);
XcursorBool
XcursorSetTheme (Display *dpy, const char *theme);

View file

@ -730,7 +730,6 @@ _LT_CONFIG_SAVE_COMMANDS([
cat <<_LT_EOF >> "$cfgfile"
#! $SHELL
# Generated automatically by $as_me ($PACKAGE) $VERSION
# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
# Provide generalized library-building support services.
@ -2907,6 +2906,18 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
dynamic_linker='GNU/Linux ld.so'
;;
netbsdelf*-gnu)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
dynamic_linker='NetBSD ld.elf_so'
;;
netbsd*)
version_type=sunos
need_lib_prefix=no
@ -3566,7 +3577,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
lt_cv_deplibs_check_method=pass_all
;;
netbsd*)
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
else
@ -4072,7 +4083,8 @@ _LT_EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
$ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD
if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
@ -4444,7 +4456,7 @@ m4_if([$1], [CXX], [
;;
esac
;;
netbsd*)
netbsd* | netbsdelf*-gnu)
;;
*qnx* | *nto*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
@ -4712,6 +4724,12 @@ m4_if([$1], [CXX], [
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
# flang / f18. f95 an alias for gfortran or flang on Debian
flang* | f18* | f95*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
# icc used to be incompatible with GCC.
# ICC 10 doesn't accept -KPIC any more.
icc* | ifort*)
@ -4956,6 +4974,9 @@ m4_if([$1], [CXX], [
;;
esac
;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
;;
@ -5018,6 +5039,9 @@ dnl Note also adjust exclude_expsyms for C++ above.
openbsd* | bitrig*)
with_gnu_ld=no
;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
esac
_LT_TAGVAR(ld_shlibs, $1)=yes
@ -5253,6 +5277,7 @@ _LT_EOF
case $cc_basename in
tcc*)
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic'
;;
xlf* | bgf* | bgxlf* | mpixlf*)
@ -5273,7 +5298,7 @@ _LT_EOF
fi
;;
netbsd*)
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
@ -5794,6 +5819,7 @@ _LT_EOF
if test yes = "$lt_cv_irix_exported_symbol"; then
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
fi
_LT_TAGVAR(link_all_deplibs, $1)=no
else
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
@ -5811,11 +5837,12 @@ _LT_EOF
# Fabrice Bellard et al's Tiny C Compiler
_LT_TAGVAR(ld_shlibs, $1)=yes
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
;;
esac
;;
netbsd*)
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
@ -6442,7 +6469,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
else
GXX=no
@ -6818,7 +6845,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test yes = "$GXX"; then
@ -6883,7 +6910,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test yes = "$GXX"; then
@ -7222,7 +7249,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
else
# FIXME: insert proper C++ library support
@ -7306,7 +7333,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
else
# g++ 2.7 appears to require '-G' NOT '-shared' on this
# platform.
@ -7317,7 +7344,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir'

View file

@ -1,5 +1,5 @@
.\"
.\" Copyright © 2021 Thomas E. Dickey
.\" Copyright © 2021,2024 Thomas E. Dickey
.\" Copyright © 2002 Keith Packard
.\"
.\" Permission to use, copy, modify, distribute, and sell this software and
@ -25,14 +25,17 @@
.el .ta 0.5i 1.0i 1.5i 2.0i
..
.de PS
.sp
.ns
.TP \\$1
.TP
.na
.nf
.ie n .ta 0.8i 3.0i
.el .ta 0.5i 2.0i
..
.de PC
.sp
.PS
..
.de PE
.br
.ad
@ -71,8 +74,8 @@
.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>
@ -99,7 +102,7 @@ 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
.SS "CURSOR FILES"
Xcursor defines a new format for cursors on disk.
Each file holds
one or more cursor images.
@ -121,7 +124,7 @@ The file header looks like:
\fIversion\fP\^: CARD32 file version number
\fIntoc\fP\^: CARD32 number of toc entries
\fItoc\fP\^: LISTofTOC table of contents
.in -.2i
.QE
.P
Each table of contents entry looks like:
.LP
@ -131,7 +134,6 @@ Each table of contents entry looks like:
\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
@ -194,7 +196,7 @@ 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,
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,
@ -308,16 +310,15 @@ typedef struct _XcursorFile {
int (*seek) (XcursorFile *file, long offset, int whence);
};
.QE
.fi
.
.SH FUNCTIONS
.
.SS Object Management
.SS "Object Management"
.PS
XcursorImage *XcursorImageCreate (
int \fIwidth\fP,
int \fIheight\fP)
.PS
.PC
void XcursorImageDestroy (
XcursorImage *\fIimage\fP)
.PE
@ -328,7 +329,7 @@ The size is set to the maximum of \fIwidth\fP and \fIheight\fP.
.PS
XcursorImages *XcursorImagesCreate (
int \fIsize\fP)
.PS
.PC
void XcursorImagesDestroy (
XcursorImages *\fIimages\fP)
.PE
@ -339,7 +340,7 @@ On allocation, \fInimage\fP is set to zero.
XcursorCursors *XcursorCursorsCreate (
Display *\fIdpy\fP,
int \fIsize\fP)
.PS
.PC
void XcursorCursorsDestroy (
XcursorCursors *\fIcursors\fP)
.PE
@ -347,25 +348,25 @@ 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.
.SS "Reading and writing images"
.
.PS
XcursorImage *XcursorXcFileLoadImage (
XcursorFile *\fIfile\fP,
int \fIsize\fP)
.PS
.PC
XcursorImages *XcursorXcFileLoadImages (
XcursorFile *\fIfile\fP,
int \fIsize\fP)
.PS
.PC
XcursorImages *XcursorXcFileLoadAllImages (
XcursorFile *\fIfile\fP)
.PS
.PC
XcursorBool XcursorXcFileLoad (
XcursorFile *\fIfile\fP,
XcursorComments **\fIcommentsp\fP,
XcursorImages **\fIimagesp\fP)
.PS
.PC
XcursorBool XcursorXcFileSave (
XcursorFile *\fIfile\fP,
const XcursorComments *\fIcomments\fP,
@ -378,23 +379,23 @@ After reading, the file pointer will be left at some random place in the file.
XcursorImage *XcursorFileLoadImage (
FILE *\fIfile\fP,
int \fIsize\fP)
.PS
.PC
XcursorImages *XcursorFileLoadImages (
FILE *\fIfile\fP,
int \fIsize\fP)
.PS
.PC
XcursorImages *XcursorFileLoadAllImages (
FILE *\fIfile\fP)
.PS
.PC
XcursorBool XcursorFileLoad (
FILE *\fIfile\fP,
XcursorComments **\fIcommentsp\fP,
XcursorImages **\fIimagesp\fP)
.PS
.PC
XcursorBool XcursorFileSaveImages (
FILE *\fIfile\fP,
const XcursorImages *\fIimages\fP)
.PS
.PC
XcursorBool XcursorFileSave (
FILE *\fIfile\fP,
const XcursorComments *\fIcomments\fP,
@ -407,23 +408,23 @@ Writing flushes before returning so that any errors should be detected.
XcursorImage *XcursorFilenameLoadImage (
const char *\fIfilename\fP,
int \fIsize\fP)
.PS
.PC
XcursorImages *XcursorFilenameLoadImages (
const char *\fIfilename\fP,
int \fIsize\fP)
.PS
.PC
XcursorImages *XcursorFilenameLoadAllImages (
const char *\fIfile\fP)
.PS
.PC
XcursorBool XcursorFilenameLoad (
const char *\fIfile\fP,
XcursorComments **\fIcommentsp\fP,
XcursorImages **\fIimagesp\fP)
.PS
.PC
XcursorBool XcursorFilenameSaveImages (
const char *\fIfilename\fP,
const XcursorImages *\fIimages\fP)
.PS
.PC
XcursorBool XcursorFilenameSave (
const char *\fIfile\fP,
const XcursorComments *\fIcomments\fP,
@ -431,13 +432,13 @@ XcursorBool XcursorFilenameSave (
.PE
These parallel the stdio FILE interfaces above, but take filenames.
.
.SS Reading library images
.SS "Reading library images"
.PS
XcursorImage *XcursorLibraryLoadImage (
const char *\fIname\fP,
const char *\fItheme\fP,
int \fIsize\fP)
.PS
.PC
XcursorImages *XcursorLibraryLoadImages (
const char *\fIname\fP,
const char *\fItheme\fP,
@ -467,7 +468,7 @@ and (on success)
it calls XcursorImagesSetName to associate \fIname\fP with the result.
.RE
.
.SS Library attributes
.SS "Library attributes"
.PS
const char * XcursorLibraryPath (void)
.PE
@ -480,7 +481,7 @@ return that value.
Otherwise, return the compiled-in search path.
.RE
.
.PS
.PC
int XcursorLibraryShape (
const char *\fIlibrary\fP)
.PE
@ -495,13 +496,13 @@ used in an X cursor font).
If not found, return -1.
.RE
.
.SS Cursor APIs
.SS "Cursor APIs"
.
.PS
Cursor XcursorFilenameLoadCursor (
Display *\fIdpy\fP,
const char *\fIfile\fP)
.PS
.PC
XcursorCursors *XcursorFilenameLoadCursors (
Display *\fIdpy\fP,
const char *\fIfile\fP)
@ -512,7 +513,7 @@ These load cursors from the specified file.
Cursor XcursorLibraryLoadCursor (
Display *\fIdpy\fP,
const char *\fIname\fP)
.PS
.PC
XcursorCursors *XcursorLibraryLoadCursors (
Display *\fIdpy\fP,
const char *\fIname\fP)
@ -534,7 +535,7 @@ XRenderCreateCursor is used if ARGB is supported on the display, and
XCreatePixmapCursor is used otherwise.
.RE
.
.PS
.PC
Cursor XcursorImagesLoadCursor(
Display *\fIdpy\fP,
const XcursorImages *\fIimages\fP)
@ -557,14 +558,14 @@ Normally it returns the resulting array pointer.
On any failure, it discards the result XcursorCursorsDestroy,
and returns NULL.
.
.SS X Cursor Name APIs
.SS "X Cursor Name APIs"
.
.PS
XcursorImage *XcursorShapeLoadImage (
unsigned int \fIshape\fP,
const char *\fItheme\fP,
int \fIsize\fP)
.PS
.PC
XcursorImages *XcursorShapeLoadImages (
unsigned int \fIshape\fP,
const char *\fItheme\fP,
@ -577,14 +578,14 @@ then load the images.
Cursor XcursorShapeLoadCursor (
Display *\fIdpy\fP,
unsigned int \fIshape\fP)
.PS
.PC
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
.SS "X Cursor Comment APIs"
.PS
XcursorComment *XcursorCommentCreate (
XcursorUInt \fIcomment_type\fP,
@ -617,7 +618,7 @@ void XcursorCommentsDestroy (
Deallocates the given XcursorComments structure
as well as the XcursorComment structures which it points to.
.
.SS Animated Cursors
.SS "Animated Cursors"
.PS
XcursorAnimate * XcursorAnimateCreate (
XcursorCursors *\fIcursors\fP)
@ -643,7 +644,7 @@ incrementing the sequence number to prepare for the next call.
The caller is responsible for displaying the series of Cursor images.
Xcursor does not do that.
.
.SS Glyph Cursor APIs
.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
@ -727,7 +728,7 @@ Xcursor calls XcursorShapeLoadImages to load the cursor images.
If successful, Xcursor uses XcursorImagesLoadCursor
to load the cursor information.
.
.SS Display Information APIs
.SS "Display Information APIs"
.
.PS
XcursorBool XcursorSupportsARGB (
@ -759,6 +760,20 @@ int XcursorGetDefaultSize (
Gets the default cursor size.
.
.PS
XcursorBool XcursorSetResizable (
Display *\fIdpy\fP,
XcursorBool \fIresizable\fP)
.PE
Sets the current resizable-cursors state.
.
.PS
XcursorBool XcursorGetResizable (
Display *\fIdpy\fP)
.PE
Gets the current resizable-cursors state.
.
.
.PS
XcursorBool XcursorSetTheme (
Display *\fIdpy\fP,
const char *\fItheme\fP)
@ -771,18 +786,18 @@ char *XcursorGetTheme (
.PE
Gets the current theme name.
.
.PS
.PC
XcursorBool XcursorGetThemeCore (
Display *\fIdpy\fP)
.PS
.PC
XcursorBool XcursorSetThemeCore (
Display *\fIdpy\fP,
XcursorBool \fItheme_core\fP)
.PE
Get or set property which tells Xcursor whether to
Get or set property which tells Xcursor whether to
enable themes for core cursors.
.
.SH "ENVIRONMENT VARIABLES"
.SH ENVIRONMENT
Environment variables can be used to override resource settings,
which in turn override compiled-in default values.
.PP
@ -850,6 +865,13 @@ rather than the compiled-in default list.
.IP
Directories in this path are separated by colons (:).
.TP 15
.B XCURSOR_RESIZED
Enables automatic resizing of cursors to improve their displayed size
if the environment variable is \fItrue\fP.
.IP
If the environment variable is not given,
Xcursor tries the \fBXcursor.resized\fP resource.
.TP 15
.B XCURSOR_SIZE
This variable sets the desired cursor size, in pixels.
.IP
@ -881,6 +903,15 @@ Xcursor tries the \fBXcursor.theme_core\fP resource.
.IP
An application can enable or disable themes using XcursorSetThemeCore.
.
.SH CAVEATS
.B Xcursor
will probably change radically in the future; weak attempts will be made to
retain some level of source-file compatibility.
.
.SH AUTHORS
Keith Packard
Thomas E. Dickey
.
.SH SEE ALSO
.na
XCreateRenderCursor(__libmansuffix__),
@ -893,11 +924,3 @@ as well as
\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

View file

@ -1,4 +1,5 @@
/*
* Copyright © 2024 Thomas E. Dickey
* Copyright © 2002 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -742,9 +743,11 @@ Cursor
XcursorFilenameLoadCursor (Display *dpy, const char *file)
{
int size = XcursorGetDefaultSize (dpy);
XcursorImages *images = XcursorFilenameLoadImages (file, size);
XcursorBool resize = XcursorGetResizable (dpy);
XcursorImages *images;
Cursor cursor;
images = _XcursorFilenameLoadImages (file, size, resize);
if (!images)
return None;
cursor = XcursorImagesLoadCursor (dpy, images);
@ -756,9 +759,11 @@ XcursorCursors *
XcursorFilenameLoadCursors (Display *dpy, const char *file)
{
int size = XcursorGetDefaultSize (dpy);
XcursorImages *images = XcursorFilenameLoadImages (file, size);
XcursorBool resize = XcursorGetResizable (dpy);
XcursorImages *images;
XcursorCursors *cursors;
images = _XcursorFilenameLoadImages (file, size, resize);
if (!images)
return NULL;
cursors = XcursorImagesLoadCursors (dpy, images);

View file

@ -1,4 +1,5 @@
/*
* Copyright © 2024 Thomas E. Dickey
* Copyright © 2002 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -23,6 +24,7 @@
#include "xcursorint.h"
#include <X11/Xlibint.h>
#include <ctype.h>
#include <unistd.h> /* for getpid */
static XcursorDisplayInfo *_XcursorDisplayInfo;
@ -137,6 +139,14 @@ _XcursorGetDisplayInfo (Display *dpy)
}
(void) XESetCloseDisplay (dpy, info->codes->extension, _XcursorCloseDisplay);
/*
* The debugging-trace for new info-blocks begins here.
* As a reminder that multiple processes/threads use this library,
* the current process-id is logged.
*/
traceOpts((T_CALLED(_XcursorGetDisplayInfo) " info %p, pid %d\n",
(void*)info, getpid()));
/*
* Check whether the display supports the Render CreateCursor request
*/
@ -153,6 +163,7 @@ _XcursorGetDisplayInfo (Display *dpy)
v = XGetDefault (dpy, "Xcursor", "core");
if (v && _XcursorDefaultParseBool (v) == 1)
info->has_render_cursor = XcursorFalse;
traceOpts((T_OPTION(XCURSOR_CORE) ": %d\n", info->has_render_cursor));
}
if (info->has_render_cursor && (major > 0 || minor >= 8))
{
@ -162,6 +173,7 @@ _XcursorGetDisplayInfo (Display *dpy)
v = XGetDefault (dpy, "Xcursor", "anim");
if (v && _XcursorDefaultParseBool (v) == 0)
info->has_anim_cursor = XcursorFalse;
traceOpts((T_OPTION(XCURSOR_ANIM) ": %d\n", info->has_anim_cursor));
}
}
@ -175,6 +187,7 @@ _XcursorGetDisplayInfo (Display *dpy)
v = XGetDefault (dpy, "Xcursor", "size");
if (v)
info->size = atoi (v);
traceOpts((T_OPTION(XCURSOR_SIZE) ": %d\n", info->size));
/*
* Use the Xft size to guess a size; make cursors 16 "points" tall
@ -187,6 +200,7 @@ _XcursorGetDisplayInfo (Display *dpy)
dpi = atoi (v);
if (dpi)
info->size = dpi * 16 / 72;
traceOpts((T_OPTION(XCURSOR_SIZE) ": %d\n", info->size));
}
/*
@ -205,11 +219,27 @@ _XcursorGetDisplayInfo (Display *dpy)
* 16 pixels on a display of dimension 768
*/
info->size = dim / 48;
traceOpts((T_OPTION(XCURSOR_SIZE) ": %d\n", info->size));
}
info->theme = NULL;
info->theme_from_config = NULL;
/*
* Provide for making cursors resized to match the requested size
*/
info->resized_cursors = XcursorFalse;
v = getenv ("XCURSOR_RESIZED");
if (!v)
v = XGetDefault (dpy, "Xcursor", "resized");
if (v)
{
i = _XcursorDefaultParseBool (v);
if (i >= 0)
info->resized_cursors = i;
}
traceOpts((T_OPTION(XCURSOR_RESIZED) ": %d\n", info->resized_cursors));
/*
* Get the desired theme
*/
@ -221,6 +251,7 @@ _XcursorGetDisplayInfo (Display *dpy)
info->theme = strdup (v);
info->theme_from_config = strdup (v);
}
traceOpts((T_OPTION(XCURSOR_THEME) ": %s\n", NonNull(info->theme)));
/*
* Get the desired dither
@ -240,6 +271,7 @@ _XcursorGetDisplayInfo (Display *dpy)
if (!strcmp (v, "diffuse"))
info->dither = XcursorDitherDiffuse;
}
traceOpts((T_OPTION(XCURSOR_DITHER) ": %d\n", info->dither));
info->theme_core = False;
/*
@ -255,6 +287,7 @@ _XcursorGetDisplayInfo (Display *dpy)
if (i >= 0)
info->theme_core = i;
}
traceOpts((T_OPTION(XCURSOR_THEME_CORE) ": %d\n", info->theme_core));
info->fonts = NULL;
for (i = 0; i < NUM_BITMAPS; i++)
@ -281,7 +314,7 @@ _XcursorGetDisplayInfo (Display *dpy)
}
_XUnlockMutex (_Xglobal_lock);
return info;
returnAddr(info);
}
XcursorBool
@ -321,6 +354,27 @@ XcursorGetDefaultSize (Display *dpy)
return info->size;
}
XcursorBool
XcursorSetResizable (Display *dpy, XcursorBool flag)
{
XcursorDisplayInfo *info = _XcursorGetDisplayInfo (dpy);
if (!info)
return XcursorFalse;
info->resized_cursors = flag;
return XcursorTrue;
}
XcursorBool
XcursorGetResizable (Display *dpy)
{
XcursorDisplayInfo *info = _XcursorGetDisplayInfo (dpy);
if (!info)
return 0;
return info->resized_cursors;
}
XcursorBool
XcursorSetTheme (Display *dpy, const char *theme)
{
@ -365,7 +419,6 @@ XcursorGetThemeCore (Display *dpy)
if (!info)
return XcursorFalse;
return info->theme_core;
}
XcursorBool

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,5 @@
/*
* Copyright © 2024 Thomas E. Dickey
* Copyright © 2002 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -47,6 +48,7 @@ XcursorLibraryPath (void)
path = getenv ("XCURSOR_PATH");
if (!path)
path = XCURSORPATH;
traceOpts((T_OPTION(XCURSOR_PATH) ": %s\n", NonNull(path)));
}
return path;
}
@ -314,8 +316,11 @@ XcursorLibraryLoadImage (const char *file, const char *theme, int size)
FILE *f = NULL;
XcursorImage *image = NULL;
enterFunc((T_CALLED(XcursorLibraryLoadImage) "(\"%s\",\"%s\", %d)\n",
NonNull(file), NonNull(theme), size));
if (!file)
return NULL;
returnAddr(NULL);
if (theme)
f = XcursorScanTheme (theme, file);
@ -326,12 +331,15 @@ XcursorLibraryLoadImage (const char *file, const char *theme, int size)
image = XcursorFileLoadImage (f, size);
fclose (f);
}
return image;
returnAddr(image);
}
XcursorImages *
XcursorLibraryLoadImages (const char *file, const char *theme, int size)
static XcursorImages *
_XcursorLibraryLoadImages (Display *dpy, const char *file)
{
int size = XcursorGetDefaultSize (dpy);
char *theme = XcursorGetTheme (dpy);
XcursorBool resized = XcursorGetResizable (dpy);
FILE *f = NULL;
XcursorImages *images = NULL;
@ -344,7 +352,7 @@ XcursorLibraryLoadImages (const char *file, const char *theme, int size)
f = XcursorScanTheme ("default", file);
if (f != NULL && f != XCURSOR_SCAN_CORE)
{
images = XcursorFileLoadImages (f, size);
images = _XcursorFileLoadImages (f, size, resized);
if (images)
XcursorImagesSetName (images, file);
fclose (f);
@ -352,45 +360,76 @@ XcursorLibraryLoadImages (const char *file, const char *theme, int size)
return images;
}
XcursorImages *
XcursorLibraryLoadImages (const char *file, const char *theme, int size)
{
FILE *f = NULL;
XcursorImages *images = NULL;
enterFunc((T_CALLED(XcursorLibraryLoadImages) "(\"%s\", \"%s\", %d)\n",
NonNull(file), NonNull(theme), size));
if (!file)
returnAddr(NULL);
if (theme)
f = XcursorScanTheme (theme, file);
if (!f)
f = XcursorScanTheme ("default", file);
if (f != NULL && f != XCURSOR_SCAN_CORE)
{
images = XcursorFileLoadImages (f, size);
if (images)
XcursorImagesSetName (images, file);
fclose (f);
}
returnAddr(images);
}
Cursor
XcursorLibraryLoadCursor (Display *dpy, const char *file)
{
int size = XcursorGetDefaultSize (dpy);
char *theme = XcursorGetTheme (dpy);
XcursorImages *images = XcursorLibraryLoadImages (file, theme, size);
Cursor cursor;
XcursorImages *images;
Cursor cursor = 0;
enterFunc((T_CALLED(XcursorLibraryLoadCursor) "(%p, \"%s\")\n",
(void*)dpy, NonNull(file)));
if (!file)
return 0;
returnLong(cursor);
images = _XcursorLibraryLoadImages (dpy, file);
if (!images)
{
int id = XcursorLibraryShape (file);
if (id >= 0)
return _XcursorCreateFontCursor (dpy, (unsigned) id);
else
return 0;
cursor = _XcursorCreateFontCursor (dpy, (unsigned) id);
}
cursor = XcursorImagesLoadCursor (dpy, images);
XcursorImagesDestroy (images);
else
{
cursor = XcursorImagesLoadCursor (dpy, images);
XcursorImagesDestroy (images);
#if defined HAVE_XFIXES && XFIXES_MAJOR >= 2
XFixesSetCursorName (dpy, cursor, file);
XFixesSetCursorName (dpy, cursor, file);
#endif
return cursor;
}
returnLong(cursor);
}
XcursorCursors *
XcursorLibraryLoadCursors (Display *dpy, const char *file)
{
int size = XcursorGetDefaultSize (dpy);
char *theme = XcursorGetTheme (dpy);
XcursorImages *images = XcursorLibraryLoadImages (file, theme, size);
XcursorImages *images;
XcursorCursors *cursors;
if (!file)
return NULL;
enterFunc((T_CALLED(XcursorLibraryLoadCursors) "(%p, \"%s\")\n",
(void*)dpy, NonNull(file)));
if (!file)
returnAddr(NULL);
images = _XcursorLibraryLoadImages (dpy, file);
if (!images)
{
int id = XcursorLibraryShape (file);
@ -418,7 +457,7 @@ XcursorLibraryLoadCursors (Display *dpy, const char *file)
cursors = XcursorImagesLoadCursors (dpy, images);
XcursorImagesDestroy (images);
}
return cursors;
returnAddr(cursors);
}
static const char _XcursorStandardNames[] =
@ -518,44 +557,75 @@ XcursorImage *
XcursorShapeLoadImage (unsigned int shape, const char *theme, int size)
{
unsigned int id = shape >> 1;
XcursorImage *result = NULL;
enterFunc((T_CALLED(XcursorShapeLoadImage) "(%u, \"%s\", %d)\n",
shape, NonNull(theme), size));
if (id < NUM_STANDARD_NAMES)
return XcursorLibraryLoadImage (STANDARD_NAME (id), theme, size);
else
return NULL;
result = XcursorLibraryLoadImage (STANDARD_NAME (id), theme, size);
returnAddr(result);
}
XcursorImages *
_XcursorShapeLoadImages (Display *dpy, unsigned int shape)
{
unsigned int id = shape >> 1;
XcursorImages *result = NULL;
enterFunc((T_CALLED(_XcursorShapeLoadImages) "(%p, %u)\n",
(void*)dpy, shape));
if (id < NUM_STANDARD_NAMES)
result = _XcursorLibraryLoadImages (dpy, STANDARD_NAME (id));
returnAddr(result);
}
XcursorImages *
XcursorShapeLoadImages (unsigned int shape, const char *theme, int size)
{
unsigned int id = shape >> 1;
XcursorImages *result = NULL;
enterFunc((T_CALLED(XcursorShapeLoadImages) "(%u, \"%s\", %d)\n",
shape, NonNull(theme), size));
if (id < NUM_STANDARD_NAMES)
return XcursorLibraryLoadImages (STANDARD_NAME (id), theme, size);
else
return NULL;
result = XcursorLibraryLoadImages (STANDARD_NAME (id), theme, size);
returnAddr(result);
}
Cursor
XcursorShapeLoadCursor (Display *dpy, unsigned int shape)
{
unsigned int id = shape >> 1;
Cursor result = None;
enterFunc((T_CALLED(XcursorShapeLoadCursor) "(%p, %u)\n",
(void*)dpy, shape));
if (id < NUM_STANDARD_NAMES)
return XcursorLibraryLoadCursor (dpy, STANDARD_NAME (id));
else
return 0;
result = XcursorLibraryLoadCursor (dpy, STANDARD_NAME (id));
returnLong(result);
}
XcursorCursors *
XcursorShapeLoadCursors (Display *dpy, unsigned int shape)
{
unsigned int id = shape >> 1;
XcursorCursors *result = NULL;
enterFunc((T_CALLED(XcursorShapeLoadCursors) "(%p, %u)\n",
(void*)dpy, shape));
if (id < NUM_STANDARD_NAMES)
return XcursorLibraryLoadCursors (dpy, STANDARD_NAME (id));
else
return NULL;
result = XcursorLibraryLoadCursors (dpy, STANDARD_NAME (id));
returnAddr(result);
}
int
@ -563,6 +633,8 @@ XcursorLibraryShape (const char *library)
{
int low, high;
enterFunc((T_CALLED(XcursorLibraryShape) "(%s)\n", NonNull(library)));
low = 0;
high = NUM_STANDARD_NAMES - 1;
while (low < high - 1)
@ -570,7 +642,7 @@ XcursorLibraryShape (const char *library)
int mid = (low + high) >> 1;
int c = strcmp (library, STANDARD_NAME (mid));
if (c == 0)
return (mid << 1);
returnCode(mid << 1);
if (c > 0)
low = mid;
else
@ -582,5 +654,5 @@ XcursorLibraryShape (const char *library)
return (low << 1);
low++;
}
return -1;
returnCode(-1);
}

View file

@ -1,4 +1,5 @@
/*
* Copyright © 2024 Thomas E. Dickey
* Copyright © 2002 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -86,6 +87,7 @@ typedef struct _XcursorDisplayInfo {
XExtCodes *codes;
XcursorBool has_render_cursor;
XcursorBool has_anim_cursor;
XcursorBool resized_cursors;
XcursorBool theme_core;
int size;
XcursorFontInfo *fonts;
@ -110,4 +112,49 @@ _XcursorCreateGlyphCursor(Display *dpy,
Cursor
_XcursorCreateFontCursor (Display *dpy, unsigned int shape);
/* provide for XCURSOR_RESIZED */
XcursorImage *
_XcursorFileLoadImage (FILE *file, int size, XcursorBool resize);
XcursorImages *
_XcursorXcFileLoadImages (XcursorFile *file, int size, XcursorBool resize);
XcursorImages *
_XcursorFileLoadImages (FILE *file, int size, XcursorBool resize);
XcursorImages *
_XcursorFilenameLoadImages (const char *file, int size, XcursorBool resize);
XcursorImages *
_XcursorShapeLoadImages (Display *dpy, unsigned int shape);
#ifdef DEBUG_XCURSOR
void _XcursorTrace(const char *fmt, ...) __attribute__((format(printf,1,2)));
void *_XcursorReturnAddr(void *addr);
int _XcursorReturnCode(int code);
unsigned long _XcursorReturnLong(unsigned long code);
unsigned _XcursorReturnUint(unsigned code);
void _XcursorReturnVoid(void);
#define T_CALLED(func) "called: { " #func
#define T_OPTION(opts) "option: : " #opts
#define T_RETURN(form) "return: } %" #form "\n"
#define enterFunc(params) _XcursorTrace params
#define traceOpts(params) _XcursorTrace params
#define returnAddr(addr) return _XcursorReturnAddr(addr)
#define returnCode(code) return _XcursorReturnCode(code)
#define returnLong(code) return _XcursorReturnLong(code)
#define returnUint(code) return _XcursorReturnUint(code)
#define returnVoid() do { _XcursorReturnVoid(); return; } while (0)
#else
#define enterFunc(params) /* nothing */
#define traceOpts(params) /* nothing */
#define returnAddr(addr) return (addr)
#define returnCode(code) return (code)
#define returnLong(code) return (code)
#define returnUint(code) return (code)
#define returnVoid() return
#endif
#define NonNull(p) ((p) != NULL ? (p) : "<null>")
#endif /* _XCURSORINT_H_ */

View file

@ -1,4 +1,5 @@
/*
* Copyright © 2024 Thomas E. Dickey
* Copyright © 2002 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -90,19 +91,23 @@ XcursorTryShapeCursor (Display *dpy,
{
Cursor cursor = None;
enterFunc((T_CALLED(XcursorTryShapeCursor) "(%p, %lu, %lu, %u, %u, %p, %p)\n",
(void*)dpy, source_font, mask_font,
source_char, mask_char,
(const void*)foreground,
(const void*)background));
if (!dpy || !source_font || !mask_font || !foreground || !background)
return 0;
returnLong(None);
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return None;
returnLong(None);
if (source_font == mask_font &&
_XcursorFontIsCursor (dpy, source_font) &&
source_char + 1 == mask_char)
{
int size = XcursorGetDefaultSize (dpy);
char *theme = XcursorGetTheme (dpy);
XcursorImages *images = XcursorShapeLoadImages (source_char, theme, size);
XcursorImages *images = _XcursorShapeLoadImages (dpy, source_char);
if (images)
{
@ -110,7 +115,7 @@ XcursorTryShapeCursor (Display *dpy,
XcursorImagesDestroy (images);
}
}
return cursor;
returnLong(cursor);
}
void
@ -126,18 +131,21 @@ XcursorNoticeCreateBitmap (Display *dpy,
int replace = 0;
XcursorBitmapInfo *bmi;
enterFunc((T_CALLED(XcursorNoticeCreateBitmap) "(%p, %lu, %u, %u)\n",
(void*)dpy, pid, width, height));
if (!dpy)
return;
returnVoid();
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return;
returnVoid();
if (width > MAX_BITMAP_CURSOR_SIZE || height > MAX_BITMAP_CURSOR_SIZE)
return;
returnVoid();
info = _XcursorGetDisplayInfo (dpy);
if (!info)
return;
returnVoid();
LockDisplay (dpy);
replace = 0;
@ -164,6 +172,8 @@ XcursorNoticeCreateBitmap (Display *dpy,
bmi->height = height;
bmi->has_image = False;
UnlockDisplay (dpy);
returnVoid();
}
static XcursorBitmapInfo *
@ -247,8 +257,11 @@ XcursorImageHash (XImage *image,
int low_addr;
Bool bit_swap;
enterFunc((T_CALLED(XcursorImageHash) "(%p, %p)\n",
(void*)image, (void*)hash));
if (!image)
return;
returnVoid();
for (i = 0; i < XCURSOR_BITMAP_HASH_SIZE; i++)
hash[i] = 0;
@ -295,6 +308,8 @@ XcursorImageHash (XImage *image,
}
line += image->bytes_per_line;
}
returnVoid();
}
static Bool
@ -309,6 +324,7 @@ _XcursorLogDiscover (void)
if (getenv ("XCURSOR_DISCOVER"))
log = True;
traceOpts((T_OPTION(XCURSOR_DISCOVER) ": %d\n", log));
}
return log;
}
@ -320,26 +336,29 @@ XcursorNoticePutBitmap (Display *dpy,
{
XcursorBitmapInfo *bmi;
enterFunc((T_CALLED(XcursorNoticePutBitmap ) "(%p, %lu, %p)\n",
(void*)dpy, draw, (void*)image));
if (!dpy || !image)
return;
returnVoid();
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return;
returnVoid();
if (image->width > MAX_BITMAP_CURSOR_SIZE ||
image->height > MAX_BITMAP_CURSOR_SIZE)
return;
returnVoid();
bmi = _XcursorGetBitmap (dpy, (Pixmap) draw);
if (!bmi)
return;
returnVoid();
/*
* Make sure the image fills the bitmap
*/
if (image->width != (int)bmi->width || image->height != (int)bmi->height)
{
bmi->bitmap = 0;
return;
returnVoid();
}
/*
* If multiple images are placed in the same bitmap,
@ -348,7 +367,7 @@ XcursorNoticePutBitmap (Display *dpy,
if (bmi->has_image)
{
bmi->bitmap = 0;
return;
returnVoid();
}
/*
* Make sure the image is valid
@ -356,7 +375,7 @@ XcursorNoticePutBitmap (Display *dpy,
if (image->bytes_per_line & ((image->bitmap_unit >> 3) - 1))
{
bmi->bitmap = 0;
return;
returnVoid();
}
/*
* Hash the image
@ -387,6 +406,7 @@ XcursorNoticePutBitmap (Display *dpy,
}
}
bmi->has_image = True;
returnVoid();
}
Cursor
@ -407,19 +427,27 @@ XcursorTryShapeBitmapCursor (Display *dpy,
(void) x; /* UNUSED */
(void) y; /* UNUSED */
enterFunc((T_CALLED(XcursorTryShapeBitmapCursor)
"(%p, %lu, %lu, %p, %p, %u, %u)\n",
(void*)dpy,
source, mask,
(void*)foreground,
(void*)background,
x, y));
if (!dpy || !foreground || !background)
return 0;
returnLong(None);
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return None;
returnLong(None);
bmi = _XcursorGetBitmap (dpy, source);
if (!bmi || !bmi->has_image)
return None;
returnLong(None);
for (i = 0; i < XCURSOR_BITMAP_HASH_SIZE; i++)
sprintf (name + 2 * i, "%02x", bmi->hash[i]);
cursor = XcursorLibraryLoadCursor (dpy, name);
if (_XcursorLogDiscover())
printf ("Cursor hash %s returns 0x%x\n", name, (unsigned int) cursor);
return cursor;
returnLong(cursor);
}