1 /***********************************************************
3 Copyright 1987, 1998 The Open Group
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.
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
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.
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.
26 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
28 All Rights Reserved
30 Permission to use, copy, modify, and distribute this software and its
31 documentation for any purpose and without fee is hereby granted,
32 provided that the above copyright notice appear in all copies and that
33 both that copyright notice and this permission notice appear in
34 supporting documentation, and that the name of Digital not be
35 used in advertising or publicity pertaining to distribution of the
36 software without specific, written prior permission.
38 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44 SOFTWARE.
46 ******************************************************************/
48 #ifndef SCREENINTSTRUCT_H
49 #define SCREENINTSTRUCT_H
51 #include "screenint.h"
52 #include "regionstr.h"
53 #include "colormap.h"
54 #include "cursor.h"
55 #include "validate.h"
56 #include <X11/Xproto.h>
57 #include "dix.h"
58 #include "privates.h"
60 typedef struct _PixmapFormat {
61 unsigned char depth;
62 unsigned char bitsPerPixel;
63 unsigned char scanlinePad;
64 } PixmapFormatRec;
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;
78 typedef struct _Depth {
79 unsigned char depth;
80 short numVids;
81 VisualID *vids; /* block of visual ids for this depth */
82 } DepthRec;
84 typedef struct _ScreenSaverStuff {
85 WindowPtr pWindow;
86 XID wid;
87 char blanked;
88 Bool (*ExternalScreenSaver)(
89 ScreenPtr /*pScreen*/,
90 int /*xstate*/,
91 Bool /*force*/);
92 } ScreenSaverStuffRec;
95 /*
96 * There is a typedef for each screen function pointer so that code that
97 * needs to declare a screen function pointer (e.g. in a screen private
98 * or as a local variable) can easily do so and retain full type checking.
99 */
101 typedef Bool (* CloseScreenProcPtr)(
102 int /*index*/,
103 ScreenPtr /*pScreen*/);
105 typedef void (* QueryBestSizeProcPtr)(
106 int /*class*/,
107 unsigned short * /*pwidth*/,
108 unsigned short * /*pheight*/,
109 ScreenPtr /*pScreen*/);
111 typedef Bool (* SaveScreenProcPtr)(
112 ScreenPtr /*pScreen*/,
113 int /*on*/);
115 typedef void (* GetImageProcPtr)(
116 DrawablePtr /*pDrawable*/,
117 int /*sx*/,
118 int /*sy*/,
119 int /*w*/,
120 int /*h*/,
121 unsigned int /*format*/,
122 unsigned long /*planeMask*/,
123 char * /*pdstLine*/);
125 typedef void (* GetSpansProcPtr)(
126 DrawablePtr /*pDrawable*/,
127 int /*wMax*/,
128 DDXPointPtr /*ppt*/,
129 int* /*pwidth*/,
130 int /*nspans*/,
131 char * /*pdstStart*/);
133 typedef void (* SourceValidateProcPtr)(
134 DrawablePtr /*pDrawable*/,
135 int /*x*/,
136 int /*y*/,
137 int /*width*/,
138 int /*height*/,
139 unsigned int /*subWindowMode*/);
141 typedef Bool (* CreateWindowProcPtr)(
142 WindowPtr /*pWindow*/);
144 typedef Bool (* DestroyWindowProcPtr)(
145 WindowPtr /*pWindow*/);
147 typedef Bool (* PositionWindowProcPtr)(
148 WindowPtr /*pWindow*/,
149 int /*x*/,
150 int /*y*/);
152 typedef Bool (* ChangeWindowAttributesProcPtr)(
153 WindowPtr /*pWindow*/,
154 unsigned long /*mask*/);
156 typedef Bool (* RealizeWindowProcPtr)(
157 WindowPtr /*pWindow*/);
159 typedef Bool (* UnrealizeWindowProcPtr)(
160 WindowPtr /*pWindow*/);
162 typedef void (* RestackWindowProcPtr)(
163 WindowPtr /*pWindow*/,
164 WindowPtr /*pOldNextSib*/);
166 typedef int (* ValidateTreeProcPtr)(
167 WindowPtr /*pParent*/,
168 WindowPtr /*pChild*/,
169 VTKind /*kind*/);
171 typedef void (* PostValidateTreeProcPtr)(
172 WindowPtr /*pParent*/,
173 WindowPtr /*pChild*/,
174 VTKind /*kind*/);
176 typedef void (* WindowExposuresProcPtr)(
177 WindowPtr /*pWindow*/,
178 RegionPtr /*prgn*/,
179 RegionPtr /*other_exposed*/);
181 typedef void (* CopyWindowProcPtr)(
182 WindowPtr /*pWindow*/,
183 DDXPointRec /*ptOldOrg*/,
184 RegionPtr /*prgnSrc*/);
186 typedef void (* ClearToBackgroundProcPtr)(
187 WindowPtr /*pWindow*/,
188 int /*x*/,
189 int /*y*/,
190 int /*w*/,
191 int /*h*/,
192 Bool /*generateExposures*/);
194 typedef void (* ClipNotifyProcPtr)(
195 WindowPtr /*pWindow*/,
196 int /*dx*/,
197 int /*dy*/);
199 /* pixmap will exist only for the duration of the current rendering operation */
200 #define CREATE_PIXMAP_USAGE_SCRATCH 1
201 /* pixmap will be the backing pixmap for a redirected window */
202 #define CREATE_PIXMAP_USAGE_BACKING_PIXMAP 2
203 /* pixmap will contain a glyph */
204 #define CREATE_PIXMAP_USAGE_GLYPH_PICTURE 3
206 typedef PixmapPtr (* CreatePixmapProcPtr)(
207 ScreenPtr /*pScreen*/,
208 int /*width*/,
209 int /*height*/,
210 int /*depth*/,
211 unsigned /*usage_hint*/);
213 typedef Bool (* DestroyPixmapProcPtr)(
214 PixmapPtr /*pPixmap*/);
216 typedef Bool (* RealizeFontProcPtr)(
217 ScreenPtr /*pScreen*/,
218 FontPtr /*pFont*/);
220 typedef Bool (* UnrealizeFontProcPtr)(
221 ScreenPtr /*pScreen*/,
222 FontPtr /*pFont*/);
224 typedef void (* ConstrainCursorProcPtr)(
225 DeviceIntPtr /*pDev*/,
226 ScreenPtr /*pScreen*/,
227 BoxPtr /*pBox*/);
229 typedef void (* CursorLimitsProcPtr)(
230 DeviceIntPtr /* pDev */,
231 ScreenPtr /*pScreen*/,
232 CursorPtr /*pCursor*/,
233 BoxPtr /*pHotBox*/,
234 BoxPtr /*pTopLeftBox*/);
236 typedef Bool (* DisplayCursorProcPtr)(
237 DeviceIntPtr /* pDev */,
238 ScreenPtr /*pScreen*/,
239 CursorPtr /*pCursor*/);
241 typedef Bool (* RealizeCursorProcPtr)(
242 DeviceIntPtr /* pDev */,
243 ScreenPtr /*pScreen*/,
244 CursorPtr /*pCursor*/);
246 typedef Bool (* UnrealizeCursorProcPtr)(
247 DeviceIntPtr /* pDev */,
248 ScreenPtr /*pScreen*/,
249 CursorPtr /*pCursor*/);
251 typedef void (* RecolorCursorProcPtr)(
252 DeviceIntPtr /* pDev */,
253 ScreenPtr /*pScreen*/,
254 CursorPtr /*pCursor*/,
255 Bool /*displayed*/);
257 typedef Bool (* SetCursorPositionProcPtr)(
258 DeviceIntPtr /* pDev */,
259 ScreenPtr /*pScreen*/,
260 int /*x*/,
261 int /*y*/,
262 Bool /*generateEvent*/);
264 typedef Bool (* CreateGCProcPtr)(
265 GCPtr /*pGC*/);
267 typedef Bool (* CreateColormapProcPtr)(
268 ColormapPtr /*pColormap*/);
270 typedef void (* DestroyColormapProcPtr)(
271 ColormapPtr /*pColormap*/);
273 typedef void (* InstallColormapProcPtr)(
274 ColormapPtr /*pColormap*/);
276 typedef void (* UninstallColormapProcPtr)(
277 ColormapPtr /*pColormap*/);
279 typedef int (* ListInstalledColormapsProcPtr) (
280 ScreenPtr /*pScreen*/,
281 XID* /*pmaps */);
283 typedef void (* StoreColorsProcPtr)(
284 ColormapPtr /*pColormap*/,
285 int /*ndef*/,
286 xColorItem * /*pdef*/);
288 typedef void (* ResolveColorProcPtr)(
289 unsigned short* /*pred*/,
290 unsigned short* /*pgreen*/,
291 unsigned short* /*pblue*/,
292 VisualPtr /*pVisual*/);
294 typedef RegionPtr (* BitmapToRegionProcPtr)(
295 PixmapPtr /*pPix*/);
297 typedef void (* SendGraphicsExposeProcPtr)(
298 ClientPtr /*client*/,
299 RegionPtr /*pRgn*/,
300 XID /*drawable*/,
301 int /*major*/,
302 int /*minor*/);
304 typedef void (* ScreenBlockHandlerProcPtr)(
305 int /*screenNum*/,
306 pointer /*blockData*/,
307 pointer /*pTimeout*/,
308 pointer /*pReadmask*/);
310 typedef void (* ScreenWakeupHandlerProcPtr)(
311 int /*screenNum*/,
312 pointer /*wakeupData*/,
313 unsigned long /*result*/,
314 pointer /*pReadMask*/);
316 typedef Bool (* CreateScreenResourcesProcPtr)(
317 ScreenPtr /*pScreen*/);
319 typedef Bool (* ModifyPixmapHeaderProcPtr)(
320 PixmapPtr /*pPixmap*/,
321 int /*width*/,
322 int /*height*/,
323 int /*depth*/,
324 int /*bitsPerPixel*/,
325 int /*devKind*/,
326 pointer /*pPixData*/);
328 typedef PixmapPtr (* GetWindowPixmapProcPtr)(
329 WindowPtr /*pWin*/);
331 typedef void (* SetWindowPixmapProcPtr)(
332 WindowPtr /*pWin*/,
333 PixmapPtr /*pPix*/);
335 typedef PixmapPtr (* GetScreenPixmapProcPtr)(
336 ScreenPtr /*pScreen*/);
338 typedef void (* SetScreenPixmapProcPtr)(
339 PixmapPtr /*pPix*/);
341 typedef void (* MarkWindowProcPtr)(
342 WindowPtr /*pWin*/);
344 typedef Bool (* MarkOverlappedWindowsProcPtr)(
345 WindowPtr /*parent*/,
346 WindowPtr /*firstChild*/,
347 WindowPtr * /*pLayerWin*/);
349 typedef int (* ConfigNotifyProcPtr)(
350 WindowPtr /*pWin*/,
351 int /*x*/,
352 int /*y*/,
353 int /*w*/,
354 int /*h*/,
355 int /*bw*/,
356 WindowPtr /*pSib*/);
358 typedef void (* MoveWindowProcPtr)(
359 WindowPtr /*pWin*/,
360 int /*x*/,
361 int /*y*/,
362 WindowPtr /*pSib*/,
363 VTKind /*kind*/);
365 typedef void (* ResizeWindowProcPtr)(
366 WindowPtr /*pWin*/,
367 int /*x*/,
368 int /*y*/,
369 unsigned int /*w*/,
370 unsigned int /*h*/,
371 WindowPtr /*pSib*/
372 );
374 typedef WindowPtr (* GetLayerWindowProcPtr)(
375 WindowPtr /*pWin*/
376 );
378 typedef void (* HandleExposuresProcPtr)(
379 WindowPtr /*pWin*/);
381 typedef void (* ReparentWindowProcPtr)(
382 WindowPtr /*pWin*/,
383 WindowPtr /*pPriorParent*/);
385 typedef void (* SetShapeProcPtr)(
386 WindowPtr /*pWin*/,
387 int /* kind */);
389 typedef void (* ChangeBorderWidthProcPtr)(
390 WindowPtr /*pWin*/,
391 unsigned int /*width*/);
393 typedef void (* MarkUnrealizedWindowProcPtr)(
394 WindowPtr /*pChild*/,
395 WindowPtr /*pWin*/,
396 Bool /*fromConfigure*/);
398 typedef Bool (* DeviceCursorInitializeProcPtr)(
399 DeviceIntPtr /* pDev */,
400 ScreenPtr /* pScreen */);
402 typedef void (* DeviceCursorCleanupProcPtr)(
403 DeviceIntPtr /* pDev */,
404 ScreenPtr /* pScreen */);
406 typedef void (*ConstrainCursorHarderProcPtr)(
407 DeviceIntPtr, ScreenPtr, int, int *, int *);
409 typedef struct _Screen {
410 int myNum; /* index of this instance in Screens[] */
411 ATOM id;
412 short x, y, width, height;
413 short mmWidth, mmHeight;
414 short numDepths;
415 unsigned char rootDepth;
416 DepthPtr allowedDepths;
417 unsigned long rootVisual;
418 unsigned long defColormap;
419 short minInstalledCmaps, maxInstalledCmaps;
420 char backingStoreSupport, saveUnderSupport;
421 unsigned long whitePixel, blackPixel;
422 GCPtr GCperDepth[MAXFORMATS+1];
423 /* next field is a stipple to use as default in
424 a GC. we don't build default tiles of all depths
425 because they are likely to be of a color
426 different from the default fg pixel, so
427 we don't win anything by building
428 a standard one.
429 */
430 PixmapPtr PixmapPerDepth[1];
431 pointer devPrivate;
432 short numVisuals;
433 VisualPtr visuals;
434 WindowPtr root;
435 ScreenSaverStuffRec screensaver;
437 /* Random screen procedures */
439 CloseScreenProcPtr CloseScreen;
440 QueryBestSizeProcPtr QueryBestSize;
441 SaveScreenProcPtr SaveScreen;
442 GetImageProcPtr GetImage;
443 GetSpansProcPtr GetSpans;
444 SourceValidateProcPtr SourceValidate;
446 /* Window Procedures */
448 CreateWindowProcPtr CreateWindow;
449 DestroyWindowProcPtr DestroyWindow;
450 PositionWindowProcPtr PositionWindow;
451 ChangeWindowAttributesProcPtr ChangeWindowAttributes;
452 RealizeWindowProcPtr RealizeWindow;
453 UnrealizeWindowProcPtr UnrealizeWindow;
454 ValidateTreeProcPtr ValidateTree;
455 PostValidateTreeProcPtr PostValidateTree;
456 WindowExposuresProcPtr WindowExposures;
457 CopyWindowProcPtr CopyWindow;
458 ClearToBackgroundProcPtr ClearToBackground;
459 ClipNotifyProcPtr ClipNotify;
460 RestackWindowProcPtr RestackWindow;
462 /* Pixmap procedures */
464 CreatePixmapProcPtr CreatePixmap;
465 DestroyPixmapProcPtr DestroyPixmap;
467 /* Font procedures */
469 RealizeFontProcPtr RealizeFont;
470 UnrealizeFontProcPtr UnrealizeFont;
472 /* Cursor Procedures */
474 ConstrainCursorProcPtr ConstrainCursor;
475 ConstrainCursorHarderProcPtr ConstrainCursorHarder;
476 CursorLimitsProcPtr CursorLimits;
477 DisplayCursorProcPtr DisplayCursor;
478 RealizeCursorProcPtr RealizeCursor;
479 UnrealizeCursorProcPtr UnrealizeCursor;
480 RecolorCursorProcPtr RecolorCursor;
481 SetCursorPositionProcPtr SetCursorPosition;
483 /* GC procedures */
485 CreateGCProcPtr CreateGC;
487 /* Colormap procedures */
489 CreateColormapProcPtr CreateColormap;
490 DestroyColormapProcPtr DestroyColormap;
491 InstallColormapProcPtr InstallColormap;
492 UninstallColormapProcPtr UninstallColormap;
493 ListInstalledColormapsProcPtr ListInstalledColormaps;
494 StoreColorsProcPtr StoreColors;
495 ResolveColorProcPtr ResolveColor;
497 /* Region procedures */
499 BitmapToRegionProcPtr BitmapToRegion;
500 SendGraphicsExposeProcPtr SendGraphicsExpose;
502 /* os layer procedures */
504 ScreenBlockHandlerProcPtr BlockHandler;
505 ScreenWakeupHandlerProcPtr WakeupHandler;
507 pointer blockData;
508 pointer wakeupData;
510 /* anybody can get a piece of this array */
511 PrivateRec *devPrivates;
513 CreateScreenResourcesProcPtr CreateScreenResources;
514 ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
516 GetWindowPixmapProcPtr GetWindowPixmap;
517 SetWindowPixmapProcPtr SetWindowPixmap;
518 GetScreenPixmapProcPtr GetScreenPixmap;
519 SetScreenPixmapProcPtr SetScreenPixmap;
521 PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
523 unsigned int totalPixmapSize;
525 MarkWindowProcPtr MarkWindow;
526 MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
527 ConfigNotifyProcPtr ConfigNotify;
528 MoveWindowProcPtr MoveWindow;
529 ResizeWindowProcPtr ResizeWindow;
530 GetLayerWindowProcPtr GetLayerWindow;
531 HandleExposuresProcPtr HandleExposures;
532 ReparentWindowProcPtr ReparentWindow;
534 SetShapeProcPtr SetShape;
536 ChangeBorderWidthProcPtr ChangeBorderWidth;
537 MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
539 /* Device cursor procedures */
540 DeviceCursorInitializeProcPtr DeviceCursorInitialize;
541 DeviceCursorCleanupProcPtr DeviceCursorCleanup;
543 /* set it in driver side if X server can copy the framebuffer content.
544 * Meant to be used together with '-background none' option, avoiding
545 * malicious users to steal framebuffer's content if that would be the
546 * default */
547 Bool canDoBGNoneRoot;
548 } ScreenRec;
550 static inline RegionPtr BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix) {
551 return (*(_pScreen)->BitmapToRegion)(pPix); /* no mi version?! */
552 }
554 typedef struct _ScreenInfo {
555 int imageByteOrder;
556 int bitmapScanlineUnit;
557 int bitmapScanlinePad;
558 int bitmapBitOrder;
559 int numPixmapFormats;
560 PixmapFormatRec
561 formats[MAXFORMATS];
562 int numScreens;
563 ScreenPtr screens[MAXSCREENS];
564 int x; /* origin */
565 int y; /* origin */
566 int width; /* total width of all screens together */
567 int height; /* total height of all screens together */
568 } ScreenInfo;
570 extern _X_EXPORT ScreenInfo screenInfo;
572 extern _X_EXPORT void InitOutput(
573 ScreenInfo * /*pScreenInfo*/,
574 int /*argc*/,
575 char ** /*argv*/);
577 #endif /* SCREENINTSTRUCT_H */