1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 theme.c for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 See the COPYING file for a copy of the GNU General Public License.
26 #include "parser/parse.h"
35 const RrInstance
*inst
;
39 static void parse_style(gchar
*tex
, RrSurfaceColorType
*grad
,
40 RrReliefType
*relief
, RrBevelType
*bevel
,
41 gboolean
*interlaced
, gboolean
*border
,
42 gboolean allow_trans
);
43 static gboolean
read_mask(ParseState
*ps
, const gchar
*maskname
,
44 RrPixmapMask
**value
);
45 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
);
46 static void set_default_appearance(RrAppearance
*a
);
47 static xmlNodePtr
find_node(xmlNodePtr n
, const gchar
*names
[]);
48 static gboolean
find_int(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
49 gint
*integer
, gint lower
, gint upper
);
50 static gboolean
find_string(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
51 const gchar
**string
);
52 static gboolean
find_color(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
53 RrColor
**color
, gchar
*alpha
);
54 static gboolean
find_point(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
56 gint lowx
, gint lowy
, gint upx
, gint upy
);
57 static gboolean
find_shadow(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
59 static gboolean
find_appearance(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
60 RrAppearance
*a
, gboolean allow_trans
);
62 /* make a null terminated array out of a list of strings */
63 #define L(args...) (const gchar*[]){args,NULL}
64 /* shortcut to the various find_* functions */
65 #define FIND(type, args...) find_##type(&ps, root, args)
67 RrTheme
* RrThemeNew(const RrInstance
*inst
, gchar
*name
,
68 RrFont
*active_window_font
, RrFont
*inactive_window_font
,
69 RrFont
*menu_title_font
, RrFont
*menu_item_font
)
73 RrJustify winjust
, mtitlejust
;
78 if (!parse_load_theme(name
, &ps
.doc
, &root
, &ps
.path
)) {
79 g_warning("Falling back to the default theme: '%s'",
81 /* make it fall back to default theme */
86 if (!parse_load_theme(DEFAULT_THEME
, &ps
.doc
, &root
, &ps
.path
))
91 theme
= g_new0(RrTheme
, 1);
94 theme
->a_disabled_focused_max
= RrAppearanceNew(inst
, 1);
95 theme
->a_disabled_unfocused_max
= RrAppearanceNew(inst
, 1);
96 theme
->a_hover_focused_max
= RrAppearanceNew(inst
, 1);
97 theme
->a_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
98 theme
->a_toggled_focused_pressed_max
= RrAppearanceNew(inst
, 1);
99 theme
->a_toggled_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
100 theme
->a_toggled_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
101 theme
->a_toggled_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
102 theme
->a_toggled_hover_focused_max
= RrAppearanceNew(inst
, 1);
103 theme
->a_toggled_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
104 theme
->a_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
105 theme
->a_focused_pressed_max
= RrAppearanceNew(inst
, 1);
106 theme
->a_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
107 theme
->a_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
108 theme
->a_focused_grip
= RrAppearanceNew(inst
, 0);
109 theme
->a_unfocused_grip
= RrAppearanceNew(inst
, 0);
110 theme
->a_focused_title
= RrAppearanceNew(inst
, 0);
111 theme
->a_unfocused_title
= RrAppearanceNew(inst
, 0);
112 theme
->a_focused_label
= RrAppearanceNew(inst
, 1);
113 theme
->a_unfocused_label
= RrAppearanceNew(inst
, 1);
114 theme
->a_icon
= RrAppearanceNew(inst
, 1);
115 theme
->a_focused_handle
= RrAppearanceNew(inst
, 0);
116 theme
->a_unfocused_handle
= RrAppearanceNew(inst
, 0);
117 theme
->a_menu
= RrAppearanceNew(inst
, 0);
118 theme
->a_menu_title
= RrAppearanceNew(inst
, 1);
119 theme
->a_menu_normal
= RrAppearanceNew(inst
, 0);
120 theme
->a_menu_disabled
= RrAppearanceNew(inst
, 0);
121 theme
->a_menu_selected
= RrAppearanceNew(inst
, 0);
122 theme
->a_menu_text_normal
= RrAppearanceNew(inst
, 1);
123 theme
->a_menu_text_disabled
= RrAppearanceNew(inst
, 1);
124 theme
->a_menu_text_selected
= RrAppearanceNew(inst
, 1);
125 theme
->a_menu_bullet_normal
= RrAppearanceNew(inst
, 1);
126 theme
->a_menu_bullet_selected
= RrAppearanceNew(inst
, 1);
127 theme
->a_clear
= RrAppearanceNew(inst
, 0);
128 theme
->a_clear_tex
= RrAppearanceNew(inst
, 1);
130 /* load the font stuff */
132 if (active_window_font
) {
133 theme
->win_font_focused
= active_window_font
;
134 RrFontRef(active_window_font
);
136 theme
->win_font_focused
= RrFontOpenDefault(inst
);
138 if (inactive_window_font
) {
139 theme
->win_font_unfocused
= inactive_window_font
;
140 RrFontRef(inactive_window_font
);
142 theme
->win_font_unfocused
= RrFontOpenDefault(inst
);
144 winjust
= RR_JUSTIFY_LEFT
;
145 if (FIND(string
, L( "window", "justify"), &str
)) {
146 if (strcmp(str
, "right") == 0)
147 winjust
= RR_JUSTIFY_RIGHT
;
148 else if (strcmp(str
, "center") == 0)
149 winjust
= RR_JUSTIFY_CENTER
;
152 if (menu_title_font
) {
153 theme
->menu_title_font
= menu_title_font
;
154 RrFontRef(menu_title_font
);
156 theme
->menu_title_font
= RrFontOpenDefault(inst
);
158 mtitlejust
= RR_JUSTIFY_LEFT
;
159 if (FIND(string
, L("menu", "justify"), &str
)) {
160 if (strcmp(str
, "right") == 0)
161 mtitlejust
= RR_JUSTIFY_RIGHT
;
162 else if (strcmp(str
, "center") == 0)
163 mtitlejust
= RR_JUSTIFY_CENTER
;
166 if (menu_item_font
) {
167 theme
->menu_font
= menu_item_font
;
168 RrFontRef(menu_item_font
);
170 theme
->menu_font
= RrFontOpenDefault(inst
);
172 /* load direct dimensions */
173 if (!FIND(int, L("menu","overlap"),
174 &theme
->menu_overlap
, -100, 100))
175 theme
->menu_overlap
= 0;
177 if (!FIND(int, L("dimensions","handle"), &theme
->handle_height
, 0, 100))
178 theme
->handle_height
= 6;
180 if (!FIND(point
, L("dimensions","padding"),
181 &theme
->paddingx
, &theme
->paddingy
, 0, 100, 0, 100))
182 theme
->paddingx
= theme
->paddingy
= 3;
184 if (!FIND(int, L("window","border","width"),
185 &theme
->fbwidth
, 0, 100))
188 /* menu border width inherits from frame border width */
189 if (!FIND(int, L("menu","border","width"),
190 &theme
->mbwidth
, 0, 100))
191 theme
->mbwidth
= theme
->fbwidth
;
193 if (!FIND(point
, L("window","clientpadding"), &theme
->cbwidthx
,
194 &theme
->cbwidthy
, 0, 100, 0, 100))
195 theme
->cbwidthx
= theme
->cbwidthy
= 1;
198 if (!FIND(color
, L("window","border","primary"),
199 &theme
->frame_b_color
, NULL
))
200 theme
->frame_b_color
= RrColorNew(inst
, 0, 0, 0);
202 /* menu border color inherits from frame border color */
203 if (!FIND(color
, L("menu","border","primary"),
204 &theme
->menu_b_color
, NULL
))
205 theme
->menu_b_color
= RrColorNew(inst
,
206 theme
->frame_b_color
->r
,
207 theme
->frame_b_color
->g
,
208 theme
->frame_b_color
->b
);
209 if (!FIND(color
, L("window","active","clientpadding"),
210 &theme
->cb_focused_color
, NULL
))
211 theme
->cb_focused_color
= RrColorNew(inst
, 255, 255, 255);
212 if (!FIND(color
, L("window","inactive","clientpadding"),
213 &theme
->cb_unfocused_color
, NULL
))
214 theme
->cb_unfocused_color
= RrColorNew(inst
, 255, 255, 255);
215 if (!FIND(color
, L("window","active","label","text","primary"),
216 &theme
->title_focused_color
, NULL
))
217 theme
->title_focused_color
= RrColorNew(inst
, 0x0, 0x0, 0x0);
218 if (!FIND(color
, L("osd","text","primary"),
219 &theme
->osd_color
, NULL
))
220 theme
->osd_color
= RrColorNew(inst
,
221 theme
->title_focused_color
->r
,
222 theme
->title_focused_color
->g
,
223 theme
->title_focused_color
->b
);
224 if (!FIND(color
, L("window","inactive","label","text","primary"),
225 &theme
->title_unfocused_color
, NULL
))
226 theme
->title_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
227 if (!FIND(color
, L("window","active","buttons","unpressed","image"),
228 &theme
->titlebut_focused_unpressed_color
, NULL
))
229 theme
->titlebut_focused_unpressed_color
= RrColorNew(inst
, 0, 0, 0);
230 if (!FIND(color
, L("window","inactive","buttons", "unpressed","image"),
231 &theme
->titlebut_unfocused_unpressed_color
, NULL
))
232 theme
->titlebut_unfocused_unpressed_color
=
233 RrColorNew(inst
, 0xff, 0xff, 0xff);
234 if (!FIND(color
, L("window","active","buttons","pressed","image"),
235 &theme
->titlebut_focused_pressed_color
, NULL
))
236 theme
->titlebut_focused_pressed_color
=
238 theme
->titlebut_focused_unpressed_color
->r
,
239 theme
->titlebut_focused_unpressed_color
->g
,
240 theme
->titlebut_focused_unpressed_color
->b
);
241 if (!FIND(color
, L("window","inactive","buttons","pressed","image"),
242 &theme
->titlebut_unfocused_pressed_color
, NULL
))
243 theme
->titlebut_unfocused_pressed_color
=
245 theme
->titlebut_unfocused_unpressed_color
->r
,
246 theme
->titlebut_unfocused_unpressed_color
->g
,
247 theme
->titlebut_unfocused_unpressed_color
->b
);
248 if (!FIND(color
, L("window","active","buttons","disabled","image"),
249 &theme
->titlebut_disabled_focused_color
, NULL
))
250 theme
->titlebut_disabled_focused_color
=
251 RrColorNew(inst
, 0xff, 0xff, 0xff);
252 if (!FIND(color
, L("window","inactive","buttons","disabled","image"),
253 &theme
->titlebut_disabled_unfocused_color
, NULL
))
254 theme
->titlebut_disabled_unfocused_color
= RrColorNew(inst
, 0, 0, 0);
256 L("window","active","buttons","hover","image"),
257 &theme
->titlebut_hover_focused_color
, NULL
))
258 theme
->titlebut_hover_focused_color
=
260 theme
->titlebut_focused_unpressed_color
->r
,
261 theme
->titlebut_focused_unpressed_color
->g
,
262 theme
->titlebut_focused_unpressed_color
->b
);
263 if (!FIND(color
, L("window","inactive","buttons","hover","image"),
264 &theme
->titlebut_hover_unfocused_color
, NULL
))
265 theme
->titlebut_hover_unfocused_color
=
267 theme
->titlebut_unfocused_unpressed_color
->r
,
268 theme
->titlebut_unfocused_unpressed_color
->g
,
269 theme
->titlebut_unfocused_unpressed_color
->b
);
271 L("window","active","buttons","toggled-pressed","image"),
272 &theme
->titlebut_toggled_focused_pressed_color
, NULL
))
273 theme
->titlebut_toggled_focused_pressed_color
=
275 theme
->titlebut_focused_pressed_color
->r
,
276 theme
->titlebut_focused_pressed_color
->g
,
277 theme
->titlebut_focused_pressed_color
->b
);
279 L("window","inactive","buttons","toggled-pressed","image"),
280 &theme
->titlebut_toggled_unfocused_pressed_color
, NULL
))
281 theme
->titlebut_toggled_unfocused_pressed_color
=
283 theme
->titlebut_unfocused_pressed_color
->r
,
284 theme
->titlebut_unfocused_pressed_color
->g
,
285 theme
->titlebut_unfocused_pressed_color
->b
);
287 L("window","active","buttons","toggled-unpressed","image"),
288 &theme
->titlebut_toggled_focused_unpressed_color
, NULL
))
289 theme
->titlebut_toggled_focused_unpressed_color
=
291 theme
->titlebut_focused_unpressed_color
->r
,
292 theme
->titlebut_focused_unpressed_color
->g
,
293 theme
->titlebut_focused_unpressed_color
->b
);
295 L("window","inactive","buttons","toggled-unpressed","image"),
296 &theme
->titlebut_toggled_unfocused_unpressed_color
, NULL
))
297 theme
->titlebut_toggled_unfocused_unpressed_color
=
299 theme
->titlebut_unfocused_unpressed_color
->r
,
300 theme
->titlebut_unfocused_unpressed_color
->g
,
301 theme
->titlebut_unfocused_unpressed_color
->b
);
303 L("window","active","buttons","toggled-hover","image"),
304 &theme
->titlebut_toggled_hover_focused_color
, NULL
))
305 theme
->titlebut_toggled_hover_focused_color
=
307 theme
->titlebut_toggled_focused_unpressed_color
->r
,
308 theme
->titlebut_toggled_focused_unpressed_color
->g
,
309 theme
->titlebut_toggled_focused_unpressed_color
->b
);
311 L("window","inactive","buttons","toggled-hover","image"),
312 &theme
->titlebut_toggled_hover_unfocused_color
, NULL
))
313 theme
->titlebut_toggled_hover_unfocused_color
=
315 theme
->titlebut_toggled_unfocused_unpressed_color
->r
,
316 theme
->titlebut_toggled_unfocused_unpressed_color
->g
,
317 theme
->titlebut_toggled_unfocused_unpressed_color
->b
);
318 if (!FIND(color
, L("menu","title","text","primary"),
319 &theme
->menu_title_color
, NULL
))
320 theme
->menu_title_color
= RrColorNew(inst
, 0, 0, 0);
321 if (!FIND(color
, L("menu","inactive","primary"), &theme
->menu_color
, NULL
))
322 theme
->menu_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
323 if (!FIND(color
, L("menu","disabled","primary"),
324 &theme
->menu_disabled_color
, NULL
))
325 theme
->menu_disabled_color
= RrColorNew(inst
, 0, 0, 0);
326 if (!FIND(color
, L("menu","active","text","primary"),
327 &theme
->menu_selected_color
, NULL
))
328 theme
->menu_selected_color
= RrColorNew(inst
, 0, 0, 0);
329 if (!FIND(color
, L("window","active","label","text","shadow","primary"),
330 &theme
->title_focused_shadow_color
,
331 &theme
->title_focused_shadow_alpha
))
333 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
334 theme
->title_focused_shadow_alpha
= 50;
336 if (!FIND(color
, L("osd","text","shadow","primary"),
337 &theme
->osd_shadow_color
, &theme
->osd_shadow_alpha
))
339 theme
->osd_shadow_color
=
340 RrColorNew(inst
, theme
->title_focused_shadow_color
->r
,
341 theme
->title_focused_shadow_color
->g
,
342 theme
->title_focused_shadow_color
->b
);
343 theme
->osd_shadow_alpha
= theme
->title_focused_shadow_alpha
;
345 if (!FIND(color
, L("window","inactive","label","text","shadow","primary"),
346 &theme
->title_unfocused_shadow_color
,
347 &theme
->title_unfocused_shadow_alpha
))
349 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
350 theme
->title_unfocused_shadow_alpha
= 50;
352 if (!FIND(color
, L("menu","title","text","shadow","primary"),
353 &theme
->menu_title_shadow_color
,
354 &theme
->menu_title_shadow_alpha
))
356 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
357 theme
->menu_title_shadow_alpha
= 50;
359 if (!FIND(color
, L("menu","inactive","shadow","primary"),
360 &theme
->menu_text_normal_shadow_color
,
361 &theme
->menu_text_normal_shadow_alpha
))
363 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
364 theme
->menu_text_normal_shadow_alpha
= 50;
366 if (!FIND(color
, L("menu","active","text","shadow","primary"),
367 &theme
->menu_text_selected_shadow_color
,
368 &theme
->menu_text_selected_shadow_alpha
))
370 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
371 theme
->menu_text_selected_shadow_alpha
= 50;
373 if (!FIND(color
, L("menu","disabled","shadow","primary"),
374 &theme
->menu_text_disabled_shadow_color
,
375 &theme
->menu_text_disabled_shadow_alpha
))
377 theme
->menu_text_disabled_shadow_color
=
378 RrColorNew(inst
, theme
->menu_text_normal_shadow_color
->r
,
379 theme
->menu_text_normal_shadow_color
->g
,
380 theme
->menu_text_normal_shadow_color
->b
);
381 theme
->menu_text_disabled_shadow_alpha
=
382 theme
->menu_text_normal_shadow_alpha
;
385 /* load the image masks */
386 if (read_mask(&ps
, "max.xbm", &theme
->max_mask
)) {
387 if (!read_mask(&ps
, "max_pressed.xbm", &theme
->max_pressed_mask
))
388 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
389 if (!read_mask(&ps
, "max_toggled.xbm", &theme
->max_toggled_mask
))
390 theme
->max_toggled_mask
=
391 RrPixmapMaskCopy(theme
->max_pressed_mask
);
392 if (!read_mask(&ps
, "max_toggled_pressed.xbm",
393 &theme
->max_toggled_pressed_mask
))
394 theme
->max_toggled_pressed_mask
=
395 RrPixmapMaskCopy(theme
->max_toggled_mask
);
396 if (!read_mask(&ps
, "max_toggled_hover.xbm",
397 &theme
->max_toggled_hover_mask
))
398 theme
->max_toggled_hover_mask
=
399 RrPixmapMaskCopy(theme
->max_toggled_mask
);
400 if (!read_mask(&ps
, "max_disabled.xbm", &theme
->max_disabled_mask
))
401 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
402 if (!read_mask(&ps
, "max_hover.xbm", &theme
->max_hover_mask
))
403 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
406 guchar data
[] = { 0x7f, 0x7f, 0x7f, 0x41, 0x41, 0x41, 0x7f };
407 theme
->max_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
410 guchar data
[] = { 0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f };
411 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
413 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
414 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
415 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
416 theme
->max_toggled_pressed_mask
=
417 RrPixmapMaskCopy(theme
->max_toggled_mask
);
418 theme
->max_toggled_hover_mask
=
419 RrPixmapMaskCopy(theme
->max_toggled_mask
);
422 if (read_mask(&ps
, "iconify.xbm", &theme
->iconify_mask
)) {
423 if (!read_mask(&ps
, "iconify_pressed.xbm",
424 &theme
->iconify_pressed_mask
))
425 theme
->iconify_pressed_mask
=
426 RrPixmapMaskCopy(theme
->iconify_mask
);
427 if (!read_mask(&ps
, "iconify_disabled.xbm",
428 &theme
->iconify_disabled_mask
))
429 theme
->iconify_disabled_mask
=
430 RrPixmapMaskCopy(theme
->iconify_mask
);
431 if (!read_mask(&ps
, "iconify_hover.xbm", &theme
->iconify_hover_mask
))
432 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
435 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f };
436 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
438 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
439 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
440 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
443 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
444 OB_DEFAULT_ICON_HEIGHT
,
445 OB_DEFAULT_ICON_pixel_data
);
447 if (read_mask(&ps
, "desk.xbm", &theme
->desk_mask
)) {
448 if (!read_mask(&ps
, "desk_pressed.xbm", &theme
->desk_pressed_mask
))
449 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
450 if (!read_mask(&ps
, "desk_toggled.xbm", &theme
->desk_toggled_mask
))
451 theme
->desk_toggled_mask
=
452 RrPixmapMaskCopy(theme
->desk_pressed_mask
);
453 if (!read_mask(&ps
, "desk_toggled_pressed.xbm",
454 &theme
->desk_toggled_pressed_mask
))
455 theme
->desk_toggled_pressed_mask
=
456 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
457 if (!read_mask(&ps
, "desk_toggled_hover.xbm",
458 &theme
->desk_toggled_hover_mask
))
459 theme
->desk_toggled_hover_mask
=
460 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
461 if (!read_mask(&ps
, "desk_disabled.xbm", &theme
->desk_disabled_mask
))
462 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
463 if (!read_mask(&ps
, "desk_hover.xbm", &theme
->desk_hover_mask
))
464 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
467 guchar data
[] = { 0x63, 0x63, 0x00, 0x00, 0x00, 0x63, 0x63 };
468 theme
->desk_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
471 guchar data
[] = { 0x00, 0x36, 0x36, 0x08, 0x36, 0x36, 0x00 };
472 theme
->desk_toggled_mask
= RrPixmapMaskNew(inst
, 7, 7,
475 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
476 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
477 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
478 theme
->desk_toggled_pressed_mask
=
479 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
480 theme
->desk_toggled_hover_mask
=
481 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
484 if (read_mask(&ps
, "shade.xbm", &theme
->shade_mask
)) {
485 if (!read_mask(&ps
, "shade_pressed.xbm", &theme
->shade_pressed_mask
))
486 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
487 if (!read_mask(&ps
, "shade_toggled.xbm", &theme
->shade_toggled_mask
))
488 theme
->shade_toggled_mask
=
489 RrPixmapMaskCopy(theme
->shade_pressed_mask
);
490 if (!read_mask(&ps
, "shade_toggled_pressed.xbm",
491 &theme
->shade_toggled_pressed_mask
))
492 theme
->shade_toggled_pressed_mask
=
493 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
494 if (!read_mask(&ps
, "shade_toggled_hover.xbm",
495 &theme
->shade_toggled_hover_mask
))
496 theme
->shade_toggled_hover_mask
=
497 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
498 if (!read_mask(&ps
, "shade_disabled.xbm", &theme
->shade_disabled_mask
))
499 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
500 if (!read_mask(&ps
, "shade_hover.xbm", &theme
->shade_hover_mask
))
501 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
504 guchar data
[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00 };
505 theme
->shade_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
508 guchar data
[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x7f };
509 theme
->shade_toggled_mask
= RrPixmapMaskNew(inst
, 7, 7,
512 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
513 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
514 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
515 theme
->shade_toggled_pressed_mask
=
516 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
517 theme
->shade_toggled_hover_mask
=
518 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
521 if (read_mask(&ps
, "close.xbm", &theme
->close_mask
)) {
522 if (!read_mask(&ps
, "close_pressed.xbm", &theme
->close_pressed_mask
))
523 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
524 if (!read_mask(&ps
, "close_disabled.xbm", &theme
->close_disabled_mask
))
525 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
526 if (!read_mask(&ps
, "close_hover.xbm", &theme
->close_hover_mask
))
527 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
530 guchar data
[] = { 0x63, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x63 };
531 theme
->close_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
533 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
534 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
535 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
538 if (!read_mask(&ps
, "bullet.xbm", &theme
->menu_bullet_mask
)) {
539 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
540 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
543 /* read the decoration textures */
544 if (!FIND(appearance
, L("window","active","titlebar"),
545 theme
->a_focused_title
, FALSE
))
546 set_default_appearance(theme
->a_focused_title
);
547 if (!FIND(appearance
, L("window","inactive","titlebar"),
548 theme
->a_unfocused_title
, FALSE
))
549 set_default_appearance(theme
->a_unfocused_title
);
550 if (!FIND(appearance
, L("window","active","label"),
551 theme
->a_focused_label
, TRUE
))
552 set_default_appearance(theme
->a_focused_label
);
553 if (!FIND(appearance
, L("window","inactive","label"),
554 theme
->a_unfocused_label
, TRUE
))
555 set_default_appearance(theme
->a_unfocused_label
);
556 if (!FIND(appearance
, L("window","active","handle"),
557 theme
->a_focused_handle
, FALSE
))
558 set_default_appearance(theme
->a_focused_handle
);
559 if (!FIND(appearance
, L("window","inactive","handle"),
560 theme
->a_unfocused_handle
, FALSE
))
561 set_default_appearance(theme
->a_unfocused_handle
);
562 if (!FIND(appearance
, L("window","active","grip"),
563 theme
->a_focused_grip
, TRUE
))
564 set_default_appearance(theme
->a_focused_grip
);
565 if (!FIND(appearance
, L("window","inactive","grip"),
566 theme
->a_unfocused_grip
, TRUE
))
567 set_default_appearance(theme
->a_unfocused_grip
);
568 if (!FIND(appearance
, L("menu","entries"), theme
->a_menu
, FALSE
))
569 set_default_appearance(theme
->a_menu
);
570 if (!FIND(appearance
, L("menu","title"), theme
->a_menu_title
, FALSE
))
571 set_default_appearance(theme
->a_menu_title
);
572 if (!FIND(appearance
, L("menu", "active"), theme
->a_menu_selected
, TRUE
))
573 set_default_appearance(theme
->a_menu_selected
);
575 /* read the appearances for rendering non-decorations */
576 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
577 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
578 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
579 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_label
);
581 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_title
);
582 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
583 theme
->osd_unhilite_fg
= RrAppearanceCopy(theme
->a_unfocused_label
);
585 theme
->osd_unhilite_fg
= RrAppearanceCopy(theme
->a_unfocused_title
);
587 /* read buttons textures */
588 if (!FIND(appearance
, L("window","active","buttons","disabled"),
589 theme
->a_disabled_focused_max
, TRUE
))
590 set_default_appearance(theme
->a_disabled_focused_max
);
591 if (!FIND(appearance
, L("window","inactive","buttons","disabled"),
592 theme
->a_disabled_unfocused_max
, TRUE
))
593 set_default_appearance(theme
->a_disabled_unfocused_max
);
594 if (!FIND(appearance
, L("window","active","buttons","pressed"),
595 theme
->a_focused_pressed_max
, TRUE
))
596 set_default_appearance(theme
->a_focused_pressed_max
);
597 if (!FIND(appearance
, L("window","inactive","buttons","pressed"),
598 theme
->a_unfocused_pressed_max
, TRUE
))
599 set_default_appearance(theme
->a_unfocused_pressed_max
);
600 if (!FIND(appearance
, L("window","active","buttons","unpressed"),
601 theme
->a_focused_unpressed_max
, TRUE
))
602 set_default_appearance(theme
->a_focused_unpressed_max
);
603 if (!FIND(appearance
, L("window","inactive","buttons","unpressed"),
604 theme
->a_unfocused_unpressed_max
, TRUE
))
605 set_default_appearance(theme
->a_unfocused_unpressed_max
);
606 if (!FIND(appearance
, L("window","active","buttons","hover"),
607 theme
->a_hover_focused_max
, TRUE
))
609 RrAppearanceFree(theme
->a_hover_focused_max
);
610 theme
->a_hover_focused_max
=
611 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
613 if (!FIND(appearance
, L("window","inactive","buttons","hover"),
614 theme
->a_hover_unfocused_max
, TRUE
))
616 RrAppearanceFree(theme
->a_hover_unfocused_max
);
617 theme
->a_hover_unfocused_max
=
618 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
620 if (!FIND(appearance
, L("window","active","buttons","toggled-pressed"),
621 theme
->a_toggled_focused_pressed_max
, TRUE
))
623 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
624 theme
->a_toggled_focused_pressed_max
=
625 RrAppearanceCopy(theme
->a_focused_pressed_max
);
627 if (!FIND(appearance
, L("window","inactive","buttons","toggled-pressed"),
628 theme
->a_toggled_unfocused_pressed_max
, TRUE
))
630 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
631 theme
->a_toggled_unfocused_pressed_max
=
632 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
634 if (!FIND(appearance
, L("window","active","buttons","toggled-unpressed"),
635 theme
->a_toggled_focused_unpressed_max
, TRUE
))
637 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
638 theme
->a_toggled_focused_unpressed_max
=
639 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
641 if (!FIND(appearance
, L("window","inactive","buttons","toggled-unpressed"),
642 theme
->a_toggled_unfocused_unpressed_max
, TRUE
))
644 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
645 theme
->a_toggled_unfocused_unpressed_max
=
646 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
648 if (!FIND(appearance
, L("window","active","buttons","toggled-hover"),
649 theme
->a_toggled_hover_focused_max
, TRUE
))
651 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
652 theme
->a_toggled_hover_focused_max
=
653 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
655 if (!FIND(appearance
, L("window","inactive","buttons","toggled-hover"),
656 theme
->a_toggled_hover_unfocused_max
, TRUE
))
658 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
659 theme
->a_toggled_hover_unfocused_max
=
660 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
663 theme
->a_disabled_focused_close
=
664 RrAppearanceCopy(theme
->a_disabled_focused_max
);
665 theme
->a_disabled_unfocused_close
=
666 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
667 theme
->a_hover_focused_close
=
668 RrAppearanceCopy(theme
->a_hover_focused_max
);
669 theme
->a_hover_unfocused_close
=
670 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
671 theme
->a_unfocused_unpressed_close
=
672 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
673 theme
->a_unfocused_pressed_close
=
674 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
675 theme
->a_focused_unpressed_close
=
676 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
677 theme
->a_focused_pressed_close
=
678 RrAppearanceCopy(theme
->a_focused_pressed_max
);
679 theme
->a_disabled_focused_desk
=
680 RrAppearanceCopy(theme
->a_disabled_focused_max
);
681 theme
->a_disabled_unfocused_desk
=
682 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
683 theme
->a_hover_focused_desk
=
684 RrAppearanceCopy(theme
->a_hover_focused_max
);
685 theme
->a_hover_unfocused_desk
=
686 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
687 theme
->a_toggled_focused_pressed_desk
=
688 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
689 theme
->a_toggled_unfocused_pressed_desk
=
690 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
691 theme
->a_toggled_focused_unpressed_desk
=
692 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
693 theme
->a_toggled_unfocused_unpressed_desk
=
694 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
695 theme
->a_toggled_hover_focused_desk
=
696 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
697 theme
->a_toggled_hover_unfocused_desk
=
698 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
699 theme
->a_unfocused_unpressed_desk
=
700 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
701 theme
->a_unfocused_pressed_desk
=
702 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
703 theme
->a_focused_unpressed_desk
=
704 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
705 theme
->a_focused_pressed_desk
=
706 RrAppearanceCopy(theme
->a_focused_pressed_max
);
707 theme
->a_disabled_focused_shade
=
708 RrAppearanceCopy(theme
->a_disabled_focused_max
);
709 theme
->a_disabled_unfocused_shade
=
710 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
711 theme
->a_hover_focused_shade
=
712 RrAppearanceCopy(theme
->a_hover_focused_max
);
713 theme
->a_hover_unfocused_shade
=
714 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
715 theme
->a_toggled_focused_pressed_shade
=
716 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
717 theme
->a_toggled_unfocused_pressed_shade
=
718 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
719 theme
->a_toggled_focused_unpressed_shade
=
720 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
721 theme
->a_toggled_unfocused_unpressed_shade
=
722 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
723 theme
->a_toggled_hover_focused_shade
=
724 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
725 theme
->a_toggled_hover_unfocused_shade
=
726 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
727 theme
->a_unfocused_unpressed_shade
=
728 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
729 theme
->a_unfocused_pressed_shade
=
730 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
731 theme
->a_focused_unpressed_shade
=
732 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
733 theme
->a_focused_pressed_shade
=
734 RrAppearanceCopy(theme
->a_focused_pressed_max
);
735 theme
->a_disabled_focused_iconify
=
736 RrAppearanceCopy(theme
->a_disabled_focused_max
);
737 theme
->a_disabled_unfocused_iconify
=
738 RrAppearanceCopy(theme
->a_disabled_focused_max
);
739 theme
->a_hover_focused_iconify
=
740 RrAppearanceCopy(theme
->a_hover_focused_max
);
741 theme
->a_hover_unfocused_iconify
=
742 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
743 theme
->a_unfocused_unpressed_iconify
=
744 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
745 theme
->a_unfocused_pressed_iconify
=
746 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
747 theme
->a_focused_unpressed_iconify
=
748 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
749 theme
->a_focused_pressed_iconify
=
750 RrAppearanceCopy(theme
->a_focused_pressed_max
);
752 theme
->a_icon
->surface
.grad
=
753 theme
->a_clear
->surface
.grad
=
754 theme
->a_clear_tex
->surface
.grad
=
755 theme
->a_menu_normal
->surface
.grad
=
756 theme
->a_menu_disabled
->surface
.grad
=
757 theme
->a_menu_text_normal
->surface
.grad
=
758 theme
->a_menu_text_disabled
->surface
.grad
=
759 theme
->a_menu_text_selected
->surface
.grad
=
760 theme
->a_menu_bullet_normal
->surface
.grad
=
761 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
763 /* set up the textures */
764 theme
->a_focused_label
->texture
[0].type
=
765 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
766 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
767 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
768 theme
->a_focused_label
->texture
[0].data
.text
.font
=
769 theme
->osd_hilite_label
->texture
[0].data
.text
.font
=
770 theme
->win_font_focused
;
771 theme
->a_focused_label
->texture
[0].data
.text
.color
=
772 theme
->title_focused_color
;
773 theme
->osd_hilite_label
->texture
[0].data
.text
.color
=
776 if (!FIND(shadow
, L("window","active","label","text","shadow","offset"),
777 theme
->a_focused_label
))
778 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
=
779 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
780 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
781 theme
->title_focused_shadow_color
;
782 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
783 theme
->title_focused_shadow_alpha
;
785 if (!FIND(shadow
, L("osd","text","shadow","offset"),
786 theme
->osd_hilite_label
))
788 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
789 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
790 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
791 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
793 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
794 theme
->osd_shadow_color
;
795 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
796 theme
->osd_shadow_alpha
;
798 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
799 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
800 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
801 theme
->win_font_unfocused
;
802 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
803 theme
->title_unfocused_color
;
805 if (!FIND(shadow
, L("window","inactive","label","text","shadow","offset"),
806 theme
->a_unfocused_label
))
807 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
=
808 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
809 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
810 theme
->title_unfocused_shadow_color
;
811 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
812 theme
->title_unfocused_shadow_alpha
;
814 theme
->a_menu_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
815 theme
->a_menu_title
->texture
[0].data
.text
.justify
= mtitlejust
;
816 theme
->a_menu_title
->texture
[0].data
.text
.font
= theme
->menu_title_font
;
817 theme
->a_menu_title
->texture
[0].data
.text
.color
= theme
->menu_title_color
;
819 if (!FIND(shadow
, L("menu","title","text","shadow","offset"),
820 theme
->a_menu_title
))
821 theme
->a_menu_title
->texture
[0].data
.text
.shadow_offset_x
=
822 theme
->a_menu_title
->texture
[0].data
.text
.shadow_offset_y
= 0;
823 theme
->a_menu_title
->texture
[0].data
.text
.shadow_color
=
824 theme
->menu_title_shadow_color
;
825 theme
->a_menu_title
->texture
[0].data
.text
.shadow_alpha
=
826 theme
->menu_title_shadow_alpha
;
828 theme
->a_menu_text_normal
->texture
[0].type
=
829 theme
->a_menu_text_disabled
->texture
[0].type
=
830 theme
->a_menu_text_selected
->texture
[0].type
= RR_TEXTURE_TEXT
;
831 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
832 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
833 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
835 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
836 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
837 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
839 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
840 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
841 theme
->menu_disabled_color
;
842 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
843 theme
->menu_selected_color
;
845 if (!FIND(shadow
, L("menu","inactive","shadow","offset"),
846 theme
->a_menu_text_normal
))
847 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_x
=
848 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
=
850 if (!FIND(shadow
, L("menu","active","text","shadow","offset"),
851 theme
->a_menu_text_selected
))
852 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_x
=
853 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_y
=
855 if (!FIND(shadow
, L("menu","disabled","shadow","offset"),
856 theme
->a_menu_text_disabled
))
857 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_x
=
858 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_y
=
860 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
861 theme
->menu_text_normal_shadow_color
;
862 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
863 theme
->menu_text_normal_shadow_alpha
;
864 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
865 theme
->menu_text_selected_shadow_color
;
866 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
867 theme
->menu_text_selected_shadow_alpha
;
868 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
869 theme
->menu_text_disabled_shadow_color
;
870 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
871 theme
->menu_text_disabled_shadow_alpha
;
873 theme
->a_disabled_focused_max
->texture
[0].type
=
874 theme
->a_disabled_unfocused_max
->texture
[0].type
=
875 theme
->a_hover_focused_max
->texture
[0].type
=
876 theme
->a_hover_unfocused_max
->texture
[0].type
=
877 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
878 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
879 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
880 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
881 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
882 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
883 theme
->a_focused_unpressed_max
->texture
[0].type
=
884 theme
->a_focused_pressed_max
->texture
[0].type
=
885 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
886 theme
->a_unfocused_pressed_max
->texture
[0].type
=
887 theme
->a_disabled_focused_close
->texture
[0].type
=
888 theme
->a_disabled_unfocused_close
->texture
[0].type
=
889 theme
->a_hover_focused_close
->texture
[0].type
=
890 theme
->a_hover_unfocused_close
->texture
[0].type
=
891 theme
->a_focused_unpressed_close
->texture
[0].type
=
892 theme
->a_focused_pressed_close
->texture
[0].type
=
893 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
894 theme
->a_unfocused_pressed_close
->texture
[0].type
=
895 theme
->a_disabled_focused_desk
->texture
[0].type
=
896 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
897 theme
->a_hover_focused_desk
->texture
[0].type
=
898 theme
->a_hover_unfocused_desk
->texture
[0].type
=
899 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
900 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
901 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
902 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
903 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
904 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
905 theme
->a_focused_unpressed_desk
->texture
[0].type
=
906 theme
->a_focused_pressed_desk
->texture
[0].type
=
907 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
908 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
909 theme
->a_disabled_focused_shade
->texture
[0].type
=
910 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
911 theme
->a_hover_focused_shade
->texture
[0].type
=
912 theme
->a_hover_unfocused_shade
->texture
[0].type
=
913 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
914 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
915 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
916 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
917 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
918 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
919 theme
->a_focused_unpressed_shade
->texture
[0].type
=
920 theme
->a_focused_pressed_shade
->texture
[0].type
=
921 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
922 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
923 theme
->a_disabled_focused_iconify
->texture
[0].type
=
924 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
925 theme
->a_hover_focused_iconify
->texture
[0].type
=
926 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
927 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
928 theme
->a_focused_pressed_iconify
->texture
[0].type
=
929 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
930 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
931 theme
->a_menu_bullet_normal
->texture
[0].type
=
932 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
934 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
935 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
936 theme
->max_disabled_mask
;
937 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
938 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
939 theme
->max_hover_mask
;
940 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
941 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
942 theme
->max_pressed_mask
;
943 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
944 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
946 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
947 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
948 theme
->max_toggled_pressed_mask
;
949 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
950 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
951 theme
->max_toggled_mask
;
952 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
953 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
954 theme
->max_toggled_hover_mask
;
955 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
956 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
957 theme
->close_disabled_mask
;
958 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
959 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
960 theme
->close_hover_mask
;
961 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
962 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
963 theme
->close_pressed_mask
;
964 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
965 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
967 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
968 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
969 theme
->desk_disabled_mask
;
970 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
971 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
972 theme
->desk_hover_mask
;
973 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
974 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
975 theme
->desk_pressed_mask
;
976 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
977 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
979 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
980 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
981 theme
->desk_toggled_pressed_mask
;
982 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
983 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
984 theme
->desk_toggled_mask
;
985 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
986 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
987 theme
->desk_toggled_hover_mask
;
988 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
989 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
990 theme
->shade_disabled_mask
;
991 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
992 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
993 theme
->shade_hover_mask
;
994 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
995 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
996 theme
->shade_pressed_mask
;
997 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
998 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1000 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1001 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1002 theme
->shade_toggled_pressed_mask
;
1003 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1004 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1005 theme
->shade_toggled_mask
;
1006 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1007 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1008 theme
->shade_toggled_hover_mask
;
1009 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1010 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1011 theme
->iconify_disabled_mask
;
1012 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1013 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1014 theme
->iconify_hover_mask
;
1015 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1016 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1017 theme
->iconify_pressed_mask
;
1018 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1019 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1020 theme
->iconify_mask
;
1021 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1022 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1023 theme
->menu_bullet_mask
;
1024 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1025 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1026 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1027 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1028 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1029 theme
->titlebut_disabled_focused_color
;
1030 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1031 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1032 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1033 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1034 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1035 theme
->titlebut_disabled_unfocused_color
;
1036 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1037 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1038 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1039 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1040 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1041 theme
->titlebut_hover_focused_color
;
1042 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1043 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1044 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1045 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1046 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1047 theme
->titlebut_hover_unfocused_color
;
1048 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1049 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1050 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1051 theme
->titlebut_toggled_hover_focused_color
;
1052 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1053 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1054 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1055 theme
->titlebut_toggled_hover_unfocused_color
;
1056 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1057 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1058 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1059 theme
->titlebut_toggled_focused_pressed_color
;
1060 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1061 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1062 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1063 theme
->titlebut_toggled_unfocused_pressed_color
;
1064 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1065 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1066 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1067 theme
->titlebut_toggled_focused_unpressed_color
;
1068 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1069 theme
->a_toggled_unfocused_unpressed_desk
->
1070 texture
[0].data
.mask
.color
=
1071 theme
->a_toggled_unfocused_unpressed_shade
->
1072 texture
[0].data
.mask
.color
=
1073 theme
->titlebut_toggled_unfocused_unpressed_color
;
1074 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1075 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1076 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1077 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1078 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1079 theme
->titlebut_focused_unpressed_color
;
1080 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1081 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1082 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1083 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1084 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1085 theme
->titlebut_focused_pressed_color
;
1086 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1087 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1088 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1089 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1090 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1091 theme
->titlebut_unfocused_unpressed_color
;
1092 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1093 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1094 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1095 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1096 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1097 theme
->titlebut_unfocused_pressed_color
;
1098 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1100 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1101 theme
->menu_selected_color
;
1104 parse_close(ps
.doc
);
1107 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1108 RrAppearance
*a
, *b
, *c
;
1110 /* caluclate the font heights*/
1111 a
= theme
->a_focused_label
;
1112 theme
->win_font_height
=
1113 RrFontHeight(theme
->win_font_focused
,
1114 a
->texture
[0].data
.text
.shadow_offset_y
);
1115 a
= theme
->a_unfocused_label
;
1116 theme
->win_font_height
=
1117 MAX(theme
->win_font_height
,
1118 RrFontHeight(theme
->win_font_unfocused
,
1119 a
->texture
[0].data
.text
.shadow_offset_y
));
1120 a
= theme
->a_menu_title
;
1121 theme
->menu_title_font_height
=
1122 RrFontHeight(theme
->menu_title_font
,
1123 a
->texture
[0].data
.text
.shadow_offset_y
);
1124 a
= theme
->a_menu_text_normal
;
1125 b
= theme
->a_menu_text_selected
;
1126 c
= theme
->a_menu_text_disabled
;
1127 theme
->menu_font_height
=
1128 RrFontHeight(theme
->menu_font
,
1129 MAX(a
->texture
[0].data
.text
.shadow_offset_y
,
1130 MAX(b
->texture
[0].data
.text
.shadow_offset_y
,
1131 c
->texture
[0].data
.text
.shadow_offset_y
)));
1133 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1134 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1135 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1137 /* this would be nice I think, since padding.width can now be 0,
1138 but it breaks frame.c horribly and I don't feel like fixing that
1139 right now, so if anyone complains, here is how to keep text from
1140 going over the title's bevel/border with a padding.width of 0 and a
1141 bevelless/borderless label
1142 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1143 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1144 theme->title_height = theme->label_height +
1145 MAX(MAX(theme->padding * 2, ft + fb),
1146 MAX(theme->padding * 2, ut + ub));
1148 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1149 /* this should match the above title_height given the same font size
1151 theme
->menu_title_height
= theme
->menu_title_font_height
+
1152 theme
->paddingy
* 2;
1154 theme
->button_size
= theme
->label_height
- 2;
1155 theme
->grip_width
= 25;
1160 void RrThemeFree(RrTheme
*theme
)
1163 RrColorFree(theme
->menu_b_color
);
1164 RrColorFree(theme
->frame_b_color
);
1165 RrColorFree(theme
->cb_unfocused_color
);
1166 RrColorFree(theme
->cb_focused_color
);
1167 RrColorFree(theme
->title_focused_color
);
1168 RrColorFree(theme
->title_unfocused_color
);
1169 RrColorFree(theme
->titlebut_disabled_focused_color
);
1170 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1171 RrColorFree(theme
->titlebut_hover_focused_color
);
1172 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1173 RrColorFree(theme
->titlebut_focused_pressed_color
);
1174 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1175 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1176 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1177 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1178 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1179 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1180 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1181 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1182 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1183 RrColorFree(theme
->menu_title_color
);
1184 RrColorFree(theme
->menu_color
);
1185 RrColorFree(theme
->menu_disabled_color
);
1186 RrColorFree(theme
->menu_selected_color
);
1187 RrColorFree(theme
->title_focused_shadow_color
);
1188 RrColorFree(theme
->title_unfocused_shadow_color
);
1189 RrColorFree(theme
->osd_color
);
1190 RrColorFree(theme
->osd_shadow_color
);
1191 RrColorFree(theme
->menu_title_shadow_color
);
1192 RrColorFree(theme
->menu_text_normal_shadow_color
);
1193 RrColorFree(theme
->menu_text_selected_shadow_color
);
1194 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1196 g_free(theme
->def_win_icon
);
1198 RrPixmapMaskFree(theme
->max_mask
);
1199 RrPixmapMaskFree(theme
->max_toggled_mask
);
1200 RrPixmapMaskFree(theme
->max_disabled_mask
);
1201 RrPixmapMaskFree(theme
->max_hover_mask
);
1202 RrPixmapMaskFree(theme
->max_pressed_mask
);
1203 RrPixmapMaskFree(theme
->desk_mask
);
1204 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1205 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1206 RrPixmapMaskFree(theme
->desk_hover_mask
);
1207 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1208 RrPixmapMaskFree(theme
->shade_mask
);
1209 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1210 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1211 RrPixmapMaskFree(theme
->shade_hover_mask
);
1212 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1213 RrPixmapMaskFree(theme
->iconify_mask
);
1214 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1215 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1216 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1217 RrPixmapMaskFree(theme
->close_mask
);
1218 RrPixmapMaskFree(theme
->close_disabled_mask
);
1219 RrPixmapMaskFree(theme
->close_hover_mask
);
1220 RrPixmapMaskFree(theme
->close_pressed_mask
);
1221 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1223 RrFontClose(theme
->win_font_focused
);
1224 RrFontClose(theme
->win_font_unfocused
);
1225 RrFontClose(theme
->menu_title_font
);
1226 RrFontClose(theme
->menu_font
);
1228 RrAppearanceFree(theme
->a_disabled_focused_max
);
1229 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1230 RrAppearanceFree(theme
->a_hover_focused_max
);
1231 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1232 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1233 RrAppearanceFree(theme
->a_focused_pressed_max
);
1234 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1235 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1236 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1237 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1238 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1239 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1240 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1241 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1242 RrAppearanceFree(theme
->a_disabled_focused_close
);
1243 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1244 RrAppearanceFree(theme
->a_hover_focused_close
);
1245 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1246 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1247 RrAppearanceFree(theme
->a_focused_pressed_close
);
1248 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1249 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1250 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1251 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1252 RrAppearanceFree(theme
->a_hover_focused_desk
);
1253 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1254 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1255 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1256 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1257 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1258 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1259 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1260 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1261 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1262 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1263 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1264 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1265 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1266 RrAppearanceFree(theme
->a_hover_focused_shade
);
1267 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1268 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1269 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1270 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1271 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1272 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1273 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1274 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1275 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1276 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1277 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1278 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1279 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1280 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1281 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1282 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1283 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1284 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1285 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1286 RrAppearanceFree(theme
->a_focused_grip
);
1287 RrAppearanceFree(theme
->a_unfocused_grip
);
1288 RrAppearanceFree(theme
->a_focused_title
);
1289 RrAppearanceFree(theme
->a_unfocused_title
);
1290 RrAppearanceFree(theme
->a_focused_label
);
1291 RrAppearanceFree(theme
->a_unfocused_label
);
1292 RrAppearanceFree(theme
->a_icon
);
1293 RrAppearanceFree(theme
->a_focused_handle
);
1294 RrAppearanceFree(theme
->a_unfocused_handle
);
1295 RrAppearanceFree(theme
->a_menu
);
1296 RrAppearanceFree(theme
->a_menu_title
);
1297 RrAppearanceFree(theme
->a_menu_normal
);
1298 RrAppearanceFree(theme
->a_menu_disabled
);
1299 RrAppearanceFree(theme
->a_menu_selected
);
1300 RrAppearanceFree(theme
->a_menu_text_normal
);
1301 RrAppearanceFree(theme
->a_menu_text_disabled
);
1302 RrAppearanceFree(theme
->a_menu_text_selected
);
1303 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1304 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1305 RrAppearanceFree(theme
->a_clear
);
1306 RrAppearanceFree(theme
->a_clear_tex
);
1307 RrAppearanceFree(theme
->osd_hilite_bg
);
1308 RrAppearanceFree(theme
->osd_hilite_fg
);
1309 RrAppearanceFree(theme
->osd_hilite_label
);
1310 RrAppearanceFree(theme
->osd_unhilite_fg
);
1316 static gboolean
read_mask(ParseState
*ps
, const gchar
*maskname
,
1317 RrPixmapMask
**value
)
1319 gboolean ret
= FALSE
;
1321 gint hx
, hy
; /* ignored */
1325 s
= g_build_filename(ps
->path
, maskname
, NULL
);
1326 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1328 *value
= RrPixmapMaskNew(ps
->inst
, w
, h
, (gchar
*)b
);
1336 static void set_default_appearance(RrAppearance
*a
)
1338 a
->surface
.grad
= RR_SURFACE_SOLID
;
1339 a
->surface
.relief
= RR_RELIEF_FLAT
;
1340 a
->surface
.bevel
= RR_BEVEL_1
;
1341 a
->surface
.interlaced
= FALSE
;
1342 a
->surface
.border
= FALSE
;
1343 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1344 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1347 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1348 an RrTextureRGBA. */
1349 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1354 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1356 for (i
= 0; i
< width
* height
; ++i
) {
1357 guchar a
= ((*p
>> 24) & 0xff);
1358 guchar b
= ((*p
>> 16) & 0xff);
1359 guchar g
= ((*p
>> 8) & 0xff);
1360 guchar r
= ((*p
>> 0) & 0xff);
1362 *p
= ((r
<< RrDefaultRedOffset
) +
1363 (g
<< RrDefaultGreenOffset
) +
1364 (b
<< RrDefaultBlueOffset
) +
1365 (a
<< RrDefaultAlphaOffset
));
1372 static void parse_style(gchar
*tex
, RrSurfaceColorType
*grad
,
1373 RrReliefType
*relief
, RrBevelType
*bevel
,
1374 gboolean
*interlaced
, gboolean
*border
,
1375 gboolean allow_trans
)
1379 /* convert to all lowercase */
1380 for (t
= tex
; *t
!= '\0'; ++t
)
1381 *t
= g_ascii_tolower(*t
);
1383 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1384 *grad
= RR_SURFACE_PARENTREL
;
1386 if (strstr(tex
, "gradient") != NULL
) {
1387 if (strstr(tex
, "crossdiagonal") != NULL
)
1388 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1389 else if (strstr(tex
, "pyramid") != NULL
)
1390 *grad
= RR_SURFACE_PYRAMID
;
1391 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1392 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1393 else if (strstr(tex
, "horizontal") != NULL
)
1394 *grad
= RR_SURFACE_HORIZONTAL
;
1395 else if (strstr(tex
, "splitvertical") != NULL
)
1396 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1397 else if (strstr(tex
, "vertical") != NULL
)
1398 *grad
= RR_SURFACE_VERTICAL
;
1400 *grad
= RR_SURFACE_DIAGONAL
;
1402 *grad
= RR_SURFACE_SOLID
;
1405 if (strstr(tex
, "sunken") != NULL
)
1406 *relief
= RR_RELIEF_SUNKEN
;
1407 else if (strstr(tex
, "flat") != NULL
)
1408 *relief
= RR_RELIEF_FLAT
;
1410 *relief
= RR_RELIEF_RAISED
;
1413 if (*relief
== RR_RELIEF_FLAT
) {
1414 if (strstr(tex
, "border") != NULL
)
1417 if (strstr(tex
, "bevel2") != NULL
)
1418 *bevel
= RR_BEVEL_2
;
1420 *bevel
= RR_BEVEL_1
;
1423 if (strstr(tex
, "interlaced") != NULL
)
1426 *interlaced
= FALSE
;
1430 static xmlNodePtr
find_node(xmlNodePtr n
, const gchar
*names
[])
1434 for (i
= 0; names
[i
] && n
; ++i
)
1435 n
= parse_find_node(names
[i
], n
->children
);
1439 static gboolean
find_int(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1440 gint
*integer
, gint lower
, gint upper
)
1444 if ((n
= find_node(n
, names
))) {
1445 i
= parse_int(ps
->doc
, n
);
1446 if (i
>= lower
&& i
<= upper
) {
1454 static gboolean
find_string(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1455 const gchar
**string
)
1457 if ((n
= find_node(n
, names
))) {
1458 *string
= parse_string(ps
->doc
, n
);
1464 static gboolean
find_color(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1465 RrColor
**color
, gchar
*alpha
)
1467 if ((n
= find_node(n
, names
))) {
1469 if (parse_attr_int("r", n
, &r
) &&
1470 parse_attr_int("g", n
, &g
) &&
1471 parse_attr_int("b", n
, &b
) &&
1472 parse_attr_int("a", n
, &a
) &&
1473 r
>= 0 && g
>= 0 && b
>= 0 && a
>= 0 &&
1474 r
< 256 && g
< 256 && b
< 256 && a
< 256)
1476 *color
= RrColorNew(ps
->inst
, r
, g
, b
);
1477 if (alpha
) *alpha
= a
;
1484 static gboolean
find_point(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1486 gint lowx
, gint upx
, gint lowy
, gint upy
)
1488 if ((n
= find_node(n
, names
))) {
1490 if (parse_attr_int("x", n
, &a
) &&
1491 parse_attr_int("y", n
, &b
) &&
1492 a
>= lowx
&& a
<= upx
&& b
>= lowy
&& b
<= upy
)
1501 static gboolean
find_shadow(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1504 return find_point(ps
, n
, names
,
1505 &a
->texture
[0].data
.text
.shadow_offset_x
,
1506 &a
->texture
[0].data
.text
.shadow_offset_y
,
1510 static gboolean
find_appearance(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1511 RrAppearance
*a
, gboolean allow_trans
)
1515 if (!(n
= find_node(n
, names
)))
1518 if ((n2
= find_node(n
, L("style")))) {
1519 gchar
*s
= parse_string(ps
->doc
, n2
);
1520 parse_style(s
, &a
->surface
.grad
, &a
->surface
.relief
,
1521 &a
->surface
.bevel
, &a
->surface
.interlaced
,
1522 &a
->surface
.border
, allow_trans
);
1527 if (!find_color(ps
, n
, L("primary"), &a
->surface
.primary
, NULL
))
1528 a
->surface
.primary
= RrColorNew(ps
->inst
, 0, 0, 0);
1529 if (!find_color(ps
, n
, L("secondary"), &a
->surface
.secondary
, NULL
))
1530 a
->surface
.secondary
= RrColorNew(ps
->inst
, 0, 0, 0);
1531 if (a
->surface
.border
)
1532 if (!find_color(ps
, n
, L("border"),
1533 &a
->surface
.border_color
, NULL
))
1534 a
->surface
.border_color
= RrColorNew(ps
->inst
, 0, 0, 0);
1535 if (a
->surface
.interlaced
)
1536 if (!find_color(ps
, n
, L("interlace"),
1537 &a
->surface
.interlace_color
, NULL
))
1538 a
->surface
.interlace_color
= RrColorNew(ps
->inst
, 0, 0, 0);