scrnintstr.h revision 6747b715
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
85typedef struct _ScreenSaverStuff {
86    WindowPtr pWindow;
87    XID       wid;
88    char      blanked;
89    Bool      (*ExternalScreenSaver)(
90	ScreenPtr	/*pScreen*/,
91	int		/*xstate*/,
92	Bool		/*force*/);
93} ScreenSaverStuffRec;
94
95
96/*
97 *  There is a typedef for each screen function pointer so that code that
98 *  needs to declare a screen function pointer (e.g. in a screen private
99 *  or as a local variable) can easily do so and retain full type checking.
100 */
101
102typedef    Bool (* CloseScreenProcPtr)(
103	int /*index*/,
104	ScreenPtr /*pScreen*/);
105
106typedef    void (* QueryBestSizeProcPtr)(
107	int /*class*/,
108	unsigned short * /*pwidth*/,
109	unsigned short * /*pheight*/,
110	ScreenPtr /*pScreen*/);
111
112typedef    Bool (* SaveScreenProcPtr)(
113	 ScreenPtr /*pScreen*/,
114	 int /*on*/);
115
116typedef    void (* GetImageProcPtr)(
117	DrawablePtr /*pDrawable*/,
118	int /*sx*/,
119	int /*sy*/,
120	int /*w*/,
121	int /*h*/,
122	unsigned int /*format*/,
123	unsigned long /*planeMask*/,
124	char * /*pdstLine*/);
125
126typedef    void (* GetSpansProcPtr)(
127	DrawablePtr /*pDrawable*/,
128	int /*wMax*/,
129	DDXPointPtr /*ppt*/,
130	int* /*pwidth*/,
131	int /*nspans*/,
132	char * /*pdstStart*/);
133
134typedef    void (* SourceValidateProcPtr)(
135	DrawablePtr /*pDrawable*/,
136	int /*x*/,
137	int /*y*/,
138	int /*width*/,
139	int /*height*/);
140
141typedef    Bool (* CreateWindowProcPtr)(
142	WindowPtr /*pWindow*/);
143
144typedef    Bool (* DestroyWindowProcPtr)(
145	WindowPtr /*pWindow*/);
146
147typedef    Bool (* PositionWindowProcPtr)(
148	WindowPtr /*pWindow*/,
149	int /*x*/,
150	int /*y*/);
151
152typedef    Bool (* ChangeWindowAttributesProcPtr)(
153	WindowPtr /*pWindow*/,
154	unsigned long /*mask*/);
155
156typedef    Bool (* RealizeWindowProcPtr)(
157	WindowPtr /*pWindow*/);
158
159typedef    Bool (* UnrealizeWindowProcPtr)(
160	WindowPtr /*pWindow*/);
161
162typedef    void (* RestackWindowProcPtr)(
163	WindowPtr /*pWindow*/,
164	WindowPtr /*pOldNextSib*/);
165
166typedef    int  (* ValidateTreeProcPtr)(
167	WindowPtr /*pParent*/,
168	WindowPtr /*pChild*/,
169	VTKind /*kind*/);
170
171typedef    void (* PostValidateTreeProcPtr)(
172	WindowPtr /*pParent*/,
173	WindowPtr /*pChild*/,
174	VTKind /*kind*/);
175
176typedef    void (* WindowExposuresProcPtr)(
177	WindowPtr /*pWindow*/,
178	RegionPtr /*prgn*/,
179	RegionPtr /*other_exposed*/);
180
181typedef    void (* CopyWindowProcPtr)(
182	WindowPtr /*pWindow*/,
183	DDXPointRec /*ptOldOrg*/,
184	RegionPtr /*prgnSrc*/);
185
186typedef    void (* ClearToBackgroundProcPtr)(
187	WindowPtr /*pWindow*/,
188	int /*x*/,
189	int /*y*/,
190	int /*w*/,
191	int /*h*/,
192	Bool /*generateExposures*/);
193
194typedef    void (* ClipNotifyProcPtr)(
195	WindowPtr /*pWindow*/,
196	int /*dx*/,
197	int /*dy*/);
198
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
205
206typedef    PixmapPtr (* CreatePixmapProcPtr)(
207	ScreenPtr /*pScreen*/,
208	int /*width*/,
209	int /*height*/,
210	int /*depth*/,
211	unsigned /*usage_hint*/);
212
213typedef    Bool (* DestroyPixmapProcPtr)(
214	PixmapPtr /*pPixmap*/);
215
216typedef    void (* SaveDoomedAreasProcPtr)(
217	WindowPtr /*pWindow*/,
218	RegionPtr /*prgnSave*/,
219	int /*xorg*/,
220	int /*yorg*/);
221
222typedef    RegionPtr (* RestoreAreasProcPtr)(
223	WindowPtr /*pWindow*/,
224	RegionPtr /*prgnRestore*/);
225
226typedef    void (* ExposeCopyProcPtr)(
227	WindowPtr /*pSrc*/,
228	DrawablePtr /*pDst*/,
229	GCPtr /*pGC*/,
230	RegionPtr /*prgnExposed*/,
231	int /*srcx*/,
232	int /*srcy*/,
233	int /*dstx*/,
234	int /*dsty*/,
235	unsigned long /*plane*/);
236
237typedef    RegionPtr (* TranslateBackingStoreProcPtr)(
238	WindowPtr /*pWindow*/,
239	int /*windx*/,
240	int /*windy*/,
241	RegionPtr /*oldClip*/,
242	int /*oldx*/,
243	int /*oldy*/);
244
245typedef    RegionPtr (* ClearBackingStoreProcPtr)(
246	WindowPtr /*pWindow*/,
247	int /*x*/,
248	int /*y*/,
249	int /*w*/,
250	int /*h*/,
251	Bool /*generateExposures*/);
252
253typedef    void (* DrawGuaranteeProcPtr)(
254	WindowPtr /*pWindow*/,
255	GCPtr /*pGC*/,
256	int /*guarantee*/);
257
258typedef    Bool (* RealizeFontProcPtr)(
259	ScreenPtr /*pScreen*/,
260	FontPtr /*pFont*/);
261
262typedef    Bool (* UnrealizeFontProcPtr)(
263	ScreenPtr /*pScreen*/,
264	FontPtr /*pFont*/);
265
266typedef    void (* ConstrainCursorProcPtr)(
267        DeviceIntPtr /*pDev*/,
268	ScreenPtr /*pScreen*/,
269	BoxPtr /*pBox*/);
270
271typedef    void (* CursorLimitsProcPtr)(
272        DeviceIntPtr /* pDev */,
273	ScreenPtr /*pScreen*/,
274	CursorPtr /*pCursor*/,
275	BoxPtr /*pHotBox*/,
276	BoxPtr /*pTopLeftBox*/);
277
278typedef    Bool (* DisplayCursorProcPtr)(
279        DeviceIntPtr /* pDev */,
280	ScreenPtr /*pScreen*/,
281	CursorPtr /*pCursor*/);
282
283typedef    Bool (* RealizeCursorProcPtr)(
284        DeviceIntPtr /* pDev */,
285	ScreenPtr /*pScreen*/,
286	CursorPtr /*pCursor*/);
287
288typedef    Bool (* UnrealizeCursorProcPtr)(
289        DeviceIntPtr /* pDev */,
290	ScreenPtr /*pScreen*/,
291	CursorPtr /*pCursor*/);
292
293typedef    void (* RecolorCursorProcPtr)(
294        DeviceIntPtr /* pDev */,
295	ScreenPtr /*pScreen*/,
296	CursorPtr /*pCursor*/,
297	Bool /*displayed*/);
298
299typedef    Bool (* SetCursorPositionProcPtr)(
300        DeviceIntPtr /* pDev */,
301	ScreenPtr /*pScreen*/,
302	int /*x*/,
303	int /*y*/,
304	Bool /*generateEvent*/);
305
306typedef    Bool (* CreateGCProcPtr)(
307	GCPtr /*pGC*/);
308
309typedef    Bool (* CreateColormapProcPtr)(
310	ColormapPtr /*pColormap*/);
311
312typedef    void (* DestroyColormapProcPtr)(
313	ColormapPtr /*pColormap*/);
314
315typedef    void (* InstallColormapProcPtr)(
316	ColormapPtr /*pColormap*/);
317
318typedef    void (* UninstallColormapProcPtr)(
319	ColormapPtr /*pColormap*/);
320
321typedef    int (* ListInstalledColormapsProcPtr) (
322	ScreenPtr /*pScreen*/,
323	XID* /*pmaps */);
324
325typedef    void (* StoreColorsProcPtr)(
326	ColormapPtr /*pColormap*/,
327	int /*ndef*/,
328	xColorItem * /*pdef*/);
329
330typedef    void (* ResolveColorProcPtr)(
331	unsigned short* /*pred*/,
332	unsigned short* /*pgreen*/,
333	unsigned short* /*pblue*/,
334	VisualPtr /*pVisual*/);
335
336typedef    RegionPtr (* BitmapToRegionProcPtr)(
337	PixmapPtr /*pPix*/);
338
339typedef    void (* SendGraphicsExposeProcPtr)(
340	ClientPtr /*client*/,
341	RegionPtr /*pRgn*/,
342	XID /*drawable*/,
343	int /*major*/,
344	int /*minor*/);
345
346typedef    void (* ScreenBlockHandlerProcPtr)(
347	int /*screenNum*/,
348	pointer /*blockData*/,
349	pointer /*pTimeout*/,
350	pointer /*pReadmask*/);
351
352typedef    void (* ScreenWakeupHandlerProcPtr)(
353	 int /*screenNum*/,
354	 pointer /*wakeupData*/,
355	 unsigned long /*result*/,
356	 pointer /*pReadMask*/);
357
358typedef    Bool (* CreateScreenResourcesProcPtr)(
359	ScreenPtr /*pScreen*/);
360
361typedef    Bool (* ModifyPixmapHeaderProcPtr)(
362	PixmapPtr /*pPixmap*/,
363	int /*width*/,
364	int /*height*/,
365	int /*depth*/,
366	int /*bitsPerPixel*/,
367	int /*devKind*/,
368	pointer /*pPixData*/);
369
370typedef    PixmapPtr (* GetWindowPixmapProcPtr)(
371	WindowPtr /*pWin*/);
372
373typedef    void (* SetWindowPixmapProcPtr)(
374	WindowPtr /*pWin*/,
375	PixmapPtr /*pPix*/);
376
377typedef    PixmapPtr (* GetScreenPixmapProcPtr)(
378	ScreenPtr /*pScreen*/);
379
380typedef    void (* SetScreenPixmapProcPtr)(
381	PixmapPtr /*pPix*/);
382
383typedef    void (* MarkWindowProcPtr)(
384	WindowPtr /*pWin*/);
385
386typedef    Bool (* MarkOverlappedWindowsProcPtr)(
387	WindowPtr /*parent*/,
388	WindowPtr /*firstChild*/,
389	WindowPtr * /*pLayerWin*/);
390
391typedef    Bool (* ChangeSaveUnderProcPtr)(
392	WindowPtr /*pLayerWin*/,
393	WindowPtr /*firstChild*/);
394
395typedef    void (* PostChangeSaveUnderProcPtr)(
396	WindowPtr /*pLayerWin*/,
397	WindowPtr /*firstChild*/);
398
399typedef    int (* ConfigNotifyProcPtr)(
400	WindowPtr /*pWin*/,
401	int /*x*/,
402	int /*y*/,
403	int /*w*/,
404	int /*h*/,
405	int /*bw*/,
406	WindowPtr /*pSib*/);
407
408typedef    void (* MoveWindowProcPtr)(
409	WindowPtr /*pWin*/,
410	int /*x*/,
411	int /*y*/,
412	WindowPtr /*pSib*/,
413	VTKind /*kind*/);
414
415typedef    void (* ResizeWindowProcPtr)(
416    WindowPtr /*pWin*/,
417    int /*x*/,
418    int /*y*/,
419    unsigned int /*w*/,
420    unsigned int /*h*/,
421    WindowPtr /*pSib*/
422);
423
424typedef    WindowPtr (* GetLayerWindowProcPtr)(
425    WindowPtr /*pWin*/
426);
427
428typedef    void (* HandleExposuresProcPtr)(
429    WindowPtr /*pWin*/);
430
431typedef    void (* ReparentWindowProcPtr)(
432    WindowPtr /*pWin*/,
433    WindowPtr /*pPriorParent*/);
434
435typedef    void (* SetShapeProcPtr)(
436        WindowPtr /*pWin*/,
437        int /* kind */);
438
439typedef    void (* ChangeBorderWidthProcPtr)(
440	WindowPtr /*pWin*/,
441	unsigned int /*width*/);
442
443typedef    void (* MarkUnrealizedWindowProcPtr)(
444	WindowPtr /*pChild*/,
445	WindowPtr /*pWin*/,
446	Bool /*fromConfigure*/);
447
448typedef    Bool (* DeviceCursorInitializeProcPtr)(
449        DeviceIntPtr /* pDev */,
450        ScreenPtr    /* pScreen */);
451
452typedef    void (* DeviceCursorCleanupProcPtr)(
453        DeviceIntPtr /* pDev */,
454        ScreenPtr    /* pScreen */);
455
456typedef struct _Screen {
457    int			myNum;	/* index of this instance in Screens[] */
458    ATOM		id;
459    short		x, y, width, height;
460    short		mmWidth, mmHeight;
461    short		numDepths;
462    unsigned char      	rootDepth;
463    DepthPtr       	allowedDepths;
464    unsigned long      	rootVisual;
465    unsigned long	defColormap;
466    short		minInstalledCmaps, maxInstalledCmaps;
467    char                backingStoreSupport, saveUnderSupport;
468    unsigned long	whitePixel, blackPixel;
469    GCPtr		GCperDepth[MAXFORMATS+1];
470			/* next field is a stipple to use as default in
471			   a GC.  we don't build default tiles of all depths
472			   because they are likely to be of a color
473			   different from the default fg pixel, so
474			   we don't win anything by building
475			   a standard one.
476			*/
477    PixmapPtr		PixmapPerDepth[1];
478    pointer		devPrivate;
479    short       	numVisuals;
480    VisualPtr		visuals;
481    WindowPtr		root;
482    ScreenSaverStuffRec screensaver;
483
484    /* Random screen procedures */
485
486    CloseScreenProcPtr		CloseScreen;
487    QueryBestSizeProcPtr	QueryBestSize;
488    SaveScreenProcPtr		SaveScreen;
489    GetImageProcPtr		GetImage;
490    GetSpansProcPtr		GetSpans;
491    SourceValidateProcPtr	SourceValidate;
492
493    /* Window Procedures */
494
495    CreateWindowProcPtr		CreateWindow;
496    DestroyWindowProcPtr	DestroyWindow;
497    PositionWindowProcPtr	PositionWindow;
498    ChangeWindowAttributesProcPtr ChangeWindowAttributes;
499    RealizeWindowProcPtr	RealizeWindow;
500    UnrealizeWindowProcPtr	UnrealizeWindow;
501    ValidateTreeProcPtr		ValidateTree;
502    PostValidateTreeProcPtr	PostValidateTree;
503    WindowExposuresProcPtr	WindowExposures;
504    CopyWindowProcPtr		CopyWindow;
505    ClearToBackgroundProcPtr	ClearToBackground;
506    ClipNotifyProcPtr		ClipNotify;
507    RestackWindowProcPtr	RestackWindow;
508
509    /* Pixmap procedures */
510
511    CreatePixmapProcPtr		CreatePixmap;
512    DestroyPixmapProcPtr	DestroyPixmap;
513
514    /* Backing store procedures */
515
516    SaveDoomedAreasProcPtr	SaveDoomedAreas;
517    RestoreAreasProcPtr		RestoreAreas;
518    ExposeCopyProcPtr		ExposeCopy;
519    TranslateBackingStoreProcPtr TranslateBackingStore;
520    ClearBackingStoreProcPtr	ClearBackingStore;
521    DrawGuaranteeProcPtr	DrawGuarantee;
522    /*
523     * A read/write copy of the lower level backing store vector is needed now
524     * that the functions can be wrapped.
525     */
526    BSFuncRec			BackingStoreFuncs;
527
528    /* Font procedures */
529
530    RealizeFontProcPtr		RealizeFont;
531    UnrealizeFontProcPtr	UnrealizeFont;
532
533    /* Cursor Procedures */
534
535    ConstrainCursorProcPtr	ConstrainCursor;
536    CursorLimitsProcPtr		CursorLimits;
537    DisplayCursorProcPtr	DisplayCursor;
538    RealizeCursorProcPtr	RealizeCursor;
539    UnrealizeCursorProcPtr	UnrealizeCursor;
540    RecolorCursorProcPtr	RecolorCursor;
541    SetCursorPositionProcPtr	SetCursorPosition;
542
543    /* GC procedures */
544
545    CreateGCProcPtr		CreateGC;
546
547    /* Colormap procedures */
548
549    CreateColormapProcPtr	CreateColormap;
550    DestroyColormapProcPtr	DestroyColormap;
551    InstallColormapProcPtr	InstallColormap;
552    UninstallColormapProcPtr	UninstallColormap;
553    ListInstalledColormapsProcPtr ListInstalledColormaps;
554    StoreColorsProcPtr		StoreColors;
555    ResolveColorProcPtr		ResolveColor;
556
557    /* Region procedures */
558
559    BitmapToRegionProcPtr	BitmapToRegion;
560    SendGraphicsExposeProcPtr	SendGraphicsExpose;
561
562    /* os layer procedures */
563
564    ScreenBlockHandlerProcPtr	BlockHandler;
565    ScreenWakeupHandlerProcPtr	WakeupHandler;
566
567    pointer blockData;
568    pointer wakeupData;
569
570    /* anybody can get a piece of this array */
571    PrivateRec	*devPrivates;
572
573    CreateScreenResourcesProcPtr CreateScreenResources;
574    ModifyPixmapHeaderProcPtr	ModifyPixmapHeader;
575
576    GetWindowPixmapProcPtr	GetWindowPixmap;
577    SetWindowPixmapProcPtr	SetWindowPixmap;
578    GetScreenPixmapProcPtr	GetScreenPixmap;
579    SetScreenPixmapProcPtr	SetScreenPixmap;
580
581    PixmapPtr pScratchPixmap;		/* scratch pixmap "pool" */
582
583    unsigned int		totalPixmapSize;
584
585    MarkWindowProcPtr		MarkWindow;
586    MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
587    ChangeSaveUnderProcPtr	ChangeSaveUnder;
588    PostChangeSaveUnderProcPtr	PostChangeSaveUnder;
589    ConfigNotifyProcPtr		ConfigNotify;
590    MoveWindowProcPtr		MoveWindow;
591    ResizeWindowProcPtr		ResizeWindow;
592    GetLayerWindowProcPtr	GetLayerWindow;
593    HandleExposuresProcPtr	HandleExposures;
594    ReparentWindowProcPtr	ReparentWindow;
595
596    SetShapeProcPtr		SetShape;
597
598    ChangeBorderWidthProcPtr	ChangeBorderWidth;
599    MarkUnrealizedWindowProcPtr	MarkUnrealizedWindow;
600
601    /* Device cursor procedures */
602    DeviceCursorInitializeProcPtr DeviceCursorInitialize;
603    DeviceCursorCleanupProcPtr    DeviceCursorCleanup;
604} ScreenRec;
605
606static inline RegionPtr BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix) {
607    return (*(_pScreen)->BitmapToRegion)(pPix); /* no mi version?! */
608}
609
610typedef struct _ScreenInfo {
611    int		imageByteOrder;
612    int		bitmapScanlineUnit;
613    int		bitmapScanlinePad;
614    int		bitmapBitOrder;
615    int		numPixmapFormats;
616    PixmapFormatRec
617		formats[MAXFORMATS];
618    int		numScreens;
619    ScreenPtr	screens[MAXSCREENS];
620} ScreenInfo;
621
622extern _X_EXPORT ScreenInfo screenInfo;
623
624extern _X_EXPORT void InitOutput(
625    ScreenInfo 	* /*pScreenInfo*/,
626    int     	/*argc*/,
627    char    	** /*argv*/);
628
629#endif /* SCREENINTSTRUCT_H */
630