1 /* Fvwm colorset technology is Copyright (C) 1999 Joey Shutup
2 http://www.streetmap.co.uk/streetmap.dll?Postcode2Map?BS24+9TZ
3 You may use this code for any purpose, as long as the original copyright
4 and this notice remains in the source code and all documentation
6 /* This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef LIBS_COLORSETS_H
22 #define LIBS_COLORSETS_H
35 unsigned int width
: 12;
36 unsigned int height
: 12;
37 unsigned int pixmap_type
: 3;
38 unsigned int shape_width
: 12;
39 unsigned int shape_height
: 12;
40 unsigned int shape_type
: 2;
41 unsigned int do_dither_icon
: 1;
42 unsigned int fg_alpha_percent
: 7;
43 unsigned int tint_percent
: 7;
44 unsigned int icon_alpha_percent
: 7;
45 unsigned int icon_tint_percent
: 7;
46 #ifdef FVWM_COLORSET_PRIVATE
47 /* fvwm/colorset.c use only */
57 unsigned int color_flags
;
63 short image_alpha_percent
;
65 Bool allows_buffered_transparency
;
66 Bool is_maybe_root_transparent
;
70 #define PIXMAP_TILED 0
71 #define PIXMAP_STRETCH_X 1
72 #define PIXMAP_STRETCH_Y 2
73 #define PIXMAP_STRETCH 3
74 #define PIXMAP_STRETCH_ASPECT 4
75 #define PIXMAP_ROOT_PIXMAP_PURE 5
76 #define PIXMAP_ROOT_PIXMAP_TRAN 6
79 #define SHAPE_STRETCH 1
80 #define SHAPE_STRETCH_ASPECT 2
82 #ifdef FVWM_COLORSET_PRIVATE
83 #define FG_SUPPLIED 0x1
84 #define BG_SUPPLIED 0x2
85 #define HI_SUPPLIED 0x4
86 #define SH_SUPPLIED 0x8
87 #define FGSH_SUPPLIED 0x10
88 #define FG_CONTRAST 0x20
89 #define BG_AVERAGE 0x40
90 #define TINT_SUPPLIED 0x80
91 #define FG_TINT_SUPPLIED 0x100
92 #define BG_TINT_SUPPLIED 0x200
93 #define ICON_TINT_SUPPLIED 0x400
96 /* colorsets are stored as an array of structs to permit fast dereferencing */
97 extern colorset_t
*Colorset
;
100 /* some macro for transparency */
101 #define CSET_IS_TRANSPARENT(cset) \
102 (cset >= 0 && (Colorset[cset].pixmap == ParentRelative || \
103 (Colorset[cset].pixmap != None && \
104 (Colorset[cset].pixmap_type == PIXMAP_ROOT_PIXMAP_TRAN ||\
105 Colorset[cset].pixmap_type == PIXMAP_ROOT_PIXMAP_PURE))))
106 #define CSET_IS_TRANSPARENT_PR(cset) \
107 (cset >= 0 && Colorset[cset].pixmap == ParentRelative)
108 #define CSET_IS_TRANSPARENT_ROOT(cset) \
109 (cset >= 0 && Colorset[cset].pixmap != None && \
110 (Colorset[cset].pixmap_type == PIXMAP_ROOT_PIXMAP_TRAN ||\
111 Colorset[cset].pixmap_type == PIXMAP_ROOT_PIXMAP_PURE))
112 #define CSET_IS_TRANSPARENT_PR_PURE(cset) \
113 (cset >= 0 && Colorset[cset].pixmap == ParentRelative && \
114 Colorset[cset].tint_percent == 0)
115 #define CSET_IS_TRANSPARENT_ROOT_PURE(cset) \
116 (cset >= 0 && Colorset[cset].pixmap != None && \
117 Colorset[cset].pixmap_type == PIXMAP_ROOT_PIXMAP_PURE)
118 #define CSET_IS_TRANSPARENT_ROOT_TRAN(cset) \
119 (cset >= 0 && Colorset[cset].pixmap != None && \
120 Colorset[cset].pixmap_type == PIXMAP_ROOT_PIXMAP_TRAN)
121 #define CSET_IS_TRANSPARENT_PR_TINT(cset) \
122 (cset >= 0 && Colorset[cset].pixmap == ParentRelative && \
123 Colorset[cset].tint_percent > 0)
126 /* some macro for transparency */
127 #define CSETS_IS_TRANSPARENT(cset) \
128 (cset >= 0 && (cset->pixmap == ParentRelative || \
129 (cset->pixmap != None && \
130 (cset->pixmap_type == PIXMAP_ROOT_PIXMAP_TRAN ||\
131 cset->pixmap_type == PIXMAP_ROOT_PIXMAP_PURE))))
132 #define CSETS_IS_TRANSPARENT_ROOT(cset) \
133 (cset >= 0 && cset->pixmap != None && \
134 (cset->pixmap_type == PIXMAP_ROOT_PIXMAP_TRAN ||\
135 cset->pixmap_type == PIXMAP_ROOT_PIXMAP_PURE))
136 #define CSETS_IS_TRANSPARENT_PR_PURE(cset) \
137 (cset >= 0 && cset->pixmap == ParentRelative && \
138 cset->tint_percent == 0)
139 #define CSETS_IS_TRANSPARENT_ROOT_PURE(cset) \
140 (cset >= 0 && cset->pixmap != None && \
141 cset->pixmap_type == PIXMAP_ROOT_PIXMAP_PURE)
142 #define CSETS_IS_TRANSPARENT_ROOT_TRAN(cset) \
143 (cset >= 0 && cset->pixmap != None && \
144 cset->pixmap_type == PIXMAP_ROOT_PIXMAP_TRAN)
145 #define CSETS_IS_TRANSPARENT_PR_TINT(cset) \
146 (cset >= 0 && cset->pixmap == ParentRelative && \
147 cset->tint_percent > 0)
149 #ifndef FVWM_COLORSET_PRIVATE
150 /* Create n new colorsets, fvwm/colorset.c does its own thing (different size)
152 void AllocColorset(int n
);
156 char *DumpColorset(int n
, colorset_t
*colorset
);
158 int LoadColorset(char *line
);
160 Pixmap
CreateBackgroundPixmap(
161 Display
*dpy
, Window win
, int width
, int height
,
162 colorset_t
*colorset
, unsigned int depth
,
163 GC gc
, Bool is_mask
);
165 Display
*dpy
, Pixmap p
, GC gc
, int x_off
, int y_off
, int width
,
166 int height
, unsigned int depth
);
167 void SetWindowBackgroundWithOffset(
168 Display
*dpy
, Window win
, int x_off
, int y_off
, int width
, int height
,
169 colorset_t
*colorset
, unsigned int depth
, GC gc
, Bool clear_area
);
170 void SetWindowBackground(
171 Display
*dpy
, Window win
, int width
, int height
,
172 colorset_t
*colorset
, unsigned int depth
, GC gc
,
174 Bool
UpdateBackgroundTransparency(
175 Display
*dpy
, Window win
, int width
, int height
,
176 colorset_t
*colorset
, unsigned int depth
, GC gc
, Bool clear_area
);
177 void SetRectangleBackground(
178 Display
*dpy
, Window win
, int x
, int y
, int width
, int height
,
179 colorset_t
*colorset
, unsigned int depth
, GC gc
);
180 void SetClippedRectangleBackground(
181 Display
*dpy
, Window win
, int x
, int y
, int width
, int height
,
182 XRectangle
*clip
, colorset_t
*colorset
,
183 unsigned int depth
, GC gc
);