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
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.
25 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
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.
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
45 ******************************************************************/
47 #ifndef SCREENINTSTRUCT_H
48 #define SCREENINTSTRUCT_H
50 #include "screenint.h"
51 #include "regionstr.h"
55 #include <X11/Xproto.h>
59 typedef struct _PixmapFormat {
61 unsigned char bitsPerPixel;
62 unsigned char scanlinePad;
65 typedef struct _Visual {
68 short bitsPerRGBValue;
69 short ColormapEntries;
70 short nplanes; /* = log2 (ColormapEntries). This does not
71 * imply that the screen has this many planes.
72 * it may have more or fewer */
73 unsigned long redMask, greenMask, blueMask;
74 int offsetRed, offsetGreen, offsetBlue;
77 typedef struct _Depth {
80 VisualID *vids; /* block of visual ids for this depth */
83 typedef struct _ScreenSaverStuff {
87 Bool (*ExternalScreenSaver) (ScreenPtr /*pScreen */ ,
90 } ScreenSaverStuffRec;
93 * There is a typedef for each screen function pointer so that code that
94 * needs to declare a screen function pointer (e.g. in a screen private
95 * or as a local variable) can easily do so and retain full type checking.
98 typedef Bool (*CloseScreenProcPtr) (ScreenPtr /*pScreen */ );
100 typedef void (*QueryBestSizeProcPtr) (int /*class */ ,
101 unsigned short * /*pwidth */ ,
102 unsigned short * /*pheight */ ,
103 ScreenPtr /*pScreen */ );
105 typedef Bool (*SaveScreenProcPtr) (ScreenPtr /*pScreen */ ,
108 typedef void (*GetImageProcPtr) (DrawablePtr /*pDrawable */ ,
113 unsigned int /*format */ ,
114 unsigned long /*planeMask */ ,
115 char * /*pdstLine */ );
117 typedef void (*GetSpansProcPtr) (DrawablePtr /*pDrawable */ ,
119 DDXPointPtr /*ppt */ ,
122 char * /*pdstStart */ );
124 typedef void (*SourceValidateProcPtr) (DrawablePtr /*pDrawable */ ,
129 unsigned int /*subWindowMode */ );
131 typedef Bool (*CreateWindowProcPtr) (WindowPtr /*pWindow */ );
133 typedef Bool (*DestroyWindowProcPtr) (WindowPtr /*pWindow */ );
135 typedef Bool (*PositionWindowProcPtr) (WindowPtr /*pWindow */ ,
139 typedef Bool (*ChangeWindowAttributesProcPtr) (WindowPtr /*pWindow */ ,
140 unsigned long /*mask */ );
142 typedef Bool (*RealizeWindowProcPtr) (WindowPtr /*pWindow */ );
144 typedef Bool (*UnrealizeWindowProcPtr) (WindowPtr /*pWindow */ );
146 typedef void (*RestackWindowProcPtr) (WindowPtr /*pWindow */ ,
147 WindowPtr /*pOldNextSib */ );
149 typedef int (*ValidateTreeProcPtr) (WindowPtr /*pParent */ ,
150 WindowPtr /*pChild */ ,
153 typedef void (*PostValidateTreeProcPtr) (WindowPtr /*pParent */ ,
154 WindowPtr /*pChild */ ,
157 typedef void (*WindowExposuresProcPtr) (WindowPtr /*pWindow */ ,
158 RegionPtr /*prgn */ ,
159 RegionPtr /*other_exposed */ );
161 typedef void (*CopyWindowProcPtr) (WindowPtr /*pWindow */ ,
162 DDXPointRec /*ptOldOrg */ ,
163 RegionPtr /*prgnSrc */ );
165 typedef void (*ClearToBackgroundProcPtr) (WindowPtr /*pWindow */ ,
170 Bool /*generateExposures */ );
172 typedef void (*ClipNotifyProcPtr) (WindowPtr /*pWindow */ ,
176 /* pixmap will exist only for the duration of the current rendering operation */
177 #define CREATE_PIXMAP_USAGE_SCRATCH 1
178 /* pixmap will be the backing pixmap for a redirected window */
179 #define CREATE_PIXMAP_USAGE_BACKING_PIXMAP 2
180 /* pixmap will contain a glyph */
181 #define CREATE_PIXMAP_USAGE_GLYPH_PICTURE 3
182 /* pixmap will be shared */
183 #define CREATE_PIXMAP_USAGE_SHARED 4
184 /* _F_COMP_OVL_PATCH : pixmap will be the hw overlay pixmap */
185 #define CREATE_PIXMAP_USAGE_OVERLAY 5
187 typedef PixmapPtr (*CreatePixmapProcPtr) (ScreenPtr /*pScreen */ ,
191 unsigned /*usage_hint */ );
193 typedef Bool (*DestroyPixmapProcPtr) (PixmapPtr /*pPixmap */ );
195 typedef Bool (*RealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
196 FontPtr /*pFont */ );
198 typedef Bool (*UnrealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
199 FontPtr /*pFont */ );
201 typedef void (*ConstrainCursorProcPtr) (DeviceIntPtr /*pDev */ ,
202 ScreenPtr /*pScreen */ ,
205 typedef void (*CursorLimitsProcPtr) (DeviceIntPtr /* pDev */ ,
206 ScreenPtr /*pScreen */ ,
207 CursorPtr /*pCursor */ ,
208 BoxPtr /*pHotBox */ ,
209 BoxPtr /*pTopLeftBox */ );
211 typedef Bool (*DisplayCursorProcPtr) (DeviceIntPtr /* pDev */ ,
212 ScreenPtr /*pScreen */ ,
213 CursorPtr /*pCursor */ );
215 typedef Bool (*RealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
216 ScreenPtr /*pScreen */ ,
217 CursorPtr /*pCursor */ );
219 typedef Bool (*UnrealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
220 ScreenPtr /*pScreen */ ,
221 CursorPtr /*pCursor */ );
223 typedef void (*RecolorCursorProcPtr) (DeviceIntPtr /* pDev */ ,
224 ScreenPtr /*pScreen */ ,
225 CursorPtr /*pCursor */ ,
226 Bool /*displayed */ );
228 typedef Bool (*SetCursorPositionProcPtr) (DeviceIntPtr /* pDev */ ,
229 ScreenPtr /*pScreen */ ,
232 Bool /*generateEvent */ );
234 typedef Bool (*CreateGCProcPtr) (GCPtr /*pGC */ );
236 typedef Bool (*CreateColormapProcPtr) (ColormapPtr /*pColormap */ );
238 typedef void (*DestroyColormapProcPtr) (ColormapPtr /*pColormap */ );
240 typedef void (*InstallColormapProcPtr) (ColormapPtr /*pColormap */ );
242 typedef void (*UninstallColormapProcPtr) (ColormapPtr /*pColormap */ );
244 typedef int (*ListInstalledColormapsProcPtr) (ScreenPtr /*pScreen */ ,
247 typedef void (*StoreColorsProcPtr) (ColormapPtr /*pColormap */ ,
249 xColorItem * /*pdef */ );
251 typedef void (*ResolveColorProcPtr) (unsigned short * /*pred */ ,
252 unsigned short * /*pgreen */ ,
253 unsigned short * /*pblue */ ,
254 VisualPtr /*pVisual */ );
256 typedef RegionPtr (*BitmapToRegionProcPtr) (PixmapPtr /*pPix */ );
258 typedef void (*SendGraphicsExposeProcPtr) (ClientPtr /*client */ ,
259 RegionPtr /*pRgn */ ,
264 typedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr /*pScreen*/ ,
265 pointer /*pTimeout */ ,
266 pointer /*pReadmask */ );
268 typedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr /*pScreen*/ ,
269 unsigned long /*result */ ,
270 pointer /*pReadMask */ );
272 typedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ );
274 typedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr /*pPixmap */ ,
278 int /*bitsPerPixel */ ,
280 pointer /*pPixData */ );
282 typedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ );
284 typedef void (*SetWindowPixmapProcPtr) (WindowPtr /*pWin */ ,
285 PixmapPtr /*pPix */ );
287 typedef PixmapPtr (*GetScreenPixmapProcPtr) (ScreenPtr /*pScreen */ );
289 typedef void (*SetScreenPixmapProcPtr) (PixmapPtr /*pPix */ );
291 typedef void (*MarkWindowProcPtr) (WindowPtr /*pWin */ );
293 typedef Bool (*MarkOverlappedWindowsProcPtr) (WindowPtr /*parent */ ,
294 WindowPtr /*firstChild */ ,
295 WindowPtr * /*pLayerWin */ );
297 typedef int (*ConfigNotifyProcPtr) (WindowPtr /*pWin */ ,
303 WindowPtr /*pSib */ );
305 typedef void (*MoveWindowProcPtr) (WindowPtr /*pWin */ ,
308 WindowPtr /*pSib */ ,
311 typedef void (*ResizeWindowProcPtr) (WindowPtr /*pWin */ ,
314 unsigned int /*w */ ,
315 unsigned int /*h */ ,
319 typedef WindowPtr (*GetLayerWindowProcPtr) (WindowPtr /*pWin */
322 typedef void (*HandleExposuresProcPtr) (WindowPtr /*pWin */ );
324 typedef void (*ReparentWindowProcPtr) (WindowPtr /*pWin */ ,
325 WindowPtr /*pPriorParent */ );
327 typedef void (*SetShapeProcPtr) (WindowPtr /*pWin */ ,
330 typedef void (*ChangeBorderWidthProcPtr) (WindowPtr /*pWin */ ,
331 unsigned int /*width */ );
333 typedef void (*MarkUnrealizedWindowProcPtr) (WindowPtr /*pChild */ ,
334 WindowPtr /*pWin */ ,
335 Bool /*fromConfigure */ );
337 typedef Bool (*DeviceCursorInitializeProcPtr) (DeviceIntPtr /* pDev */ ,
338 ScreenPtr /* pScreen */ );
340 typedef void (*DeviceCursorCleanupProcPtr) (DeviceIntPtr /* pDev */ ,
341 ScreenPtr /* pScreen */ );
343 typedef void (*ConstrainCursorHarderProcPtr) (DeviceIntPtr, ScreenPtr, int,
347 typedef Bool (*SharePixmapBackingProcPtr)(PixmapPtr, ScreenPtr, void **);
349 typedef Bool (*SetSharedPixmapBackingProcPtr)(PixmapPtr, void *);
351 typedef Bool (*StartPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr,
354 typedef Bool (*StopPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr);
356 typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
358 typedef struct _Screen {
359 int myNum; /* index of this instance in Screens[] */
361 short x, y, width, height;
362 short mmWidth, mmHeight;
364 unsigned char rootDepth;
365 DepthPtr allowedDepths;
366 unsigned long rootVisual;
367 unsigned long defColormap;
368 short minInstalledCmaps, maxInstalledCmaps;
369 char backingStoreSupport, saveUnderSupport;
370 unsigned long whitePixel, blackPixel;
371 GCPtr GCperDepth[MAXFORMATS + 1];
372 /* next field is a stipple to use as default in
373 a GC. we don't build default tiles of all depths
374 because they are likely to be of a color
375 different from the default fg pixel, so
376 we don't win anything by building
379 PixmapPtr PixmapPerDepth[1];
384 ScreenSaverStuffRec screensaver;
386 DevPrivateSetRec screenSpecificPrivates[PRIVATE_LAST];
388 /* Random screen procedures */
390 CloseScreenProcPtr CloseScreen;
391 QueryBestSizeProcPtr QueryBestSize;
392 SaveScreenProcPtr SaveScreen;
393 GetImageProcPtr GetImage;
394 GetSpansProcPtr GetSpans;
395 SourceValidateProcPtr SourceValidate;
397 /* Window Procedures */
399 CreateWindowProcPtr CreateWindow;
400 DestroyWindowProcPtr DestroyWindow;
401 PositionWindowProcPtr PositionWindow;
402 ChangeWindowAttributesProcPtr ChangeWindowAttributes;
403 RealizeWindowProcPtr RealizeWindow;
404 UnrealizeWindowProcPtr UnrealizeWindow;
405 ValidateTreeProcPtr ValidateTree;
406 PostValidateTreeProcPtr PostValidateTree;
407 WindowExposuresProcPtr WindowExposures;
408 CopyWindowProcPtr CopyWindow;
409 ClearToBackgroundProcPtr ClearToBackground;
410 ClipNotifyProcPtr ClipNotify;
411 RestackWindowProcPtr RestackWindow;
413 /* Pixmap procedures */
415 CreatePixmapProcPtr CreatePixmap;
416 DestroyPixmapProcPtr DestroyPixmap;
418 /* Font procedures */
420 RealizeFontProcPtr RealizeFont;
421 UnrealizeFontProcPtr UnrealizeFont;
423 /* Cursor Procedures */
425 ConstrainCursorProcPtr ConstrainCursor;
426 ConstrainCursorHarderProcPtr ConstrainCursorHarder;
427 CursorLimitsProcPtr CursorLimits;
428 DisplayCursorProcPtr DisplayCursor;
429 RealizeCursorProcPtr RealizeCursor;
430 UnrealizeCursorProcPtr UnrealizeCursor;
431 RecolorCursorProcPtr RecolorCursor;
432 SetCursorPositionProcPtr SetCursorPosition;
436 CreateGCProcPtr CreateGC;
438 /* Colormap procedures */
440 CreateColormapProcPtr CreateColormap;
441 DestroyColormapProcPtr DestroyColormap;
442 InstallColormapProcPtr InstallColormap;
443 UninstallColormapProcPtr UninstallColormap;
444 ListInstalledColormapsProcPtr ListInstalledColormaps;
445 StoreColorsProcPtr StoreColors;
446 ResolveColorProcPtr ResolveColor;
448 /* Region procedures */
450 BitmapToRegionProcPtr BitmapToRegion;
451 SendGraphicsExposeProcPtr SendGraphicsExpose;
453 /* os layer procedures */
455 ScreenBlockHandlerProcPtr BlockHandler;
456 ScreenWakeupHandlerProcPtr WakeupHandler;
458 /* anybody can get a piece of this array */
459 PrivateRec *devPrivates;
461 CreateScreenResourcesProcPtr CreateScreenResources;
462 ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
464 GetWindowPixmapProcPtr GetWindowPixmap;
465 SetWindowPixmapProcPtr SetWindowPixmap;
466 GetScreenPixmapProcPtr GetScreenPixmap;
467 SetScreenPixmapProcPtr SetScreenPixmap;
469 PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
471 unsigned int totalPixmapSize;
473 MarkWindowProcPtr MarkWindow;
474 MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
475 ConfigNotifyProcPtr ConfigNotify;
476 MoveWindowProcPtr MoveWindow;
477 ResizeWindowProcPtr ResizeWindow;
478 GetLayerWindowProcPtr GetLayerWindow;
479 HandleExposuresProcPtr HandleExposures;
480 ReparentWindowProcPtr ReparentWindow;
482 SetShapeProcPtr SetShape;
484 ChangeBorderWidthProcPtr ChangeBorderWidth;
485 MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
487 /* Device cursor procedures */
488 DeviceCursorInitializeProcPtr DeviceCursorInitialize;
489 DeviceCursorCleanupProcPtr DeviceCursorCleanup;
491 /* set it in driver side if X server can copy the framebuffer content.
492 * Meant to be used together with '-background none' option, avoiding
493 * malicious users to steal framebuffer's content if that would be the
495 Bool canDoBGNoneRoot;
499 struct xorg_list unattached_list;
500 struct xorg_list unattached_head;
502 ScreenPtr current_master;
504 struct xorg_list output_slave_list;
505 struct xorg_list output_head;
507 SharePixmapBackingProcPtr SharePixmapBacking;
508 SetSharedPixmapBackingProcPtr SetSharedPixmapBacking;
510 StartPixmapTrackingProcPtr StartPixmapTracking;
511 StopPixmapTrackingProcPtr StopPixmapTracking;
513 struct xorg_list pixmap_dirty_list;
514 struct xorg_list offload_slave_list;
515 struct xorg_list offload_head;
517 ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
520 static inline RegionPtr
521 BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix)
523 return (*(_pScreen)->BitmapToRegion) (pPix); /* no mi version?! */
526 typedef struct _ScreenInfo {
528 int bitmapScanlineUnit;
529 int bitmapScanlinePad;
531 int numPixmapFormats;
532 PixmapFormatRec formats[MAXFORMATS];
534 ScreenPtr screens[MAXSCREENS];
536 ScreenPtr gpuscreens[MAXGPUSCREENS];
539 int width; /* total width of all screens together */
540 int height; /* total height of all screens together */
543 extern _X_EXPORT ScreenInfo screenInfo;
545 extern _X_EXPORT void InitOutput(ScreenInfo * /*pScreenInfo */ ,
549 #endif /* SCREENINTSTRUCT_H */