dmxwindow.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
  3. *
  4. * All Rights Reserved.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining
  7. * a copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation on the rights to use, copy, modify, merge,
  10. * publish, distribute, sublicense, and/or sell copies of the Software,
  11. * and to permit persons to whom the Software is furnished to do so,
  12. * subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice (including the
  15. * next paragraph) shall be included in all copies or substantial
  16. * portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  19. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  21. * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
  22. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  23. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  25. * SOFTWARE.
  26. */
  27. /*
  28. * Authors:
  29. * Kevin E. Martin <kem@redhat.com>
  30. *
  31. */
  32. /** \file
  33. * Interface for window support. \see dmxwindow.c */
  34. #ifndef DMXWINDOW_H
  35. #define DMXWINDOW_H
  36. #include "windowstr.h"
  37. /** Window private area. */
  38. typedef struct _dmxWinPriv {
  39. Window window;
  40. Bool offscreen;
  41. Bool mapped;
  42. Bool restacked;
  43. unsigned long attribMask;
  44. Colormap cmap;
  45. Visual *visual;
  46. Bool isShaped;
  47. Bool hasPict;
  48. #ifdef GLXEXT
  49. void *swapGroup;
  50. int barrier;
  51. void (*windowDestroyed) (WindowPtr);
  52. void (*windowUnmapped) (WindowPtr);
  53. #endif
  54. } dmxWinPrivRec, *dmxWinPrivPtr;
  55. extern Bool dmxInitWindow(ScreenPtr pScreen);
  56. extern Window dmxCreateRootWindow(WindowPtr pWindow);
  57. extern void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
  58. Colormap * cmap, Visual ** visual);
  59. extern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync);
  60. extern Bool dmxCreateWindow(WindowPtr pWindow);
  61. extern Bool dmxDestroyWindow(WindowPtr pWindow);
  62. extern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y);
  63. extern Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask);
  64. extern Bool dmxRealizeWindow(WindowPtr pWindow);
  65. extern Bool dmxUnrealizeWindow(WindowPtr pWindow);
  66. extern void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib);
  67. extern void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
  68. RegionPtr other_exposed);
  69. extern void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
  70. RegionPtr prgnSrc);
  71. extern void dmxResizeWindow(WindowPtr pWindow, int x, int y,
  72. unsigned int w, unsigned int h, WindowPtr pSib);
  73. extern void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent);
  74. extern void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width);
  75. extern void dmxResizeScreenWindow(ScreenPtr pScreen,
  76. int x, int y, int w, int h);
  77. extern void dmxResizeRootWindow(WindowPtr pRoot, int x, int y, int w, int h);
  78. extern Bool dmxBEDestroyWindow(WindowPtr pWindow);
  79. /* Support for shape extension */
  80. extern void dmxSetShape(WindowPtr pWindow, int kind);
  81. /** Get window private pointer. */
  82. #define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \
  83. dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey))
  84. /* All of these macros are only used in dmxwindow.c */
  85. #define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \
  86. do { \
  87. dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
  88. DMX_UNWRAP(funcs, pGCPriv, (_pGC)); \
  89. if (pGCPriv->ops) \
  90. DMX_UNWRAP(ops, pGCPriv, (_pGC)); \
  91. } while (0)
  92. #define DMX_WINDOW_FUNC_EPILOGUE(_pGC) \
  93. do { \
  94. dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
  95. DMX_WRAP(funcs, &dmxGCFuncs, pGCPriv, (_pGC)); \
  96. if (pGCPriv->ops) \
  97. DMX_WRAP(ops, &dmxGCOps, pGCPriv, (_pGC)); \
  98. } while (0)
  99. #define DMX_WINDOW_X1(_pWin) \
  100. ((_pWin)->drawable.x - wBorderWidth(_pWin))
  101. #define DMX_WINDOW_Y1(_pWin) \
  102. ((_pWin)->drawable.y - wBorderWidth(_pWin))
  103. #define DMX_WINDOW_X2(_pWin) \
  104. ((_pWin)->drawable.x + wBorderWidth(_pWin) + (_pWin)->drawable.width)
  105. #define DMX_WINDOW_Y2(_pWin) \
  106. ((_pWin)->drawable.y + wBorderWidth(_pWin) + (_pWin)->drawable.height)
  107. #define DMX_WINDOW_OFFSCREEN(_pWin) \
  108. (DMX_WINDOW_X1(_pWin) >= (_pWin)->drawable.pScreen->width || \
  109. DMX_WINDOW_Y1(_pWin) >= (_pWin)->drawable.pScreen->height || \
  110. DMX_WINDOW_X2(_pWin) <= 0 || \
  111. DMX_WINDOW_Y2(_pWin) <= 0)
  112. #endif /* DMXWINDOW_H */