dmxwindow.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
00003  *
00004  * All Rights Reserved.
00005  *
00006  * Permission is hereby granted, free of charge, to any person obtaining
00007  * a copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation on the rights to use, copy, modify, merge,
00010  * publish, distribute, sublicense, and/or sell copies of the Software,
00011  * and to permit persons to whom the Software is furnished to do so,
00012  * subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial
00016  * portions of the Software.
00017  *
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00019  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00021  * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
00022  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00023  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00024  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00025  * SOFTWARE.
00026  */
00027 
00028 /*
00029  * Authors:
00030  *   Kevin E. Martin <kem@redhat.com>
00031  *
00032  */
00033 
00037 #ifndef DMXWINDOW_H
00038 #define DMXWINDOW_H
00039 
00040 #include "windowstr.h"
00041 
00043 typedef struct _dmxWinPriv {
00044     Window         window;
00045     Bool           offscreen;
00046     Bool           mapped;
00047     Bool           restacked;
00048     unsigned long  attribMask;
00049     Colormap       cmap;
00050     Visual        *visual;
00051     Bool           isShaped;
00052     Bool           hasPict;
00053 #ifdef GLXEXT
00054     void          *swapGroup;
00055     int            barrier;
00056     void         (*windowDestroyed)(WindowPtr);
00057     void         (*windowUnmapped)(WindowPtr);
00058 #endif
00059 } dmxWinPrivRec, *dmxWinPrivPtr;
00060 
00061 
00062 extern Bool dmxInitWindow(ScreenPtr pScreen);
00063 
00064 extern Window dmxCreateRootWindow(WindowPtr pWindow);
00065 
00066 extern void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
00067                                           Colormap *cmap,
00068                                           Visual **visual);
00069 extern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync);
00070 
00071 extern Bool dmxCreateWindow(WindowPtr pWindow);
00072 extern Bool dmxDestroyWindow(WindowPtr pWindow);
00073 extern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y);
00074 extern Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask);
00075 extern Bool dmxRealizeWindow(WindowPtr pWindow);
00076 extern Bool dmxUnrealizeWindow(WindowPtr pWindow);
00077 extern void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib);
00078 extern void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
00079                                RegionPtr other_exposed);
00080 extern void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
00081                           RegionPtr prgnSrc);
00082 
00083 extern void dmxResizeWindow(WindowPtr pWindow, int x, int y,
00084                             unsigned int w, unsigned int h, WindowPtr pSib);
00085 extern void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent);
00086 
00087 extern void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width);
00088 
00089 extern void dmxResizeScreenWindow(ScreenPtr pScreen,
00090                                   int x, int y, int w, int h);
00091 extern void dmxResizeRootWindow(WindowPtr pRoot,
00092                                 int x, int y, int w, int h);
00093 
00094 extern Bool dmxBEDestroyWindow(WindowPtr pWindow);
00095 
00096 /* Support for shape extension */
00097 extern void dmxSetShape(WindowPtr pWindow, int kind);
00098 
00100 #define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \
00101     dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey))
00102 
00103 /* All of these macros are only used in dmxwindow.c */
00104 #define DMX_WINDOW_FUNC_PROLOGUE(_pGC)                                  \
00105 do {                                                                    \
00106     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC);                       \
00107     DMX_UNWRAP(funcs, pGCPriv, (_pGC));                                 \
00108     if (pGCPriv->ops)                                                   \
00109         DMX_UNWRAP(ops, pGCPriv, (_pGC));                               \
00110 } while (0)
00111 
00112 #define DMX_WINDOW_FUNC_EPILOGUE(_pGC)                                  \
00113 do {                                                                    \
00114     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC);                       \
00115     DMX_WRAP(funcs, &dmxGCFuncs, pGCPriv, (_pGC));                      \
00116     if (pGCPriv->ops)                                                   \
00117         DMX_WRAP(ops, &dmxGCOps, pGCPriv, (_pGC));                      \
00118 } while (0)
00119 
00120 #define DMX_WINDOW_X1(_pWin)                                            \
00121     ((_pWin)->drawable.x - wBorderWidth(_pWin))
00122 #define DMX_WINDOW_Y1(_pWin)                                            \
00123     ((_pWin)->drawable.y - wBorderWidth(_pWin))
00124 #define DMX_WINDOW_X2(_pWin)                                            \
00125     ((_pWin)->drawable.x + wBorderWidth(_pWin) + (_pWin)->drawable.width) 
00126 #define DMX_WINDOW_Y2(_pWin)                                            \
00127     ((_pWin)->drawable.y + wBorderWidth(_pWin) + (_pWin)->drawable.height) 
00128 
00129 #define DMX_WINDOW_OFFSCREEN(_pWin)                                     \
00130     (DMX_WINDOW_X1(_pWin) >= (_pWin)->drawable.pScreen->width  ||       \
00131      DMX_WINDOW_Y1(_pWin) >= (_pWin)->drawable.pScreen->height ||       \
00132      DMX_WINDOW_X2(_pWin) <= 0                                 ||       \
00133      DMX_WINDOW_Y2(_pWin) <= 0)
00134 
00135 #endif /* DMXWINDOW_H */