mirror of
https://gitlab.freedesktop.org/xorg/lib/libxcursor.git
synced 2026-05-05 01:48:01 +02:00
Strip trailing whitespace
Performed with: find * -type f | xargs perl -i -p -e 's{\s+$}{\n}'
git diff -w & git diff -b show no diffs from this change
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
d79ddc01e4
commit
e086eb1bf4
10 changed files with 123 additions and 123 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
#
|
||||
# Copyright © 2003 Keith Packard, Noah Levitt
|
||||
#
|
||||
#
|
||||
# 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
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
# specific, written prior permission. Keith Packard makes no
|
||||
# representations about the suitability of this software for any purpose. It
|
||||
# is provided "as is" without express or implied warranty.
|
||||
#
|
||||
#
|
||||
# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ void
|
|||
XcursorImageDestroy (XcursorImage *image);
|
||||
|
||||
/*
|
||||
* Manage Images objects
|
||||
* Manage Images objects
|
||||
*/
|
||||
XcursorImages *
|
||||
XcursorImagesCreate (int size);
|
||||
|
|
@ -304,7 +304,7 @@ XcursorXcFileLoad (XcursorFile *file,
|
|||
XcursorImages **imagesp);
|
||||
|
||||
XcursorBool
|
||||
XcursorXcFileSave (XcursorFile *file,
|
||||
XcursorXcFileSave (XcursorFile *file,
|
||||
const XcursorComments *comments,
|
||||
const XcursorImages *images);
|
||||
|
||||
|
|
@ -321,15 +321,15 @@ XcursorImages *
|
|||
XcursorFileLoadAllImages (FILE *file);
|
||||
|
||||
XcursorBool
|
||||
XcursorFileLoad (FILE *file,
|
||||
XcursorComments **commentsp,
|
||||
XcursorFileLoad (FILE *file,
|
||||
XcursorComments **commentsp,
|
||||
XcursorImages **imagesp);
|
||||
|
||||
XcursorBool
|
||||
XcursorFileSaveImages (FILE *file, const XcursorImages *images);
|
||||
|
||||
XcursorBool
|
||||
XcursorFileSave (FILE * file,
|
||||
XcursorFileSave (FILE * file,
|
||||
const XcursorComments *comments,
|
||||
const XcursorImages *images);
|
||||
|
||||
|
|
@ -354,7 +354,7 @@ XcursorBool
|
|||
XcursorFilenameSaveImages (const char *filename, const XcursorImages *images);
|
||||
|
||||
XcursorBool
|
||||
XcursorFilenameSave (const char *file,
|
||||
XcursorFilenameSave (const char *file,
|
||||
const XcursorComments *comments,
|
||||
const XcursorImages *images);
|
||||
|
||||
|
|
@ -376,7 +376,7 @@ XcursorLibraryPath (void);
|
|||
|
||||
int
|
||||
XcursorLibraryShape (const char *library);
|
||||
|
||||
|
||||
/*
|
||||
* Image/Cursor APIs
|
||||
*/
|
||||
|
|
@ -465,7 +465,7 @@ XcursorTryShapeBitmapCursor (Display *dpy,
|
|||
#define XCURSOR_BITMAP_HASH_SIZE 16
|
||||
|
||||
void
|
||||
XcursorImageHash (XImage *image,
|
||||
XcursorImageHash (XImage *image,
|
||||
unsigned char hash[XCURSOR_BITMAP_HASH_SIZE]);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ XcursorBool XcursorXcFileLoad (XcursorFile *file, XcursorComments **commentsp, X
|
|||
XcursorBool XcursorXcFileSave (XcursorFile *file, const XcursorComments *comments, const XcursorImages *images)
|
||||
These read and write cursors from an XcursorFile handle. After reading, the
|
||||
file pointer will be left at some random place in the file.
|
||||
|
||||
|
||||
.TP
|
||||
XcursorImage *XcursorFileLoadImage (FILE *file, int size)
|
||||
.TQ
|
||||
|
|
@ -372,7 +372,7 @@ Gets the current theme name.
|
|||
.SH "ENVIRONMENT VARIABLES"
|
||||
.TP 15
|
||||
.B XCURSOR_PATH
|
||||
This variable sets the list of paths to look for cursors in.
|
||||
This variable sets the list of paths to look for cursors in.
|
||||
Directories in this path are separated by colons (:).
|
||||
|
||||
.SH RESTRICTIONS
|
||||
|
|
|
|||
|
|
@ -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_srcdir)/include/X11/Xcursor/Xcursor.h
|
||||
|
||||
if LINT
|
||||
ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
|
|
|
|||
54
src/cursor.c
54
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);
|
||||
}
|
||||
|
|
@ -604,12 +604,12 @@ XcursorImageLoadCursor (Display *dpy, const XcursorImage *image)
|
|||
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 +642,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 +702,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 +734,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 +748,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 +768,7 @@ _XcursorCreateGlyphCursor(Display *dpy,
|
|||
unsigned int mask_char,
|
||||
XColor _Xconst *foreground,
|
||||
XColor _Xconst *background)
|
||||
{
|
||||
{
|
||||
Cursor cid;
|
||||
register xCreateGlyphCursorReq *req;
|
||||
|
||||
|
|
@ -800,21 +800,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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
88
src/file.c
88
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;
|
||||
|
|
@ -987,7 +987,7 @@ XcursorFileSaveImages (FILE *file, const XcursorImages *images)
|
|||
}
|
||||
|
||||
XcursorBool
|
||||
XcursorFileSave (FILE * file,
|
||||
XcursorFileSave (FILE * file,
|
||||
const XcursorComments *comments,
|
||||
const XcursorImages *images)
|
||||
{
|
||||
|
|
@ -995,7 +995,7 @@ XcursorFileSave (FILE * file,
|
|||
|
||||
if (!file || !comments || !images)
|
||||
return XcursorFalse;
|
||||
|
||||
|
||||
_XcursorStdioFileInitialize (file, &f);
|
||||
return XcursorXcFileSave (&f, comments, images) && fflush (file) != EOF;
|
||||
}
|
||||
|
|
@ -1025,7 +1025,7 @@ XcursorFilenameLoadImages (const char *file, int size)
|
|||
|
||||
if (!file || size < 0)
|
||||
return NULL;
|
||||
|
||||
|
||||
f = fopen (file, "r");
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
|
@ -1087,7 +1087,7 @@ XcursorFilenameSaveImages (const char *file, const XcursorImages *images)
|
|||
}
|
||||
|
||||
XcursorBool
|
||||
XcursorFilenameSave (const char *file,
|
||||
XcursorFilenameSave (const char *file,
|
||||
const XcursorComments *comments,
|
||||
const XcursorImages *images)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
32
src/xlib.c
32
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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue