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