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