08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * External interface to generic rootless mode
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 * 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 * 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 * 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 * 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.
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 * 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 // Position and size includes the window border
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore // Position is in per-screen coordinates
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore RootlessFrameID wid; // implementation specific frame id
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore // Valid only when drawing (ie. is_drawing is set)
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore unsigned int is_drawing:1; // Currently drawing?
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore/* Offset for screen-local to global coordinate transforms */
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/* Gravity for window contents during resizing */
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 Rootless Implementation Functions
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore ------------------------------------------*/
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * Create a new frame.
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * The frame is created unmapped.
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.
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore (RootlessWindowPtr pFrame, ScreenPtr pScreen, int newX, int newY,
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore * Destroy a frame.
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore * Drawing is stopped and all updates are flushed before this is called.
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore * wid Frame id
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 * 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 (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
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 * 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 int newX, int newY, unsigned int newW, unsigned int newH,
af145792def4317aeeb9d20f7772b32a35a0161fGarrett D'Amore unsigned int gravity);
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 * 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 (RootlessFrameID wid, RootlessFrameID nextWid);
af145792def4317aeeb9d20f7772b32a35a0161fGarrett D'Amore * Change frame's shape.
af145792def4317aeeb9d20f7772b32a35a0161fGarrett D'Amore * Drawing is stopped before this is called.
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 * Unmap a frame.
af145792def4317aeeb9d20f7772b32a35a0161fGarrett D'Amore * wid Frame id
af145792def4317aeeb9d20f7772b32a35a0161fGarrett D'Amore * Start drawing to a frame.
af145792def4317aeeb9d20f7772b32a35a0161fGarrett D'Amore * Prepare a frame for direct access to its backing buffer.
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 (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
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.
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * wid Frame id
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * flush Flush drawing updates for this frame to the screen.
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * Flush drawing updates to the screen.
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * Drawing is stopped before this is called.
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.
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore * Mark damaged rectangles as requiring redisplay to screen.
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
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore (RootlessFrameID wid, int nrects, const BoxRec * rects,
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.
af145792def4317aeeb9d20f7772b32a35a0161fGarrett D'Amore * pFrame Frame whose window has switched
af145792def4317aeeb9d20f7772b32a35a0161fGarrett D'Amore * oldWin Previous window wrapped by this frame
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore (RootlessWindowPtr pFrame, WindowPtr oldWin);
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.
af145792def4317aeeb9d20f7772b32a35a0161fGarrett D'Amore * pFrame Frame to reorder
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * Copy bytes. (Optional)
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * Source and destinate may overlap and the right thing should happen.
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 * Copy area in frame to another part of frame. (Optional)
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 (RootlessFrameID wid, int dstNrects, const BoxRec * dstRects, int dx, int dy);
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * Rootless implementation function list
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore /* Optional frame functions */
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore RootlessDoReorderWindowProc DoReorderWindow;
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore /* Optional acceleration functions */
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore} RootlessFrameProcsRec, *RootlessFrameProcsPtr;
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * Initialize rootless mode on the given screen.
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'AmoreBool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs);
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * Return the frame ID for the physical window displaying the given window.
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * create If true and the window has no frame, attempt to create one
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'AmoreRootlessFrameID RootlessFrameForWindow(WindowPtr pWin, Bool create);
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 * Prepare a window for direct access to its backing buffer.
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amorevoid RootlessStartDrawing(WindowPtr pWindow);
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * Finish drawing to a window's backing buffer.
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * flush If true, damaged areas are flushed to the screen.
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amorevoid RootlessStopDrawing(WindowPtr pWindow, Bool flush);
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'Amorevoid RootlessUpdateScreenPixmap(ScreenPtr pScreen);
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * Reposition all windows on a screen to their correct positions.
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amorevoid RootlessRepositionWindows(ScreenPtr pScreen);
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore * Bring all windows to the front of the native stack
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amorevoid RootlessOrderAllWindows(Bool include_unhitable);
08045defdf65ee890fef6e20510a093a17feb8feGarrett D'Amore#endif /* _ROOTLESS_H */