Commit graph

191 commits

Author SHA1 Message Date
Alan Coopersmith
2197ca8cbb Improve man page formatting
Fix 'mandoc: man/Xcursor.3:74:15: WARNING: cannot parse date,
 using it verbatim: TH libXcursor 1.2.3' and use .BR markup for
references to other man pages

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxcursor/-/merge_requests/26>
2025-07-13 14:57:48 -07:00
Haelwenn (lanodan) Monnier
f9a2078c0f Add SPDX-License-Identifier: HPND-sell-variant
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxcursor/-/merge_requests/25>
2025-06-16 12:32:52 +02:00
Alan Coopersmith
61b84c2d42 meson: Add option to build with meson
Also updates the gitlab CI config to test both build types
and compare the generated output/installed files.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxcursor/-/merge_requests/24>
2025-02-23 18:12:17 -08:00
Thomas E. Dickey
8ae6cf61b1
amend per merge_requests/22#note_2642042
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-04 04:06:21 -05:00
Thomas E. Dickey
68fe24020c
amend per merge_requests/22#note_2642034
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-04 04:00:20 -05:00
Thomas E. Dickey
8d27f282e4
reduce the message-check to ignore the over-long one
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 19:05:59 -05:00
Thomas E. Dickey
d8b955d6b2
fix overlooked compiler-warning
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:58:23 -05:00
Thomas E. Dickey
cb2d1b97c3
add debug-trace for the configuration information
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:58:16 -05:00
Thomas E. Dickey
304ac296f3
ensure ncomment and nimage values are positive
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:58:09 -05:00
Thomas E. Dickey
00a59a7199
changes will suggest new release
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:58:01 -05:00
Thomas E. Dickey
83071fff3f
document/tidy the new set/get functions
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:57:56 -05:00
Thomas E. Dickey
fa5c5bb1bd
document the new XCURSOR_RESIZED environment variable and resource "resized"
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:57:49 -05:00
Thomas E. Dickey
f155414617
add traces for library.c and xlib.c, also another internal function for dpy
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:57:43 -05:00
Thomas E. Dickey
fbfe95e05f
add debug-logging for file.c, to help with analysis
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:57:36 -05:00
Thomas E. Dickey
8a1de72216
add/use _XcursorLibraryLoadImages to pass resized-parameter when loading
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:57:29 -05:00
Thomas E. Dickey
b00d7da27b
use resized-parameter where available when loading images
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:57:23 -05:00
Thomas E. Dickey
5cb505f21e
provide internal variants of existing functions to pass "resized" parameter
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:57:16 -05:00
Thomas E. Dickey
e7272c8046
restore behavior of image-loading, provide resizing via internal function
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:57:10 -05:00
Thomas E. Dickey
6816ed58e9
add getter/setter for "resized" property
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:57:03 -05:00
Thomas E. Dickey
e5e63e2ba8
add new property "resized" and environment "XCURSOR_RESIZED"
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:56:57 -05:00
Thomas E. Dickey
a5739d863b
trim redundant code from the resize-calls
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:56:49 -05:00
Thomas E. Dickey
e1b6d3abb4
improve manpage formatting
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:56:44 -05:00
Thomas E. Dickey
7e03738efd
fix compiler warnings
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:56:38 -05:00
Thomas E. Dickey
b09856069c
build-fix
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2024-11-03 18:56:30 -05:00
Jin Liu
dfc8561247
Remove unnecessary MIN calls 2024-11-03 18:56:12 -05:00
Jin Liu
a21cdaf167
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>
2024-11-03 18:56:04 -05:00
Tobias Stoeckmann
833735e323 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>
2024-09-12 22:23:50 +02:00
Alan Coopersmith
09617bcc9a
libXcursor 1.2.2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-03-02 12:55:30 -08:00
Robin Linden
3783190da9 Remove superfluous and unguarded config.h include
config.h is correctly included behind a HAVE_CONFIG_H guard earlier in
the file, so this isn't needed.

Signed-off-by: Robin Linden <dev@robinlinden.eu>
2024-01-18 18:38:13 +01:00
Alan Coopersmith
5e0f8347ce XcursorXcFileLoad: plug memory leak in error paths
Found by gcc analyzer:
file.c: In function ‘XcursorXcFileLoad’:
file.c:782:8: warning: leak of ‘fileHeader’ [CWE-401] [-Wanalyzer-malloc-leak]
  782 |     if (!images)
      |        ^

Fixes: 3b84b14 ("Initial revision")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-10-08 10:48:25 -07:00
Alan Coopersmith
9c1b50ed98 Add comment about keeping libxcb-cursor copy of code in sync
_XcursorThemeInherits, XcursorWhite, & XcursorSep are copied in
libxcb-cursor/cursor/load_cursor.c and should be kept in sync
with changes to the libXcursor originals of those.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-07-08 11:07:03 -07:00
Alan Coopersmith
a353f02a7a If O_CLOEXEC is defined, add "e" to fopen modes
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-03-25 12:14:36 -07:00
Alan Coopersmith
81dc4a481b configure: Use LT_INIT from libtool 2 instead of deprecated AC_PROG_LIBTOOL
AC_PROG_LIBTOOL was replaced by LT_INIT in libtool 2 in 2008,
so it's time to rely on it.

Clears autoconf warnings:

configure.ac:42: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:42: You should run autoupdate.
aclocal.m4:3465: AC_PROG_LIBTOOL is expanded from...
configure.ac:42: the top level

libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-03-04 14:50:53 -08:00
Alan Coopersmith
87a30b1758 gitlab CI: stop requiring Signed-off-by in commits
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-02-09 12:07:02 -08:00
Alan Coopersmith
27adb16027
libXcursor 1.2.1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-04-03 09:55:44 -07:00
Alan Coopersmith
e864ad8306 gitlab CI: add a basic build test
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-04-03 09:43:29 -07:00
Alan Coopersmith
f0d8a59186 Build xz tarballs instead of bzip2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-04-03 09:22:14 -07:00
Alan Coopersmith
d223fce4c7 Fix spelling/wording issues
Found by using:
    codespell --builtin clear,rare,usage,informal,code,names

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-04-03 09:21:29 -07:00
Alan Coopersmith
66accad188 Convert COPYING from ISO-8859-1 to UTF-8
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-04-03 09:19:14 -07:00
Thomas E. Dickey
801925839d
more cppcheck-style fixes
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-05-06 20:12:37 -04:00
Thomas E. Dickey
f807ac9c78
cppcheck style-fixes
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-05-05 20:25:26 -04:00
Thomas E. Dickey
13ca987eaf
mention "Inherits=" lists
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-05-05 20:18:31 -04:00
Tobias Stoeckmann
6edf1caf6f 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>
2021-05-04 18:59:46 +02:00
Tobias Stoeckmann
b47ca9858e Handle more theme loop situations
This is a follow up for commit f64a8cc1a6
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>
2021-05-02 16:27:38 +02:00
Thomas E. Dickey
403bb32d5f
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>
2021-03-19 17:16:15 -04:00
Thomas E. Dickey
1ab5ffa9e3
fix a typo and a style issue
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-03-19 17:16:08 -04:00
Thomas E. Dickey
9898afadfb
update copyright notice
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-03-17 19:10:31 -04:00
Thomas E. Dickey
d64dda62de
fix raggedy prototypes and structure declarations using tabstops in appropriate macros
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-03-17 19:10:26 -04:00
Thomas E. Dickey
8560016436
document the API called from libX11
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-03-17 19:10:22 -04:00
Thomas E. Dickey
bacd41c0c0
document the cursor-comments functions
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-03-17 19:10:17 -04:00