summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cursor.c13
-rw-r--r--src/display.c3
-rw-r--r--src/file.c21
-rw-r--r--src/library.c27
-rw-r--r--src/xcursorint.h13
-rw-r--r--src/xlib.c3
6 files changed, 53 insertions, 27 deletions
diff --git a/src/cursor.c b/src/cursor.c
index 9b14ce2..701e3a9 100644
--- a/src/cursor.c
+++ b/src/cursor.c
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/cursor.c,v 1.5 2003/01/26 03:22:42 eich Exp $
*
- * 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 +688,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 +712,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 1f41a57..e9dc765 100644
--- a/src/display.c
+++ b/src/display.c
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/display.c,v 1.6 2003/02/20 03:13:50 dawes Exp $
*
- * 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
diff --git a/src/file.c b/src/file.c
index 813ac28..6e1e8c6 100644
--- a/src/file.c
+++ b/src/file.c
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/file.c,v 1.2 2002/09/18 17:11:42 tsi Exp $
*
- * 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 +60,7 @@ XcursorImagesCreate (int size)
return 0;
images->nimage = 0;
images->images = (XcursorImage **) (images + 1);
+ images->name = 0;
return images;
}
@@ -71,9 +71,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 +200,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 b359c45..b92ac6a 100644
--- a/src/library.c
+++ b/src/library.c
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/library.c,v 1.4 2003/11/11 01:17:54 dawes Exp $
*
- * 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 +31,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 +100,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 +218,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 +288,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 +314,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 5d4a2f2..9e426c9 100644
--- a/src/xcursorint.h
+++ b/src/xcursorint.h
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/xcursorint.h,v 1.4 2003/01/26 03:22:42 eich Exp $
*
- * 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 +24,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;
diff --git a/src/xlib.c b/src/xlib.c
index 13e2433..59fcd27 100644
--- a/src/xlib.c
+++ b/src/xlib.c
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/xlib.c,v 1.4 2003/02/22 06:16:15 dawes Exp $
*
- * 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