Imported Upstream version 1.15.1
[deb_xorg-server.git] / include / scrnintstr.h
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
59 typedef struct _PixmapFormat {
60 unsigned char depth;
61 unsigned char bitsPerPixel;
62 unsigned char scanlinePad;
63 } PixmapFormatRec;
64
65 typedef struct _Visual {
66 VisualID vid;
67 short class;
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;
75 } VisualRec;
76
77 typedef struct _Depth {
78 unsigned char depth;
79 short numVids;
80 VisualID *vids; /* block of visual ids for this depth */
81 } DepthRec;
82
83 typedef struct _ScreenSaverStuff {
84 WindowPtr pWindow;
85 XID wid;
86 char blanked;
87 Bool (*ExternalScreenSaver) (ScreenPtr /*pScreen */ ,
88 int /*xstate */ ,
89 Bool /*force */ );
90 } ScreenSaverStuffRec;
91
92 /*
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.
96 */
97
98 typedef Bool (*CloseScreenProcPtr) (ScreenPtr /*pScreen */ );
99
100 typedef void (*QueryBestSizeProcPtr) (int /*class */ ,
101 unsigned short * /*pwidth */ ,
102 unsigned short * /*pheight */ ,
103 ScreenPtr /*pScreen */ );
104
105 typedef Bool (*SaveScreenProcPtr) (ScreenPtr /*pScreen */ ,
106 int /*on */ );
107
108 typedef void (*GetImageProcPtr) (DrawablePtr /*pDrawable */ ,
109 int /*sx */ ,
110 int /*sy */ ,
111 int /*w */ ,
112 int /*h */ ,
113 unsigned int /*format */ ,
114 unsigned long /*planeMask */ ,
115 char * /*pdstLine */ );
116
117 typedef void (*GetSpansProcPtr) (DrawablePtr /*pDrawable */ ,
118 int /*wMax */ ,
119 DDXPointPtr /*ppt */ ,
120 int * /*pwidth */ ,
121 int /*nspans */ ,
122 char * /*pdstStart */ );
123
124 typedef void (*SourceValidateProcPtr) (DrawablePtr /*pDrawable */ ,
125 int /*x */ ,
126 int /*y */ ,
127 int /*width */ ,
128 int /*height */ ,
129 unsigned int /*subWindowMode */ );
130
131 typedef Bool (*CreateWindowProcPtr) (WindowPtr /*pWindow */ );
132
133 typedef Bool (*DestroyWindowProcPtr) (WindowPtr /*pWindow */ );
134
135 typedef Bool (*PositionWindowProcPtr) (WindowPtr /*pWindow */ ,
136 int /*x */ ,
137 int /*y */ );
138
139 typedef Bool (*ChangeWindowAttributesProcPtr) (WindowPtr /*pWindow */ ,
140 unsigned long /*mask */ );
141
142 typedef Bool (*RealizeWindowProcPtr) (WindowPtr /*pWindow */ );
143
144 typedef Bool (*UnrealizeWindowProcPtr) (WindowPtr /*pWindow */ );
145
146 typedef void (*RestackWindowProcPtr) (WindowPtr /*pWindow */ ,
147 WindowPtr /*pOldNextSib */ );
148
149 typedef int (*ValidateTreeProcPtr) (WindowPtr /*pParent */ ,
150 WindowPtr /*pChild */ ,
151 VTKind /*kind */ );
152
153 typedef void (*PostValidateTreeProcPtr) (WindowPtr /*pParent */ ,
154 WindowPtr /*pChild */ ,
155 VTKind /*kind */ );
156
157 typedef void (*WindowExposuresProcPtr) (WindowPtr /*pWindow */ ,
158 RegionPtr /*prgn */ ,
159 RegionPtr /*other_exposed */ );
160
161 typedef void (*CopyWindowProcPtr) (WindowPtr /*pWindow */ ,
162 DDXPointRec /*ptOldOrg */ ,
163 RegionPtr /*prgnSrc */ );
164
165 typedef void (*ClearToBackgroundProcPtr) (WindowPtr /*pWindow */ ,
166 int /*x */ ,
167 int /*y */ ,
168 int /*w */ ,
169 int /*h */ ,
170 Bool /*generateExposures */ );
171
172 typedef void (*ClipNotifyProcPtr) (WindowPtr /*pWindow */ ,
173 int /*dx */ ,
174 int /*dy */ );
175
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
185 typedef PixmapPtr (*CreatePixmapProcPtr) (ScreenPtr /*pScreen */ ,
186 int /*width */ ,
187 int /*height */ ,
188 int /*depth */ ,
189 unsigned /*usage_hint */ );
190
191 typedef Bool (*DestroyPixmapProcPtr) (PixmapPtr /*pPixmap */ );
192
193 typedef Bool (*RealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
194 FontPtr /*pFont */ );
195
196 typedef Bool (*UnrealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
197 FontPtr /*pFont */ );
198
199 typedef void (*ConstrainCursorProcPtr) (DeviceIntPtr /*pDev */ ,
200 ScreenPtr /*pScreen */ ,
201 BoxPtr /*pBox */ );
202
203 typedef void (*CursorLimitsProcPtr) (DeviceIntPtr /* pDev */ ,
204 ScreenPtr /*pScreen */ ,
205 CursorPtr /*pCursor */ ,
206 BoxPtr /*pHotBox */ ,
207 BoxPtr /*pTopLeftBox */ );
208
209 typedef Bool (*DisplayCursorProcPtr) (DeviceIntPtr /* pDev */ ,
210 ScreenPtr /*pScreen */ ,
211 CursorPtr /*pCursor */ );
212
213 typedef Bool (*RealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
214 ScreenPtr /*pScreen */ ,
215 CursorPtr /*pCursor */ );
216
217 typedef Bool (*UnrealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
218 ScreenPtr /*pScreen */ ,
219 CursorPtr /*pCursor */ );
220
221 typedef void (*RecolorCursorProcPtr) (DeviceIntPtr /* pDev */ ,
222 ScreenPtr /*pScreen */ ,
223 CursorPtr /*pCursor */ ,
224 Bool /*displayed */ );
225
226 typedef Bool (*SetCursorPositionProcPtr) (DeviceIntPtr /* pDev */ ,
227 ScreenPtr /*pScreen */ ,
228 int /*x */ ,
229 int /*y */ ,
230 Bool /*generateEvent */ );
231
232 typedef Bool (*CreateGCProcPtr) (GCPtr /*pGC */ );
233
234 typedef Bool (*CreateColormapProcPtr) (ColormapPtr /*pColormap */ );
235
236 typedef void (*DestroyColormapProcPtr) (ColormapPtr /*pColormap */ );
237
238 typedef void (*InstallColormapProcPtr) (ColormapPtr /*pColormap */ );
239
240 typedef void (*UninstallColormapProcPtr) (ColormapPtr /*pColormap */ );
241
242 typedef int (*ListInstalledColormapsProcPtr) (ScreenPtr /*pScreen */ ,
243 XID * /*pmaps */ );
244
245 typedef void (*StoreColorsProcPtr) (ColormapPtr /*pColormap */ ,
246 int /*ndef */ ,
247 xColorItem * /*pdef */ );
248
249 typedef void (*ResolveColorProcPtr) (unsigned short * /*pred */ ,
250 unsigned short * /*pgreen */ ,
251 unsigned short * /*pblue */ ,
252 VisualPtr /*pVisual */ );
253
254 typedef RegionPtr (*BitmapToRegionProcPtr) (PixmapPtr /*pPix */ );
255
256 typedef void (*SendGraphicsExposeProcPtr) (ClientPtr /*client */ ,
257 RegionPtr /*pRgn */ ,
258 XID /*drawable */ ,
259 int /*major */ ,
260 int /*minor */ );
261
262 typedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr /*pScreen*/ ,
263 pointer /*pTimeout */ ,
264 pointer /*pReadmask */ );
265
266 typedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr /*pScreen*/ ,
267 unsigned long /*result */ ,
268 pointer /*pReadMask */ );
269
270 typedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ );
271
272 typedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr /*pPixmap */ ,
273 int /*width */ ,
274 int /*height */ ,
275 int /*depth */ ,
276 int /*bitsPerPixel */ ,
277 int /*devKind */ ,
278 pointer /*pPixData */ );
279
280 typedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ );
281
282 typedef void (*SetWindowPixmapProcPtr) (WindowPtr /*pWin */ ,
283 PixmapPtr /*pPix */ );
284
285 typedef PixmapPtr (*GetScreenPixmapProcPtr) (ScreenPtr /*pScreen */ );
286
287 typedef void (*SetScreenPixmapProcPtr) (PixmapPtr /*pPix */ );
288
289 typedef void (*MarkWindowProcPtr) (WindowPtr /*pWin */ );
290
291 typedef Bool (*MarkOverlappedWindowsProcPtr) (WindowPtr /*parent */ ,
292 WindowPtr /*firstChild */ ,
293 WindowPtr * /*pLayerWin */ );
294
295 typedef int (*ConfigNotifyProcPtr) (WindowPtr /*pWin */ ,
296 int /*x */ ,
297 int /*y */ ,
298 int /*w */ ,
299 int /*h */ ,
300 int /*bw */ ,
301 WindowPtr /*pSib */ );
302
303 typedef void (*MoveWindowProcPtr) (WindowPtr /*pWin */ ,
304 int /*x */ ,
305 int /*y */ ,
306 WindowPtr /*pSib */ ,
307 VTKind /*kind */ );
308
309 typedef void (*ResizeWindowProcPtr) (WindowPtr /*pWin */ ,
310 int /*x */ ,
311 int /*y */ ,
312 unsigned int /*w */ ,
313 unsigned int /*h */ ,
314 WindowPtr /*pSib */
315 );
316
317 typedef WindowPtr (*GetLayerWindowProcPtr) (WindowPtr /*pWin */
318 );
319
320 typedef void (*HandleExposuresProcPtr) (WindowPtr /*pWin */ );
321
322 typedef void (*ReparentWindowProcPtr) (WindowPtr /*pWin */ ,
323 WindowPtr /*pPriorParent */ );
324
325 typedef void (*SetShapeProcPtr) (WindowPtr /*pWin */ ,
326 int /* kind */ );
327
328 typedef void (*ChangeBorderWidthProcPtr) (WindowPtr /*pWin */ ,
329 unsigned int /*width */ );
330
331 typedef void (*MarkUnrealizedWindowProcPtr) (WindowPtr /*pChild */ ,
332 WindowPtr /*pWin */ ,
333 Bool /*fromConfigure */ );
334
335 typedef Bool (*DeviceCursorInitializeProcPtr) (DeviceIntPtr /* pDev */ ,
336 ScreenPtr /* pScreen */ );
337
338 typedef void (*DeviceCursorCleanupProcPtr) (DeviceIntPtr /* pDev */ ,
339 ScreenPtr /* pScreen */ );
340
341 typedef void (*ConstrainCursorHarderProcPtr) (DeviceIntPtr, ScreenPtr, int,
342 int *, int *);
343
344
345 typedef Bool (*SharePixmapBackingProcPtr)(PixmapPtr, ScreenPtr, void **);
346
347 typedef Bool (*SetSharedPixmapBackingProcPtr)(PixmapPtr, void *);
348
349 typedef Bool (*StartPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr,
350 int x, int y);
351
352 typedef Bool (*StopPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr);
353
354 typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
355
356 typedef struct _Screen {
357 int myNum; /* index of this instance in Screens[] */
358 ATOM id;
359 short x, y, width, height;
360 short mmWidth, mmHeight;
361 short numDepths;
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
375 a standard one.
376 */
377 PixmapPtr PixmapPerDepth[1];
378 pointer devPrivate;
379 short numVisuals;
380 VisualPtr visuals;
381 WindowPtr root;
382 ScreenSaverStuffRec screensaver;
383
384 DevPrivateSetRec screenSpecificPrivates[PRIVATE_LAST];
385
386 /* Random screen procedures */
387
388 CloseScreenProcPtr CloseScreen;
389 QueryBestSizeProcPtr QueryBestSize;
390 SaveScreenProcPtr SaveScreen;
391 GetImageProcPtr GetImage;
392 GetSpansProcPtr GetSpans;
393 SourceValidateProcPtr SourceValidate;
394
395 /* Window Procedures */
396
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;
410
411 /* Pixmap procedures */
412
413 CreatePixmapProcPtr CreatePixmap;
414 DestroyPixmapProcPtr DestroyPixmap;
415
416 /* Font procedures */
417
418 RealizeFontProcPtr RealizeFont;
419 UnrealizeFontProcPtr UnrealizeFont;
420
421 /* Cursor Procedures */
422
423 ConstrainCursorProcPtr ConstrainCursor;
424 ConstrainCursorHarderProcPtr ConstrainCursorHarder;
425 CursorLimitsProcPtr CursorLimits;
426 DisplayCursorProcPtr DisplayCursor;
427 RealizeCursorProcPtr RealizeCursor;
428 UnrealizeCursorProcPtr UnrealizeCursor;
429 RecolorCursorProcPtr RecolorCursor;
430 SetCursorPositionProcPtr SetCursorPosition;
431
432 /* GC procedures */
433
434 CreateGCProcPtr CreateGC;
435
436 /* Colormap procedures */
437
438 CreateColormapProcPtr CreateColormap;
439 DestroyColormapProcPtr DestroyColormap;
440 InstallColormapProcPtr InstallColormap;
441 UninstallColormapProcPtr UninstallColormap;
442 ListInstalledColormapsProcPtr ListInstalledColormaps;
443 StoreColorsProcPtr StoreColors;
444 ResolveColorProcPtr ResolveColor;
445
446 /* Region procedures */
447
448 BitmapToRegionProcPtr BitmapToRegion;
449 SendGraphicsExposeProcPtr SendGraphicsExpose;
450
451 /* os layer procedures */
452
453 ScreenBlockHandlerProcPtr BlockHandler;
454 ScreenWakeupHandlerProcPtr WakeupHandler;
455
456 /* anybody can get a piece of this array */
457 PrivateRec *devPrivates;
458
459 CreateScreenResourcesProcPtr CreateScreenResources;
460 ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
461
462 GetWindowPixmapProcPtr GetWindowPixmap;
463 SetWindowPixmapProcPtr SetWindowPixmap;
464 GetScreenPixmapProcPtr GetScreenPixmap;
465 SetScreenPixmapProcPtr SetScreenPixmap;
466
467 PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
468
469 unsigned int totalPixmapSize;
470
471 MarkWindowProcPtr MarkWindow;
472 MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
473 ConfigNotifyProcPtr ConfigNotify;
474 MoveWindowProcPtr MoveWindow;
475 ResizeWindowProcPtr ResizeWindow;
476 GetLayerWindowProcPtr GetLayerWindow;
477 HandleExposuresProcPtr HandleExposures;
478 ReparentWindowProcPtr ReparentWindow;
479
480 SetShapeProcPtr SetShape;
481
482 ChangeBorderWidthProcPtr ChangeBorderWidth;
483 MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
484
485 /* Device cursor procedures */
486 DeviceCursorInitializeProcPtr DeviceCursorInitialize;
487 DeviceCursorCleanupProcPtr DeviceCursorCleanup;
488
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
492 * default */
493 Bool canDoBGNoneRoot;
494
495 Bool isGPU;
496
497 struct xorg_list unattached_list;
498 struct xorg_list unattached_head;
499
500 ScreenPtr current_master;
501
502 struct xorg_list output_slave_list;
503 struct xorg_list output_head;
504
505 SharePixmapBackingProcPtr SharePixmapBacking;
506 SetSharedPixmapBackingProcPtr SetSharedPixmapBacking;
507
508 StartPixmapTrackingProcPtr StartPixmapTracking;
509 StopPixmapTrackingProcPtr StopPixmapTracking;
510
511 struct xorg_list pixmap_dirty_list;
512 struct xorg_list offload_slave_list;
513 struct xorg_list offload_head;
514
515 ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
516 } ScreenRec;
517
518 static inline RegionPtr
519 BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix)
520 {
521 return (*(_pScreen)->BitmapToRegion) (pPix); /* no mi version?! */
522 }
523
524 typedef struct _ScreenInfo {
525 int imageByteOrder;
526 int bitmapScanlineUnit;
527 int bitmapScanlinePad;
528 int bitmapBitOrder;
529 int numPixmapFormats;
530 PixmapFormatRec formats[MAXFORMATS];
531 int numScreens;
532 ScreenPtr screens[MAXSCREENS];
533 int numGPUScreens;
534 ScreenPtr gpuscreens[MAXGPUSCREENS];
535 int x; /* origin */
536 int y; /* origin */
537 int width; /* total width of all screens together */
538 int height; /* total height of all screens together */
539 } ScreenInfo;
540
541 extern _X_EXPORT ScreenInfo screenInfo;
542
543 extern _X_EXPORT void InitOutput(ScreenInfo * /*pScreenInfo */ ,
544 int /*argc */ ,
545 char ** /*argv */ );
546
547 #endif /* SCREENINTSTRUCT_H */