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
185 typedef PixmapPtr (*CreatePixmapProcPtr
) (ScreenPtr
/*pScreen */ ,
189 unsigned /*usage_hint */ );
191 typedef Bool (*DestroyPixmapProcPtr
) (PixmapPtr
/*pPixmap */ );
193 typedef Bool (*RealizeFontProcPtr
) (ScreenPtr
/*pScreen */ ,
194 FontPtr
/*pFont */ );
196 typedef Bool (*UnrealizeFontProcPtr
) (ScreenPtr
/*pScreen */ ,
197 FontPtr
/*pFont */ );
199 typedef void (*ConstrainCursorProcPtr
) (DeviceIntPtr
/*pDev */ ,
200 ScreenPtr
/*pScreen */ ,
203 typedef void (*CursorLimitsProcPtr
) (DeviceIntPtr
/* pDev */ ,
204 ScreenPtr
/*pScreen */ ,
205 CursorPtr
/*pCursor */ ,
206 BoxPtr
/*pHotBox */ ,
207 BoxPtr
/*pTopLeftBox */ );
209 typedef Bool (*DisplayCursorProcPtr
) (DeviceIntPtr
/* pDev */ ,
210 ScreenPtr
/*pScreen */ ,
211 CursorPtr
/*pCursor */ );
213 typedef Bool (*RealizeCursorProcPtr
) (DeviceIntPtr
/* pDev */ ,
214 ScreenPtr
/*pScreen */ ,
215 CursorPtr
/*pCursor */ );
217 typedef Bool (*UnrealizeCursorProcPtr
) (DeviceIntPtr
/* pDev */ ,
218 ScreenPtr
/*pScreen */ ,
219 CursorPtr
/*pCursor */ );
221 typedef void (*RecolorCursorProcPtr
) (DeviceIntPtr
/* pDev */ ,
222 ScreenPtr
/*pScreen */ ,
223 CursorPtr
/*pCursor */ ,
224 Bool
/*displayed */ );
226 typedef Bool (*SetCursorPositionProcPtr
) (DeviceIntPtr
/* pDev */ ,
227 ScreenPtr
/*pScreen */ ,
230 Bool
/*generateEvent */ );
232 typedef Bool (*CreateGCProcPtr
) (GCPtr
/*pGC */ );
234 typedef Bool (*CreateColormapProcPtr
) (ColormapPtr
/*pColormap */ );
236 typedef void (*DestroyColormapProcPtr
) (ColormapPtr
/*pColormap */ );
238 typedef void (*InstallColormapProcPtr
) (ColormapPtr
/*pColormap */ );
240 typedef void (*UninstallColormapProcPtr
) (ColormapPtr
/*pColormap */ );
242 typedef int (*ListInstalledColormapsProcPtr
) (ScreenPtr
/*pScreen */ ,
245 typedef void (*StoreColorsProcPtr
) (ColormapPtr
/*pColormap */ ,
247 xColorItem
* /*pdef */ );
249 typedef void (*ResolveColorProcPtr
) (unsigned short * /*pred */ ,
250 unsigned short * /*pgreen */ ,
251 unsigned short * /*pblue */ ,
252 VisualPtr
/*pVisual */ );
254 typedef RegionPtr (*BitmapToRegionProcPtr
) (PixmapPtr
/*pPix */ );
256 typedef void (*SendGraphicsExposeProcPtr
) (ClientPtr
/*client */ ,
257 RegionPtr
/*pRgn */ ,
262 typedef void (*ScreenBlockHandlerProcPtr
) (ScreenPtr
/*pScreen*/ ,
263 pointer
/*pTimeout */ ,
264 pointer
/*pReadmask */ );
266 typedef void (*ScreenWakeupHandlerProcPtr
) (ScreenPtr
/*pScreen*/ ,
267 unsigned long /*result */ ,
268 pointer
/*pReadMask */ );
270 typedef Bool (*CreateScreenResourcesProcPtr
) (ScreenPtr
/*pScreen */ );
272 typedef Bool (*ModifyPixmapHeaderProcPtr
) (PixmapPtr
/*pPixmap */ ,
276 int /*bitsPerPixel */ ,
278 pointer
/*pPixData */ );
280 typedef PixmapPtr (*GetWindowPixmapProcPtr
) (WindowPtr
/*pWin */ );
282 typedef void (*SetWindowPixmapProcPtr
) (WindowPtr
/*pWin */ ,
283 PixmapPtr
/*pPix */ );
285 typedef PixmapPtr (*GetScreenPixmapProcPtr
) (ScreenPtr
/*pScreen */ );
287 typedef void (*SetScreenPixmapProcPtr
) (PixmapPtr
/*pPix */ );
289 typedef void (*MarkWindowProcPtr
) (WindowPtr
/*pWin */ );
291 typedef Bool (*MarkOverlappedWindowsProcPtr
) (WindowPtr
/*parent */ ,
292 WindowPtr
/*firstChild */ ,
293 WindowPtr
* /*pLayerWin */ );
295 typedef int (*ConfigNotifyProcPtr
) (WindowPtr
/*pWin */ ,
301 WindowPtr
/*pSib */ );
303 typedef void (*MoveWindowProcPtr
) (WindowPtr
/*pWin */ ,
306 WindowPtr
/*pSib */ ,
309 typedef void (*ResizeWindowProcPtr
) (WindowPtr
/*pWin */ ,
312 unsigned int /*w */ ,
313 unsigned int /*h */ ,
317 typedef WindowPtr (*GetLayerWindowProcPtr
) (WindowPtr
/*pWin */
320 typedef void (*HandleExposuresProcPtr
) (WindowPtr
/*pWin */ );
322 typedef void (*ReparentWindowProcPtr
) (WindowPtr
/*pWin */ ,
323 WindowPtr
/*pPriorParent */ );
325 typedef void (*SetShapeProcPtr
) (WindowPtr
/*pWin */ ,
328 typedef void (*ChangeBorderWidthProcPtr
) (WindowPtr
/*pWin */ ,
329 unsigned int /*width */ );
331 typedef void (*MarkUnrealizedWindowProcPtr
) (WindowPtr
/*pChild */ ,
332 WindowPtr
/*pWin */ ,
333 Bool
/*fromConfigure */ );
335 typedef Bool (*DeviceCursorInitializeProcPtr
) (DeviceIntPtr
/* pDev */ ,
336 ScreenPtr
/* pScreen */ );
338 typedef void (*DeviceCursorCleanupProcPtr
) (DeviceIntPtr
/* pDev */ ,
339 ScreenPtr
/* pScreen */ );
341 typedef void (*ConstrainCursorHarderProcPtr
) (DeviceIntPtr
, ScreenPtr
, int,
345 typedef Bool (*SharePixmapBackingProcPtr
)(PixmapPtr
, ScreenPtr
, void **);
347 typedef Bool (*SetSharedPixmapBackingProcPtr
)(PixmapPtr
, void *);
349 typedef Bool (*StartPixmapTrackingProcPtr
)(PixmapPtr
, PixmapPtr
,
352 typedef Bool (*StopPixmapTrackingProcPtr
)(PixmapPtr
, PixmapPtr
);
354 typedef Bool (*ReplaceScanoutPixmapProcPtr
)(DrawablePtr
, PixmapPtr
, Bool
);
356 typedef struct _Screen
{
357 int myNum
; /* index of this instance in Screens[] */
359 short x
, y
, width
, height
;
360 short mmWidth
, mmHeight
;
362 unsigned char rootDepth
;
363 DepthPtr allowedDepths
;
364 unsigned long rootVisual
;
365 unsigned long defColormap
;
366 short minInstalledCmaps
, maxInstalledCmaps
;
367 char backingStoreSupport
, saveUnderSupport
;
368 unsigned long whitePixel
, blackPixel
;
369 GCPtr GCperDepth
[MAXFORMATS
+ 1];
370 /* next field is a stipple to use as default in
371 a GC. we don't build default tiles of all depths
372 because they are likely to be of a color
373 different from the default fg pixel, so
374 we don't win anything by building
377 PixmapPtr PixmapPerDepth
[1];
382 ScreenSaverStuffRec screensaver
;
384 DevPrivateSetRec screenSpecificPrivates
[PRIVATE_LAST
];
386 /* Random screen procedures */
388 CloseScreenProcPtr CloseScreen
;
389 QueryBestSizeProcPtr QueryBestSize
;
390 SaveScreenProcPtr SaveScreen
;
391 GetImageProcPtr GetImage
;
392 GetSpansProcPtr GetSpans
;
393 SourceValidateProcPtr SourceValidate
;
395 /* Window Procedures */
397 CreateWindowProcPtr CreateWindow
;
398 DestroyWindowProcPtr DestroyWindow
;
399 PositionWindowProcPtr PositionWindow
;
400 ChangeWindowAttributesProcPtr ChangeWindowAttributes
;
401 RealizeWindowProcPtr RealizeWindow
;
402 UnrealizeWindowProcPtr UnrealizeWindow
;
403 ValidateTreeProcPtr ValidateTree
;
404 PostValidateTreeProcPtr PostValidateTree
;
405 WindowExposuresProcPtr WindowExposures
;
406 CopyWindowProcPtr CopyWindow
;
407 ClearToBackgroundProcPtr ClearToBackground
;
408 ClipNotifyProcPtr ClipNotify
;
409 RestackWindowProcPtr RestackWindow
;
411 /* Pixmap procedures */
413 CreatePixmapProcPtr CreatePixmap
;
414 DestroyPixmapProcPtr DestroyPixmap
;
416 /* Font procedures */
418 RealizeFontProcPtr RealizeFont
;
419 UnrealizeFontProcPtr UnrealizeFont
;
421 /* Cursor Procedures */
423 ConstrainCursorProcPtr ConstrainCursor
;
424 ConstrainCursorHarderProcPtr ConstrainCursorHarder
;
425 CursorLimitsProcPtr CursorLimits
;
426 DisplayCursorProcPtr DisplayCursor
;
427 RealizeCursorProcPtr RealizeCursor
;
428 UnrealizeCursorProcPtr UnrealizeCursor
;
429 RecolorCursorProcPtr RecolorCursor
;
430 SetCursorPositionProcPtr SetCursorPosition
;
434 CreateGCProcPtr CreateGC
;
436 /* Colormap procedures */
438 CreateColormapProcPtr CreateColormap
;
439 DestroyColormapProcPtr DestroyColormap
;
440 InstallColormapProcPtr InstallColormap
;
441 UninstallColormapProcPtr UninstallColormap
;
442 ListInstalledColormapsProcPtr ListInstalledColormaps
;
443 StoreColorsProcPtr StoreColors
;
444 ResolveColorProcPtr ResolveColor
;
446 /* Region procedures */
448 BitmapToRegionProcPtr BitmapToRegion
;
449 SendGraphicsExposeProcPtr SendGraphicsExpose
;
451 /* os layer procedures */
453 ScreenBlockHandlerProcPtr BlockHandler
;
454 ScreenWakeupHandlerProcPtr WakeupHandler
;
456 /* anybody can get a piece of this array */
457 PrivateRec
*devPrivates
;
459 CreateScreenResourcesProcPtr CreateScreenResources
;
460 ModifyPixmapHeaderProcPtr ModifyPixmapHeader
;
462 GetWindowPixmapProcPtr GetWindowPixmap
;
463 SetWindowPixmapProcPtr SetWindowPixmap
;
464 GetScreenPixmapProcPtr GetScreenPixmap
;
465 SetScreenPixmapProcPtr SetScreenPixmap
;
467 PixmapPtr pScratchPixmap
; /* scratch pixmap "pool" */
469 unsigned int totalPixmapSize
;
471 MarkWindowProcPtr MarkWindow
;
472 MarkOverlappedWindowsProcPtr MarkOverlappedWindows
;
473 ConfigNotifyProcPtr ConfigNotify
;
474 MoveWindowProcPtr MoveWindow
;
475 ResizeWindowProcPtr ResizeWindow
;
476 GetLayerWindowProcPtr GetLayerWindow
;
477 HandleExposuresProcPtr HandleExposures
;
478 ReparentWindowProcPtr ReparentWindow
;
480 SetShapeProcPtr SetShape
;
482 ChangeBorderWidthProcPtr ChangeBorderWidth
;
483 MarkUnrealizedWindowProcPtr MarkUnrealizedWindow
;
485 /* Device cursor procedures */
486 DeviceCursorInitializeProcPtr DeviceCursorInitialize
;
487 DeviceCursorCleanupProcPtr DeviceCursorCleanup
;
489 /* set it in driver side if X server can copy the framebuffer content.
490 * Meant to be used together with '-background none' option, avoiding
491 * malicious users to steal framebuffer's content if that would be the
493 Bool canDoBGNoneRoot
;
497 struct xorg_list unattached_list
;
498 struct xorg_list unattached_head
;
500 ScreenPtr current_master
;
502 struct xorg_list output_slave_list
;
503 struct xorg_list output_head
;
505 SharePixmapBackingProcPtr SharePixmapBacking
;
506 SetSharedPixmapBackingProcPtr SetSharedPixmapBacking
;
508 StartPixmapTrackingProcPtr StartPixmapTracking
;
509 StopPixmapTrackingProcPtr StopPixmapTracking
;
511 struct xorg_list pixmap_dirty_list
;
512 struct xorg_list offload_slave_list
;
513 struct xorg_list offload_head
;
515 ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap
;
518 static inline RegionPtr
519 BitmapToRegion(ScreenPtr _pScreen
, PixmapPtr pPix
)
521 return (*(_pScreen
)->BitmapToRegion
) (pPix
); /* no mi version?! */
524 typedef struct _ScreenInfo
{
526 int bitmapScanlineUnit
;
527 int bitmapScanlinePad
;
529 int numPixmapFormats
;
530 PixmapFormatRec formats
[MAXFORMATS
];
532 ScreenPtr screens
[MAXSCREENS
];
534 ScreenPtr gpuscreens
[MAXGPUSCREENS
];
537 int width
; /* total width of all screens together */
538 int height
; /* total height of all screens together */
541 extern _X_EXPORT ScreenInfo screenInfo
;
543 extern _X_EXPORT
void InitOutput(ScreenInfo
* /*pScreenInfo */ ,
547 #endif /* SCREENINTSTRUCT_H */