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