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
);
83 g_message("Falling back to the default theme '%s'",
85 /* make it fall back to default theme */
89 if (name
== NULL
&& allow_fallback
) {
90 if (!parse_load_theme(DEFAULT_THEME
, &ps
.doc
, &root
, &ps
.path
)) {
91 g_message("Unable to load the theme '%s'", DEFAULT_THEME
);
100 theme
= g_new0(RrTheme
, 1);
102 theme
->name
= g_strdup(name
? name
: DEFAULT_THEME
);
104 theme
->a_disabled_focused_max
= RrAppearanceNew(inst
, 1);
105 theme
->a_disabled_unfocused_max
= RrAppearanceNew(inst
, 1);
106 theme
->a_hover_focused_max
= RrAppearanceNew(inst
, 1);
107 theme
->a_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
108 theme
->a_toggled_focused_pressed_max
= RrAppearanceNew(inst
, 1);
109 theme
->a_toggled_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
110 theme
->a_toggled_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
111 theme
->a_toggled_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
112 theme
->a_toggled_hover_focused_max
= RrAppearanceNew(inst
, 1);
113 theme
->a_toggled_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
114 theme
->a_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
115 theme
->a_focused_pressed_max
= RrAppearanceNew(inst
, 1);
116 theme
->a_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
117 theme
->a_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
118 theme
->a_focused_grip
= RrAppearanceNew(inst
, 0);
119 theme
->a_unfocused_grip
= RrAppearanceNew(inst
, 0);
120 theme
->a_focused_title
= RrAppearanceNew(inst
, 0);
121 theme
->a_unfocused_title
= RrAppearanceNew(inst
, 0);
122 theme
->a_focused_label
= RrAppearanceNew(inst
, 1);
123 theme
->a_unfocused_label
= RrAppearanceNew(inst
, 1);
124 theme
->a_icon
= RrAppearanceNew(inst
, 1);
125 theme
->a_focused_handle
= RrAppearanceNew(inst
, 0);
126 theme
->a_unfocused_handle
= RrAppearanceNew(inst
, 0);
127 theme
->a_menu
= RrAppearanceNew(inst
, 0);
128 theme
->a_menu_title
= RrAppearanceNew(inst
, 0);
129 theme
->a_menu_text_title
= RrAppearanceNew(inst
, 1);
130 theme
->a_menu_normal
= RrAppearanceNew(inst
, 0);
131 theme
->a_menu_disabled
= RrAppearanceNew(inst
, 0);
132 theme
->a_menu_disabled_selected
= RrAppearanceNew(inst
, 0);
133 theme
->a_menu_selected
= RrAppearanceNew(inst
, 0);
134 theme
->a_menu_text_normal
= RrAppearanceNew(inst
, 1);
135 theme
->a_menu_text_selected
= RrAppearanceNew(inst
, 1);
136 theme
->a_menu_text_disabled
= RrAppearanceNew(inst
, 1);
137 theme
->a_menu_text_disabled_selected
= RrAppearanceNew(inst
, 1);
138 theme
->a_menu_bullet_normal
= RrAppearanceNew(inst
, 1);
139 theme
->a_menu_bullet_selected
= RrAppearanceNew(inst
, 1);
140 theme
->a_clear
= RrAppearanceNew(inst
, 0);
141 theme
->a_clear_tex
= RrAppearanceNew(inst
, 1);
143 /* load the font stuff */
145 if (active_window_font
) {
146 theme
->win_font_focused
= active_window_font
;
147 RrFontRef(active_window_font
);
149 theme
->win_font_focused
= RrFontOpenDefault(inst
);
151 if (inactive_window_font
) {
152 theme
->win_font_unfocused
= inactive_window_font
;
153 RrFontRef(inactive_window_font
);
155 theme
->win_font_unfocused
= RrFontOpenDefault(inst
);
157 winjust
= RR_JUSTIFY_LEFT
;
158 if (FIND(string
, L( "window", "justify"), &str
)) {
159 if (strcmp(str
, "right") == 0)
160 winjust
= RR_JUSTIFY_RIGHT
;
161 else if (strcmp(str
, "center") == 0)
162 winjust
= RR_JUSTIFY_CENTER
;
166 if (menu_title_font
) {
167 theme
->menu_title_font
= menu_title_font
;
168 RrFontRef(menu_title_font
);
170 theme
->menu_title_font
= RrFontOpenDefault(inst
);
172 mtitlejust
= RR_JUSTIFY_LEFT
;
173 if (FIND(string
, L("menu", "justify"), &str
)) {
174 if (strcmp(str
, "right") == 0)
175 mtitlejust
= RR_JUSTIFY_RIGHT
;
176 else if (strcmp(str
, "center") == 0)
177 mtitlejust
= RR_JUSTIFY_CENTER
;
181 if (menu_item_font
) {
182 theme
->menu_font
= menu_item_font
;
183 RrFontRef(menu_item_font
);
185 theme
->menu_font
= RrFontOpenDefault(inst
);
188 theme
->osd_font
= osd_font
;
191 theme
->osd_font
= RrFontOpenDefault(inst
);
193 /* load direct dimensions */
194 if (!FIND(int, L("menu","overlap"),
195 &theme
->menu_overlap
, -100, 100))
196 theme
->menu_overlap
= 0;
198 if (!FIND(int, L("dimensions","handle"), &theme
->handle_height
, 0, 100))
199 theme
->handle_height
= 6;
201 if (!FIND(point
, L("dimensions","padding"),
202 &theme
->paddingx
, &theme
->paddingy
, 0, 100, 0, 100))
203 theme
->paddingx
= theme
->paddingy
= 3;
205 if (!FIND(int, L("dimensions","window","border"),
206 &theme
->fbwidth
, 0, 100))
209 /* menu border width inherits from frame border width */
210 if (!FIND(int, L("dimensions","menu","border"),
211 &theme
->mbwidth
, 0, 100))
212 theme
->mbwidth
= theme
->fbwidth
;
214 if (!FIND(point
, L("dimensions","window","clientpadding"),
215 &theme
->cbwidthx
, &theme
->cbwidthy
, 0, 100, 0, 100))
216 theme
->cbwidthx
= theme
->cbwidthy
= 1;
219 if (!FIND(color
, L("window","active","border"),
220 &theme
->frame_focused_border_color
, NULL
))
221 theme
->frame_focused_border_color
= RrColorNew(inst
, 0, 0, 0);
222 /* frame unfocused border color inherits from frame focused border color */
223 if (!FIND(color
, L("window","inactive","border"),
224 &theme
->frame_unfocused_border_color
, NULL
))
225 theme
->frame_unfocused_border_color
=
227 theme
->frame_focused_border_color
->r
,
228 theme
->frame_focused_border_color
->g
,
229 theme
->frame_focused_border_color
->b
);
231 /* menu border color inherits from frame focused border color */
232 if (!FIND(color
, L("menu","border"),
233 &theme
->menu_border_color
, NULL
))
234 theme
->menu_border_color
=
236 theme
->frame_focused_border_color
->r
,
237 theme
->frame_focused_border_color
->g
,
238 theme
->frame_focused_border_color
->b
);
239 if (!FIND(color
, L("window","active","clientpadding"),
240 &theme
->cb_focused_color
, NULL
))
241 theme
->cb_focused_color
= RrColorNew(inst
, 255, 255, 255);
242 if (!FIND(color
, L("window","inactive","clientpadding"),
243 &theme
->cb_unfocused_color
, NULL
))
244 theme
->cb_unfocused_color
= RrColorNew(inst
, 255, 255, 255);
245 if (!FIND(color
, L("window","active","label","text","primary"),
246 &theme
->title_focused_color
, NULL
))
247 theme
->title_focused_color
= RrColorNew(inst
, 0x0, 0x0, 0x0);
248 if (!FIND(color
, L("osd","text","primary"),
249 &theme
->osd_color
, NULL
))
250 theme
->osd_color
= RrColorNew(inst
,
251 theme
->title_focused_color
->r
,
252 theme
->title_focused_color
->g
,
253 theme
->title_focused_color
->b
);
254 if (!FIND(color
, L("window","inactive","label","text","primary"),
255 &theme
->title_unfocused_color
, NULL
))
256 theme
->title_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
257 if (!FIND(color
, L("window","active","buttons","unpressed","image"),
258 &theme
->titlebut_focused_unpressed_color
, NULL
))
259 theme
->titlebut_focused_unpressed_color
= RrColorNew(inst
, 0, 0, 0);
260 if (!FIND(color
, L("window","inactive","buttons", "unpressed","image"),
261 &theme
->titlebut_unfocused_unpressed_color
, NULL
))
262 theme
->titlebut_unfocused_unpressed_color
=
263 RrColorNew(inst
, 0xff, 0xff, 0xff);
264 if (!FIND(color
, L("window","active","buttons","pressed","image"),
265 &theme
->titlebut_focused_pressed_color
, NULL
))
266 theme
->titlebut_focused_pressed_color
=
268 theme
->titlebut_focused_unpressed_color
->r
,
269 theme
->titlebut_focused_unpressed_color
->g
,
270 theme
->titlebut_focused_unpressed_color
->b
);
271 if (!FIND(color
, L("window","inactive","buttons","pressed","image"),
272 &theme
->titlebut_unfocused_pressed_color
, NULL
))
273 theme
->titlebut_unfocused_pressed_color
=
275 theme
->titlebut_unfocused_unpressed_color
->r
,
276 theme
->titlebut_unfocused_unpressed_color
->g
,
277 theme
->titlebut_unfocused_unpressed_color
->b
);
278 if (!FIND(color
, L("window","active","buttons","disabled","image"),
279 &theme
->titlebut_disabled_focused_color
, NULL
))
280 theme
->titlebut_disabled_focused_color
=
281 RrColorNew(inst
, 0xff, 0xff, 0xff);
282 if (!FIND(color
, L("window","inactive","buttons","disabled","image"),
283 &theme
->titlebut_disabled_unfocused_color
, NULL
))
284 theme
->titlebut_disabled_unfocused_color
= RrColorNew(inst
, 0, 0, 0);
286 L("window","active","buttons","hover","image"),
287 &theme
->titlebut_hover_focused_color
, NULL
))
288 theme
->titlebut_hover_focused_color
=
290 theme
->titlebut_focused_unpressed_color
->r
,
291 theme
->titlebut_focused_unpressed_color
->g
,
292 theme
->titlebut_focused_unpressed_color
->b
);
293 if (!FIND(color
, L("window","inactive","buttons","hover","image"),
294 &theme
->titlebut_hover_unfocused_color
, NULL
))
295 theme
->titlebut_hover_unfocused_color
=
297 theme
->titlebut_unfocused_unpressed_color
->r
,
298 theme
->titlebut_unfocused_unpressed_color
->g
,
299 theme
->titlebut_unfocused_unpressed_color
->b
);
301 L("window","active","buttons","toggled-pressed","image"),
302 &theme
->titlebut_toggled_focused_pressed_color
, NULL
))
303 theme
->titlebut_toggled_focused_pressed_color
=
305 theme
->titlebut_focused_pressed_color
->r
,
306 theme
->titlebut_focused_pressed_color
->g
,
307 theme
->titlebut_focused_pressed_color
->b
);
309 L("window","inactive","buttons","toggled-pressed","image"),
310 &theme
->titlebut_toggled_unfocused_pressed_color
, NULL
))
311 theme
->titlebut_toggled_unfocused_pressed_color
=
313 theme
->titlebut_unfocused_pressed_color
->r
,
314 theme
->titlebut_unfocused_pressed_color
->g
,
315 theme
->titlebut_unfocused_pressed_color
->b
);
317 L("window","active","buttons","toggled-unpressed","image"),
318 &theme
->titlebut_toggled_focused_unpressed_color
, NULL
))
319 theme
->titlebut_toggled_focused_unpressed_color
=
321 theme
->titlebut_focused_pressed_color
->r
,
322 theme
->titlebut_focused_pressed_color
->g
,
323 theme
->titlebut_focused_pressed_color
->b
);
325 L("window","inactive","buttons","toggled-unpressed","image"),
326 &theme
->titlebut_toggled_unfocused_unpressed_color
, NULL
))
327 theme
->titlebut_toggled_unfocused_unpressed_color
=
329 theme
->titlebut_unfocused_pressed_color
->r
,
330 theme
->titlebut_unfocused_pressed_color
->g
,
331 theme
->titlebut_unfocused_pressed_color
->b
);
333 L("window","active","buttons","toggled-hover","image"),
334 &theme
->titlebut_toggled_hover_focused_color
, NULL
))
335 theme
->titlebut_toggled_hover_focused_color
=
337 theme
->titlebut_toggled_focused_unpressed_color
->r
,
338 theme
->titlebut_toggled_focused_unpressed_color
->g
,
339 theme
->titlebut_toggled_focused_unpressed_color
->b
);
341 L("window","inactive","buttons","toggled-hover","image"),
342 &theme
->titlebut_toggled_hover_unfocused_color
, NULL
))
343 theme
->titlebut_toggled_hover_unfocused_color
=
345 theme
->titlebut_toggled_unfocused_unpressed_color
->r
,
346 theme
->titlebut_toggled_unfocused_unpressed_color
->g
,
347 theme
->titlebut_toggled_unfocused_unpressed_color
->b
);
348 if (!FIND(color
, L("menu","title","text","primary"),
349 &theme
->menu_title_color
, NULL
))
350 theme
->menu_title_color
= RrColorNew(inst
, 0, 0, 0);
351 if (!FIND(color
, L("menu","inactive","primary"), &theme
->menu_color
, NULL
))
352 theme
->menu_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
353 if (!FIND(color
, L("menu","disabled","primary"),
354 &theme
->menu_disabled_color
, NULL
))
355 theme
->menu_disabled_color
= RrColorNew(inst
, 0, 0, 0);
356 if (!FIND(color
, L("menu","activedisabled","text","primary"),
357 &theme
->menu_disabled_selected_color
, NULL
))
358 theme
->menu_disabled_selected_color
=
360 theme
->menu_disabled_color
->r
,
361 theme
->menu_disabled_color
->g
,
362 theme
->menu_disabled_color
->b
);
363 if (!FIND(color
, L("menu","active","text","primary"),
364 &theme
->menu_selected_color
, NULL
))
365 theme
->menu_selected_color
= RrColorNew(inst
, 0, 0, 0);
366 if (!FIND(color
, L("window","active","label","text","shadow","primary"),
367 &theme
->title_focused_shadow_color
,
368 &theme
->title_focused_shadow_alpha
))
370 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
371 theme
->title_focused_shadow_alpha
= 50;
373 if (!FIND(color
, L("osd","text","shadow","primary"),
374 &theme
->osd_shadow_color
, &theme
->osd_shadow_alpha
))
376 theme
->osd_shadow_color
=
377 RrColorNew(inst
, theme
->title_focused_shadow_color
->r
,
378 theme
->title_focused_shadow_color
->g
,
379 theme
->title_focused_shadow_color
->b
);
380 theme
->osd_shadow_alpha
= theme
->title_focused_shadow_alpha
;
382 if (!FIND(color
, L("window","inactive","label","text","shadow","primary"),
383 &theme
->title_unfocused_shadow_color
,
384 &theme
->title_unfocused_shadow_alpha
))
386 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
387 theme
->title_unfocused_shadow_alpha
= 50;
389 if (!FIND(color
, L("menu","title","text","shadow","primary"),
390 &theme
->menu_title_shadow_color
,
391 &theme
->menu_title_shadow_alpha
))
393 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
394 theme
->menu_title_shadow_alpha
= 50;
396 if (!FIND(color
, L("menu","inactive","shadow","primary"),
397 &theme
->menu_text_normal_shadow_color
,
398 &theme
->menu_text_normal_shadow_alpha
))
400 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
401 theme
->menu_text_normal_shadow_alpha
= 50;
403 if (!FIND(color
, L("menu","active","text","shadow","primary"),
404 &theme
->menu_text_selected_shadow_color
,
405 &theme
->menu_text_selected_shadow_alpha
))
407 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
408 theme
->menu_text_selected_shadow_alpha
= 50;
410 if (!FIND(color
, L("menu","disabled","shadow","primary"),
411 &theme
->menu_text_disabled_shadow_color
,
412 &theme
->menu_text_disabled_shadow_alpha
))
414 theme
->menu_text_disabled_shadow_color
=
415 RrColorNew(inst
, theme
->menu_text_normal_shadow_color
->r
,
416 theme
->menu_text_normal_shadow_color
->g
,
417 theme
->menu_text_normal_shadow_color
->b
);
418 theme
->menu_text_disabled_shadow_alpha
=
419 theme
->menu_text_normal_shadow_alpha
;
421 if (!FIND(color
, L("menu","activedisabled","shadow","primary"),
422 &theme
->menu_text_disabled_selected_shadow_color
,
423 &theme
->menu_text_disabled_selected_shadow_alpha
))
425 theme
->menu_text_disabled_selected_shadow_color
=
426 RrColorNew(inst
, theme
->menu_text_disabled_shadow_color
->r
,
427 theme
->menu_text_disabled_shadow_color
->g
,
428 theme
->menu_text_disabled_shadow_color
->b
);
429 theme
->menu_text_disabled_selected_shadow_alpha
=
430 theme
->menu_text_disabled_shadow_alpha
;
433 /* load the image masks */
435 /* maximize button masks */
437 if (!read_mask(&ps
, "max.xbm", &theme
->max_mask
)) {
438 guchar data
[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
439 theme
->max_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
442 if (!read_mask(&ps
, "max_toggled.xbm", &theme
->max_toggled_mask
)) {
444 theme
->max_toggled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
446 guchar data
[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
447 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 6, 6,(gchar
*)data
);
450 if (!read_mask(&ps
, "max_pressed.xbm", &theme
->max_pressed_mask
))
451 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
452 if (!read_mask(&ps
, "max_disabled.xbm", &theme
->max_disabled_mask
))
453 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
454 if (!read_mask(&ps
, "max_hover.xbm", &theme
->max_hover_mask
))
455 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
456 if (!read_mask(&ps
, "max_toggled_pressed.xbm",
457 &theme
->max_toggled_pressed_mask
))
458 theme
->max_toggled_pressed_mask
=
459 RrPixmapMaskCopy(theme
->max_toggled_mask
);
460 if (!read_mask(&ps
, "max_toggled_hover.xbm",
461 &theme
->max_toggled_hover_mask
))
462 theme
->max_toggled_hover_mask
=
463 RrPixmapMaskCopy(theme
->max_toggled_mask
);
465 /* iconify button masks */
466 if (!read_mask(&ps
, "iconify.xbm", &theme
->iconify_mask
)) {
467 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
468 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
470 if (!read_mask(&ps
, "iconify_pressed.xbm", &theme
->iconify_pressed_mask
))
471 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
472 if (!read_mask(&ps
, "iconify_disabled.xbm", &theme
->iconify_disabled_mask
))
473 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
474 if (!read_mask(&ps
, "iconify_hover.xbm", &theme
->iconify_hover_mask
))
475 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
477 /* all desktops button masks */
479 if (!read_mask(&ps
, "desk.xbm", &theme
->desk_mask
)) {
480 guchar data
[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
481 theme
->desk_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
484 if (!read_mask(&ps
, "desk_toggled.xbm", &theme
->desk_toggled_mask
)) {
486 theme
->desk_toggled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
488 guchar data
[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
489 theme
->desk_toggled_mask
=
490 RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
493 if (!read_mask(&ps
, "desk_pressed.xbm", &theme
->desk_pressed_mask
))
494 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
495 if (!read_mask(&ps
, "desk_disabled.xbm", &theme
->desk_disabled_mask
))
496 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
497 if (!read_mask(&ps
, "desk_hover.xbm", &theme
->desk_hover_mask
))
498 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
499 if (!read_mask(&ps
, "desk_toggled_pressed.xbm",
500 &theme
->desk_toggled_pressed_mask
))
501 theme
->desk_toggled_pressed_mask
=
502 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
503 if (!read_mask(&ps
, "desk_toggled_hover.xbm",
504 &theme
->desk_toggled_hover_mask
))
505 theme
->desk_toggled_hover_mask
=
506 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
508 /* shade button masks */
509 if (!read_mask(&ps
, "shade.xbm", &theme
->shade_mask
)) {
510 guchar data
[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
511 theme
->shade_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
513 if (!read_mask(&ps
, "shade_toggled.xbm", &theme
->shade_toggled_mask
))
514 theme
->shade_toggled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
515 if (!read_mask(&ps
, "shade_pressed.xbm", &theme
->shade_pressed_mask
))
516 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
517 if (!read_mask(&ps
, "shade_disabled.xbm", &theme
->shade_disabled_mask
))
518 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
519 if (!read_mask(&ps
, "shade_hover.xbm", &theme
->shade_hover_mask
))
520 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
521 if (!read_mask(&ps
, "shade_toggled_pressed.xbm",
522 &theme
->shade_toggled_pressed_mask
))
523 theme
->shade_toggled_pressed_mask
=
524 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
525 if (!read_mask(&ps
, "shade_toggled_hover.xbm",
526 &theme
->shade_toggled_hover_mask
))
527 theme
->shade_toggled_hover_mask
=
528 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
530 /* close button masks */
531 if (!read_mask(&ps
, "close.xbm", &theme
->close_mask
)) {
532 guchar data
[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
533 theme
->close_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
535 if (!read_mask(&ps
, "close_pressed.xbm", &theme
->close_pressed_mask
))
536 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
537 if (!read_mask(&ps
, "close_disabled.xbm", &theme
->close_disabled_mask
))
538 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
539 if (!read_mask(&ps
, "close_hover.xbm", &theme
->close_hover_mask
))
540 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
542 /* submenu bullet mask */
543 if (!read_mask(&ps
, "bullet.xbm", &theme
->menu_bullet_mask
)) {
544 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
545 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
548 /* setup the default window icon */
549 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
550 OB_DEFAULT_ICON_HEIGHT
,
551 OB_DEFAULT_ICON_pixel_data
);
553 /* read the decoration textures */
554 if (!FIND(appearance
, L("window","active","titlebar"),
555 theme
->a_focused_title
, FALSE
))
556 set_default_appearance(theme
->a_focused_title
);
557 if (!FIND(appearance
, L("window","inactive","titlebar"),
558 theme
->a_unfocused_title
, FALSE
))
559 set_default_appearance(theme
->a_unfocused_title
);
560 if (!FIND(appearance
, L("window","active","label"),
561 theme
->a_focused_label
, TRUE
))
562 set_default_appearance(theme
->a_focused_label
);
563 if (!FIND(appearance
, L("window","inactive","label"),
564 theme
->a_unfocused_label
, TRUE
))
565 set_default_appearance(theme
->a_unfocused_label
);
566 if (!FIND(appearance
, L("window","active","handle"),
567 theme
->a_focused_handle
, FALSE
))
568 set_default_appearance(theme
->a_focused_handle
);
569 if (!FIND(appearance
, L("window","inactive","handle"),
570 theme
->a_unfocused_handle
, FALSE
))
571 set_default_appearance(theme
->a_unfocused_handle
);
572 if (!FIND(appearance
, L("window","active","grip"),
573 theme
->a_focused_grip
, TRUE
))
574 set_default_appearance(theme
->a_focused_grip
);
575 if (!FIND(appearance
, L("window","inactive","grip"),
576 theme
->a_unfocused_grip
, TRUE
))
577 set_default_appearance(theme
->a_unfocused_grip
);
578 if (!FIND(appearance
, L("menu","entries"), theme
->a_menu
, FALSE
))
579 set_default_appearance(theme
->a_menu
);
580 if (!FIND(appearance
, L("menu","title"), theme
->a_menu_title
, TRUE
))
581 set_default_appearance(theme
->a_menu_title
);
582 if (!FIND(appearance
, L("menu", "active"), theme
->a_menu_selected
, TRUE
))
583 set_default_appearance(theme
->a_menu_selected
);
584 if (!FIND(appearance
, L("menu", "activedisabled"),
585 theme
->a_menu_disabled_selected
, TRUE
))
586 theme
->a_menu_disabled_selected
=
587 RrAppearanceCopy(theme
->a_menu_selected
);
589 /* read the appearances for rendering non-decorations */
590 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
591 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
592 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
593 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_label
);
595 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_title
);
596 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
597 theme
->osd_unhilite_fg
= RrAppearanceCopy(theme
->a_unfocused_label
);
599 theme
->osd_unhilite_fg
= RrAppearanceCopy(theme
->a_unfocused_title
);
601 /* read buttons textures */
602 if (!FIND(appearance
, L("window","active","buttons","disabled"),
603 theme
->a_disabled_focused_max
, TRUE
))
604 set_default_appearance(theme
->a_disabled_focused_max
);
605 if (!FIND(appearance
, L("window","inactive","buttons","disabled"),
606 theme
->a_disabled_unfocused_max
, TRUE
))
607 set_default_appearance(theme
->a_disabled_unfocused_max
);
608 if (!FIND(appearance
, L("window","active","buttons","pressed"),
609 theme
->a_focused_pressed_max
, TRUE
))
610 set_default_appearance(theme
->a_focused_pressed_max
);
611 if (!FIND(appearance
, L("window","inactive","buttons","pressed"),
612 theme
->a_unfocused_pressed_max
, TRUE
))
613 set_default_appearance(theme
->a_unfocused_pressed_max
);
614 if (!FIND(appearance
, L("window","active","buttons","unpressed"),
615 theme
->a_focused_unpressed_max
, TRUE
))
616 set_default_appearance(theme
->a_focused_unpressed_max
);
617 if (!FIND(appearance
, L("window","inactive","buttons","unpressed"),
618 theme
->a_unfocused_unpressed_max
, TRUE
))
619 set_default_appearance(theme
->a_unfocused_unpressed_max
);
620 if (!FIND(appearance
, L("window","active","buttons","hover"),
621 theme
->a_hover_focused_max
, TRUE
))
623 RrAppearanceFree(theme
->a_hover_focused_max
);
624 theme
->a_hover_focused_max
=
625 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
627 if (!FIND(appearance
, L("window","inactive","buttons","hover"),
628 theme
->a_hover_unfocused_max
, TRUE
))
630 RrAppearanceFree(theme
->a_hover_unfocused_max
);
631 theme
->a_hover_unfocused_max
=
632 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
634 if (!FIND(appearance
, L("window","active","buttons","toggled-pressed"),
635 theme
->a_toggled_focused_pressed_max
, TRUE
))
637 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
638 theme
->a_toggled_focused_pressed_max
=
639 RrAppearanceCopy(theme
->a_focused_pressed_max
);
641 if (!FIND(appearance
, L("window","inactive","buttons","toggled-pressed"),
642 theme
->a_toggled_unfocused_pressed_max
, TRUE
))
644 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
645 theme
->a_toggled_unfocused_pressed_max
=
646 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
648 if (!FIND(appearance
, L("window","active","buttons","toggled-unpressed"),
649 theme
->a_toggled_focused_unpressed_max
, TRUE
))
651 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
652 theme
->a_toggled_focused_unpressed_max
=
653 RrAppearanceCopy(theme
->a_focused_pressed_max
);
655 if (!FIND(appearance
, L("window","inactive","buttons","toggled-unpressed"),
656 theme
->a_toggled_unfocused_unpressed_max
, TRUE
))
658 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
659 theme
->a_toggled_unfocused_unpressed_max
=
660 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
662 if (!FIND(appearance
, L("window","active","buttons","toggled-hover"),
663 theme
->a_toggled_hover_focused_max
, TRUE
))
665 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
666 theme
->a_toggled_hover_focused_max
=
667 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
669 if (!FIND(appearance
, L("window","inactive","buttons","toggled-hover"),
670 theme
->a_toggled_hover_unfocused_max
, TRUE
))
672 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
673 theme
->a_toggled_hover_unfocused_max
=
674 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
677 theme
->a_disabled_focused_close
=
678 RrAppearanceCopy(theme
->a_disabled_focused_max
);
679 theme
->a_disabled_unfocused_close
=
680 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
681 theme
->a_hover_focused_close
=
682 RrAppearanceCopy(theme
->a_hover_focused_max
);
683 theme
->a_hover_unfocused_close
=
684 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
685 theme
->a_unfocused_unpressed_close
=
686 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
687 theme
->a_unfocused_pressed_close
=
688 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
689 theme
->a_focused_unpressed_close
=
690 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
691 theme
->a_focused_pressed_close
=
692 RrAppearanceCopy(theme
->a_focused_pressed_max
);
693 theme
->a_disabled_focused_desk
=
694 RrAppearanceCopy(theme
->a_disabled_focused_max
);
695 theme
->a_disabled_unfocused_desk
=
696 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
697 theme
->a_hover_focused_desk
=
698 RrAppearanceCopy(theme
->a_hover_focused_max
);
699 theme
->a_hover_unfocused_desk
=
700 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
701 theme
->a_toggled_focused_pressed_desk
=
702 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
703 theme
->a_toggled_unfocused_pressed_desk
=
704 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
705 theme
->a_toggled_focused_unpressed_desk
=
706 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
707 theme
->a_toggled_unfocused_unpressed_desk
=
708 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
709 theme
->a_toggled_hover_focused_desk
=
710 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
711 theme
->a_toggled_hover_unfocused_desk
=
712 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
713 theme
->a_unfocused_unpressed_desk
=
714 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
715 theme
->a_unfocused_pressed_desk
=
716 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
717 theme
->a_focused_unpressed_desk
=
718 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
719 theme
->a_focused_pressed_desk
=
720 RrAppearanceCopy(theme
->a_focused_pressed_max
);
721 theme
->a_disabled_focused_shade
=
722 RrAppearanceCopy(theme
->a_disabled_focused_max
);
723 theme
->a_disabled_unfocused_shade
=
724 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
725 theme
->a_hover_focused_shade
=
726 RrAppearanceCopy(theme
->a_hover_focused_max
);
727 theme
->a_hover_unfocused_shade
=
728 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
729 theme
->a_toggled_focused_pressed_shade
=
730 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
731 theme
->a_toggled_unfocused_pressed_shade
=
732 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
733 theme
->a_toggled_focused_unpressed_shade
=
734 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
735 theme
->a_toggled_unfocused_unpressed_shade
=
736 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
737 theme
->a_toggled_hover_focused_shade
=
738 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
739 theme
->a_toggled_hover_unfocused_shade
=
740 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
741 theme
->a_unfocused_unpressed_shade
=
742 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
743 theme
->a_unfocused_pressed_shade
=
744 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
745 theme
->a_focused_unpressed_shade
=
746 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
747 theme
->a_focused_pressed_shade
=
748 RrAppearanceCopy(theme
->a_focused_pressed_max
);
749 theme
->a_disabled_focused_iconify
=
750 RrAppearanceCopy(theme
->a_disabled_focused_max
);
751 theme
->a_disabled_unfocused_iconify
=
752 RrAppearanceCopy(theme
->a_disabled_focused_max
);
753 theme
->a_hover_focused_iconify
=
754 RrAppearanceCopy(theme
->a_hover_focused_max
);
755 theme
->a_hover_unfocused_iconify
=
756 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
757 theme
->a_unfocused_unpressed_iconify
=
758 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
759 theme
->a_unfocused_pressed_iconify
=
760 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
761 theme
->a_focused_unpressed_iconify
=
762 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
763 theme
->a_focused_pressed_iconify
=
764 RrAppearanceCopy(theme
->a_focused_pressed_max
);
766 theme
->a_icon
->surface
.grad
=
767 theme
->a_clear
->surface
.grad
=
768 theme
->a_clear_tex
->surface
.grad
=
769 theme
->a_menu_text_title
->surface
.grad
=
770 theme
->a_menu_normal
->surface
.grad
=
771 theme
->a_menu_disabled
->surface
.grad
=
772 theme
->a_menu_text_normal
->surface
.grad
=
773 theme
->a_menu_text_selected
->surface
.grad
=
774 theme
->a_menu_text_disabled
->surface
.grad
=
775 theme
->a_menu_text_disabled_selected
->surface
.grad
=
776 theme
->a_menu_bullet_normal
->surface
.grad
=
777 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
779 /* set up the textures */
780 theme
->a_focused_label
->texture
[0].type
=
781 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
782 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
783 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
784 theme
->a_focused_label
->texture
[0].data
.text
.font
=
785 theme
->win_font_focused
;
786 theme
->osd_hilite_label
->texture
[0].data
.text
.font
= theme
->osd_font
;
787 theme
->a_focused_label
->texture
[0].data
.text
.color
=
788 theme
->title_focused_color
;
789 theme
->osd_hilite_label
->texture
[0].data
.text
.color
=
792 if (!FIND(shadow
, L("window","active","label","text","shadow","offset"),
793 theme
->a_focused_label
))
794 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
=
795 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
796 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
797 theme
->title_focused_shadow_color
;
798 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
799 theme
->title_focused_shadow_alpha
;
801 if (!FIND(shadow
, L("osd","text","shadow","offset"),
802 theme
->osd_hilite_label
))
804 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
805 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
806 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
807 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
809 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
810 theme
->osd_shadow_color
;
811 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
812 theme
->osd_shadow_alpha
;
814 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
815 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
816 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
817 theme
->win_font_unfocused
;
818 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
819 theme
->title_unfocused_color
;
821 if (!FIND(shadow
, L("window","inactive","label","text","shadow","offset"),
822 theme
->a_unfocused_label
))
823 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
=
824 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
825 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
826 theme
->title_unfocused_shadow_color
;
827 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
828 theme
->title_unfocused_shadow_alpha
;
830 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
831 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
832 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
833 theme
->menu_title_font
;
834 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
835 theme
->menu_title_color
;
837 if (!FIND(shadow
, L("menu","title","text","shadow","offset"),
838 theme
->a_menu_text_title
))
839 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
=
840 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= 0;
841 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
842 theme
->menu_title_shadow_color
;
843 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
844 theme
->menu_title_shadow_alpha
;
846 theme
->a_menu_text_normal
->texture
[0].type
=
847 theme
->a_menu_text_selected
->texture
[0].type
=
848 theme
->a_menu_text_disabled
->texture
[0].type
=
849 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
851 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
852 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
853 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
854 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
856 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
857 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
858 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
859 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
861 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
862 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
863 theme
->menu_selected_color
;
864 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
865 theme
->menu_disabled_color
;
866 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
867 theme
->menu_disabled_selected_color
;
869 if (!FIND(shadow
, L("menu","inactive","shadow","offset"),
870 theme
->a_menu_text_normal
))
871 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_x
=
872 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
=
874 if (!FIND(shadow
, L("menu","active","text","shadow","offset"),
875 theme
->a_menu_text_selected
))
876 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_x
=
877 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_y
=
879 if (!FIND(shadow
, L("menu","disabled","shadow","offset"),
880 theme
->a_menu_text_disabled
))
881 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_x
=
882 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_y
=
884 if (!FIND(shadow
, L("menu","activedisabled","shadow","offset"),
885 theme
->a_menu_text_disabled_selected
))
886 theme
->a_menu_text_disabled_selected
->
887 texture
[0].data
.text
.shadow_offset_x
= 0;
888 theme
->a_menu_text_disabled_selected
->
889 texture
[0].data
.text
.shadow_offset_y
= 0;
890 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
891 theme
->menu_text_normal_shadow_color
;
892 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
893 theme
->menu_text_normal_shadow_alpha
;
894 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
895 theme
->menu_text_selected_shadow_color
;
896 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
897 theme
->menu_text_selected_shadow_alpha
;
898 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
899 theme
->menu_text_disabled_shadow_color
;
900 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
901 theme
->menu_text_disabled_shadow_alpha
;
902 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
903 theme
->menu_text_disabled_selected_shadow_color
;
904 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
905 theme
->menu_text_disabled_selected_shadow_alpha
;
907 theme
->a_disabled_focused_max
->texture
[0].type
=
908 theme
->a_disabled_unfocused_max
->texture
[0].type
=
909 theme
->a_hover_focused_max
->texture
[0].type
=
910 theme
->a_hover_unfocused_max
->texture
[0].type
=
911 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
912 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
913 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
914 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
915 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
916 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
917 theme
->a_focused_unpressed_max
->texture
[0].type
=
918 theme
->a_focused_pressed_max
->texture
[0].type
=
919 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
920 theme
->a_unfocused_pressed_max
->texture
[0].type
=
921 theme
->a_disabled_focused_close
->texture
[0].type
=
922 theme
->a_disabled_unfocused_close
->texture
[0].type
=
923 theme
->a_hover_focused_close
->texture
[0].type
=
924 theme
->a_hover_unfocused_close
->texture
[0].type
=
925 theme
->a_focused_unpressed_close
->texture
[0].type
=
926 theme
->a_focused_pressed_close
->texture
[0].type
=
927 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
928 theme
->a_unfocused_pressed_close
->texture
[0].type
=
929 theme
->a_disabled_focused_desk
->texture
[0].type
=
930 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
931 theme
->a_hover_focused_desk
->texture
[0].type
=
932 theme
->a_hover_unfocused_desk
->texture
[0].type
=
933 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
934 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
935 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
936 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
937 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
938 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
939 theme
->a_focused_unpressed_desk
->texture
[0].type
=
940 theme
->a_focused_pressed_desk
->texture
[0].type
=
941 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
942 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
943 theme
->a_disabled_focused_shade
->texture
[0].type
=
944 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
945 theme
->a_hover_focused_shade
->texture
[0].type
=
946 theme
->a_hover_unfocused_shade
->texture
[0].type
=
947 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
948 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
949 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
950 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
951 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
952 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
953 theme
->a_focused_unpressed_shade
->texture
[0].type
=
954 theme
->a_focused_pressed_shade
->texture
[0].type
=
955 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
956 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
957 theme
->a_disabled_focused_iconify
->texture
[0].type
=
958 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
959 theme
->a_hover_focused_iconify
->texture
[0].type
=
960 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
961 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
962 theme
->a_focused_pressed_iconify
->texture
[0].type
=
963 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
964 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
965 theme
->a_menu_bullet_normal
->texture
[0].type
=
966 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
968 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
969 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
970 theme
->max_disabled_mask
;
971 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
972 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
973 theme
->max_hover_mask
;
974 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
975 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
976 theme
->max_pressed_mask
;
977 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
978 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
980 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
981 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
982 theme
->max_toggled_pressed_mask
;
983 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
984 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
985 theme
->max_toggled_mask
;
986 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
987 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
988 theme
->max_toggled_hover_mask
;
989 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
990 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
991 theme
->close_disabled_mask
;
992 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
993 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
994 theme
->close_hover_mask
;
995 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
996 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
997 theme
->close_pressed_mask
;
998 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
999 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
1001 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
1002 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
1003 theme
->desk_disabled_mask
;
1004 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1005 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1006 theme
->desk_hover_mask
;
1007 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1008 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1009 theme
->desk_pressed_mask
;
1010 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1011 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1013 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1014 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1015 theme
->desk_toggled_pressed_mask
;
1016 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1017 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1018 theme
->desk_toggled_mask
;
1019 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1020 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1021 theme
->desk_toggled_hover_mask
;
1022 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1023 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1024 theme
->shade_disabled_mask
;
1025 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1026 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1027 theme
->shade_hover_mask
;
1028 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1029 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1030 theme
->shade_pressed_mask
;
1031 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1032 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1034 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1035 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1036 theme
->shade_toggled_pressed_mask
;
1037 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1038 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1039 theme
->shade_toggled_mask
;
1040 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1041 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1042 theme
->shade_toggled_hover_mask
;
1043 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1044 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1045 theme
->iconify_disabled_mask
;
1046 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1047 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1048 theme
->iconify_hover_mask
;
1049 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1050 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1051 theme
->iconify_pressed_mask
;
1052 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1053 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1054 theme
->iconify_mask
;
1055 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1056 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1057 theme
->menu_bullet_mask
;
1058 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1059 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1060 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1061 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1062 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1063 theme
->titlebut_disabled_focused_color
;
1064 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1065 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1066 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1067 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1068 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1069 theme
->titlebut_disabled_unfocused_color
;
1070 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1071 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1072 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1073 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1074 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1075 theme
->titlebut_hover_focused_color
;
1076 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1077 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1078 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1079 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1080 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1081 theme
->titlebut_hover_unfocused_color
;
1082 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1083 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1084 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1085 theme
->titlebut_toggled_hover_focused_color
;
1086 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1087 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1088 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1089 theme
->titlebut_toggled_hover_unfocused_color
;
1090 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1091 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1092 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1093 theme
->titlebut_toggled_focused_pressed_color
;
1094 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1095 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1096 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1097 theme
->titlebut_toggled_unfocused_pressed_color
;
1098 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1099 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1100 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1101 theme
->titlebut_toggled_focused_unpressed_color
;
1102 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1103 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1104 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1105 theme
->titlebut_toggled_unfocused_unpressed_color
;
1106 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1107 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1108 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1109 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1110 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1111 theme
->titlebut_focused_unpressed_color
;
1112 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1113 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1114 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1115 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1116 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1117 theme
->titlebut_focused_pressed_color
;
1118 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1119 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1120 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1121 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1122 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1123 theme
->titlebut_unfocused_unpressed_color
;
1124 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1125 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1126 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1127 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1128 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1129 theme
->titlebut_unfocused_pressed_color
;
1130 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1132 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1133 theme
->menu_selected_color
;
1136 parse_close(ps
.doc
);
1139 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1140 RrAppearance
*a
, *b
, *c
, *d
;
1142 /* caluclate the font heights*/
1143 a
= theme
->a_focused_label
;
1144 theme
->win_font_height
=
1145 RrFontHeight(theme
->win_font_focused
,
1146 a
->texture
[0].data
.text
.shadow_offset_y
);
1147 a
= theme
->a_unfocused_label
;
1148 theme
->win_font_height
=
1149 MAX(theme
->win_font_height
,
1150 RrFontHeight(theme
->win_font_unfocused
,
1151 a
->texture
[0].data
.text
.shadow_offset_y
));
1152 a
= theme
->a_menu_text_title
;
1153 theme
->menu_title_font_height
=
1154 RrFontHeight(theme
->menu_title_font
,
1155 a
->texture
[0].data
.text
.shadow_offset_y
);
1156 a
= theme
->a_menu_text_normal
;
1157 b
= theme
->a_menu_text_selected
;
1158 c
= theme
->a_menu_text_disabled
;
1159 d
= theme
->a_menu_text_disabled_selected
;
1160 theme
->menu_font_height
=
1161 RrFontHeight(theme
->menu_font
,
1162 MAX(a
->texture
[0].data
.text
.shadow_offset_y
,
1163 MAX(b
->texture
[0].data
.text
.shadow_offset_y
,
1164 MAX(c
->texture
[0].data
.text
.shadow_offset_y
,
1165 d
->texture
[0].data
.text
.shadow_offset_y
1168 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1169 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1170 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1171 theme
->label_height
+= theme
->label_height
& 1;
1173 /* this would be nice I think, since padding.width can now be 0,
1174 but it breaks frame.c horribly and I don't feel like fixing that
1175 right now, so if anyone complains, here is how to keep text from
1176 going over the title's bevel/border with a padding.width of 0 and a
1177 bevelless/borderless label
1178 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1179 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1180 theme->title_height = theme->label_height +
1181 MAX(MAX(theme->padding * 2, ft + fb),
1182 MAX(theme->padding * 2, ut + ub));
1184 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1186 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1187 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1188 theme
->menu_title_height
= theme
->menu_title_label_height
+
1189 theme
->paddingy
* 2;
1191 theme
->button_size
= theme
->label_height
- 2;
1192 theme
->grip_width
= 25;
1197 void RrThemeFree(RrTheme
*theme
)
1200 g_free(theme
->name
);
1202 RrColorFree(theme
->menu_border_color
);
1203 RrColorFree(theme
->frame_focused_border_color
);
1204 RrColorFree(theme
->frame_unfocused_border_color
);
1205 RrColorFree(theme
->cb_unfocused_color
);
1206 RrColorFree(theme
->cb_focused_color
);
1207 RrColorFree(theme
->title_focused_color
);
1208 RrColorFree(theme
->title_unfocused_color
);
1209 RrColorFree(theme
->titlebut_disabled_focused_color
);
1210 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1211 RrColorFree(theme
->titlebut_hover_focused_color
);
1212 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1213 RrColorFree(theme
->titlebut_focused_pressed_color
);
1214 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1215 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1216 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1217 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1218 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1219 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1220 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1221 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1222 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1223 RrColorFree(theme
->menu_title_color
);
1224 RrColorFree(theme
->menu_color
);
1225 RrColorFree(theme
->menu_selected_color
);
1226 RrColorFree(theme
->menu_disabled_color
);
1227 RrColorFree(theme
->menu_disabled_selected_color
);
1228 RrColorFree(theme
->title_focused_shadow_color
);
1229 RrColorFree(theme
->title_unfocused_shadow_color
);
1230 RrColorFree(theme
->osd_color
);
1231 RrColorFree(theme
->osd_shadow_color
);
1232 RrColorFree(theme
->menu_title_shadow_color
);
1233 RrColorFree(theme
->menu_text_normal_shadow_color
);
1234 RrColorFree(theme
->menu_text_selected_shadow_color
);
1235 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1236 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1238 g_free(theme
->def_win_icon
);
1240 RrPixmapMaskFree(theme
->max_mask
);
1241 RrPixmapMaskFree(theme
->max_toggled_mask
);
1242 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1243 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1244 RrPixmapMaskFree(theme
->max_disabled_mask
);
1245 RrPixmapMaskFree(theme
->max_hover_mask
);
1246 RrPixmapMaskFree(theme
->max_pressed_mask
);
1247 RrPixmapMaskFree(theme
->desk_mask
);
1248 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1249 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1250 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1251 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1252 RrPixmapMaskFree(theme
->desk_hover_mask
);
1253 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1254 RrPixmapMaskFree(theme
->shade_mask
);
1255 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1256 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1257 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1258 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1259 RrPixmapMaskFree(theme
->shade_hover_mask
);
1260 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1261 RrPixmapMaskFree(theme
->iconify_mask
);
1262 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1263 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1264 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1265 RrPixmapMaskFree(theme
->close_mask
);
1266 RrPixmapMaskFree(theme
->close_disabled_mask
);
1267 RrPixmapMaskFree(theme
->close_hover_mask
);
1268 RrPixmapMaskFree(theme
->close_pressed_mask
);
1269 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1271 RrFontClose(theme
->win_font_focused
);
1272 RrFontClose(theme
->win_font_unfocused
);
1273 RrFontClose(theme
->menu_title_font
);
1274 RrFontClose(theme
->menu_font
);
1276 RrAppearanceFree(theme
->a_disabled_focused_max
);
1277 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1278 RrAppearanceFree(theme
->a_hover_focused_max
);
1279 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1280 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1281 RrAppearanceFree(theme
->a_focused_pressed_max
);
1282 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1283 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1284 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1285 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1286 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1287 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1288 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1289 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1290 RrAppearanceFree(theme
->a_disabled_focused_close
);
1291 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1292 RrAppearanceFree(theme
->a_hover_focused_close
);
1293 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1294 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1295 RrAppearanceFree(theme
->a_focused_pressed_close
);
1296 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1297 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1298 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1299 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1300 RrAppearanceFree(theme
->a_hover_focused_desk
);
1301 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1302 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1303 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1304 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1305 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1306 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1307 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1308 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1309 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1310 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1311 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1312 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1313 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1314 RrAppearanceFree(theme
->a_hover_focused_shade
);
1315 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1316 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1317 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1318 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1319 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1320 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1321 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1322 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1323 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1324 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1325 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1326 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1327 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1328 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1329 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1330 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1331 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1332 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1333 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1334 RrAppearanceFree(theme
->a_focused_grip
);
1335 RrAppearanceFree(theme
->a_unfocused_grip
);
1336 RrAppearanceFree(theme
->a_focused_title
);
1337 RrAppearanceFree(theme
->a_unfocused_title
);
1338 RrAppearanceFree(theme
->a_focused_label
);
1339 RrAppearanceFree(theme
->a_unfocused_label
);
1340 RrAppearanceFree(theme
->a_icon
);
1341 RrAppearanceFree(theme
->a_focused_handle
);
1342 RrAppearanceFree(theme
->a_unfocused_handle
);
1343 RrAppearanceFree(theme
->a_menu
);
1344 RrAppearanceFree(theme
->a_menu_title
);
1345 RrAppearanceFree(theme
->a_menu_text_title
);
1346 RrAppearanceFree(theme
->a_menu_normal
);
1347 RrAppearanceFree(theme
->a_menu_selected
);
1348 RrAppearanceFree(theme
->a_menu_disabled
);
1349 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1350 RrAppearanceFree(theme
->a_menu_text_normal
);
1351 RrAppearanceFree(theme
->a_menu_text_selected
);
1352 RrAppearanceFree(theme
->a_menu_text_disabled
);
1353 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1354 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1355 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1356 RrAppearanceFree(theme
->a_clear
);
1357 RrAppearanceFree(theme
->a_clear_tex
);
1358 RrAppearanceFree(theme
->osd_hilite_bg
);
1359 RrAppearanceFree(theme
->osd_hilite_fg
);
1360 RrAppearanceFree(theme
->osd_hilite_label
);
1361 RrAppearanceFree(theme
->osd_unhilite_fg
);
1367 static gboolean
read_mask(ParseState
*ps
, const gchar
*maskname
,
1368 RrPixmapMask
**value
)
1370 gboolean ret
= FALSE
;
1372 gint hx
, hy
; /* ignored */
1376 s
= g_build_filename(ps
->path
, maskname
, NULL
);
1377 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1379 *value
= RrPixmapMaskNew(ps
->inst
, w
, h
, (gchar
*)b
);
1387 static void set_default_appearance(RrAppearance
*a
)
1389 a
->surface
.grad
= RR_SURFACE_SOLID
;
1390 a
->surface
.relief
= RR_RELIEF_FLAT
;
1391 a
->surface
.bevel
= RR_BEVEL_1
;
1392 a
->surface
.interlaced
= FALSE
;
1393 a
->surface
.border
= FALSE
;
1394 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1395 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1398 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1399 an RrTextureRGBA. */
1400 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1405 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1407 for (i
= 0; i
< width
* height
; ++i
) {
1408 guchar a
= ((*p
>> 24) & 0xff);
1409 guchar b
= ((*p
>> 16) & 0xff);
1410 guchar g
= ((*p
>> 8) & 0xff);
1411 guchar r
= ((*p
>> 0) & 0xff);
1413 *p
= ((r
<< RrDefaultRedOffset
) +
1414 (g
<< RrDefaultGreenOffset
) +
1415 (b
<< RrDefaultBlueOffset
) +
1416 (a
<< RrDefaultAlphaOffset
));
1423 static void parse_style(gchar
*tex
, RrSurfaceColorType
*grad
,
1424 RrReliefType
*relief
, RrBevelType
*bevel
,
1425 gboolean
*interlaced
, gboolean
*border
,
1426 gboolean allow_trans
)
1430 /* convert to all lowercase */
1431 for (t
= tex
; *t
!= '\0'; ++t
)
1432 *t
= g_ascii_tolower(*t
);
1434 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1435 *grad
= RR_SURFACE_PARENTREL
;
1437 if (strstr(tex
, "gradient") != NULL
) {
1438 if (strstr(tex
, "crossdiagonal") != NULL
)
1439 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1440 else if (strstr(tex
, "pyramid") != NULL
)
1441 *grad
= RR_SURFACE_PYRAMID
;
1442 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1443 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1444 else if (strstr(tex
, "horizontal") != NULL
)
1445 *grad
= RR_SURFACE_HORIZONTAL
;
1446 else if (strstr(tex
, "splitvertical") != NULL
)
1447 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1448 else if (strstr(tex
, "vertical") != NULL
)
1449 *grad
= RR_SURFACE_VERTICAL
;
1451 *grad
= RR_SURFACE_DIAGONAL
;
1453 *grad
= RR_SURFACE_SOLID
;
1456 if (strstr(tex
, "sunken") != NULL
)
1457 *relief
= RR_RELIEF_SUNKEN
;
1458 else if (strstr(tex
, "flat") != NULL
)
1459 *relief
= RR_RELIEF_FLAT
;
1461 *relief
= RR_RELIEF_RAISED
;
1464 if (*relief
== RR_RELIEF_FLAT
) {
1465 if (strstr(tex
, "border") != NULL
)
1468 if (strstr(tex
, "bevel2") != NULL
)
1469 *bevel
= RR_BEVEL_2
;
1471 *bevel
= RR_BEVEL_1
;
1474 if (strstr(tex
, "interlaced") != NULL
)
1477 *interlaced
= FALSE
;
1481 static xmlNodePtr
find_node(xmlNodePtr n
, const gchar
*names
[])
1485 for (i
= 0; names
[i
] && n
; ++i
)
1486 n
= parse_find_node(names
[i
], n
->children
);
1490 static gboolean
find_int(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1491 gint
*integer
, gint lower
, gint upper
)
1495 if ((n
= find_node(n
, names
))) {
1496 i
= parse_int(ps
->doc
, n
);
1497 if (i
>= lower
&& i
<= upper
) {
1505 static gboolean
find_string(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1508 if ((n
= find_node(n
, names
))) {
1509 *string
= parse_string(ps
->doc
, n
);
1515 static gboolean
find_color(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1516 RrColor
**color
, gchar
*alpha
)
1518 if ((n
= find_node(n
, names
))) {
1520 if (parse_attr_int("r", n
, &r
) &&
1521 parse_attr_int("g", n
, &g
) &&
1522 parse_attr_int("b", n
, &b
) &&
1523 parse_attr_int("a", n
, &a
) &&
1524 r
>= 0 && g
>= 0 && b
>= 0 && a
>= 0 &&
1525 r
< 256 && g
< 256 && b
< 256 && a
< 256)
1527 *color
= RrColorNew(ps
->inst
, r
, g
, b
);
1528 if (alpha
) *alpha
= a
;
1535 static gboolean
find_point(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1537 gint lowx
, gint upx
, gint lowy
, gint upy
)
1539 if ((n
= find_node(n
, names
))) {
1541 if (parse_attr_int("x", n
, &a
) &&
1542 parse_attr_int("y", n
, &b
) &&
1543 a
>= lowx
&& a
<= upx
&& b
>= lowy
&& b
<= upy
)
1552 static gboolean
find_shadow(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1555 return find_point(ps
, n
, names
,
1556 &a
->texture
[0].data
.text
.shadow_offset_x
,
1557 &a
->texture
[0].data
.text
.shadow_offset_y
,
1561 static gboolean
find_appearance(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1562 RrAppearance
*a
, gboolean allow_trans
)
1566 if (!(n
= find_node(n
, names
)))
1569 if ((n2
= find_node(n
, L("style")))) {
1570 gchar
*s
= parse_string(ps
->doc
, n2
);
1571 parse_style(s
, &a
->surface
.grad
, &a
->surface
.relief
,
1572 &a
->surface
.bevel
, &a
->surface
.interlaced
,
1573 &a
->surface
.border
, allow_trans
);
1578 if (!find_color(ps
, n
, L("primary"), &a
->surface
.primary
, NULL
))
1579 a
->surface
.primary
= RrColorNew(ps
->inst
, 0, 0, 0);
1580 if (!find_color(ps
, n
, L("secondary"), &a
->surface
.secondary
, NULL
))
1581 a
->surface
.secondary
= RrColorNew(ps
->inst
, 0, 0, 0);
1582 if (a
->surface
.border
)
1583 if (!find_color(ps
, n
, L("border"),
1584 &a
->surface
.border_color
, NULL
))
1585 a
->surface
.border_color
= RrColorNew(ps
->inst
, 0, 0, 0);
1586 if (a
->surface
.interlaced
)
1587 if (!find_color(ps
, n
, L("interlace"),
1588 &a
->surface
.interlace_color
, NULL
))
1589 a
->surface
.interlace_color
= RrColorNew(ps
->inst
, 0, 0, 0);