1 | /*
|
---|
2 | * $XFree86: xc/programs/Xserver/miext/layer/layer.h,v 1.4 2001/08/01 00:44:58 tsi Exp $
|
---|
3 | *
|
---|
4 | * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
|
---|
5 | *
|
---|
6 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
7 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
8 | * the above copyright notice appear in all copies and that both that
|
---|
9 | * copyright notice and this permission notice appear in supporting
|
---|
10 | * documentation, and that the name of Keith Packard not be used in
|
---|
11 | * advertising or publicity pertaining to distribution of the software without
|
---|
12 | * specific, written prior permission. Keith Packard makes no
|
---|
13 | * representations about the suitability of this software for any purpose. It
|
---|
14 | * is provided "as is" without express or implied warranty.
|
---|
15 | *
|
---|
16 | * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
---|
17 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
---|
18 | * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
---|
19 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
---|
20 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
---|
21 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
22 | * PERFORMANCE OF THIS SOFTWARE.
|
---|
23 | */
|
---|
24 |
|
---|
25 | #ifdef HAVE_DIX_CONFIG_H
|
---|
26 | #include <dix-config.h>
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | #ifndef _LAYER_H_
|
---|
30 | #define _LAYER_H_
|
---|
31 |
|
---|
32 | #include <shadow.h>
|
---|
33 |
|
---|
34 | #define LAYER_FB 0
|
---|
35 | #define LAYER_SHADOW 1
|
---|
36 |
|
---|
37 | typedef struct _LayerKind *LayerKindPtr;
|
---|
38 | typedef struct _LayerWin *LayerWinPtr;
|
---|
39 | typedef struct _LayerList *LayerListPtr;
|
---|
40 | typedef struct _LayerGC *LayerGCPtr;
|
---|
41 | typedef struct _Layer *LayerPtr;
|
---|
42 | typedef struct _LayerScreen *LayerScreenPtr;
|
---|
43 |
|
---|
44 | /*
|
---|
45 | * We'll try to work without a list of windows in each layer
|
---|
46 | * for now, this will make computing bounding boxes for each
|
---|
47 | * layer rather expensive, so that may need to change at some point.
|
---|
48 | */
|
---|
49 |
|
---|
50 | #define LAYER_SCREEN_PIXMAP ((PixmapPtr) 1)
|
---|
51 |
|
---|
52 | typedef struct _Layer {
|
---|
53 | LayerPtr pNext; /* a list of all layers for this screen */
|
---|
54 | LayerKindPtr pKind; /* characteristics of this layer */
|
---|
55 | int refcnt; /* reference count, layer is freed when zero */
|
---|
56 | int windows; /* number of windows, free pixmap when zero */
|
---|
57 | int depth; /* window depth in this layer */
|
---|
58 | PixmapPtr pPixmap; /* pixmap for this layer (may be frame buffer) */
|
---|
59 | Bool freePixmap; /* whether to free this pixmap when done */
|
---|
60 | RegionRec region; /* valid set of pPixmap for drawing */
|
---|
61 | ShadowUpdateProc update; /* for shadow layers, update/window/closure values */
|
---|
62 | ShadowWindowProc window;
|
---|
63 | int randr;
|
---|
64 | void *closure;
|
---|
65 | } LayerRec;
|
---|
66 |
|
---|
67 | /*
|
---|
68 | * Call this before wrapping stuff for acceleration, it
|
---|
69 | * gives layer pointers to the raw frame buffer functions
|
---|
70 | */
|
---|
71 |
|
---|
72 | Bool
|
---|
73 | LayerStartInit (ScreenPtr pScreen);
|
---|
74 |
|
---|
75 | /*
|
---|
76 | * Initialize wrappers for each acceleration type and
|
---|
77 | * call this function, it will move the needed functions
|
---|
78 | * into a new LayerKind and replace them with the generic
|
---|
79 | * functions.
|
---|
80 | */
|
---|
81 |
|
---|
82 | int
|
---|
83 | LayerNewKind (ScreenPtr pScreen);
|
---|
84 |
|
---|
85 | /*
|
---|
86 | * Finally, call this function and layer
|
---|
87 | * will wrap the screen functions and prepare for execution
|
---|
88 | */
|
---|
89 |
|
---|
90 | Bool
|
---|
91 | LayerFinishInit (ScreenPtr pScreen);
|
---|
92 |
|
---|
93 | /*
|
---|
94 | * At any point after LayerStartInit, a new layer can be created.
|
---|
95 | */
|
---|
96 | LayerPtr
|
---|
97 | LayerCreate (ScreenPtr pScreen,
|
---|
98 | int kind,
|
---|
99 | int depth,
|
---|
100 | PixmapPtr pPixmap,
|
---|
101 | ShadowUpdateProc update,
|
---|
102 | ShadowWindowProc window,
|
---|
103 | int randr,
|
---|
104 | void *closure);
|
---|
105 |
|
---|
106 | /*
|
---|
107 | * Create a layer pixmap
|
---|
108 | */
|
---|
109 | Bool
|
---|
110 | LayerCreatePixmap (ScreenPtr pScreen, LayerPtr pLayer);
|
---|
111 |
|
---|
112 | /*
|
---|
113 | * Change a layer pixmap
|
---|
114 | */
|
---|
115 | void
|
---|
116 | LayerSetPixmap (ScreenPtr pScreen, LayerPtr pLayer, PixmapPtr pPixmap);
|
---|
117 |
|
---|
118 | /*
|
---|
119 | * Destroy a layer pixmap
|
---|
120 | */
|
---|
121 | void
|
---|
122 | LayerDestroyPixmap (ScreenPtr pScreen, LayerPtr pLayer);
|
---|
123 |
|
---|
124 | /*
|
---|
125 | * Change a layer kind
|
---|
126 | */
|
---|
127 | void
|
---|
128 | LayerSetKind (ScreenPtr pScreen, LayerPtr pLayer, int kind);
|
---|
129 |
|
---|
130 | /*
|
---|
131 | * Destroy a layer. The layer must not contain any windows.
|
---|
132 | */
|
---|
133 | void
|
---|
134 | LayerDestroy (ScreenPtr pScreen, LayerPtr layer);
|
---|
135 |
|
---|
136 | /*
|
---|
137 | * Add a window to a layer
|
---|
138 | */
|
---|
139 | Bool
|
---|
140 | LayerWindowAdd (ScreenPtr pScreen, LayerPtr pLayer, WindowPtr pWin);
|
---|
141 |
|
---|
142 | /*
|
---|
143 | * Remove a window from a layer
|
---|
144 | */
|
---|
145 |
|
---|
146 | void
|
---|
147 | LayerWindowRemove (ScreenPtr pScreen, LayerPtr pLayer, WindowPtr pWin);
|
---|
148 |
|
---|
149 | #endif /* _LAYER_H_ */
|
---|