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
;
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_disabled_selected
= RrAppearanceNew(inst
, 0);
127 theme
->a_menu_selected
= RrAppearanceNew(inst
, 0);
128 theme
->a_menu_text_normal
= RrAppearanceNew(inst
, 1);
129 theme
->a_menu_text_selected
= RrAppearanceNew(inst
, 1);
130 theme
->a_menu_text_disabled
= RrAppearanceNew(inst
, 1);
131 theme
->a_menu_text_disabled_selected
= RrAppearanceNew(inst
, 1);
132 theme
->a_menu_bullet_normal
= RrAppearanceNew(inst
, 1);
133 theme
->a_menu_bullet_selected
= RrAppearanceNew(inst
, 1);
134 theme
->a_clear
= RrAppearanceNew(inst
, 0);
135 theme
->a_clear_tex
= RrAppearanceNew(inst
, 1);
137 /* load the font stuff */
139 if (active_window_font
) {
140 theme
->win_font_focused
= active_window_font
;
141 RrFontRef(active_window_font
);
143 theme
->win_font_focused
= RrFontOpenDefault(inst
);
145 if (inactive_window_font
) {
146 theme
->win_font_unfocused
= inactive_window_font
;
147 RrFontRef(inactive_window_font
);
149 theme
->win_font_unfocused
= RrFontOpenDefault(inst
);
151 winjust
= RR_JUSTIFY_LEFT
;
152 if (FIND(string
, L( "window", "justify"), &str
)) {
153 if (strcmp(str
, "right") == 0)
154 winjust
= RR_JUSTIFY_RIGHT
;
155 else if (strcmp(str
, "center") == 0)
156 winjust
= RR_JUSTIFY_CENTER
;
160 if (menu_title_font
) {
161 theme
->menu_title_font
= menu_title_font
;
162 RrFontRef(menu_title_font
);
164 theme
->menu_title_font
= RrFontOpenDefault(inst
);
166 mtitlejust
= RR_JUSTIFY_LEFT
;
167 if (FIND(string
, L("menu", "justify"), &str
)) {
168 if (strcmp(str
, "right") == 0)
169 mtitlejust
= RR_JUSTIFY_RIGHT
;
170 else if (strcmp(str
, "center") == 0)
171 mtitlejust
= RR_JUSTIFY_CENTER
;
175 if (menu_item_font
) {
176 theme
->menu_font
= menu_item_font
;
177 RrFontRef(menu_item_font
);
179 theme
->menu_font
= RrFontOpenDefault(inst
);
182 theme
->osd_font
= osd_font
;
185 theme
->osd_font
= RrFontOpenDefault(inst
);
187 /* load direct dimensions */
188 if (!FIND(int, L("menu","overlap"),
189 &theme
->menu_overlap
, -100, 100))
190 theme
->menu_overlap
= 0;
192 if (!FIND(int, L("dimensions","handle"), &theme
->handle_height
, 0, 100))
193 theme
->handle_height
= 6;
195 if (!FIND(point
, L("dimensions","padding"),
196 &theme
->paddingx
, &theme
->paddingy
, 0, 100, 0, 100))
197 theme
->paddingx
= theme
->paddingy
= 3;
199 if (!FIND(int, L("dimensions","window","border"),
200 &theme
->fbwidth
, 0, 100))
203 /* menu border width inherits from frame border width */
204 if (!FIND(int, L("dimensions","menu","border"),
205 &theme
->mbwidth
, 0, 100))
206 theme
->mbwidth
= theme
->fbwidth
;
208 if (!FIND(point
, L("dimensions","window","clientpadding"),
209 &theme
->cbwidthx
, &theme
->cbwidthy
, 0, 100, 0, 100))
210 theme
->cbwidthx
= theme
->cbwidthy
= 1;
213 if (!FIND(color
, L("window","active","border"),
214 &theme
->frame_focused_border_color
, NULL
))
215 theme
->frame_focused_border_color
= RrColorNew(inst
, 0, 0, 0);
216 /* frame unfocused border color inherits from frame focused border color */
217 if (!FIND(color
, L("window","inactive","border"),
218 &theme
->frame_unfocused_border_color
, NULL
))
219 theme
->frame_unfocused_border_color
=
221 theme
->frame_focused_border_color
->r
,
222 theme
->frame_focused_border_color
->g
,
223 theme
->frame_focused_border_color
->b
);
225 /* menu border color inherits from frame focused border color */
226 if (!FIND(color
, L("menu","border"),
227 &theme
->menu_border_color
, NULL
))
228 theme
->menu_border_color
=
230 theme
->frame_focused_border_color
->r
,
231 theme
->frame_focused_border_color
->g
,
232 theme
->frame_focused_border_color
->b
);
233 if (!FIND(color
, L("window","active","clientpadding"),
234 &theme
->cb_focused_color
, NULL
))
235 theme
->cb_focused_color
= RrColorNew(inst
, 255, 255, 255);
236 if (!FIND(color
, L("window","inactive","clientpadding"),
237 &theme
->cb_unfocused_color
, NULL
))
238 theme
->cb_unfocused_color
= RrColorNew(inst
, 255, 255, 255);
239 if (!FIND(color
, L("window","active","label","text","primary"),
240 &theme
->title_focused_color
, NULL
))
241 theme
->title_focused_color
= RrColorNew(inst
, 0x0, 0x0, 0x0);
242 if (!FIND(color
, L("osd","text","primary"),
243 &theme
->osd_color
, NULL
))
244 theme
->osd_color
= RrColorNew(inst
,
245 theme
->title_focused_color
->r
,
246 theme
->title_focused_color
->g
,
247 theme
->title_focused_color
->b
);
248 if (!FIND(color
, L("window","inactive","label","text","primary"),
249 &theme
->title_unfocused_color
, NULL
))
250 theme
->title_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
251 if (!FIND(color
, L("window","active","buttons","unpressed","image"),
252 &theme
->titlebut_focused_unpressed_color
, NULL
))
253 theme
->titlebut_focused_unpressed_color
= RrColorNew(inst
, 0, 0, 0);
254 if (!FIND(color
, L("window","inactive","buttons", "unpressed","image"),
255 &theme
->titlebut_unfocused_unpressed_color
, NULL
))
256 theme
->titlebut_unfocused_unpressed_color
=
257 RrColorNew(inst
, 0xff, 0xff, 0xff);
258 if (!FIND(color
, L("window","active","buttons","pressed","image"),
259 &theme
->titlebut_focused_pressed_color
, NULL
))
260 theme
->titlebut_focused_pressed_color
=
262 theme
->titlebut_focused_unpressed_color
->r
,
263 theme
->titlebut_focused_unpressed_color
->g
,
264 theme
->titlebut_focused_unpressed_color
->b
);
265 if (!FIND(color
, L("window","inactive","buttons","pressed","image"),
266 &theme
->titlebut_unfocused_pressed_color
, NULL
))
267 theme
->titlebut_unfocused_pressed_color
=
269 theme
->titlebut_unfocused_unpressed_color
->r
,
270 theme
->titlebut_unfocused_unpressed_color
->g
,
271 theme
->titlebut_unfocused_unpressed_color
->b
);
272 if (!FIND(color
, L("window","active","buttons","disabled","image"),
273 &theme
->titlebut_disabled_focused_color
, NULL
))
274 theme
->titlebut_disabled_focused_color
=
275 RrColorNew(inst
, 0xff, 0xff, 0xff);
276 if (!FIND(color
, L("window","inactive","buttons","disabled","image"),
277 &theme
->titlebut_disabled_unfocused_color
, NULL
))
278 theme
->titlebut_disabled_unfocused_color
= RrColorNew(inst
, 0, 0, 0);
280 L("window","active","buttons","hover","image"),
281 &theme
->titlebut_hover_focused_color
, NULL
))
282 theme
->titlebut_hover_focused_color
=
284 theme
->titlebut_focused_unpressed_color
->r
,
285 theme
->titlebut_focused_unpressed_color
->g
,
286 theme
->titlebut_focused_unpressed_color
->b
);
287 if (!FIND(color
, L("window","inactive","buttons","hover","image"),
288 &theme
->titlebut_hover_unfocused_color
, NULL
))
289 theme
->titlebut_hover_unfocused_color
=
291 theme
->titlebut_unfocused_unpressed_color
->r
,
292 theme
->titlebut_unfocused_unpressed_color
->g
,
293 theme
->titlebut_unfocused_unpressed_color
->b
);
295 L("window","active","buttons","toggled-pressed","image"),
296 &theme
->titlebut_toggled_focused_pressed_color
, NULL
))
297 theme
->titlebut_toggled_focused_pressed_color
=
299 theme
->titlebut_focused_pressed_color
->r
,
300 theme
->titlebut_focused_pressed_color
->g
,
301 theme
->titlebut_focused_pressed_color
->b
);
303 L("window","inactive","buttons","toggled-pressed","image"),
304 &theme
->titlebut_toggled_unfocused_pressed_color
, NULL
))
305 theme
->titlebut_toggled_unfocused_pressed_color
=
307 theme
->titlebut_unfocused_pressed_color
->r
,
308 theme
->titlebut_unfocused_pressed_color
->g
,
309 theme
->titlebut_unfocused_pressed_color
->b
);
311 L("window","active","buttons","toggled-unpressed","image"),
312 &theme
->titlebut_toggled_focused_unpressed_color
, NULL
))
313 theme
->titlebut_toggled_focused_unpressed_color
=
315 theme
->titlebut_focused_pressed_color
->r
,
316 theme
->titlebut_focused_pressed_color
->g
,
317 theme
->titlebut_focused_pressed_color
->b
);
319 L("window","inactive","buttons","toggled-unpressed","image"),
320 &theme
->titlebut_toggled_unfocused_unpressed_color
, NULL
))
321 theme
->titlebut_toggled_unfocused_unpressed_color
=
323 theme
->titlebut_unfocused_pressed_color
->r
,
324 theme
->titlebut_unfocused_pressed_color
->g
,
325 theme
->titlebut_unfocused_pressed_color
->b
);
327 L("window","active","buttons","toggled-hover","image"),
328 &theme
->titlebut_toggled_hover_focused_color
, NULL
))
329 theme
->titlebut_toggled_hover_focused_color
=
331 theme
->titlebut_toggled_focused_unpressed_color
->r
,
332 theme
->titlebut_toggled_focused_unpressed_color
->g
,
333 theme
->titlebut_toggled_focused_unpressed_color
->b
);
335 L("window","inactive","buttons","toggled-hover","image"),
336 &theme
->titlebut_toggled_hover_unfocused_color
, NULL
))
337 theme
->titlebut_toggled_hover_unfocused_color
=
339 theme
->titlebut_toggled_unfocused_unpressed_color
->r
,
340 theme
->titlebut_toggled_unfocused_unpressed_color
->g
,
341 theme
->titlebut_toggled_unfocused_unpressed_color
->b
);
342 if (!FIND(color
, L("menu","title","text","primary"),
343 &theme
->menu_title_color
, NULL
))
344 theme
->menu_title_color
= RrColorNew(inst
, 0, 0, 0);
345 if (!FIND(color
, L("menu","inactive","primary"), &theme
->menu_color
, NULL
))
346 theme
->menu_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
347 if (!FIND(color
, L("menu","disabled","primary"),
348 &theme
->menu_disabled_color
, NULL
))
349 theme
->menu_disabled_color
= RrColorNew(inst
, 0, 0, 0);
350 if (!FIND(color
, L("menu","activedisabled","text","primary"),
351 &theme
->menu_disabled_selected_color
, NULL
))
352 theme
->menu_disabled_selected_color
=
354 theme
->menu_disabled_color
->r
,
355 theme
->menu_disabled_color
->g
,
356 theme
->menu_disabled_color
->b
);
357 if (!FIND(color
, L("menu","active","text","primary"),
358 &theme
->menu_selected_color
, NULL
))
359 theme
->menu_selected_color
= RrColorNew(inst
, 0, 0, 0);
360 if (!FIND(color
, L("window","active","label","text","shadow","primary"),
361 &theme
->title_focused_shadow_color
,
362 &theme
->title_focused_shadow_alpha
))
364 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
365 theme
->title_focused_shadow_alpha
= 50;
367 if (!FIND(color
, L("osd","text","shadow","primary"),
368 &theme
->osd_shadow_color
, &theme
->osd_shadow_alpha
))
370 theme
->osd_shadow_color
=
371 RrColorNew(inst
, theme
->title_focused_shadow_color
->r
,
372 theme
->title_focused_shadow_color
->g
,
373 theme
->title_focused_shadow_color
->b
);
374 theme
->osd_shadow_alpha
= theme
->title_focused_shadow_alpha
;
376 if (!FIND(color
, L("window","inactive","label","text","shadow","primary"),
377 &theme
->title_unfocused_shadow_color
,
378 &theme
->title_unfocused_shadow_alpha
))
380 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
381 theme
->title_unfocused_shadow_alpha
= 50;
383 if (!FIND(color
, L("menu","title","text","shadow","primary"),
384 &theme
->menu_title_shadow_color
,
385 &theme
->menu_title_shadow_alpha
))
387 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
388 theme
->menu_title_shadow_alpha
= 50;
390 if (!FIND(color
, L("menu","inactive","shadow","primary"),
391 &theme
->menu_text_normal_shadow_color
,
392 &theme
->menu_text_normal_shadow_alpha
))
394 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
395 theme
->menu_text_normal_shadow_alpha
= 50;
397 if (!FIND(color
, L("menu","active","text","shadow","primary"),
398 &theme
->menu_text_selected_shadow_color
,
399 &theme
->menu_text_selected_shadow_alpha
))
401 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
402 theme
->menu_text_selected_shadow_alpha
= 50;
404 if (!FIND(color
, L("menu","disabled","shadow","primary"),
405 &theme
->menu_text_disabled_shadow_color
,
406 &theme
->menu_text_disabled_shadow_alpha
))
408 theme
->menu_text_disabled_shadow_color
=
409 RrColorNew(inst
, theme
->menu_text_normal_shadow_color
->r
,
410 theme
->menu_text_normal_shadow_color
->g
,
411 theme
->menu_text_normal_shadow_color
->b
);
412 theme
->menu_text_disabled_shadow_alpha
=
413 theme
->menu_text_normal_shadow_alpha
;
415 if (!FIND(color
, L("menu","activedisabled","shadow","primary"),
416 &theme
->menu_text_disabled_selected_shadow_color
,
417 &theme
->menu_text_disabled_selected_shadow_alpha
))
419 theme
->menu_text_disabled_selected_shadow_color
=
420 RrColorNew(inst
, theme
->menu_text_disabled_shadow_color
->r
,
421 theme
->menu_text_disabled_shadow_color
->g
,
422 theme
->menu_text_disabled_shadow_color
->b
);
423 theme
->menu_text_disabled_selected_shadow_alpha
=
424 theme
->menu_text_disabled_shadow_alpha
;
427 /* load the image masks */
429 /* maximize button masks */
430 if (!read_mask(&ps
, "max.xbm", &theme
->max_mask
)) {
431 guchar data
[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
432 theme
->max_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
434 if (!read_mask(&ps
, "max_toggled.xbm", &theme
->max_toggled_mask
)) {
435 guchar data
[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
436 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 6, 6,(gchar
*)data
);
438 if (!read_mask(&ps
, "max_pressed.xbm", &theme
->max_pressed_mask
))
439 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
440 if (!read_mask(&ps
, "max_disabled.xbm", &theme
->max_disabled_mask
))
441 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
442 if (!read_mask(&ps
, "max_hover.xbm", &theme
->max_hover_mask
))
443 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
444 if (!read_mask(&ps
, "max_toggled_pressed.xbm",
445 &theme
->max_toggled_pressed_mask
))
446 theme
->max_toggled_pressed_mask
=
447 RrPixmapMaskCopy(theme
->max_toggled_mask
);
448 if (!read_mask(&ps
, "max_toggled_hover.xbm",
449 &theme
->max_toggled_hover_mask
))
450 theme
->max_toggled_hover_mask
=
451 RrPixmapMaskCopy(theme
->max_toggled_mask
);
453 /* iconify button masks */
454 if (!read_mask(&ps
, "iconify.xbm", &theme
->iconify_mask
)) {
455 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
456 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
458 if (!read_mask(&ps
, "iconify_pressed.xbm", &theme
->iconify_pressed_mask
))
459 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
460 if (!read_mask(&ps
, "iconify_disabled.xbm", &theme
->iconify_disabled_mask
))
461 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
462 if (!read_mask(&ps
, "iconify_hover.xbm", &theme
->iconify_hover_mask
))
463 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
465 /* all desktops button masks */
466 if (!read_mask(&ps
, "desk.xbm", &theme
->desk_mask
)) {
467 guchar data
[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
468 theme
->desk_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
470 if (!read_mask(&ps
, "desk_toggled.xbm", &theme
->desk_toggled_mask
)) {
471 guchar data
[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
472 theme
->desk_toggled_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
474 if (!read_mask(&ps
, "desk_pressed.xbm", &theme
->desk_pressed_mask
))
475 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
476 if (!read_mask(&ps
, "desk_disabled.xbm", &theme
->desk_disabled_mask
))
477 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
478 if (!read_mask(&ps
, "desk_hover.xbm", &theme
->desk_hover_mask
))
479 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
480 if (!read_mask(&ps
, "desk_toggled_pressed.xbm",
481 &theme
->desk_toggled_pressed_mask
))
482 theme
->desk_toggled_pressed_mask
=
483 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
484 if (!read_mask(&ps
, "desk_toggled_hover.xbm",
485 &theme
->desk_toggled_hover_mask
))
486 theme
->desk_toggled_hover_mask
=
487 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
489 /* shade button masks */
490 if (!read_mask(&ps
, "shade.xbm", &theme
->shade_mask
)) {
491 guchar data
[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
492 theme
->shade_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
494 if (!read_mask(&ps
, "shade_toggled.xbm", &theme
->shade_toggled_mask
))
495 theme
->shade_toggled_mask
= RrPixmapMaskCopy(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_disabled.xbm", &theme
->shade_disabled_mask
))
499 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
500 if (!read_mask(&ps
, "shade_hover.xbm", &theme
->shade_hover_mask
))
501 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
502 if (!read_mask(&ps
, "shade_toggled_pressed.xbm",
503 &theme
->shade_toggled_pressed_mask
))
504 theme
->shade_toggled_pressed_mask
=
505 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
506 if (!read_mask(&ps
, "shade_toggled_hover.xbm",
507 &theme
->shade_toggled_hover_mask
))
508 theme
->shade_toggled_hover_mask
=
509 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
511 /* close button masks */
512 if (!read_mask(&ps
, "close.xbm", &theme
->close_mask
)) {
513 guchar data
[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
514 theme
->close_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
516 if (!read_mask(&ps
, "close_pressed.xbm", &theme
->close_pressed_mask
))
517 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
518 if (!read_mask(&ps
, "close_disabled.xbm", &theme
->close_disabled_mask
))
519 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
520 if (!read_mask(&ps
, "close_hover.xbm", &theme
->close_hover_mask
))
521 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
523 /* submenu bullet mask */
524 if (!read_mask(&ps
, "bullet.xbm", &theme
->menu_bullet_mask
)) {
525 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
526 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
529 /* setup the default window icon */
530 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
531 OB_DEFAULT_ICON_HEIGHT
,
532 OB_DEFAULT_ICON_pixel_data
);
534 /* read the decoration textures */
535 if (!FIND(appearance
, L("window","active","titlebar"),
536 theme
->a_focused_title
, FALSE
))
537 set_default_appearance(theme
->a_focused_title
);
538 if (!FIND(appearance
, L("window","inactive","titlebar"),
539 theme
->a_unfocused_title
, FALSE
))
540 set_default_appearance(theme
->a_unfocused_title
);
541 if (!FIND(appearance
, L("window","active","label"),
542 theme
->a_focused_label
, TRUE
))
543 set_default_appearance(theme
->a_focused_label
);
544 if (!FIND(appearance
, L("window","inactive","label"),
545 theme
->a_unfocused_label
, TRUE
))
546 set_default_appearance(theme
->a_unfocused_label
);
547 if (!FIND(appearance
, L("window","active","handle"),
548 theme
->a_focused_handle
, FALSE
))
549 set_default_appearance(theme
->a_focused_handle
);
550 if (!FIND(appearance
, L("window","inactive","handle"),
551 theme
->a_unfocused_handle
, FALSE
))
552 set_default_appearance(theme
->a_unfocused_handle
);
553 if (!FIND(appearance
, L("window","active","grip"),
554 theme
->a_focused_grip
, TRUE
))
555 set_default_appearance(theme
->a_focused_grip
);
556 if (!FIND(appearance
, L("window","inactive","grip"),
557 theme
->a_unfocused_grip
, TRUE
))
558 set_default_appearance(theme
->a_unfocused_grip
);
559 if (!FIND(appearance
, L("menu","entries"), theme
->a_menu
, FALSE
))
560 set_default_appearance(theme
->a_menu
);
561 if (!FIND(appearance
, L("menu","title"), theme
->a_menu_title
, TRUE
))
562 set_default_appearance(theme
->a_menu_title
);
563 if (!FIND(appearance
, L("menu", "active"), theme
->a_menu_selected
, TRUE
))
564 set_default_appearance(theme
->a_menu_selected
);
565 if (!FIND(appearance
, L("menu", "activedisabled"),
566 theme
->a_menu_disabled_selected
, TRUE
))
567 theme
->a_menu_disabled_selected
=
568 RrAppearanceCopy(theme
->a_menu_selected
);
570 /* read the appearances for rendering non-decorations */
571 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
572 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
573 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
574 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_label
);
576 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_title
);
577 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
578 theme
->osd_unhilite_fg
= RrAppearanceCopy(theme
->a_unfocused_label
);
580 theme
->osd_unhilite_fg
= RrAppearanceCopy(theme
->a_unfocused_title
);
582 /* read buttons textures */
583 if (!FIND(appearance
, L("window","active","buttons","disabled"),
584 theme
->a_disabled_focused_max
, TRUE
))
585 set_default_appearance(theme
->a_disabled_focused_max
);
586 if (!FIND(appearance
, L("window","inactive","buttons","disabled"),
587 theme
->a_disabled_unfocused_max
, TRUE
))
588 set_default_appearance(theme
->a_disabled_unfocused_max
);
589 if (!FIND(appearance
, L("window","active","buttons","pressed"),
590 theme
->a_focused_pressed_max
, TRUE
))
591 set_default_appearance(theme
->a_focused_pressed_max
);
592 if (!FIND(appearance
, L("window","inactive","buttons","pressed"),
593 theme
->a_unfocused_pressed_max
, TRUE
))
594 set_default_appearance(theme
->a_unfocused_pressed_max
);
595 if (!FIND(appearance
, L("window","active","buttons","unpressed"),
596 theme
->a_focused_unpressed_max
, TRUE
))
597 set_default_appearance(theme
->a_focused_unpressed_max
);
598 if (!FIND(appearance
, L("window","inactive","buttons","unpressed"),
599 theme
->a_unfocused_unpressed_max
, TRUE
))
600 set_default_appearance(theme
->a_unfocused_unpressed_max
);
601 if (!FIND(appearance
, L("window","active","buttons","hover"),
602 theme
->a_hover_focused_max
, TRUE
))
604 RrAppearanceFree(theme
->a_hover_focused_max
);
605 theme
->a_hover_focused_max
=
606 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
608 if (!FIND(appearance
, L("window","inactive","buttons","hover"),
609 theme
->a_hover_unfocused_max
, TRUE
))
611 RrAppearanceFree(theme
->a_hover_unfocused_max
);
612 theme
->a_hover_unfocused_max
=
613 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
615 if (!FIND(appearance
, L("window","active","buttons","toggled-pressed"),
616 theme
->a_toggled_focused_pressed_max
, TRUE
))
618 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
619 theme
->a_toggled_focused_pressed_max
=
620 RrAppearanceCopy(theme
->a_focused_pressed_max
);
622 if (!FIND(appearance
, L("window","inactive","buttons","toggled-pressed"),
623 theme
->a_toggled_unfocused_pressed_max
, TRUE
))
625 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
626 theme
->a_toggled_unfocused_pressed_max
=
627 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
629 if (!FIND(appearance
, L("window","active","buttons","toggled-unpressed"),
630 theme
->a_toggled_focused_unpressed_max
, TRUE
))
632 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
633 theme
->a_toggled_focused_unpressed_max
=
634 RrAppearanceCopy(theme
->a_focused_pressed_max
);
636 if (!FIND(appearance
, L("window","inactive","buttons","toggled-unpressed"),
637 theme
->a_toggled_unfocused_unpressed_max
, TRUE
))
639 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
640 theme
->a_toggled_unfocused_unpressed_max
=
641 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
643 if (!FIND(appearance
, L("window","active","buttons","toggled-hover"),
644 theme
->a_toggled_hover_focused_max
, TRUE
))
646 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
647 theme
->a_toggled_hover_focused_max
=
648 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
650 if (!FIND(appearance
, L("window","inactive","buttons","toggled-hover"),
651 theme
->a_toggled_hover_unfocused_max
, TRUE
))
653 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
654 theme
->a_toggled_hover_unfocused_max
=
655 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
658 theme
->a_disabled_focused_close
=
659 RrAppearanceCopy(theme
->a_disabled_focused_max
);
660 theme
->a_disabled_unfocused_close
=
661 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
662 theme
->a_hover_focused_close
=
663 RrAppearanceCopy(theme
->a_hover_focused_max
);
664 theme
->a_hover_unfocused_close
=
665 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
666 theme
->a_unfocused_unpressed_close
=
667 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
668 theme
->a_unfocused_pressed_close
=
669 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
670 theme
->a_focused_unpressed_close
=
671 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
672 theme
->a_focused_pressed_close
=
673 RrAppearanceCopy(theme
->a_focused_pressed_max
);
674 theme
->a_disabled_focused_desk
=
675 RrAppearanceCopy(theme
->a_disabled_focused_max
);
676 theme
->a_disabled_unfocused_desk
=
677 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
678 theme
->a_hover_focused_desk
=
679 RrAppearanceCopy(theme
->a_hover_focused_max
);
680 theme
->a_hover_unfocused_desk
=
681 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
682 theme
->a_toggled_focused_pressed_desk
=
683 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
684 theme
->a_toggled_unfocused_pressed_desk
=
685 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
686 theme
->a_toggled_focused_unpressed_desk
=
687 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
688 theme
->a_toggled_unfocused_unpressed_desk
=
689 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
690 theme
->a_toggled_hover_focused_desk
=
691 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
692 theme
->a_toggled_hover_unfocused_desk
=
693 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
694 theme
->a_unfocused_unpressed_desk
=
695 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
696 theme
->a_unfocused_pressed_desk
=
697 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
698 theme
->a_focused_unpressed_desk
=
699 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
700 theme
->a_focused_pressed_desk
=
701 RrAppearanceCopy(theme
->a_focused_pressed_max
);
702 theme
->a_disabled_focused_shade
=
703 RrAppearanceCopy(theme
->a_disabled_focused_max
);
704 theme
->a_disabled_unfocused_shade
=
705 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
706 theme
->a_hover_focused_shade
=
707 RrAppearanceCopy(theme
->a_hover_focused_max
);
708 theme
->a_hover_unfocused_shade
=
709 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
710 theme
->a_toggled_focused_pressed_shade
=
711 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
712 theme
->a_toggled_unfocused_pressed_shade
=
713 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
714 theme
->a_toggled_focused_unpressed_shade
=
715 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
716 theme
->a_toggled_unfocused_unpressed_shade
=
717 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
718 theme
->a_toggled_hover_focused_shade
=
719 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
720 theme
->a_toggled_hover_unfocused_shade
=
721 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
722 theme
->a_unfocused_unpressed_shade
=
723 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
724 theme
->a_unfocused_pressed_shade
=
725 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
726 theme
->a_focused_unpressed_shade
=
727 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
728 theme
->a_focused_pressed_shade
=
729 RrAppearanceCopy(theme
->a_focused_pressed_max
);
730 theme
->a_disabled_focused_iconify
=
731 RrAppearanceCopy(theme
->a_disabled_focused_max
);
732 theme
->a_disabled_unfocused_iconify
=
733 RrAppearanceCopy(theme
->a_disabled_focused_max
);
734 theme
->a_hover_focused_iconify
=
735 RrAppearanceCopy(theme
->a_hover_focused_max
);
736 theme
->a_hover_unfocused_iconify
=
737 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
738 theme
->a_unfocused_unpressed_iconify
=
739 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
740 theme
->a_unfocused_pressed_iconify
=
741 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
742 theme
->a_focused_unpressed_iconify
=
743 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
744 theme
->a_focused_pressed_iconify
=
745 RrAppearanceCopy(theme
->a_focused_pressed_max
);
747 theme
->a_icon
->surface
.grad
=
748 theme
->a_clear
->surface
.grad
=
749 theme
->a_clear_tex
->surface
.grad
=
750 theme
->a_menu_text_title
->surface
.grad
=
751 theme
->a_menu_normal
->surface
.grad
=
752 theme
->a_menu_disabled
->surface
.grad
=
753 theme
->a_menu_text_normal
->surface
.grad
=
754 theme
->a_menu_text_selected
->surface
.grad
=
755 theme
->a_menu_text_disabled
->surface
.grad
=
756 theme
->a_menu_text_disabled_selected
->surface
.grad
=
757 theme
->a_menu_bullet_normal
->surface
.grad
=
758 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
760 /* set up the textures */
761 theme
->a_focused_label
->texture
[0].type
=
762 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
763 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
764 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
765 theme
->a_focused_label
->texture
[0].data
.text
.font
=
766 theme
->win_font_focused
;
767 theme
->osd_hilite_label
->texture
[0].data
.text
.font
= theme
->osd_font
;
768 theme
->a_focused_label
->texture
[0].data
.text
.color
=
769 theme
->title_focused_color
;
770 theme
->osd_hilite_label
->texture
[0].data
.text
.color
=
773 if (!FIND(shadow
, L("window","active","label","text","shadow","offset"),
774 theme
->a_focused_label
))
775 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
=
776 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
777 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
778 theme
->title_focused_shadow_color
;
779 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
780 theme
->title_focused_shadow_alpha
;
782 if (!FIND(shadow
, L("osd","text","shadow","offset"),
783 theme
->osd_hilite_label
))
785 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
786 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
787 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
788 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
790 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
791 theme
->osd_shadow_color
;
792 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
793 theme
->osd_shadow_alpha
;
795 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
796 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
797 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
798 theme
->win_font_unfocused
;
799 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
800 theme
->title_unfocused_color
;
802 if (!FIND(shadow
, L("window","inactive","label","text","shadow","offset"),
803 theme
->a_unfocused_label
))
804 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
=
805 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
806 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
807 theme
->title_unfocused_shadow_color
;
808 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
809 theme
->title_unfocused_shadow_alpha
;
811 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
812 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
813 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
814 theme
->menu_title_font
;
815 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
816 theme
->menu_title_color
;
818 if (!FIND(shadow
, L("menu","title","text","shadow","offset"),
819 theme
->a_menu_text_title
))
820 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
=
821 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= 0;
822 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
823 theme
->menu_title_shadow_color
;
824 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
825 theme
->menu_title_shadow_alpha
;
827 theme
->a_menu_text_normal
->texture
[0].type
=
828 theme
->a_menu_text_selected
->texture
[0].type
=
829 theme
->a_menu_text_disabled
->texture
[0].type
=
830 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
832 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
833 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
834 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
835 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
837 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
838 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
839 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
840 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
842 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
843 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
844 theme
->menu_selected_color
;
845 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
846 theme
->menu_disabled_color
;
847 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
848 theme
->menu_disabled_selected_color
;
850 if (!FIND(shadow
, L("menu","inactive","shadow","offset"),
851 theme
->a_menu_text_normal
))
852 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_x
=
853 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
=
855 if (!FIND(shadow
, L("menu","active","text","shadow","offset"),
856 theme
->a_menu_text_selected
))
857 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_x
=
858 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_y
=
860 if (!FIND(shadow
, L("menu","disabled","shadow","offset"),
861 theme
->a_menu_text_disabled
))
862 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_x
=
863 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_y
=
865 if (!FIND(shadow
, L("menu","activedisabled","shadow","offset"),
866 theme
->a_menu_text_disabled_selected
))
867 theme
->a_menu_text_disabled_selected
->
868 texture
[0].data
.text
.shadow_offset_x
= 0;
869 theme
->a_menu_text_disabled_selected
->
870 texture
[0].data
.text
.shadow_offset_y
= 0;
871 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
872 theme
->menu_text_normal_shadow_color
;
873 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
874 theme
->menu_text_normal_shadow_alpha
;
875 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
876 theme
->menu_text_selected_shadow_color
;
877 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
878 theme
->menu_text_selected_shadow_alpha
;
879 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
880 theme
->menu_text_disabled_shadow_color
;
881 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
882 theme
->menu_text_disabled_shadow_alpha
;
883 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
884 theme
->menu_text_disabled_selected_shadow_color
;
885 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
886 theme
->menu_text_disabled_selected_shadow_alpha
;
888 theme
->a_disabled_focused_max
->texture
[0].type
=
889 theme
->a_disabled_unfocused_max
->texture
[0].type
=
890 theme
->a_hover_focused_max
->texture
[0].type
=
891 theme
->a_hover_unfocused_max
->texture
[0].type
=
892 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
893 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
894 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
895 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
896 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
897 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
898 theme
->a_focused_unpressed_max
->texture
[0].type
=
899 theme
->a_focused_pressed_max
->texture
[0].type
=
900 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
901 theme
->a_unfocused_pressed_max
->texture
[0].type
=
902 theme
->a_disabled_focused_close
->texture
[0].type
=
903 theme
->a_disabled_unfocused_close
->texture
[0].type
=
904 theme
->a_hover_focused_close
->texture
[0].type
=
905 theme
->a_hover_unfocused_close
->texture
[0].type
=
906 theme
->a_focused_unpressed_close
->texture
[0].type
=
907 theme
->a_focused_pressed_close
->texture
[0].type
=
908 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
909 theme
->a_unfocused_pressed_close
->texture
[0].type
=
910 theme
->a_disabled_focused_desk
->texture
[0].type
=
911 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
912 theme
->a_hover_focused_desk
->texture
[0].type
=
913 theme
->a_hover_unfocused_desk
->texture
[0].type
=
914 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
915 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
916 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
917 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
918 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
919 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
920 theme
->a_focused_unpressed_desk
->texture
[0].type
=
921 theme
->a_focused_pressed_desk
->texture
[0].type
=
922 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
923 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
924 theme
->a_disabled_focused_shade
->texture
[0].type
=
925 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
926 theme
->a_hover_focused_shade
->texture
[0].type
=
927 theme
->a_hover_unfocused_shade
->texture
[0].type
=
928 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
929 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
930 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
931 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
932 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
933 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
934 theme
->a_focused_unpressed_shade
->texture
[0].type
=
935 theme
->a_focused_pressed_shade
->texture
[0].type
=
936 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
937 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
938 theme
->a_disabled_focused_iconify
->texture
[0].type
=
939 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
940 theme
->a_hover_focused_iconify
->texture
[0].type
=
941 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
942 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
943 theme
->a_focused_pressed_iconify
->texture
[0].type
=
944 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
945 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
946 theme
->a_menu_bullet_normal
->texture
[0].type
=
947 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
949 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
950 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
951 theme
->max_disabled_mask
;
952 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
953 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
954 theme
->max_hover_mask
;
955 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
956 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
957 theme
->max_pressed_mask
;
958 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
959 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
961 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
962 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
963 theme
->max_toggled_pressed_mask
;
964 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
965 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
966 theme
->max_toggled_mask
;
967 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
968 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
969 theme
->max_toggled_hover_mask
;
970 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
971 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
972 theme
->close_disabled_mask
;
973 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
974 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
975 theme
->close_hover_mask
;
976 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
977 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
978 theme
->close_pressed_mask
;
979 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
980 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
982 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
983 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
984 theme
->desk_disabled_mask
;
985 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
986 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
987 theme
->desk_hover_mask
;
988 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
989 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
990 theme
->desk_pressed_mask
;
991 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
992 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
994 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
995 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
996 theme
->desk_toggled_pressed_mask
;
997 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
998 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
999 theme
->desk_toggled_mask
;
1000 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1001 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1002 theme
->desk_toggled_hover_mask
;
1003 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1004 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1005 theme
->shade_disabled_mask
;
1006 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1007 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1008 theme
->shade_hover_mask
;
1009 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1010 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1011 theme
->shade_pressed_mask
;
1012 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1013 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1015 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1016 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1017 theme
->shade_toggled_pressed_mask
;
1018 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1019 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1020 theme
->shade_toggled_mask
;
1021 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1022 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1023 theme
->shade_toggled_hover_mask
;
1024 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1025 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1026 theme
->iconify_disabled_mask
;
1027 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1028 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1029 theme
->iconify_hover_mask
;
1030 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1031 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1032 theme
->iconify_pressed_mask
;
1033 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1034 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1035 theme
->iconify_mask
;
1036 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1037 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1038 theme
->menu_bullet_mask
;
1039 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1040 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1041 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1042 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1043 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1044 theme
->titlebut_disabled_focused_color
;
1045 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1046 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1047 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1048 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1049 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1050 theme
->titlebut_disabled_unfocused_color
;
1051 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1052 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1053 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1054 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1055 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1056 theme
->titlebut_hover_focused_color
;
1057 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1058 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1059 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1060 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1061 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1062 theme
->titlebut_hover_unfocused_color
;
1063 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1064 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1065 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1066 theme
->titlebut_toggled_hover_focused_color
;
1067 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1068 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1069 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1070 theme
->titlebut_toggled_hover_unfocused_color
;
1071 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1072 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1073 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1074 theme
->titlebut_toggled_focused_pressed_color
;
1075 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1076 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1077 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1078 theme
->titlebut_toggled_unfocused_pressed_color
;
1079 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1080 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1081 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1082 theme
->titlebut_toggled_focused_unpressed_color
;
1083 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1084 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1085 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1086 theme
->titlebut_toggled_unfocused_unpressed_color
;
1087 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1088 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1089 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1090 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1091 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1092 theme
->titlebut_focused_unpressed_color
;
1093 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1094 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1095 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1096 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1097 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1098 theme
->titlebut_focused_pressed_color
;
1099 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1100 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1101 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1102 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1103 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1104 theme
->titlebut_unfocused_unpressed_color
;
1105 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1106 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1107 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1108 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1109 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1110 theme
->titlebut_unfocused_pressed_color
;
1111 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1113 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1114 theme
->menu_selected_color
;
1117 parse_close(ps
.doc
);
1120 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1121 RrAppearance
*a
, *b
, *c
, *d
;
1123 /* caluclate the font heights*/
1124 a
= theme
->a_focused_label
;
1125 theme
->win_font_height
=
1126 RrFontHeight(theme
->win_font_focused
,
1127 a
->texture
[0].data
.text
.shadow_offset_y
);
1128 a
= theme
->a_unfocused_label
;
1129 theme
->win_font_height
=
1130 MAX(theme
->win_font_height
,
1131 RrFontHeight(theme
->win_font_unfocused
,
1132 a
->texture
[0].data
.text
.shadow_offset_y
));
1133 a
= theme
->a_menu_text_title
;
1134 theme
->menu_title_font_height
=
1135 RrFontHeight(theme
->menu_title_font
,
1136 a
->texture
[0].data
.text
.shadow_offset_y
);
1137 a
= theme
->a_menu_text_normal
;
1138 b
= theme
->a_menu_text_selected
;
1139 c
= theme
->a_menu_text_disabled
;
1140 d
= theme
->a_menu_text_disabled_selected
;
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 MAX(c
->texture
[0].data
.text
.shadow_offset_y
,
1146 d
->texture
[0].data
.text
.shadow_offset_y
1149 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1150 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1151 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1152 theme
->label_height
+= theme
->label_height
& 1;
1154 /* this would be nice I think, since padding.width can now be 0,
1155 but it breaks frame.c horribly and I don't feel like fixing that
1156 right now, so if anyone complains, here is how to keep text from
1157 going over the title's bevel/border with a padding.width of 0 and a
1158 bevelless/borderless label
1159 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1160 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1161 theme->title_height = theme->label_height +
1162 MAX(MAX(theme->padding * 2, ft + fb),
1163 MAX(theme->padding * 2, ut + ub));
1165 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1167 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1168 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1169 theme
->menu_title_height
= theme
->menu_title_label_height
+
1170 theme
->paddingy
* 2;
1172 theme
->button_size
= theme
->label_height
- 2;
1173 theme
->grip_width
= 25;
1178 void RrThemeFree(RrTheme
*theme
)
1181 RrColorFree(theme
->menu_border_color
);
1182 RrColorFree(theme
->frame_focused_border_color
);
1183 RrColorFree(theme
->frame_unfocused_border_color
);
1184 RrColorFree(theme
->cb_unfocused_color
);
1185 RrColorFree(theme
->cb_focused_color
);
1186 RrColorFree(theme
->title_focused_color
);
1187 RrColorFree(theme
->title_unfocused_color
);
1188 RrColorFree(theme
->titlebut_disabled_focused_color
);
1189 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1190 RrColorFree(theme
->titlebut_hover_focused_color
);
1191 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1192 RrColorFree(theme
->titlebut_focused_pressed_color
);
1193 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1194 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1195 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1196 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1197 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1198 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1199 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1200 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1201 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1202 RrColorFree(theme
->menu_title_color
);
1203 RrColorFree(theme
->menu_color
);
1204 RrColorFree(theme
->menu_selected_color
);
1205 RrColorFree(theme
->menu_disabled_color
);
1206 RrColorFree(theme
->menu_disabled_selected_color
);
1207 RrColorFree(theme
->title_focused_shadow_color
);
1208 RrColorFree(theme
->title_unfocused_shadow_color
);
1209 RrColorFree(theme
->osd_color
);
1210 RrColorFree(theme
->osd_shadow_color
);
1211 RrColorFree(theme
->menu_title_shadow_color
);
1212 RrColorFree(theme
->menu_text_normal_shadow_color
);
1213 RrColorFree(theme
->menu_text_selected_shadow_color
);
1214 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1215 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1217 g_free(theme
->def_win_icon
);
1219 RrPixmapMaskFree(theme
->max_mask
);
1220 RrPixmapMaskFree(theme
->max_toggled_mask
);
1221 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1222 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1223 RrPixmapMaskFree(theme
->max_disabled_mask
);
1224 RrPixmapMaskFree(theme
->max_hover_mask
);
1225 RrPixmapMaskFree(theme
->max_pressed_mask
);
1226 RrPixmapMaskFree(theme
->desk_mask
);
1227 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1228 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1229 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1230 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1231 RrPixmapMaskFree(theme
->desk_hover_mask
);
1232 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1233 RrPixmapMaskFree(theme
->shade_mask
);
1234 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1235 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1236 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1237 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1238 RrPixmapMaskFree(theme
->shade_hover_mask
);
1239 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1240 RrPixmapMaskFree(theme
->iconify_mask
);
1241 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1242 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1243 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1244 RrPixmapMaskFree(theme
->close_mask
);
1245 RrPixmapMaskFree(theme
->close_disabled_mask
);
1246 RrPixmapMaskFree(theme
->close_hover_mask
);
1247 RrPixmapMaskFree(theme
->close_pressed_mask
);
1248 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1250 RrFontClose(theme
->win_font_focused
);
1251 RrFontClose(theme
->win_font_unfocused
);
1252 RrFontClose(theme
->menu_title_font
);
1253 RrFontClose(theme
->menu_font
);
1255 RrAppearanceFree(theme
->a_disabled_focused_max
);
1256 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1257 RrAppearanceFree(theme
->a_hover_focused_max
);
1258 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1259 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1260 RrAppearanceFree(theme
->a_focused_pressed_max
);
1261 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1262 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1263 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1264 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1265 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1266 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1267 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1268 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1269 RrAppearanceFree(theme
->a_disabled_focused_close
);
1270 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1271 RrAppearanceFree(theme
->a_hover_focused_close
);
1272 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1273 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1274 RrAppearanceFree(theme
->a_focused_pressed_close
);
1275 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1276 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1277 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1278 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1279 RrAppearanceFree(theme
->a_hover_focused_desk
);
1280 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1281 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1282 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1283 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1284 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1285 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1286 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1287 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1288 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1289 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1290 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1291 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1292 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1293 RrAppearanceFree(theme
->a_hover_focused_shade
);
1294 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1295 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1296 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1297 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1298 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1299 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1300 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1301 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1302 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1303 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1304 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1305 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1306 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1307 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1308 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1309 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1310 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1311 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1312 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1313 RrAppearanceFree(theme
->a_focused_grip
);
1314 RrAppearanceFree(theme
->a_unfocused_grip
);
1315 RrAppearanceFree(theme
->a_focused_title
);
1316 RrAppearanceFree(theme
->a_unfocused_title
);
1317 RrAppearanceFree(theme
->a_focused_label
);
1318 RrAppearanceFree(theme
->a_unfocused_label
);
1319 RrAppearanceFree(theme
->a_icon
);
1320 RrAppearanceFree(theme
->a_focused_handle
);
1321 RrAppearanceFree(theme
->a_unfocused_handle
);
1322 RrAppearanceFree(theme
->a_menu
);
1323 RrAppearanceFree(theme
->a_menu_title
);
1324 RrAppearanceFree(theme
->a_menu_text_title
);
1325 RrAppearanceFree(theme
->a_menu_normal
);
1326 RrAppearanceFree(theme
->a_menu_selected
);
1327 RrAppearanceFree(theme
->a_menu_disabled
);
1328 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1329 RrAppearanceFree(theme
->a_menu_text_normal
);
1330 RrAppearanceFree(theme
->a_menu_text_selected
);
1331 RrAppearanceFree(theme
->a_menu_text_disabled
);
1332 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1333 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1334 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1335 RrAppearanceFree(theme
->a_clear
);
1336 RrAppearanceFree(theme
->a_clear_tex
);
1337 RrAppearanceFree(theme
->osd_hilite_bg
);
1338 RrAppearanceFree(theme
->osd_hilite_fg
);
1339 RrAppearanceFree(theme
->osd_hilite_label
);
1340 RrAppearanceFree(theme
->osd_unhilite_fg
);
1346 static gboolean
read_mask(ParseState
*ps
, const gchar
*maskname
,
1347 RrPixmapMask
**value
)
1349 gboolean ret
= FALSE
;
1351 gint hx
, hy
; /* ignored */
1355 s
= g_build_filename(ps
->path
, maskname
, NULL
);
1356 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1358 *value
= RrPixmapMaskNew(ps
->inst
, w
, h
, (gchar
*)b
);
1366 static void set_default_appearance(RrAppearance
*a
)
1368 a
->surface
.grad
= RR_SURFACE_SOLID
;
1369 a
->surface
.relief
= RR_RELIEF_FLAT
;
1370 a
->surface
.bevel
= RR_BEVEL_1
;
1371 a
->surface
.interlaced
= FALSE
;
1372 a
->surface
.border
= FALSE
;
1373 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1374 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1377 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1378 an RrTextureRGBA. */
1379 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1384 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1386 for (i
= 0; i
< width
* height
; ++i
) {
1387 guchar a
= ((*p
>> 24) & 0xff);
1388 guchar b
= ((*p
>> 16) & 0xff);
1389 guchar g
= ((*p
>> 8) & 0xff);
1390 guchar r
= ((*p
>> 0) & 0xff);
1392 *p
= ((r
<< RrDefaultRedOffset
) +
1393 (g
<< RrDefaultGreenOffset
) +
1394 (b
<< RrDefaultBlueOffset
) +
1395 (a
<< RrDefaultAlphaOffset
));
1402 static void parse_style(gchar
*tex
, RrSurfaceColorType
*grad
,
1403 RrReliefType
*relief
, RrBevelType
*bevel
,
1404 gboolean
*interlaced
, gboolean
*border
,
1405 gboolean allow_trans
)
1409 /* convert to all lowercase */
1410 for (t
= tex
; *t
!= '\0'; ++t
)
1411 *t
= g_ascii_tolower(*t
);
1413 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1414 *grad
= RR_SURFACE_PARENTREL
;
1416 if (strstr(tex
, "gradient") != NULL
) {
1417 if (strstr(tex
, "crossdiagonal") != NULL
)
1418 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1419 else if (strstr(tex
, "pyramid") != NULL
)
1420 *grad
= RR_SURFACE_PYRAMID
;
1421 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1422 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1423 else if (strstr(tex
, "horizontal") != NULL
)
1424 *grad
= RR_SURFACE_HORIZONTAL
;
1425 else if (strstr(tex
, "splitvertical") != NULL
)
1426 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1427 else if (strstr(tex
, "vertical") != NULL
)
1428 *grad
= RR_SURFACE_VERTICAL
;
1430 *grad
= RR_SURFACE_DIAGONAL
;
1432 *grad
= RR_SURFACE_SOLID
;
1435 if (strstr(tex
, "sunken") != NULL
)
1436 *relief
= RR_RELIEF_SUNKEN
;
1437 else if (strstr(tex
, "flat") != NULL
)
1438 *relief
= RR_RELIEF_FLAT
;
1440 *relief
= RR_RELIEF_RAISED
;
1443 if (*relief
== RR_RELIEF_FLAT
) {
1444 if (strstr(tex
, "border") != NULL
)
1447 if (strstr(tex
, "bevel2") != NULL
)
1448 *bevel
= RR_BEVEL_2
;
1450 *bevel
= RR_BEVEL_1
;
1453 if (strstr(tex
, "interlaced") != NULL
)
1456 *interlaced
= FALSE
;
1460 static xmlNodePtr
find_node(xmlNodePtr n
, const gchar
*names
[])
1464 for (i
= 0; names
[i
] && n
; ++i
)
1465 n
= parse_find_node(names
[i
], n
->children
);
1469 static gboolean
find_int(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1470 gint
*integer
, gint lower
, gint upper
)
1474 if ((n
= find_node(n
, names
))) {
1475 i
= parse_int(ps
->doc
, n
);
1476 if (i
>= lower
&& i
<= upper
) {
1484 static gboolean
find_string(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1487 if ((n
= find_node(n
, names
))) {
1488 *string
= parse_string(ps
->doc
, n
);
1494 static gboolean
find_color(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1495 RrColor
**color
, gchar
*alpha
)
1497 if ((n
= find_node(n
, names
))) {
1499 if (parse_attr_int("r", n
, &r
) &&
1500 parse_attr_int("g", n
, &g
) &&
1501 parse_attr_int("b", n
, &b
) &&
1502 parse_attr_int("a", n
, &a
) &&
1503 r
>= 0 && g
>= 0 && b
>= 0 && a
>= 0 &&
1504 r
< 256 && g
< 256 && b
< 256 && a
< 256)
1506 *color
= RrColorNew(ps
->inst
, r
, g
, b
);
1507 if (alpha
) *alpha
= a
;
1514 static gboolean
find_point(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1516 gint lowx
, gint upx
, gint lowy
, gint upy
)
1518 if ((n
= find_node(n
, names
))) {
1520 if (parse_attr_int("x", n
, &a
) &&
1521 parse_attr_int("y", n
, &b
) &&
1522 a
>= lowx
&& a
<= upx
&& b
>= lowy
&& b
<= upy
)
1531 static gboolean
find_shadow(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1534 return find_point(ps
, n
, names
,
1535 &a
->texture
[0].data
.text
.shadow_offset_x
,
1536 &a
->texture
[0].data
.text
.shadow_offset_y
,
1540 static gboolean
find_appearance(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1541 RrAppearance
*a
, gboolean allow_trans
)
1545 if (!(n
= find_node(n
, names
)))
1548 if ((n2
= find_node(n
, L("style")))) {
1549 gchar
*s
= parse_string(ps
->doc
, n2
);
1550 parse_style(s
, &a
->surface
.grad
, &a
->surface
.relief
,
1551 &a
->surface
.bevel
, &a
->surface
.interlaced
,
1552 &a
->surface
.border
, allow_trans
);
1557 if (!find_color(ps
, n
, L("primary"), &a
->surface
.primary
, NULL
))
1558 a
->surface
.primary
= RrColorNew(ps
->inst
, 0, 0, 0);
1559 if (!find_color(ps
, n
, L("secondary"), &a
->surface
.secondary
, NULL
))
1560 a
->surface
.secondary
= RrColorNew(ps
->inst
, 0, 0, 0);
1561 if (a
->surface
.border
)
1562 if (!find_color(ps
, n
, L("border"),
1563 &a
->surface
.border_color
, NULL
))
1564 a
->surface
.border_color
= RrColorNew(ps
->inst
, 0, 0, 0);
1565 if (a
->surface
.interlaced
)
1566 if (!find_color(ps
, n
, L("interlace"),
1567 &a
->surface
.interlace_color
, NULL
))
1568 a
->surface
.interlace_color
= RrColorNew(ps
->inst
, 0, 0, 0);