Mir
Macros | Typedefs | Functions
xcursor.c File Reference
#include "xcursor.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
Include dependency graph for xcursor.c:

Macros

#define XcursorTrue   1
 
#define XcursorFalse   0
 
#define XCURSOR_MAGIC   0x72756358 /* "Xcur" LSBFirst */
 
#define XCURSOR_LIB_MAJOR   1
 
#define XCURSOR_LIB_MINOR   1
 
#define XCURSOR_LIB_REVISION   13
 
#define XCURSOR_LIB_VERSION
 
#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)
 
#define XCURSOR_CHUNK_HEADER_LEN   (4 * 4)
 
#define XCURSOR_COMMENT_TYPE   0xfffe0001
 
#define XCURSOR_COMMENT_VERSION   1
 
#define XCURSOR_COMMENT_HEADER_LEN   (XCURSOR_CHUNK_HEADER_LEN + (1 *4))
 
#define XCURSOR_COMMENT_COPYRIGHT   1
 
#define XCURSOR_COMMENT_LICENSE   2
 
#define XCURSOR_COMMENT_OTHER   3
 
#define XCURSOR_COMMENT_MAX_LEN   0x100000
 
#define XCURSOR_IMAGE_TYPE   0xfffd0002
 
#define XCURSOR_IMAGE_VERSION   1
 
#define XCURSOR_IMAGE_HEADER_LEN   (XCURSOR_CHUNK_HEADER_LEN + (5*4))
 
#define XCURSOR_IMAGE_MAX_SIZE   0x7fff /* 32767x32767 max cursor size */
 
#define dist(a, b)   ((a) > (b) ? (a) - (b) : (b) - (a))
 
#define ICONDIR   "/usr/X11R6/lib/X11/icons"
 
#define XCURSORPATH   "~/.icons:/usr/share/icons:/usr/share/pixmaps:~/.cursors:/usr/share/cursors/xorg-x11:"ICONDIR
 
#define XcursorWhite(c)   ((c) == ' ' || (c) == '\t' || (c) == '\n')
 
#define XcursorSep(c)   ((c) == ';' || (c) == ',')
 

Typedefs

typedef struct _XcursorFileToc XcursorFileToc
 
typedef struct _XcursorFileHeader XcursorFileHeader
 
typedef struct _XcursorChunkHeader XcursorChunkHeader
 
typedef struct _XcursorComment XcursorComment
 
typedef struct _XcursorFile XcursorFile
 
typedef struct _XcursorComments XcursorComments
 

Functions

void XcursorImagesDestroy (XcursorImages *images)
 
XcursorImagesXcursorLibraryLoadImages (const char *file, const char *theme, int size)
 
void xcursor_load_theme (const char *theme, int size, void(*load_callback)(XcursorImages *, void *), void *user_data)
 Load all the cursor of a theme. More...
 

Macro Definition Documentation

#define dist (   a,
 
)    ((a) > (b) ? (a) - (b) : (b) - (a))
#define ICONDIR   "/usr/X11R6/lib/X11/icons"
#define XCURSOR_CHUNK_HEADER_LEN   (4 * 4)
#define XCURSOR_COMMENT_COPYRIGHT   1
#define XCURSOR_COMMENT_HEADER_LEN   (XCURSOR_CHUNK_HEADER_LEN + (1 *4))
#define XCURSOR_COMMENT_LICENSE   2
#define XCURSOR_COMMENT_MAX_LEN   0x100000
#define XCURSOR_COMMENT_OTHER   3
#define XCURSOR_COMMENT_TYPE   0xfffe0001
#define XCURSOR_COMMENT_VERSION   1
#define XCURSOR_FILE_HEADER_LEN   (4 * 4)
#define XCURSOR_FILE_MAJOR   1
#define XCURSOR_FILE_MINOR   0
#define XCURSOR_FILE_TOC_LEN   (3 * 4)
#define XCURSOR_FILE_VERSION   ((XCURSOR_FILE_MAJOR << 16) | (XCURSOR_FILE_MINOR))
#define XCURSOR_IMAGE_HEADER_LEN   (XCURSOR_CHUNK_HEADER_LEN + (5*4))
#define XCURSOR_IMAGE_MAX_SIZE   0x7fff /* 32767x32767 max cursor size */
#define XCURSOR_IMAGE_TYPE   0xfffd0002
#define XCURSOR_IMAGE_VERSION   1
#define XCURSOR_LIB_MAJOR   1
#define XCURSOR_LIB_MINOR   1
#define XCURSOR_LIB_REVISION   13
#define XCURSOR_LIB_VERSION
Value:
((XCURSOR_LIB_MAJOR * 10000) + \
(XCURSOR_LIB_MINOR * 100) + \
#define XCURSOR_LIB_MAJOR
Definition: xcursor.c:74
#define XCURSOR_LIB_REVISION
Definition: xcursor.c:76
#define XCURSOR_LIB_MINOR
Definition: xcursor.c:75
#define XCURSOR_MAGIC   0x72756358 /* "Xcur" LSBFirst */
#define XcursorFalse   0
#define XCURSORPATH   "~/.icons:/usr/share/icons:/usr/share/pixmaps:~/.cursors:/usr/share/cursors/xorg-x11:"ICONDIR
#define XcursorSep (   c)    ((c) == ';' || (c) == ',')
#define XcursorTrue   1
#define XcursorWhite (   c)    ((c) == ' ' || (c) == '\t' || (c) == '\n')

Typedef Documentation

typedef struct _XcursorChunkHeader XcursorChunkHeader
typedef struct _XcursorComment XcursorComment
typedef struct _XcursorComments XcursorComments
typedef struct _XcursorFile XcursorFile
typedef struct _XcursorFileHeader XcursorFileHeader
typedef struct _XcursorFileToc XcursorFileToc

Function Documentation

void xcursor_load_theme ( const char *  theme,
int  size,
void(*)(XcursorImages *, void *)  load_callback,
void *  user_data 
)

Load all the cursor of a theme.

This function loads all the cursor images of a given theme and its inherited themes. Each cursor is loaded into an XcursorImages object which is passed to the caller's load callback. If a cursor appears more than once across all the inherited themes, the load callback will be called multiple times, with possibly different XcursorImages object which have the same name. The user is expected to destroy the XcursorImages objects passed to the callback with XcursorImagesDestroy().

Parameters
themeThe name of theme that should be loaded
sizeThe desired size of the cursor images
load_callbackA callback function that will be called for each cursor loaded. The first parameter is the XcursorImages object representing the loaded cursor and the second is a pointer to data provided by the user.
user_dataThe data that should be passed to the load callback
void XcursorImagesDestroy ( XcursorImages images)
XcursorImages* XcursorLibraryLoadImages ( const char *  file,
const char *  theme,
int  size 
)

Copyright © 2012-2016 Canonical Ltd.
Generated on Wed May 10 10:41:27 UTC 2017