dbestruct.h revision 65fea56f17cd614bc8908264df980a62e1931468
77b1a2d8b5dbe2c0b5200794914239fee3c8ee5dvboxsync/******************************************************************************
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync *
77b1a2d8b5dbe2c0b5200794914239fee3c8ee5dvboxsync * Copyright (c) 1994, 1995 Hewlett-Packard Company
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync *
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * Permission is hereby granted, free of charge, to any person obtaining
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * a copy of this software and associated documentation files (the
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * "Software"), to deal in the Software without restriction, including
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * without limitation the rights to use, copy, modify, merge, publish,
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * distribute, sublicense, and/or sell copies of the Software, and to
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * permit persons to whom the Software is furnished to do so, subject to
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * the following conditions:
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * The above copyright notice and this permission notice shall be included
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * in all copies or substantial portions of the Software.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync *
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
cd6f71bc352f550074f1ba2c830a2cf2f0b3dd46vboxsync *
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync * Except as contained in this notice, the name of the Hewlett-Packard
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync * Company shall not be used in advertising or otherwise to promote the
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync * sale, use or other dealings in this Software without prior written
16a9adc14900ca18e6909679a579f6833425e030vboxsync * authorization from the Hewlett-Packard Company.
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync *
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync * Header file for DIX-related DBE
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync *
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync *****************************************************************************/
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync
51fe8789a74f6c118894aaa12eb69ec155386dbdvboxsync#ifndef DBE_STRUCT_H
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync#define DBE_STRUCT_H
a9f41cb889f53e8407561a6155052c441eb0fc5fvboxsync
cc15c3fa4bb2d3fb91e4d0cd15a73133963f86b0vboxsync/* INCLUDES */
cc15c3fa4bb2d3fb91e4d0cd15a73133963f86b0vboxsync
b0b15690f00527424b2d5fb88456d747252322f7vboxsync#define NEED_DBE_PROTOCOL
51fe8789a74f6c118894aaa12eb69ec155386dbdvboxsync#include <X11/extensions/dbeproto.h>
efff36b306e370346025647a158689021df2e1d1vboxsync#include "windowstr.h"
51fe8789a74f6c118894aaa12eb69ec155386dbdvboxsync#include "privates.h"
590bfe12ce22cd3716448fbb9f4dc51664bfe5e2vboxsync
51fe8789a74f6c118894aaa12eb69ec155386dbdvboxsynctypedef struct {
51fe8789a74f6c118894aaa12eb69ec155386dbdvboxsync VisualID visual; /* one visual ID that supports double-buffering */
51fe8789a74f6c118894aaa12eb69ec155386dbdvboxsync int depth; /* depth of visual in bits */
590bfe12ce22cd3716448fbb9f4dc51664bfe5e2vboxsync int perflevel; /* performance level of visual */
efff36b306e370346025647a158689021df2e1d1vboxsync} XdbeVisualInfo;
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync
f5e53763b0a581b0299e98028c6c52192eb06785vboxsynctypedef struct {
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync int count; /* number of items in visual_depth */
efff36b306e370346025647a158689021df2e1d1vboxsync XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
51fe8789a74f6c118894aaa12eb69ec155386dbdvboxsync} XdbeScreenVisualInfo;
51fe8789a74f6c118894aaa12eb69ec155386dbdvboxsync
efff36b306e370346025647a158689021df2e1d1vboxsync/* DEFINES */
51fe8789a74f6c118894aaa12eb69ec155386dbdvboxsync
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync#define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey))
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync#define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync DBE_SCREEN_PRIV((pDrawable)->pScreen)
1bf495e3eec00dd79cecb6b36ef2a97f422c3737vboxsync
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync#define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen)
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync#define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync DBE_SCREEN_PRIV((pWindow)->drawable.pScreen)
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync#define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen)
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync
0abd77741a608f6c41c8dfcd4781b8b84adf1044vboxsync#define DBE_SCREEN_PRIV_FROM_GC(pGC)\
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync DBE_SCREEN_PRIV((pGC)->pScreen)
9496f2d398b49813176939d7a339ae513d5175efvboxsync
9496f2d398b49813176939d7a339ae513d5175efvboxsync#define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \
9496f2d398b49813176939d7a339ae513d5175efvboxsync dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey))
9496f2d398b49813176939d7a339ae513d5175efvboxsync
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync/* Initial size of the buffer ID array in the window priv. */
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync#define DBE_INIT_MAX_IDS 2
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync/* Reallocation increment for the buffer ID array. */
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync#define DBE_INCR_MAX_IDS 4
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync/* Marker for free elements in the buffer ID array. */
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync#define DBE_FREE_ID_ELEMENT 0
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync/* TYPEDEFS */
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync/* Record used to pass swap information between DIX and DDX swapping
c0a370e600bb60153a269fb32b5f709347c35768vboxsync * procedures.
c0a370e600bb60153a269fb32b5f709347c35768vboxsync */
c0a370e600bb60153a269fb32b5f709347c35768vboxsynctypedef struct _DbeSwapInfoRec {
c0a370e600bb60153a269fb32b5f709347c35768vboxsync WindowPtr pWindow;
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync unsigned char swapAction;
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync} DbeSwapInfoRec, *DbeSwapInfoPtr;
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync/*
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync ******************************************************************************
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync ** Per-window data
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync ******************************************************************************
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync */
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsynctypedef struct _DbeWindowPrivRec {
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync /* A pointer to the window with which the DBE window private (buffer) is
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync * associated.
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync */
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync WindowPtr pWindow;
7766bf675357fd940d8c49e69a5d72dc6eaa6be4vboxsync
7766bf675357fd940d8c49e69a5d72dc6eaa6be4vboxsync /* Last known swap action for this buffer. Legal values for this field
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync */
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync unsigned char swapAction;
5341459ca931b65de60b5af2a4cba6836b6b45cavboxsync
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync /* Last known buffer size.
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync */
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync unsigned short width, height;
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync /* Coordinates used for static gravity when the window is positioned.
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync */
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync short x, y;
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync /* Number of XIDs associated with this buffer.
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync */
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync int nBufferIDs;
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync /* Capacity of the current buffer ID array, IDs. */
9496f2d398b49813176939d7a339ae513d5175efvboxsync int maxAvailableIDs;
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync
9496f2d398b49813176939d7a339ae513d5175efvboxsync /* Pointer to the array of buffer IDs. This initially points to initIDs.
cab115cfa31c584def7069312a1e23c3fc88533bvboxsync * When the static limit of the initIDs array is reached, the array is
cab115cfa31c584def7069312a1e23c3fc88533bvboxsync * reallocated and this pointer is set to the new array instead of initIDs.
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync */
9496f2d398b49813176939d7a339ae513d5175efvboxsync XID *IDs;
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync
9496f2d398b49813176939d7a339ae513d5175efvboxsync /* Initial array of buffer IDs. We are defining the XID array within the
21029597fc4b76d0db0c9542daee201447281781vboxsync * window priv to optimize for data locality. In most cases, only one
21029597fc4b76d0db0c9542daee201447281781vboxsync * buffer will be associated with a window. Having the array declared
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync * here can prevent us from accessing the data in another memory page,
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync * possibly resulting in a page swap and loss of performance. Initially we
9496f2d398b49813176939d7a339ae513d5175efvboxsync * will use this array to store buffer IDs. For situations where we have
9496f2d398b49813176939d7a339ae513d5175efvboxsync * more IDs than can fit in this static array, we will allocate a larger
9496f2d398b49813176939d7a339ae513d5175efvboxsync * array to use, possibly suffering a performance loss.
9496f2d398b49813176939d7a339ae513d5175efvboxsync */
16a9adc14900ca18e6909679a579f6833425e030vboxsync XID initIDs[DBE_INIT_MAX_IDS];
16a9adc14900ca18e6909679a579f6833425e030vboxsync
16a9adc14900ca18e6909679a579f6833425e030vboxsync /* Pointer to a drawable that contains the contents of the back buffer.
16a9adc14900ca18e6909679a579f6833425e030vboxsync */
c0a370e600bb60153a269fb32b5f709347c35768vboxsync PixmapPtr pBackBuffer;
9c149a2789022f5011e88fb62f02a1cc8068e88fvboxsync
9c149a2789022f5011e88fb62f02a1cc8068e88fvboxsync /* Pointer to a drawable that contains the contents of the front buffer.
c0a370e600bb60153a269fb32b5f709347c35768vboxsync * This pointer is only used for the XdbeUntouched swap action. For that
c0a370e600bb60153a269fb32b5f709347c35768vboxsync * swap action, we need to copy the front buffer (window) contents into
c0a370e600bb60153a269fb32b5f709347c35768vboxsync * this drawable, copy the contents of current back buffer drawable (the
c0a370e600bb60153a269fb32b5f709347c35768vboxsync * back buffer) into the window, swap the front and back drawable pointers,
c0a370e600bb60153a269fb32b5f709347c35768vboxsync * and then swap the drawable/resource associations in the resource
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * database.
9496f2d398b49813176939d7a339ae513d5175efvboxsync */
9496f2d398b49813176939d7a339ae513d5175efvboxsync PixmapPtr pFrontBuffer;
9496f2d398b49813176939d7a339ae513d5175efvboxsync
9496f2d398b49813176939d7a339ae513d5175efvboxsync /* Device-specific private information.
9496f2d398b49813176939d7a339ae513d5175efvboxsync */
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync PrivateRec *devPrivates;
d80c85a1bc7317da7d0cd1254fae6a20db039c8cvboxsync
61d064a54f03596920c3918f58ecc7764074a5d8vboxsync} DbeWindowPrivRec, *DbeWindowPrivPtr;
61d064a54f03596920c3918f58ecc7764074a5d8vboxsync
16a9adc14900ca18e6909679a579f6833425e030vboxsync/*
16a9adc14900ca18e6909679a579f6833425e030vboxsync ******************************************************************************
16a9adc14900ca18e6909679a579f6833425e030vboxsync ** Per-screen data
16a9adc14900ca18e6909679a579f6833425e030vboxsync ******************************************************************************
16a9adc14900ca18e6909679a579f6833425e030vboxsync */
16a9adc14900ca18e6909679a579f6833425e030vboxsync
16a9adc14900ca18e6909679a579f6833425e030vboxsynctypedef struct _DbeScreenPrivRec {
16a9adc14900ca18e6909679a579f6833425e030vboxsync /* Wrapped functions
16a9adc14900ca18e6909679a579f6833425e030vboxsync * It is the responsibilty of the DDX layer to wrap PositionWindow().
16a9adc14900ca18e6909679a579f6833425e030vboxsync * DbeExtensionInit wraps DestroyWindow().
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync */
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync PositionWindowProcPtr PositionWindow;
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync DestroyWindowProcPtr DestroyWindow;
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync /* Per-screen DIX routines */
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync GCPtr /*pGC */
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync );
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync /* Per-screen DDX routines */
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync Bool (*GetVisualInfo) (ScreenPtr /*pScreen */ ,
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync XdbeScreenVisualInfo * /*pVisInfo */
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync );
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync int (*AllocBackBufferName) (WindowPtr /*pWin */ ,
63c12491acc2b8b95c8ac454f1c48b98eec8f7d8vboxsync XID /*bufId */ ,
b5ad839a3757b305d4e98d7264da2b53c9cd27f0vboxsync int /*swapAction */
b5ad839a3757b305d4e98d7264da2b53c9cd27f0vboxsync );
681fd85cc7cd49e9cf66a917d6ae9ff36eb7d9e9vboxsync int (*SwapBuffers) (ClientPtr /*client */ ,
681fd85cc7cd49e9cf66a917d6ae9ff36eb7d9e9vboxsync int * /*pNumWindows */ ,
681fd85cc7cd49e9cf66a917d6ae9ff36eb7d9e9vboxsync DbeSwapInfoPtr /*swapInfo */
681fd85cc7cd49e9cf66a917d6ae9ff36eb7d9e9vboxsync );
681fd85cc7cd49e9cf66a917d6ae9ff36eb7d9e9vboxsync void (*WinPrivDelete) (DbeWindowPrivPtr /*pDbeWindowPriv */ ,
009d45aa55691312278d41edb20154dc208d9cd8vboxsync XID /*bufId */
009d45aa55691312278d41edb20154dc208d9cd8vboxsync );
009d45aa55691312278d41edb20154dc208d9cd8vboxsync} DbeScreenPrivRec, *DbeScreenPrivPtr;
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync
a0240ff4f7663045c848fdbc192ea3d4d9f70a11vboxsync#endif /* DBE_STRUCT_H */
1bf495e3eec00dd79cecb6b36ef2a97f422c3737vboxsync