1/*
2
3Copyright 1989, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24*/
25
26#ifndef MIPOINTER_H
27#define MIPOINTER_H
28
29#include "cursor.h"
30#include "input.h"
31#include "privates.h"
32
33typedef struct _miPointerSpriteFuncRec {
34    Bool	(*RealizeCursor)(
35                    DeviceIntPtr /* pDev */,
36                    ScreenPtr /* pScr */,
37                    CursorPtr /* pCurs */
38                    );
39    Bool	(*UnrealizeCursor)(
40                    DeviceIntPtr /* pDev */,
41                    ScreenPtr /* pScr */,
42                    CursorPtr /* pCurs */
43                    );
44    void	(*SetCursor)(
45                    DeviceIntPtr /* pDev */,
46                    ScreenPtr /* pScr */,
47                    CursorPtr /* pCurs */,
48                    int  /* x */,
49                    int  /* y */
50                    );
51    void	(*MoveCursor)(
52                    DeviceIntPtr /* pDev */,
53                    ScreenPtr /* pScr */,
54                    int  /* x */,
55                    int  /* y */
56                    );
57    Bool        (*DeviceCursorInitialize)(
58                    DeviceIntPtr /* pDev */,
59                    ScreenPtr /* pScr */
60                    );
61    void        (*DeviceCursorCleanup)(
62                    DeviceIntPtr /* pDev */,
63                    ScreenPtr /* pScr */
64                    );
65} miPointerSpriteFuncRec, *miPointerSpriteFuncPtr;
66
67typedef struct _miPointerScreenFuncRec {
68    Bool	(*CursorOffScreen)(
69                    ScreenPtr* /* ppScr */,
70                    int*  /* px */,
71                    int*  /* py */
72                    );
73    void	(*CrossScreen)(
74                    ScreenPtr /* pScr */,
75                    int  /* entering */
76                    );
77    void	(*WarpCursor)(
78                    DeviceIntPtr /*pDev*/,
79                    ScreenPtr /* pScr */,
80                    int  /* x */,
81                    int  /* y */
82                    );
83    void	(*EnqueueEvent)(
84                    DeviceIntPtr /* pDev */,
85                    InternalEvent* /* event */
86                    );
87    void	(*NewEventScreen)(
88		    DeviceIntPtr /* pDev */,
89                    ScreenPtr /* pScr */,
90		    Bool /* fromDIX */
91                    );
92} miPointerScreenFuncRec, *miPointerScreenFuncPtr;
93
94extern _X_EXPORT Bool miDCInitialize(
95    ScreenPtr /*pScreen*/,
96    miPointerScreenFuncPtr /*screenFuncs*/
97);
98
99extern _X_EXPORT Bool miPointerInitialize(
100    ScreenPtr /*pScreen*/,
101    miPointerSpriteFuncPtr /*spriteFuncs*/,
102    miPointerScreenFuncPtr /*screenFuncs*/,
103    Bool /*waitForUpdate*/
104);
105
106extern _X_EXPORT void miPointerWarpCursor(
107    DeviceIntPtr /*pDev*/,
108    ScreenPtr /*pScreen*/,
109    int /*x*/,
110    int /*y*/
111);
112
113/* Deprecated in favour of miPointerGetScreen. */
114extern _X_EXPORT ScreenPtr miPointerCurrentScreen(
115    void
116) _X_DEPRECATED;
117
118extern _X_EXPORT ScreenPtr miPointerGetScreen(
119    DeviceIntPtr pDev);
120extern _X_EXPORT void miPointerSetScreen(
121    DeviceIntPtr pDev,
122    int screen_num,
123    int x,
124    int y);
125
126/* Returns the current cursor position. */
127extern _X_EXPORT void miPointerGetPosition(
128    DeviceIntPtr pDev,
129    int *x,
130    int *y);
131
132/* Moves the cursor to the specified position.  May clip the co-ordinates:
133 * x and y are modified in-place. */
134extern _X_EXPORT void miPointerSetPosition(
135    DeviceIntPtr pDev,
136    int *x,
137    int *y);
138
139extern _X_EXPORT void miPointerUpdateSprite(
140    DeviceIntPtr pDev);
141
142/* Sets whether the sprite should be updated immediately on pointer moves */
143extern _X_EXPORT Bool miPointerSetWaitForUpdate(
144    ScreenPtr pScreen,
145    Bool wait);
146
147extern _X_EXPORT DevPrivateKeyRec miPointerPrivKeyRec;
148#define miPointerPrivKey (&miPointerPrivKeyRec)
149
150extern _X_EXPORT DevPrivateKeyRec miPointerScreenKeyRec;
151#define miPointerScreenKey (&miPointerScreenKeyRec)
152
153#endif /* MIPOINTER_H */
154