resource.h revision deb4998ba50060c48cce222fd18a8eed053918d7
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/***********************************************************
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncCopyright 1987, 1989, 1998 The Open Group
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncPermission to use, copy, modify, distribute, and sell this software and its
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncdocumentation for any purpose is hereby granted without fee, provided that
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncthe above copyright notice appear in all copies and that both that
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynccopyright notice and this permission notice appear in supporting
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncdocumentation.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncThe above copyright notice and this permission notice shall be included in
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncall copies or substantial portions of the Software.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncExcept as contained in this notice, the name of The Open Group shall not be
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncused in advertising or otherwise to promote the sale, use or other dealings
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncin this Software without prior written authorization from The Open Group.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncCopyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync All Rights Reserved
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncPermission to use, copy, modify, and distribute this software and its
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncdocumentation for any purpose and without fee is hereby granted,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncprovided that the above copyright notice appear in all copies and that
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncboth that copyright notice and this permission notice appear in
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncsupporting documentation, and that the name of Digital not be
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncused in advertising or publicity pertaining to distribution of the
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncsoftware without specific, written prior permission.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync******************************************************************/
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/*****************************************************************
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * STUFF FOR RESOURCES
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync *****************************************************************/
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* classes for Resource routines */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef unsigned long RESTYPE;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* Use class RC_NEVERRETAIN for resources that should not be retained
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * regardless of the close down mode when the client dies. (A client's
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * event selections on objects that it doesn't own are good candidates.)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * Extensions can use this too!
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* types for Resource routines */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define RT_WINDOW ((RESTYPE)1|RC_CACHED|RC_DRAWABLE)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define RT_PIXMAP ((RESTYPE)2|RC_CACHED|RC_DRAWABLE)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* bits and fields within a resource id */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* client field offset */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define CLIENTOFFSET (RESOURCE_AND_CLIENT_COUNT - RESOURCE_CLIENT_BITS)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* resource field */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* client field */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define RESOURCE_CLIENT_MASK (((1 << RESOURCE_CLIENT_BITS) - 1) << CLIENTOFFSET)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* extract the client mask from an XID */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK)
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* extract the client id from an XID */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define SERVER_BIT (Mask)0x40000000 /* use illegal bit */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* Invalid resource id */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef int (*DeleteType)(
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef void (*FindResType)(
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynctypedef void (*FindAllRes)(
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync int /*client*/);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* Quartz support on Mac OS X uses the CarbonCore
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync framework whose AddResource function conflicts here. */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncextern void FreeAllResources(void);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* These are the access modes that can be passed in the last parameter
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * to SecurityLookupIDByType/Class. The Security extension doesn't
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * currently make much use of these; they're mainly provided as an
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * example of what you might need for discretionary access control.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * You can or these values together to indicate multiple modes
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync * simultaneously.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define SecurityUnknownAccess 0 /* don't know intentions */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define SecurityReadAccess (1<<0) /* inspecting the object */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define SecurityWriteAccess (1<<1) /* changing the object */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#define SecurityDestroyAccess (1<<2) /* destroying the object */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync int /*client*/,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncextern unsigned int GetXIDList(
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync unsigned int /*count*/,
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncvoid RegisterResourceName(RESTYPE type, char* name);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync#endif /* RESOURCE_H */