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