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