summaryrefslogtreecommitdiff
path: root/lib/libXcursor/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2012-03-10 13:53:29 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2012-03-10 13:53:29 +0000
commitd21da6df5098e18cc8bb436acc89d2262a157fb7 (patch)
treebbeb36a0273c2a6641533a8c1b53316ad2e0441c /lib/libXcursor/src
parente269829efe9831e4d828da7862b1c5312c7a0a2e (diff)
upate to libXcursor 1.1.13
Diffstat (limited to 'lib/libXcursor/src')
-rw-r--r--lib/libXcursor/src/Makefile.am2
-rw-r--r--lib/libXcursor/src/Makefile.in41
-rw-r--r--lib/libXcursor/src/cursor.c57
-rw-r--r--lib/libXcursor/src/display.c18
-rw-r--r--lib/libXcursor/src/file.c95
-rw-r--r--lib/libXcursor/src/library.c20
-rw-r--r--lib/libXcursor/src/xcursorint.h6
-rw-r--r--lib/libXcursor/src/xlib.c32
8 files changed, 140 insertions, 131 deletions
diff --git a/lib/libXcursor/src/Makefile.am b/lib/libXcursor/src/Makefile.am
index a55b8d61e..a44dcb3ca 100644
--- a/lib/libXcursor/src/Makefile.am
+++ b/lib/libXcursor/src/Makefile.am
@@ -20,7 +20,7 @@ INCLUDES = -I$(top_srcdir)/include/X11/Xcursor
libXcursor_la_LDFLAGS = -version-number 1:0:2 -no-undefined
libXcursorincludedir = $(includedir)/X11/Xcursor
-libXcursorinclude_HEADERS = $(top_srcdir)/include/X11/Xcursor/Xcursor.h
+libXcursorinclude_HEADERS = $(top_builddir)/include/X11/Xcursor/Xcursor.h
if LINT
ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
diff --git a/lib/libXcursor/src/Makefile.in b/lib/libXcursor/src/Makefile.in
index 531929574..e96031873 100644
--- a/lib/libXcursor/src/Makefile.in
+++ b/lib/libXcursor/src/Makefile.in
@@ -24,9 +24,9 @@ pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
+install_sh_DATA = ${SHELL} $(install_sh) -c -m 644
+install_sh_PROGRAM = ${SHELL} $(install_sh) -c
+install_sh_SCRIPT = ${SHELL} $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
@@ -45,7 +45,8 @@ am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_HEADER = $(top_builddir)/config.h \
+ $(top_builddir)/include/X11/Xcursor/Xcursor.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -62,7 +63,7 @@ libXcursor_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_libXcursor_la_OBJECTS = cursor.lo display.lo file.lo library.lo \
xlib.lo
libXcursor_la_OBJECTS = $(am_libXcursor_la_OBJECTS)
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/include/X11/Xcursor
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -94,6 +95,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -101,24 +103,20 @@ CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
GREP = @GREP@
@@ -128,6 +126,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -138,17 +137,23 @@ LINT = @LINT@
LINT_FALSE = @LINT_FALSE@
LINT_FLAGS = @LINT_FLAGS@
LINT_TRUE = @LINT_TRUE@
+LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+NM = @NM@
NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -161,20 +166,18 @@ RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XCURSORPATH = @XCURSORPATH@
-XCURSORPATH_LIST = @XCURSORPATH_LIST@
XCURSOR_CFLAGS = @XCURSOR_CFLAGS@
XCURSOR_LIBS = @XCURSOR_LIBS@
XORG_MAN_PAGE = @XORG_MAN_PAGE@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -231,7 +234,7 @@ INCLUDES = -I$(top_srcdir)/include/X11/Xcursor
#
libXcursor_la_LDFLAGS = -version-number 1:0:2 -no-undefined
libXcursorincludedir = $(includedir)/X11/Xcursor
-libXcursorinclude_HEADERS = $(top_srcdir)/include/X11/Xcursor/Xcursor.h
+libXcursorinclude_HEADERS = $(top_builddir)/include/X11/Xcursor/Xcursor.h
@LINT_TRUE@ALL_LINT_FLAGS = $(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
@LINT_TRUE@ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS)
@@ -407,7 +410,7 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- $(mkdir_p) $(distdir)/../include/X11/Xcursor
+ $(mkdir_p) $(distdir)/$(top_builddir)/include/X11/Xcursor
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
diff --git a/lib/libXcursor/src/cursor.c b/lib/libXcursor/src/cursor.c
index 7da62ef05..92bd41767 100644
--- a/lib/libXcursor/src/cursor.c
+++ b/lib/libXcursor/src/cursor.c
@@ -51,7 +51,7 @@ XcursorCursorsDestroy (XcursorCursors *cursors)
--cursors->ref;
if (cursors->ref > 0)
return;
-
+
for (n = 0; n < cursors->ncursor; n++)
XFreeCursor (cursors->dpy, cursors->cursors[n]);
free (cursors);
@@ -238,17 +238,17 @@ _XcursorHeckbertMedianCut (const XcursorImage *image, XcursorCoreCursor *core)
XcursorPixel leftColor, centerColor, rightColor;
int (*compare) (const void *, const void *);
int x, y;
-
+
/*
* Temp space for converted image and converted colors
*/
temp = malloc (npixels * sizeof (XcursorPixel) * 2);
if (!temp)
return False;
-
+
pixels = temp;
colors = pixels + npixels;
-
+
/*
* Convert to 2-value alpha and build
* array of opaque color values and an
@@ -286,7 +286,7 @@ _XcursorHeckbertMedianCut (const XcursorImage *image, XcursorCoreCursor *core)
*pn++ = p;
}
ncolors = pc - colors;
-
+
/*
* Compute longest dimension and sort
*/
@@ -468,16 +468,16 @@ _XcursorFloydSteinberg (const XcursorImage *image, XcursorCoreCursor *core)
iErrorRight = (iError * 7) >> 4;
iErrorBelowLeft = (iError * 3) >> 4;
iErrorBelow = (iError * 5) >> 4;
- iErrorBelowRight = (iError - iErrorRight -
+ iErrorBelowRight = (iError - iErrorRight -
iErrorBelowLeft - iErrorBelow);
aErrorRight = (aError * 7) >> 4;
aErrorBelowLeft = (aError * 3) >> 4;
aErrorBelow = (aError * 5) >> 4;
- aErrorBelowRight = (aError - aErrorRight -
+ aErrorBelowRight = (aError - aErrorRight -
aErrorBelowLeft - aErrorBelow);
if (x < image->width - 1)
{
- iP[right] += iErrorRight;
+ iP[right] += iErrorRight;
aP[right] += aErrorRight;
}
if (y < image->height - 1)
@@ -500,9 +500,9 @@ _XcursorFloydSteinberg (const XcursorImage *image, XcursorCoreCursor *core)
}
free (iPicture);
core->on_color.red =
- core->on_color.green =
+ core->on_color.green =
core->on_color.blue = (min_inten | min_inten << 8);
- core->off_color.red =
+ core->off_color.red =
core->off_color.green =
core->off_color.blue = (max_inten | max_inten << 8);
return True;
@@ -537,9 +537,9 @@ _XcursorThreshold (const XcursorImage *image, XcursorCoreCursor *core)
}
}
core->on_color.red =
- core->on_color.green =
+ core->on_color.green =
core->on_color.blue = 0;
- core->off_color.red =
+ core->off_color.red =
core->off_color.green =
core->off_color.blue = 0xffff;
return True;
@@ -549,7 +549,7 @@ Cursor
XcursorImageLoadCursor (Display *dpy, const XcursorImage *image)
{
Cursor cursor;
-
+
#if RENDER_MAJOR > 0 || RENDER_MINOR >= 5
if (XcursorSupportsARGB (dpy))
{
@@ -581,13 +581,13 @@ XcursorImageLoadCursor (Display *dpy, const XcursorImage *image)
pixmap = XCreatePixmap (dpy, RootWindow (dpy, screen),
image->width, image->height, 32);
gc = XCreateGC (dpy, pixmap, 0, NULL);
- XPutImage (dpy, pixmap, gc, &ximage,
+ XPutImage (dpy, pixmap, gc, &ximage,
0, 0, 0, 0, image->width, image->height);
XFreeGC (dpy, gc);
format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
picture = XRenderCreatePicture (dpy, pixmap, format, 0, NULL);
XFreePixmap (dpy, pixmap);
- cursor = XRenderCreateCursor (dpy, picture,
+ cursor = XRenderCreateCursor (dpy, picture,
image->xhot, image->yhot);
XRenderFreePicture (dpy, picture);
}
@@ -601,15 +601,18 @@ XcursorImageLoadCursor (Display *dpy, const XcursorImage *image)
GC gc;
XGCValues gcv;
+ if (!info)
+ return 0;
+
core.src_image = XCreateImage (dpy, NULL, 1, ZPixmap,
0, NULL, image->width, image->height,
32, 0);
- core.src_image->data = Xmalloc (image->height *
+ core.src_image->data = Xmalloc (image->height *
core.src_image->bytes_per_line);
core.msk_image = XCreateImage (dpy, NULL, 1, ZPixmap,
0, NULL, image->width, image->height,
32, 0);
- core.msk_image->data = Xmalloc (image->height *
+ core.msk_image->data = Xmalloc (image->height *
core.msk_image->bytes_per_line);
switch (info->dither) {
@@ -642,16 +645,16 @@ XcursorImageLoadCursor (Display *dpy, const XcursorImage *image)
image->width, image->height, 1);
gcv.foreground = 1;
gcv.background = 0;
- gc = XCreateGC (dpy, src_pixmap,
+ gc = XCreateGC (dpy, src_pixmap,
GCForeground|GCBackground,
&gcv);
XPutImage (dpy, src_pixmap, gc, core.src_image,
0, 0, 0, 0, image->width, image->height);
-
+
XPutImage (dpy, msk_pixmap, gc, core.msk_image,
0, 0, 0, 0, image->width, image->height);
XFreeGC (dpy, gc);
-
+
#ifdef DEBUG_IMAGE
_XcursorDumpColor (&core.on_color, "on_color");
_XcursorDumpColor (&core.off_color, "off_color");
@@ -702,7 +705,7 @@ XcursorImagesLoadCursor (Display *dpy, const XcursorImages *images)
XcursorCursors *cursors = XcursorImagesLoadCursors (dpy, images);
XAnimCursor *anim;
int n;
-
+
if (!cursors)
return 0;
anim = malloc (cursors->ncursor * sizeof (XAnimCursor));
@@ -734,7 +737,7 @@ XcursorFilenameLoadCursor (Display *dpy, const char *file)
int size = XcursorGetDefaultSize (dpy);
XcursorImages *images = XcursorFilenameLoadImages (file, size);
Cursor cursor;
-
+
if (!images)
return None;
cursor = XcursorImagesLoadCursor (dpy, images);
@@ -748,7 +751,7 @@ XcursorFilenameLoadCursors (Display *dpy, const char *file)
int size = XcursorGetDefaultSize (dpy);
XcursorImages *images = XcursorFilenameLoadImages (file, size);
XcursorCursors *cursors;
-
+
if (!images)
return NULL;
cursors = XcursorImagesLoadCursors (dpy, images);
@@ -768,7 +771,7 @@ _XcursorCreateGlyphCursor(Display *dpy,
unsigned int mask_char,
XColor _Xconst *foreground,
XColor _Xconst *background)
-{
+{
Cursor cid;
register xCreateGlyphCursorReq *req;
@@ -800,21 +803,21 @@ _XcursorCreateFontCursor (Display *dpy, unsigned int shape)
static XColor _Xconst foreground = { 0, 0, 0, 0 }; /* black */
static XColor _Xconst background = { 0, 65535, 65535, 65535 }; /* white */
- /*
+ /*
* the cursor font contains the shape glyph followed by the mask
* glyph; so character position 0 contains a shape, 1 the mask for 0,
* 2 a shape, etc. <X11/cursorfont.h> contains hash define names
* for all of these.
*/
- if (dpy->cursor_font == None)
+ if (dpy->cursor_font == None)
{
dpy->cursor_font = XLoadFont (dpy, CURSORFONT);
if (dpy->cursor_font == None)
return None;
}
- return _XcursorCreateGlyphCursor (dpy, dpy->cursor_font, dpy->cursor_font,
+ return _XcursorCreateGlyphCursor (dpy, dpy->cursor_font, dpy->cursor_font,
shape, shape + 1, &foreground, &background);
}
diff --git a/lib/libXcursor/src/display.c b/lib/libXcursor/src/display.c
index bcf99644d..7998fe744 100644
--- a/lib/libXcursor/src/display.c
+++ b/lib/libXcursor/src/display.c
@@ -126,7 +126,7 @@ _XcursorGetDisplayInfo (Display *dpy)
return NULL;
info->next = NULL;
info->display = dpy;
-
+
info->codes = XAddExtension (dpy);
if (!info->codes)
{
@@ -162,7 +162,7 @@ _XcursorGetDisplayInfo (Display *dpy)
info->has_anim_cursor = XcursorFalse;
}
}
-
+
info->size = 0;
/*
@@ -173,7 +173,7 @@ _XcursorGetDisplayInfo (Display *dpy)
v = XGetDefault (dpy, "Xcursor", "size");
if (v)
info->size = atoi (v);
-
+
/*
* Use the Xft size to guess a size; make cursors 16 "points" tall
*/
@@ -186,15 +186,15 @@ _XcursorGetDisplayInfo (Display *dpy)
if (dpi)
info->size = dpi * 16 / 72;
}
-
+
/*
* Use display size to guess a size
*/
if (info->size == 0)
{
int dim;
-
- if (DisplayHeight (dpy, DefaultScreen (dpy)) <
+
+ if (DisplayHeight (dpy, DefaultScreen (dpy)) <
DisplayWidth (dpy, DefaultScreen (dpy)))
dim = DisplayHeight (dpy, DefaultScreen (dpy));
else
@@ -204,7 +204,7 @@ _XcursorGetDisplayInfo (Display *dpy)
*/
info->size = dim / 48;
}
-
+
info->theme = NULL;
info->theme_from_config = NULL;
@@ -287,7 +287,7 @@ _XcursorGetDisplayInfo (Display *dpy)
_XcursorDisplayInfo = info;
}
_XUnlockMutex (_Xglobal_lock);
-
+
return info;
}
@@ -373,7 +373,7 @@ XcursorGetThemeCore (Display *dpy)
if (!info)
return XcursorFalse;
return info->theme_core;
-
+
}
XcursorBool
diff --git a/lib/libXcursor/src/file.c b/lib/libXcursor/src/file.c
index e3d7e61ef..efe6d4b92 100644
--- a/lib/libXcursor/src/file.c
+++ b/lib/libXcursor/src/file.c
@@ -53,7 +53,7 @@ XcursorImagesCreate (int size)
{
XcursorImages *images;
- images = malloc (sizeof (XcursorImages) +
+ images = malloc (sizeof (XcursorImages) +
size * sizeof (XcursorImage *));
if (!images)
return NULL;
@@ -82,10 +82,10 @@ void
XcursorImagesSetName (XcursorImages *images, const char *name)
{
char *new;
-
+
if (!images || !name)
return;
-
+
new = malloc (strlen (name) + 1);
if (!new)
@@ -180,7 +180,7 @@ _XcursorWriteUInt (XcursorFile *file, XcursorUInt u)
if (!file)
return XcursorFalse;
-
+
bytes[0] = u;
bytes[1] = u >> 8;
bytes[2] = u >> 16;
@@ -232,7 +232,7 @@ _XcursorReadFileHeader (XcursorFile *file)
if (!file)
return NULL;
-
+
if (!_XcursorReadUInt (file, &head.magic))
return NULL;
if (head.magic != XCURSOR_MAGIC)
@@ -274,7 +274,7 @@ _XcursorReadFileHeader (XcursorFile *file)
static XcursorUInt
_XcursorFileHeaderLength (XcursorFileHeader *fileHeader)
{
- return (XCURSOR_FILE_HEADER_LEN +
+ return (XCURSOR_FILE_HEADER_LEN +
fileHeader->ntoc * XCURSOR_FILE_TOC_LEN);
}
@@ -285,7 +285,7 @@ _XcursorWriteFileHeader (XcursorFile *file, XcursorFileHeader *fileHeader)
if (!file || !fileHeader)
return XcursorFalse;
-
+
if (!_XcursorWriteUInt (file, fileHeader->magic))
return XcursorFalse;
if (!_XcursorWriteUInt (file, fileHeader->header))
@@ -307,7 +307,7 @@ _XcursorWriteFileHeader (XcursorFile *file, XcursorFileHeader *fileHeader)
}
static XcursorBool
-_XcursorSeekToToc (XcursorFile *file,
+_XcursorSeekToToc (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc)
{
@@ -423,7 +423,7 @@ _XcursorFindImageToc (XcursorFileHeader *fileHeader,
}
static XcursorImage *
-_XcursorReadImage (XcursorFile *file,
+_XcursorReadImage (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc)
{
@@ -455,7 +455,7 @@ _XcursorReadImage (XcursorFile *file,
return NULL;
if (head.xhot > head.width || head.yhot > head.height)
return NULL;
-
+
/* Create the image and initialize it */
image = XcursorImageCreate (head.width, head.height);
if (chunkHeader.version < image->version)
@@ -488,7 +488,7 @@ _XcursorImageLength (XcursorImage *image)
}
static XcursorBool
-_XcursorWriteImage (XcursorFile *file,
+_XcursorWriteImage (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc,
XcursorImage *image)
@@ -508,16 +508,16 @@ _XcursorWriteImage (XcursorFile *file,
return XcursorFalse;
if (image->xhot > image->width || image->yhot > image->height)
return XcursorFalse;
-
+
/* write chunk header */
chunkHeader.header = XCURSOR_IMAGE_HEADER_LEN;
chunkHeader.type = XCURSOR_IMAGE_TYPE;
chunkHeader.subtype = image->size;
chunkHeader.version = XCURSOR_IMAGE_VERSION;
-
+
if (!_XcursorFileWriteChunkHeader (file, fileHeader, toc, &chunkHeader))
return XcursorFalse;
-
+
/* write extra image header fields */
if (!_XcursorWriteUInt (file, image->width))
return XcursorFalse;
@@ -529,7 +529,7 @@ _XcursorWriteImage (XcursorFile *file,
return XcursorFalse;
if (!_XcursorWriteUInt (file, image->delay))
return XcursorFalse;
-
+
/* write the image */
n = image->width * image->height;
p = image->pixels;
@@ -543,7 +543,7 @@ _XcursorWriteImage (XcursorFile *file,
}
static XcursorComment *
-_XcursorReadComment (XcursorFile *file,
+_XcursorReadComment (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc)
{
@@ -579,7 +579,7 @@ _XcursorCommentLength (XcursorComment *comment)
}
static XcursorBool
-_XcursorWriteComment (XcursorFile *file,
+_XcursorWriteComment (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc,
XcursorComment *comment)
@@ -591,24 +591,24 @@ _XcursorWriteComment (XcursorFile *file,
return XcursorFalse;
length = strlen (comment->comment);
-
+
/* sanity check data */
if (length > XCURSOR_COMMENT_MAX_LEN)
return XcursorFalse;
-
+
/* read chunk header */
chunkHeader.header = XCURSOR_COMMENT_HEADER_LEN;
chunkHeader.type = XCURSOR_COMMENT_TYPE;
chunkHeader.subtype = comment->comment_type;
chunkHeader.version = XCURSOR_COMMENT_VERSION;
-
+
if (!_XcursorFileWriteChunkHeader (file, fileHeader, toc, &chunkHeader))
return XcursorFalse;
-
+
/* write extra comment header fields */
if (!_XcursorWriteUInt (file, length))
return XcursorFalse;
-
+
if (!_XcursorWriteBytes (file, comment->comment, length))
return XcursorFalse;
return XcursorTrue;
@@ -622,7 +622,7 @@ XcursorXcFileLoadImage (XcursorFile *file, int size)
int nsize;
int toc;
XcursorImage *image;
-
+
if (size < 0)
return NULL;
fileHeader = _XcursorReadFileHeader (file);
@@ -648,7 +648,7 @@ XcursorXcFileLoadImages (XcursorFile *file, int size)
XcursorImages *images;
int n;
int toc;
-
+
if (!file || size < 0)
return NULL;
fileHeader = _XcursorReadFileHeader (file);
@@ -671,7 +671,7 @@ XcursorXcFileLoadImages (XcursorFile *file, int size)
toc = _XcursorFindImageToc (fileHeader, bestSize, n);
if (toc < 0)
break;
- images->images[images->nimage] = _XcursorReadImage (file, fileHeader,
+ images->images[images->nimage] = _XcursorReadImage (file, fileHeader,
toc);
if (!images->images[images->nimage])
break;
@@ -695,10 +695,10 @@ XcursorXcFileLoadAllImages (XcursorFile *file)
int nimage;
int n;
int toc;
-
+
if (!file)
return NULL;
-
+
fileHeader = _XcursorReadFileHeader (file);
if (!fileHeader)
return NULL;
@@ -752,7 +752,7 @@ XcursorXcFileLoad (XcursorFile *file,
XcursorComment *comment;
XcursorComments *comments;
int toc;
-
+
if (!file)
return 0;
fileHeader = _XcursorReadFileHeader (file);
@@ -816,7 +816,7 @@ XcursorXcFileLoad (XcursorFile *file,
}
XcursorBool
-XcursorXcFileSave (XcursorFile *file,
+XcursorXcFileSave (XcursorFile *file,
const XcursorComments *comments,
const XcursorImages *images)
{
@@ -824,21 +824,21 @@ XcursorXcFileSave (XcursorFile *file,
XcursorUInt position;
int n;
int toc;
-
+
if (!file || !comments || !images)
return XcursorFalse;
-
+
fileHeader = _XcursorFileHeaderCreate (comments->ncomment + images->nimage);
if (!fileHeader)
return XcursorFalse;
-
+
position = _XcursorFileHeaderLength (fileHeader);
/*
* Compute the toc. Place the images before the comments
* as they're more often read
*/
-
+
toc = 0;
for (n = 0; n < images->nimage; n++)
{
@@ -848,7 +848,7 @@ XcursorXcFileSave (XcursorFile *file,
position += _XcursorImageLength (images->images[n]);
toc++;
}
-
+
for (n = 0; n < comments->ncomment; n++)
{
fileHeader->tocs[toc].type = XCURSOR_COMMENT_TYPE;
@@ -857,13 +857,13 @@ XcursorXcFileSave (XcursorFile *file,
position += _XcursorCommentLength (comments->comments[n]);
toc++;
}
-
+
/*
* Write the header and the toc
*/
if (!_XcursorWriteFileHeader (file, fileHeader))
goto bail;
-
+
/*
* Write the images
*/
@@ -874,7 +874,7 @@ XcursorXcFileSave (XcursorFile *file,
goto bail;
toc++;
}
-
+
/*
* Write the comments
*/
@@ -884,7 +884,7 @@ XcursorXcFileSave (XcursorFile *file,
goto bail;
toc++;
}
-
+
_XcursorFileHeaderDestroy (fileHeader);
return XcursorTrue;
bail:
@@ -959,8 +959,8 @@ XcursorFileLoadAllImages (FILE *file)
}
XcursorBool
-XcursorFileLoad (FILE *file,
- XcursorComments **commentsp,
+XcursorFileLoad (FILE *file,
+ XcursorComments **commentsp,
XcursorImages **imagesp)
{
XcursorFile f;
@@ -975,10 +975,13 @@ XcursorFileLoad (FILE *file,
XcursorBool
XcursorFileSaveImages (FILE *file, const XcursorImages *images)
{
- XcursorComments *comments = XcursorCommentsCreate (0);
+ XcursorComments *comments;
XcursorFile f;
XcursorBool ret;
- if (!comments || !file || !images)
+
+ if (!file || !images)
+ return 0;
+ if ((comments = XcursorCommentsCreate (0)) == NULL)
return 0;
_XcursorStdioFileInitialize (file, &f);
ret = XcursorXcFileSave (&f, comments, images) && fflush (file) != EOF;
@@ -987,7 +990,7 @@ XcursorFileSaveImages (FILE *file, const XcursorImages *images)
}
XcursorBool
-XcursorFileSave (FILE * file,
+XcursorFileSave (FILE * file,
const XcursorComments *comments,
const XcursorImages *images)
{
@@ -995,7 +998,7 @@ XcursorFileSave (FILE * file,
if (!file || !comments || !images)
return XcursorFalse;
-
+
_XcursorStdioFileInitialize (file, &f);
return XcursorXcFileSave (&f, comments, images) && fflush (file) != EOF;
}
@@ -1025,7 +1028,7 @@ XcursorFilenameLoadImages (const char *file, int size)
if (!file || size < 0)
return NULL;
-
+
f = fopen (file, "r");
if (!f)
return NULL;
@@ -1087,7 +1090,7 @@ XcursorFilenameSaveImages (const char *file, const XcursorImages *images)
}
XcursorBool
-XcursorFilenameSave (const char *file,
+XcursorFilenameSave (const char *file,
const XcursorComments *comments,
const XcursorImages *images)
{
diff --git a/lib/libXcursor/src/library.c b/lib/libXcursor/src/library.c
index 86f2d7668..48b75bffd 100644
--- a/lib/libXcursor/src/library.c
+++ b/lib/libXcursor/src/library.c
@@ -50,7 +50,7 @@ static void
_XcursorAddPathElt (char *path, const char *elt, int len)
{
int pathlen = strlen (path);
-
+
/* append / if the path doesn't currently have one */
if (path[0] == '\0' || path[pathlen - 1] != '/')
{
@@ -83,11 +83,11 @@ _XcursorBuildThemeDir (const char *dir, const char *theme)
if (!dir || !theme)
return NULL;
-
+
colon = strchr (dir, ':');
if (!colon)
colon = dir + strlen (dir);
-
+
dirlen = colon - dir;
tcolon = strchr (theme, ':');
@@ -95,7 +95,7 @@ _XcursorBuildThemeDir (const char *dir, const char *theme)
tcolon = theme + strlen (theme);
themelen = tcolon - theme;
-
+
home = NULL;
homelen = 0;
if (*dir == '~')
@@ -113,7 +113,7 @@ _XcursorBuildThemeDir (const char *dir, const char *theme)
* and one for the trailing null
*/
len = 1 + homelen + 1 + dirlen + 1 + themelen + 1;
-
+
full = malloc (len);
if (!full)
return NULL;
@@ -184,14 +184,14 @@ _XcursorThemeInherits (const char *full)
if (result)
{
r = result;
- while (*l)
+ while (*l)
{
while (XcursorSep(*l) || XcursorWhite (*l)) l++;
if (!*l)
break;
if (r != result)
*r++ = ':';
- while (*l && !XcursorWhite(*l) &&
+ while (*l && !XcursorWhite(*l) &&
!XcursorSep(*l))
*r++ = *l++;
}
@@ -324,7 +324,7 @@ XcursorLibraryLoadCursor (Display *dpy, const char *file)
if (!file)
return 0;
-
+
if (!images)
{
int id = XcursorLibraryShape (file);
@@ -349,10 +349,10 @@ XcursorLibraryLoadCursors (Display *dpy, const char *file)
char *theme = XcursorGetTheme (dpy);
XcursorImages *images = XcursorLibraryLoadImages (file, theme, size);
XcursorCursors *cursors;
-
+
if (!file)
return NULL;
-
+
if (!images)
{
int id = XcursorLibraryShape (file);
diff --git a/lib/libXcursor/src/xcursorint.h b/lib/libXcursor/src/xcursorint.h
index c2eec32a6..d8f9ea355 100644
--- a/lib/libXcursor/src/xcursorint.h
+++ b/lib/libXcursor/src/xcursorint.h
@@ -26,7 +26,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-
+
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
#include <X11/extensions/Xrender.h>
@@ -53,7 +53,7 @@ typedef struct _XcursorFontInfo {
* Xcursor computes a hash value for the source image
* and tries to load a library cursor of that name.
*/
-
+
/* large bitmaps are unlikely to be cursors */
#define MAX_BITMAP_CURSOR_SIZE 64
/* don't need to remember very many; in fact, 2 is likely sufficient */
@@ -103,5 +103,5 @@ _XcursorCreateGlyphCursor(Display *dpy,
Cursor
_XcursorCreateFontCursor (Display *dpy, unsigned int shape);
-
+
#endif /* _XCURSORINT_H_ */
diff --git a/lib/libXcursor/src/xlib.c b/lib/libXcursor/src/xlib.c
index dedc43a33..15716b2de 100644
--- a/lib/libXcursor/src/xlib.c
+++ b/lib/libXcursor/src/xlib.c
@@ -92,11 +92,11 @@ XcursorTryShapeCursor (Display *dpy,
if (!dpy || !source_font || !mask_font || !foreground || !background)
return 0;
-
+
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return None;
-
- if (source_font == mask_font &&
+
+ if (source_font == mask_font &&
_XcursorFontIsCursor (dpy, source_font) &&
source_char + 1 == mask_char)
{
@@ -131,14 +131,14 @@ XcursorNoticeCreateBitmap (Display *dpy,
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return;
-
+
if (width > MAX_BITMAP_CURSOR_SIZE || height > MAX_BITMAP_CURSOR_SIZE)
return;
-
+
info = _XcursorGetDisplayInfo (dpy);
if (!info)
return;
-
+
LockDisplay (dpy);
replace = 0;
now = dpy->request;
@@ -174,7 +174,7 @@ _XcursorGetBitmap (Display *dpy, Pixmap bitmap)
if (!dpy || !bitmap)
return NULL;
-
+
info = _XcursorGetDisplayInfo (dpy);
if (!info)
@@ -233,7 +233,7 @@ static unsigned char const _reverse_byte[0x100] = {
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};
-
+
#define RotByte(t,i) (((t) << (i)) | ((t) >> (8 - (i))))
void
@@ -273,7 +273,7 @@ XcursorImageHash (XImage *image,
* Flip bit order on MSB images
*/
bit_swap = (image->bitmap_bit_order != LSBFirst);
-
+
line = (unsigned char *) image->data;
i = 0;
/*
@@ -312,7 +312,7 @@ _XcursorLogDiscover (void)
}
return log;
}
-
+
void
XcursorNoticePutBitmap (Display *dpy,
Drawable draw,
@@ -322,14 +322,14 @@ XcursorNoticePutBitmap (Display *dpy,
if (!dpy || !image)
return;
-
+
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return;
-
- if (image->width > MAX_BITMAP_CURSOR_SIZE ||
+
+ if (image->width > MAX_BITMAP_CURSOR_SIZE ||
image->height > MAX_BITMAP_CURSOR_SIZE)
return;
-
+
bmi = _XcursorGetBitmap (dpy, (Pixmap) draw);
if (!bmi)
return;
@@ -374,7 +374,7 @@ XcursorNoticePutBitmap (Display *dpy,
XImage t = *image;
XInitImage (&t);
-
+
printf ("Cursor image name: ");
for (i = 0; i < XCURSOR_BITMAP_HASH_SIZE; i++)
printf ("%02x", bmi->hash[i]);
@@ -408,7 +408,7 @@ XcursorTryShapeBitmapCursor (Display *dpy,
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return None;
-
+
bmi = _XcursorGetBitmap (dpy, source);
if (!bmi || !bmi->has_image)
return None;