a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/***********************************************************
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncCopyright 1987, 1989, 1998 The Open Group
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncPermission to use, copy, modify, distribute, and sell this software and its
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncdocumentation for any purpose is hereby granted without fee, provided that
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncthe above copyright notice appear in all copies and that both that
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynccopyright notice and this permission notice appear in supporting
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncdocumentation.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncThe above copyright notice and this permission notice shall be included in
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncall copies or substantial portions of the Software.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncExcept as contained in this notice, the name of The Open Group shall not be
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncused in advertising or otherwise to promote the sale, use or other dealings
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncin this Software without prior written authorization from The Open Group.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncCopyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync All Rights Reserved
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncPermission to use, copy, modify, and distribute this software and its
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncdocumentation for any purpose and without fee is hereby granted,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncprovided that the above copyright notice appear in all copies and that
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncboth that copyright notice and this permission notice appear in
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncsupporting documentation, and that the name of Digital not be
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncused in advertising or publicity pertaining to distribution of the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncsoftware without specific, written prior permission.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync******************************************************************/
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/*****************************************************************
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * STUFF FOR RESOURCES
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *****************************************************************/
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* classes for Resource routines */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* Use class RC_NEVERRETAIN for resources that should not be retained
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * regardless of the close down mode when the client dies. (A client's
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * event selections on objects that it doesn't own are good candidates.)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Extensions can use this too!
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* types for Resource routines */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* bits and fields within a resource id */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* client field offset */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define CLIENTOFFSET (RESOURCE_AND_CLIENT_COUNT - RESOURCE_CLIENT_BITS)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* resource field */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* client field */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define RESOURCE_CLIENT_MASK (((1 << RESOURCE_CLIENT_BITS) - 1) << CLIENTOFFSET)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* extract the client mask from an XID */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* extract the client id from an XID */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define SERVER_BIT (Mask)0x40000000 /* use illegal bit */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* Invalid resource id */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* Resource state callback */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT CallbackListPtr ResourceStateCallback;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef struct {
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef Bool (*FindComplexResType) (pointer /*value */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* Structure for estimating resource memory usage. Memory usage
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * consists of space allocated for the resource itself and of
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * references to other resources. Currently the most important use for
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * this structure is to estimate pixmap usage of different resources
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * more accurately. */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef struct {
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /* Size of resource itself. Zero if not implemented. */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /* Size attributed to pixmap references from the resource. */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /* Number of references to this resource; typically 1 */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT RESTYPE CreateNewResourceType(DeleteType /*deleteFunc */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync const char * /*name */ );
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef void (*FindTypeSubResources)(pointer /* value */,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void SetResourceTypeFindSubResFunc(
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync RESTYPE /*type*/, FindTypeSubResources /*findFunc*/);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT RESTYPE CreateNewResourceClass(void);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT Bool InitClientResources(ClientPtr /*client */ );
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT XID FakeClientID(int /*client */ );
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* Quartz support on Mac OS X uses the CarbonCore
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync framework whose AddResource function conflicts here. */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void FreeResourceByType(XID /*id */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT Bool ChangeResourceValue(XID /*id */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void FindClientResourcesByType(ClientPtr /*client */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void FindAllClientResources(ClientPtr /*client */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/** @brief Iterate through all subresources of a resource.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync @note The XID argument provided to the FindAllRes function
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync may be 0 for subresources that don't have an XID */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void FindSubResources(pointer /*resource*/,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void FreeClientNeverRetainResources(ClientPtr /*client */ );
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void FreeClientResources(ClientPtr /*client */ );
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT pointer LookupClientResourceComplex(ClientPtr client,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT int dixLookupResourceByType(pointer *result,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT int dixLookupResourceByClass(pointer *result,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT unsigned int GetXIDList(ClientPtr /*client */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync unsigned int /*count */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/** @brief A hashing function to be used for hashing resource IDs
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync @param id The resource ID to hash
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync @param numBits The number of bits in the resulting hash. Must be >=0.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync @note This function is really only for handling
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync INITHASHSIZE..MAXHASHSIZE bit hashes, but will handle any number
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync of bits by either masking numBits lower bits of the ID or by
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync providing at most MAXHASHSIZE hashes.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#endif /* RESOURCE_H */