a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * All Rights Reserved.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Permission is hereby granted, free of charge, to any person obtaining
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * a copy of this software and associated documentation files (the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * "Software"), to deal in the Software without restriction, including
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * without limitation on the rights to use, copy, modify, merge,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * publish, distribute, sublicense, and/or sell copies of the Software,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * and to permit persons to whom the Software is furnished to do so,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * subject to the following conditions:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The above copyright notice and this permission notice (including the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * next paragraph) shall be included in all copies or substantial
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * portions of the Software.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * SOFTWARE.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Authors:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Kevin E. Martin <kem@redhat.com>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/** \file
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Interface for window support. \see dmxwindow.c */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#ifndef DMXWINDOW_H
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define DMXWINDOW_H
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#include "windowstr.h"
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/** Window private area. */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef struct _dmxWinPriv {
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Window window;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool offscreen;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool mapped;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool restacked;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync unsigned long attribMask;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Colormap cmap;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Visual *visual;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool isShaped;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool hasPict;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#ifdef GLXEXT
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void *swapGroup;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int barrier;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void (*windowDestroyed) (WindowPtr);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void (*windowUnmapped) (WindowPtr);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#endif
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync} dmxWinPrivRec, *dmxWinPrivPtr;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern Bool dmxInitWindow(ScreenPtr pScreen);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern Window dmxCreateRootWindow(WindowPtr pWindow);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Colormap * cmap, Visual ** visual);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern Bool dmxCreateWindow(WindowPtr pWindow);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern Bool dmxDestroyWindow(WindowPtr pWindow);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern Bool dmxRealizeWindow(WindowPtr pWindow);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern Bool dmxUnrealizeWindow(WindowPtr pWindow);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync RegionPtr other_exposed);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync RegionPtr prgnSrc);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern void dmxResizeWindow(WindowPtr pWindow, int x, int y,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync unsigned int w, unsigned int h, WindowPtr pSib);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern void dmxResizeScreenWindow(ScreenPtr pScreen,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int x, int y, int w, int h);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern void dmxResizeRootWindow(WindowPtr pRoot, int x, int y, int w, int h);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern Bool dmxBEDestroyWindow(WindowPtr pWindow);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* Support for shape extension */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern void dmxSetShape(WindowPtr pWindow, int kind);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/** Get window private pointer. */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey))
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* All of these macros are only used in dmxwindow.c */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncdo { \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync DMX_UNWRAP(funcs, pGCPriv, (_pGC)); \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync if (pGCPriv->ops) \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync DMX_UNWRAP(ops, pGCPriv, (_pGC)); \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync} while (0)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define DMX_WINDOW_FUNC_EPILOGUE(_pGC) \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncdo { \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync DMX_WRAP(funcs, &dmxGCFuncs, pGCPriv, (_pGC)); \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync if (pGCPriv->ops) \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync DMX_WRAP(ops, &dmxGCOps, pGCPriv, (_pGC)); \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync} while (0)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define DMX_WINDOW_X1(_pWin) \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ((_pWin)->drawable.x - wBorderWidth(_pWin))
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define DMX_WINDOW_Y1(_pWin) \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ((_pWin)->drawable.y - wBorderWidth(_pWin))
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define DMX_WINDOW_X2(_pWin) \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ((_pWin)->drawable.x + wBorderWidth(_pWin) + (_pWin)->drawable.width)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define DMX_WINDOW_Y2(_pWin) \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ((_pWin)->drawable.y + wBorderWidth(_pWin) + (_pWin)->drawable.height)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define DMX_WINDOW_OFFSCREEN(_pWin) \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync (DMX_WINDOW_X1(_pWin) >= (_pWin)->drawable.pScreen->width || \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync DMX_WINDOW_Y1(_pWin) >= (_pWin)->drawable.pScreen->height || \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync DMX_WINDOW_X2(_pWin) <= 0 || \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync DMX_WINDOW_Y2(_pWin) <= 0)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#endif /* DMXWINDOW_H */