469N/A#ifndef _MULTIVIS_H
469N/A#define _MULTIVIS_H
469N/A/*-
469N/A * multivis.h - Header file for Mechanism for GetImage across Multiple Visuals
469N/A *
1233N/A * Copyright (c) 1990, 2011, Oracle and/or its affiliates. All rights reserved.
469N/A *
919N/A * Permission is hereby granted, free of charge, to any person obtaining a
919N/A * copy of this software and associated documentation files (the "Software"),
919N/A * to deal in the Software without restriction, including without limitation
919N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense,
919N/A * and/or sell copies of the Software, and to permit persons to whom the
919N/A * Software is furnished to do so, subject to the following conditions:
919N/A *
919N/A * The above copyright notice and this permission notice (including the next
919N/A * paragraph) shall be included in all copies or substantial portions of the
919N/A * Software.
469N/A *
919N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
919N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
919N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
919N/A * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
919N/A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
919N/A * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
919N/A * DEALINGS IN THE SOFTWARE.
469N/A *
919N/A * Original author:
469N/A * Milind M. Pansare
919N/A * Window Systems Group
469N/A * Sun Microsystems, Inc.
469N/A *
469N/A * Revision History:
469N/A * 11-15-90 Written
469N/A */
469N/A
469N/A#include <X11/Xlib.h>
469N/A#include <X11/Xutil.h>
469N/A#include <stdio.h>
469N/A/*
469N/A * Data Structures used ...
469N/A*/
469N/A
469N/Atypedef struct _colmap { /* Colormap Information */
469N/A Colormap cmap; /* X Colormap ID */
469N/A XColor *Colors; /* Actual list of RGB values */
469N/A struct _colmap *next; /* link in chain */
469N/A int doComposite; /* True for Direct & TrueColor */
469N/A unsigned long red_mask, /* All these valid only for */
469N/A green_mask, /* Direct & TrueColor */
469N/A blue_mask;
469N/A unsigned long rmax, /* Max indices into each primary */
469N/A gmax,
469N/A bmax;
469N/A int rshft, /* Quick calcs for later */
469N/A gshft,
469N/A bshft,
469N/A rgbshft;
469N/A} MVColmap;
469N/A
469N/Atypedef struct _winVisInfo { /* A window & it's VisualInfo */
469N/A Window window;
469N/A int depth;
469N/A XVisualInfo *visinfo;
469N/A MVColmap *colmap; /* Colormap information */
469N/A int x, y, width, height; /* GetImage, in window space */
469N/A int x1, y1; /* Top left of image in root space */
469N/A#ifdef SHAPE
469N/A Region region; /* Computed effective bounding region */
469N/A#endif /* SHAPE */
469N/A} MVWinVisInfo;
469N/A
469N/Atypedef struct _winVisInfoList { /* An Array of winVisInfo */
469N/A unsigned long allocated, used;
469N/A MVWinVisInfo *wins;
469N/A} MVWinVisInfoList;
469N/A
469N/Atypedef struct _pel { /* One for each pixel position */
469N/A MVColmap *colmap; /* cmap used for this position */
469N/A unsigned long pixel; /* pixel value */
469N/A} MVPel;
469N/A
469N/A/*
469N/A * CAUTION: There will be one _pel for each pixel position in the
469N/A * requested dump area. This could potentially explode the data space.
469N/A * There are 2 remedies for this.
469N/A * 1. Dump small areas at a time
469N/A * 2. Change this data structure to contain only the final RGB value,
469N/A * if the pixel value is not of consequence to the application.
469N/A * Pixel Examination type of clients (eg. XMag) require the
469N/A * pixel value, and operate on a relatively small dump area, so this
469N/A * is not a problem.
469N/A*/
469N/A
469N/A
469N/A/*
469N/A * Defines & macros ...
469N/A*/
469N/A
469N/A/* Return MVPel * for this pixel position */
469N/A#define mvFindPel(x,y) ((mvImg+((y)*request_width))+(x))
469N/A#define max(a,b) ((a) > (b) ? (a) : (b))
469N/A#define min(a,b) ((a) < (b) ? (a) : (b))
469N/A
469N/A/* This is the number of windows we typically expect on a desktop */
469N/A#define MV_WIN_TUNE1 20
469N/A/* If not, this is a likely multiplier ... */
469N/A#define MV_WIN_TUNE2 2
469N/A
469N/A#ifdef UPDATE_HACK
469N/Atypedef void (*mvCallbackFunc)(void *);
469N/A#endif /* UPDATE_HACK */
469N/A
469N/A/*
469N/A * extern declarations ... These are the mvLib's PUBLIC routines
469N/A * There are no other PUBLIC interfaces to mvLib.
469N/A * None of the Data Structures are PUBLIC.
469N/A*/
469N/A#if defined(__cplusplus) || defined(c_plusplus)
469N/Aextern "C" {
469N/A#endif /* __cplusplus */
469N/A
469N/A#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
469N/Aint mvShifts(unsigned long mask);
469N/Aint mvOnes(unsigned long mask);
469N/A
469N/A#ifdef UPDATE_HACK
469N/Avoid mvInit(Display *display, int screen, XVisualInfo *visuals, int numVisual,
469N/A void *callbackFunction, mvCallbackFunc cbFunction);
469N/A#else
469N/Avoid mvInit(Display *display, int screen, XVisualInfo *visuals, int numVisual);
469N/A#endif /* UPDATE_HACK */
469N/A
1233N/Avoid mvReset(void);
469N/Avoid mvWalkTree(Window window, int parentX, int parentY,
469N/A int requestX, int requestY, int requestWidth, int requestHeight
469N/A#ifdef SHAPE
469N/A , Bool ancestorShaped, Region ancestorRegion
469N/A#endif /* SHAPE */
469N/A );
1233N/Aint mvIsMultiVis(void);
469N/Aint mvCreatImg(int width, int height, int x, int y);
1233N/Avoid mvDoWindowsFrontToBack(void);
469N/AXColor *mvFindColorInColormap(int x, int y);
469N/A#else /* ! __STDC__ */
469N/Aextern int mvShifts();
469N/Aextern int mvOnes();
469N/Aextern void mvInit();
469N/Aextern void mvReset();
469N/Aextern void mvWalkTree();
469N/Aextern int mvIsMultiVis();
469N/Aextern int mvCreatImg();
469N/Aextern void mvDoWindowsFrontToBack();
469N/Aextern XColor *mvFindColorInColormap();
469N/A#endif /* __STDC__ */
469N/A
469N/A#if defined(__cplusplus) || defined(c_plusplus)
469N/A}
469N/A#endif /* __cplusplus */
469N/A#endif /* _MULTIVIS_H */