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