VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/XFree86-4.3/Xserver/resource.h@ 97956

最後變更 在這個檔案從97956是 69098,由 vboxsync 提交於 7 年 前

Clean up XFree86 driver header files.
bugref:3810: X11 Guest Additions maintenance
Over the years we have cleaned up the layout in the tree of the X.Org
header files we use to build drivers. The XFree86 ones were still in their
original, rather sub-optimal layout. This change fixes that.

  • 屬性 svn:eol-style 設為 native
檔案大小: 8.9 KB
 
1/* $Xorg: resource.h,v 1.5 2001/02/09 02:05:15 xorgcvs Exp $ */
2/***********************************************************
3
4Copyright 1987, 1989, 1998 The Open Group
5
6Permission to use, copy, modify, distribute, and sell this software and its
7documentation for any purpose is hereby granted without fee, provided that
8the above copyright notice appear in all copies and that both that
9copyright notice and this permission notice appear in supporting
10documentation.
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall not be
23used in advertising or otherwise to promote the sale, use or other dealings
24in this Software without prior written authorization from The Open Group.
25
26
27Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
28
29 All Rights Reserved
30
31Permission to use, copy, modify, and distribute this software and its
32documentation for any purpose and without fee is hereby granted,
33provided that the above copyright notice appear in all copies and that
34both that copyright notice and this permission notice appear in
35supporting documentation, and that the name of Digital not be
36used in advertising or publicity pertaining to distribution of the
37software without specific, written prior permission.
38
39DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
40ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
41DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
43WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45SOFTWARE.
46
47******************************************************************/
48/* $XFree86: xc/programs/Xserver/include/resource.h,v 1.11 2002/03/06 21:14:04 mvojkovi Exp $ */
49
50#ifndef RESOURCE_H
51#define RESOURCE_H 1
52#include "misc.h"
53
54/*****************************************************************
55 * STUFF FOR RESOURCES
56 *****************************************************************/
57
58/* classes for Resource routines */
59
60typedef unsigned long RESTYPE;
61
62#define RC_VANILLA ((RESTYPE)0)
63#define RC_CACHED ((RESTYPE)1<<31)
64#define RC_DRAWABLE ((RESTYPE)1<<30)
65/* Use class RC_NEVERRETAIN for resources that should not be retained
66 * regardless of the close down mode when the client dies. (A client's
67 * event selections on objects that it doesn't own are good candidates.)
68 * Extensions can use this too!
69 */
70#define RC_NEVERRETAIN ((RESTYPE)1<<29)
71#define RC_LASTPREDEF RC_NEVERRETAIN
72#define RC_ANY (~(RESTYPE)0)
73
74/* types for Resource routines */
75
76#define RT_WINDOW ((RESTYPE)1|RC_CACHED|RC_DRAWABLE)
77#define RT_PIXMAP ((RESTYPE)2|RC_CACHED|RC_DRAWABLE)
78#define RT_GC ((RESTYPE)3|RC_CACHED)
79#undef RT_FONT
80#undef RT_CURSOR
81#define RT_FONT ((RESTYPE)4)
82#define RT_CURSOR ((RESTYPE)5)
83#define RT_COLORMAP ((RESTYPE)6)
84#define RT_CMAPENTRY ((RESTYPE)7)
85#define RT_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN)
86#define RT_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN)
87#define RT_LASTPREDEF ((RESTYPE)9)
88#define RT_NONE ((RESTYPE)0)
89
90/* bits and fields within a resource id */
91#define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */
92#if MAXCLIENTS == 64
93#define RESOURCE_CLIENT_BITS 6
94#endif
95#if MAXCLIENTS == 128
96#define RESOURCE_CLIENT_BITS 7
97#endif
98#if MAXCLIENTS == 256
99#define RESOURCE_CLIENT_BITS 8
100#endif
101#if MAXCLIENTS == 512
102#define RESOURCE_CLIENT_BITS 9
103#endif
104/* client field offset */
105#define CLIENTOFFSET (RESOURCE_AND_CLIENT_COUNT - RESOURCE_CLIENT_BITS)
106/* resource field */
107#define RESOURCE_ID_MASK ((1 << CLIENTOFFSET) - 1)
108/* client field */
109#define RESOURCE_CLIENT_MASK (((1 << RESOURCE_CLIENT_BITS) - 1) << CLIENTOFFSET)
110/* extract the client mask from an XID */
111#define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK)
112/* extract the client id from an XID */
113#define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
114#define SERVER_BIT (Mask)0x40000000 /* use illegal bit */
115
116#ifdef INVALID
117#undef INVALID /* needed on HP/UX */
118#endif
119
120/* Invalid resource id */
121#define INVALID (0)
122
123#define BAD_RESOURCE 0xe0000000
124
125typedef int (*DeleteType)(
126#if NeedNestedPrototypes
127 pointer /*value*/,
128 XID /*id*/
129#endif
130);
131
132typedef void (*FindResType)(
133#if NeedNestedPrototypes
134 pointer /*value*/,
135 XID /*id*/,
136 pointer /*cdata*/
137#endif
138);
139
140typedef void (*FindAllRes)(
141#if NeedNestedPrototypes
142 pointer /*value*/,
143 XID /*id*/,
144 RESTYPE /*type*/,
145 pointer /*cdata*/
146#endif
147);
148
149typedef Bool (*FindComplexResType)(
150#if NeedNestedPrototypes
151 pointer /*value*/,
152 XID /*id*/,
153 pointer /*cdata*/
154#endif
155);
156
157extern RESTYPE CreateNewResourceType(
158#if NeedFunctionPrototypes
159 DeleteType /*deleteFunc*/
160#endif
161);
162
163extern RESTYPE CreateNewResourceClass(
164#if NeedFunctionPrototypes
165void
166#endif
167);
168
169extern Bool InitClientResources(
170#if NeedFunctionPrototypes
171 ClientPtr /*client*/
172#endif
173);
174
175extern XID FakeClientID(
176#if NeedFunctionPrototypes
177 int /*client*/
178#endif
179);
180
181/* Quartz support on Mac OS X uses the CarbonCore
182 framework whose AddResource function conflicts here. */
183#ifdef __DARWIN__
184#define AddResource Darwin_X_AddResource
185#endif
186extern Bool AddResource(
187#if NeedFunctionPrototypes
188 XID /*id*/,
189 RESTYPE /*type*/,
190 pointer /*value*/
191#endif
192);
193
194extern void FreeResource(
195#if NeedFunctionPrototypes
196 XID /*id*/,
197 RESTYPE /*skipDeleteFuncType*/
198#endif
199);
200
201extern void FreeResourceByType(
202#if NeedFunctionPrototypes
203 XID /*id*/,
204 RESTYPE /*type*/,
205 Bool /*skipFree*/
206#endif
207);
208
209extern Bool ChangeResourceValue(
210#if NeedFunctionPrototypes
211 XID /*id*/,
212 RESTYPE /*rtype*/,
213 pointer /*value*/
214#endif
215);
216
217extern void FindClientResourcesByType(
218#if NeedFunctionPrototypes
219 ClientPtr /*client*/,
220 RESTYPE /*type*/,
221 FindResType /*func*/,
222 pointer /*cdata*/
223#endif
224);
225
226extern void FindAllClientResources(
227#if NeedFunctionPrototypes
228 ClientPtr /*client*/,
229 FindAllRes /*func*/,
230 pointer /*cdata*/
231#endif
232);
233
234extern void FreeClientNeverRetainResources(
235#if NeedFunctionPrototypes
236 ClientPtr /*client*/
237#endif
238);
239
240extern void FreeClientResources(
241#if NeedFunctionPrototypes
242 ClientPtr /*client*/
243#endif
244);
245
246extern void FreeAllResources(
247#if NeedFunctionPrototypes
248void
249#endif
250);
251
252extern Bool LegalNewID(
253#if NeedFunctionPrototypes
254 XID /*id*/,
255 ClientPtr /*client*/
256#endif
257);
258
259extern pointer LookupIDByType(
260#if NeedFunctionPrototypes
261 XID /*id*/,
262 RESTYPE /*rtype*/
263#endif
264);
265
266extern pointer LookupIDByClass(
267#if NeedFunctionPrototypes
268 XID /*id*/,
269 RESTYPE /*classes*/
270#endif
271);
272
273extern pointer LookupClientResourceComplex(
274#if NeedFunctionPrototypes
275 ClientPtr client,
276 RESTYPE type,
277 FindComplexResType func,
278 pointer cdata
279#endif
280);
281
282/* These are the access modes that can be passed in the last parameter
283 * to SecurityLookupIDByType/Class. The Security extension doesn't
284 * currently make much use of these; they're mainly provided as an
285 * example of what you might need for discretionary access control.
286 * You can or these values together to indicate multiple modes
287 * simultaneously.
288 */
289
290#define SecurityUnknownAccess 0 /* don't know intentions */
291#define SecurityReadAccess (1<<0) /* inspecting the object */
292#define SecurityWriteAccess (1<<1) /* changing the object */
293#define SecurityDestroyAccess (1<<2) /* destroying the object */
294
295#ifdef XCSECURITY
296
297extern pointer SecurityLookupIDByType(
298#if NeedFunctionPrototypes
299 ClientPtr /*client*/,
300 XID /*id*/,
301 RESTYPE /*rtype*/,
302 Mask /*access_mode*/
303#endif
304);
305
306extern pointer SecurityLookupIDByClass(
307#if NeedFunctionPrototypes
308 ClientPtr /*client*/,
309 XID /*id*/,
310 RESTYPE /*classes*/,
311 Mask /*access_mode*/
312#endif
313);
314
315#else /* not XCSECURITY */
316
317#define SecurityLookupIDByType(client, id, rtype, access_mode) \
318 LookupIDByType(id, rtype)
319
320#define SecurityLookupIDByClass(client, id, classes, access_mode) \
321 LookupIDByClass(id, classes)
322
323#endif /* XCSECURITY */
324
325extern void GetXIDRange(
326#if NeedFunctionPrototypes
327 int /*client*/,
328 Bool /*server*/,
329 XID * /*minp*/,
330 XID * /*maxp*/
331#endif
332);
333
334extern unsigned int GetXIDList(
335#if NeedFunctionPrototypes
336 ClientPtr /*client*/,
337 unsigned int /*count*/,
338 XID * /*pids*/
339#endif
340);
341
342extern RESTYPE lastResourceType;
343extern RESTYPE TypeMask;
344
345#ifdef XResExtension
346extern Atom *ResourceNames;
347void RegisterResourceName(RESTYPE type, char* name);
348#endif
349
350#endif /* RESOURCE_H */
351
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette