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