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