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