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