1 | /***********************************************************
|
---|
2 |
|
---|
3 | Copyright 1987, 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 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
---|
26 |
|
---|
27 | All Rights Reserved
|
---|
28 |
|
---|
29 | Permission to use, copy, modify, and distribute this software and its
|
---|
30 | documentation for any purpose and without fee is hereby granted,
|
---|
31 | provided that the above copyright notice appear in all copies and that
|
---|
32 | both that copyright notice and this permission notice appear in
|
---|
33 | supporting documentation, and that the name of Digital not be
|
---|
34 | used in advertising or publicity pertaining to distribution of the
|
---|
35 | software without specific, written prior permission.
|
---|
36 |
|
---|
37 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
---|
38 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
---|
39 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
---|
40 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
---|
41 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
---|
42 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
43 | SOFTWARE.
|
---|
44 |
|
---|
45 | ******************************************************************/
|
---|
46 |
|
---|
47 | #ifndef SCREENINTSTRUCT_H
|
---|
48 | #define SCREENINTSTRUCT_H
|
---|
49 |
|
---|
50 | #include "screenint.h"
|
---|
51 | #include "regionstr.h"
|
---|
52 | #include "colormap.h"
|
---|
53 | #include "cursor.h"
|
---|
54 | #include "validate.h"
|
---|
55 | #include <X11/Xproto.h>
|
---|
56 | #include "dix.h"
|
---|
57 | #include "privates.h"
|
---|
58 | #include <X11/extensions/randr.h>
|
---|
59 |
|
---|
60 | typedef struct _PixmapFormat {
|
---|
61 | unsigned char depth;
|
---|
62 | unsigned char bitsPerPixel;
|
---|
63 | unsigned char scanlinePad;
|
---|
64 | } PixmapFormatRec;
|
---|
65 |
|
---|
66 | typedef struct _Visual {
|
---|
67 | VisualID vid;
|
---|
68 | short class;
|
---|
69 | short bitsPerRGBValue;
|
---|
70 | short ColormapEntries;
|
---|
71 | short nplanes; /* = log2 (ColormapEntries). This does not
|
---|
72 | * imply that the screen has this many planes.
|
---|
73 | * it may have more or fewer */
|
---|
74 | unsigned long redMask, greenMask, blueMask;
|
---|
75 | int offsetRed, offsetGreen, offsetBlue;
|
---|
76 | } VisualRec;
|
---|
77 |
|
---|
78 | typedef struct _Depth {
|
---|
79 | unsigned char depth;
|
---|
80 | short numVids;
|
---|
81 | VisualID *vids; /* block of visual ids for this depth */
|
---|
82 | } DepthRec;
|
---|
83 |
|
---|
84 | typedef struct _ScreenSaverStuff {
|
---|
85 | WindowPtr pWindow;
|
---|
86 | XID wid;
|
---|
87 | char blanked;
|
---|
88 | Bool (*ExternalScreenSaver) (ScreenPtr /*pScreen */ ,
|
---|
89 | int /*xstate */ ,
|
---|
90 | Bool /*force */ );
|
---|
91 | } ScreenSaverStuffRec;
|
---|
92 |
|
---|
93 | /*
|
---|
94 | * There is a typedef for each screen function pointer so that code that
|
---|
95 | * needs to declare a screen function pointer (e.g. in a screen private
|
---|
96 | * or as a local variable) can easily do so and retain full type checking.
|
---|
97 | */
|
---|
98 |
|
---|
99 | typedef Bool (*CloseScreenProcPtr) (ScreenPtr /*pScreen */ );
|
---|
100 |
|
---|
101 | typedef void (*QueryBestSizeProcPtr) (int /*class */ ,
|
---|
102 | unsigned short * /*pwidth */ ,
|
---|
103 | unsigned short * /*pheight */ ,
|
---|
104 | ScreenPtr /*pScreen */ );
|
---|
105 |
|
---|
106 | typedef Bool (*SaveScreenProcPtr) (ScreenPtr /*pScreen */ ,
|
---|
107 | int /*on */ );
|
---|
108 |
|
---|
109 | typedef void (*GetImageProcPtr) (DrawablePtr /*pDrawable */ ,
|
---|
110 | int /*sx */ ,
|
---|
111 | int /*sy */ ,
|
---|
112 | int /*w */ ,
|
---|
113 | int /*h */ ,
|
---|
114 | unsigned int /*format */ ,
|
---|
115 | unsigned long /*planeMask */ ,
|
---|
116 | char * /*pdstLine */ );
|
---|
117 |
|
---|
118 | typedef void (*GetSpansProcPtr) (DrawablePtr /*pDrawable */ ,
|
---|
119 | int /*wMax */ ,
|
---|
120 | DDXPointPtr /*ppt */ ,
|
---|
121 | int * /*pwidth */ ,
|
---|
122 | int /*nspans */ ,
|
---|
123 | char * /*pdstStart */ );
|
---|
124 |
|
---|
125 | typedef void (*SourceValidateProcPtr) (DrawablePtr /*pDrawable */ ,
|
---|
126 | int /*x */ ,
|
---|
127 | int /*y */ ,
|
---|
128 | int /*width */ ,
|
---|
129 | int /*height */ ,
|
---|
130 | unsigned int /*subWindowMode */ );
|
---|
131 |
|
---|
132 | typedef Bool (*CreateWindowProcPtr) (WindowPtr /*pWindow */ );
|
---|
133 |
|
---|
134 | typedef Bool (*DestroyWindowProcPtr) (WindowPtr /*pWindow */ );
|
---|
135 |
|
---|
136 | typedef Bool (*PositionWindowProcPtr) (WindowPtr /*pWindow */ ,
|
---|
137 | int /*x */ ,
|
---|
138 | int /*y */ );
|
---|
139 |
|
---|
140 | typedef Bool (*ChangeWindowAttributesProcPtr) (WindowPtr /*pWindow */ ,
|
---|
141 | unsigned long /*mask */ );
|
---|
142 |
|
---|
143 | typedef Bool (*RealizeWindowProcPtr) (WindowPtr /*pWindow */ );
|
---|
144 |
|
---|
145 | typedef Bool (*UnrealizeWindowProcPtr) (WindowPtr /*pWindow */ );
|
---|
146 |
|
---|
147 | typedef void (*RestackWindowProcPtr) (WindowPtr /*pWindow */ ,
|
---|
148 | WindowPtr /*pOldNextSib */ );
|
---|
149 |
|
---|
150 | typedef int (*ValidateTreeProcPtr) (WindowPtr /*pParent */ ,
|
---|
151 | WindowPtr /*pChild */ ,
|
---|
152 | VTKind /*kind */ );
|
---|
153 |
|
---|
154 | typedef void (*PostValidateTreeProcPtr) (WindowPtr /*pParent */ ,
|
---|
155 | WindowPtr /*pChild */ ,
|
---|
156 | VTKind /*kind */ );
|
---|
157 |
|
---|
158 | typedef void (*WindowExposuresProcPtr) (WindowPtr /*pWindow */ ,
|
---|
159 | RegionPtr /*prgn */);
|
---|
160 |
|
---|
161 | typedef void (*PaintWindowProcPtr) (WindowPtr /*pWindow*/,
|
---|
162 | RegionPtr /*pRegion*/,
|
---|
163 | int /*what*/);
|
---|
164 |
|
---|
165 | typedef void (*CopyWindowProcPtr) (WindowPtr /*pWindow */ ,
|
---|
166 | DDXPointRec /*ptOldOrg */ ,
|
---|
167 | RegionPtr /*prgnSrc */ );
|
---|
168 |
|
---|
169 | typedef void (*ClearToBackgroundProcPtr) (WindowPtr /*pWindow */ ,
|
---|
170 | int /*x */ ,
|
---|
171 | int /*y */ ,
|
---|
172 | int /*w */ ,
|
---|
173 | int /*h */ ,
|
---|
174 | Bool /*generateExposures */ );
|
---|
175 |
|
---|
176 | typedef void (*ClipNotifyProcPtr) (WindowPtr /*pWindow */ ,
|
---|
177 | int /*dx */ ,
|
---|
178 | int /*dy */ );
|
---|
179 |
|
---|
180 | /* pixmap will exist only for the duration of the current rendering operation */
|
---|
181 | #define CREATE_PIXMAP_USAGE_SCRATCH 1
|
---|
182 | /* pixmap will be the backing pixmap for a redirected window */
|
---|
183 | #define CREATE_PIXMAP_USAGE_BACKING_PIXMAP 2
|
---|
184 | /* pixmap will contain a glyph */
|
---|
185 | #define CREATE_PIXMAP_USAGE_GLYPH_PICTURE 3
|
---|
186 | /* pixmap will be shared */
|
---|
187 | #define CREATE_PIXMAP_USAGE_SHARED 4
|
---|
188 |
|
---|
189 | typedef PixmapPtr (*CreatePixmapProcPtr) (ScreenPtr /*pScreen */ ,
|
---|
190 | int /*width */ ,
|
---|
191 | int /*height */ ,
|
---|
192 | int /*depth */ ,
|
---|
193 | unsigned /*usage_hint */ );
|
---|
194 |
|
---|
195 | typedef Bool (*DestroyPixmapProcPtr) (PixmapPtr /*pPixmap */ );
|
---|
196 |
|
---|
197 | typedef Bool (*RealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
|
---|
198 | FontPtr /*pFont */ );
|
---|
199 |
|
---|
200 | typedef Bool (*UnrealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
|
---|
201 | FontPtr /*pFont */ );
|
---|
202 |
|
---|
203 | typedef void (*ConstrainCursorProcPtr) (DeviceIntPtr /*pDev */ ,
|
---|
204 | ScreenPtr /*pScreen */ ,
|
---|
205 | BoxPtr /*pBox */ );
|
---|
206 |
|
---|
207 | typedef void (*CursorLimitsProcPtr) (DeviceIntPtr /* pDev */ ,
|
---|
208 | ScreenPtr /*pScreen */ ,
|
---|
209 | CursorPtr /*pCursor */ ,
|
---|
210 | BoxPtr /*pHotBox */ ,
|
---|
211 | BoxPtr /*pTopLeftBox */ );
|
---|
212 |
|
---|
213 | typedef Bool (*DisplayCursorProcPtr) (DeviceIntPtr /* pDev */ ,
|
---|
214 | ScreenPtr /*pScreen */ ,
|
---|
215 | CursorPtr /*pCursor */ );
|
---|
216 |
|
---|
217 | typedef Bool (*RealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
|
---|
218 | ScreenPtr /*pScreen */ ,
|
---|
219 | CursorPtr /*pCursor */ );
|
---|
220 |
|
---|
221 | typedef Bool (*UnrealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
|
---|
222 | ScreenPtr /*pScreen */ ,
|
---|
223 | CursorPtr /*pCursor */ );
|
---|
224 |
|
---|
225 | typedef void (*RecolorCursorProcPtr) (DeviceIntPtr /* pDev */ ,
|
---|
226 | ScreenPtr /*pScreen */ ,
|
---|
227 | CursorPtr /*pCursor */ ,
|
---|
228 | Bool /*displayed */ );
|
---|
229 |
|
---|
230 | typedef Bool (*SetCursorPositionProcPtr) (DeviceIntPtr /* pDev */ ,
|
---|
231 | ScreenPtr /*pScreen */ ,
|
---|
232 | int /*x */ ,
|
---|
233 | int /*y */ ,
|
---|
234 | Bool /*generateEvent */ );
|
---|
235 |
|
---|
236 | typedef Bool (*CreateGCProcPtr) (GCPtr /*pGC */ );
|
---|
237 |
|
---|
238 | typedef Bool (*CreateColormapProcPtr) (ColormapPtr /*pColormap */ );
|
---|
239 |
|
---|
240 | typedef void (*DestroyColormapProcPtr) (ColormapPtr /*pColormap */ );
|
---|
241 |
|
---|
242 | typedef void (*InstallColormapProcPtr) (ColormapPtr /*pColormap */ );
|
---|
243 |
|
---|
244 | typedef void (*UninstallColormapProcPtr) (ColormapPtr /*pColormap */ );
|
---|
245 |
|
---|
246 | typedef int (*ListInstalledColormapsProcPtr) (ScreenPtr /*pScreen */ ,
|
---|
247 | XID * /*pmaps */ );
|
---|
248 |
|
---|
249 | typedef void (*StoreColorsProcPtr) (ColormapPtr /*pColormap */ ,
|
---|
250 | int /*ndef */ ,
|
---|
251 | xColorItem * /*pdef */ );
|
---|
252 |
|
---|
253 | typedef void (*ResolveColorProcPtr) (unsigned short * /*pred */ ,
|
---|
254 | unsigned short * /*pgreen */ ,
|
---|
255 | unsigned short * /*pblue */ ,
|
---|
256 | VisualPtr /*pVisual */ );
|
---|
257 |
|
---|
258 | typedef RegionPtr (*BitmapToRegionProcPtr) (PixmapPtr /*pPix */ );
|
---|
259 |
|
---|
260 | typedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr pScreen,
|
---|
261 | void *pTimeout,
|
---|
262 | void *pReadmask);
|
---|
263 |
|
---|
264 | typedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr pScreen,
|
---|
265 | unsigned long result,
|
---|
266 | void *pReadMask);
|
---|
267 |
|
---|
268 | typedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ );
|
---|
269 |
|
---|
270 | typedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr pPixmap,
|
---|
271 | int width,
|
---|
272 | int height,
|
---|
273 | int depth,
|
---|
274 | int bitsPerPixel,
|
---|
275 | int devKind,
|
---|
276 | void *pPixData);
|
---|
277 |
|
---|
278 | typedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ );
|
---|
279 |
|
---|
280 | typedef void (*SetWindowPixmapProcPtr) (WindowPtr /*pWin */ ,
|
---|
281 | PixmapPtr /*pPix */ );
|
---|
282 |
|
---|
283 | typedef PixmapPtr (*GetScreenPixmapProcPtr) (ScreenPtr /*pScreen */ );
|
---|
284 |
|
---|
285 | typedef void (*SetScreenPixmapProcPtr) (PixmapPtr /*pPix */ );
|
---|
286 |
|
---|
287 | typedef void (*MarkWindowProcPtr) (WindowPtr /*pWin */ );
|
---|
288 |
|
---|
289 | typedef Bool (*MarkOverlappedWindowsProcPtr) (WindowPtr /*parent */ ,
|
---|
290 | WindowPtr /*firstChild */ ,
|
---|
291 | WindowPtr * /*pLayerWin */ );
|
---|
292 |
|
---|
293 | typedef int (*ConfigNotifyProcPtr) (WindowPtr /*pWin */ ,
|
---|
294 | int /*x */ ,
|
---|
295 | int /*y */ ,
|
---|
296 | int /*w */ ,
|
---|
297 | int /*h */ ,
|
---|
298 | int /*bw */ ,
|
---|
299 | WindowPtr /*pSib */ );
|
---|
300 |
|
---|
301 | typedef void (*MoveWindowProcPtr) (WindowPtr /*pWin */ ,
|
---|
302 | int /*x */ ,
|
---|
303 | int /*y */ ,
|
---|
304 | WindowPtr /*pSib */ ,
|
---|
305 | VTKind /*kind */ );
|
---|
306 |
|
---|
307 | typedef void (*ResizeWindowProcPtr) (WindowPtr /*pWin */ ,
|
---|
308 | int /*x */ ,
|
---|
309 | int /*y */ ,
|
---|
310 | unsigned int /*w */ ,
|
---|
311 | unsigned int /*h */ ,
|
---|
312 | WindowPtr /*pSib */
|
---|
313 | );
|
---|
314 |
|
---|
315 | typedef WindowPtr (*GetLayerWindowProcPtr) (WindowPtr /*pWin */
|
---|
316 | );
|
---|
317 |
|
---|
318 | typedef void (*HandleExposuresProcPtr) (WindowPtr /*pWin */ );
|
---|
319 |
|
---|
320 | typedef void (*ReparentWindowProcPtr) (WindowPtr /*pWin */ ,
|
---|
321 | WindowPtr /*pPriorParent */ );
|
---|
322 |
|
---|
323 | typedef void (*SetShapeProcPtr) (WindowPtr /*pWin */ ,
|
---|
324 | int /* kind */ );
|
---|
325 |
|
---|
326 | typedef void (*ChangeBorderWidthProcPtr) (WindowPtr /*pWin */ ,
|
---|
327 | unsigned int /*width */ );
|
---|
328 |
|
---|
329 | typedef void (*MarkUnrealizedWindowProcPtr) (WindowPtr /*pChild */ ,
|
---|
330 | WindowPtr /*pWin */ ,
|
---|
331 | Bool /*fromConfigure */ );
|
---|
332 |
|
---|
333 | typedef Bool (*DeviceCursorInitializeProcPtr) (DeviceIntPtr /* pDev */ ,
|
---|
334 | ScreenPtr /* pScreen */ );
|
---|
335 |
|
---|
336 | typedef void (*DeviceCursorCleanupProcPtr) (DeviceIntPtr /* pDev */ ,
|
---|
337 | ScreenPtr /* pScreen */ );
|
---|
338 |
|
---|
339 | typedef void (*ConstrainCursorHarderProcPtr) (DeviceIntPtr, ScreenPtr, int,
|
---|
340 | int *, int *);
|
---|
341 |
|
---|
342 |
|
---|
343 | typedef Bool (*SharePixmapBackingProcPtr)(PixmapPtr, ScreenPtr, void **);
|
---|
344 |
|
---|
345 | typedef Bool (*SetSharedPixmapBackingProcPtr)(PixmapPtr, void *);
|
---|
346 |
|
---|
347 | typedef Bool (*StartPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr,
|
---|
348 | int x, int y,
|
---|
349 | int dst_x, int dst_y,
|
---|
350 | Rotation rotation);
|
---|
351 |
|
---|
352 | typedef Bool (*StopPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr);
|
---|
353 |
|
---|
354 | typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
|
---|
355 |
|
---|
356 | typedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen,
|
---|
357 | SpritePtr pSprite, int x, int y);
|
---|
358 |
|
---|
359 | typedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32);
|
---|
360 |
|
---|
361 | /* Wrapping Screen procedures
|
---|
362 |
|
---|
363 | There are a few modules in the X server which dynamically add and
|
---|
364 | remove themselves from various screen procedure call chains.
|
---|
365 |
|
---|
366 | For example, the BlockHandler is dynamically modified by:
|
---|
367 |
|
---|
368 | * xf86Rotate
|
---|
369 | * miSprite
|
---|
370 | * composite
|
---|
371 | * render (for animated cursors)
|
---|
372 |
|
---|
373 | Correctly manipulating this chain is complicated by the fact that
|
---|
374 | the chain is constructed through a sequence of screen private
|
---|
375 | structures, each holding the next screen->proc pointer.
|
---|
376 |
|
---|
377 | To add a module to a screen->proc chain is fairly simple; just save
|
---|
378 | the current screen->proc value in the module screen private
|
---|
379 | and store the module's function in the screen->proc location.
|
---|
380 |
|
---|
381 | Removing a screen proc is a bit trickier. It seems like all you
|
---|
382 | need to do is set the screen->proc pointer back to the value saved
|
---|
383 | in your screen private. However, if some other module has come
|
---|
384 | along and wrapped on top of you, then the right place to store the
|
---|
385 | previous screen->proc value is actually in the wrapping module's
|
---|
386 | screen private structure(!). Of course, you have no idea what
|
---|
387 | other module may have wrapped on top, nor could you poke inside
|
---|
388 | its screen private in any case.
|
---|
389 |
|
---|
390 | To make this work, we restrict the unwrapping process to happen
|
---|
391 | during the invocation of the screen proc itself, and then we
|
---|
392 | require the screen proc to take some care when manipulating the
|
---|
393 | screen proc functions pointers.
|
---|
394 |
|
---|
395 | The requirements are:
|
---|
396 |
|
---|
397 | 1) The screen proc must set the screen->proc pointer back to the
|
---|
398 | value saved in its screen private before calling outside its
|
---|
399 | module.
|
---|
400 |
|
---|
401 | 2a) If the screen proc wants to be remove itself from the chain,
|
---|
402 | it must not manipulate screen->proc pointer again before
|
---|
403 | returning.
|
---|
404 |
|
---|
405 | 2b) If the screen proc wants to remain in the chain, it must:
|
---|
406 |
|
---|
407 | 2b.1) Re-fetch the screen->proc pointer and store that in
|
---|
408 | its screen private. This ensures that any changes
|
---|
409 | to the chain will be preserved.
|
---|
410 |
|
---|
411 | 2b.2) Set screen->proc back to itself
|
---|
412 |
|
---|
413 | One key requirement here is that these steps must wrap not just
|
---|
414 | any invocation of the nested screen->proc value, but must nest
|
---|
415 | essentially any calls outside the current module. This ensures
|
---|
416 | that other modules can reliably manipulate screen->proc wrapping
|
---|
417 | using these same rules.
|
---|
418 |
|
---|
419 | For example, the animated cursor code in render has two macros,
|
---|
420 | Wrap and Unwrap.
|
---|
421 |
|
---|
422 | #define Unwrap(as,s,elt) ((s)->elt = (as)->elt)
|
---|
423 |
|
---|
424 | Unwrap takes the screen private (as), the screen (s) and the
|
---|
425 | member name (elt), and restores screen->proc to that saved in the
|
---|
426 | screen private.
|
---|
427 |
|
---|
428 | #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
|
---|
429 |
|
---|
430 | Wrap takes the screen private (as), the screen (s), the member
|
---|
431 | name (elt) and the wrapping function (func). It saves the
|
---|
432 | current screen->proc value in the screen private, and then sets the
|
---|
433 | screen->proc to the local wrapping function.
|
---|
434 |
|
---|
435 | Within each of these functions, there's a pretty simple pattern:
|
---|
436 |
|
---|
437 | Unwrap(as, pScreen, UnrealizeCursor);
|
---|
438 |
|
---|
439 | // Do local stuff, including possibly calling down through
|
---|
440 | // pScreen->UnrealizeCursor
|
---|
441 |
|
---|
442 | Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
|
---|
443 |
|
---|
444 | The wrapping block handler is a bit different; it does the Unwrap,
|
---|
445 | the local operations and then only re-Wraps if the hook is still
|
---|
446 | required. Unwrap occurrs at the top of each function, just after
|
---|
447 | entry, and Wrap occurrs at the bottom of each function, just
|
---|
448 | before returning.
|
---|
449 | */
|
---|
450 |
|
---|
451 | typedef struct _Screen {
|
---|
452 | int myNum; /* index of this instance in Screens[] */
|
---|
453 | ATOM id;
|
---|
454 | short x, y, width, height;
|
---|
455 | short mmWidth, mmHeight;
|
---|
456 | short numDepths;
|
---|
457 | unsigned char rootDepth;
|
---|
458 | DepthPtr allowedDepths;
|
---|
459 | unsigned long rootVisual;
|
---|
460 | unsigned long defColormap;
|
---|
461 | short minInstalledCmaps, maxInstalledCmaps;
|
---|
462 | char backingStoreSupport, saveUnderSupport;
|
---|
463 | unsigned long whitePixel, blackPixel;
|
---|
464 | GCPtr GCperDepth[MAXFORMATS + 1];
|
---|
465 | /* next field is a stipple to use as default in
|
---|
466 | a GC. we don't build default tiles of all depths
|
---|
467 | because they are likely to be of a color
|
---|
468 | different from the default fg pixel, so
|
---|
469 | we don't win anything by building
|
---|
470 | a standard one.
|
---|
471 | */
|
---|
472 | PixmapPtr PixmapPerDepth[1];
|
---|
473 | void *devPrivate;
|
---|
474 | short numVisuals;
|
---|
475 | VisualPtr visuals;
|
---|
476 | WindowPtr root;
|
---|
477 | ScreenSaverStuffRec screensaver;
|
---|
478 |
|
---|
479 | DevPrivateSetRec screenSpecificPrivates[PRIVATE_LAST];
|
---|
480 |
|
---|
481 | /* Random screen procedures */
|
---|
482 |
|
---|
483 | CloseScreenProcPtr CloseScreen;
|
---|
484 | QueryBestSizeProcPtr QueryBestSize;
|
---|
485 | SaveScreenProcPtr SaveScreen;
|
---|
486 | GetImageProcPtr GetImage;
|
---|
487 | GetSpansProcPtr GetSpans;
|
---|
488 | SourceValidateProcPtr SourceValidate;
|
---|
489 |
|
---|
490 | /* Window Procedures */
|
---|
491 |
|
---|
492 | CreateWindowProcPtr CreateWindow;
|
---|
493 | DestroyWindowProcPtr DestroyWindow;
|
---|
494 | PositionWindowProcPtr PositionWindow;
|
---|
495 | ChangeWindowAttributesProcPtr ChangeWindowAttributes;
|
---|
496 | RealizeWindowProcPtr RealizeWindow;
|
---|
497 | UnrealizeWindowProcPtr UnrealizeWindow;
|
---|
498 | ValidateTreeProcPtr ValidateTree;
|
---|
499 | PostValidateTreeProcPtr PostValidateTree;
|
---|
500 | WindowExposuresProcPtr WindowExposures;
|
---|
501 | CopyWindowProcPtr CopyWindow;
|
---|
502 | ClearToBackgroundProcPtr ClearToBackground;
|
---|
503 | ClipNotifyProcPtr ClipNotify;
|
---|
504 | RestackWindowProcPtr RestackWindow;
|
---|
505 | PaintWindowProcPtr PaintWindow;
|
---|
506 |
|
---|
507 | /* Pixmap procedures */
|
---|
508 |
|
---|
509 | CreatePixmapProcPtr CreatePixmap;
|
---|
510 | DestroyPixmapProcPtr DestroyPixmap;
|
---|
511 |
|
---|
512 | /* Font procedures */
|
---|
513 |
|
---|
514 | RealizeFontProcPtr RealizeFont;
|
---|
515 | UnrealizeFontProcPtr UnrealizeFont;
|
---|
516 |
|
---|
517 | /* Cursor Procedures */
|
---|
518 |
|
---|
519 | ConstrainCursorProcPtr ConstrainCursor;
|
---|
520 | ConstrainCursorHarderProcPtr ConstrainCursorHarder;
|
---|
521 | CursorLimitsProcPtr CursorLimits;
|
---|
522 | DisplayCursorProcPtr DisplayCursor;
|
---|
523 | RealizeCursorProcPtr RealizeCursor;
|
---|
524 | UnrealizeCursorProcPtr UnrealizeCursor;
|
---|
525 | RecolorCursorProcPtr RecolorCursor;
|
---|
526 | SetCursorPositionProcPtr SetCursorPosition;
|
---|
527 |
|
---|
528 | /* GC procedures */
|
---|
529 |
|
---|
530 | CreateGCProcPtr CreateGC;
|
---|
531 |
|
---|
532 | /* Colormap procedures */
|
---|
533 |
|
---|
534 | CreateColormapProcPtr CreateColormap;
|
---|
535 | DestroyColormapProcPtr DestroyColormap;
|
---|
536 | InstallColormapProcPtr InstallColormap;
|
---|
537 | UninstallColormapProcPtr UninstallColormap;
|
---|
538 | ListInstalledColormapsProcPtr ListInstalledColormaps;
|
---|
539 | StoreColorsProcPtr StoreColors;
|
---|
540 | ResolveColorProcPtr ResolveColor;
|
---|
541 |
|
---|
542 | /* Region procedures */
|
---|
543 |
|
---|
544 | BitmapToRegionProcPtr BitmapToRegion;
|
---|
545 |
|
---|
546 | /* os layer procedures */
|
---|
547 |
|
---|
548 | ScreenBlockHandlerProcPtr BlockHandler;
|
---|
549 | ScreenWakeupHandlerProcPtr WakeupHandler;
|
---|
550 |
|
---|
551 | /* anybody can get a piece of this array */
|
---|
552 | PrivateRec *devPrivates;
|
---|
553 |
|
---|
554 | CreateScreenResourcesProcPtr CreateScreenResources;
|
---|
555 | ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
|
---|
556 |
|
---|
557 | GetWindowPixmapProcPtr GetWindowPixmap;
|
---|
558 | SetWindowPixmapProcPtr SetWindowPixmap;
|
---|
559 | GetScreenPixmapProcPtr GetScreenPixmap;
|
---|
560 | SetScreenPixmapProcPtr SetScreenPixmap;
|
---|
561 | NameWindowPixmapProcPtr NameWindowPixmap;
|
---|
562 |
|
---|
563 | PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
|
---|
564 |
|
---|
565 | unsigned int totalPixmapSize;
|
---|
566 |
|
---|
567 | MarkWindowProcPtr MarkWindow;
|
---|
568 | MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
|
---|
569 | ConfigNotifyProcPtr ConfigNotify;
|
---|
570 | MoveWindowProcPtr MoveWindow;
|
---|
571 | ResizeWindowProcPtr ResizeWindow;
|
---|
572 | GetLayerWindowProcPtr GetLayerWindow;
|
---|
573 | HandleExposuresProcPtr HandleExposures;
|
---|
574 | ReparentWindowProcPtr ReparentWindow;
|
---|
575 |
|
---|
576 | SetShapeProcPtr SetShape;
|
---|
577 |
|
---|
578 | ChangeBorderWidthProcPtr ChangeBorderWidth;
|
---|
579 | MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
|
---|
580 |
|
---|
581 | /* Device cursor procedures */
|
---|
582 | DeviceCursorInitializeProcPtr DeviceCursorInitialize;
|
---|
583 | DeviceCursorCleanupProcPtr DeviceCursorCleanup;
|
---|
584 |
|
---|
585 | /* set it in driver side if X server can copy the framebuffer content.
|
---|
586 | * Meant to be used together with '-background none' option, avoiding
|
---|
587 | * malicious users to steal framebuffer's content if that would be the
|
---|
588 | * default */
|
---|
589 | Bool canDoBGNoneRoot;
|
---|
590 |
|
---|
591 | Bool isGPU;
|
---|
592 |
|
---|
593 | struct xorg_list unattached_list;
|
---|
594 | struct xorg_list unattached_head;
|
---|
595 |
|
---|
596 | ScreenPtr current_master;
|
---|
597 |
|
---|
598 | struct xorg_list output_slave_list;
|
---|
599 | struct xorg_list output_head;
|
---|
600 |
|
---|
601 | SharePixmapBackingProcPtr SharePixmapBacking;
|
---|
602 | SetSharedPixmapBackingProcPtr SetSharedPixmapBacking;
|
---|
603 |
|
---|
604 | StartPixmapTrackingProcPtr StartPixmapTracking;
|
---|
605 | StopPixmapTrackingProcPtr StopPixmapTracking;
|
---|
606 |
|
---|
607 | struct xorg_list pixmap_dirty_list;
|
---|
608 | struct xorg_list offload_slave_list;
|
---|
609 | struct xorg_list offload_head;
|
---|
610 |
|
---|
611 | ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
|
---|
612 | XYToWindowProcPtr XYToWindow;
|
---|
613 | } ScreenRec;
|
---|
614 |
|
---|
615 | static inline RegionPtr
|
---|
616 | BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix)
|
---|
617 | {
|
---|
618 | return (*(_pScreen)->BitmapToRegion) (pPix); /* no mi version?! */
|
---|
619 | }
|
---|
620 |
|
---|
621 | typedef struct _ScreenInfo {
|
---|
622 | int imageByteOrder;
|
---|
623 | int bitmapScanlineUnit;
|
---|
624 | int bitmapScanlinePad;
|
---|
625 | int bitmapBitOrder;
|
---|
626 | int numPixmapFormats;
|
---|
627 | PixmapFormatRec formats[MAXFORMATS];
|
---|
628 | int numScreens;
|
---|
629 | ScreenPtr screens[MAXSCREENS];
|
---|
630 | int numGPUScreens;
|
---|
631 | ScreenPtr gpuscreens[MAXGPUSCREENS];
|
---|
632 | int x; /* origin */
|
---|
633 | int y; /* origin */
|
---|
634 | int width; /* total width of all screens together */
|
---|
635 | int height; /* total height of all screens together */
|
---|
636 | } ScreenInfo;
|
---|
637 |
|
---|
638 | extern _X_EXPORT ScreenInfo screenInfo;
|
---|
639 |
|
---|
640 | extern _X_EXPORT void InitOutput(ScreenInfo * /*pScreenInfo */ ,
|
---|
641 | int /*argc */ ,
|
---|
642 | char ** /*argv */ );
|
---|
643 |
|
---|
644 | #endif /* SCREENINTSTRUCT_H */
|
---|