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