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