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