|
|
|
@ -795,85 +795,6 @@ _XcursorThemeInherits (const char *full)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static FILE *
|
|
|
|
|
XcursorScanTheme (const char *theme, const char *name)
|
|
|
|
|
{
|
|
|
|
|
FILE *f = NULL;
|
|
|
|
|
char *full;
|
|
|
|
|
char *dir;
|
|
|
|
|
const char *path;
|
|
|
|
|
char *inherits = NULL;
|
|
|
|
|
const char *i;
|
|
|
|
|
|
|
|
|
|
if (!theme || !name)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Scan this theme
|
|
|
|
|
*/
|
|
|
|
|
for (path = XcursorLibraryPath ();
|
|
|
|
|
path && f == NULL;
|
|
|
|
|
path = _XcursorNextPath (path))
|
|
|
|
|
{
|
|
|
|
|
dir = _XcursorBuildThemeDir (path, theme);
|
|
|
|
|
if (dir)
|
|
|
|
|
{
|
|
|
|
|
full = _XcursorBuildFullname (dir, "cursors", name);
|
|
|
|
|
if (full)
|
|
|
|
|
{
|
|
|
|
|
f = fopen (full, "r");
|
|
|
|
|
free (full);
|
|
|
|
|
}
|
|
|
|
|
if (!f && !inherits)
|
|
|
|
|
{
|
|
|
|
|
full = _XcursorBuildFullname (dir, "", "index.theme");
|
|
|
|
|
if (full)
|
|
|
|
|
{
|
|
|
|
|
inherits = _XcursorThemeInherits (full);
|
|
|
|
|
free (full);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
free (dir);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Recurse to scan inherited themes
|
|
|
|
|
*/
|
|
|
|
|
for (i = inherits; i && f == NULL; i = _XcursorNextPath (i))
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(i, theme) != 0)
|
|
|
|
|
f = XcursorScanTheme (i, name);
|
|
|
|
|
else
|
|
|
|
|
printf("Not calling XcursorScanTheme because of circular dependency: %s. %s", i, name);
|
|
|
|
|
}
|
|
|
|
|
if (inherits != NULL)
|
|
|
|
|
free (inherits);
|
|
|
|
|
return f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XcursorImages *
|
|
|
|
|
XcursorLibraryLoadImages (const char *file, const char *theme, int size)
|
|
|
|
|
{
|
|
|
|
|
FILE *f = NULL;
|
|
|
|
|
XcursorImages *images = NULL;
|
|
|
|
|
|
|
|
|
|
if (!file)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if (theme)
|
|
|
|
|
f = XcursorScanTheme (theme, file);
|
|
|
|
|
if (!f)
|
|
|
|
|
f = XcursorScanTheme ("default", file);
|
|
|
|
|
if (f)
|
|
|
|
|
{
|
|
|
|
|
images = XcursorFileLoadImages (f, size);
|
|
|
|
|
if (images)
|
|
|
|
|
XcursorImagesSetName (images, file);
|
|
|
|
|
fclose (f);
|
|
|
|
|
}
|
|
|
|
|
return images;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
load_all_cursors_from_dir(const char *path, int size,
|
|
|
|
|
void (*load_callback)(XcursorImages *, void *),
|
|
|
|
|