1
2#ifndef _XF86CURSOR_H
3#define _XF86CURSOR_H
4
5#include "xf86str.h"
6#include "mipointer.h"
7
8typedef struct _xf86CursorInfoRec {
9    ScrnInfoPtr pScrn;
10    int Flags;
11    int MaxWidth;
12    int MaxHeight;
13    void (*SetCursorColors) (ScrnInfoPtr pScrn, int bg, int fg);
14    void (*SetCursorPosition) (ScrnInfoPtr pScrn, int x, int y);
15    void (*LoadCursorImage) (ScrnInfoPtr pScrn, unsigned char *bits);
16    Bool (*LoadCursorImageCheck) (ScrnInfoPtr pScrn, unsigned char *bits);
17    void (*HideCursor) (ScrnInfoPtr pScrn);
18    void (*ShowCursor) (ScrnInfoPtr pScrn);
19    Bool (*ShowCursorCheck) (ScrnInfoPtr pScrn);
20    unsigned char *(*RealizeCursor) (struct _xf86CursorInfoRec *, CursorPtr);
21    Bool (*UseHWCursor) (ScreenPtr, CursorPtr);
22
23    Bool (*UseHWCursorARGB) (ScreenPtr, CursorPtr);
24    void (*LoadCursorARGB) (ScrnInfoPtr, CursorPtr);
25    Bool (*LoadCursorARGBCheck) (ScrnInfoPtr, CursorPtr);
26
27} xf86CursorInfoRec, *xf86CursorInfoPtr;
28
29static inline Bool
30xf86DriverHasLoadCursorImage(xf86CursorInfoPtr infoPtr)
31{
32    return infoPtr->LoadCursorImageCheck || infoPtr->LoadCursorImage;
33}
34
35static inline Bool
36xf86DriverLoadCursorImage(xf86CursorInfoPtr infoPtr, unsigned char *bits)
37{
38    if(infoPtr->LoadCursorImageCheck)
39        return infoPtr->LoadCursorImageCheck(infoPtr->pScrn, bits);
40    infoPtr->LoadCursorImage(infoPtr->pScrn, bits);
41    return TRUE;
42}
43
44static inline Bool
45xf86DriverHasShowCursor(xf86CursorInfoPtr infoPtr)
46{
47    return infoPtr->ShowCursorCheck || infoPtr->ShowCursor;
48}
49
50static inline Bool
51xf86DriverShowCursor(xf86CursorInfoPtr infoPtr)
52{
53    if(infoPtr->ShowCursorCheck)
54        return infoPtr->ShowCursorCheck(infoPtr->pScrn);
55    infoPtr->ShowCursor(infoPtr->pScrn);
56    return TRUE;
57}
58
59static inline Bool
60xf86DriverHasLoadCursorARGB(xf86CursorInfoPtr infoPtr)
61{
62    return infoPtr->LoadCursorARGBCheck || infoPtr->LoadCursorARGB;
63}
64
65static inline Bool
66xf86DriverLoadCursorARGB(xf86CursorInfoPtr infoPtr, CursorPtr pCursor)
67{
68    if(infoPtr->LoadCursorARGBCheck)
69        return infoPtr->LoadCursorARGBCheck(infoPtr->pScrn, pCursor);
70    infoPtr->LoadCursorARGB(infoPtr->pScrn, pCursor);
71    return TRUE;
72}
73
74extern _X_EXPORT Bool xf86InitCursor(ScreenPtr pScreen,
75                                     xf86CursorInfoPtr infoPtr);
76extern _X_EXPORT xf86CursorInfoPtr xf86CreateCursorInfoRec(void);
77extern _X_EXPORT void xf86DestroyCursorInfoRec(xf86CursorInfoPtr);
78extern _X_EXPORT void xf86CursorResetCursor(ScreenPtr pScreen);
79extern _X_EXPORT void xf86ForceHWCursor(ScreenPtr pScreen, Bool on);
80extern _X_EXPORT CursorPtr xf86CurrentCursor(ScreenPtr pScreen);
81
82#define HARDWARE_CURSOR_INVERT_MASK 			0x00000001
83#define HARDWARE_CURSOR_AND_SOURCE_WITH_MASK		0x00000002
84#define HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK		0x00000004
85#define HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED	0x00000008
86#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1	0x00000010
87#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8	0x00000020
88#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16	0x00000040
89#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32	0x00000080
90#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64	0x00000100
91#define HARDWARE_CURSOR_TRUECOLOR_AT_8BPP		0x00000200
92#define HARDWARE_CURSOR_BIT_ORDER_MSBFIRST		0x00000400
93#define HARDWARE_CURSOR_NIBBLE_SWAPPED			0x00000800
94#define HARDWARE_CURSOR_SHOW_TRANSPARENT		0x00001000
95#define HARDWARE_CURSOR_UPDATE_UNHIDDEN			0x00002000
96#define HARDWARE_CURSOR_ARGB				0x00004000
97
98#endif                          /* _XF86CURSOR_H */
99