|
Packit |
439757 |
/*
|
|
Packit |
439757 |
* Copyright © 2002 Keith Packard
|
|
Packit |
439757 |
*
|
|
Packit |
439757 |
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
Packit |
439757 |
* documentation for any purpose is hereby granted without fee, provided that
|
|
Packit |
439757 |
* the above copyright notice appear in all copies and that both that
|
|
Packit |
439757 |
* copyright notice and this permission notice appear in supporting
|
|
Packit |
439757 |
* documentation, and that the name of Keith Packard not be used in
|
|
Packit |
439757 |
* advertising or publicity pertaining to distribution of the software without
|
|
Packit |
439757 |
* specific, written prior permission. Keith Packard makes no
|
|
Packit |
439757 |
* representations about the suitability of this software for any purpose. It
|
|
Packit |
439757 |
* is provided "as is" without express or implied warranty.
|
|
Packit |
439757 |
*
|
|
Packit |
439757 |
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
Packit |
439757 |
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
Packit |
439757 |
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
Packit |
439757 |
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
Packit |
439757 |
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
Packit |
439757 |
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
Packit |
439757 |
* PERFORMANCE OF THIS SOFTWARE.
|
|
Packit |
439757 |
*/
|
|
Packit |
439757 |
|
|
Packit |
439757 |
#ifndef _XCURSORINT_H_
|
|
Packit |
439757 |
#define _XCURSORINT_H_
|
|
Packit |
439757 |
|
|
Packit |
439757 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
439757 |
#include "config.h"
|
|
Packit |
439757 |
#endif
|
|
Packit |
439757 |
|
|
Packit |
439757 |
#include <X11/Xlib.h>
|
|
Packit |
439757 |
#include <X11/cursorfont.h>
|
|
Packit |
439757 |
#include <X11/extensions/Xrender.h>
|
|
Packit |
439757 |
|
|
Packit |
439757 |
#ifdef HAVE_XFIXES
|
|
Packit |
439757 |
#include <X11/extensions/Xfixes.h>
|
|
Packit |
439757 |
#endif
|
|
Packit |
439757 |
|
|
Packit |
439757 |
#include "Xcursor.h"
|
|
Packit |
439757 |
#include "config.h"
|
|
Packit |
439757 |
|
|
Packit |
439757 |
typedef struct _XcursorFontInfo {
|
|
Packit |
439757 |
struct _XcursorFontInfo *next;
|
|
Packit |
439757 |
Font font;
|
|
Packit |
439757 |
XcursorBool is_cursor_font;
|
|
Packit |
439757 |
} XcursorFontInfo;
|
|
Packit |
439757 |
|
|
Packit |
439757 |
/*
|
|
Packit |
439757 |
* Track a few recently created bitmaps to see
|
|
Packit |
439757 |
* if they get used to create cursors. This
|
|
Packit |
439757 |
* is done by hooking into Xlib and watching
|
|
Packit |
439757 |
* for XCreatePixmap, XPutImage, XCreatePixmapCursor
|
|
Packit |
439757 |
* with appropriate arguments. When this happens
|
|
Packit |
439757 |
* Xcursor computes a hash value for the source image
|
|
Packit |
439757 |
* and tries to load a library cursor of that name.
|
|
Packit |
439757 |
*/
|
|
Packit |
439757 |
|
|
Packit |
439757 |
/* large bitmaps are unlikely to be cursors */
|
|
Packit |
439757 |
#define MAX_BITMAP_CURSOR_SIZE 64
|
|
Packit |
439757 |
/* don't need to remember very many; in fact, 2 is likely sufficient */
|
|
Packit |
439757 |
#define NUM_BITMAPS 8
|
|
Packit |
439757 |
|
|
Packit |
439757 |
typedef struct _XcursorBitmapInfo {
|
|
Packit |
439757 |
Pixmap bitmap;
|
|
Packit |
439757 |
unsigned long sequence;
|
|
Packit |
439757 |
unsigned int width, height;
|
|
Packit |
439757 |
Bool has_image;
|
|
Packit |
439757 |
unsigned char hash[XCURSOR_BITMAP_HASH_SIZE];
|
|
Packit |
439757 |
} XcursorBitmapInfo;
|
|
Packit |
439757 |
|
|
Packit |
439757 |
typedef enum _XcursorDither {
|
|
Packit |
439757 |
XcursorDitherThreshold,
|
|
Packit |
439757 |
XcursorDitherMedian,
|
|
Packit |
439757 |
XcursorDitherOrdered,
|
|
Packit |
439757 |
XcursorDitherDiffuse
|
|
Packit |
439757 |
} XcursorDither;
|
|
Packit |
439757 |
|
|
Packit |
439757 |
typedef struct _XcursorDisplayInfo {
|
|
Packit |
439757 |
struct _XcursorDisplayInfo *next;
|
|
Packit |
439757 |
Display *display;
|
|
Packit |
439757 |
XExtCodes *codes;
|
|
Packit |
439757 |
XcursorBool has_render_cursor;
|
|
Packit |
439757 |
XcursorBool has_anim_cursor;
|
|
Packit |
439757 |
XcursorBool theme_core;
|
|
Packit |
439757 |
int size;
|
|
Packit |
439757 |
XcursorFontInfo *fonts;
|
|
Packit |
439757 |
char *theme;
|
|
Packit |
439757 |
char *theme_from_config;
|
|
Packit |
439757 |
XcursorDither dither;
|
|
Packit |
439757 |
XcursorBitmapInfo bitmaps[NUM_BITMAPS];
|
|
Packit |
439757 |
} XcursorDisplayInfo;
|
|
Packit |
439757 |
|
|
Packit |
439757 |
XcursorDisplayInfo *
|
|
Packit |
439757 |
_XcursorGetDisplayInfo (Display *dpy);
|
|
Packit |
439757 |
|
|
Packit |
439757 |
Cursor
|
|
Packit |
439757 |
_XcursorCreateGlyphCursor(Display *dpy,
|
|
Packit |
439757 |
Font source_font,
|
|
Packit |
439757 |
Font mask_font,
|
|
Packit |
439757 |
unsigned int source_char,
|
|
Packit |
439757 |
unsigned int mask_char,
|
|
Packit |
439757 |
XColor _Xconst *foreground,
|
|
Packit |
439757 |
XColor _Xconst *background);
|
|
Packit |
439757 |
|
|
Packit |
439757 |
Cursor
|
|
Packit |
439757 |
_XcursorCreateFontCursor (Display *dpy, unsigned int shape);
|
|
Packit |
439757 |
|
|
Packit |
439757 |
#endif /* _XCURSORINT_H_ */
|