a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync/*
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * Common internal rootless definitions and code
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync */
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync/*
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * Copyright (c) 2001 Greg Parker. All Rights Reserved.
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync *
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * Permission is hereby granted, free of charge, to any person obtaining a
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * copy of this software and associated documentation files (the "Software"),
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * to deal in the Software without restriction, including without limitation
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * and/or sell copies of the Software, and to permit persons to whom the
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * Software is furnished to do so, subject to the following conditions:
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync *
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * The above copyright notice and this permission notice shall be included in
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * all copies or substantial portions of the Software.
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync *
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * DEALINGS IN THE SOFTWARE.
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync *
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * Except as contained in this notice, the name(s) of the above copyright
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * holders shall not be used in advertising or otherwise to promote the sale,
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync * use or other dealings in this Software without prior written authorization.
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync */
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#ifdef HAVE_DIX_CONFIG_H
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#include <dix-config.h>
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#endif
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#include <stdint.h>
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#ifndef _ROOTLESSCOMMON_H
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define _ROOTLESSCOMMON_H
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#include "rootless.h"
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#include "fb.h"
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#ifdef SHAPE
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#include "scrnintstr.h"
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#endif /* SHAPE */
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#ifdef RENDER
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#include "picturestr.h"
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#endif
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// Debug output, or not.
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#ifdef ROOTLESSDEBUG
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define RL_DEBUG_MSG ErrorF
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#else
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define RL_DEBUG_MSG(a, ...)
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#endif
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// Global variables
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsyncextern DevPrivateKey rootlessGCPrivateKey;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsyncextern DevPrivateKey rootlessScreenPrivateKey;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsyncextern DevPrivateKey rootlessWindowPrivateKey;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsyncextern DevPrivateKey rootlessWindowOldPixmapPrivateKey;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// RootlessGCRec: private per-gc data
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsynctypedef struct {
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync GCFuncs *originalFuncs;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync GCOps *originalOps;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync} RootlessGCRec;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// RootlessScreenRec: per-screen private data
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsynctypedef struct _RootlessScreenRec {
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync // Rootless implementation functions
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync RootlessFrameProcsPtr imp;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync // Wrapped screen functions
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync CreateScreenResourcesProcPtr CreateScreenResources;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync CloseScreenProcPtr CloseScreen;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync CreateWindowProcPtr CreateWindow;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync DestroyWindowProcPtr DestroyWindow;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync RealizeWindowProcPtr RealizeWindow;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync UnrealizeWindowProcPtr UnrealizeWindow;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync MoveWindowProcPtr MoveWindow;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync ResizeWindowProcPtr ResizeWindow;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync RestackWindowProcPtr RestackWindow;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync ReparentWindowProcPtr ReparentWindow;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync ChangeBorderWidthProcPtr ChangeBorderWidth;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync PositionWindowProcPtr PositionWindow;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync ChangeWindowAttributesProcPtr ChangeWindowAttributes;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync CreateGCProcPtr CreateGC;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync CopyWindowProcPtr CopyWindow;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync GetImageProcPtr GetImage;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync SourceValidateProcPtr SourceValidate;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync ValidateTreeProcPtr ValidateTree;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#ifdef SHAPE
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync SetShapeProcPtr SetShape;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#endif
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#ifdef RENDER
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync CompositeProcPtr Composite;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync GlyphsProcPtr Glyphs;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#endif
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync InstallColormapProcPtr InstallColormap;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync UninstallColormapProcPtr UninstallColormap;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync StoreColorsProcPtr StoreColors;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync void *pixmap_data;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync unsigned int pixmap_data_size;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync ColormapPtr colormap;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync void *redisplay_timer;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync unsigned int redisplay_timer_set :1;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync unsigned int redisplay_queued :1;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync unsigned int redisplay_expired :1;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync unsigned int colormap_changed :1;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync} RootlessScreenRec, *RootlessScreenPtr;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#undef MIN
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define MIN(x,y) ((x) < (y) ? (x) : (y))
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#undef MAX
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define MAX(x,y) ((x) > (y) ? (x) : (y))
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// "Definition of the Porting Layer for the X11 Sample Server" says
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// unwrap and rewrap of screen functions is unnecessary, but
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// screen->CreateGC changes after a call to cfbCreateGC.
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define SCREEN_UNWRAP(screen, fn) \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync screen->fn = SCREENREC(screen)->fn;
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define SCREEN_WRAP(screen, fn) \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync SCREENREC(screen)->fn = screen->fn; \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync screen->fn = Rootless##fn
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// Accessors for screen and window privates
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define SCREENREC(pScreen) ((RootlessScreenRec *) \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync dixLookupPrivate(&(pScreen)->devPrivates, rootlessScreenPrivateKey))
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define SETSCREENREC(pScreen, v) \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync dixSetPrivate(&(pScreen)->devPrivates, rootlessScreenPrivateKey, v)
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define WINREC(pWin) ((RootlessWindowRec *) \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync dixLookupPrivate(&(pWin)->devPrivates, rootlessWindowPrivateKey))
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define SETWINREC(pWin, v) \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync dixSetPrivate(&(pWin)->devPrivates, rootlessWindowPrivateKey, v)
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// Call a rootless implementation function.
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// Many rootless implementation functions are allowed to be NULL.
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define CallFrameProc(pScreen, proc, params) \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync if (SCREENREC(pScreen)->frameProcs.proc) { \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync RL_DEBUG_MSG("calling frame proc " #proc " "); \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync SCREENREC(pScreen)->frameProcs.proc params; \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync }
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// BoxRec manipulators
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync// Copied from shadowfb
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define TRIM_BOX(box, pGC) { \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync BoxPtr extents = &pGC->pCompositeClip->extents;\
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync if(box.x1 < extents->x1) box.x1 = extents->x1; \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync if(box.x2 > extents->x2) box.x2 = extents->x2; \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync if(box.y1 < extents->y1) box.y1 = extents->y1; \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync if(box.y2 > extents->y2) box.y2 = extents->y2; \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync}
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define TRANSLATE_BOX(box, pDraw) { \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync box.x1 += pDraw->x; \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync box.x2 += pDraw->x; \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync box.y1 += pDraw->y; \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync box.y2 += pDraw->y; \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync}
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync#define TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC) { \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync TRANSLATE_BOX(box, pDraw); \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync TRIM_BOX(box, pGC); \
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync}
a1c5f8454dc8516e7a0f41bd274a34c20d6e113dvboxsync
#define BOX_NOT_EMPTY(box) \
(((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
// HUGE_ROOT and NORMAL_ROOT
// We don't want to clip windows to the edge of the screen.
// HUGE_ROOT temporarily makes the root window really big.
// This is needed as a wrapper around any function that calls
// SetWinSize or SetBorderSize which clip a window against its
// parents, including the root.
extern RegionRec rootlessHugeRoot;
#define HUGE_ROOT(pWin) \
do { \
WindowPtr w = pWin; \
while (w->parent) \
w = w->parent; \
saveRoot = w->winSize; \
w->winSize = rootlessHugeRoot; \
} while (0)
#define NORMAL_ROOT(pWin) \
do { \
WindowPtr w = pWin; \
while (w->parent) \
w = w->parent; \
w->winSize = saveRoot; \
} while (0)
// Returns TRUE if this window is a top-level window (i.e. child of the root)
// The root is not a top-level window.
#define IsTopLevel(pWin) \
((pWin) && (pWin)->parent && !(pWin)->parent->parent)
// Returns TRUE if this window is a root window
#define IsRoot(pWin) \
((pWin) == WindowTable[(pWin)->drawable.pScreen->myNum])
/*
* SetPixmapBaseToScreen
* Move the given pixmap's base address to where pixel (0, 0)
* would be if the pixmap's actual data started at (x, y).
* Can't access the bits before the first word of the drawable's data in
* rootless mode, so make sure our base address is always 32-bit aligned.
*/
#define SetPixmapBaseToScreen(pix, _x, _y) { \
PixmapPtr _pPix = (PixmapPtr) (pix); \
_pPix->devPrivate.ptr = (char *) (_pPix->devPrivate.ptr) - \
((int)(_x) * _pPix->drawable.bitsPerPixel/8 + \
(int)(_y) * _pPix->devKind); \
if (_pPix->drawable.bitsPerPixel != FB_UNIT) { \
unsigned _diff = ((unsigned) _pPix->devPrivate.ptr) & \
(FB_UNIT / CHAR_BIT - 1); \
_pPix->devPrivate.ptr = (char *) (_pPix->devPrivate.ptr) - \
_diff; \
_pPix->drawable.x = _diff / \
(_pPix->drawable.bitsPerPixel / CHAR_BIT); \
} \
}
// Returns TRUE if this window is visible inside a frame
// (e.g. it is visible and has a top-level or root parent)
Bool IsFramedWindow(WindowPtr pWin);
// Routines that cause regions to get redrawn.
// DamageRegion and DamageRect are in global coordinates.
// DamageBox is in window-local coordinates.
void RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion);
void RootlessDamageRect(WindowPtr pWindow, int x, int y, int w, int h);
void RootlessDamageBox(WindowPtr pWindow, BoxPtr pBox);
void RootlessRedisplay(WindowPtr pWindow);
void RootlessRedisplayScreen(ScreenPtr pScreen);
void RootlessQueueRedisplay(ScreenPtr pScreen);
/* Return the colormap currently installed on the given screen. */
ColormapPtr RootlessGetColormap (ScreenPtr pScreen);
/* Convert colormap to ARGB. */
Bool RootlessResolveColormap (ScreenPtr pScreen, int first_color,
int n_colors, uint32_t *colors);
void RootlessFlushWindowColormap (WindowPtr pWin);
void RootlessFlushScreenColormaps (ScreenPtr pScreen);
// Move a window to its proper location on the screen.
void RootlessRepositionWindow(WindowPtr pWin);
// Move the window to it's correct place in the physical stacking order.
void RootlessReorderWindow(WindowPtr pWin);
#endif /* _ROOTLESSCOMMON_H */