4 * multivis.h - Header file for Mechanism for GetImage across Multiple Visuals
6 * Copyright (c) 1990, 2011, Oracle and/or its affiliates. All rights reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
29 * Window Systems Group
30 * Sun Microsystems, Inc.
37 #include <X11/Xutil.h>
40 * Data Structures used ...
43 typedef struct _colmap
{ /* Colormap Information */
44 Colormap cmap
; /* X Colormap ID */
45 XColor
*Colors
; /* Actual list of RGB values */
46 struct _colmap
*next
; /* link in chain */
47 int doComposite
; /* True for Direct & TrueColor */
48 unsigned long red_mask
, /* All these valid only for */
49 green_mask
, /* Direct & TrueColor */
51 unsigned long rmax
, /* Max indices into each primary */
54 int rshft
, /* Quick calcs for later */
60 typedef struct _winVisInfo
{ /* A window & it's VisualInfo */
64 MVColmap
*colmap
; /* Colormap information */
65 int x
, y
, width
, height
; /* GetImage, in window space */
66 int x1
, y1
; /* Top left of image in root space */
68 Region region
; /* Computed effective bounding region */
72 typedef struct _winVisInfoList
{ /* An Array of winVisInfo */
73 unsigned long allocated
, used
;
77 typedef struct _pel
{ /* One for each pixel position */
78 MVColmap
*colmap
; /* cmap used for this position */
79 unsigned long pixel
; /* pixel value */
83 * CAUTION: There will be one _pel for each pixel position in the
84 * requested dump area. This could potentially explode the data space.
85 * There are 2 remedies for this.
86 * 1. Dump small areas at a time
87 * 2. Change this data structure to contain only the final RGB value,
88 * if the pixel value is not of consequence to the application.
89 * Pixel Examination type of clients (eg. XMag) require the
90 * pixel value, and operate on a relatively small dump area, so this
96 * Defines & macros ...
99 /* Return MVPel * for this pixel position */
100 #define mvFindPel(x,y) ((mvImg+((y)*request_width))+(x))
101 #define max(a,b) ((a) > (b) ? (a) : (b))
102 #define min(a,b) ((a) < (b) ? (a) : (b))
104 /* This is the number of windows we typically expect on a desktop */
105 #define MV_WIN_TUNE1 20
106 /* If not, this is a likely multiplier ... */
107 #define MV_WIN_TUNE2 2
110 typedef void (*mvCallbackFunc
)(void *);
111 #endif /* UPDATE_HACK */
114 * extern declarations ... These are the mvLib's PUBLIC routines
115 * There are no other PUBLIC interfaces to mvLib.
116 * None of the Data Structures are PUBLIC.
118 #if defined(__cplusplus) || defined(c_plusplus)
120 #endif /* __cplusplus */
122 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
123 int mvShifts(unsigned long mask
);
124 int mvOnes(unsigned long mask
);
127 void mvInit(Display
*display
, int screen
, XVisualInfo
*visuals
, int numVisual
,
128 void *callbackFunction
, mvCallbackFunc cbFunction
);
130 void mvInit(Display
*display
, int screen
, XVisualInfo
*visuals
, int numVisual
);
131 #endif /* UPDATE_HACK */
134 void mvWalkTree(Window window
, int parentX
, int parentY
,
135 int requestX
, int requestY
, int requestWidth
, int requestHeight
137 , Bool ancestorShaped
, Region ancestorRegion
140 int mvIsMultiVis(void);
141 int mvCreatImg(int width
, int height
, int x
, int y
);
142 void mvDoWindowsFrontToBack(void);
143 XColor
*mvFindColorInColormap(int x
, int y
);
144 #else /* ! __STDC__ */
145 extern int mvShifts();
147 extern void mvInit();
148 extern void mvReset();
149 extern void mvWalkTree();
150 extern int mvIsMultiVis();
151 extern int mvCreatImg();
152 extern void mvDoWindowsFrontToBack();
153 extern XColor
*mvFindColorInColormap();
154 #endif /* __STDC__ */
156 #if defined(__cplusplus) || defined(c_plusplus)
158 #endif /* __cplusplus */
159 #endif /* _MULTIVIS_H */