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
[],
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
, const gchar
*name
,
68 gboolean allow_fallback
,
69 RrFont
*active_window_font
, RrFont
*inactive_window_font
,
70 RrFont
*menu_title_font
, RrFont
*menu_item_font
,
75 RrJustify winjust
, mtitlejust
;
81 if (!parse_load_theme(name
, &ps
.doc
, &root
, &ps
.path
)) {
82 g_message("Unable to load the theme '%s'", name
);
84 g_message("Falling back to the default theme '%s'",
86 /* make it fall back to default theme */
92 if (!parse_load_theme(DEFAULT_THEME
, &ps
.doc
, &root
, &ps
.path
)) {
93 g_message("Unable to load the theme '%s'", DEFAULT_THEME
);
102 theme
= g_new0(RrTheme
, 1);
104 theme
->name
= g_strdup(name
? name
: DEFAULT_THEME
);
106 theme
->a_disabled_focused_max
= RrAppearanceNew(inst
, 1);
107 theme
->a_disabled_unfocused_max
= RrAppearanceNew(inst
, 1);
108 theme
->a_hover_focused_max
= RrAppearanceNew(inst
, 1);
109 theme
->a_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
110 theme
->a_toggled_focused_pressed_max
= RrAppearanceNew(inst
, 1);
111 theme
->a_toggled_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
112 theme
->a_toggled_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
113 theme
->a_toggled_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
114 theme
->a_toggled_hover_focused_max
= RrAppearanceNew(inst
, 1);
115 theme
->a_toggled_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
116 theme
->a_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
117 theme
->a_focused_pressed_max
= RrAppearanceNew(inst
, 1);
118 theme
->a_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
119 theme
->a_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
120 theme
->a_focused_grip
= RrAppearanceNew(inst
, 0);
121 theme
->a_unfocused_grip
= RrAppearanceNew(inst
, 0);
122 theme
->a_focused_title
= RrAppearanceNew(inst
, 0);
123 theme
->a_unfocused_title
= RrAppearanceNew(inst
, 0);
124 theme
->a_focused_label
= RrAppearanceNew(inst
, 1);
125 theme
->a_unfocused_label
= RrAppearanceNew(inst
, 1);
126 theme
->a_icon
= RrAppearanceNew(inst
, 1);
127 theme
->a_focused_handle
= RrAppearanceNew(inst
, 0);
128 theme
->a_unfocused_handle
= RrAppearanceNew(inst
, 0);
129 theme
->a_menu
= RrAppearanceNew(inst
, 0);
130 theme
->a_menu_title
= RrAppearanceNew(inst
, 0);
131 theme
->a_menu_text_title
= RrAppearanceNew(inst
, 1);
132 theme
->a_menu_normal
= RrAppearanceNew(inst
, 0);
133 theme
->a_menu_disabled
= RrAppearanceNew(inst
, 0);
134 theme
->a_menu_disabled_selected
= RrAppearanceNew(inst
, 0);
135 theme
->a_menu_selected
= RrAppearanceNew(inst
, 0);
136 theme
->a_menu_text_normal
= RrAppearanceNew(inst
, 1);
137 theme
->a_menu_text_selected
= RrAppearanceNew(inst
, 1);
138 theme
->a_menu_text_disabled
= RrAppearanceNew(inst
, 1);
139 theme
->a_menu_text_disabled_selected
= RrAppearanceNew(inst
, 1);
140 theme
->a_menu_bullet_normal
= RrAppearanceNew(inst
, 1);
141 theme
->a_menu_bullet_selected
= RrAppearanceNew(inst
, 1);
142 theme
->a_clear
= RrAppearanceNew(inst
, 0);
143 theme
->a_clear_tex
= RrAppearanceNew(inst
, 1);
144 theme
->osd_hilite_bg
= RrAppearanceNew(inst
, 0);
145 theme
->osd_hilite_label
= RrAppearanceNew(inst
, 1);
146 theme
->osd_hilite_fg
= RrAppearanceNew(inst
, 0);
147 theme
->osd_unhilite_fg
= RrAppearanceNew(inst
, 0);
149 /* load the font stuff */
151 if (active_window_font
) {
152 theme
->win_font_focused
= active_window_font
;
153 RrFontRef(active_window_font
);
155 theme
->win_font_focused
= RrFontOpenDefault(inst
);
157 if (inactive_window_font
) {
158 theme
->win_font_unfocused
= inactive_window_font
;
159 RrFontRef(inactive_window_font
);
161 theme
->win_font_unfocused
= RrFontOpenDefault(inst
);
163 winjust
= RR_JUSTIFY_LEFT
;
164 if (FIND(string
, L( "window", "justify"), &str
)) {
165 if (strcmp(str
, "right") == 0)
166 winjust
= RR_JUSTIFY_RIGHT
;
167 else if (strcmp(str
, "center") == 0)
168 winjust
= RR_JUSTIFY_CENTER
;
172 if (menu_title_font
) {
173 theme
->menu_title_font
= menu_title_font
;
174 RrFontRef(menu_title_font
);
176 theme
->menu_title_font
= RrFontOpenDefault(inst
);
178 mtitlejust
= RR_JUSTIFY_LEFT
;
179 if (FIND(string
, L("menu", "justify"), &str
)) {
180 if (strcmp(str
, "right") == 0)
181 mtitlejust
= RR_JUSTIFY_RIGHT
;
182 else if (strcmp(str
, "center") == 0)
183 mtitlejust
= RR_JUSTIFY_CENTER
;
187 if (menu_item_font
) {
188 theme
->menu_font
= menu_item_font
;
189 RrFontRef(menu_item_font
);
191 theme
->menu_font
= RrFontOpenDefault(inst
);
194 theme
->osd_font
= osd_font
;
197 theme
->osd_font
= RrFontOpenDefault(inst
);
199 /* load direct dimensions */
200 if (!FIND(int, L("menu","overlap"),
201 &theme
->menu_overlap
, -100, 100))
202 theme
->menu_overlap
= 0;
204 if (!FIND(int, L("dimensions","handle"), &theme
->handle_height
, 0, 100))
205 theme
->handle_height
= 6;
207 if (!FIND(point
, L("dimensions","padding"),
208 &theme
->paddingx
, &theme
->paddingy
, 0, 100, 0, 100))
209 theme
->paddingx
= theme
->paddingy
= 3;
211 if (!FIND(int, L("dimensions","window","border"),
212 &theme
->fbwidth
, 0, 100))
215 /* menu border width inherits from frame border width */
216 if (!FIND(int, L("dimensions","menu","border"), &theme
->mbwidth
, 0, 100))
217 theme
->mbwidth
= theme
->fbwidth
;
219 /* osd border width inherits from frame border width */
220 if (!FIND(int, L("dimensions","osd","border"), &theme
->obwidth
, 0, 100))
221 theme
->obwidth
= theme
->fbwidth
;
223 if (!FIND(point
, L("dimensions","window","clientpadding"),
224 &theme
->cbwidthx
, &theme
->cbwidthy
, 0, 100, 0, 100))
225 theme
->cbwidthx
= theme
->cbwidthy
= 1;
228 if (!FIND(color
, L("window","active","border"),
229 &theme
->frame_focused_border_color
, NULL
))
230 theme
->frame_focused_border_color
= RrColorNew(inst
, 0, 0, 0);
231 /* title separator focused color inherits from focused boder color */
232 if (!FIND(color
, L("window","active","titleseparator"),
233 &theme
->title_separator_focused_color
, NULL
))
234 theme
->title_separator_focused_color
=
236 theme
->frame_focused_border_color
->r
,
237 theme
->frame_focused_border_color
->g
,
238 theme
->frame_focused_border_color
->b
);
239 /* frame unfocused border color inherits from frame focused border color */
240 if (!FIND(color
, L("window","inactive","border"),
241 &theme
->frame_unfocused_border_color
, NULL
))
242 theme
->frame_unfocused_border_color
=
244 theme
->frame_focused_border_color
->r
,
245 theme
->frame_focused_border_color
->g
,
246 theme
->frame_focused_border_color
->b
);
247 /* title separator unfocused color inherits from unfocused boder color */
248 if (!FIND(color
, L("window","inactive","titleseparator"),
249 &theme
->title_separator_unfocused_color
, NULL
))
250 theme
->title_separator_unfocused_color
=
252 theme
->frame_unfocused_border_color
->r
,
253 theme
->frame_unfocused_border_color
->g
,
254 theme
->frame_unfocused_border_color
->b
);
256 /* menu border color inherits from frame focused border color */
257 if (!FIND(color
, L("menu","border"), &theme
->menu_border_color
, NULL
))
258 theme
->menu_border_color
=
260 theme
->frame_focused_border_color
->r
,
261 theme
->frame_focused_border_color
->g
,
262 theme
->frame_focused_border_color
->b
);
263 /* osd border color inherits from frame focused border color */
264 if (!FIND(color
, L("osd","border"), &theme
->osd_border_color
, NULL
))
265 theme
->osd_border_color
=
267 theme
->frame_focused_border_color
->r
,
268 theme
->frame_focused_border_color
->g
,
269 theme
->frame_focused_border_color
->b
);
270 if (!FIND(color
, L("window","active","clientpadding"),
271 &theme
->cb_focused_color
, NULL
))
272 theme
->cb_focused_color
= RrColorNew(inst
, 255, 255, 255);
273 if (!FIND(color
, L("window","inactive","clientpadding"),
274 &theme
->cb_unfocused_color
, NULL
))
275 theme
->cb_unfocused_color
= RrColorNew(inst
, 255, 255, 255);
276 if (!FIND(color
, L("window","active","label","text","primary"),
277 &theme
->title_focused_color
, NULL
))
278 theme
->title_focused_color
= RrColorNew(inst
, 0x0, 0x0, 0x0);
279 if (!FIND(color
, L("osd","label","text","primary"),
280 &theme
->osd_color
, NULL
))
281 theme
->osd_color
= RrColorNew(inst
,
282 theme
->title_focused_color
->r
,
283 theme
->title_focused_color
->g
,
284 theme
->title_focused_color
->b
);
285 if (!FIND(color
, L("window","inactive","label","text","primary"),
286 &theme
->title_unfocused_color
, NULL
))
287 theme
->title_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
288 if (!FIND(color
, L("window","active","buttons","unpressed","image"),
289 &theme
->titlebut_focused_unpressed_color
, NULL
))
290 theme
->titlebut_focused_unpressed_color
= RrColorNew(inst
, 0, 0, 0);
291 if (!FIND(color
, L("window","inactive","buttons", "unpressed","image"),
292 &theme
->titlebut_unfocused_unpressed_color
, NULL
))
293 theme
->titlebut_unfocused_unpressed_color
=
294 RrColorNew(inst
, 0xff, 0xff, 0xff);
295 if (!FIND(color
, L("window","active","buttons","pressed","image"),
296 &theme
->titlebut_focused_pressed_color
, NULL
))
297 theme
->titlebut_focused_pressed_color
=
299 theme
->titlebut_focused_unpressed_color
->r
,
300 theme
->titlebut_focused_unpressed_color
->g
,
301 theme
->titlebut_focused_unpressed_color
->b
);
302 if (!FIND(color
, L("window","inactive","buttons","pressed","image"),
303 &theme
->titlebut_unfocused_pressed_color
, NULL
))
304 theme
->titlebut_unfocused_pressed_color
=
306 theme
->titlebut_unfocused_unpressed_color
->r
,
307 theme
->titlebut_unfocused_unpressed_color
->g
,
308 theme
->titlebut_unfocused_unpressed_color
->b
);
309 if (!FIND(color
, L("window","active","buttons","disabled","image"),
310 &theme
->titlebut_disabled_focused_color
, NULL
))
311 theme
->titlebut_disabled_focused_color
=
312 RrColorNew(inst
, 0xff, 0xff, 0xff);
313 if (!FIND(color
, L("window","inactive","buttons","disabled","image"),
314 &theme
->titlebut_disabled_unfocused_color
, NULL
))
315 theme
->titlebut_disabled_unfocused_color
= RrColorNew(inst
, 0, 0, 0);
317 L("window","active","buttons","hover","image"),
318 &theme
->titlebut_hover_focused_color
, NULL
))
319 theme
->titlebut_hover_focused_color
=
321 theme
->titlebut_focused_unpressed_color
->r
,
322 theme
->titlebut_focused_unpressed_color
->g
,
323 theme
->titlebut_focused_unpressed_color
->b
);
324 if (!FIND(color
, L("window","inactive","buttons","hover","image"),
325 &theme
->titlebut_hover_unfocused_color
, NULL
))
326 theme
->titlebut_hover_unfocused_color
=
328 theme
->titlebut_unfocused_unpressed_color
->r
,
329 theme
->titlebut_unfocused_unpressed_color
->g
,
330 theme
->titlebut_unfocused_unpressed_color
->b
);
332 L("window","active","buttons","toggled-pressed","image"),
333 &theme
->titlebut_toggled_focused_pressed_color
, NULL
))
334 theme
->titlebut_toggled_focused_pressed_color
=
336 theme
->titlebut_focused_pressed_color
->r
,
337 theme
->titlebut_focused_pressed_color
->g
,
338 theme
->titlebut_focused_pressed_color
->b
);
340 L("window","inactive","buttons","toggled-pressed","image"),
341 &theme
->titlebut_toggled_unfocused_pressed_color
, NULL
))
342 theme
->titlebut_toggled_unfocused_pressed_color
=
344 theme
->titlebut_unfocused_pressed_color
->r
,
345 theme
->titlebut_unfocused_pressed_color
->g
,
346 theme
->titlebut_unfocused_pressed_color
->b
);
348 L("window","active","buttons","toggled-unpressed","image"),
349 &theme
->titlebut_toggled_focused_unpressed_color
, NULL
))
350 theme
->titlebut_toggled_focused_unpressed_color
=
352 theme
->titlebut_focused_pressed_color
->r
,
353 theme
->titlebut_focused_pressed_color
->g
,
354 theme
->titlebut_focused_pressed_color
->b
);
356 L("window","inactive","buttons","toggled-unpressed","image"),
357 &theme
->titlebut_toggled_unfocused_unpressed_color
, NULL
))
358 theme
->titlebut_toggled_unfocused_unpressed_color
=
360 theme
->titlebut_unfocused_pressed_color
->r
,
361 theme
->titlebut_unfocused_pressed_color
->g
,
362 theme
->titlebut_unfocused_pressed_color
->b
);
364 L("window","active","buttons","toggled-hover","image"),
365 &theme
->titlebut_toggled_hover_focused_color
, NULL
))
366 theme
->titlebut_toggled_hover_focused_color
=
368 theme
->titlebut_toggled_focused_unpressed_color
->r
,
369 theme
->titlebut_toggled_focused_unpressed_color
->g
,
370 theme
->titlebut_toggled_focused_unpressed_color
->b
);
372 L("window","inactive","buttons","toggled-hover","image"),
373 &theme
->titlebut_toggled_hover_unfocused_color
, NULL
))
374 theme
->titlebut_toggled_hover_unfocused_color
=
376 theme
->titlebut_toggled_unfocused_unpressed_color
->r
,
377 theme
->titlebut_toggled_unfocused_unpressed_color
->g
,
378 theme
->titlebut_toggled_unfocused_unpressed_color
->b
);
379 if (!FIND(color
, L("menu","title","text","primary"),
380 &theme
->menu_title_color
, NULL
))
381 theme
->menu_title_color
= RrColorNew(inst
, 0, 0, 0);
382 if (!FIND(color
, L("menu","inactive","primary"), &theme
->menu_color
, NULL
))
383 theme
->menu_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
384 if (!FIND(color
, L("menu","disabled","primary"),
385 &theme
->menu_disabled_color
, NULL
))
386 theme
->menu_disabled_color
= RrColorNew(inst
, 0, 0, 0);
387 if (!FIND(color
, L("menu","active-disabled","text","primary"),
388 &theme
->menu_disabled_selected_color
, NULL
))
389 theme
->menu_disabled_selected_color
=
391 theme
->menu_disabled_color
->r
,
392 theme
->menu_disabled_color
->g
,
393 theme
->menu_disabled_color
->b
);
394 if (!FIND(color
, L("menu","active","text","primary"),
395 &theme
->menu_selected_color
, NULL
))
396 theme
->menu_selected_color
= RrColorNew(inst
, 0, 0, 0);
397 if (!FIND(color
, L("window","active","label","text","shadow","primary"),
398 &theme
->title_focused_shadow_color
,
399 &theme
->title_focused_shadow_alpha
))
401 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
402 theme
->title_focused_shadow_alpha
= 50;
404 if (!FIND(color
, L("osd","label","text","shadow","primary"),
405 &theme
->osd_shadow_color
, &theme
->osd_shadow_alpha
))
407 theme
->osd_shadow_color
=
408 RrColorNew(inst
, theme
->title_focused_shadow_color
->r
,
409 theme
->title_focused_shadow_color
->g
,
410 theme
->title_focused_shadow_color
->b
);
411 theme
->osd_shadow_alpha
= theme
->title_focused_shadow_alpha
;
413 if (!FIND(color
, L("window","inactive","label","text","shadow","primary"),
414 &theme
->title_unfocused_shadow_color
,
415 &theme
->title_unfocused_shadow_alpha
))
417 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
418 theme
->title_unfocused_shadow_alpha
= 50;
420 if (!FIND(color
, L("menu","title","text","shadow","primary"),
421 &theme
->menu_title_shadow_color
,
422 &theme
->menu_title_shadow_alpha
))
424 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
425 theme
->menu_title_shadow_alpha
= 50;
427 if (!FIND(color
, L("menu","inactive","shadow","primary"),
428 &theme
->menu_text_normal_shadow_color
,
429 &theme
->menu_text_normal_shadow_alpha
))
431 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
432 theme
->menu_text_normal_shadow_alpha
= 50;
434 if (!FIND(color
, L("menu","active","text","shadow","primary"),
435 &theme
->menu_text_selected_shadow_color
,
436 &theme
->menu_text_selected_shadow_alpha
))
438 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
439 theme
->menu_text_selected_shadow_alpha
= 50;
441 if (!FIND(color
, L("menu","disabled","shadow","primary"),
442 &theme
->menu_text_disabled_shadow_color
,
443 &theme
->menu_text_disabled_shadow_alpha
))
445 theme
->menu_text_disabled_shadow_color
=
446 RrColorNew(inst
, theme
->menu_text_normal_shadow_color
->r
,
447 theme
->menu_text_normal_shadow_color
->g
,
448 theme
->menu_text_normal_shadow_color
->b
);
449 theme
->menu_text_disabled_shadow_alpha
=
450 theme
->menu_text_normal_shadow_alpha
;
452 if (!FIND(color
, L("menu","active-disabled","shadow","primary"),
453 &theme
->menu_text_disabled_selected_shadow_color
,
454 &theme
->menu_text_disabled_selected_shadow_alpha
))
456 theme
->menu_text_disabled_selected_shadow_color
=
457 RrColorNew(inst
, theme
->menu_text_disabled_shadow_color
->r
,
458 theme
->menu_text_disabled_shadow_color
->g
,
459 theme
->menu_text_disabled_shadow_color
->b
);
460 theme
->menu_text_disabled_selected_shadow_alpha
=
461 theme
->menu_text_disabled_shadow_alpha
;
464 /* load the image masks */
466 /* maximize button masks */
468 if (!read_mask(&ps
, "max.xbm", &theme
->max_mask
)) {
469 guchar data
[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
470 theme
->max_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
473 if (!read_mask(&ps
, "max_toggled.xbm", &theme
->max_toggled_mask
)) {
475 theme
->max_toggled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
477 guchar data
[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
478 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 6, 6,(gchar
*)data
);
481 if (!read_mask(&ps
, "max_pressed.xbm", &theme
->max_pressed_mask
))
482 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
483 if (!read_mask(&ps
, "max_disabled.xbm", &theme
->max_disabled_mask
))
484 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
485 if (!read_mask(&ps
, "max_hover.xbm", &theme
->max_hover_mask
))
486 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
487 if (!read_mask(&ps
, "max_toggled_pressed.xbm",
488 &theme
->max_toggled_pressed_mask
))
489 theme
->max_toggled_pressed_mask
=
490 RrPixmapMaskCopy(theme
->max_toggled_mask
);
491 if (!read_mask(&ps
, "max_toggled_hover.xbm",
492 &theme
->max_toggled_hover_mask
))
493 theme
->max_toggled_hover_mask
=
494 RrPixmapMaskCopy(theme
->max_toggled_mask
);
496 /* iconify button masks */
497 if (!read_mask(&ps
, "iconify.xbm", &theme
->iconify_mask
)) {
498 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
499 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
501 if (!read_mask(&ps
, "iconify_pressed.xbm", &theme
->iconify_pressed_mask
))
502 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
503 if (!read_mask(&ps
, "iconify_disabled.xbm", &theme
->iconify_disabled_mask
))
504 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
505 if (!read_mask(&ps
, "iconify_hover.xbm", &theme
->iconify_hover_mask
))
506 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
508 /* all desktops button masks */
510 if (!read_mask(&ps
, "desk.xbm", &theme
->desk_mask
)) {
511 guchar data
[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
512 theme
->desk_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
515 if (!read_mask(&ps
, "desk_toggled.xbm", &theme
->desk_toggled_mask
)) {
517 theme
->desk_toggled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
519 guchar data
[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
520 theme
->desk_toggled_mask
=
521 RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
524 if (!read_mask(&ps
, "desk_pressed.xbm", &theme
->desk_pressed_mask
))
525 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
526 if (!read_mask(&ps
, "desk_disabled.xbm", &theme
->desk_disabled_mask
))
527 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
528 if (!read_mask(&ps
, "desk_hover.xbm", &theme
->desk_hover_mask
))
529 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
530 if (!read_mask(&ps
, "desk_toggled_pressed.xbm",
531 &theme
->desk_toggled_pressed_mask
))
532 theme
->desk_toggled_pressed_mask
=
533 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
534 if (!read_mask(&ps
, "desk_toggled_hover.xbm",
535 &theme
->desk_toggled_hover_mask
))
536 theme
->desk_toggled_hover_mask
=
537 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
539 /* shade button masks */
540 if (!read_mask(&ps
, "shade.xbm", &theme
->shade_mask
)) {
541 guchar data
[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
542 theme
->shade_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
544 if (!read_mask(&ps
, "shade_toggled.xbm", &theme
->shade_toggled_mask
))
545 theme
->shade_toggled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
546 if (!read_mask(&ps
, "shade_pressed.xbm", &theme
->shade_pressed_mask
))
547 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
548 if (!read_mask(&ps
, "shade_disabled.xbm", &theme
->shade_disabled_mask
))
549 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
550 if (!read_mask(&ps
, "shade_hover.xbm", &theme
->shade_hover_mask
))
551 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
552 if (!read_mask(&ps
, "shade_toggled_pressed.xbm",
553 &theme
->shade_toggled_pressed_mask
))
554 theme
->shade_toggled_pressed_mask
=
555 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
556 if (!read_mask(&ps
, "shade_toggled_hover.xbm",
557 &theme
->shade_toggled_hover_mask
))
558 theme
->shade_toggled_hover_mask
=
559 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
561 /* close button masks */
562 if (!read_mask(&ps
, "close.xbm", &theme
->close_mask
)) {
563 guchar data
[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
564 theme
->close_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
566 if (!read_mask(&ps
, "close_pressed.xbm", &theme
->close_pressed_mask
))
567 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
568 if (!read_mask(&ps
, "close_disabled.xbm", &theme
->close_disabled_mask
))
569 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
570 if (!read_mask(&ps
, "close_hover.xbm", &theme
->close_hover_mask
))
571 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
573 /* submenu bullet mask */
574 if (!read_mask(&ps
, "bullet.xbm", &theme
->menu_bullet_mask
)) {
575 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
576 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
579 /* setup the default window icon */
580 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
581 OB_DEFAULT_ICON_HEIGHT
,
582 OB_DEFAULT_ICON_pixel_data
);
584 /* read the decoration textures */
585 if (!FIND(appearance
, L("window","active","titlebar"),
586 theme
->a_focused_title
, FALSE
))
587 set_default_appearance(theme
->a_focused_title
);
588 if (!FIND(appearance
, L("window","inactive","titlebar"),
589 theme
->a_unfocused_title
, FALSE
))
590 set_default_appearance(theme
->a_unfocused_title
);
591 if (!FIND(appearance
, L("window","active","label"),
592 theme
->a_focused_label
, TRUE
))
593 set_default_appearance(theme
->a_focused_label
);
594 if (!FIND(appearance
, L("window","inactive","label"),
595 theme
->a_unfocused_label
, TRUE
))
596 set_default_appearance(theme
->a_unfocused_label
);
597 if (!FIND(appearance
, L("window","active","handle"),
598 theme
->a_focused_handle
, FALSE
))
599 set_default_appearance(theme
->a_focused_handle
);
600 if (!FIND(appearance
, L("window","inactive","handle"),
601 theme
->a_unfocused_handle
, FALSE
))
602 set_default_appearance(theme
->a_unfocused_handle
);
603 if (!FIND(appearance
, L("window","active","grip"),
604 theme
->a_focused_grip
, TRUE
))
605 set_default_appearance(theme
->a_focused_grip
);
606 if (!FIND(appearance
, L("window","inactive","grip"),
607 theme
->a_unfocused_grip
, TRUE
))
608 set_default_appearance(theme
->a_unfocused_grip
);
609 if (!FIND(appearance
, L("menu","entries"), theme
->a_menu
, FALSE
))
610 set_default_appearance(theme
->a_menu
);
611 if (!FIND(appearance
, L("menu","title"), theme
->a_menu_title
, TRUE
))
612 set_default_appearance(theme
->a_menu_title
);
613 if (!FIND(appearance
, L("menu", "active"), theme
->a_menu_selected
, TRUE
))
614 set_default_appearance(theme
->a_menu_selected
);
615 if (!FIND(appearance
, L("menu", "active-disabled"),
616 theme
->a_menu_disabled_selected
, TRUE
))
617 theme
->a_menu_disabled_selected
=
618 RrAppearanceCopy(theme
->a_menu_selected
);
620 /* read appearances for non-decorations (on-screen-display) */
621 if (!FIND(appearance
, L("osd", "background"), theme
->osd_hilite_bg
, FALSE
)) {
622 RrAppearanceFree(theme
->osd_hilite_bg
);
623 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
625 if (!FIND(appearance
, L("osd", "label"), theme
->osd_hilite_label
, TRUE
)) {
626 RrAppearanceFree(theme
->osd_hilite_label
);
627 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
629 /* osd_hilite_fg can't be parentrel */
630 if (!FIND(appearance
, L("osd", "hilight"), theme
->osd_hilite_fg
, FALSE
)) {
631 RrAppearanceFree(theme
->osd_hilite_fg
);
632 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
633 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_label
);
635 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_title
);
637 /* osd_unhilite_fg can't be parentrel either */
638 if (!FIND(appearance
, L("osd", "unhilight"), theme
->osd_unhilite_fg
,
641 RrAppearanceFree(theme
->osd_unhilite_fg
);
642 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
643 theme
->osd_unhilite_fg
=RrAppearanceCopy(theme
->a_unfocused_label
);
645 theme
->osd_unhilite_fg
=RrAppearanceCopy(theme
->a_unfocused_title
);
648 /* read buttons textures */
649 if (!FIND(appearance
, L("window","active","buttons","disabled"),
650 theme
->a_disabled_focused_max
, TRUE
))
651 set_default_appearance(theme
->a_disabled_focused_max
);
652 if (!FIND(appearance
, L("window","inactive","buttons","disabled"),
653 theme
->a_disabled_unfocused_max
, TRUE
))
654 set_default_appearance(theme
->a_disabled_unfocused_max
);
655 if (!FIND(appearance
, L("window","active","buttons","pressed"),
656 theme
->a_focused_pressed_max
, TRUE
))
657 set_default_appearance(theme
->a_focused_pressed_max
);
658 if (!FIND(appearance
, L("window","inactive","buttons","pressed"),
659 theme
->a_unfocused_pressed_max
, TRUE
))
660 set_default_appearance(theme
->a_unfocused_pressed_max
);
661 if (!FIND(appearance
, L("window","active","buttons","unpressed"),
662 theme
->a_focused_unpressed_max
, TRUE
))
663 set_default_appearance(theme
->a_focused_unpressed_max
);
664 if (!FIND(appearance
, L("window","inactive","buttons","unpressed"),
665 theme
->a_unfocused_unpressed_max
, TRUE
))
666 set_default_appearance(theme
->a_unfocused_unpressed_max
);
667 if (!FIND(appearance
, L("window","active","buttons","hover"),
668 theme
->a_hover_focused_max
, TRUE
))
670 RrAppearanceFree(theme
->a_hover_focused_max
);
671 theme
->a_hover_focused_max
=
672 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
674 if (!FIND(appearance
, L("window","inactive","buttons","hover"),
675 theme
->a_hover_unfocused_max
, TRUE
))
677 RrAppearanceFree(theme
->a_hover_unfocused_max
);
678 theme
->a_hover_unfocused_max
=
679 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
681 if (!FIND(appearance
, L("window","active","buttons","toggled-pressed"),
682 theme
->a_toggled_focused_pressed_max
, TRUE
))
684 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
685 theme
->a_toggled_focused_pressed_max
=
686 RrAppearanceCopy(theme
->a_focused_pressed_max
);
688 if (!FIND(appearance
, L("window","inactive","buttons","toggled-pressed"),
689 theme
->a_toggled_unfocused_pressed_max
, TRUE
))
691 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
692 theme
->a_toggled_unfocused_pressed_max
=
693 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
695 if (!FIND(appearance
, L("window","active","buttons","toggled-unpressed"),
696 theme
->a_toggled_focused_unpressed_max
, TRUE
))
698 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
699 theme
->a_toggled_focused_unpressed_max
=
700 RrAppearanceCopy(theme
->a_focused_pressed_max
);
702 if (!FIND(appearance
, L("window","inactive","buttons","toggled-unpressed"),
703 theme
->a_toggled_unfocused_unpressed_max
, TRUE
))
705 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
706 theme
->a_toggled_unfocused_unpressed_max
=
707 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
709 if (!FIND(appearance
, L("window","active","buttons","toggled-hover"),
710 theme
->a_toggled_hover_focused_max
, TRUE
))
712 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
713 theme
->a_toggled_hover_focused_max
=
714 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
716 if (!FIND(appearance
, L("window","inactive","buttons","toggled-hover"),
717 theme
->a_toggled_hover_unfocused_max
, TRUE
))
719 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
720 theme
->a_toggled_hover_unfocused_max
=
721 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
724 theme
->a_disabled_focused_close
=
725 RrAppearanceCopy(theme
->a_disabled_focused_max
);
726 theme
->a_disabled_unfocused_close
=
727 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
728 theme
->a_hover_focused_close
=
729 RrAppearanceCopy(theme
->a_hover_focused_max
);
730 theme
->a_hover_unfocused_close
=
731 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
732 theme
->a_unfocused_unpressed_close
=
733 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
734 theme
->a_unfocused_pressed_close
=
735 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
736 theme
->a_focused_unpressed_close
=
737 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
738 theme
->a_focused_pressed_close
=
739 RrAppearanceCopy(theme
->a_focused_pressed_max
);
740 theme
->a_disabled_focused_desk
=
741 RrAppearanceCopy(theme
->a_disabled_focused_max
);
742 theme
->a_disabled_unfocused_desk
=
743 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
744 theme
->a_hover_focused_desk
=
745 RrAppearanceCopy(theme
->a_hover_focused_max
);
746 theme
->a_hover_unfocused_desk
=
747 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
748 theme
->a_toggled_focused_pressed_desk
=
749 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
750 theme
->a_toggled_unfocused_pressed_desk
=
751 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
752 theme
->a_toggled_focused_unpressed_desk
=
753 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
754 theme
->a_toggled_unfocused_unpressed_desk
=
755 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
756 theme
->a_toggled_hover_focused_desk
=
757 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
758 theme
->a_toggled_hover_unfocused_desk
=
759 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
760 theme
->a_unfocused_unpressed_desk
=
761 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
762 theme
->a_unfocused_pressed_desk
=
763 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
764 theme
->a_focused_unpressed_desk
=
765 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
766 theme
->a_focused_pressed_desk
=
767 RrAppearanceCopy(theme
->a_focused_pressed_max
);
768 theme
->a_disabled_focused_shade
=
769 RrAppearanceCopy(theme
->a_disabled_focused_max
);
770 theme
->a_disabled_unfocused_shade
=
771 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
772 theme
->a_hover_focused_shade
=
773 RrAppearanceCopy(theme
->a_hover_focused_max
);
774 theme
->a_hover_unfocused_shade
=
775 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
776 theme
->a_toggled_focused_pressed_shade
=
777 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
778 theme
->a_toggled_unfocused_pressed_shade
=
779 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
780 theme
->a_toggled_focused_unpressed_shade
=
781 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
782 theme
->a_toggled_unfocused_unpressed_shade
=
783 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
784 theme
->a_toggled_hover_focused_shade
=
785 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
786 theme
->a_toggled_hover_unfocused_shade
=
787 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
788 theme
->a_unfocused_unpressed_shade
=
789 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
790 theme
->a_unfocused_pressed_shade
=
791 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
792 theme
->a_focused_unpressed_shade
=
793 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
794 theme
->a_focused_pressed_shade
=
795 RrAppearanceCopy(theme
->a_focused_pressed_max
);
796 theme
->a_disabled_focused_iconify
=
797 RrAppearanceCopy(theme
->a_disabled_focused_max
);
798 theme
->a_disabled_unfocused_iconify
=
799 RrAppearanceCopy(theme
->a_disabled_focused_max
);
800 theme
->a_hover_focused_iconify
=
801 RrAppearanceCopy(theme
->a_hover_focused_max
);
802 theme
->a_hover_unfocused_iconify
=
803 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
804 theme
->a_unfocused_unpressed_iconify
=
805 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
806 theme
->a_unfocused_pressed_iconify
=
807 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
808 theme
->a_focused_unpressed_iconify
=
809 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
810 theme
->a_focused_pressed_iconify
=
811 RrAppearanceCopy(theme
->a_focused_pressed_max
);
813 theme
->a_icon
->surface
.grad
=
814 theme
->a_clear
->surface
.grad
=
815 theme
->a_clear_tex
->surface
.grad
=
816 theme
->a_menu_text_title
->surface
.grad
=
817 theme
->a_menu_normal
->surface
.grad
=
818 theme
->a_menu_disabled
->surface
.grad
=
819 theme
->a_menu_text_normal
->surface
.grad
=
820 theme
->a_menu_text_selected
->surface
.grad
=
821 theme
->a_menu_text_disabled
->surface
.grad
=
822 theme
->a_menu_text_disabled_selected
->surface
.grad
=
823 theme
->a_menu_bullet_normal
->surface
.grad
=
824 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
826 /* set up the textures */
827 theme
->a_focused_label
->texture
[0].type
=
828 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
829 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
830 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
831 theme
->a_focused_label
->texture
[0].data
.text
.font
=
832 theme
->win_font_focused
;
833 theme
->osd_hilite_label
->texture
[0].data
.text
.font
= theme
->osd_font
;
834 theme
->a_focused_label
->texture
[0].data
.text
.color
=
835 theme
->title_focused_color
;
836 theme
->osd_hilite_label
->texture
[0].data
.text
.color
=
839 if (!FIND(shadow
, L("window","active","label","text","shadow","offset"),
840 theme
->a_focused_label
))
841 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
=
842 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
843 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
844 theme
->title_focused_shadow_color
;
845 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
846 theme
->title_focused_shadow_alpha
;
848 if (!FIND(shadow
, L("osd","label","text","shadow","offset"),
849 theme
->osd_hilite_label
))
851 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
852 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
853 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
854 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
856 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
857 theme
->osd_shadow_color
;
858 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
859 theme
->osd_shadow_alpha
;
861 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
862 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
863 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
864 theme
->win_font_unfocused
;
865 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
866 theme
->title_unfocused_color
;
868 if (!FIND(shadow
, L("window","inactive","label","text","shadow","offset"),
869 theme
->a_unfocused_label
))
870 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
=
871 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
872 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
873 theme
->title_unfocused_shadow_color
;
874 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
875 theme
->title_unfocused_shadow_alpha
;
877 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
878 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
879 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
880 theme
->menu_title_font
;
881 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
882 theme
->menu_title_color
;
884 if (!FIND(shadow
, L("menu","title","text","shadow","offset"),
885 theme
->a_menu_text_title
))
886 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
=
887 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= 0;
888 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
889 theme
->menu_title_shadow_color
;
890 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
891 theme
->menu_title_shadow_alpha
;
893 theme
->a_menu_text_normal
->texture
[0].type
=
894 theme
->a_menu_text_selected
->texture
[0].type
=
895 theme
->a_menu_text_disabled
->texture
[0].type
=
896 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
898 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
899 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
900 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
901 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
903 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
904 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
905 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
906 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
908 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
909 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
910 theme
->menu_selected_color
;
911 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
912 theme
->menu_disabled_color
;
913 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
914 theme
->menu_disabled_selected_color
;
916 if (!FIND(shadow
, L("menu","inactive","shadow","offset"),
917 theme
->a_menu_text_normal
))
918 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_x
=
919 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
=
921 if (!FIND(shadow
, L("menu","active","text","shadow","offset"),
922 theme
->a_menu_text_selected
))
923 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_x
=
924 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_y
=
926 if (!FIND(shadow
, L("menu","disabled","shadow","offset"),
927 theme
->a_menu_text_disabled
))
928 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_x
=
929 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_y
=
931 if (!FIND(shadow
, L("menu","active-disabled","shadow","offset"),
932 theme
->a_menu_text_disabled_selected
))
933 theme
->a_menu_text_disabled_selected
->
934 texture
[0].data
.text
.shadow_offset_x
=
935 theme
->a_menu_text_disabled_selected
->
936 texture
[0].data
.text
.shadow_offset_y
= 0;
937 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
938 theme
->menu_text_normal_shadow_color
;
939 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
940 theme
->menu_text_normal_shadow_alpha
;
941 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
942 theme
->menu_text_selected_shadow_color
;
943 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
944 theme
->menu_text_selected_shadow_alpha
;
945 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
946 theme
->menu_text_disabled_shadow_color
;
947 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
948 theme
->menu_text_disabled_shadow_alpha
;
949 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
950 theme
->menu_text_disabled_selected_shadow_color
;
951 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
952 theme
->menu_text_disabled_selected_shadow_alpha
;
954 theme
->a_disabled_focused_max
->texture
[0].type
=
955 theme
->a_disabled_unfocused_max
->texture
[0].type
=
956 theme
->a_hover_focused_max
->texture
[0].type
=
957 theme
->a_hover_unfocused_max
->texture
[0].type
=
958 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
959 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
960 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
961 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
962 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
963 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
964 theme
->a_focused_unpressed_max
->texture
[0].type
=
965 theme
->a_focused_pressed_max
->texture
[0].type
=
966 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
967 theme
->a_unfocused_pressed_max
->texture
[0].type
=
968 theme
->a_disabled_focused_close
->texture
[0].type
=
969 theme
->a_disabled_unfocused_close
->texture
[0].type
=
970 theme
->a_hover_focused_close
->texture
[0].type
=
971 theme
->a_hover_unfocused_close
->texture
[0].type
=
972 theme
->a_focused_unpressed_close
->texture
[0].type
=
973 theme
->a_focused_pressed_close
->texture
[0].type
=
974 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
975 theme
->a_unfocused_pressed_close
->texture
[0].type
=
976 theme
->a_disabled_focused_desk
->texture
[0].type
=
977 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
978 theme
->a_hover_focused_desk
->texture
[0].type
=
979 theme
->a_hover_unfocused_desk
->texture
[0].type
=
980 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
981 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
982 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
983 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
984 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
985 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
986 theme
->a_focused_unpressed_desk
->texture
[0].type
=
987 theme
->a_focused_pressed_desk
->texture
[0].type
=
988 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
989 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
990 theme
->a_disabled_focused_shade
->texture
[0].type
=
991 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
992 theme
->a_hover_focused_shade
->texture
[0].type
=
993 theme
->a_hover_unfocused_shade
->texture
[0].type
=
994 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
995 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
996 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
997 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
998 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
999 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
1000 theme
->a_focused_unpressed_shade
->texture
[0].type
=
1001 theme
->a_focused_pressed_shade
->texture
[0].type
=
1002 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
1003 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
1004 theme
->a_disabled_focused_iconify
->texture
[0].type
=
1005 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
1006 theme
->a_hover_focused_iconify
->texture
[0].type
=
1007 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
1008 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
1009 theme
->a_focused_pressed_iconify
->texture
[0].type
=
1010 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
1011 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
1012 theme
->a_menu_bullet_normal
->texture
[0].type
=
1013 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
1015 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
1016 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
1017 theme
->max_disabled_mask
;
1018 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
1019 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1020 theme
->max_hover_mask
;
1021 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1022 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1023 theme
->max_pressed_mask
;
1024 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1025 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1027 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1028 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1029 theme
->max_toggled_pressed_mask
;
1030 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1031 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1032 theme
->max_toggled_mask
;
1033 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
1034 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1035 theme
->max_toggled_hover_mask
;
1036 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
1037 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
1038 theme
->close_disabled_mask
;
1039 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
1040 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
1041 theme
->close_hover_mask
;
1042 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
1043 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
1044 theme
->close_pressed_mask
;
1045 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
1046 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
1048 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
1049 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
1050 theme
->desk_disabled_mask
;
1051 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1052 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1053 theme
->desk_hover_mask
;
1054 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1055 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1056 theme
->desk_pressed_mask
;
1057 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1058 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1060 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1061 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1062 theme
->desk_toggled_pressed_mask
;
1063 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1064 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1065 theme
->desk_toggled_mask
;
1066 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1067 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1068 theme
->desk_toggled_hover_mask
;
1069 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1070 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1071 theme
->shade_disabled_mask
;
1072 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1073 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1074 theme
->shade_hover_mask
;
1075 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1076 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1077 theme
->shade_pressed_mask
;
1078 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1079 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1081 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1082 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1083 theme
->shade_toggled_pressed_mask
;
1084 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1085 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1086 theme
->shade_toggled_mask
;
1087 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1088 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1089 theme
->shade_toggled_hover_mask
;
1090 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1091 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1092 theme
->iconify_disabled_mask
;
1093 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1094 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1095 theme
->iconify_hover_mask
;
1096 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1097 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1098 theme
->iconify_pressed_mask
;
1099 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1100 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1101 theme
->iconify_mask
;
1102 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1103 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1104 theme
->menu_bullet_mask
;
1105 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1106 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1107 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1108 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1109 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1110 theme
->titlebut_disabled_focused_color
;
1111 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1112 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1113 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1114 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1115 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1116 theme
->titlebut_disabled_unfocused_color
;
1117 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1118 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1119 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1120 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1121 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1122 theme
->titlebut_hover_focused_color
;
1123 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1124 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1125 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1126 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1127 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1128 theme
->titlebut_hover_unfocused_color
;
1129 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1130 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1131 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1132 theme
->titlebut_toggled_hover_focused_color
;
1133 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1134 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1135 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1136 theme
->titlebut_toggled_hover_unfocused_color
;
1137 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1138 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1139 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1140 theme
->titlebut_toggled_focused_pressed_color
;
1141 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1142 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1143 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1144 theme
->titlebut_toggled_unfocused_pressed_color
;
1145 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1146 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1147 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1148 theme
->titlebut_toggled_focused_unpressed_color
;
1149 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1150 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1151 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1152 theme
->titlebut_toggled_unfocused_unpressed_color
;
1153 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1154 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1155 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1156 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1157 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1158 theme
->titlebut_focused_unpressed_color
;
1159 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1160 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1161 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1162 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1163 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1164 theme
->titlebut_focused_pressed_color
;
1165 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1166 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1167 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1168 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1169 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1170 theme
->titlebut_unfocused_unpressed_color
;
1171 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1172 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1173 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1174 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1175 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1176 theme
->titlebut_unfocused_pressed_color
;
1177 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1179 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1180 theme
->menu_selected_color
;
1183 parse_close(ps
.doc
);
1186 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1187 RrAppearance
*a
, *b
, *c
, *d
;
1189 /* caluclate the font heights*/
1190 a
= theme
->a_focused_label
;
1191 theme
->win_font_height
=
1192 RrFontHeight(theme
->win_font_focused
,
1193 a
->texture
[0].data
.text
.shadow_offset_y
);
1194 a
= theme
->a_unfocused_label
;
1195 theme
->win_font_height
=
1196 MAX(theme
->win_font_height
,
1197 RrFontHeight(theme
->win_font_unfocused
,
1198 a
->texture
[0].data
.text
.shadow_offset_y
));
1199 a
= theme
->a_menu_text_title
;
1200 theme
->menu_title_font_height
=
1201 RrFontHeight(theme
->menu_title_font
,
1202 a
->texture
[0].data
.text
.shadow_offset_y
);
1203 a
= theme
->a_menu_text_normal
;
1204 b
= theme
->a_menu_text_selected
;
1205 c
= theme
->a_menu_text_disabled
;
1206 d
= theme
->a_menu_text_disabled_selected
;
1207 theme
->menu_font_height
=
1208 RrFontHeight(theme
->menu_font
,
1209 MAX(a
->texture
[0].data
.text
.shadow_offset_y
,
1210 MAX(b
->texture
[0].data
.text
.shadow_offset_y
,
1211 MAX(c
->texture
[0].data
.text
.shadow_offset_y
,
1212 d
->texture
[0].data
.text
.shadow_offset_y
1215 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1216 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1217 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1218 theme
->label_height
+= theme
->label_height
& 1;
1220 /* this would be nice I think, since padding.width can now be 0,
1221 but it breaks frame.c horribly and I don't feel like fixing that
1222 right now, so if anyone complains, here is how to keep text from
1223 going over the title's bevel/border with a padding.width of 0 and a
1224 bevelless/borderless label
1225 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1226 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1227 theme->title_height = theme->label_height +
1228 MAX(MAX(theme->padding * 2, ft + fb),
1229 MAX(theme->padding * 2, ut + ub));
1231 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1233 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1234 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1235 theme
->menu_title_height
= theme
->menu_title_label_height
+
1236 theme
->paddingy
* 2;
1238 theme
->button_size
= theme
->label_height
- 2;
1239 theme
->grip_width
= 25;
1244 void RrThemeFree(RrTheme
*theme
)
1247 g_free(theme
->name
);
1249 RrColorFree(theme
->menu_border_color
);
1250 RrColorFree(theme
->osd_border_color
);
1251 RrColorFree(theme
->frame_focused_border_color
);
1252 RrColorFree(theme
->frame_unfocused_border_color
);
1253 RrColorFree(theme
->title_separator_focused_color
);
1254 RrColorFree(theme
->title_separator_unfocused_color
);
1255 RrColorFree(theme
->cb_unfocused_color
);
1256 RrColorFree(theme
->cb_focused_color
);
1257 RrColorFree(theme
->title_focused_color
);
1258 RrColorFree(theme
->title_unfocused_color
);
1259 RrColorFree(theme
->titlebut_disabled_focused_color
);
1260 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1261 RrColorFree(theme
->titlebut_hover_focused_color
);
1262 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1263 RrColorFree(theme
->titlebut_focused_pressed_color
);
1264 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1265 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1266 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1267 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1268 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1269 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1270 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1271 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1272 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1273 RrColorFree(theme
->menu_title_color
);
1274 RrColorFree(theme
->menu_color
);
1275 RrColorFree(theme
->menu_selected_color
);
1276 RrColorFree(theme
->menu_disabled_color
);
1277 RrColorFree(theme
->menu_disabled_selected_color
);
1278 RrColorFree(theme
->title_focused_shadow_color
);
1279 RrColorFree(theme
->title_unfocused_shadow_color
);
1280 RrColorFree(theme
->osd_color
);
1281 RrColorFree(theme
->osd_shadow_color
);
1282 RrColorFree(theme
->menu_title_shadow_color
);
1283 RrColorFree(theme
->menu_text_normal_shadow_color
);
1284 RrColorFree(theme
->menu_text_selected_shadow_color
);
1285 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1286 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1288 g_free(theme
->def_win_icon
);
1290 RrPixmapMaskFree(theme
->max_mask
);
1291 RrPixmapMaskFree(theme
->max_toggled_mask
);
1292 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1293 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1294 RrPixmapMaskFree(theme
->max_disabled_mask
);
1295 RrPixmapMaskFree(theme
->max_hover_mask
);
1296 RrPixmapMaskFree(theme
->max_pressed_mask
);
1297 RrPixmapMaskFree(theme
->desk_mask
);
1298 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1299 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1300 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1301 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1302 RrPixmapMaskFree(theme
->desk_hover_mask
);
1303 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1304 RrPixmapMaskFree(theme
->shade_mask
);
1305 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1306 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1307 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1308 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1309 RrPixmapMaskFree(theme
->shade_hover_mask
);
1310 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1311 RrPixmapMaskFree(theme
->iconify_mask
);
1312 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1313 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1314 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1315 RrPixmapMaskFree(theme
->close_mask
);
1316 RrPixmapMaskFree(theme
->close_disabled_mask
);
1317 RrPixmapMaskFree(theme
->close_hover_mask
);
1318 RrPixmapMaskFree(theme
->close_pressed_mask
);
1319 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1321 RrFontClose(theme
->win_font_focused
);
1322 RrFontClose(theme
->win_font_unfocused
);
1323 RrFontClose(theme
->menu_title_font
);
1324 RrFontClose(theme
->menu_font
);
1326 RrAppearanceFree(theme
->a_disabled_focused_max
);
1327 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1328 RrAppearanceFree(theme
->a_hover_focused_max
);
1329 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1330 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1331 RrAppearanceFree(theme
->a_focused_pressed_max
);
1332 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1333 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1334 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1335 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1336 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1337 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1338 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1339 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1340 RrAppearanceFree(theme
->a_disabled_focused_close
);
1341 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1342 RrAppearanceFree(theme
->a_hover_focused_close
);
1343 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1344 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1345 RrAppearanceFree(theme
->a_focused_pressed_close
);
1346 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1347 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1348 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1349 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1350 RrAppearanceFree(theme
->a_hover_focused_desk
);
1351 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1352 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1353 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1354 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1355 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1356 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1357 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1358 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1359 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1360 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1361 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1362 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1363 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1364 RrAppearanceFree(theme
->a_hover_focused_shade
);
1365 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1366 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1367 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1368 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1369 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1370 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1371 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1372 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1373 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1374 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1375 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1376 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1377 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1378 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1379 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1380 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1381 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1382 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1383 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1384 RrAppearanceFree(theme
->a_focused_grip
);
1385 RrAppearanceFree(theme
->a_unfocused_grip
);
1386 RrAppearanceFree(theme
->a_focused_title
);
1387 RrAppearanceFree(theme
->a_unfocused_title
);
1388 RrAppearanceFree(theme
->a_focused_label
);
1389 RrAppearanceFree(theme
->a_unfocused_label
);
1390 RrAppearanceFree(theme
->a_icon
);
1391 RrAppearanceFree(theme
->a_focused_handle
);
1392 RrAppearanceFree(theme
->a_unfocused_handle
);
1393 RrAppearanceFree(theme
->a_menu
);
1394 RrAppearanceFree(theme
->a_menu_title
);
1395 RrAppearanceFree(theme
->a_menu_text_title
);
1396 RrAppearanceFree(theme
->a_menu_normal
);
1397 RrAppearanceFree(theme
->a_menu_selected
);
1398 RrAppearanceFree(theme
->a_menu_disabled
);
1399 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1400 RrAppearanceFree(theme
->a_menu_text_normal
);
1401 RrAppearanceFree(theme
->a_menu_text_selected
);
1402 RrAppearanceFree(theme
->a_menu_text_disabled
);
1403 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1404 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1405 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1406 RrAppearanceFree(theme
->a_clear
);
1407 RrAppearanceFree(theme
->a_clear_tex
);
1408 RrAppearanceFree(theme
->osd_hilite_bg
);
1409 RrAppearanceFree(theme
->osd_hilite_fg
);
1410 RrAppearanceFree(theme
->osd_hilite_label
);
1411 RrAppearanceFree(theme
->osd_unhilite_fg
);
1417 static gboolean
read_mask(ParseState
*ps
, const gchar
*maskname
,
1418 RrPixmapMask
**value
)
1420 gboolean ret
= FALSE
;
1422 gint hx
, hy
; /* ignored */
1426 s
= g_build_filename(ps
->path
, maskname
, NULL
);
1427 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1429 *value
= RrPixmapMaskNew(ps
->inst
, w
, h
, (gchar
*)b
);
1437 static void set_default_appearance(RrAppearance
*a
)
1439 a
->surface
.grad
= RR_SURFACE_SOLID
;
1440 a
->surface
.relief
= RR_RELIEF_FLAT
;
1441 a
->surface
.bevel
= RR_BEVEL_1
;
1442 a
->surface
.interlaced
= FALSE
;
1443 a
->surface
.border
= FALSE
;
1444 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1445 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1448 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1449 an RrTextureRGBA. */
1450 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1455 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1457 for (i
= 0; i
< width
* height
; ++i
) {
1458 guchar a
= ((*p
>> 24) & 0xff);
1459 guchar b
= ((*p
>> 16) & 0xff);
1460 guchar g
= ((*p
>> 8) & 0xff);
1461 guchar r
= ((*p
>> 0) & 0xff);
1463 *p
= ((r
<< RrDefaultRedOffset
) +
1464 (g
<< RrDefaultGreenOffset
) +
1465 (b
<< RrDefaultBlueOffset
) +
1466 (a
<< RrDefaultAlphaOffset
));
1473 static void parse_style(gchar
*tex
, RrSurfaceColorType
*grad
,
1474 RrReliefType
*relief
, RrBevelType
*bevel
,
1475 gboolean
*interlaced
, gboolean
*border
,
1476 gboolean allow_trans
)
1480 /* convert to all lowercase */
1481 for (t
= tex
; *t
!= '\0'; ++t
)
1482 *t
= g_ascii_tolower(*t
);
1484 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1485 *grad
= RR_SURFACE_PARENTREL
;
1487 if (strstr(tex
, "gradient") != NULL
) {
1488 if (strstr(tex
, "crossdiagonal") != NULL
)
1489 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1490 else if (strstr(tex
, "pyramid") != NULL
)
1491 *grad
= RR_SURFACE_PYRAMID
;
1492 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1493 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1494 else if (strstr(tex
, "horizontal") != NULL
)
1495 *grad
= RR_SURFACE_HORIZONTAL
;
1496 else if (strstr(tex
, "splitvertical") != NULL
)
1497 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1498 else if (strstr(tex
, "vertical") != NULL
)
1499 *grad
= RR_SURFACE_VERTICAL
;
1501 *grad
= RR_SURFACE_DIAGONAL
;
1503 *grad
= RR_SURFACE_SOLID
;
1507 if (strstr(tex
, "sunken") != NULL
)
1508 *relief
= RR_RELIEF_SUNKEN
;
1509 else if (strstr(tex
, "flat") != NULL
)
1510 *relief
= RR_RELIEF_FLAT
;
1511 else if (strstr(tex
, "raised") != NULL
)
1512 *relief
= RR_RELIEF_RAISED
;
1514 *relief
= (*grad
== RR_SURFACE_PARENTREL
) ?
1515 RR_RELIEF_FLAT
: RR_RELIEF_RAISED
;
1518 if (*relief
== RR_RELIEF_FLAT
) {
1519 if (strstr(tex
, "border") != NULL
)
1522 if (strstr(tex
, "bevel2") != NULL
)
1523 *bevel
= RR_BEVEL_2
;
1525 *bevel
= RR_BEVEL_1
;
1528 if (strstr(tex
, "interlaced") != NULL
)
1531 *interlaced
= FALSE
;
1534 static xmlNodePtr
find_node(xmlNodePtr n
, const gchar
*names
[])
1538 for (i
= 0; names
[i
] && n
; ++i
)
1539 n
= parse_find_node(names
[i
], n
->children
);
1543 static gboolean
find_int(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1544 gint
*integer
, gint lower
, gint upper
)
1548 if ((n
= find_node(n
, names
))) {
1549 i
= parse_int(ps
->doc
, n
);
1550 if (i
>= lower
&& i
<= upper
) {
1558 static gboolean
find_string(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1561 if ((n
= find_node(n
, names
))) {
1562 *string
= parse_string(ps
->doc
, n
);
1568 static gboolean
find_color(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1569 RrColor
**color
, gchar
*alpha
)
1571 if ((n
= find_node(n
, names
))) {
1573 if (parse_attr_int("r", n
, &r
) &&
1574 parse_attr_int("g", n
, &g
) &&
1575 parse_attr_int("b", n
, &b
) &&
1576 parse_attr_int("a", n
, &a
) &&
1577 r
>= 0 && g
>= 0 && b
>= 0 && a
>= 0 &&
1578 r
< 256 && g
< 256 && b
< 256 && a
< 256)
1580 *color
= RrColorNew(ps
->inst
, r
, g
, b
);
1581 if (alpha
) *alpha
= a
;
1588 static gboolean
find_point(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1590 gint lowx
, gint upx
, gint lowy
, gint upy
)
1592 if ((n
= find_node(n
, names
))) {
1594 if (parse_attr_int("x", n
, &a
) &&
1595 parse_attr_int("y", n
, &b
) &&
1596 a
>= lowx
&& a
<= upx
&& b
>= lowy
&& b
<= upy
)
1605 static gboolean
find_shadow(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1608 return find_point(ps
, n
, names
,
1609 &a
->texture
[0].data
.text
.shadow_offset_x
,
1610 &a
->texture
[0].data
.text
.shadow_offset_y
,
1614 static gboolean
find_appearance(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1615 RrAppearance
*a
, gboolean allow_trans
)
1619 if (!(n
= find_node(n
, names
)))
1622 if ((n2
= find_node(n
, L("style")))) {
1623 gchar
*s
= parse_string(ps
->doc
, n2
);
1624 parse_style(s
, &a
->surface
.grad
, &a
->surface
.relief
,
1625 &a
->surface
.bevel
, &a
->surface
.interlaced
,
1626 &a
->surface
.border
, allow_trans
);
1631 if (!find_color(ps
, n
, L("primary"), &a
->surface
.primary
, NULL
))
1632 a
->surface
.primary
= RrColorNew(ps
->inst
, 0, 0, 0);
1633 if (!find_color(ps
, n
, L("secondary"), &a
->surface
.secondary
, NULL
))
1634 a
->surface
.secondary
= RrColorNew(ps
->inst
, 0, 0, 0);
1635 if (a
->surface
.border
)
1636 if (!find_color(ps
, n
, L("border"),
1637 &a
->surface
.border_color
, NULL
))
1638 a
->surface
.border_color
= RrColorNew(ps
->inst
, 0, 0, 0);
1639 if (a
->surface
.interlaced
)
1640 if (!find_color(ps
, n
, L("interlace"),
1641 &a
->surface
.interlace_color
, NULL
))
1642 a
->surface
.interlace_color
= RrColorNew(ps
->inst
, 0, 0, 0);