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