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