diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cursor.c | 14 | ||||
-rw-r--r-- | src/display.c | 4 | ||||
-rw-r--r-- | src/file.c | 22 | ||||
-rw-r--r-- | src/library.c | 28 | ||||
-rw-r--r-- | src/xcursorint.h | 14 | ||||
-rw-r--r-- | src/xlib.c | 4 |
6 files changed, 59 insertions, 27 deletions
diff --git a/src/cursor.c b/src/cursor.c index 2dd8d19..237d464 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -1,7 +1,7 @@ /* - * $XFree86: xc/lib/Xcursor/cursor.c,v 1.4 2002/11/23 02:34:45 keithp Exp $ + * $Id$ * - * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * 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 @@ -689,14 +689,14 @@ XcursorImagesLoadCursors (Display *dpy, const XcursorImages *images) Cursor XcursorImagesLoadCursor (Display *dpy, const XcursorImages *images) { + Cursor cursor; if (images->nimage == 1 || !XcursorSupportsAnim (dpy)) - return XcursorImageLoadCursor (dpy, images->images[0]); + cursor = XcursorImageLoadCursor (dpy, images->images[0]); else { XcursorCursors *cursors = XcursorImagesLoadCursors (dpy, images); XAnimCursor *anim; int n; - Cursor cursor; if (!cursors) return 0; @@ -713,8 +713,12 @@ XcursorImagesLoadCursor (Display *dpy, const XcursorImages *images) } cursor = XRenderCreateAnimCursor (dpy, cursors->ncursor, anim); free (anim); - return cursor; } +#if defined HAVE_XFIXES && XFIXES_MAJOR >= 2 + if (images->name) + XFixesSetCursorName (dpy, cursor, images->name); +#endif + return cursor; } diff --git a/src/display.c b/src/display.c index ca91c01..0540d63 100644 --- a/src/display.c +++ b/src/display.c @@ -1,7 +1,7 @@ /* - * $XFree86: xc/lib/Xcursor/display.c,v 1.5 2002/11/27 05:35:10 keithp Exp $ + * $Id$ * - * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * 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 @@ -1,7 +1,7 @@ /* - * $XFree86: xc/lib/Xcursor/file.c,v 1.1tsi Exp $ + * $Id$ * - * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * 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 @@ -61,6 +61,7 @@ XcursorImagesCreate (int size) return 0; images->nimage = 0; images->images = (XcursorImage **) (images + 1); + images->name = 0; return images; } @@ -71,9 +72,24 @@ XcursorImagesDestroy (XcursorImages *images) for (n = 0; n < images->nimage; n++) XcursorImageDestroy (images->images[n]); + if (images->name) + free (images->name); free (images); } +void +XcursorImagesSetName (XcursorImages *images, const char *name) +{ + char *new = malloc (strlen (name) + 1); + + if (!new) + return; + strcpy (new, name); + if (images->name) + free (images->name); + images->name = new; +} + XcursorComment * XcursorCommentCreate (XcursorUInt comment_type, int length) { @@ -185,7 +201,7 @@ _XcursorFileHeaderCreate (int ntoc) return 0; fileHeader->magic = XCURSOR_MAGIC; fileHeader->header = XCURSOR_FILE_HEADER_LEN; - fileHeader->version = XCURSOR_VERSION; + fileHeader->version = XCURSOR_FILE_VERSION; fileHeader->ntoc = ntoc; fileHeader->tocs = (XcursorFileToc *) (fileHeader + 1); return fileHeader; diff --git a/src/library.c b/src/library.c index 3367a85..99af99e 100644 --- a/src/library.c +++ b/src/library.c @@ -1,7 +1,7 @@ /* - * $XFree86: xc/lib/Xcursor/library.c,v 1.3 2003/11/07 17:56:02 dawes Exp $ + * $Id$ * - * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * 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 @@ -32,8 +32,8 @@ #define CURSORPATH "~/.icons:/usr/share/icons:/usr/share/pixmaps:"ICONDIR -static const char * -_XcursorLibraryPath (void) +const char * +XcursorLibraryPath (void) { static const char *path; @@ -101,19 +101,16 @@ _XcursorBuildThemeDir (const char *dir, const char *theme) if (!home) return 0; homelen = strlen (home); - /* A '/' gets prepended if $HOME doesn't start with one. */ - if (home[0] != '/') - homelen++; dir++; dirlen--; } - len = homelen + dirlen + 1 + themelen + 1; + /* + * add space for any needed directory separators, one per component, + * and one for the trailing null + */ + len = 1 + homelen + 1 + dirlen + 1 + themelen + 1; - /* A '/' gets inserted if dir doesn't start with one. */ - if (dir[0] != '/') - len++; - full = malloc (len); if (!full) return 0; @@ -222,7 +219,7 @@ XcursorScanTheme (const char *theme, const char *name) /* * Scan this theme */ - for (path = _XcursorLibraryPath (); + for (path = XcursorLibraryPath (); path && f == 0; path = _XcursorNextPath (path)) { @@ -292,6 +289,8 @@ XcursorLibraryLoadImages (const char *file, const char *theme, int size) if (f) { images = XcursorFileLoadImages (f, size); + if (images) + XcursorImagesSetName (images, file); fclose (f); } return images; @@ -316,6 +315,9 @@ XcursorLibraryLoadCursor (Display *dpy, const char *file) } cursor = XcursorImagesLoadCursor (dpy, images); XcursorImagesDestroy (images); +#if defined HAVE_XFIXES && XFIXES_MAJOR >= 2 + XFixesSetCursorName (dpy, cursor, file); +#endif return cursor; } diff --git a/src/xcursorint.h b/src/xcursorint.h index 97407fe..090c20e 100644 --- a/src/xcursorint.h +++ b/src/xcursorint.h @@ -1,7 +1,7 @@ /* - * $XFree86: xc/lib/Xcursor/xcursorint.h,v 1.3 2002/11/23 02:34:45 keithp Exp $ + * $Id$ * - * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * 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 @@ -25,10 +25,20 @@ #ifndef _XCURSORINT_H_ #define _XCURSORINT_H_ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <X11/Xlib.h> #include <X11/cursorfont.h> #include <X11/extensions/Xrender.h> + +#ifdef HAVE_XFIXES +#include <X11/extensions/Xfixes.h> +#endif + #include "Xcursor.h" +#include "config.h" typedef struct _XcursorFontInfo { struct _XcursorFontInfo *next; @@ -1,7 +1,7 @@ /* - * $XFree86: xc/lib/Xcursor/xlib.c,v 1.3 2002/11/23 02:34:45 keithp Exp $ + * $Id$ * - * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * 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 |