Xwindows.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. Copyright 1996, 1998 The Open Group
  3. Permission to use, copy, modify, distribute, and sell this software and its
  4. documentation for any purpose is hereby granted without fee, provided that
  5. the above copyright notice appear in all copies and that both that
  6. copyright notice and this permission notice appear in supporting
  7. documentation.
  8. The above copyright notice and this permission notice shall be included
  9. in all copies or substantial portions of the Software.
  10. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  11. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
  12. ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
  13. SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
  14. ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  16. IN THE SOFTWARE.
  17. Except as contained in this notice, the name of The Open Group shall
  18. not be used in advertising or otherwise to promote the sale, use or
  19. other dealings in this Software without prior written authorization from
  20. The Open Group.
  21. */
  22. /*
  23. * This header file has the sole purpose of allowing the inclusion of
  24. * windows.h without getting any name conflicts with X headers code, by
  25. * renaming or disabling the conflicting definitions from windows.h
  26. */
  27. /*
  28. * Mingw.org versions of the Windows API headers actually avoid
  29. * making the conflicting definitions if XFree86Server is defined, so we
  30. * need to remember if that was defined and undefine it during including
  31. * windows.h (so the conflicting definitions get wrapped correctly), and
  32. * then redefine it afterwards. (This was never the correct thing to
  33. * do as it's no help at all to X11 clients which also need to use the
  34. * Win32 API)
  35. */
  36. #undef _XFree86Server
  37. #ifdef XFree86Server
  38. # define _XFree86Server
  39. # undef XFree86Server
  40. #endif
  41. /*
  42. * There doesn't seem to be a good way to wrap the min/max macros from
  43. * windows.h, so we simply avoid defining them completely, allowing any
  44. * pre-existing definition to stand.
  45. *
  46. */
  47. #define NOMINMAX
  48. /*
  49. * mingw-w64 headers define BOOL as a typedef, protecting against macros
  50. * mingw.org headers define BOOL in terms of WINBOOL
  51. * ... so try to come up with something which works with both :-)
  52. */
  53. #define _NO_BOOL_TYPEDEF
  54. #define BOOL WINBOOL
  55. #define INT32 wINT32
  56. #ifdef __x86_64__
  57. #define INT64 wINT64
  58. #define LONG64 wLONG64
  59. #endif
  60. #undef Status
  61. #define Status wStatus
  62. #define ATOM wATOM
  63. #define BYTE wBYTE
  64. #define FreeResource wFreeResource
  65. #include <windows.h>
  66. #undef NOMINMAX
  67. #undef Status
  68. #define Status int
  69. #undef BYTE
  70. #undef BOOL
  71. #undef INT32
  72. #undef INT64
  73. #undef LONG64
  74. #undef ATOM
  75. #undef FreeResource
  76. #undef CreateWindowA
  77. /*
  78. * Older version of this header used to name the windows API bool type wBOOL,
  79. * rather than more standard name WINBOOL
  80. */
  81. #define wBOOL WINBOOL
  82. #ifdef RESOURCE_H
  83. # undef RT_FONT
  84. # undef RT_CURSOR
  85. # define RT_FONT ((RESTYPE)4)
  86. # define RT_CURSOR ((RESTYPE)5)
  87. #endif
  88. #ifndef __CYGWIN__
  89. #define sleep(x) Sleep((x) * 1000)
  90. #endif
  91. #if defined(WIN32) && (!defined(PATH_MAX) || PATH_MAX < 1024)
  92. # undef PATH_MAX
  93. # define PATH_MAX 1024
  94. #endif
  95. #ifdef _XFree86Server
  96. # define XFree86Server
  97. # undef _XFree86Server
  98. #endif