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("window","border","width"),
200 &theme
->fbwidth
, 0, 100))
203 /* menu border width inherits from frame border width */
204 if (!FIND(int, L("menu","border","width"),
205 &theme
->mbwidth
, 0, 100))
206 theme
->mbwidth
= theme
->fbwidth
;
208 if (!FIND(point
, L("window","clientpadding"), &theme
->cbwidthx
,
209 &theme
->cbwidthy
, 0, 100, 0, 100))
210 theme
->cbwidthx
= theme
->cbwidthy
= 1;
213 if (!FIND(color
, L("window","border","primary"),
214 &theme
->frame_b_color
, NULL
))
215 theme
->frame_b_color
= RrColorNew(inst
, 0, 0, 0);
217 /* menu border color inherits from frame border color */
218 if (!FIND(color
, L("menu","border","primary"),
219 &theme
->menu_b_color
, NULL
))
220 theme
->menu_b_color
= RrColorNew(inst
,
221 theme
->frame_b_color
->r
,
222 theme
->frame_b_color
->g
,
223 theme
->frame_b_color
->b
);
224 if (!FIND(color
, L("window","active","clientpadding"),
225 &theme
->cb_focused_color
, NULL
))
226 theme
->cb_focused_color
= RrColorNew(inst
, 255, 255, 255);
227 if (!FIND(color
, L("window","inactive","clientpadding"),
228 &theme
->cb_unfocused_color
, NULL
))
229 theme
->cb_unfocused_color
= RrColorNew(inst
, 255, 255, 255);
230 if (!FIND(color
, L("window","active","label","text","primary"),
231 &theme
->title_focused_color
, NULL
))
232 theme
->title_focused_color
= RrColorNew(inst
, 0x0, 0x0, 0x0);
233 if (!FIND(color
, L("osd","text","primary"),
234 &theme
->osd_color
, NULL
))
235 theme
->osd_color
= RrColorNew(inst
,
236 theme
->title_focused_color
->r
,
237 theme
->title_focused_color
->g
,
238 theme
->title_focused_color
->b
);
239 if (!FIND(color
, L("window","inactive","label","text","primary"),
240 &theme
->title_unfocused_color
, NULL
))
241 theme
->title_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
242 if (!FIND(color
, L("window","active","buttons","unpressed","image"),
243 &theme
->titlebut_focused_unpressed_color
, NULL
))
244 theme
->titlebut_focused_unpressed_color
= RrColorNew(inst
, 0, 0, 0);
245 if (!FIND(color
, L("window","inactive","buttons", "unpressed","image"),
246 &theme
->titlebut_unfocused_unpressed_color
, NULL
))
247 theme
->titlebut_unfocused_unpressed_color
=
248 RrColorNew(inst
, 0xff, 0xff, 0xff);
249 if (!FIND(color
, L("window","active","buttons","pressed","image"),
250 &theme
->titlebut_focused_pressed_color
, NULL
))
251 theme
->titlebut_focused_pressed_color
=
253 theme
->titlebut_focused_unpressed_color
->r
,
254 theme
->titlebut_focused_unpressed_color
->g
,
255 theme
->titlebut_focused_unpressed_color
->b
);
256 if (!FIND(color
, L("window","inactive","buttons","pressed","image"),
257 &theme
->titlebut_unfocused_pressed_color
, NULL
))
258 theme
->titlebut_unfocused_pressed_color
=
260 theme
->titlebut_unfocused_unpressed_color
->r
,
261 theme
->titlebut_unfocused_unpressed_color
->g
,
262 theme
->titlebut_unfocused_unpressed_color
->b
);
263 if (!FIND(color
, L("window","active","buttons","disabled","image"),
264 &theme
->titlebut_disabled_focused_color
, NULL
))
265 theme
->titlebut_disabled_focused_color
=
266 RrColorNew(inst
, 0xff, 0xff, 0xff);
267 if (!FIND(color
, L("window","inactive","buttons","disabled","image"),
268 &theme
->titlebut_disabled_unfocused_color
, NULL
))
269 theme
->titlebut_disabled_unfocused_color
= RrColorNew(inst
, 0, 0, 0);
271 L("window","active","buttons","hover","image"),
272 &theme
->titlebut_hover_focused_color
, NULL
))
273 theme
->titlebut_hover_focused_color
=
275 theme
->titlebut_focused_unpressed_color
->r
,
276 theme
->titlebut_focused_unpressed_color
->g
,
277 theme
->titlebut_focused_unpressed_color
->b
);
278 if (!FIND(color
, L("window","inactive","buttons","hover","image"),
279 &theme
->titlebut_hover_unfocused_color
, NULL
))
280 theme
->titlebut_hover_unfocused_color
=
282 theme
->titlebut_unfocused_unpressed_color
->r
,
283 theme
->titlebut_unfocused_unpressed_color
->g
,
284 theme
->titlebut_unfocused_unpressed_color
->b
);
286 L("window","active","buttons","toggled-pressed","image"),
287 &theme
->titlebut_toggled_focused_pressed_color
, NULL
))
288 theme
->titlebut_toggled_focused_pressed_color
=
290 theme
->titlebut_focused_pressed_color
->r
,
291 theme
->titlebut_focused_pressed_color
->g
,
292 theme
->titlebut_focused_pressed_color
->b
);
294 L("window","inactive","buttons","toggled-pressed","image"),
295 &theme
->titlebut_toggled_unfocused_pressed_color
, NULL
))
296 theme
->titlebut_toggled_unfocused_pressed_color
=
298 theme
->titlebut_unfocused_pressed_color
->r
,
299 theme
->titlebut_unfocused_pressed_color
->g
,
300 theme
->titlebut_unfocused_pressed_color
->b
);
302 L("window","active","buttons","toggled-unpressed","image"),
303 &theme
->titlebut_toggled_focused_unpressed_color
, NULL
))
304 theme
->titlebut_toggled_focused_unpressed_color
=
306 theme
->titlebut_focused_pressed_color
->r
,
307 theme
->titlebut_focused_pressed_color
->g
,
308 theme
->titlebut_focused_pressed_color
->b
);
310 L("window","inactive","buttons","toggled-unpressed","image"),
311 &theme
->titlebut_toggled_unfocused_unpressed_color
, NULL
))
312 theme
->titlebut_toggled_unfocused_unpressed_color
=
314 theme
->titlebut_unfocused_pressed_color
->r
,
315 theme
->titlebut_unfocused_pressed_color
->g
,
316 theme
->titlebut_unfocused_pressed_color
->b
);
318 L("window","active","buttons","toggled-hover","image"),
319 &theme
->titlebut_toggled_hover_focused_color
, NULL
))
320 theme
->titlebut_toggled_hover_focused_color
=
322 theme
->titlebut_toggled_focused_unpressed_color
->r
,
323 theme
->titlebut_toggled_focused_unpressed_color
->g
,
324 theme
->titlebut_toggled_focused_unpressed_color
->b
);
326 L("window","inactive","buttons","toggled-hover","image"),
327 &theme
->titlebut_toggled_hover_unfocused_color
, NULL
))
328 theme
->titlebut_toggled_hover_unfocused_color
=
330 theme
->titlebut_toggled_unfocused_unpressed_color
->r
,
331 theme
->titlebut_toggled_unfocused_unpressed_color
->g
,
332 theme
->titlebut_toggled_unfocused_unpressed_color
->b
);
333 if (!FIND(color
, L("menu","title","text","primary"),
334 &theme
->menu_title_color
, NULL
))
335 theme
->menu_title_color
= RrColorNew(inst
, 0, 0, 0);
336 if (!FIND(color
, L("menu","inactive","primary"), &theme
->menu_color
, NULL
))
337 theme
->menu_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
338 if (!FIND(color
, L("menu","disabled","primary"),
339 &theme
->menu_disabled_color
, NULL
))
340 theme
->menu_disabled_color
= RrColorNew(inst
, 0, 0, 0);
341 if (!FIND(color
, L("menu","activedisabled","text","primary"),
342 &theme
->menu_disabled_selected_color
, NULL
))
343 theme
->menu_disabled_selected_color
=
345 theme
->menu_disabled_color
->r
,
346 theme
->menu_disabled_color
->g
,
347 theme
->menu_disabled_color
->b
);
348 if (!FIND(color
, L("menu","active","text","primary"),
349 &theme
->menu_selected_color
, NULL
))
350 theme
->menu_selected_color
= RrColorNew(inst
, 0, 0, 0);
351 if (!FIND(color
, L("window","active","label","text","shadow","primary"),
352 &theme
->title_focused_shadow_color
,
353 &theme
->title_focused_shadow_alpha
))
355 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
356 theme
->title_focused_shadow_alpha
= 50;
358 if (!FIND(color
, L("osd","text","shadow","primary"),
359 &theme
->osd_shadow_color
, &theme
->osd_shadow_alpha
))
361 theme
->osd_shadow_color
=
362 RrColorNew(inst
, theme
->title_focused_shadow_color
->r
,
363 theme
->title_focused_shadow_color
->g
,
364 theme
->title_focused_shadow_color
->b
);
365 theme
->osd_shadow_alpha
= theme
->title_focused_shadow_alpha
;
367 if (!FIND(color
, L("window","inactive","label","text","shadow","primary"),
368 &theme
->title_unfocused_shadow_color
,
369 &theme
->title_unfocused_shadow_alpha
))
371 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
372 theme
->title_unfocused_shadow_alpha
= 50;
374 if (!FIND(color
, L("menu","title","text","shadow","primary"),
375 &theme
->menu_title_shadow_color
,
376 &theme
->menu_title_shadow_alpha
))
378 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
379 theme
->menu_title_shadow_alpha
= 50;
381 if (!FIND(color
, L("menu","inactive","shadow","primary"),
382 &theme
->menu_text_normal_shadow_color
,
383 &theme
->menu_text_normal_shadow_alpha
))
385 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
386 theme
->menu_text_normal_shadow_alpha
= 50;
388 if (!FIND(color
, L("menu","active","text","shadow","primary"),
389 &theme
->menu_text_selected_shadow_color
,
390 &theme
->menu_text_selected_shadow_alpha
))
392 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
393 theme
->menu_text_selected_shadow_alpha
= 50;
395 if (!FIND(color
, L("menu","disabled","shadow","primary"),
396 &theme
->menu_text_disabled_shadow_color
,
397 &theme
->menu_text_disabled_shadow_alpha
))
399 theme
->menu_text_disabled_shadow_color
=
400 RrColorNew(inst
, theme
->menu_text_normal_shadow_color
->r
,
401 theme
->menu_text_normal_shadow_color
->g
,
402 theme
->menu_text_normal_shadow_color
->b
);
403 theme
->menu_text_disabled_shadow_alpha
=
404 theme
->menu_text_normal_shadow_alpha
;
406 if (!FIND(color
, L("menu","activedisabled","shadow","primary"),
407 &theme
->menu_text_disabled_selected_shadow_color
,
408 &theme
->menu_text_disabled_selected_shadow_alpha
))
410 theme
->menu_text_disabled_selected_shadow_color
=
411 RrColorNew(inst
, theme
->menu_text_disabled_shadow_color
->r
,
412 theme
->menu_text_disabled_shadow_color
->g
,
413 theme
->menu_text_disabled_shadow_color
->b
);
414 theme
->menu_text_disabled_selected_shadow_alpha
=
415 theme
->menu_text_disabled_shadow_alpha
;
418 /* load the image masks */
419 if (read_mask(&ps
, "max.xbm", &theme
->max_mask
)) {
420 if (!read_mask(&ps
, "max_pressed.xbm", &theme
->max_pressed_mask
))
421 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
422 if (!read_mask(&ps
, "max_toggled.xbm", &theme
->max_toggled_mask
))
423 theme
->max_toggled_mask
=
424 RrPixmapMaskCopy(theme
->max_pressed_mask
);
425 if (!read_mask(&ps
, "max_toggled_pressed.xbm",
426 &theme
->max_toggled_pressed_mask
))
427 theme
->max_toggled_pressed_mask
=
428 RrPixmapMaskCopy(theme
->max_toggled_mask
);
429 if (!read_mask(&ps
, "max_toggled_hover.xbm",
430 &theme
->max_toggled_hover_mask
))
431 theme
->max_toggled_hover_mask
=
432 RrPixmapMaskCopy(theme
->max_toggled_mask
);
433 if (!read_mask(&ps
, "max_disabled.xbm", &theme
->max_disabled_mask
))
434 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
435 if (!read_mask(&ps
, "max_hover.xbm", &theme
->max_hover_mask
))
436 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
439 guchar data
[] = { 0x7f, 0x7f, 0x7f, 0x41, 0x41, 0x41, 0x7f };
440 theme
->max_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
443 guchar data
[] = { 0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f };
444 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
446 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
447 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
448 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
449 theme
->max_toggled_pressed_mask
=
450 RrPixmapMaskCopy(theme
->max_toggled_mask
);
451 theme
->max_toggled_hover_mask
=
452 RrPixmapMaskCopy(theme
->max_toggled_mask
);
455 if (read_mask(&ps
, "iconify.xbm", &theme
->iconify_mask
)) {
456 if (!read_mask(&ps
, "iconify_pressed.xbm",
457 &theme
->iconify_pressed_mask
))
458 theme
->iconify_pressed_mask
=
459 RrPixmapMaskCopy(theme
->iconify_mask
);
460 if (!read_mask(&ps
, "iconify_disabled.xbm",
461 &theme
->iconify_disabled_mask
))
462 theme
->iconify_disabled_mask
=
463 RrPixmapMaskCopy(theme
->iconify_mask
);
464 if (!read_mask(&ps
, "iconify_hover.xbm", &theme
->iconify_hover_mask
))
465 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
468 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f };
469 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
471 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
472 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
473 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
476 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
477 OB_DEFAULT_ICON_HEIGHT
,
478 OB_DEFAULT_ICON_pixel_data
);
480 if (read_mask(&ps
, "desk.xbm", &theme
->desk_mask
)) {
481 if (!read_mask(&ps
, "desk_pressed.xbm", &theme
->desk_pressed_mask
))
482 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
483 if (!read_mask(&ps
, "desk_toggled.xbm", &theme
->desk_toggled_mask
))
484 theme
->desk_toggled_mask
=
485 RrPixmapMaskCopy(theme
->desk_pressed_mask
);
486 if (!read_mask(&ps
, "desk_toggled_pressed.xbm",
487 &theme
->desk_toggled_pressed_mask
))
488 theme
->desk_toggled_pressed_mask
=
489 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
490 if (!read_mask(&ps
, "desk_toggled_hover.xbm",
491 &theme
->desk_toggled_hover_mask
))
492 theme
->desk_toggled_hover_mask
=
493 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
494 if (!read_mask(&ps
, "desk_disabled.xbm", &theme
->desk_disabled_mask
))
495 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
496 if (!read_mask(&ps
, "desk_hover.xbm", &theme
->desk_hover_mask
))
497 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
500 guchar data
[] = { 0x63, 0x63, 0x00, 0x00, 0x00, 0x63, 0x63 };
501 theme
->desk_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
504 guchar data
[] = { 0x00, 0x36, 0x36, 0x08, 0x36, 0x36, 0x00 };
505 theme
->desk_toggled_mask
= RrPixmapMaskNew(inst
, 7, 7,
508 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
509 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
510 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
511 theme
->desk_toggled_pressed_mask
=
512 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
513 theme
->desk_toggled_hover_mask
=
514 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
517 if (read_mask(&ps
, "shade.xbm", &theme
->shade_mask
)) {
518 if (!read_mask(&ps
, "shade_pressed.xbm", &theme
->shade_pressed_mask
))
519 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
520 if (!read_mask(&ps
, "shade_toggled.xbm", &theme
->shade_toggled_mask
))
521 theme
->shade_toggled_mask
=
522 RrPixmapMaskCopy(theme
->shade_pressed_mask
);
523 if (!read_mask(&ps
, "shade_toggled_pressed.xbm",
524 &theme
->shade_toggled_pressed_mask
))
525 theme
->shade_toggled_pressed_mask
=
526 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
527 if (!read_mask(&ps
, "shade_toggled_hover.xbm",
528 &theme
->shade_toggled_hover_mask
))
529 theme
->shade_toggled_hover_mask
=
530 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
531 if (!read_mask(&ps
, "shade_disabled.xbm", &theme
->shade_disabled_mask
))
532 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
533 if (!read_mask(&ps
, "shade_hover.xbm", &theme
->shade_hover_mask
))
534 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
537 guchar data
[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00 };
538 theme
->shade_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
541 guchar data
[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x7f };
542 theme
->shade_toggled_mask
= RrPixmapMaskNew(inst
, 7, 7,
545 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
546 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
547 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
548 theme
->shade_toggled_pressed_mask
=
549 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
550 theme
->shade_toggled_hover_mask
=
551 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
554 if (read_mask(&ps
, "close.xbm", &theme
->close_mask
)) {
555 if (!read_mask(&ps
, "close_pressed.xbm", &theme
->close_pressed_mask
))
556 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
557 if (!read_mask(&ps
, "close_disabled.xbm", &theme
->close_disabled_mask
))
558 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
559 if (!read_mask(&ps
, "close_hover.xbm", &theme
->close_hover_mask
))
560 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
563 guchar data
[] = { 0x63, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x63 };
564 theme
->close_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
566 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
567 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
568 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
571 if (!read_mask(&ps
, "bullet.xbm", &theme
->menu_bullet_mask
)) {
572 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
573 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
576 /* read the decoration textures */
577 if (!FIND(appearance
, L("window","active","titlebar"),
578 theme
->a_focused_title
, FALSE
))
579 set_default_appearance(theme
->a_focused_title
);
580 if (!FIND(appearance
, L("window","inactive","titlebar"),
581 theme
->a_unfocused_title
, FALSE
))
582 set_default_appearance(theme
->a_unfocused_title
);
583 if (!FIND(appearance
, L("window","active","label"),
584 theme
->a_focused_label
, TRUE
))
585 set_default_appearance(theme
->a_focused_label
);
586 if (!FIND(appearance
, L("window","inactive","label"),
587 theme
->a_unfocused_label
, TRUE
))
588 set_default_appearance(theme
->a_unfocused_label
);
589 if (!FIND(appearance
, L("window","active","handle"),
590 theme
->a_focused_handle
, FALSE
))
591 set_default_appearance(theme
->a_focused_handle
);
592 if (!FIND(appearance
, L("window","inactive","handle"),
593 theme
->a_unfocused_handle
, FALSE
))
594 set_default_appearance(theme
->a_unfocused_handle
);
595 if (!FIND(appearance
, L("window","active","grip"),
596 theme
->a_focused_grip
, TRUE
))
597 set_default_appearance(theme
->a_focused_grip
);
598 if (!FIND(appearance
, L("window","inactive","grip"),
599 theme
->a_unfocused_grip
, TRUE
))
600 set_default_appearance(theme
->a_unfocused_grip
);
601 if (!FIND(appearance
, L("menu","entries"), theme
->a_menu
, FALSE
))
602 set_default_appearance(theme
->a_menu
);
603 if (!FIND(appearance
, L("menu","title"), theme
->a_menu_title
, TRUE
))
604 set_default_appearance(theme
->a_menu_title
);
605 if (!FIND(appearance
, L("menu", "active"), theme
->a_menu_selected
, TRUE
))
606 set_default_appearance(theme
->a_menu_selected
);
607 if (!FIND(appearance
, L("menu", "activedisabled"),
608 theme
->a_menu_disabled_selected
, TRUE
))
609 theme
->a_menu_disabled_selected
=
610 RrAppearanceCopy(theme
->a_menu_selected
);
612 /* read the appearances for rendering non-decorations */
613 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
614 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
615 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
616 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_label
);
618 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_title
);
619 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
620 theme
->osd_unhilite_fg
= RrAppearanceCopy(theme
->a_unfocused_label
);
622 theme
->osd_unhilite_fg
= RrAppearanceCopy(theme
->a_unfocused_title
);
624 /* read buttons textures */
625 if (!FIND(appearance
, L("window","active","buttons","disabled"),
626 theme
->a_disabled_focused_max
, TRUE
))
627 set_default_appearance(theme
->a_disabled_focused_max
);
628 if (!FIND(appearance
, L("window","inactive","buttons","disabled"),
629 theme
->a_disabled_unfocused_max
, TRUE
))
630 set_default_appearance(theme
->a_disabled_unfocused_max
);
631 if (!FIND(appearance
, L("window","active","buttons","pressed"),
632 theme
->a_focused_pressed_max
, TRUE
))
633 set_default_appearance(theme
->a_focused_pressed_max
);
634 if (!FIND(appearance
, L("window","inactive","buttons","pressed"),
635 theme
->a_unfocused_pressed_max
, TRUE
))
636 set_default_appearance(theme
->a_unfocused_pressed_max
);
637 if (!FIND(appearance
, L("window","active","buttons","unpressed"),
638 theme
->a_focused_unpressed_max
, TRUE
))
639 set_default_appearance(theme
->a_focused_unpressed_max
);
640 if (!FIND(appearance
, L("window","inactive","buttons","unpressed"),
641 theme
->a_unfocused_unpressed_max
, TRUE
))
642 set_default_appearance(theme
->a_unfocused_unpressed_max
);
643 if (!FIND(appearance
, L("window","active","buttons","hover"),
644 theme
->a_hover_focused_max
, TRUE
))
646 RrAppearanceFree(theme
->a_hover_focused_max
);
647 theme
->a_hover_focused_max
=
648 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
650 if (!FIND(appearance
, L("window","inactive","buttons","hover"),
651 theme
->a_hover_unfocused_max
, TRUE
))
653 RrAppearanceFree(theme
->a_hover_unfocused_max
);
654 theme
->a_hover_unfocused_max
=
655 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
657 if (!FIND(appearance
, L("window","active","buttons","toggled-pressed"),
658 theme
->a_toggled_focused_pressed_max
, TRUE
))
660 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
661 theme
->a_toggled_focused_pressed_max
=
662 RrAppearanceCopy(theme
->a_focused_pressed_max
);
664 if (!FIND(appearance
, L("window","inactive","buttons","toggled-pressed"),
665 theme
->a_toggled_unfocused_pressed_max
, TRUE
))
667 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
668 theme
->a_toggled_unfocused_pressed_max
=
669 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
671 if (!FIND(appearance
, L("window","active","buttons","toggled-unpressed"),
672 theme
->a_toggled_focused_unpressed_max
, TRUE
))
674 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
675 theme
->a_toggled_focused_unpressed_max
=
676 RrAppearanceCopy(theme
->a_focused_pressed_max
);
678 if (!FIND(appearance
, L("window","inactive","buttons","toggled-unpressed"),
679 theme
->a_toggled_unfocused_unpressed_max
, TRUE
))
681 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
682 theme
->a_toggled_unfocused_unpressed_max
=
683 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
685 if (!FIND(appearance
, L("window","active","buttons","toggled-hover"),
686 theme
->a_toggled_hover_focused_max
, TRUE
))
688 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
689 theme
->a_toggled_hover_focused_max
=
690 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
692 if (!FIND(appearance
, L("window","inactive","buttons","toggled-hover"),
693 theme
->a_toggled_hover_unfocused_max
, TRUE
))
695 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
696 theme
->a_toggled_hover_unfocused_max
=
697 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
700 theme
->a_disabled_focused_close
=
701 RrAppearanceCopy(theme
->a_disabled_focused_max
);
702 theme
->a_disabled_unfocused_close
=
703 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
704 theme
->a_hover_focused_close
=
705 RrAppearanceCopy(theme
->a_hover_focused_max
);
706 theme
->a_hover_unfocused_close
=
707 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
708 theme
->a_unfocused_unpressed_close
=
709 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
710 theme
->a_unfocused_pressed_close
=
711 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
712 theme
->a_focused_unpressed_close
=
713 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
714 theme
->a_focused_pressed_close
=
715 RrAppearanceCopy(theme
->a_focused_pressed_max
);
716 theme
->a_disabled_focused_desk
=
717 RrAppearanceCopy(theme
->a_disabled_focused_max
);
718 theme
->a_disabled_unfocused_desk
=
719 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
720 theme
->a_hover_focused_desk
=
721 RrAppearanceCopy(theme
->a_hover_focused_max
);
722 theme
->a_hover_unfocused_desk
=
723 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
724 theme
->a_toggled_focused_pressed_desk
=
725 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
726 theme
->a_toggled_unfocused_pressed_desk
=
727 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
728 theme
->a_toggled_focused_unpressed_desk
=
729 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
730 theme
->a_toggled_unfocused_unpressed_desk
=
731 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
732 theme
->a_toggled_hover_focused_desk
=
733 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
734 theme
->a_toggled_hover_unfocused_desk
=
735 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
736 theme
->a_unfocused_unpressed_desk
=
737 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
738 theme
->a_unfocused_pressed_desk
=
739 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
740 theme
->a_focused_unpressed_desk
=
741 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
742 theme
->a_focused_pressed_desk
=
743 RrAppearanceCopy(theme
->a_focused_pressed_max
);
744 theme
->a_disabled_focused_shade
=
745 RrAppearanceCopy(theme
->a_disabled_focused_max
);
746 theme
->a_disabled_unfocused_shade
=
747 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
748 theme
->a_hover_focused_shade
=
749 RrAppearanceCopy(theme
->a_hover_focused_max
);
750 theme
->a_hover_unfocused_shade
=
751 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
752 theme
->a_toggled_focused_pressed_shade
=
753 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
754 theme
->a_toggled_unfocused_pressed_shade
=
755 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
756 theme
->a_toggled_focused_unpressed_shade
=
757 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
758 theme
->a_toggled_unfocused_unpressed_shade
=
759 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
760 theme
->a_toggled_hover_focused_shade
=
761 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
762 theme
->a_toggled_hover_unfocused_shade
=
763 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
764 theme
->a_unfocused_unpressed_shade
=
765 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
766 theme
->a_unfocused_pressed_shade
=
767 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
768 theme
->a_focused_unpressed_shade
=
769 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
770 theme
->a_focused_pressed_shade
=
771 RrAppearanceCopy(theme
->a_focused_pressed_max
);
772 theme
->a_disabled_focused_iconify
=
773 RrAppearanceCopy(theme
->a_disabled_focused_max
);
774 theme
->a_disabled_unfocused_iconify
=
775 RrAppearanceCopy(theme
->a_disabled_focused_max
);
776 theme
->a_hover_focused_iconify
=
777 RrAppearanceCopy(theme
->a_hover_focused_max
);
778 theme
->a_hover_unfocused_iconify
=
779 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
780 theme
->a_unfocused_unpressed_iconify
=
781 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
782 theme
->a_unfocused_pressed_iconify
=
783 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
784 theme
->a_focused_unpressed_iconify
=
785 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
786 theme
->a_focused_pressed_iconify
=
787 RrAppearanceCopy(theme
->a_focused_pressed_max
);
789 theme
->a_icon
->surface
.grad
=
790 theme
->a_clear
->surface
.grad
=
791 theme
->a_clear_tex
->surface
.grad
=
792 theme
->a_menu_text_title
->surface
.grad
=
793 theme
->a_menu_normal
->surface
.grad
=
794 theme
->a_menu_disabled
->surface
.grad
=
795 theme
->a_menu_text_normal
->surface
.grad
=
796 theme
->a_menu_text_selected
->surface
.grad
=
797 theme
->a_menu_text_disabled
->surface
.grad
=
798 theme
->a_menu_text_disabled_selected
->surface
.grad
=
799 theme
->a_menu_bullet_normal
->surface
.grad
=
800 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
802 /* set up the textures */
803 theme
->a_focused_label
->texture
[0].type
=
804 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
805 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
806 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
807 theme
->a_focused_label
->texture
[0].data
.text
.font
=
808 theme
->win_font_focused
;
809 theme
->osd_hilite_label
->texture
[0].data
.text
.font
= theme
->osd_font
;
810 theme
->a_focused_label
->texture
[0].data
.text
.color
=
811 theme
->title_focused_color
;
812 theme
->osd_hilite_label
->texture
[0].data
.text
.color
=
815 if (!FIND(shadow
, L("window","active","label","text","shadow","offset"),
816 theme
->a_focused_label
))
817 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
=
818 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
819 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
820 theme
->title_focused_shadow_color
;
821 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
822 theme
->title_focused_shadow_alpha
;
824 if (!FIND(shadow
, L("osd","text","shadow","offset"),
825 theme
->osd_hilite_label
))
827 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
828 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
829 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
830 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
832 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
833 theme
->osd_shadow_color
;
834 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
835 theme
->osd_shadow_alpha
;
837 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
838 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
839 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
840 theme
->win_font_unfocused
;
841 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
842 theme
->title_unfocused_color
;
844 if (!FIND(shadow
, L("window","inactive","label","text","shadow","offset"),
845 theme
->a_unfocused_label
))
846 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
=
847 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
848 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
849 theme
->title_unfocused_shadow_color
;
850 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
851 theme
->title_unfocused_shadow_alpha
;
853 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
854 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
855 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
856 theme
->menu_title_font
;
857 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
858 theme
->menu_title_color
;
860 if (!FIND(shadow
, L("menu","title","text","shadow","offset"),
861 theme
->a_menu_text_title
))
862 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
=
863 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= 0;
864 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
865 theme
->menu_title_shadow_color
;
866 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
867 theme
->menu_title_shadow_alpha
;
869 theme
->a_menu_text_normal
->texture
[0].type
=
870 theme
->a_menu_text_selected
->texture
[0].type
=
871 theme
->a_menu_text_disabled
->texture
[0].type
=
872 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
874 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
875 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
876 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
877 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
879 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
880 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
881 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
882 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
884 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
885 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
886 theme
->menu_selected_color
;
887 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
888 theme
->menu_disabled_color
;
889 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
890 theme
->menu_disabled_selected_color
;
892 if (!FIND(shadow
, L("menu","inactive","shadow","offset"),
893 theme
->a_menu_text_normal
))
894 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_x
=
895 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
=
897 if (!FIND(shadow
, L("menu","active","text","shadow","offset"),
898 theme
->a_menu_text_selected
))
899 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_x
=
900 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_y
=
902 if (!FIND(shadow
, L("menu","disabled","shadow","offset"),
903 theme
->a_menu_text_disabled
))
904 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_x
=
905 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_y
=
907 if (!FIND(shadow
, L("menu","activedisabled","shadow","offset"),
908 theme
->a_menu_text_disabled_selected
))
909 theme
->a_menu_text_disabled_selected
->
910 texture
[0].data
.text
.shadow_offset_x
= 0;
911 theme
->a_menu_text_disabled_selected
->
912 texture
[0].data
.text
.shadow_offset_y
= 0;
913 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
914 theme
->menu_text_normal_shadow_color
;
915 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
916 theme
->menu_text_normal_shadow_alpha
;
917 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
918 theme
->menu_text_selected_shadow_color
;
919 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
920 theme
->menu_text_selected_shadow_alpha
;
921 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
922 theme
->menu_text_disabled_shadow_color
;
923 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
924 theme
->menu_text_disabled_shadow_alpha
;
925 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
926 theme
->menu_text_disabled_selected_shadow_color
;
927 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
928 theme
->menu_text_disabled_selected_shadow_alpha
;
930 theme
->a_disabled_focused_max
->texture
[0].type
=
931 theme
->a_disabled_unfocused_max
->texture
[0].type
=
932 theme
->a_hover_focused_max
->texture
[0].type
=
933 theme
->a_hover_unfocused_max
->texture
[0].type
=
934 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
935 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
936 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
937 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
938 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
939 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
940 theme
->a_focused_unpressed_max
->texture
[0].type
=
941 theme
->a_focused_pressed_max
->texture
[0].type
=
942 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
943 theme
->a_unfocused_pressed_max
->texture
[0].type
=
944 theme
->a_disabled_focused_close
->texture
[0].type
=
945 theme
->a_disabled_unfocused_close
->texture
[0].type
=
946 theme
->a_hover_focused_close
->texture
[0].type
=
947 theme
->a_hover_unfocused_close
->texture
[0].type
=
948 theme
->a_focused_unpressed_close
->texture
[0].type
=
949 theme
->a_focused_pressed_close
->texture
[0].type
=
950 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
951 theme
->a_unfocused_pressed_close
->texture
[0].type
=
952 theme
->a_disabled_focused_desk
->texture
[0].type
=
953 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
954 theme
->a_hover_focused_desk
->texture
[0].type
=
955 theme
->a_hover_unfocused_desk
->texture
[0].type
=
956 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
957 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
958 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
959 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
960 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
961 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
962 theme
->a_focused_unpressed_desk
->texture
[0].type
=
963 theme
->a_focused_pressed_desk
->texture
[0].type
=
964 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
965 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
966 theme
->a_disabled_focused_shade
->texture
[0].type
=
967 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
968 theme
->a_hover_focused_shade
->texture
[0].type
=
969 theme
->a_hover_unfocused_shade
->texture
[0].type
=
970 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
971 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
972 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
973 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
974 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
975 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
976 theme
->a_focused_unpressed_shade
->texture
[0].type
=
977 theme
->a_focused_pressed_shade
->texture
[0].type
=
978 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
979 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
980 theme
->a_disabled_focused_iconify
->texture
[0].type
=
981 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
982 theme
->a_hover_focused_iconify
->texture
[0].type
=
983 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
984 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
985 theme
->a_focused_pressed_iconify
->texture
[0].type
=
986 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
987 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
988 theme
->a_menu_bullet_normal
->texture
[0].type
=
989 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
991 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
992 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
993 theme
->max_disabled_mask
;
994 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
995 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
996 theme
->max_hover_mask
;
997 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
998 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
999 theme
->max_pressed_mask
;
1000 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1001 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1003 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1004 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1005 theme
->max_toggled_pressed_mask
;
1006 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1007 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1008 theme
->max_toggled_mask
;
1009 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
1010 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1011 theme
->max_toggled_hover_mask
;
1012 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
1013 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
1014 theme
->close_disabled_mask
;
1015 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
1016 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
1017 theme
->close_hover_mask
;
1018 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
1019 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
1020 theme
->close_pressed_mask
;
1021 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
1022 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
1024 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
1025 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
1026 theme
->desk_disabled_mask
;
1027 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1028 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1029 theme
->desk_hover_mask
;
1030 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1031 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1032 theme
->desk_pressed_mask
;
1033 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1034 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1036 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1037 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1038 theme
->desk_toggled_pressed_mask
;
1039 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1040 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1041 theme
->desk_toggled_mask
;
1042 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1043 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1044 theme
->desk_toggled_hover_mask
;
1045 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1046 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1047 theme
->shade_disabled_mask
;
1048 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1049 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1050 theme
->shade_hover_mask
;
1051 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1052 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1053 theme
->shade_pressed_mask
;
1054 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1055 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1057 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1058 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1059 theme
->shade_toggled_pressed_mask
;
1060 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1061 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1062 theme
->shade_toggled_mask
;
1063 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1064 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1065 theme
->shade_toggled_hover_mask
;
1066 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1067 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1068 theme
->iconify_disabled_mask
;
1069 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1070 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1071 theme
->iconify_hover_mask
;
1072 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1073 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1074 theme
->iconify_pressed_mask
;
1075 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1076 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1077 theme
->iconify_mask
;
1078 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1079 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1080 theme
->menu_bullet_mask
;
1081 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1082 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1083 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1084 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1085 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1086 theme
->titlebut_disabled_focused_color
;
1087 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1088 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1089 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1090 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1091 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1092 theme
->titlebut_disabled_unfocused_color
;
1093 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1094 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1095 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1096 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1097 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1098 theme
->titlebut_hover_focused_color
;
1099 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1100 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1101 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1102 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1103 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1104 theme
->titlebut_hover_unfocused_color
;
1105 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1106 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1107 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1108 theme
->titlebut_toggled_hover_focused_color
;
1109 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1110 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1111 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1112 theme
->titlebut_toggled_hover_unfocused_color
;
1113 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1114 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1115 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1116 theme
->titlebut_toggled_focused_pressed_color
;
1117 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1118 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1119 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1120 theme
->titlebut_toggled_unfocused_pressed_color
;
1121 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1122 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1123 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1124 theme
->titlebut_toggled_focused_unpressed_color
;
1125 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1126 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1127 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1128 theme
->titlebut_toggled_unfocused_unpressed_color
;
1129 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1130 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1131 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1132 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1133 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1134 theme
->titlebut_focused_unpressed_color
;
1135 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1136 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1137 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1138 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1139 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1140 theme
->titlebut_focused_pressed_color
;
1141 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1142 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1143 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1144 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1145 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1146 theme
->titlebut_unfocused_unpressed_color
;
1147 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1148 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1149 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1150 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1151 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1152 theme
->titlebut_unfocused_pressed_color
;
1153 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1155 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1156 theme
->menu_selected_color
;
1159 parse_close(ps
.doc
);
1162 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1163 RrAppearance
*a
, *b
, *c
, *d
;
1165 /* caluclate the font heights*/
1166 a
= theme
->a_focused_label
;
1167 theme
->win_font_height
=
1168 RrFontHeight(theme
->win_font_focused
,
1169 a
->texture
[0].data
.text
.shadow_offset_y
);
1170 a
= theme
->a_unfocused_label
;
1171 theme
->win_font_height
=
1172 MAX(theme
->win_font_height
,
1173 RrFontHeight(theme
->win_font_unfocused
,
1174 a
->texture
[0].data
.text
.shadow_offset_y
));
1175 a
= theme
->a_menu_text_title
;
1176 theme
->menu_title_font_height
=
1177 RrFontHeight(theme
->menu_title_font
,
1178 a
->texture
[0].data
.text
.shadow_offset_y
);
1179 a
= theme
->a_menu_text_normal
;
1180 b
= theme
->a_menu_text_selected
;
1181 c
= theme
->a_menu_text_disabled
;
1182 d
= theme
->a_menu_text_disabled_selected
;
1183 theme
->menu_font_height
=
1184 RrFontHeight(theme
->menu_font
,
1185 MAX(a
->texture
[0].data
.text
.shadow_offset_y
,
1186 MAX(b
->texture
[0].data
.text
.shadow_offset_y
,
1187 MAX(c
->texture
[0].data
.text
.shadow_offset_y
,
1188 d
->texture
[0].data
.text
.shadow_offset_y
1191 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1192 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1193 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1194 theme
->label_height
+= theme
->label_height
% 2;
1196 /* this would be nice I think, since padding.width can now be 0,
1197 but it breaks frame.c horribly and I don't feel like fixing that
1198 right now, so if anyone complains, here is how to keep text from
1199 going over the title's bevel/border with a padding.width of 0 and a
1200 bevelless/borderless label
1201 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1202 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1203 theme->title_height = theme->label_height +
1204 MAX(MAX(theme->padding * 2, ft + fb),
1205 MAX(theme->padding * 2, ut + ub));
1207 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1209 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1210 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1211 theme
->menu_title_height
= theme
->menu_title_label_height
+
1212 theme
->paddingy
* 2;
1214 theme
->button_size
= theme
->label_height
- 2;
1215 theme
->grip_width
= 25;
1220 void RrThemeFree(RrTheme
*theme
)
1223 RrColorFree(theme
->menu_b_color
);
1224 RrColorFree(theme
->frame_b_color
);
1225 RrColorFree(theme
->cb_unfocused_color
);
1226 RrColorFree(theme
->cb_focused_color
);
1227 RrColorFree(theme
->title_focused_color
);
1228 RrColorFree(theme
->title_unfocused_color
);
1229 RrColorFree(theme
->titlebut_disabled_focused_color
);
1230 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1231 RrColorFree(theme
->titlebut_hover_focused_color
);
1232 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1233 RrColorFree(theme
->titlebut_focused_pressed_color
);
1234 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1235 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1236 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1237 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1238 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1239 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1240 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1241 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1242 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1243 RrColorFree(theme
->menu_title_color
);
1244 RrColorFree(theme
->menu_color
);
1245 RrColorFree(theme
->menu_selected_color
);
1246 RrColorFree(theme
->menu_disabled_color
);
1247 RrColorFree(theme
->menu_disabled_selected_color
);
1248 RrColorFree(theme
->title_focused_shadow_color
);
1249 RrColorFree(theme
->title_unfocused_shadow_color
);
1250 RrColorFree(theme
->osd_color
);
1251 RrColorFree(theme
->osd_shadow_color
);
1252 RrColorFree(theme
->menu_title_shadow_color
);
1253 RrColorFree(theme
->menu_text_normal_shadow_color
);
1254 RrColorFree(theme
->menu_text_selected_shadow_color
);
1255 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1256 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1258 g_free(theme
->def_win_icon
);
1260 RrPixmapMaskFree(theme
->max_mask
);
1261 RrPixmapMaskFree(theme
->max_toggled_mask
);
1262 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1263 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1264 RrPixmapMaskFree(theme
->max_disabled_mask
);
1265 RrPixmapMaskFree(theme
->max_hover_mask
);
1266 RrPixmapMaskFree(theme
->max_pressed_mask
);
1267 RrPixmapMaskFree(theme
->desk_mask
);
1268 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1269 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1270 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1271 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1272 RrPixmapMaskFree(theme
->desk_hover_mask
);
1273 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1274 RrPixmapMaskFree(theme
->shade_mask
);
1275 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1276 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1277 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1278 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1279 RrPixmapMaskFree(theme
->shade_hover_mask
);
1280 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1281 RrPixmapMaskFree(theme
->iconify_mask
);
1282 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1283 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1284 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1285 RrPixmapMaskFree(theme
->close_mask
);
1286 RrPixmapMaskFree(theme
->close_disabled_mask
);
1287 RrPixmapMaskFree(theme
->close_hover_mask
);
1288 RrPixmapMaskFree(theme
->close_pressed_mask
);
1289 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1291 RrFontClose(theme
->win_font_focused
);
1292 RrFontClose(theme
->win_font_unfocused
);
1293 RrFontClose(theme
->menu_title_font
);
1294 RrFontClose(theme
->menu_font
);
1296 RrAppearanceFree(theme
->a_disabled_focused_max
);
1297 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1298 RrAppearanceFree(theme
->a_hover_focused_max
);
1299 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1300 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1301 RrAppearanceFree(theme
->a_focused_pressed_max
);
1302 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1303 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1304 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1305 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1306 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1307 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1308 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1309 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1310 RrAppearanceFree(theme
->a_disabled_focused_close
);
1311 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1312 RrAppearanceFree(theme
->a_hover_focused_close
);
1313 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1314 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1315 RrAppearanceFree(theme
->a_focused_pressed_close
);
1316 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1317 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1318 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1319 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1320 RrAppearanceFree(theme
->a_hover_focused_desk
);
1321 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1322 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1323 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1324 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1325 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1326 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1327 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1328 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1329 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1330 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1331 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1332 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1333 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1334 RrAppearanceFree(theme
->a_hover_focused_shade
);
1335 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1336 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1337 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1338 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1339 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1340 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1341 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1342 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1343 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1344 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1345 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1346 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1347 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1348 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1349 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1350 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1351 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1352 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1353 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1354 RrAppearanceFree(theme
->a_focused_grip
);
1355 RrAppearanceFree(theme
->a_unfocused_grip
);
1356 RrAppearanceFree(theme
->a_focused_title
);
1357 RrAppearanceFree(theme
->a_unfocused_title
);
1358 RrAppearanceFree(theme
->a_focused_label
);
1359 RrAppearanceFree(theme
->a_unfocused_label
);
1360 RrAppearanceFree(theme
->a_icon
);
1361 RrAppearanceFree(theme
->a_focused_handle
);
1362 RrAppearanceFree(theme
->a_unfocused_handle
);
1363 RrAppearanceFree(theme
->a_menu
);
1364 RrAppearanceFree(theme
->a_menu_title
);
1365 RrAppearanceFree(theme
->a_menu_text_title
);
1366 RrAppearanceFree(theme
->a_menu_normal
);
1367 RrAppearanceFree(theme
->a_menu_selected
);
1368 RrAppearanceFree(theme
->a_menu_disabled
);
1369 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1370 RrAppearanceFree(theme
->a_menu_text_normal
);
1371 RrAppearanceFree(theme
->a_menu_text_selected
);
1372 RrAppearanceFree(theme
->a_menu_text_disabled
);
1373 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1374 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1375 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1376 RrAppearanceFree(theme
->a_clear
);
1377 RrAppearanceFree(theme
->a_clear_tex
);
1378 RrAppearanceFree(theme
->osd_hilite_bg
);
1379 RrAppearanceFree(theme
->osd_hilite_fg
);
1380 RrAppearanceFree(theme
->osd_hilite_label
);
1381 RrAppearanceFree(theme
->osd_unhilite_fg
);
1387 static gboolean
read_mask(ParseState
*ps
, const gchar
*maskname
,
1388 RrPixmapMask
**value
)
1390 gboolean ret
= FALSE
;
1392 gint hx
, hy
; /* ignored */
1396 s
= g_build_filename(ps
->path
, maskname
, NULL
);
1397 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1399 *value
= RrPixmapMaskNew(ps
->inst
, w
, h
, (gchar
*)b
);
1407 static void set_default_appearance(RrAppearance
*a
)
1409 a
->surface
.grad
= RR_SURFACE_SOLID
;
1410 a
->surface
.relief
= RR_RELIEF_FLAT
;
1411 a
->surface
.bevel
= RR_BEVEL_1
;
1412 a
->surface
.interlaced
= FALSE
;
1413 a
->surface
.border
= FALSE
;
1414 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1415 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1418 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1419 an RrTextureRGBA. */
1420 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1425 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1427 for (i
= 0; i
< width
* height
; ++i
) {
1428 guchar a
= ((*p
>> 24) & 0xff);
1429 guchar b
= ((*p
>> 16) & 0xff);
1430 guchar g
= ((*p
>> 8) & 0xff);
1431 guchar r
= ((*p
>> 0) & 0xff);
1433 *p
= ((r
<< RrDefaultRedOffset
) +
1434 (g
<< RrDefaultGreenOffset
) +
1435 (b
<< RrDefaultBlueOffset
) +
1436 (a
<< RrDefaultAlphaOffset
));
1443 static void parse_style(gchar
*tex
, RrSurfaceColorType
*grad
,
1444 RrReliefType
*relief
, RrBevelType
*bevel
,
1445 gboolean
*interlaced
, gboolean
*border
,
1446 gboolean allow_trans
)
1450 /* convert to all lowercase */
1451 for (t
= tex
; *t
!= '\0'; ++t
)
1452 *t
= g_ascii_tolower(*t
);
1454 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1455 *grad
= RR_SURFACE_PARENTREL
;
1457 if (strstr(tex
, "gradient") != NULL
) {
1458 if (strstr(tex
, "crossdiagonal") != NULL
)
1459 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1460 else if (strstr(tex
, "pyramid") != NULL
)
1461 *grad
= RR_SURFACE_PYRAMID
;
1462 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1463 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1464 else if (strstr(tex
, "horizontal") != NULL
)
1465 *grad
= RR_SURFACE_HORIZONTAL
;
1466 else if (strstr(tex
, "splitvertical") != NULL
)
1467 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1468 else if (strstr(tex
, "vertical") != NULL
)
1469 *grad
= RR_SURFACE_VERTICAL
;
1471 *grad
= RR_SURFACE_DIAGONAL
;
1473 *grad
= RR_SURFACE_SOLID
;
1476 if (strstr(tex
, "sunken") != NULL
)
1477 *relief
= RR_RELIEF_SUNKEN
;
1478 else if (strstr(tex
, "flat") != NULL
)
1479 *relief
= RR_RELIEF_FLAT
;
1481 *relief
= RR_RELIEF_RAISED
;
1484 if (*relief
== RR_RELIEF_FLAT
) {
1485 if (strstr(tex
, "border") != NULL
)
1488 if (strstr(tex
, "bevel2") != NULL
)
1489 *bevel
= RR_BEVEL_2
;
1491 *bevel
= RR_BEVEL_1
;
1494 if (strstr(tex
, "interlaced") != NULL
)
1497 *interlaced
= FALSE
;
1501 static xmlNodePtr
find_node(xmlNodePtr n
, const gchar
*names
[])
1505 for (i
= 0; names
[i
] && n
; ++i
)
1506 n
= parse_find_node(names
[i
], n
->children
);
1510 static gboolean
find_int(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1511 gint
*integer
, gint lower
, gint upper
)
1515 if ((n
= find_node(n
, names
))) {
1516 i
= parse_int(ps
->doc
, n
);
1517 if (i
>= lower
&& i
<= upper
) {
1525 static gboolean
find_string(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1528 if ((n
= find_node(n
, names
))) {
1529 *string
= parse_string(ps
->doc
, n
);
1535 static gboolean
find_color(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1536 RrColor
**color
, gchar
*alpha
)
1538 if ((n
= find_node(n
, names
))) {
1540 if (parse_attr_int("r", n
, &r
) &&
1541 parse_attr_int("g", n
, &g
) &&
1542 parse_attr_int("b", n
, &b
) &&
1543 parse_attr_int("a", n
, &a
) &&
1544 r
>= 0 && g
>= 0 && b
>= 0 && a
>= 0 &&
1545 r
< 256 && g
< 256 && b
< 256 && a
< 256)
1547 *color
= RrColorNew(ps
->inst
, r
, g
, b
);
1548 if (alpha
) *alpha
= a
;
1555 static gboolean
find_point(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1557 gint lowx
, gint upx
, gint lowy
, gint upy
)
1559 if ((n
= find_node(n
, names
))) {
1561 if (parse_attr_int("x", n
, &a
) &&
1562 parse_attr_int("y", n
, &b
) &&
1563 a
>= lowx
&& a
<= upx
&& b
>= lowy
&& b
<= upy
)
1572 static gboolean
find_shadow(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1575 return find_point(ps
, n
, names
,
1576 &a
->texture
[0].data
.text
.shadow_offset_x
,
1577 &a
->texture
[0].data
.text
.shadow_offset_y
,
1581 static gboolean
find_appearance(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1582 RrAppearance
*a
, gboolean allow_trans
)
1586 if (!(n
= find_node(n
, names
)))
1589 if ((n2
= find_node(n
, L("style")))) {
1590 gchar
*s
= parse_string(ps
->doc
, n2
);
1591 parse_style(s
, &a
->surface
.grad
, &a
->surface
.relief
,
1592 &a
->surface
.bevel
, &a
->surface
.interlaced
,
1593 &a
->surface
.border
, allow_trans
);
1598 if (!find_color(ps
, n
, L("primary"), &a
->surface
.primary
, NULL
))
1599 a
->surface
.primary
= RrColorNew(ps
->inst
, 0, 0, 0);
1600 if (!find_color(ps
, n
, L("secondary"), &a
->surface
.secondary
, NULL
))
1601 a
->surface
.secondary
= RrColorNew(ps
->inst
, 0, 0, 0);
1602 if (a
->surface
.border
)
1603 if (!find_color(ps
, n
, L("border"),
1604 &a
->surface
.border_color
, NULL
))
1605 a
->surface
.border_color
= RrColorNew(ps
->inst
, 0, 0, 0);
1606 if (a
->surface
.interlaced
)
1607 if (!find_color(ps
, n
, L("interlace"),
1608 &a
->surface
.interlace_color
, NULL
))
1609 a
->surface
.interlace_color
= RrColorNew(ps
->inst
, 0, 0, 0);