home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / include / resource.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-03  |  2.9 KB  |  84 lines

  1. /* $XConsortium: resource.h,v 1.12 91/05/03 17:57:10 keith Exp $ */
  2. /***********************************************************
  3. Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts,
  4. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  5.  
  6.                         All Rights Reserved
  7.  
  8. Permission to use, copy, modify, and distribute this software and its 
  9. documentation for any purpose and without fee is hereby granted, 
  10. provided that the above copyright notice appear in all copies and that
  11. both that copyright notice and this permission notice appear in 
  12. supporting documentation, and that the names of Digital or MIT not be
  13. used in advertising or publicity pertaining to distribution of the
  14. software without specific, written prior permission.  
  15.  
  16. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  18. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  19. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22. SOFTWARE.
  23.  
  24. ******************************************************************/
  25. #ifndef RESOURCE_H
  26. #define RESOURCE_H 1
  27. #include "misc.h"
  28.  
  29. /*****************************************************************
  30.  * STUFF FOR RESOURCES 
  31.  *****************************************************************/
  32.  
  33. /* classes for Resource routines */
  34.  
  35. typedef unsigned long RESTYPE;
  36.  
  37. #define RC_VANILLA    ((RESTYPE)0)
  38. #define RC_CACHED    ((RESTYPE)1<<31)
  39. #define RC_DRAWABLE    ((RESTYPE)1<<30)
  40. #define RC_LASTPREDEF    RC_DRAWABLE
  41. #define RC_ANY        (~(RESTYPE)0)
  42.  
  43. /* types for Resource routines */
  44.  
  45. #define RT_WINDOW    ((RESTYPE)1|RC_CACHED|RC_DRAWABLE)
  46. #define RT_PIXMAP    ((RESTYPE)2|RC_CACHED|RC_DRAWABLE)
  47. #define RT_GC        ((RESTYPE)3|RC_CACHED)
  48. #define RT_FONT        ((RESTYPE)4)
  49. #define RT_CURSOR    ((RESTYPE)5)
  50. #define RT_COLORMAP    ((RESTYPE)6)
  51. #define RT_CMAPENTRY    ((RESTYPE)7)
  52. #define RT_OTHERCLIENT    ((RESTYPE)8)
  53. #define RT_PASSIVEGRAB    ((RESTYPE)9)
  54. #define RT_LASTPREDEF    RT_PASSIVEGRAB
  55. #define RT_NONE        ((RESTYPE)0)
  56.  
  57. /* bits and fields within a resource id */
  58. #define CLIENTOFFSET 22                    /* client field */
  59. #define RESOURCE_ID_MASK    0x3FFFFF        /* low 22 bits */
  60. #define CLIENT_BITS(id) ((id) & 0x1fc00000)        /* hi 7 bits */
  61. #define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
  62. #define SERVER_BIT        0x20000000        /* use illegal bit */
  63.  
  64. #ifdef INVALID
  65. #undef INVALID    /* needed on HP/UX */
  66. #endif
  67.  
  68. /* Invalid resource id */
  69. #define INVALID    (0)
  70.  
  71. #define BAD_RESOURCE 0xe0000000
  72.  
  73. RESTYPE CreateNewResourceType();
  74. RESTYPE CreateNewResourceClass();
  75. unsigned long FakeClientID();
  76. Bool AddResource();
  77. void FreeResource();
  78. void FreeClientResources();
  79. Bool LegalNewID();
  80. pointer LookupIDByType();
  81. pointer LookupIDByClass();
  82.  
  83. #endif /* RESOURCE_H */
  84.