b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * External interface to generic rootless mode
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Copyright (c) 2001 Greg Parker. All Rights Reserved.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Permission is hereby granted, free of charge, to any person obtaining a
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * copy of this software and associated documentation files (the "Software"),
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * to deal in the Software without restriction, including without limitation
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * and/or sell copies of the Software, and to permit persons to whom the
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Software is furnished to do so, subject to the following conditions:
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * The above copyright notice and this permission notice shall be included in
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * all copies or substantial portions of the Software.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * DEALINGS IN THE SOFTWARE.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Except as contained in this notice, the name(s) of the above copyright
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * holders shall not be used in advertising or otherwise to promote the sale,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * use or other dealings in this Software without prior written authorization.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#ifdef HAVE_DIX_CONFIG_H
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#include <dix-config.h>
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#ifndef _ROOTLESS_H
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define _ROOTLESS_H
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#include "rootlessConfig.h"
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#include "mi.h"
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#include "gcstruct.h"
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync Each top-level rootless window has a one-to-one correspondence to a physical
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync on-screen window. The physical window is refered to as a "frame".
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void * RootlessFrameID;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * RootlessWindowRec
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * This structure stores the per-frame data used by the rootless code.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Each top-level X window has one RootlessWindowRec associated with it.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef struct _RootlessWindowRec {
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync // Position and size includes the window border
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync // Position is in per-screen coordinates
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync int x, y;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync unsigned int width, height;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync unsigned int borderWidth;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync int level;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessFrameID wid; // implementation specific frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync WindowPtr win; // underlying X window
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync // Valid only when drawing (ie. is_drawing is set)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync char *pixelData;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync int bytesPerRow;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync PixmapPtr pixmap;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#ifdef ROOTLESS_TRACK_DAMAGE
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RegionRec damage;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync unsigned int is_drawing :1; // Currently drawing?
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync unsigned int is_reorder_pending :1;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync unsigned int is_offscreen :1;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync unsigned int is_obscured :1;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync} RootlessWindowRec, *RootlessWindowPtr;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/* Offset for screen-local to global coordinate transforms */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#ifdef ROOTLESS_GLOBAL_COORDS
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncextern int rootlessGlobalOffsetX;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncextern int rootlessGlobalOffsetY;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/* The minimum number of bytes or pixels for which to use the
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync implementation's accelerated functions. */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncextern unsigned int rootless_CopyBytes_threshold;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncextern unsigned int rootless_FillBytes_threshold;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncextern unsigned int rootless_CompositePixels_threshold;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncextern unsigned int rootless_CopyWindow_threshold;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/* Operations used by CompositePixels */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncenum rl_composite_op_enum {
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_COMPOSITE_SRC = 0,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_COMPOSITE_OVER,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync};
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/* Data formats for depth field and composite functions */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncenum rl_depth_enum {
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_DEPTH_NIL = 0, /* null source when compositing */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_DEPTH_ARGB8888,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_DEPTH_RGB555,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_DEPTH_A8, /* for masks when compositing */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_DEPTH_INDEX8,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync};
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/* Macro to form the composite function for CompositePixels */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define RL_COMPOSITE_FUNCTION(op, src_depth, mask_depth, dest_depth) \
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (((op) << 24) | ((src_depth) << 16) \
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync | ((mask_depth) << 8) | ((dest_depth) << 0))
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/* Gravity for window contents during resizing */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncenum rl_gravity_enum {
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_GRAVITY_NONE = 0, /* no gravity, fill everything */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_GRAVITY_NORTH_WEST = 1, /* anchor to top-left corner */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_GRAVITY_NORTH_EAST = 2, /* anchor to top-right corner */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_GRAVITY_SOUTH_EAST = 3, /* anchor to bottom-right corner */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RL_GRAVITY_SOUTH_WEST = 4, /* anchor to bottom-left corner */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync};
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*------------------------------------------
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync Rootless Implementation Functions
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync ------------------------------------------*/
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Create a new frame.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * The frame is created unmapped.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * pFrame RootlessWindowPtr for this frame should be completely
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * initialized before calling except for pFrame->wid, which
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * is set by this function.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * pScreen Screen on which to place the new frame
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * newX, newY Position of the frame. These will be identical to pFrame-x,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * pFrame->y unless ROOTLESS_GLOBAL_COORDS is set.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * pNewShape Shape for the frame (in frame-local coordinates). NULL for
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * unshaped frames.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef Bool (*RootlessCreateFrameProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessWindowPtr pFrame, ScreenPtr pScreen, int newX, int newY,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RegionPtr pNewShape);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Destroy a frame.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Drawing is stopped and all updates are flushed before this is called.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * wid Frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessDestroyFrameProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Move a frame on screen.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Drawing is stopped and all updates are flushed before this is called.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * wid Frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * pScreen Screen to move the new frame to
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * newX, newY New position of the frame
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessMoveFrameProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Resize and move a frame.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Drawing is stopped and all updates are flushed before this is called.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * wid Frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * pScreen Screen to move the new frame to
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * newX, newY New position of the frame
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * newW, newH New size of the frame
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * gravity Gravity for window contents (rl_gravity_enum). This is always
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * RL_GRAVITY_NONE unless ROOTLESS_RESIZE_GRAVITY is set.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessResizeFrameProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid, ScreenPtr pScreen,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync int newX, int newY, unsigned int newW, unsigned int newH,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync unsigned int gravity);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Change frame ordering (AKA stacking, layering).
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Drawing is stopped before this is called. Unmapped frames are mapped by
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * setting their ordering.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * wid Frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * nextWid Frame id of frame that is now above this one or NULL if this
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * frame is at the top.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessRestackFrameProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid, RootlessFrameID nextWid);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Change frame's shape.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Drawing is stopped before this is called.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * wid Frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * pNewShape New shape for the frame (in frame-local coordinates)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * or NULL if now unshaped.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessReshapeFrameProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid, RegionPtr pNewShape);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Unmap a frame.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * wid Frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessUnmapFrameProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Start drawing to a frame.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Prepare a frame for direct access to its backing buffer.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * wid Frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * pixelData Address of the backing buffer (returned)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * bytesPerRow Width in bytes of the backing buffer (returned)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessStartDrawingProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Stop drawing to a frame.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * No drawing to the frame's backing buffer will occur until drawing
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * is started again.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * wid Frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * flush Flush drawing updates for this frame to the screen. This
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * will always be FALSE if ROOTLESS_TRACK_DAMAGE is set.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessStopDrawingProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid, Bool flush);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Flush drawing updates to the screen.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Drawing is stopped before this is called.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * wid Frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * pDamage Region containing all the changed pixels in frame-lcoal
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * coordinates. This is clipped to the window's clip. This
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * will be NULL if ROOTLESS_TRACK_DAMAGE is not set.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessUpdateRegionProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid, RegionPtr pDamage);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Mark damaged rectangles as requiring redisplay to screen.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * This will only be called if ROOTLESS_TRACK_DAMAGE is not set.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * wid Frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * nrects Number of damaged rectangles
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * rects Array of damaged rectangles in frame-local coordinates
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * shift_x, Vector to shift rectangles by
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * shift_y
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessDamageRectsProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid, int nrects, const BoxRec *rects,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync int shift_x, int shift_y);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Switch the window associated with a frame. (Optional)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * When a framed window is reparented, the frame is resized and set to
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * use the new top-level parent. If defined this function will be called
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * afterwards for implementation specific bookkeeping.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * pFrame Frame whose window has switched
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * oldWin Previous window wrapped by this frame
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessSwitchWindowProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessWindowPtr pFrame, WindowPtr oldWin);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Check if window should be reordered. (Optional)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * The underlying window system may animate windows being ordered in.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * We want them to be mapped but remain ordered out until the animation
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * completes. If defined this function will be called to check if a
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * framed window should be reordered now. If this function returns
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * FALSE, the window will still be mapped from the X11 perspective, but
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * the RestackFrame function will not be called for its frame.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * pFrame Frame to reorder
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef Bool (*RootlessDoReorderWindowProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessWindowPtr pFrame);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Copy bytes. (Optional)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Source and destinate may overlap and the right thing should happen.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * width Bytes to copy per row
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * height Number of rows
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * src Source data
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * srcRowBytes Width of source in bytes
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * dst Destination data
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * dstRowBytes Width of destination in bytes
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessCopyBytesProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (unsigned int width, unsigned int height,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync const void *src, unsigned int srcRowBytes,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync void *dst, unsigned int dstRowBytes);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Fill memory with 32-bit pattern. (Optional)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * width Bytes to fill per row
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * height Number of rows
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * value 32-bit pattern to fill with
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * dst Destination data
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * dstRowBytes Width of destination in bytes
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessFillBytesProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (unsigned int width, unsigned int height, unsigned int value,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync void *dst, unsigned int dstRowBytes);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Composite pixels from source and mask to destination. (Optional)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * width, height Size of area to composite to in pizels
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * function Composite function built with RL_COMPOSITE_FUNCTION
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * src Source data
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * srcRowBytes Width of source in bytes (Passing NULL means source
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * is a single pixel.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * mask Mask data
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * maskRowBytes Width of mask in bytes
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * dst Destination data
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * dstRowBytes Width of destination in bytes
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * For src and dst, the first element of the array is the color data. If
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * the second element is non-null it implies there is alpha data (which
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * may be meshed or planar). Data without alpha is assumed to be opaque.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * An X11 error code is returned.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef int (*RootlessCompositePixelsProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (unsigned int width, unsigned int height, unsigned int function,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync void *src[2], unsigned int srcRowBytes[2],
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync void *mask, unsigned int maskRowBytes,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync void *dst[2], unsigned int dstRowBytes[2]);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Copy area in frame to another part of frame. (Optional)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * wid Frame id
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * dstNrects Number of rectangles to copy
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * dstRects Array of rectangles to copy
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * dx, dy Number of pixels away to copy area
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessCopyWindowProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync int dx, int dy);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessHideWindowProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef void (*RootlessUpdateColormapProc)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (RootlessFrameID wid, ScreenPtr pScreen);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Rootless implementation function list
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsynctypedef struct _RootlessFrameProcs {
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessCreateFrameProc CreateFrame;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessDestroyFrameProc DestroyFrame;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessMoveFrameProc MoveFrame;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessResizeFrameProc ResizeFrame;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessRestackFrameProc RestackFrame;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessReshapeFrameProc ReshapeFrame;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessUnmapFrameProc UnmapFrame;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessStartDrawingProc StartDrawing;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessStopDrawingProc StopDrawing;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessUpdateRegionProc UpdateRegion;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#ifndef ROOTLESS_TRACK_DAMAGE
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessDamageRectsProc DamageRects;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync /* Optional frame functions */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessSwitchWindowProc SwitchWindow;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessDoReorderWindowProc DoReorderWindow;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessHideWindowProc HideWindow;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessUpdateColormapProc UpdateColormap;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync /* Optional acceleration functions */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessCopyBytesProc CopyBytes;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessFillBytesProc FillBytes;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessCompositePixelsProc CompositePixels;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync RootlessCopyWindowProc CopyWindow;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync} RootlessFrameProcsRec, *RootlessFrameProcsPtr;
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Initialize rootless mode on the given screen.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncBool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Initialize acceleration for rootless mode on a given screen.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Note: RootlessAccelInit() must be called before DamageSetup()
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * and RootlessInit() must be called afterwards.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncBool RootlessAccelInit(ScreenPtr pScreen);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Return the frame ID for the physical window displaying the given window.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * create If true and the window has no frame, attempt to create one
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncRootlessFrameID RootlessFrameForWindow(WindowPtr pWin, Bool create);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Return the top-level parent of a window.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * The root is the top-level parent of itself, even though the root is
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * not otherwise considered to be a top-level window.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncWindowPtr TopLevelParent(WindowPtr pWindow);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Prepare a window for direct access to its backing buffer.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncvoid RootlessStartDrawing(WindowPtr pWindow);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Finish drawing to a window's backing buffer.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * flush If true and ROOTLESS_TRACK_DAMAGE is set, damaged areas
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * are flushed to the screen.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncvoid RootlessStopDrawing(WindowPtr pWindow, Bool flush);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Alocate a new screen pixmap.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * miCreateScreenResources does not do this properly with a null
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * framebuffer pointer.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncvoid RootlessUpdateScreenPixmap(ScreenPtr pScreen);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Reposition all windows on a screen to their correct positions.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncvoid RootlessRepositionWindows(ScreenPtr pScreen);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Bring all windows to the front of the Aqua stack
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncvoid RootlessOrderAllWindows (void);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif /* _ROOTLESS_H */