scrnintstr.h revision 4642e01f
1/***********************************************************
2
3Copyright 1987, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25
26Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28                        All Rights Reserved
29
30Permission to use, copy, modify, and distribute this software and its
31documentation for any purpose and without fee is hereby granted,
32provided that the above copyright notice appear in all copies and that
33both that copyright notice and this permission notice appear in
34supporting documentation, and that the name of Digital not be
35used in advertising or publicity pertaining to distribution of the
36software without specific, written prior permission.
37
38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44SOFTWARE.
45
46******************************************************************/
47
48#ifndef SCREENINTSTRUCT_H
49#define SCREENINTSTRUCT_H
50
51#include "screenint.h"
52#include "regionstr.h"
53#include "bstore.h"
54#include "colormap.h"
55#include "cursor.h"
56#include "validate.h"
57#include <X11/Xproto.h>
58#include "dix.h"
59#include "privates.h"
60
61typedef struct _PixmapFormat {
62    unsigned char	depth;
63    unsigned char	bitsPerPixel;
64    unsigned char	scanlinePad;
65    } PixmapFormatRec;
66
67typedef struct _Visual {
68    VisualID		vid;
69    short		class;
70    short		bitsPerRGBValue;
71    short		ColormapEntries;
72    short		nplanes;/* = log2 (ColormapEntries). This does not
73				 * imply that the screen has this many planes.
74				 * it may have more or fewer */
75    unsigned long	redMask, greenMask, blueMask;
76    int			offsetRed, offsetGreen, offsetBlue;
77  } VisualRec;
78
79typedef struct _Depth {
80    unsigned char	depth;
81    short		numVids;
82    VisualID		*vids;    /* block of visual ids for this depth */
83  } DepthRec;
84
85
86/*
87 *  There is a typedef for each screen function pointer so that code that
88 *  needs to declare a screen function pointer (e.g. in a screen private
89 *  or as a local variable) can easily do so and retain full type checking.
90 */
91
92typedef    Bool (* CloseScreenProcPtr)(
93	int /*index*/,
94	ScreenPtr /*pScreen*/);
95
96typedef    void (* QueryBestSizeProcPtr)(
97	int /*class*/,
98	unsigned short * /*pwidth*/,
99	unsigned short * /*pheight*/,
100	ScreenPtr /*pScreen*/);
101
102typedef    Bool (* SaveScreenProcPtr)(
103	 ScreenPtr /*pScreen*/,
104	 int /*on*/);
105
106typedef    void (* GetImageProcPtr)(
107	DrawablePtr /*pDrawable*/,
108	int /*sx*/,
109	int /*sy*/,
110	int /*w*/,
111	int /*h*/,
112	unsigned int /*format*/,
113	unsigned long /*planeMask*/,
114	char * /*pdstLine*/);
115
116typedef    void (* GetSpansProcPtr)(
117	DrawablePtr /*pDrawable*/,
118	int /*wMax*/,
119	DDXPointPtr /*ppt*/,
120	int* /*pwidth*/,
121	int /*nspans*/,
122	char * /*pdstStart*/);
123
124typedef    void (* PointerNonInterestBoxProcPtr)(
125        DeviceIntPtr /*pDev*/,
126	ScreenPtr /*pScreen*/,
127	BoxPtr /*pBox*/);
128
129typedef    void (* SourceValidateProcPtr)(
130	DrawablePtr /*pDrawable*/,
131	int /*x*/,
132	int /*y*/,
133	int /*width*/,
134	int /*height*/);
135
136typedef    Bool (* CreateWindowProcPtr)(
137	WindowPtr /*pWindow*/);
138
139typedef    Bool (* DestroyWindowProcPtr)(
140	WindowPtr /*pWindow*/);
141
142typedef    Bool (* PositionWindowProcPtr)(
143	WindowPtr /*pWindow*/,
144	int /*x*/,
145	int /*y*/);
146
147typedef    Bool (* ChangeWindowAttributesProcPtr)(
148	WindowPtr /*pWindow*/,
149	unsigned long /*mask*/);
150
151typedef    Bool (* RealizeWindowProcPtr)(
152	WindowPtr /*pWindow*/);
153
154typedef    Bool (* UnrealizeWindowProcPtr)(
155	WindowPtr /*pWindow*/);
156
157typedef    void (* RestackWindowProcPtr)(
158	WindowPtr /*pWindow*/,
159	WindowPtr /*pOldNextSib*/);
160
161typedef    int  (* ValidateTreeProcPtr)(
162	WindowPtr /*pParent*/,
163	WindowPtr /*pChild*/,
164	VTKind /*kind*/);
165
166typedef    void (* PostValidateTreeProcPtr)(
167	WindowPtr /*pParent*/,
168	WindowPtr /*pChild*/,
169	VTKind /*kind*/);
170
171typedef    void (* WindowExposuresProcPtr)(
172	WindowPtr /*pWindow*/,
173	RegionPtr /*prgn*/,
174	RegionPtr /*other_exposed*/);
175
176typedef    void (* PaintWindowProcPtr)(
177	WindowPtr /*pWindow*/,
178	RegionPtr /*pRegion*/,
179	int /*what*/);
180
181typedef PaintWindowProcPtr PaintWindowBackgroundProcPtr;
182typedef PaintWindowProcPtr PaintWindowBorderProcPtr;
183
184typedef    void (* CopyWindowProcPtr)(
185	WindowPtr /*pWindow*/,
186	DDXPointRec /*ptOldOrg*/,
187	RegionPtr /*prgnSrc*/);
188
189typedef    void (* ClearToBackgroundProcPtr)(
190	WindowPtr /*pWindow*/,
191	int /*x*/,
192	int /*y*/,
193	int /*w*/,
194	int /*h*/,
195	Bool /*generateExposures*/);
196
197typedef    void (* ClipNotifyProcPtr)(
198	WindowPtr /*pWindow*/,
199	int /*dx*/,
200	int /*dy*/);
201
202/* pixmap will exist only for the duration of the current rendering operation */
203#define CREATE_PIXMAP_USAGE_SCRATCH                     1
204/* pixmap will be the backing pixmap for a redirected window */
205#define CREATE_PIXMAP_USAGE_BACKING_PIXMAP              2
206/* pixmap will contain a glyph */
207#define CREATE_PIXMAP_USAGE_GLYPH_PICTURE               3
208
209typedef    PixmapPtr (* CreatePixmapProcPtr)(
210	ScreenPtr /*pScreen*/,
211	int /*width*/,
212	int /*height*/,
213	int /*depth*/,
214	unsigned /*usage_hint*/);
215
216typedef    Bool (* DestroyPixmapProcPtr)(
217	PixmapPtr /*pPixmap*/);
218
219typedef    void (* SaveDoomedAreasProcPtr)(
220	WindowPtr /*pWindow*/,
221	RegionPtr /*prgnSave*/,
222	int /*xorg*/,
223	int /*yorg*/);
224
225typedef    RegionPtr (* RestoreAreasProcPtr)(
226	WindowPtr /*pWindow*/,
227	RegionPtr /*prgnRestore*/);
228
229typedef    void (* ExposeCopyProcPtr)(
230	WindowPtr /*pSrc*/,
231	DrawablePtr /*pDst*/,
232	GCPtr /*pGC*/,
233	RegionPtr /*prgnExposed*/,
234	int /*srcx*/,
235	int /*srcy*/,
236	int /*dstx*/,
237	int /*dsty*/,
238	unsigned long /*plane*/);
239
240typedef    RegionPtr (* TranslateBackingStoreProcPtr)(
241	WindowPtr /*pWindow*/,
242	int /*windx*/,
243	int /*windy*/,
244	RegionPtr /*oldClip*/,
245	int /*oldx*/,
246	int /*oldy*/);
247
248typedef    RegionPtr (* ClearBackingStoreProcPtr)(
249	WindowPtr /*pWindow*/,
250	int /*x*/,
251	int /*y*/,
252	int /*w*/,
253	int /*h*/,
254	Bool /*generateExposures*/);
255
256typedef    void (* DrawGuaranteeProcPtr)(
257	WindowPtr /*pWindow*/,
258	GCPtr /*pGC*/,
259	int /*guarantee*/);
260
261typedef    Bool (* RealizeFontProcPtr)(
262	ScreenPtr /*pScreen*/,
263	FontPtr /*pFont*/);
264
265typedef    Bool (* UnrealizeFontProcPtr)(
266	ScreenPtr /*pScreen*/,
267	FontPtr /*pFont*/);
268
269typedef    void (* ConstrainCursorProcPtr)(
270        DeviceIntPtr /*pDev*/,
271	ScreenPtr /*pScreen*/,
272	BoxPtr /*pBox*/);
273
274typedef    void (* CursorLimitsProcPtr)(
275        DeviceIntPtr /* pDev */,
276	ScreenPtr /*pScreen*/,
277	CursorPtr /*pCursor*/,
278	BoxPtr /*pHotBox*/,
279	BoxPtr /*pTopLeftBox*/);
280
281typedef    Bool (* DisplayCursorProcPtr)(
282        DeviceIntPtr /* pDev */,
283	ScreenPtr /*pScreen*/,
284	CursorPtr /*pCursor*/);
285
286typedef    Bool (* RealizeCursorProcPtr)(
287        DeviceIntPtr /* pDev */,
288	ScreenPtr /*pScreen*/,
289	CursorPtr /*pCursor*/);
290
291typedef    Bool (* UnrealizeCursorProcPtr)(
292        DeviceIntPtr /* pDev */,
293	ScreenPtr /*pScreen*/,
294	CursorPtr /*pCursor*/);
295
296typedef    void (* RecolorCursorProcPtr)(
297        DeviceIntPtr /* pDev */,
298	ScreenPtr /*pScreen*/,
299	CursorPtr /*pCursor*/,
300	Bool /*displayed*/);
301
302typedef    Bool (* SetCursorPositionProcPtr)(
303        DeviceIntPtr /* pDev */,
304	ScreenPtr /*pScreen*/,
305	int /*x*/,
306	int /*y*/,
307	Bool /*generateEvent*/);
308
309typedef    Bool (* CreateGCProcPtr)(
310	GCPtr /*pGC*/);
311
312typedef    Bool (* CreateColormapProcPtr)(
313	ColormapPtr /*pColormap*/);
314
315typedef    void (* DestroyColormapProcPtr)(
316	ColormapPtr /*pColormap*/);
317
318typedef    void (* InstallColormapProcPtr)(
319	ColormapPtr /*pColormap*/);
320
321typedef    void (* UninstallColormapProcPtr)(
322	ColormapPtr /*pColormap*/);
323
324typedef    int (* ListInstalledColormapsProcPtr) (
325	ScreenPtr /*pScreen*/,
326	XID* /*pmaps */);
327
328typedef    void (* StoreColorsProcPtr)(
329	ColormapPtr /*pColormap*/,
330	int /*ndef*/,
331	xColorItem * /*pdef*/);
332
333typedef    void (* ResolveColorProcPtr)(
334	unsigned short* /*pred*/,
335	unsigned short* /*pgreen*/,
336	unsigned short* /*pblue*/,
337	VisualPtr /*pVisual*/);
338
339typedef    RegionPtr (* BitmapToRegionProcPtr)(
340	PixmapPtr /*pPix*/);
341
342typedef    void (* SendGraphicsExposeProcPtr)(
343	ClientPtr /*client*/,
344	RegionPtr /*pRgn*/,
345	XID /*drawable*/,
346	int /*major*/,
347	int /*minor*/);
348
349typedef    void (* ScreenBlockHandlerProcPtr)(
350	int /*screenNum*/,
351	pointer /*blockData*/,
352	pointer /*pTimeout*/,
353	pointer /*pReadmask*/);
354
355typedef    void (* ScreenWakeupHandlerProcPtr)(
356	 int /*screenNum*/,
357	 pointer /*wakeupData*/,
358	 unsigned long /*result*/,
359	 pointer /*pReadMask*/);
360
361typedef    Bool (* CreateScreenResourcesProcPtr)(
362	ScreenPtr /*pScreen*/);
363
364typedef    Bool (* ModifyPixmapHeaderProcPtr)(
365	PixmapPtr /*pPixmap*/,
366	int /*width*/,
367	int /*height*/,
368	int /*depth*/,
369	int /*bitsPerPixel*/,
370	int /*devKind*/,
371	pointer /*pPixData*/);
372
373typedef    PixmapPtr (* GetWindowPixmapProcPtr)(
374	WindowPtr /*pWin*/);
375
376typedef    void (* SetWindowPixmapProcPtr)(
377	WindowPtr /*pWin*/,
378	PixmapPtr /*pPix*/);
379
380typedef    PixmapPtr (* GetScreenPixmapProcPtr)(
381	ScreenPtr /*pScreen*/);
382
383typedef    void (* SetScreenPixmapProcPtr)(
384	PixmapPtr /*pPix*/);
385
386typedef    void (* MarkWindowProcPtr)(
387	WindowPtr /*pWin*/);
388
389typedef    Bool (* MarkOverlappedWindowsProcPtr)(
390	WindowPtr /*parent*/,
391	WindowPtr /*firstChild*/,
392	WindowPtr * /*pLayerWin*/);
393
394typedef    Bool (* ChangeSaveUnderProcPtr)(
395	WindowPtr /*pLayerWin*/,
396	WindowPtr /*firstChild*/);
397
398typedef    void (* PostChangeSaveUnderProcPtr)(
399	WindowPtr /*pLayerWin*/,
400	WindowPtr /*firstChild*/);
401
402typedef    void (* MoveWindowProcPtr)(
403	WindowPtr /*pWin*/,
404	int /*x*/,
405	int /*y*/,
406	WindowPtr /*pSib*/,
407	VTKind /*kind*/);
408
409typedef    void (* ResizeWindowProcPtr)(
410    WindowPtr /*pWin*/,
411    int /*x*/,
412    int /*y*/,
413    unsigned int /*w*/,
414    unsigned int /*h*/,
415    WindowPtr /*pSib*/
416);
417
418typedef    WindowPtr (* GetLayerWindowProcPtr)(
419    WindowPtr /*pWin*/
420);
421
422typedef    void (* HandleExposuresProcPtr)(
423    WindowPtr /*pWin*/);
424
425typedef    void (* ReparentWindowProcPtr)(
426    WindowPtr /*pWin*/,
427    WindowPtr /*pPriorParent*/);
428
429typedef    void (* SetShapeProcPtr)(
430	WindowPtr /*pWin*/);
431
432typedef    void (* ChangeBorderWidthProcPtr)(
433	WindowPtr /*pWin*/,
434	unsigned int /*width*/);
435
436typedef    void (* MarkUnrealizedWindowProcPtr)(
437	WindowPtr /*pChild*/,
438	WindowPtr /*pWin*/,
439	Bool /*fromConfigure*/);
440
441typedef    Bool (* DeviceCursorInitializeProcPtr)(
442        DeviceIntPtr /* pDev */,
443        ScreenPtr    /* pScreen */);
444
445typedef    void (* DeviceCursorCleanupProcPtr)(
446        DeviceIntPtr /* pDev */,
447        ScreenPtr    /* pScreen */);
448
449typedef struct _Screen {
450    int			myNum;	/* index of this instance in Screens[] */
451    ATOM		id;
452    short		width, height;
453    short		mmWidth, mmHeight;
454    short		numDepths;
455    unsigned char      	rootDepth;
456    DepthPtr       	allowedDepths;
457    unsigned long      	rootVisual;
458    unsigned long	defColormap;
459    short		minInstalledCmaps, maxInstalledCmaps;
460    char                backingStoreSupport, saveUnderSupport;
461    unsigned long	whitePixel, blackPixel;
462    unsigned long	rgf;	/* array of flags; she's -- HUNGARIAN */
463    GCPtr		GCperDepth[MAXFORMATS+1];
464			/* next field is a stipple to use as default in
465			   a GC.  we don't build default tiles of all depths
466			   because they are likely to be of a color
467			   different from the default fg pixel, so
468			   we don't win anything by building
469			   a standard one.
470			*/
471    PixmapPtr		PixmapPerDepth[1];
472    pointer		devPrivate;
473    short       	numVisuals;
474    VisualPtr		visuals;
475
476    /* Random screen procedures */
477
478    CloseScreenProcPtr		CloseScreen;
479    QueryBestSizeProcPtr	QueryBestSize;
480    SaveScreenProcPtr		SaveScreen;
481    GetImageProcPtr		GetImage;
482    GetSpansProcPtr		GetSpans;
483    PointerNonInterestBoxProcPtr PointerNonInterestBox;
484    SourceValidateProcPtr	SourceValidate;
485
486    /* Window Procedures */
487
488    CreateWindowProcPtr		CreateWindow;
489    DestroyWindowProcPtr	DestroyWindow;
490    PositionWindowProcPtr	PositionWindow;
491    ChangeWindowAttributesProcPtr ChangeWindowAttributes;
492    RealizeWindowProcPtr	RealizeWindow;
493    UnrealizeWindowProcPtr	UnrealizeWindow;
494    ValidateTreeProcPtr		ValidateTree;
495    PostValidateTreeProcPtr	PostValidateTree;
496    WindowExposuresProcPtr	WindowExposures;
497    PaintWindowBackgroundProcPtr PaintWindowBackground; /** unused */
498    PaintWindowBorderProcPtr	PaintWindowBorder; /** unused */
499    CopyWindowProcPtr		CopyWindow;
500    ClearToBackgroundProcPtr	ClearToBackground;
501    ClipNotifyProcPtr		ClipNotify;
502    RestackWindowProcPtr	RestackWindow;
503
504    /* Pixmap procedures */
505
506    CreatePixmapProcPtr		CreatePixmap;
507    DestroyPixmapProcPtr	DestroyPixmap;
508
509    /* Backing store procedures */
510
511    SaveDoomedAreasProcPtr	SaveDoomedAreas;
512    RestoreAreasProcPtr		RestoreAreas;
513    ExposeCopyProcPtr		ExposeCopy;
514    TranslateBackingStoreProcPtr TranslateBackingStore;
515    ClearBackingStoreProcPtr	ClearBackingStore;
516    DrawGuaranteeProcPtr	DrawGuarantee;
517    /*
518     * A read/write copy of the lower level backing store vector is needed now
519     * that the functions can be wrapped.
520     */
521    BSFuncRec			BackingStoreFuncs;
522
523    /* Font procedures */
524
525    RealizeFontProcPtr		RealizeFont;
526    UnrealizeFontProcPtr	UnrealizeFont;
527
528    /* Cursor Procedures */
529
530    ConstrainCursorProcPtr	ConstrainCursor;
531    CursorLimitsProcPtr		CursorLimits;
532    DisplayCursorProcPtr	DisplayCursor;
533    RealizeCursorProcPtr	RealizeCursor;
534    UnrealizeCursorProcPtr	UnrealizeCursor;
535    RecolorCursorProcPtr	RecolorCursor;
536    SetCursorPositionProcPtr	SetCursorPosition;
537
538    /* GC procedures */
539
540    CreateGCProcPtr		CreateGC;
541
542    /* Colormap procedures */
543
544    CreateColormapProcPtr	CreateColormap;
545    DestroyColormapProcPtr	DestroyColormap;
546    InstallColormapProcPtr	InstallColormap;
547    UninstallColormapProcPtr	UninstallColormap;
548    ListInstalledColormapsProcPtr ListInstalledColormaps;
549    StoreColorsProcPtr		StoreColors;
550    ResolveColorProcPtr		ResolveColor;
551
552    /* Region procedures */
553
554    BitmapToRegionProcPtr	BitmapToRegion;
555    SendGraphicsExposeProcPtr	SendGraphicsExpose;
556
557    /* os layer procedures */
558
559    ScreenBlockHandlerProcPtr	BlockHandler;
560    ScreenWakeupHandlerProcPtr	WakeupHandler;
561
562    pointer blockData;
563    pointer wakeupData;
564
565    /* anybody can get a piece of this array */
566    PrivateRec	*devPrivates;
567
568    CreateScreenResourcesProcPtr CreateScreenResources;
569    ModifyPixmapHeaderProcPtr	ModifyPixmapHeader;
570
571    GetWindowPixmapProcPtr	GetWindowPixmap;
572    SetWindowPixmapProcPtr	SetWindowPixmap;
573    GetScreenPixmapProcPtr	GetScreenPixmap;
574    SetScreenPixmapProcPtr	SetScreenPixmap;
575
576    PixmapPtr pScratchPixmap;		/* scratch pixmap "pool" */
577
578    unsigned int		totalPixmapSize;
579
580    MarkWindowProcPtr		MarkWindow;
581    MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
582    ChangeSaveUnderProcPtr	ChangeSaveUnder;
583    PostChangeSaveUnderProcPtr	PostChangeSaveUnder;
584    MoveWindowProcPtr		MoveWindow;
585    ResizeWindowProcPtr		ResizeWindow;
586    GetLayerWindowProcPtr	GetLayerWindow;
587    HandleExposuresProcPtr	HandleExposures;
588    ReparentWindowProcPtr	ReparentWindow;
589
590    SetShapeProcPtr		SetShape;
591
592    ChangeBorderWidthProcPtr	ChangeBorderWidth;
593    MarkUnrealizedWindowProcPtr	MarkUnrealizedWindow;
594
595    /* Device cursor procedures */
596    DeviceCursorInitializeProcPtr DeviceCursorInitialize;
597    DeviceCursorCleanupProcPtr    DeviceCursorCleanup;
598} ScreenRec;
599
600typedef struct _ScreenInfo {
601    int		imageByteOrder;
602    int		bitmapScanlineUnit;
603    int		bitmapScanlinePad;
604    int		bitmapBitOrder;
605    int		numPixmapFormats;
606    PixmapFormatRec
607		formats[MAXFORMATS];
608    int		arraySize;
609    int		numScreens;
610    ScreenPtr	screens[MAXSCREENS];
611    int		unused;
612} ScreenInfo;
613
614extern ScreenInfo screenInfo;
615
616extern void InitOutput(
617    ScreenInfo 	* /*pScreenInfo*/,
618    int     	/*argc*/,
619    char    	** /*argv*/);
620
621#endif /* SCREENINTSTRUCT_H */
622