45e9809aff7304721fddb95654901b32195c9c7avboxsync * Common internal rootless definitions and code
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright (c) 2001 Greg Parker. All Rights Reserved.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission is hereby granted, free of charge, to any person obtaining a
45e9809aff7304721fddb95654901b32195c9c7avboxsync * copy of this software and associated documentation files (the "Software"),
45e9809aff7304721fddb95654901b32195c9c7avboxsync * to deal in the Software without restriction, including without limitation
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * and/or sell copies of the Software, and to permit persons to whom the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Software is furnished to do so, subject to the following conditions:
45e9809aff7304721fddb95654901b32195c9c7avboxsync * The above copyright notice and this permission notice shall be included in
45e9809aff7304721fddb95654901b32195c9c7avboxsync * all copies or substantial portions of the Software.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
45e9809aff7304721fddb95654901b32195c9c7avboxsync * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
45e9809aff7304721fddb95654901b32195c9c7avboxsync * DEALINGS IN THE SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Except as contained in this notice, the name(s) of the above copyright
45e9809aff7304721fddb95654901b32195c9c7avboxsync * holders shall not be used in advertising or otherwise to promote the sale,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * use or other dealings in this Software without prior written authorization.
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Debug output, or not.
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Global variables
45e9809aff7304721fddb95654901b32195c9c7avboxsync// RootlessGCRec: private per-gc data
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct {
45e9809aff7304721fddb95654901b32195c9c7avboxsync// RootlessScreenRec: per-screen private data
45e9809aff7304721fddb95654901b32195c9c7avboxsync // Rootless implementation functions
45e9809aff7304721fddb95654901b32195c9c7avboxsync // Wrapped screen functions
45e9809aff7304721fddb95654901b32195c9c7avboxsync CreateScreenResourcesProcPtr CreateScreenResources;
45e9809aff7304721fddb95654901b32195c9c7avboxsync ChangeWindowAttributesProcPtr ChangeWindowAttributes;
45e9809aff7304721fddb95654901b32195c9c7avboxsync PaintWindowBackgroundProcPtr PaintWindowBackground;
45e9809aff7304721fddb95654901b32195c9c7avboxsync MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
45e9809aff7304721fddb95654901b32195c9c7avboxsync// "Definition of the Porting Layer for the X11 Sample Server" says
45e9809aff7304721fddb95654901b32195c9c7avboxsync// unwrap and rewrap of screen functions is unnecessary, but
45e9809aff7304721fddb95654901b32195c9c7avboxsync// screen->CreateGC changes after a call to cfbCreateGC.
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Accessors for screen and window privates
45e9809aff7304721fddb95654901b32195c9c7avboxsync ((RootlessScreenRec *)(pScreen)->devPrivates[rootlessScreenPrivateIndex].ptr)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ((RootlessWindowRec *)(pWin)->devPrivates[rootlessWindowPrivateIndex].ptr)
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Call a rootless implementation function.
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Many rootless implementation functions are allowed to be NULL.
45e9809aff7304721fddb95654901b32195c9c7avboxsync// BoxRec manipulators
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Copied from shadowfb
45e9809aff7304721fddb95654901b32195c9c7avboxsync (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
45e9809aff7304721fddb95654901b32195c9c7avboxsync// HUGE_ROOT and NORMAL_ROOT
45e9809aff7304721fddb95654901b32195c9c7avboxsync// We don't want to clip windows to the edge of the screen.
45e9809aff7304721fddb95654901b32195c9c7avboxsync// HUGE_ROOT temporarily makes the root window really big.
45e9809aff7304721fddb95654901b32195c9c7avboxsync// This is needed as a wrapper around any function that calls
45e9809aff7304721fddb95654901b32195c9c7avboxsync// SetWinSize or SetBorderSize which clip a window against its
45e9809aff7304721fddb95654901b32195c9c7avboxsync// parents, including the root.
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (w->parent) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync } while (0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (w->parent) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync } while (0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Returns TRUE if this window is a top-level window (i.e. child of the root)
45e9809aff7304721fddb95654901b32195c9c7avboxsync// The root is not a top-level window.
45e9809aff7304721fddb95654901b32195c9c7avboxsync ((pWin) && (pWin)->parent && !(pWin)->parent->parent)
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Returns TRUE if this window is a root window
45e9809aff7304721fddb95654901b32195c9c7avboxsync ((pWin) == WindowTable[(pWin)->drawable.pScreen->myNum])
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SetPixmapBaseToScreen
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Move the given pixmap's base address to where pixel (0, 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync * would be if the pixmap's actual data started at (x, y).
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Can't access the bits before the first word of the drawable's data in
45e9809aff7304721fddb95654901b32195c9c7avboxsync * rootless mode, so make sure our base address is always 32-bit aligned.
45e9809aff7304721fddb95654901b32195c9c7avboxsync _pPix->devPrivate.ptr = (char *) (_pPix->devPrivate.ptr) - \
45e9809aff7304721fddb95654901b32195c9c7avboxsync unsigned _diff = ((unsigned) _pPix->devPrivate.ptr) & \
45e9809aff7304721fddb95654901b32195c9c7avboxsync _pPix->devPrivate.ptr = (char *) (_pPix->devPrivate.ptr) - \
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Returns TRUE if this window is visible inside a frame
45e9809aff7304721fddb95654901b32195c9c7avboxsync// (e.g. it is visible and has a top-level or root parent)
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Routines that cause regions to get redrawn.
45e9809aff7304721fddb95654901b32195c9c7avboxsync// DamageRegion and DamageRect are in global coordinates.
45e9809aff7304721fddb95654901b32195c9c7avboxsync// DamageBox is in window-local coordinates.
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid RootlessDamageRect(WindowPtr pWindow, int x, int y, int w, int h);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid RootlessDamageBox(WindowPtr pWindow, BoxPtr pBox);
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Move a window to its proper location on the screen.
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Move the window to it's correct place in the physical stacking order.
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* _ROOTLESSCOMMON_H */