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 */
428 if (read_mask(&ps
, "max.xbm", &theme
->max_mask
)) {
429 if (!read_mask(&ps
, "max_pressed.xbm", &theme
->max_pressed_mask
))
430 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
431 if (!read_mask(&ps
, "max_toggled.xbm", &theme
->max_toggled_mask
))
432 theme
->max_toggled_mask
=
433 RrPixmapMaskCopy(theme
->max_pressed_mask
);
434 if (!read_mask(&ps
, "max_toggled_pressed.xbm",
435 &theme
->max_toggled_pressed_mask
))
436 theme
->max_toggled_pressed_mask
=
437 RrPixmapMaskCopy(theme
->max_toggled_mask
);
438 if (!read_mask(&ps
, "max_toggled_hover.xbm",
439 &theme
->max_toggled_hover_mask
))
440 theme
->max_toggled_hover_mask
=
441 RrPixmapMaskCopy(theme
->max_toggled_mask
);
442 if (!read_mask(&ps
, "max_disabled.xbm", &theme
->max_disabled_mask
))
443 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
444 if (!read_mask(&ps
, "max_hover.xbm", &theme
->max_hover_mask
))
445 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
448 guchar data
[] = { 0x7f, 0x7f, 0x7f, 0x41, 0x41, 0x41, 0x7f };
449 theme
->max_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
452 guchar data
[] = { 0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f };
453 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
455 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
456 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
457 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
458 theme
->max_toggled_pressed_mask
=
459 RrPixmapMaskCopy(theme
->max_toggled_mask
);
460 theme
->max_toggled_hover_mask
=
461 RrPixmapMaskCopy(theme
->max_toggled_mask
);
464 if (read_mask(&ps
, "iconify.xbm", &theme
->iconify_mask
)) {
465 if (!read_mask(&ps
, "iconify_pressed.xbm",
466 &theme
->iconify_pressed_mask
))
467 theme
->iconify_pressed_mask
=
468 RrPixmapMaskCopy(theme
->iconify_mask
);
469 if (!read_mask(&ps
, "iconify_disabled.xbm",
470 &theme
->iconify_disabled_mask
))
471 theme
->iconify_disabled_mask
=
472 RrPixmapMaskCopy(theme
->iconify_mask
);
473 if (!read_mask(&ps
, "iconify_hover.xbm", &theme
->iconify_hover_mask
))
474 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
477 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f };
478 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
480 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
481 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
482 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
485 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
486 OB_DEFAULT_ICON_HEIGHT
,
487 OB_DEFAULT_ICON_pixel_data
);
489 if (read_mask(&ps
, "desk.xbm", &theme
->desk_mask
)) {
490 if (!read_mask(&ps
, "desk_pressed.xbm", &theme
->desk_pressed_mask
))
491 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
492 if (!read_mask(&ps
, "desk_toggled.xbm", &theme
->desk_toggled_mask
))
493 theme
->desk_toggled_mask
=
494 RrPixmapMaskCopy(theme
->desk_pressed_mask
);
495 if (!read_mask(&ps
, "desk_toggled_pressed.xbm",
496 &theme
->desk_toggled_pressed_mask
))
497 theme
->desk_toggled_pressed_mask
=
498 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
499 if (!read_mask(&ps
, "desk_toggled_hover.xbm",
500 &theme
->desk_toggled_hover_mask
))
501 theme
->desk_toggled_hover_mask
=
502 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
503 if (!read_mask(&ps
, "desk_disabled.xbm", &theme
->desk_disabled_mask
))
504 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
505 if (!read_mask(&ps
, "desk_hover.xbm", &theme
->desk_hover_mask
))
506 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
509 guchar data
[] = { 0x63, 0x63, 0x00, 0x00, 0x00, 0x63, 0x63 };
510 theme
->desk_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
513 guchar data
[] = { 0x00, 0x36, 0x36, 0x08, 0x36, 0x36, 0x00 };
514 theme
->desk_toggled_mask
= RrPixmapMaskNew(inst
, 7, 7,
517 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
518 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
519 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
520 theme
->desk_toggled_pressed_mask
=
521 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
522 theme
->desk_toggled_hover_mask
=
523 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
526 if (read_mask(&ps
, "shade.xbm", &theme
->shade_mask
)) {
527 if (!read_mask(&ps
, "shade_pressed.xbm", &theme
->shade_pressed_mask
))
528 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
529 if (!read_mask(&ps
, "shade_toggled.xbm", &theme
->shade_toggled_mask
))
530 theme
->shade_toggled_mask
=
531 RrPixmapMaskCopy(theme
->shade_pressed_mask
);
532 if (!read_mask(&ps
, "shade_toggled_pressed.xbm",
533 &theme
->shade_toggled_pressed_mask
))
534 theme
->shade_toggled_pressed_mask
=
535 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
536 if (!read_mask(&ps
, "shade_toggled_hover.xbm",
537 &theme
->shade_toggled_hover_mask
))
538 theme
->shade_toggled_hover_mask
=
539 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
540 if (!read_mask(&ps
, "shade_disabled.xbm", &theme
->shade_disabled_mask
))
541 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
542 if (!read_mask(&ps
, "shade_hover.xbm", &theme
->shade_hover_mask
))
543 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
546 guchar data
[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00 };
547 theme
->shade_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
550 guchar data
[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x7f };
551 theme
->shade_toggled_mask
= RrPixmapMaskNew(inst
, 7, 7,
554 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
555 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
556 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
557 theme
->shade_toggled_pressed_mask
=
558 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
559 theme
->shade_toggled_hover_mask
=
560 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
563 if (read_mask(&ps
, "close.xbm", &theme
->close_mask
)) {
564 if (!read_mask(&ps
, "close_pressed.xbm", &theme
->close_pressed_mask
))
565 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
566 if (!read_mask(&ps
, "close_disabled.xbm", &theme
->close_disabled_mask
))
567 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
568 if (!read_mask(&ps
, "close_hover.xbm", &theme
->close_hover_mask
))
569 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
572 guchar data
[] = { 0x63, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x63 };
573 theme
->close_mask
= RrPixmapMaskNew(inst
, 7, 7, (gchar
*)data
);
575 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
576 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
577 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
580 if (!read_mask(&ps
, "bullet.xbm", &theme
->menu_bullet_mask
)) {
581 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
582 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
585 /* read the decoration textures */
586 if (!FIND(appearance
, L("window","active","titlebar"),
587 theme
->a_focused_title
, FALSE
))
588 set_default_appearance(theme
->a_focused_title
);
589 if (!FIND(appearance
, L("window","inactive","titlebar"),
590 theme
->a_unfocused_title
, FALSE
))
591 set_default_appearance(theme
->a_unfocused_title
);
592 if (!FIND(appearance
, L("window","active","label"),
593 theme
->a_focused_label
, TRUE
))
594 set_default_appearance(theme
->a_focused_label
);
595 if (!FIND(appearance
, L("window","inactive","label"),
596 theme
->a_unfocused_label
, TRUE
))
597 set_default_appearance(theme
->a_unfocused_label
);
598 if (!FIND(appearance
, L("window","active","handle"),
599 theme
->a_focused_handle
, FALSE
))
600 set_default_appearance(theme
->a_focused_handle
);
601 if (!FIND(appearance
, L("window","inactive","handle"),
602 theme
->a_unfocused_handle
, FALSE
))
603 set_default_appearance(theme
->a_unfocused_handle
);
604 if (!FIND(appearance
, L("window","active","grip"),
605 theme
->a_focused_grip
, TRUE
))
606 set_default_appearance(theme
->a_focused_grip
);
607 if (!FIND(appearance
, L("window","inactive","grip"),
608 theme
->a_unfocused_grip
, TRUE
))
609 set_default_appearance(theme
->a_unfocused_grip
);
610 if (!FIND(appearance
, L("menu","entries"), theme
->a_menu
, FALSE
))
611 set_default_appearance(theme
->a_menu
);
612 if (!FIND(appearance
, L("menu","title"), theme
->a_menu_title
, TRUE
))
613 set_default_appearance(theme
->a_menu_title
);
614 if (!FIND(appearance
, L("menu", "active"), theme
->a_menu_selected
, TRUE
))
615 set_default_appearance(theme
->a_menu_selected
);
616 if (!FIND(appearance
, L("menu", "activedisabled"),
617 theme
->a_menu_disabled_selected
, TRUE
))
618 theme
->a_menu_disabled_selected
=
619 RrAppearanceCopy(theme
->a_menu_selected
);
621 /* read the appearances for rendering non-decorations */
622 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
623 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
624 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
625 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_label
);
627 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_title
);
628 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
629 theme
->osd_unhilite_fg
= RrAppearanceCopy(theme
->a_unfocused_label
);
631 theme
->osd_unhilite_fg
= RrAppearanceCopy(theme
->a_unfocused_title
);
633 /* read buttons textures */
634 if (!FIND(appearance
, L("window","active","buttons","disabled"),
635 theme
->a_disabled_focused_max
, TRUE
))
636 set_default_appearance(theme
->a_disabled_focused_max
);
637 if (!FIND(appearance
, L("window","inactive","buttons","disabled"),
638 theme
->a_disabled_unfocused_max
, TRUE
))
639 set_default_appearance(theme
->a_disabled_unfocused_max
);
640 if (!FIND(appearance
, L("window","active","buttons","pressed"),
641 theme
->a_focused_pressed_max
, TRUE
))
642 set_default_appearance(theme
->a_focused_pressed_max
);
643 if (!FIND(appearance
, L("window","inactive","buttons","pressed"),
644 theme
->a_unfocused_pressed_max
, TRUE
))
645 set_default_appearance(theme
->a_unfocused_pressed_max
);
646 if (!FIND(appearance
, L("window","active","buttons","unpressed"),
647 theme
->a_focused_unpressed_max
, TRUE
))
648 set_default_appearance(theme
->a_focused_unpressed_max
);
649 if (!FIND(appearance
, L("window","inactive","buttons","unpressed"),
650 theme
->a_unfocused_unpressed_max
, TRUE
))
651 set_default_appearance(theme
->a_unfocused_unpressed_max
);
652 if (!FIND(appearance
, L("window","active","buttons","hover"),
653 theme
->a_hover_focused_max
, TRUE
))
655 RrAppearanceFree(theme
->a_hover_focused_max
);
656 theme
->a_hover_focused_max
=
657 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
659 if (!FIND(appearance
, L("window","inactive","buttons","hover"),
660 theme
->a_hover_unfocused_max
, TRUE
))
662 RrAppearanceFree(theme
->a_hover_unfocused_max
);
663 theme
->a_hover_unfocused_max
=
664 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
666 if (!FIND(appearance
, L("window","active","buttons","toggled-pressed"),
667 theme
->a_toggled_focused_pressed_max
, TRUE
))
669 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
670 theme
->a_toggled_focused_pressed_max
=
671 RrAppearanceCopy(theme
->a_focused_pressed_max
);
673 if (!FIND(appearance
, L("window","inactive","buttons","toggled-pressed"),
674 theme
->a_toggled_unfocused_pressed_max
, TRUE
))
676 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
677 theme
->a_toggled_unfocused_pressed_max
=
678 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
680 if (!FIND(appearance
, L("window","active","buttons","toggled-unpressed"),
681 theme
->a_toggled_focused_unpressed_max
, TRUE
))
683 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
684 theme
->a_toggled_focused_unpressed_max
=
685 RrAppearanceCopy(theme
->a_focused_pressed_max
);
687 if (!FIND(appearance
, L("window","inactive","buttons","toggled-unpressed"),
688 theme
->a_toggled_unfocused_unpressed_max
, TRUE
))
690 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
691 theme
->a_toggled_unfocused_unpressed_max
=
692 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
694 if (!FIND(appearance
, L("window","active","buttons","toggled-hover"),
695 theme
->a_toggled_hover_focused_max
, TRUE
))
697 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
698 theme
->a_toggled_hover_focused_max
=
699 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
701 if (!FIND(appearance
, L("window","inactive","buttons","toggled-hover"),
702 theme
->a_toggled_hover_unfocused_max
, TRUE
))
704 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
705 theme
->a_toggled_hover_unfocused_max
=
706 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
709 theme
->a_disabled_focused_close
=
710 RrAppearanceCopy(theme
->a_disabled_focused_max
);
711 theme
->a_disabled_unfocused_close
=
712 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
713 theme
->a_hover_focused_close
=
714 RrAppearanceCopy(theme
->a_hover_focused_max
);
715 theme
->a_hover_unfocused_close
=
716 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
717 theme
->a_unfocused_unpressed_close
=
718 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
719 theme
->a_unfocused_pressed_close
=
720 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
721 theme
->a_focused_unpressed_close
=
722 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
723 theme
->a_focused_pressed_close
=
724 RrAppearanceCopy(theme
->a_focused_pressed_max
);
725 theme
->a_disabled_focused_desk
=
726 RrAppearanceCopy(theme
->a_disabled_focused_max
);
727 theme
->a_disabled_unfocused_desk
=
728 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
729 theme
->a_hover_focused_desk
=
730 RrAppearanceCopy(theme
->a_hover_focused_max
);
731 theme
->a_hover_unfocused_desk
=
732 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
733 theme
->a_toggled_focused_pressed_desk
=
734 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
735 theme
->a_toggled_unfocused_pressed_desk
=
736 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
737 theme
->a_toggled_focused_unpressed_desk
=
738 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
739 theme
->a_toggled_unfocused_unpressed_desk
=
740 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
741 theme
->a_toggled_hover_focused_desk
=
742 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
743 theme
->a_toggled_hover_unfocused_desk
=
744 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
745 theme
->a_unfocused_unpressed_desk
=
746 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
747 theme
->a_unfocused_pressed_desk
=
748 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
749 theme
->a_focused_unpressed_desk
=
750 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
751 theme
->a_focused_pressed_desk
=
752 RrAppearanceCopy(theme
->a_focused_pressed_max
);
753 theme
->a_disabled_focused_shade
=
754 RrAppearanceCopy(theme
->a_disabled_focused_max
);
755 theme
->a_disabled_unfocused_shade
=
756 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
757 theme
->a_hover_focused_shade
=
758 RrAppearanceCopy(theme
->a_hover_focused_max
);
759 theme
->a_hover_unfocused_shade
=
760 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
761 theme
->a_toggled_focused_pressed_shade
=
762 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
763 theme
->a_toggled_unfocused_pressed_shade
=
764 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
765 theme
->a_toggled_focused_unpressed_shade
=
766 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
767 theme
->a_toggled_unfocused_unpressed_shade
=
768 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
769 theme
->a_toggled_hover_focused_shade
=
770 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
771 theme
->a_toggled_hover_unfocused_shade
=
772 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
773 theme
->a_unfocused_unpressed_shade
=
774 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
775 theme
->a_unfocused_pressed_shade
=
776 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
777 theme
->a_focused_unpressed_shade
=
778 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
779 theme
->a_focused_pressed_shade
=
780 RrAppearanceCopy(theme
->a_focused_pressed_max
);
781 theme
->a_disabled_focused_iconify
=
782 RrAppearanceCopy(theme
->a_disabled_focused_max
);
783 theme
->a_disabled_unfocused_iconify
=
784 RrAppearanceCopy(theme
->a_disabled_focused_max
);
785 theme
->a_hover_focused_iconify
=
786 RrAppearanceCopy(theme
->a_hover_focused_max
);
787 theme
->a_hover_unfocused_iconify
=
788 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
789 theme
->a_unfocused_unpressed_iconify
=
790 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
791 theme
->a_unfocused_pressed_iconify
=
792 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
793 theme
->a_focused_unpressed_iconify
=
794 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
795 theme
->a_focused_pressed_iconify
=
796 RrAppearanceCopy(theme
->a_focused_pressed_max
);
798 theme
->a_icon
->surface
.grad
=
799 theme
->a_clear
->surface
.grad
=
800 theme
->a_clear_tex
->surface
.grad
=
801 theme
->a_menu_text_title
->surface
.grad
=
802 theme
->a_menu_normal
->surface
.grad
=
803 theme
->a_menu_disabled
->surface
.grad
=
804 theme
->a_menu_text_normal
->surface
.grad
=
805 theme
->a_menu_text_selected
->surface
.grad
=
806 theme
->a_menu_text_disabled
->surface
.grad
=
807 theme
->a_menu_text_disabled_selected
->surface
.grad
=
808 theme
->a_menu_bullet_normal
->surface
.grad
=
809 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
811 /* set up the textures */
812 theme
->a_focused_label
->texture
[0].type
=
813 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
814 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
815 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
816 theme
->a_focused_label
->texture
[0].data
.text
.font
=
817 theme
->win_font_focused
;
818 theme
->osd_hilite_label
->texture
[0].data
.text
.font
= theme
->osd_font
;
819 theme
->a_focused_label
->texture
[0].data
.text
.color
=
820 theme
->title_focused_color
;
821 theme
->osd_hilite_label
->texture
[0].data
.text
.color
=
824 if (!FIND(shadow
, L("window","active","label","text","shadow","offset"),
825 theme
->a_focused_label
))
826 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
=
827 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
828 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
829 theme
->title_focused_shadow_color
;
830 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
831 theme
->title_focused_shadow_alpha
;
833 if (!FIND(shadow
, L("osd","text","shadow","offset"),
834 theme
->osd_hilite_label
))
836 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
837 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
838 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
839 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
841 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
842 theme
->osd_shadow_color
;
843 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
844 theme
->osd_shadow_alpha
;
846 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
847 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
848 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
849 theme
->win_font_unfocused
;
850 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
851 theme
->title_unfocused_color
;
853 if (!FIND(shadow
, L("window","inactive","label","text","shadow","offset"),
854 theme
->a_unfocused_label
))
855 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
=
856 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= 0;
857 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
858 theme
->title_unfocused_shadow_color
;
859 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
860 theme
->title_unfocused_shadow_alpha
;
862 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
863 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
864 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
865 theme
->menu_title_font
;
866 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
867 theme
->menu_title_color
;
869 if (!FIND(shadow
, L("menu","title","text","shadow","offset"),
870 theme
->a_menu_text_title
))
871 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
=
872 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= 0;
873 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
874 theme
->menu_title_shadow_color
;
875 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
876 theme
->menu_title_shadow_alpha
;
878 theme
->a_menu_text_normal
->texture
[0].type
=
879 theme
->a_menu_text_selected
->texture
[0].type
=
880 theme
->a_menu_text_disabled
->texture
[0].type
=
881 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
883 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
884 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
885 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
886 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
888 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
889 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
890 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
891 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
893 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
894 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
895 theme
->menu_selected_color
;
896 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
897 theme
->menu_disabled_color
;
898 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
899 theme
->menu_disabled_selected_color
;
901 if (!FIND(shadow
, L("menu","inactive","shadow","offset"),
902 theme
->a_menu_text_normal
))
903 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_x
=
904 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
=
906 if (!FIND(shadow
, L("menu","active","text","shadow","offset"),
907 theme
->a_menu_text_selected
))
908 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_x
=
909 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_offset_y
=
911 if (!FIND(shadow
, L("menu","disabled","shadow","offset"),
912 theme
->a_menu_text_disabled
))
913 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_x
=
914 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_offset_y
=
916 if (!FIND(shadow
, L("menu","activedisabled","shadow","offset"),
917 theme
->a_menu_text_disabled_selected
))
918 theme
->a_menu_text_disabled_selected
->
919 texture
[0].data
.text
.shadow_offset_x
= 0;
920 theme
->a_menu_text_disabled_selected
->
921 texture
[0].data
.text
.shadow_offset_y
= 0;
922 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
923 theme
->menu_text_normal_shadow_color
;
924 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
925 theme
->menu_text_normal_shadow_alpha
;
926 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
927 theme
->menu_text_selected_shadow_color
;
928 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
929 theme
->menu_text_selected_shadow_alpha
;
930 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
931 theme
->menu_text_disabled_shadow_color
;
932 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
933 theme
->menu_text_disabled_shadow_alpha
;
934 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
935 theme
->menu_text_disabled_selected_shadow_color
;
936 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
937 theme
->menu_text_disabled_selected_shadow_alpha
;
939 theme
->a_disabled_focused_max
->texture
[0].type
=
940 theme
->a_disabled_unfocused_max
->texture
[0].type
=
941 theme
->a_hover_focused_max
->texture
[0].type
=
942 theme
->a_hover_unfocused_max
->texture
[0].type
=
943 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
944 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
945 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
946 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
947 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
948 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
949 theme
->a_focused_unpressed_max
->texture
[0].type
=
950 theme
->a_focused_pressed_max
->texture
[0].type
=
951 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
952 theme
->a_unfocused_pressed_max
->texture
[0].type
=
953 theme
->a_disabled_focused_close
->texture
[0].type
=
954 theme
->a_disabled_unfocused_close
->texture
[0].type
=
955 theme
->a_hover_focused_close
->texture
[0].type
=
956 theme
->a_hover_unfocused_close
->texture
[0].type
=
957 theme
->a_focused_unpressed_close
->texture
[0].type
=
958 theme
->a_focused_pressed_close
->texture
[0].type
=
959 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
960 theme
->a_unfocused_pressed_close
->texture
[0].type
=
961 theme
->a_disabled_focused_desk
->texture
[0].type
=
962 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
963 theme
->a_hover_focused_desk
->texture
[0].type
=
964 theme
->a_hover_unfocused_desk
->texture
[0].type
=
965 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
966 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
967 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
968 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
969 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
970 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
971 theme
->a_focused_unpressed_desk
->texture
[0].type
=
972 theme
->a_focused_pressed_desk
->texture
[0].type
=
973 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
974 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
975 theme
->a_disabled_focused_shade
->texture
[0].type
=
976 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
977 theme
->a_hover_focused_shade
->texture
[0].type
=
978 theme
->a_hover_unfocused_shade
->texture
[0].type
=
979 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
980 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
981 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
982 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
983 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
984 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
985 theme
->a_focused_unpressed_shade
->texture
[0].type
=
986 theme
->a_focused_pressed_shade
->texture
[0].type
=
987 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
988 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
989 theme
->a_disabled_focused_iconify
->texture
[0].type
=
990 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
991 theme
->a_hover_focused_iconify
->texture
[0].type
=
992 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
993 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
994 theme
->a_focused_pressed_iconify
->texture
[0].type
=
995 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
996 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
997 theme
->a_menu_bullet_normal
->texture
[0].type
=
998 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
1000 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
1001 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
1002 theme
->max_disabled_mask
;
1003 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
1004 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1005 theme
->max_hover_mask
;
1006 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1007 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1008 theme
->max_pressed_mask
;
1009 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1010 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1012 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1013 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1014 theme
->max_toggled_pressed_mask
;
1015 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1016 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1017 theme
->max_toggled_mask
;
1018 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
1019 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1020 theme
->max_toggled_hover_mask
;
1021 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
1022 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
1023 theme
->close_disabled_mask
;
1024 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
1025 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
1026 theme
->close_hover_mask
;
1027 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
1028 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
1029 theme
->close_pressed_mask
;
1030 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
1031 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
1033 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
1034 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
1035 theme
->desk_disabled_mask
;
1036 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1037 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1038 theme
->desk_hover_mask
;
1039 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1040 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1041 theme
->desk_pressed_mask
;
1042 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1043 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1045 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1046 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1047 theme
->desk_toggled_pressed_mask
;
1048 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1049 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1050 theme
->desk_toggled_mask
;
1051 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1052 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1053 theme
->desk_toggled_hover_mask
;
1054 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1055 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1056 theme
->shade_disabled_mask
;
1057 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1058 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1059 theme
->shade_hover_mask
;
1060 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1061 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1062 theme
->shade_pressed_mask
;
1063 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1064 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1066 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1067 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1068 theme
->shade_toggled_pressed_mask
;
1069 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1070 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1071 theme
->shade_toggled_mask
;
1072 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1073 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1074 theme
->shade_toggled_hover_mask
;
1075 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1076 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1077 theme
->iconify_disabled_mask
;
1078 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1079 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1080 theme
->iconify_hover_mask
;
1081 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1082 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1083 theme
->iconify_pressed_mask
;
1084 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1085 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1086 theme
->iconify_mask
;
1087 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1088 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1089 theme
->menu_bullet_mask
;
1090 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1091 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1092 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1093 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1094 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1095 theme
->titlebut_disabled_focused_color
;
1096 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1097 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1098 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1099 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1100 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1101 theme
->titlebut_disabled_unfocused_color
;
1102 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1103 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1104 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1105 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1106 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1107 theme
->titlebut_hover_focused_color
;
1108 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1109 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1110 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1111 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1112 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1113 theme
->titlebut_hover_unfocused_color
;
1114 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1115 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1116 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1117 theme
->titlebut_toggled_hover_focused_color
;
1118 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1119 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1120 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1121 theme
->titlebut_toggled_hover_unfocused_color
;
1122 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1123 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1124 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1125 theme
->titlebut_toggled_focused_pressed_color
;
1126 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1127 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1128 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1129 theme
->titlebut_toggled_unfocused_pressed_color
;
1130 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1131 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1132 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1133 theme
->titlebut_toggled_focused_unpressed_color
;
1134 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1135 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1136 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1137 theme
->titlebut_toggled_unfocused_unpressed_color
;
1138 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1139 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1140 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1141 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1142 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1143 theme
->titlebut_focused_unpressed_color
;
1144 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1145 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1146 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1147 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1148 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1149 theme
->titlebut_focused_pressed_color
;
1150 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1151 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1152 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1153 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1154 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1155 theme
->titlebut_unfocused_unpressed_color
;
1156 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1157 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1158 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1159 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1160 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1161 theme
->titlebut_unfocused_pressed_color
;
1162 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1164 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1165 theme
->menu_selected_color
;
1168 parse_close(ps
.doc
);
1171 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1172 RrAppearance
*a
, *b
, *c
, *d
;
1174 /* caluclate the font heights*/
1175 a
= theme
->a_focused_label
;
1176 theme
->win_font_height
=
1177 RrFontHeight(theme
->win_font_focused
,
1178 a
->texture
[0].data
.text
.shadow_offset_y
);
1179 a
= theme
->a_unfocused_label
;
1180 theme
->win_font_height
=
1181 MAX(theme
->win_font_height
,
1182 RrFontHeight(theme
->win_font_unfocused
,
1183 a
->texture
[0].data
.text
.shadow_offset_y
));
1184 a
= theme
->a_menu_text_title
;
1185 theme
->menu_title_font_height
=
1186 RrFontHeight(theme
->menu_title_font
,
1187 a
->texture
[0].data
.text
.shadow_offset_y
);
1188 a
= theme
->a_menu_text_normal
;
1189 b
= theme
->a_menu_text_selected
;
1190 c
= theme
->a_menu_text_disabled
;
1191 d
= theme
->a_menu_text_disabled_selected
;
1192 theme
->menu_font_height
=
1193 RrFontHeight(theme
->menu_font
,
1194 MAX(a
->texture
[0].data
.text
.shadow_offset_y
,
1195 MAX(b
->texture
[0].data
.text
.shadow_offset_y
,
1196 MAX(c
->texture
[0].data
.text
.shadow_offset_y
,
1197 d
->texture
[0].data
.text
.shadow_offset_y
1200 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1201 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1202 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1203 theme
->label_height
+= theme
->label_height
% 2;
1205 /* this would be nice I think, since padding.width can now be 0,
1206 but it breaks frame.c horribly and I don't feel like fixing that
1207 right now, so if anyone complains, here is how to keep text from
1208 going over the title's bevel/border with a padding.width of 0 and a
1209 bevelless/borderless label
1210 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1211 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1212 theme->title_height = theme->label_height +
1213 MAX(MAX(theme->padding * 2, ft + fb),
1214 MAX(theme->padding * 2, ut + ub));
1216 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1218 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1219 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1220 theme
->menu_title_height
= theme
->menu_title_label_height
+
1221 theme
->paddingy
* 2;
1223 theme
->button_size
= theme
->label_height
- 2;
1224 theme
->grip_width
= 25;
1229 void RrThemeFree(RrTheme
*theme
)
1232 RrColorFree(theme
->menu_border_color
);
1233 RrColorFree(theme
->frame_focused_border_color
);
1234 RrColorFree(theme
->frame_unfocused_border_color
);
1235 RrColorFree(theme
->cb_unfocused_color
);
1236 RrColorFree(theme
->cb_focused_color
);
1237 RrColorFree(theme
->title_focused_color
);
1238 RrColorFree(theme
->title_unfocused_color
);
1239 RrColorFree(theme
->titlebut_disabled_focused_color
);
1240 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1241 RrColorFree(theme
->titlebut_hover_focused_color
);
1242 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1243 RrColorFree(theme
->titlebut_focused_pressed_color
);
1244 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1245 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1246 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1247 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1248 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1249 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1250 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1251 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1252 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1253 RrColorFree(theme
->menu_title_color
);
1254 RrColorFree(theme
->menu_color
);
1255 RrColorFree(theme
->menu_selected_color
);
1256 RrColorFree(theme
->menu_disabled_color
);
1257 RrColorFree(theme
->menu_disabled_selected_color
);
1258 RrColorFree(theme
->title_focused_shadow_color
);
1259 RrColorFree(theme
->title_unfocused_shadow_color
);
1260 RrColorFree(theme
->osd_color
);
1261 RrColorFree(theme
->osd_shadow_color
);
1262 RrColorFree(theme
->menu_title_shadow_color
);
1263 RrColorFree(theme
->menu_text_normal_shadow_color
);
1264 RrColorFree(theme
->menu_text_selected_shadow_color
);
1265 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1266 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1268 g_free(theme
->def_win_icon
);
1270 RrPixmapMaskFree(theme
->max_mask
);
1271 RrPixmapMaskFree(theme
->max_toggled_mask
);
1272 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1273 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1274 RrPixmapMaskFree(theme
->max_disabled_mask
);
1275 RrPixmapMaskFree(theme
->max_hover_mask
);
1276 RrPixmapMaskFree(theme
->max_pressed_mask
);
1277 RrPixmapMaskFree(theme
->desk_mask
);
1278 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1279 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1280 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1281 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1282 RrPixmapMaskFree(theme
->desk_hover_mask
);
1283 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1284 RrPixmapMaskFree(theme
->shade_mask
);
1285 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1286 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1287 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1288 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1289 RrPixmapMaskFree(theme
->shade_hover_mask
);
1290 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1291 RrPixmapMaskFree(theme
->iconify_mask
);
1292 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1293 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1294 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1295 RrPixmapMaskFree(theme
->close_mask
);
1296 RrPixmapMaskFree(theme
->close_disabled_mask
);
1297 RrPixmapMaskFree(theme
->close_hover_mask
);
1298 RrPixmapMaskFree(theme
->close_pressed_mask
);
1299 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1301 RrFontClose(theme
->win_font_focused
);
1302 RrFontClose(theme
->win_font_unfocused
);
1303 RrFontClose(theme
->menu_title_font
);
1304 RrFontClose(theme
->menu_font
);
1306 RrAppearanceFree(theme
->a_disabled_focused_max
);
1307 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1308 RrAppearanceFree(theme
->a_hover_focused_max
);
1309 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1310 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1311 RrAppearanceFree(theme
->a_focused_pressed_max
);
1312 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1313 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1314 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1315 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1316 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1317 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1318 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1319 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1320 RrAppearanceFree(theme
->a_disabled_focused_close
);
1321 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1322 RrAppearanceFree(theme
->a_hover_focused_close
);
1323 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1324 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1325 RrAppearanceFree(theme
->a_focused_pressed_close
);
1326 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1327 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1328 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1329 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1330 RrAppearanceFree(theme
->a_hover_focused_desk
);
1331 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1332 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1333 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1334 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1335 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1336 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1337 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1338 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1339 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1340 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1341 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1342 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1343 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1344 RrAppearanceFree(theme
->a_hover_focused_shade
);
1345 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1346 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1347 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1348 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1349 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1350 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1351 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1352 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1353 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1354 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1355 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1356 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1357 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1358 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1359 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1360 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1361 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1362 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1363 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1364 RrAppearanceFree(theme
->a_focused_grip
);
1365 RrAppearanceFree(theme
->a_unfocused_grip
);
1366 RrAppearanceFree(theme
->a_focused_title
);
1367 RrAppearanceFree(theme
->a_unfocused_title
);
1368 RrAppearanceFree(theme
->a_focused_label
);
1369 RrAppearanceFree(theme
->a_unfocused_label
);
1370 RrAppearanceFree(theme
->a_icon
);
1371 RrAppearanceFree(theme
->a_focused_handle
);
1372 RrAppearanceFree(theme
->a_unfocused_handle
);
1373 RrAppearanceFree(theme
->a_menu
);
1374 RrAppearanceFree(theme
->a_menu_title
);
1375 RrAppearanceFree(theme
->a_menu_text_title
);
1376 RrAppearanceFree(theme
->a_menu_normal
);
1377 RrAppearanceFree(theme
->a_menu_selected
);
1378 RrAppearanceFree(theme
->a_menu_disabled
);
1379 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1380 RrAppearanceFree(theme
->a_menu_text_normal
);
1381 RrAppearanceFree(theme
->a_menu_text_selected
);
1382 RrAppearanceFree(theme
->a_menu_text_disabled
);
1383 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1384 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1385 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1386 RrAppearanceFree(theme
->a_clear
);
1387 RrAppearanceFree(theme
->a_clear_tex
);
1388 RrAppearanceFree(theme
->osd_hilite_bg
);
1389 RrAppearanceFree(theme
->osd_hilite_fg
);
1390 RrAppearanceFree(theme
->osd_hilite_label
);
1391 RrAppearanceFree(theme
->osd_unhilite_fg
);
1397 static gboolean
read_mask(ParseState
*ps
, const gchar
*maskname
,
1398 RrPixmapMask
**value
)
1400 gboolean ret
= FALSE
;
1402 gint hx
, hy
; /* ignored */
1406 s
= g_build_filename(ps
->path
, maskname
, NULL
);
1407 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1409 *value
= RrPixmapMaskNew(ps
->inst
, w
, h
, (gchar
*)b
);
1417 static void set_default_appearance(RrAppearance
*a
)
1419 a
->surface
.grad
= RR_SURFACE_SOLID
;
1420 a
->surface
.relief
= RR_RELIEF_FLAT
;
1421 a
->surface
.bevel
= RR_BEVEL_1
;
1422 a
->surface
.interlaced
= FALSE
;
1423 a
->surface
.border
= FALSE
;
1424 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1425 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1428 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1429 an RrTextureRGBA. */
1430 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1435 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1437 for (i
= 0; i
< width
* height
; ++i
) {
1438 guchar a
= ((*p
>> 24) & 0xff);
1439 guchar b
= ((*p
>> 16) & 0xff);
1440 guchar g
= ((*p
>> 8) & 0xff);
1441 guchar r
= ((*p
>> 0) & 0xff);
1443 *p
= ((r
<< RrDefaultRedOffset
) +
1444 (g
<< RrDefaultGreenOffset
) +
1445 (b
<< RrDefaultBlueOffset
) +
1446 (a
<< RrDefaultAlphaOffset
));
1453 static void parse_style(gchar
*tex
, RrSurfaceColorType
*grad
,
1454 RrReliefType
*relief
, RrBevelType
*bevel
,
1455 gboolean
*interlaced
, gboolean
*border
,
1456 gboolean allow_trans
)
1460 /* convert to all lowercase */
1461 for (t
= tex
; *t
!= '\0'; ++t
)
1462 *t
= g_ascii_tolower(*t
);
1464 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1465 *grad
= RR_SURFACE_PARENTREL
;
1467 if (strstr(tex
, "gradient") != NULL
) {
1468 if (strstr(tex
, "crossdiagonal") != NULL
)
1469 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1470 else if (strstr(tex
, "pyramid") != NULL
)
1471 *grad
= RR_SURFACE_PYRAMID
;
1472 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1473 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1474 else if (strstr(tex
, "horizontal") != NULL
)
1475 *grad
= RR_SURFACE_HORIZONTAL
;
1476 else if (strstr(tex
, "splitvertical") != NULL
)
1477 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1478 else if (strstr(tex
, "vertical") != NULL
)
1479 *grad
= RR_SURFACE_VERTICAL
;
1481 *grad
= RR_SURFACE_DIAGONAL
;
1483 *grad
= RR_SURFACE_SOLID
;
1486 if (strstr(tex
, "sunken") != NULL
)
1487 *relief
= RR_RELIEF_SUNKEN
;
1488 else if (strstr(tex
, "flat") != NULL
)
1489 *relief
= RR_RELIEF_FLAT
;
1491 *relief
= RR_RELIEF_RAISED
;
1494 if (*relief
== RR_RELIEF_FLAT
) {
1495 if (strstr(tex
, "border") != NULL
)
1498 if (strstr(tex
, "bevel2") != NULL
)
1499 *bevel
= RR_BEVEL_2
;
1501 *bevel
= RR_BEVEL_1
;
1504 if (strstr(tex
, "interlaced") != NULL
)
1507 *interlaced
= FALSE
;
1511 static xmlNodePtr
find_node(xmlNodePtr n
, const gchar
*names
[])
1515 for (i
= 0; names
[i
] && n
; ++i
)
1516 n
= parse_find_node(names
[i
], n
->children
);
1520 static gboolean
find_int(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1521 gint
*integer
, gint lower
, gint upper
)
1525 if ((n
= find_node(n
, names
))) {
1526 i
= parse_int(ps
->doc
, n
);
1527 if (i
>= lower
&& i
<= upper
) {
1535 static gboolean
find_string(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1538 if ((n
= find_node(n
, names
))) {
1539 *string
= parse_string(ps
->doc
, n
);
1545 static gboolean
find_color(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1546 RrColor
**color
, gchar
*alpha
)
1548 if ((n
= find_node(n
, names
))) {
1550 if (parse_attr_int("r", n
, &r
) &&
1551 parse_attr_int("g", n
, &g
) &&
1552 parse_attr_int("b", n
, &b
) &&
1553 parse_attr_int("a", n
, &a
) &&
1554 r
>= 0 && g
>= 0 && b
>= 0 && a
>= 0 &&
1555 r
< 256 && g
< 256 && b
< 256 && a
< 256)
1557 *color
= RrColorNew(ps
->inst
, r
, g
, b
);
1558 if (alpha
) *alpha
= a
;
1565 static gboolean
find_point(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1567 gint lowx
, gint upx
, gint lowy
, gint upy
)
1569 if ((n
= find_node(n
, names
))) {
1571 if (parse_attr_int("x", n
, &a
) &&
1572 parse_attr_int("y", n
, &b
) &&
1573 a
>= lowx
&& a
<= upx
&& b
>= lowy
&& b
<= upy
)
1582 static gboolean
find_shadow(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1585 return find_point(ps
, n
, names
,
1586 &a
->texture
[0].data
.text
.shadow_offset_x
,
1587 &a
->texture
[0].data
.text
.shadow_offset_y
,
1591 static gboolean
find_appearance(ParseState
*ps
, xmlNodePtr n
, const gchar
*names
[],
1592 RrAppearance
*a
, gboolean allow_trans
)
1596 if (!(n
= find_node(n
, names
)))
1599 if ((n2
= find_node(n
, L("style")))) {
1600 gchar
*s
= parse_string(ps
->doc
, n2
);
1601 parse_style(s
, &a
->surface
.grad
, &a
->surface
.relief
,
1602 &a
->surface
.bevel
, &a
->surface
.interlaced
,
1603 &a
->surface
.border
, allow_trans
);
1608 if (!find_color(ps
, n
, L("primary"), &a
->surface
.primary
, NULL
))
1609 a
->surface
.primary
= RrColorNew(ps
->inst
, 0, 0, 0);
1610 if (!find_color(ps
, n
, L("secondary"), &a
->surface
.secondary
, NULL
))
1611 a
->surface
.secondary
= RrColorNew(ps
->inst
, 0, 0, 0);
1612 if (a
->surface
.border
)
1613 if (!find_color(ps
, n
, L("border"),
1614 &a
->surface
.border_color
, NULL
))
1615 a
->surface
.border_color
= RrColorNew(ps
->inst
, 0, 0, 0);
1616 if (a
->surface
.interlaced
)
1617 if (!find_color(ps
, n
, L("interlace"),
1618 &a
->surface
.interlace_color
, NULL
))
1619 a
->surface
.interlace_color
= RrColorNew(ps
->inst
, 0, 0, 0);