Commit cbcf471d authored by Egbert Eich's avatar Egbert Eich

Merging XORG-CURRENT into trunk

parent fb1739bd
/*
* $XFree86: xc/lib/Xcursor/Xcursor.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
......@@ -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);
......
.\"
.\" $XFree86: xc/lib/Xcursor/Xcursor.man,v 1.5 2003/11/23 05:40:36 dawes 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
......@@ -25,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
......@@ -140,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
......@@ -161,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
......@@ -179,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
......@@ -194,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
......@@ -211,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
......@@ -375,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
/*
* $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;
}
......
/*
* $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
......
/*
* $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;
......
/*
* $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;
}
......
/*
* $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;
......
/*
* $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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment