VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.3.0.0/resource.h@ 35393

最後變更 在這個檔案從35393是 25078,由 vboxsync 提交於 15 年 前

Additions/x11/x11include: exported and set eol-style on new headers

  • 屬性 svn:eol-style 設為 native
檔案大小: 7.6 KB
 
1/***********************************************************
2
3Copyright 1987, 1989, 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, 1989 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 RESOURCE_H
49#define RESOURCE_H 1
50#include "misc.h"
51
52/*****************************************************************
53 * STUFF FOR RESOURCES
54 *****************************************************************/
55
56/* classes for Resource routines */
57
58typedef unsigned long RESTYPE;
59
60#define RC_VANILLA ((RESTYPE)0)
61#define RC_CACHED ((RESTYPE)1<<31)
62#define RC_DRAWABLE ((RESTYPE)1<<30)
63/* Use class RC_NEVERRETAIN for resources that should not be retained
64 * regardless of the close down mode when the client dies. (A client's
65 * event selections on objects that it doesn't own are good candidates.)
66 * Extensions can use this too!
67 */
68#define RC_NEVERRETAIN ((RESTYPE)1<<29)
69#define RC_LASTPREDEF RC_NEVERRETAIN
70#define RC_ANY (~(RESTYPE)0)
71
72/* types for Resource routines */
73
74#define RT_WINDOW ((RESTYPE)1|RC_CACHED|RC_DRAWABLE)
75#define RT_PIXMAP ((RESTYPE)2|RC_CACHED|RC_DRAWABLE)
76#define RT_GC ((RESTYPE)3|RC_CACHED)
77#undef RT_FONT
78#undef RT_CURSOR
79#define RT_FONT ((RESTYPE)4)
80#define RT_CURSOR ((RESTYPE)5)
81#define RT_COLORMAP ((RESTYPE)6)
82#define RT_CMAPENTRY ((RESTYPE)7)
83#define RT_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN)
84#define RT_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN)
85#define RT_LASTPREDEF ((RESTYPE)9)
86#define RT_NONE ((RESTYPE)0)
87
88/* bits and fields within a resource id */
89#define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */
90#if MAXCLIENTS == 64
91#define RESOURCE_CLIENT_BITS 6
92#endif
93#if MAXCLIENTS == 128
94#define RESOURCE_CLIENT_BITS 7
95#endif
96#if MAXCLIENTS == 256
97#define RESOURCE_CLIENT_BITS 8
98#endif
99#if MAXCLIENTS == 512
100#define RESOURCE_CLIENT_BITS 9
101#endif
102/* client field offset */
103#define CLIENTOFFSET (RESOURCE_AND_CLIENT_COUNT - RESOURCE_CLIENT_BITS)
104/* resource field */
105#define RESOURCE_ID_MASK ((1 << CLIENTOFFSET) - 1)
106/* client field */
107#define RESOURCE_CLIENT_MASK (((1 << RESOURCE_CLIENT_BITS) - 1) << CLIENTOFFSET)
108/* extract the client mask from an XID */
109#define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK)
110/* extract the client id from an XID */
111#define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
112#define SERVER_BIT (Mask)0x40000000 /* use illegal bit */
113
114#ifdef INVALID
115#undef INVALID /* needed on HP/UX */
116#endif
117
118/* Invalid resource id */
119#define INVALID (0)
120
121#define BAD_RESOURCE 0xe0000000
122
123typedef int (*DeleteType)(
124 pointer /*value*/,
125 XID /*id*/);
126
127typedef void (*FindResType)(
128 pointer /*value*/,
129 XID /*id*/,
130 pointer /*cdata*/);
131
132typedef void (*FindAllRes)(
133 pointer /*value*/,
134 XID /*id*/,
135 RESTYPE /*type*/,
136 pointer /*cdata*/);
137
138typedef Bool (*FindComplexResType)(
139 pointer /*value*/,
140 XID /*id*/,
141 pointer /*cdata*/);
142
143extern RESTYPE CreateNewResourceType(
144 DeleteType /*deleteFunc*/);
145
146extern RESTYPE CreateNewResourceClass(void);
147
148extern Bool InitClientResources(
149 ClientPtr /*client*/);
150
151extern XID FakeClientID(
152 int /*client*/);
153
154/* Quartz support on Mac OS X uses the CarbonCore
155 framework whose AddResource function conflicts here. */
156#ifdef __DARWIN__
157#define AddResource Darwin_X_AddResource
158#endif
159extern Bool AddResource(
160 XID /*id*/,
161 RESTYPE /*type*/,
162 pointer /*value*/);
163
164extern void FreeResource(
165 XID /*id*/,
166 RESTYPE /*skipDeleteFuncType*/);
167
168extern void FreeResourceByType(
169 XID /*id*/,
170 RESTYPE /*type*/,
171 Bool /*skipFree*/);
172
173extern Bool ChangeResourceValue(
174 XID /*id*/,
175 RESTYPE /*rtype*/,
176 pointer /*value*/);
177
178extern void FindClientResourcesByType(
179 ClientPtr /*client*/,
180 RESTYPE /*type*/,
181 FindResType /*func*/,
182 pointer /*cdata*/);
183
184extern void FindAllClientResources(
185 ClientPtr /*client*/,
186 FindAllRes /*func*/,
187 pointer /*cdata*/);
188
189extern void FreeClientNeverRetainResources(
190 ClientPtr /*client*/);
191
192extern void FreeClientResources(
193 ClientPtr /*client*/);
194
195extern void FreeAllResources(void);
196
197extern Bool LegalNewID(
198 XID /*id*/,
199 ClientPtr /*client*/);
200
201extern pointer LookupIDByType(
202 XID /*id*/,
203 RESTYPE /*rtype*/);
204
205extern pointer LookupIDByClass(
206 XID /*id*/,
207 RESTYPE /*classes*/);
208
209extern pointer LookupClientResourceComplex(
210 ClientPtr client,
211 RESTYPE type,
212 FindComplexResType func,
213 pointer cdata);
214
215/* These are the access modes that can be passed in the last parameter
216 * to SecurityLookupIDByType/Class. The Security extension doesn't
217 * currently make much use of these; they're mainly provided as an
218 * example of what you might need for discretionary access control.
219 * You can or these values together to indicate multiple modes
220 * simultaneously.
221 */
222
223#define SecurityUnknownAccess 0 /* don't know intentions */
224#define SecurityReadAccess (1<<0) /* inspecting the object */
225#define SecurityWriteAccess (1<<1) /* changing the object */
226#define SecurityDestroyAccess (1<<2) /* destroying the object */
227
228extern pointer SecurityLookupIDByType(
229 ClientPtr /*client*/,
230 XID /*id*/,
231 RESTYPE /*rtype*/,
232 Mask /*access_mode*/);
233
234extern pointer SecurityLookupIDByClass(
235 ClientPtr /*client*/,
236 XID /*id*/,
237 RESTYPE /*classes*/,
238 Mask /*access_mode*/);
239
240
241extern void GetXIDRange(
242 int /*client*/,
243 Bool /*server*/,
244 XID * /*minp*/,
245 XID * /*maxp*/);
246
247extern unsigned int GetXIDList(
248 ClientPtr /*client*/,
249 unsigned int /*count*/,
250 XID * /*pids*/);
251
252extern RESTYPE lastResourceType;
253extern RESTYPE TypeMask;
254
255#ifdef XResExtension
256extern Atom *ResourceNames;
257void RegisterResourceName(RESTYPE type, char* name);
258#endif
259
260#endif /* RESOURCE_H */
261
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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