summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@epoch.ncsc.mil>2004-05-04 19:42:48 +0000
committerEamon Walsh <ewalsh@epoch.ncsc.mil>2004-05-04 19:42:48 +0000
commit2800736baccb6efb09f6ebf4e88cb20b63129aee (patch)
treed380f8dd7791f5a2e602a013a9e707ced757f5b2
parent5b6ea4938668fe060e591b2ef273183d0e3aea6f (diff)
Merge the new release from HEADXACE-SELINUX
-rw-r--r--include/X11/Xcursor/Xcursor.h34
-rw-r--r--man/Xcursor.man40
-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
8 files changed, 102 insertions, 52 deletions
diff --git a/include/X11/Xcursor/Xcursor.h b/include/X11/Xcursor/Xcursor.h
index c4b4ac2..43cb332 100644
--- a/include/X11/Xcursor/Xcursor.h
+++ b/include/X11/Xcursor/Xcursor.h
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/Xcursor.h,v 1.3 2002/11/23 02:34:45 keithp 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
@@ -69,9 +68,26 @@ typedef XcursorUInt XcursorPixel;
#define XCURSOR_MAGIC 0x72756358 /* "Xcur" LSBFirst */
-#define XCURSOR_MAJOR 1
-#define XCURSOR_MINOR 0
-#define XCURSOR_VERSION ((XCURSOR_MAJOR << 16) | (XCURSOR_MINOR))
+/*
+ * Current Xcursor version number. This same number
+ * must appear in the Xcursor configure.ac file. Yes,
+ * it'a a pain to synchronize version numbers like this.
+ */
+
+#define XCURSOR_LIB_MAJOR 1
+#define XCURSOR_LIB_MINOR 1
+#define XCURSOR_LIB_REVISION 2
+#define XCURSOR_LIB_VERSION ((XCURSOR_LIB_MAJOR * 10000) + \
+ (XCURSOR_LIB_MINOR * 100) + \
+ (XCURSOR_LIB_REVISION))
+
+/*
+ * This version number is stored in cursor files; changes to the
+ * file format require updating this version number
+ */
+#define XCURSOR_FILE_MAJOR 1
+#define XCURSOR_FILE_MINOR 0
+#define XCURSOR_FILE_VERSION ((XCURSOR_FILE_MAJOR << 16) | (XCURSOR_FILE_MINOR))
#define XCURSOR_FILE_HEADER_LEN (4 * 4)
#define XCURSOR_FILE_TOC_LEN (3 * 4)
@@ -180,6 +196,7 @@ typedef struct _XcursorImage {
typedef struct _XcursorImages {
int nimage; /* number of images */
XcursorImage **images; /* array of XcursorImage pointers */
+ char *name; /* name used to load images */
} XcursorImages;
typedef struct _XcursorCursors {
@@ -230,6 +247,9 @@ XcursorImagesCreate (int size);
void
XcursorImagesDestroy (XcursorImages *images);
+void
+XcursorImagesSetName (XcursorImages *images, const char *name);
+
/*
* Manage Cursor objects
*/
@@ -350,6 +370,10 @@ XcursorLibraryLoadImages (const char *library, const char *theme, int size);
/*
* Library/shape API
*/
+
+const char *
+XcursorLibraryPath (void);
+
int
XcursorLibraryShape (const char *library);
diff --git a/man/Xcursor.man b/man/Xcursor.man
index f3cfc13..1f9a62a 100644
--- a/man/Xcursor.man
+++ b/man/Xcursor.man
@@ -1,8 +1,8 @@
.\"
-.\" $XdotOrg: xc/lib/Xcursor/Xcursor.man,v 1.5 2003/11/23 05:40:36 dawes Exp $
-.\" $XFree86: xc/lib/Xcursor/Xcursor.man,v 1.4 2003/06/12 14:12:27 eich Exp $
+.\" $Id$
+.\"
+.\" Copyright © 2002 Keith Packard
.\"
-.\" Copyright 2002 Keith Packard, member of The XFree86 Project, Inc..\"
.\" 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
@@ -26,7 +26,7 @@
.ns
.TP \\$1
..
-.TH XCURSOR 3 "Version 1.0" "XFree86"
+.TH XCURSOR 3 "Version 1.0" "Keith Packard"
.SH NAME
XCURSOR \- Cursor management library
@@ -141,7 +141,7 @@ Images look like:
Xcursor (mostly) follows the freedesktop.org spec for theming icons. The
default search path it uses is $HOME/.icons, /usr/share/icons,
/usr/share/pimaps, /usr/X11R6/lib/X11/icons. Within each of these
-directories, it searches for a directory using the theme name. Within the
+directorys, 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.
.PP
@@ -162,12 +162,12 @@ value containing ARGB with A in the high byte.
.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 */
+ 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
@@ -180,8 +180,8 @@ XcursorImages is freed.
.nf
.ft CR
typedef struct _XcursorImages {
- int nimage; /\(** number of images */
- XcursorImage **images; /\(** array of XcursorImage pointers */
+ int nimage; /* number of images */
+ XcursorImage **images; /* array of XcursorImage pointers */
} XcursorImages;
.ft
.fi
@@ -195,10 +195,10 @@ structures can use the same XcursorCursors.
.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 */
+ Display *dpy; /* Display holding cursors */
+ int ref; /* reference count */
+ int ncursor; /* number of cursors */
+ Cursor *cursors; /* array of cursors */
} XcursorCursors;
.ft
.fi
@@ -212,8 +212,8 @@ holds a reference which is removed when the XcursorAnimate is freed.
.nf
.ft CR
typedef struct _XcursorAnimate {
- XcursorCursors *cursors; /\(** list of cursors to use */
- int sequence; /\(** which cursor is next */
+ XcursorCursors *cursors; /* list of cursors to use */
+ int sequence; /* which cursor is next */
} XcursorAnimate;
.ft
.fi
@@ -376,4 +376,4 @@ will probably change radically in the future; weak attempts will be made to
retain some level of source-file compatibility.
.SH AUTHOR
-Keith Packard, member of the XFree86 Project, Inc.
+Keith Packard
diff --git a/src/cursor.c b/src/cursor.c
index 2dd8d19..701e3a9 100644
--- a/src/cursor.c
+++ b/src/cursor.c
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/cursor.c,v 1.4 2002/11/23 02:34:45 keithp 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 ca91c01..e9dc765 100644
--- a/src/display.c
+++ b/src/display.c
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/display.c,v 1.5 2002/11/27 05:35:10 keithp 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 72d3a50..6e1e8c6 100644
--- a/src/file.c
+++ b/src/file.c
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/file.c,v 1.1tsi 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 3367a85..b92ac6a 100644
--- a/src/library.c
+++ b/src/library.c
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/library.c,v 1.3 2003/11/07 17:56:02 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 97407fe..9e426c9 100644
--- a/src/xcursorint.h
+++ b/src/xcursorint.h
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/xcursorint.h,v 1.3 2002/11/23 02:34:45 keithp 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 d22a17a..59fcd27 100644
--- a/src/xlib.c
+++ b/src/xlib.c
@@ -1,7 +1,6 @@
/*
- * $XFree86: xc/lib/Xcursor/xlib.c,v 1.3 2002/11/23 02:34:45 keithp 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