1 | /******************************************************************************
|
---|
2 | *
|
---|
3 | * Copyright (c) 1994, 1995 Hewlett-Packard Company
|
---|
4 | *
|
---|
5 | * Permission is hereby granted, free of charge, to any person obtaining
|
---|
6 | * a copy of this software and associated documentation files (the
|
---|
7 | * "Software"), to deal in the Software without restriction, including
|
---|
8 | * without limitation the rights to use, copy, modify, merge, publish,
|
---|
9 | * distribute, sublicense, and/or sell copies of the Software, and to
|
---|
10 | * permit persons to whom the Software is furnished to do so, subject to
|
---|
11 | * the following conditions:
|
---|
12 | *
|
---|
13 | * The above copyright notice and this permission notice shall be included
|
---|
14 | * in all copies or substantial portions of the Software.
|
---|
15 | *
|
---|
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
---|
18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
---|
19 | * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
|
---|
20 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
---|
21 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
---|
22 | * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
23 | *
|
---|
24 | * Except as contained in this notice, the name of the Hewlett-Packard
|
---|
25 | * Company shall not be used in advertising or otherwise to promote the
|
---|
26 | * sale, use or other dealings in this Software without prior written
|
---|
27 | * authorization from the Hewlett-Packard Company.
|
---|
28 | *
|
---|
29 | * Header file for DIX-related DBE
|
---|
30 | *
|
---|
31 | *****************************************************************************/
|
---|
32 |
|
---|
33 | #ifndef DBE_STRUCT_H
|
---|
34 | #define DBE_STRUCT_H
|
---|
35 |
|
---|
36 |
|
---|
37 | /* INCLUDES */
|
---|
38 |
|
---|
39 | #define NEED_DBE_PROTOCOL
|
---|
40 | #include <X11/extensions/Xdbeproto.h>
|
---|
41 | #include "windowstr.h"
|
---|
42 | #include "privates.h"
|
---|
43 |
|
---|
44 |
|
---|
45 | /* DEFINES */
|
---|
46 |
|
---|
47 | #define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \
|
---|
48 | dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey))
|
---|
49 |
|
---|
50 | #define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
|
---|
51 | DBE_SCREEN_PRIV((pDrawable)->pScreen)
|
---|
52 |
|
---|
53 | #define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \
|
---|
54 | DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen)
|
---|
55 |
|
---|
56 | #define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \
|
---|
57 | DBE_SCREEN_PRIV((pWindow)->drawable.pScreen)
|
---|
58 |
|
---|
59 | #define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \
|
---|
60 | DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen)
|
---|
61 |
|
---|
62 | #define DBE_SCREEN_PRIV_FROM_GC(pGC)\
|
---|
63 | DBE_SCREEN_PRIV((pGC)->pScreen)
|
---|
64 |
|
---|
65 | #define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \
|
---|
66 | dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey))
|
---|
67 |
|
---|
68 | /* Initial size of the buffer ID array in the window priv. */
|
---|
69 | #define DBE_INIT_MAX_IDS 2
|
---|
70 |
|
---|
71 | /* Reallocation increment for the buffer ID array. */
|
---|
72 | #define DBE_INCR_MAX_IDS 4
|
---|
73 |
|
---|
74 | /* Marker for free elements in the buffer ID array. */
|
---|
75 | #define DBE_FREE_ID_ELEMENT 0
|
---|
76 |
|
---|
77 |
|
---|
78 | /* TYPEDEFS */
|
---|
79 |
|
---|
80 | /* Record used to pass swap information between DIX and DDX swapping
|
---|
81 | * procedures.
|
---|
82 | */
|
---|
83 | typedef struct _DbeSwapInfoRec
|
---|
84 | {
|
---|
85 | WindowPtr pWindow;
|
---|
86 | unsigned char swapAction;
|
---|
87 |
|
---|
88 | } DbeSwapInfoRec, *DbeSwapInfoPtr;
|
---|
89 |
|
---|
90 | /*
|
---|
91 | ******************************************************************************
|
---|
92 | ** Per-window data
|
---|
93 | ******************************************************************************
|
---|
94 | */
|
---|
95 |
|
---|
96 | typedef struct _DbeWindowPrivRec
|
---|
97 | {
|
---|
98 | /* A pointer to the window with which the DBE window private (buffer) is
|
---|
99 | * associated.
|
---|
100 | */
|
---|
101 | WindowPtr pWindow;
|
---|
102 |
|
---|
103 | /* Last known swap action for this buffer. Legal values for this field
|
---|
104 | * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
|
---|
105 | */
|
---|
106 | unsigned char swapAction;
|
---|
107 |
|
---|
108 | /* Last known buffer size.
|
---|
109 | */
|
---|
110 | unsigned short width, height;
|
---|
111 |
|
---|
112 | /* Coordinates used for static gravity when the window is positioned.
|
---|
113 | */
|
---|
114 | short x, y;
|
---|
115 |
|
---|
116 | /* Number of XIDs associated with this buffer.
|
---|
117 | */
|
---|
118 | int nBufferIDs;
|
---|
119 |
|
---|
120 | /* Capacity of the current buffer ID array, IDs. */
|
---|
121 | int maxAvailableIDs;
|
---|
122 |
|
---|
123 | /* Pointer to the array of buffer IDs. This initially points to initIDs.
|
---|
124 | * When the static limit of the initIDs array is reached, the array is
|
---|
125 | * reallocated and this pointer is set to the new array instead of initIDs.
|
---|
126 | */
|
---|
127 | XID *IDs;
|
---|
128 |
|
---|
129 | /* Initial array of buffer IDs. We are defining the XID array within the
|
---|
130 | * window priv to optimize for data locality. In most cases, only one
|
---|
131 | * buffer will be associated with a window. Having the array declared
|
---|
132 | * here can prevent us from accessing the data in another memory page,
|
---|
133 | * possibly resulting in a page swap and loss of performance. Initially we
|
---|
134 | * will use this array to store buffer IDs. For situations where we have
|
---|
135 | * more IDs than can fit in this static array, we will allocate a larger
|
---|
136 | * array to use, possibly suffering a performance loss.
|
---|
137 | */
|
---|
138 | XID initIDs[DBE_INIT_MAX_IDS];
|
---|
139 |
|
---|
140 | /* Device-specific private information.
|
---|
141 | */
|
---|
142 | PrivateRec *devPrivates;
|
---|
143 |
|
---|
144 | } DbeWindowPrivRec, *DbeWindowPrivPtr;
|
---|
145 |
|
---|
146 |
|
---|
147 | /*
|
---|
148 | ******************************************************************************
|
---|
149 | ** Per-screen data
|
---|
150 | ******************************************************************************
|
---|
151 | */
|
---|
152 |
|
---|
153 | typedef struct _DbeScreenPrivRec
|
---|
154 | {
|
---|
155 | /* Resources created by DIX to be used by DDX */
|
---|
156 | RESTYPE dbeDrawableResType;
|
---|
157 | RESTYPE dbeWindowPrivResType;
|
---|
158 |
|
---|
159 | /* Private indices created by DIX to be used by DDX */
|
---|
160 | DevPrivateKey dbeScreenPrivKey;
|
---|
161 | DevPrivateKey dbeWindowPrivKey;
|
---|
162 |
|
---|
163 | /* Wrapped functions
|
---|
164 | * It is the responsibilty of the DDX layer to wrap PositionWindow().
|
---|
165 | * DbeExtensionInit wraps DestroyWindow().
|
---|
166 | */
|
---|
167 | PositionWindowProcPtr PositionWindow;
|
---|
168 | DestroyWindowProcPtr DestroyWindow;
|
---|
169 |
|
---|
170 | /* Per-screen DIX routines */
|
---|
171 | Bool (*SetupBackgroundPainter)(
|
---|
172 | WindowPtr /*pWin*/,
|
---|
173 | GCPtr /*pGC*/
|
---|
174 | );
|
---|
175 |
|
---|
176 | /* Per-screen DDX routines */
|
---|
177 | Bool (*GetVisualInfo)(
|
---|
178 | ScreenPtr /*pScreen*/,
|
---|
179 | XdbeScreenVisualInfo * /*pVisInfo*/
|
---|
180 | );
|
---|
181 | int (*AllocBackBufferName)(
|
---|
182 | WindowPtr /*pWin*/,
|
---|
183 | XID /*bufId*/,
|
---|
184 | int /*swapAction*/
|
---|
185 | );
|
---|
186 | int (*SwapBuffers)(
|
---|
187 | ClientPtr /*client*/,
|
---|
188 | int * /*pNumWindows*/,
|
---|
189 | DbeSwapInfoPtr /*swapInfo*/
|
---|
190 | );
|
---|
191 | void (*BeginIdiom)(
|
---|
192 | ClientPtr /*client*/
|
---|
193 | );
|
---|
194 | void (*EndIdiom)(
|
---|
195 | ClientPtr /*client*/
|
---|
196 | );
|
---|
197 | void (*WinPrivDelete)(
|
---|
198 | DbeWindowPrivPtr /*pDbeWindowPriv*/,
|
---|
199 | XID /*bufId*/
|
---|
200 | );
|
---|
201 | void (*ResetProc)(
|
---|
202 | ScreenPtr /*pScreen*/
|
---|
203 | );
|
---|
204 |
|
---|
205 | /* Device-specific private information.
|
---|
206 | */
|
---|
207 | PrivateRec *devPrivates;
|
---|
208 |
|
---|
209 | } DbeScreenPrivRec, *DbeScreenPrivPtr;
|
---|
210 |
|
---|
211 | #endif /* DBE_STRUCT_H */
|
---|