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