1 | /******************************************************************************
|
---|
2 | *
|
---|
3 | * Copyright (c) 1994, 1995 Hewlett-Packard Company
|
---|
4 | *
|
---|
5 | * Permission is hereby granted, free of charge, to any person obtaining
|
---|
6 | * a copy of this software and associated documentation files (the
|
---|
7 | * "Software"), to deal in the Software without restriction, including
|
---|
8 | * without limitation the rights to use, copy, modify, merge, publish,
|
---|
9 | * distribute, sublicense, and/or sell copies of the Software, and to
|
---|
10 | * permit persons to whom the Software is furnished to do so, subject to
|
---|
11 | * the following conditions:
|
---|
12 | *
|
---|
13 | * The above copyright notice and this permission notice shall be included
|
---|
14 | * in all copies or substantial portions of the Software.
|
---|
15 | *
|
---|
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
---|
18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
---|
19 | * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
|
---|
20 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
---|
21 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
---|
22 | * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
23 | *
|
---|
24 | * Except as contained in this notice, the name of the Hewlett-Packard
|
---|
25 | * Company shall not be used in advertising or otherwise to promote the
|
---|
26 | * sale, use or other dealings in this Software without prior written
|
---|
27 | * authorization from the Hewlett-Packard Company.
|
---|
28 | *
|
---|
29 | * Header file for DIX-related DBE
|
---|
30 | *
|
---|
31 | *****************************************************************************/
|
---|
32 |
|
---|
33 | #ifndef DBE_STRUCT_H
|
---|
34 | #define DBE_STRUCT_H
|
---|
35 |
|
---|
36 | /* INCLUDES */
|
---|
37 |
|
---|
38 | #define NEED_DBE_PROTOCOL
|
---|
39 | #include <X11/extensions/dbeproto.h>
|
---|
40 | #include "windowstr.h"
|
---|
41 | #include "privates.h"
|
---|
42 |
|
---|
43 | typedef struct {
|
---|
44 | VisualID visual; /* one visual ID that supports double-buffering */
|
---|
45 | int depth; /* depth of visual in bits */
|
---|
46 | int perflevel; /* performance level of visual */
|
---|
47 | } XdbeVisualInfo;
|
---|
48 |
|
---|
49 | typedef struct {
|
---|
50 | int count; /* number of items in visual_depth */
|
---|
51 | XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
|
---|
52 | } XdbeScreenVisualInfo;
|
---|
53 |
|
---|
54 | /* DEFINES */
|
---|
55 |
|
---|
56 | #define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \
|
---|
57 | dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey))
|
---|
58 |
|
---|
59 | #define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
|
---|
60 | DBE_SCREEN_PRIV((pDrawable)->pScreen)
|
---|
61 |
|
---|
62 | #define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \
|
---|
63 | DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen)
|
---|
64 |
|
---|
65 | #define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \
|
---|
66 | DBE_SCREEN_PRIV((pWindow)->drawable.pScreen)
|
---|
67 |
|
---|
68 | #define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \
|
---|
69 | DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen)
|
---|
70 |
|
---|
71 | #define DBE_SCREEN_PRIV_FROM_GC(pGC)\
|
---|
72 | DBE_SCREEN_PRIV((pGC)->pScreen)
|
---|
73 |
|
---|
74 | #define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \
|
---|
75 | dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey))
|
---|
76 |
|
---|
77 | /* Initial size of the buffer ID array in the window priv. */
|
---|
78 | #define DBE_INIT_MAX_IDS 2
|
---|
79 |
|
---|
80 | /* Reallocation increment for the buffer ID array. */
|
---|
81 | #define DBE_INCR_MAX_IDS 4
|
---|
82 |
|
---|
83 | /* Marker for free elements in the buffer ID array. */
|
---|
84 | #define DBE_FREE_ID_ELEMENT 0
|
---|
85 |
|
---|
86 | /* TYPEDEFS */
|
---|
87 |
|
---|
88 | /* Record used to pass swap information between DIX and DDX swapping
|
---|
89 | * procedures.
|
---|
90 | */
|
---|
91 | typedef struct _DbeSwapInfoRec {
|
---|
92 | WindowPtr pWindow;
|
---|
93 | unsigned char swapAction;
|
---|
94 |
|
---|
95 | } DbeSwapInfoRec, *DbeSwapInfoPtr;
|
---|
96 |
|
---|
97 | /*
|
---|
98 | ******************************************************************************
|
---|
99 | ** Per-window data
|
---|
100 | ******************************************************************************
|
---|
101 | */
|
---|
102 |
|
---|
103 | typedef struct _DbeWindowPrivRec {
|
---|
104 | /* A pointer to the window with which the DBE window private (buffer) is
|
---|
105 | * associated.
|
---|
106 | */
|
---|
107 | WindowPtr pWindow;
|
---|
108 |
|
---|
109 | /* Last known swap action for this buffer. Legal values for this field
|
---|
110 | * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
|
---|
111 | */
|
---|
112 | unsigned char swapAction;
|
---|
113 |
|
---|
114 | /* Last known buffer size.
|
---|
115 | */
|
---|
116 | unsigned short width, height;
|
---|
117 |
|
---|
118 | /* Coordinates used for static gravity when the window is positioned.
|
---|
119 | */
|
---|
120 | short x, y;
|
---|
121 |
|
---|
122 | /* Number of XIDs associated with this buffer.
|
---|
123 | */
|
---|
124 | int nBufferIDs;
|
---|
125 |
|
---|
126 | /* Capacity of the current buffer ID array, IDs. */
|
---|
127 | int maxAvailableIDs;
|
---|
128 |
|
---|
129 | /* Pointer to the array of buffer IDs. This initially points to initIDs.
|
---|
130 | * When the static limit of the initIDs array is reached, the array is
|
---|
131 | * reallocated and this pointer is set to the new array instead of initIDs.
|
---|
132 | */
|
---|
133 | XID *IDs;
|
---|
134 |
|
---|
135 | /* Initial array of buffer IDs. We are defining the XID array within the
|
---|
136 | * window priv to optimize for data locality. In most cases, only one
|
---|
137 | * buffer will be associated with a window. Having the array declared
|
---|
138 | * here can prevent us from accessing the data in another memory page,
|
---|
139 | * possibly resulting in a page swap and loss of performance. Initially we
|
---|
140 | * will use this array to store buffer IDs. For situations where we have
|
---|
141 | * more IDs than can fit in this static array, we will allocate a larger
|
---|
142 | * array to use, possibly suffering a performance loss.
|
---|
143 | */
|
---|
144 | XID initIDs[DBE_INIT_MAX_IDS];
|
---|
145 |
|
---|
146 | /* Device-specific private information.
|
---|
147 | */
|
---|
148 | PrivateRec *devPrivates;
|
---|
149 |
|
---|
150 | } DbeWindowPrivRec, *DbeWindowPrivPtr;
|
---|
151 |
|
---|
152 | /*
|
---|
153 | ******************************************************************************
|
---|
154 | ** Per-screen data
|
---|
155 | ******************************************************************************
|
---|
156 | */
|
---|
157 |
|
---|
158 | typedef struct _DbeScreenPrivRec {
|
---|
159 | /* Wrapped functions
|
---|
160 | * It is the responsibilty of the DDX layer to wrap PositionWindow().
|
---|
161 | * DbeExtensionInit wraps DestroyWindow().
|
---|
162 | */
|
---|
163 | PositionWindowProcPtr PositionWindow;
|
---|
164 | DestroyWindowProcPtr DestroyWindow;
|
---|
165 |
|
---|
166 | /* Per-screen DIX routines */
|
---|
167 | Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
|
---|
168 | GCPtr /*pGC */
|
---|
169 | );
|
---|
170 |
|
---|
171 | /* Per-screen DDX routines */
|
---|
172 | Bool (*GetVisualInfo) (ScreenPtr /*pScreen */ ,
|
---|
173 | XdbeScreenVisualInfo * /*pVisInfo */
|
---|
174 | );
|
---|
175 | int (*AllocBackBufferName) (WindowPtr /*pWin */ ,
|
---|
176 | XID /*bufId */ ,
|
---|
177 | int /*swapAction */
|
---|
178 | );
|
---|
179 | int (*SwapBuffers) (ClientPtr /*client */ ,
|
---|
180 | int * /*pNumWindows */ ,
|
---|
181 | DbeSwapInfoPtr /*swapInfo */
|
---|
182 | );
|
---|
183 | void (*BeginIdiom) (ClientPtr /*client */
|
---|
184 | );
|
---|
185 | void (*EndIdiom) (ClientPtr /*client */
|
---|
186 | );
|
---|
187 | void (*WinPrivDelete) (DbeWindowPrivPtr /*pDbeWindowPriv */ ,
|
---|
188 | XID /*bufId */
|
---|
189 | );
|
---|
190 | void (*ResetProc) (ScreenPtr /*pScreen */
|
---|
191 | );
|
---|
192 |
|
---|
193 | } DbeScreenPrivRec, *DbeScreenPrivPtr;
|
---|
194 |
|
---|
195 | #endif /* DBE_STRUCT_H */
|
---|