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 "obt/paths.h"
29 #include <X11/Xresource.h>
34 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
);
35 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
);
36 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
);
37 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
38 const gchar
*rname
, RrColor
**value
);
39 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
40 RrTheme
*theme
, const gchar
*maskname
,
41 RrPixmapMask
**value
);
42 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
43 const gchar
*rname
, RrAppearance
*value
,
44 gboolean allow_trans
);
45 static int parse_inline_number(const char *p
);
46 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
);
47 static void set_default_appearance(RrAppearance
*a
);
49 RrTheme
* RrThemeNew(const RrInstance
*inst
, const gchar
*name
,
50 gboolean allow_fallback
,
51 RrFont
*active_window_font
, RrFont
*inactive_window_font
,
52 RrFont
*menu_title_font
, RrFont
*menu_item_font
,
55 XrmDatabase db
= NULL
;
56 RrJustify winjust
, mtitlejust
;
63 db
= loaddb(name
, &path
);
65 g_message("Unable to load the theme '%s'", name
);
67 g_message("Falling back to the default theme '%s'",
69 /* fallback to the default theme */
75 db
= loaddb(DEFAULT_THEME
, &path
);
77 g_message("Unable to load the theme '%s'", DEFAULT_THEME
);
84 theme
= g_new0(RrTheme
, 1);
87 theme
->name
= g_strdup(name
? name
: DEFAULT_THEME
);
89 theme
->a_disabled_focused_max
= RrAppearanceNew(inst
, 1);
90 theme
->a_disabled_unfocused_max
= RrAppearanceNew(inst
, 1);
91 theme
->a_hover_focused_max
= RrAppearanceNew(inst
, 1);
92 theme
->a_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
93 theme
->a_toggled_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
94 theme
->a_toggled_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
95 theme
->a_toggled_hover_focused_max
= RrAppearanceNew(inst
, 1);
96 theme
->a_toggled_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
97 theme
->a_toggled_focused_pressed_max
= RrAppearanceNew(inst
, 1);
98 theme
->a_toggled_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
99 theme
->a_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
100 theme
->a_focused_pressed_max
= RrAppearanceNew(inst
, 1);
101 theme
->a_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
102 theme
->a_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
103 theme
->a_focused_grip
= RrAppearanceNew(inst
, 0);
104 theme
->a_unfocused_grip
= RrAppearanceNew(inst
, 0);
105 theme
->a_focused_title
= RrAppearanceNew(inst
, 0);
106 theme
->a_unfocused_title
= RrAppearanceNew(inst
, 0);
107 theme
->a_focused_label
= RrAppearanceNew(inst
, 1);
108 theme
->a_unfocused_label
= RrAppearanceNew(inst
, 1);
109 theme
->a_icon
= RrAppearanceNew(inst
, 1);
110 theme
->a_focused_handle
= RrAppearanceNew(inst
, 0);
111 theme
->a_unfocused_handle
= RrAppearanceNew(inst
, 0);
112 theme
->a_menu
= RrAppearanceNew(inst
, 0);
113 theme
->a_menu_title
= RrAppearanceNew(inst
, 0);
114 theme
->a_menu_text_title
= RrAppearanceNew(inst
, 1);
115 theme
->a_menu_normal
= RrAppearanceNew(inst
, 0);
116 theme
->a_menu_selected
= RrAppearanceNew(inst
, 0);
117 theme
->a_menu_disabled
= RrAppearanceNew(inst
, 0);
118 /* a_menu_disabled_selected is copied from a_menu_selected */
119 theme
->a_menu_text_normal
= RrAppearanceNew(inst
, 1);
120 theme
->a_menu_text_selected
= RrAppearanceNew(inst
, 1);
121 theme
->a_menu_text_disabled
= RrAppearanceNew(inst
, 1);
122 theme
->a_menu_text_disabled_selected
= RrAppearanceNew(inst
, 1);
123 theme
->a_menu_bullet_normal
= RrAppearanceNew(inst
, 1);
124 theme
->a_menu_bullet_selected
= RrAppearanceNew(inst
, 1);
125 theme
->a_clear
= RrAppearanceNew(inst
, 0);
126 theme
->a_clear_tex
= RrAppearanceNew(inst
, 1);
127 theme
->osd_hilite_bg
= RrAppearanceNew(inst
, 0);
128 theme
->osd_hilite_label
= RrAppearanceNew(inst
, 1);
129 theme
->osd_hilite_fg
= RrAppearanceNew(inst
, 0);
130 theme
->osd_unhilite_fg
= RrAppearanceNew(inst
, 0);
132 /* load the font stuff */
133 if (active_window_font
) {
134 theme
->win_font_focused
= active_window_font
;
135 RrFontRef(active_window_font
);
137 theme
->win_font_focused
= RrFontOpenDefault(inst
);
139 if (inactive_window_font
) {
140 theme
->win_font_unfocused
= inactive_window_font
;
141 RrFontRef(inactive_window_font
);
143 theme
->win_font_unfocused
= RrFontOpenDefault(inst
);
145 winjust
= RR_JUSTIFY_LEFT
;
146 if (read_string(db
, "window.label.text.justify", &str
)) {
147 if (!g_ascii_strcasecmp(str
, "right"))
148 winjust
= RR_JUSTIFY_RIGHT
;
149 else if (!g_ascii_strcasecmp(str
, "center"))
150 winjust
= RR_JUSTIFY_CENTER
;
153 if (menu_title_font
) {
154 theme
->menu_title_font
= menu_title_font
;
155 RrFontRef(menu_title_font
);
157 theme
->menu_title_font
= RrFontOpenDefault(inst
);
159 mtitlejust
= RR_JUSTIFY_LEFT
;
160 if (read_string(db
, "menu.title.text.justify", &str
)) {
161 if (!g_ascii_strcasecmp(str
, "right"))
162 mtitlejust
= RR_JUSTIFY_RIGHT
;
163 else if (!g_ascii_strcasecmp(str
, "center"))
164 mtitlejust
= RR_JUSTIFY_CENTER
;
167 if (menu_item_font
) {
168 theme
->menu_font
= menu_item_font
;
169 RrFontRef(menu_item_font
);
171 theme
->menu_font
= RrFontOpenDefault(inst
);
174 theme
->osd_font
= osd_font
;
177 theme
->osd_font
= RrFontOpenDefault(inst
);
179 /* load direct dimensions */
180 if ((!read_int(db
, "menu.overlap.x", &theme
->menu_overlap_x
) &&
181 !read_int(db
, "menu.overlap", &theme
->menu_overlap_x
)) ||
182 theme
->menu_overlap_x
< -100 || theme
->menu_overlap_x
> 100)
183 theme
->menu_overlap_x
= 0;
184 if ((!read_int(db
, "menu.overlap.y", &theme
->menu_overlap_y
) &&
185 !read_int(db
, "menu.overlap", &theme
->menu_overlap_y
)) ||
186 theme
->menu_overlap_y
< -100 || theme
->menu_overlap_y
> 100)
187 theme
->menu_overlap_y
= 0;
188 if (!read_int(db
, "window.handle.width", &theme
->handle_height
) ||
189 theme
->handle_height
< 0 || theme
->handle_height
> 100)
190 theme
->handle_height
= 6;
191 if (!read_int(db
, "padding.width", &theme
->paddingx
) ||
192 theme
->paddingx
< 0 || theme
->paddingx
> 100)
194 if (!read_int(db
, "padding.height", &theme
->paddingy
) ||
195 theme
->paddingy
< 0 || theme
->paddingy
> 100)
196 theme
->paddingy
= theme
->paddingx
;
197 if (!read_int(db
, "border.width", &theme
->fbwidth
) ||
198 theme
->fbwidth
< 0 || theme
->fbwidth
> 100)
200 /* menu border width inherits from the frame border width */
201 if (!read_int(db
, "menu.border.width", &theme
->mbwidth
) ||
202 theme
->mbwidth
< 0 || theme
->mbwidth
> 100)
203 theme
->mbwidth
= theme
->fbwidth
;
204 /* osd border width inherits from the frame border width */
205 if (!read_int(db
, "osd.border.width", &theme
->obwidth
) ||
206 theme
->obwidth
< 0 || theme
->obwidth
> 100)
207 theme
->obwidth
= theme
->fbwidth
;
208 if (!read_int(db
, "window.client.padding.width", &theme
->cbwidthx
) ||
209 theme
->cbwidthx
< 0 || theme
->cbwidthx
> 100)
210 theme
->cbwidthx
= theme
->paddingx
;
211 if (!read_int(db
, "window.client.padding.height", &theme
->cbwidthy
) ||
212 theme
->cbwidthy
< 0 || theme
->cbwidthy
> 100)
213 theme
->cbwidthy
= theme
->cbwidthx
;
214 if (!read_int(db
, "menu.separator.width", &theme
->menu_sep_width
) ||
215 theme
->menu_sep_width
< 1 || theme
->menu_sep_width
> 100)
216 theme
->menu_sep_width
= 1;
217 if (!read_int(db
, "menu.separator.padding.width",
218 &theme
->menu_sep_paddingx
) ||
219 theme
->menu_sep_paddingx
< 0 || theme
->menu_sep_paddingx
> 100)
220 theme
->menu_sep_paddingx
= 6;
221 if (!read_int(db
, "menu.separator.padding.height",
222 &theme
->menu_sep_paddingy
) ||
223 theme
->menu_sep_paddingy
< 0 || theme
->menu_sep_paddingy
> 100)
224 theme
->menu_sep_paddingy
= 3;
227 if (!read_color(db
, inst
,
228 "window.active.border.color",
229 &theme
->frame_focused_border_color
) &&
230 !read_color(db
, inst
,
232 &theme
->frame_focused_border_color
))
233 theme
->frame_focused_border_color
= RrColorNew(inst
, 0, 0, 0);
234 /* title separator focused color inherits from focused border color */
235 if (!read_color(db
, inst
,
236 "window.active.title.separator.color",
237 &theme
->title_separator_focused_color
))
238 theme
->title_separator_focused_color
=
240 theme
->frame_focused_border_color
->r
,
241 theme
->frame_focused_border_color
->g
,
242 theme
->frame_focused_border_color
->b
);
243 /* unfocused border color inherits from frame focused border color */
244 if (!read_color(db
, inst
,
245 "window.inactive.border.color",
246 &theme
->frame_unfocused_border_color
))
247 theme
->frame_unfocused_border_color
=
248 RrColorNew(inst
, theme
->frame_focused_border_color
->r
,
249 theme
->frame_focused_border_color
->g
,
250 theme
->frame_focused_border_color
->b
);
251 /* title separator unfocused color inherits from unfocused border color */
252 if (!read_color(db
, inst
,
253 "window.inactive.title.separator.color",
254 &theme
->title_separator_unfocused_color
))
255 theme
->title_separator_unfocused_color
=
257 theme
->frame_unfocused_border_color
->r
,
258 theme
->frame_unfocused_border_color
->g
,
259 theme
->frame_unfocused_border_color
->b
);
261 /* menu border color inherits from frame focused border color */
262 if (!read_color(db
, inst
, "menu.border.color", &theme
->menu_border_color
))
263 theme
->menu_border_color
=
265 theme
->frame_focused_border_color
->r
,
266 theme
->frame_focused_border_color
->g
,
267 theme
->frame_focused_border_color
->b
);
268 /* osd border color inherits from frame focused border color */
269 if (!read_color(db
, inst
, "osd.border.color", &theme
->osd_border_color
))
270 theme
->osd_border_color
=
272 theme
->frame_focused_border_color
->r
,
273 theme
->frame_focused_border_color
->g
,
274 theme
->frame_focused_border_color
->b
);
275 if (!read_color(db
, inst
,
276 "window.active.client.color",
277 &theme
->cb_focused_color
))
278 theme
->cb_focused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
279 if (!read_color(db
, inst
,
280 "window.inactive.client.color",
281 &theme
->cb_unfocused_color
))
282 theme
->cb_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
283 if (!read_color(db
, inst
,
284 "window.active.label.text.color",
285 &theme
->title_focused_color
))
286 theme
->title_focused_color
= RrColorNew(inst
, 0x0, 0x0, 0x0);
287 if (!read_color(db
, inst
, "osd.label.text.color", &theme
->osd_color
))
288 theme
->osd_color
= RrColorNew(inst
,
289 theme
->title_focused_color
->r
,
290 theme
->title_focused_color
->g
,
291 theme
->title_focused_color
->b
);
292 if (!read_color(db
, inst
,
293 "window.inactive.label.text.color",
294 &theme
->title_unfocused_color
))
295 theme
->title_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
296 if (!read_color(db
, inst
,
297 "window.active.button.unpressed.image.color",
298 &theme
->titlebut_focused_unpressed_color
))
299 theme
->titlebut_focused_unpressed_color
= RrColorNew(inst
, 0, 0, 0);
300 if (!read_color(db
, inst
,
301 "window.inactive.button.unpressed.image.color",
302 &theme
->titlebut_unfocused_unpressed_color
))
303 theme
->titlebut_unfocused_unpressed_color
=
304 RrColorNew(inst
, 0xff, 0xff, 0xff);
305 if (!read_color(db
, inst
,
306 "window.active.button.pressed.image.color",
307 &theme
->titlebut_focused_pressed_color
))
308 theme
->titlebut_focused_pressed_color
=
310 theme
->titlebut_focused_unpressed_color
->r
,
311 theme
->titlebut_focused_unpressed_color
->g
,
312 theme
->titlebut_focused_unpressed_color
->b
);
313 if (!read_color(db
, inst
,
314 "window.inactive.button.pressed.image.color",
315 &theme
->titlebut_unfocused_pressed_color
))
316 theme
->titlebut_unfocused_pressed_color
=
318 theme
->titlebut_unfocused_unpressed_color
->r
,
319 theme
->titlebut_unfocused_unpressed_color
->g
,
320 theme
->titlebut_unfocused_unpressed_color
->b
);
321 if (!read_color(db
, inst
,
322 "window.active.button.disabled.image.color",
323 &theme
->titlebut_disabled_focused_color
))
324 theme
->titlebut_disabled_focused_color
=
325 RrColorNew(inst
, 0xff, 0xff, 0xff);
326 if (!read_color(db
, inst
,
327 "window.inactive.button.disabled.image.color",
328 &theme
->titlebut_disabled_unfocused_color
))
329 theme
->titlebut_disabled_unfocused_color
= RrColorNew(inst
, 0, 0, 0);
330 if (!read_color(db
, inst
,
331 "window.active.button.hover.image.color",
332 &theme
->titlebut_hover_focused_color
))
333 theme
->titlebut_hover_focused_color
=
335 theme
->titlebut_focused_unpressed_color
->r
,
336 theme
->titlebut_focused_unpressed_color
->g
,
337 theme
->titlebut_focused_unpressed_color
->b
);
338 if (!read_color(db
, inst
,
339 "window.inactive.button.hover.image.color",
340 &theme
->titlebut_hover_unfocused_color
))
341 theme
->titlebut_hover_unfocused_color
=
343 theme
->titlebut_unfocused_unpressed_color
->r
,
344 theme
->titlebut_unfocused_unpressed_color
->g
,
345 theme
->titlebut_unfocused_unpressed_color
->b
);
346 if (!read_color(db
, inst
,
347 "window.active.button.toggled.unpressed.image.color",
348 &theme
->titlebut_toggled_focused_unpressed_color
) &&
349 !read_color(db
, inst
,
350 "window.active.button.toggled.image.color",
351 &theme
->titlebut_toggled_focused_unpressed_color
))
352 theme
->titlebut_toggled_focused_unpressed_color
=
354 theme
->titlebut_focused_pressed_color
->r
,
355 theme
->titlebut_focused_pressed_color
->g
,
356 theme
->titlebut_focused_pressed_color
->b
);
357 if (!read_color(db
, inst
,
358 "window.inactive.button.toggled.unpressed.image.color",
359 &theme
->titlebut_toggled_unfocused_unpressed_color
) &&
360 !read_color(db
, inst
,
361 "window.inactive.button.toggled.image.color",
362 &theme
->titlebut_toggled_unfocused_unpressed_color
))
363 theme
->titlebut_toggled_unfocused_unpressed_color
=
365 theme
->titlebut_unfocused_pressed_color
->r
,
366 theme
->titlebut_unfocused_pressed_color
->g
,
367 theme
->titlebut_unfocused_pressed_color
->b
);
368 if (!read_color(db
, inst
,
369 "window.active.button.toggled.hover.image.color",
370 &theme
->titlebut_toggled_hover_focused_color
))
371 theme
->titlebut_toggled_hover_focused_color
=
373 theme
->titlebut_toggled_focused_unpressed_color
->r
,
374 theme
->titlebut_toggled_focused_unpressed_color
->g
,
375 theme
->titlebut_toggled_focused_unpressed_color
->b
);
376 if (!read_color(db
, inst
,
377 "window.inactive.button.toggled.hover.image.color",
378 &theme
->titlebut_toggled_hover_unfocused_color
))
379 theme
->titlebut_toggled_hover_unfocused_color
=
381 theme
->titlebut_toggled_unfocused_unpressed_color
->r
,
382 theme
->titlebut_toggled_unfocused_unpressed_color
->g
,
383 theme
->titlebut_toggled_unfocused_unpressed_color
->b
);
384 if (!read_color(db
, inst
,
385 "window.active.button.toggled.pressed.image.color",
386 &theme
->titlebut_toggled_focused_pressed_color
))
387 theme
->titlebut_toggled_focused_pressed_color
=
389 theme
->titlebut_focused_pressed_color
->r
,
390 theme
->titlebut_focused_pressed_color
->g
,
391 theme
->titlebut_focused_pressed_color
->b
);
392 if (!read_color(db
, inst
,
393 "window.inactive.button.toggled.pressed.image.color",
394 &theme
->titlebut_toggled_unfocused_pressed_color
))
395 theme
->titlebut_toggled_unfocused_pressed_color
=
397 theme
->titlebut_unfocused_pressed_color
->r
,
398 theme
->titlebut_unfocused_pressed_color
->g
,
399 theme
->titlebut_unfocused_pressed_color
->b
);
400 if (!read_color(db
, inst
,
401 "menu.title.text.color", &theme
->menu_title_color
))
402 theme
->menu_title_color
= RrColorNew(inst
, 0, 0, 0);
403 if (!read_color(db
, inst
,
404 "menu.items.text.color", &theme
->menu_color
))
405 theme
->menu_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
406 if (!read_color(db
, inst
,
407 "menu.items.disabled.text.color",
408 &theme
->menu_disabled_color
))
409 theme
->menu_disabled_color
= RrColorNew(inst
, 0, 0, 0);
410 if (!read_color(db
, inst
,
411 "menu.items.active.disabled.text.color",
412 &theme
->menu_disabled_selected_color
))
413 theme
->menu_disabled_selected_color
=
415 theme
->menu_disabled_color
->r
,
416 theme
->menu_disabled_color
->g
,
417 theme
->menu_disabled_color
->b
);
418 if (!read_color(db
, inst
,
419 "menu.items.active.text.color",
420 &theme
->menu_selected_color
))
421 theme
->menu_selected_color
= RrColorNew(inst
, 0, 0, 0);
422 if (!read_color(db
, inst
,
423 "menu.separator.color", &theme
->menu_sep_color
))
424 theme
->menu_sep_color
= RrColorNew(inst
,
425 theme
->menu_color
->r
,
426 theme
->menu_color
->g
,
427 theme
->menu_color
->b
);
429 /* load the image masks */
431 /* maximize button masks */
433 if (!read_mask(inst
, path
, theme
, "max.xbm", &theme
->max_mask
)) {
434 guchar data
[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
435 theme
->max_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
438 if (!read_mask(inst
, path
, theme
, "max_toggled.xbm",
439 &theme
->max_toggled_mask
))
442 theme
->max_toggled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
444 guchar data
[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
445 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 6, 6,(gchar
*)data
);
448 if (!read_mask(inst
, path
, theme
, "max_pressed.xbm",
449 &theme
->max_pressed_mask
))
450 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
451 if (!read_mask(inst
,path
,theme
,"max_disabled.xbm",
452 &theme
->max_disabled_mask
))
453 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
454 if (!read_mask(inst
, path
, theme
, "max_hover.xbm", &theme
->max_hover_mask
))
455 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
456 if (!read_mask(inst
, path
, theme
, "max_toggled_pressed.xbm",
457 &theme
->max_toggled_pressed_mask
))
458 theme
->max_toggled_pressed_mask
=
459 RrPixmapMaskCopy(theme
->max_toggled_mask
);
460 if (!read_mask(inst
, path
, theme
, "max_toggled_hover.xbm",
461 &theme
->max_toggled_hover_mask
))
462 theme
->max_toggled_hover_mask
=
463 RrPixmapMaskCopy(theme
->max_toggled_mask
);
465 /* iconify button masks */
466 if (!read_mask(inst
, path
, theme
, "iconify.xbm", &theme
->iconify_mask
)) {
467 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
468 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
470 if (!read_mask(inst
, path
, theme
, "iconify_pressed.xbm",
471 &theme
->iconify_pressed_mask
))
472 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
473 if (!read_mask(inst
, path
, theme
, "iconify_disabled.xbm",
474 &theme
->iconify_disabled_mask
))
475 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
476 if (!read_mask(inst
, path
, theme
, "iconify_hover.xbm",
477 &theme
->iconify_hover_mask
))
478 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
480 /* all desktops button masks */
482 if (!read_mask(inst
, path
, theme
, "desk.xbm", &theme
->desk_mask
)) {
483 guchar data
[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
484 theme
->desk_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
487 if (!read_mask(inst
, path
, theme
, "desk_toggled.xbm",
488 &theme
->desk_toggled_mask
)) {
490 theme
->desk_toggled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
492 guchar data
[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
493 theme
->desk_toggled_mask
=
494 RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
497 if (!read_mask(inst
, path
, theme
, "desk_pressed.xbm",
498 &theme
->desk_pressed_mask
))
499 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
500 if (!read_mask(inst
, path
, theme
, "desk_disabled.xbm",
501 &theme
->desk_disabled_mask
))
502 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
503 if (!read_mask(inst
, path
, theme
, "desk_hover.xbm",
504 &theme
->desk_hover_mask
))
505 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
506 if (!read_mask(inst
, path
, theme
, "desk_toggled_pressed.xbm",
507 &theme
->desk_toggled_pressed_mask
))
508 theme
->desk_toggled_pressed_mask
=
509 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
510 if (!read_mask(inst
, path
, theme
, "desk_toggled_hover.xbm",
511 &theme
->desk_toggled_hover_mask
))
512 theme
->desk_toggled_hover_mask
=
513 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
515 /* shade button masks */
516 if (!read_mask(inst
, path
, theme
, "shade.xbm", &theme
->shade_mask
)) {
517 guchar data
[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
518 theme
->shade_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
520 if (!read_mask(inst
, path
, theme
, "shade_toggled.xbm",
521 &theme
->shade_toggled_mask
))
522 theme
->shade_toggled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
523 if (!read_mask(inst
, path
, theme
, "shade_pressed.xbm",
524 &theme
->shade_pressed_mask
))
525 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
526 if (!read_mask(inst
, path
, theme
, "shade_disabled.xbm",
527 &theme
->shade_disabled_mask
))
528 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
529 if (!read_mask(inst
, path
, theme
, "shade_hover.xbm",
530 &theme
->shade_hover_mask
))
531 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
532 if (!read_mask(inst
, path
, theme
, "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(inst
, path
, theme
, "shade_toggled_hover.xbm",
537 &theme
->shade_toggled_hover_mask
))
538 theme
->shade_toggled_hover_mask
=
539 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
541 /* close button masks */
542 if (!read_mask(inst
, path
, theme
, "close.xbm", &theme
->close_mask
)) {
543 guchar data
[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
544 theme
->close_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
546 if (!read_mask(inst
, path
, theme
, "close_pressed.xbm",
547 &theme
->close_pressed_mask
))
548 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
549 if (!read_mask(inst
, path
, theme
, "close_disabled.xbm",
550 &theme
->close_disabled_mask
))
551 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
552 if (!read_mask(inst
, path
, theme
, "close_hover.xbm",
553 &theme
->close_hover_mask
))
554 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
556 /* submenu bullet mask */
557 if (!read_mask(inst
, path
, theme
, "bullet.xbm", &theme
->menu_bullet_mask
))
559 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
560 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
563 /* up and down arrows */
565 guchar data
[] = { 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00 };
566 theme
->down_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
569 guchar data
[] = { 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00 };
570 theme
->up_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
573 /* setup the default window icon */
574 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
575 OB_DEFAULT_ICON_HEIGHT
,
576 OB_DEFAULT_ICON_pixel_data
);
577 theme
->def_win_icon_w
= OB_DEFAULT_ICON_WIDTH
;
578 theme
->def_win_icon_h
= OB_DEFAULT_ICON_HEIGHT
;
580 /* read the decoration textures */
581 if (!read_appearance(db
, inst
,
582 "window.active.title.bg", theme
->a_focused_title
,
584 set_default_appearance(theme
->a_focused_title
);
585 if (!read_appearance(db
, inst
,
586 "window.inactive.title.bg", theme
->a_unfocused_title
,
588 set_default_appearance(theme
->a_unfocused_title
);
589 if (!read_appearance(db
, inst
,
590 "window.active.label.bg", theme
->a_focused_label
,
592 set_default_appearance(theme
->a_focused_label
);
593 if (!read_appearance(db
, inst
,
594 "window.inactive.label.bg", theme
->a_unfocused_label
,
596 set_default_appearance(theme
->a_unfocused_label
);
597 if (!read_appearance(db
, inst
,
598 "window.active.handle.bg", theme
->a_focused_handle
,
600 set_default_appearance(theme
->a_focused_handle
);
601 if (!read_appearance(db
, inst
,
602 "window.inactive.handle.bg",theme
->a_unfocused_handle
,
604 set_default_appearance(theme
->a_unfocused_handle
);
605 if (!read_appearance(db
, inst
,
606 "window.active.grip.bg", theme
->a_focused_grip
,
608 set_default_appearance(theme
->a_focused_grip
);
609 if (!read_appearance(db
, inst
,
610 "window.inactive.grip.bg", theme
->a_unfocused_grip
,
612 set_default_appearance(theme
->a_unfocused_grip
);
613 if (!read_appearance(db
, inst
,
614 "menu.items.bg", theme
->a_menu
,
616 set_default_appearance(theme
->a_menu
);
617 if (!read_appearance(db
, inst
,
618 "menu.title.bg", theme
->a_menu_title
,
620 set_default_appearance(theme
->a_menu_title
);
621 if (!read_appearance(db
, inst
,
622 "menu.items.active.bg", theme
->a_menu_selected
,
624 set_default_appearance(theme
->a_menu_selected
);
625 theme
->a_menu_disabled_selected
=
626 RrAppearanceCopy(theme
->a_menu_selected
);
628 /* read appearances for non-decorations (on-screen-display) */
629 if (!read_appearance(db
, inst
, "osd.bg", theme
->osd_hilite_bg
, FALSE
)) {
630 RrAppearanceFree(theme
->osd_hilite_bg
);
631 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
633 if (!read_appearance(db
, inst
, "osd.label.bg",
634 theme
->osd_hilite_label
, TRUE
)) {
635 RrAppearanceFree(theme
->osd_hilite_label
);
636 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
638 /* osd_hilite_fg can't be parentrel */
639 if (!read_appearance(db
, inst
, "osd.hilight.bg",
640 theme
->osd_hilite_fg
, FALSE
)) {
641 RrAppearanceFree(theme
->osd_hilite_fg
);
642 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
643 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_label
);
645 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_title
);
647 /* osd_unhilite_fg can't be parentrel either */
648 if (!read_appearance(db
, inst
, "osd.unhilight.bg",
649 theme
->osd_unhilite_fg
, FALSE
)) {
650 RrAppearanceFree(theme
->osd_unhilite_fg
);
651 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
652 theme
->osd_unhilite_fg
=RrAppearanceCopy(theme
->a_unfocused_label
);
654 theme
->osd_unhilite_fg
=RrAppearanceCopy(theme
->a_unfocused_title
);
657 /* read buttons textures */
658 if (!read_appearance(db
, inst
,
659 "window.active.button.disabled.bg",
660 theme
->a_disabled_focused_max
,
662 set_default_appearance(theme
->a_disabled_focused_max
);
663 if (!read_appearance(db
, inst
,
664 "window.inactive.button.disabled.bg",
665 theme
->a_disabled_unfocused_max
,
667 set_default_appearance(theme
->a_disabled_unfocused_max
);
668 if (!read_appearance(db
, inst
,
669 "window.active.button.pressed.bg",
670 theme
->a_focused_pressed_max
,
672 set_default_appearance(theme
->a_focused_pressed_max
);
673 if (!read_appearance(db
, inst
,
674 "window.inactive.button.pressed.bg",
675 theme
->a_unfocused_pressed_max
,
677 set_default_appearance(theme
->a_unfocused_pressed_max
);
678 if (!read_appearance(db
, inst
,
679 "window.active.button.toggled.unpressed.bg",
680 theme
->a_toggled_focused_unpressed_max
,
682 !read_appearance(db
, inst
,
683 "window.active.button.toggled.bg",
684 theme
->a_toggled_focused_unpressed_max
,
687 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
688 theme
->a_toggled_focused_unpressed_max
=
689 RrAppearanceCopy(theme
->a_focused_pressed_max
);
691 if (!read_appearance(db
, inst
,
692 "window.inactive.button.toggled.unpressed.bg",
693 theme
->a_toggled_unfocused_unpressed_max
,
695 !read_appearance(db
, inst
,
696 "window.inactive.button.toggled.bg",
697 theme
->a_toggled_unfocused_unpressed_max
,
700 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
701 theme
->a_toggled_unfocused_unpressed_max
=
702 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
704 if (!read_appearance(db
, inst
,
705 "window.active.button.toggled.hover.bg",
706 theme
->a_toggled_hover_focused_max
,
709 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
710 theme
->a_toggled_hover_focused_max
=
711 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
713 if (!read_appearance(db
, inst
,
714 "window.inactive.button.toggled.hover.bg",
715 theme
->a_toggled_hover_unfocused_max
,
718 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
719 theme
->a_toggled_hover_unfocused_max
=
720 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
722 if (!read_appearance(db
, inst
,
723 "window.active.button.toggled.pressed.bg",
724 theme
->a_toggled_focused_pressed_max
,
727 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
728 theme
->a_toggled_focused_pressed_max
=
729 RrAppearanceCopy(theme
->a_focused_pressed_max
);
731 if (!read_appearance(db
, inst
,
732 "window.inactive.button.toggled.pressed.bg",
733 theme
->a_toggled_unfocused_pressed_max
,
736 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
737 theme
->a_toggled_unfocused_pressed_max
=
738 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
740 if (!read_appearance(db
, inst
,
741 "window.active.button.unpressed.bg",
742 theme
->a_focused_unpressed_max
,
744 set_default_appearance(theme
->a_focused_unpressed_max
);
745 if (!read_appearance(db
, inst
,
746 "window.inactive.button.unpressed.bg",
747 theme
->a_unfocused_unpressed_max
,
749 set_default_appearance(theme
->a_unfocused_unpressed_max
);
750 if (!read_appearance(db
, inst
,
751 "window.active.button.hover.bg",
752 theme
->a_hover_focused_max
,
755 RrAppearanceFree(theme
->a_hover_focused_max
);
756 theme
->a_hover_focused_max
=
757 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
759 if (!read_appearance(db
, inst
,
760 "window.inactive.button.hover.bg",
761 theme
->a_hover_unfocused_max
,
764 RrAppearanceFree(theme
->a_hover_unfocused_max
);
765 theme
->a_hover_unfocused_max
=
766 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
769 theme
->a_disabled_focused_close
=
770 RrAppearanceCopy(theme
->a_disabled_focused_max
);
771 theme
->a_disabled_unfocused_close
=
772 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
773 theme
->a_hover_focused_close
=
774 RrAppearanceCopy(theme
->a_hover_focused_max
);
775 theme
->a_hover_unfocused_close
=
776 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
777 theme
->a_unfocused_unpressed_close
=
778 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
779 theme
->a_unfocused_pressed_close
=
780 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
781 theme
->a_focused_unpressed_close
=
782 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
783 theme
->a_focused_pressed_close
=
784 RrAppearanceCopy(theme
->a_focused_pressed_max
);
785 theme
->a_disabled_focused_desk
=
786 RrAppearanceCopy(theme
->a_disabled_focused_max
);
787 theme
->a_disabled_unfocused_desk
=
788 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
789 theme
->a_hover_focused_desk
=
790 RrAppearanceCopy(theme
->a_hover_focused_max
);
791 theme
->a_hover_unfocused_desk
=
792 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
793 theme
->a_toggled_hover_focused_desk
=
794 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
795 theme
->a_toggled_hover_unfocused_desk
=
796 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
797 theme
->a_toggled_focused_unpressed_desk
=
798 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
799 theme
->a_toggled_unfocused_unpressed_desk
=
800 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
801 theme
->a_toggled_focused_pressed_desk
=
802 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
803 theme
->a_toggled_unfocused_pressed_desk
=
804 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
805 theme
->a_unfocused_unpressed_desk
=
806 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
807 theme
->a_unfocused_pressed_desk
=
808 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
809 theme
->a_focused_unpressed_desk
=
810 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
811 theme
->a_focused_pressed_desk
=
812 RrAppearanceCopy(theme
->a_focused_pressed_max
);
813 theme
->a_disabled_focused_shade
=
814 RrAppearanceCopy(theme
->a_disabled_focused_max
);
815 theme
->a_disabled_unfocused_shade
=
816 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
817 theme
->a_hover_focused_shade
=
818 RrAppearanceCopy(theme
->a_hover_focused_max
);
819 theme
->a_hover_unfocused_shade
=
820 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
821 theme
->a_toggled_hover_focused_shade
=
822 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
823 theme
->a_toggled_hover_unfocused_shade
=
824 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
825 theme
->a_toggled_focused_unpressed_shade
=
826 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
827 theme
->a_toggled_unfocused_unpressed_shade
=
828 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
829 theme
->a_toggled_focused_pressed_shade
=
830 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
831 theme
->a_toggled_unfocused_pressed_shade
=
832 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
833 theme
->a_unfocused_unpressed_shade
=
834 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
835 theme
->a_unfocused_pressed_shade
=
836 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
837 theme
->a_focused_unpressed_shade
=
838 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
839 theme
->a_focused_pressed_shade
=
840 RrAppearanceCopy(theme
->a_focused_pressed_max
);
841 theme
->a_disabled_focused_iconify
=
842 RrAppearanceCopy(theme
->a_disabled_focused_max
);
843 theme
->a_disabled_unfocused_iconify
=
844 RrAppearanceCopy(theme
->a_disabled_focused_max
);
845 theme
->a_hover_focused_iconify
=
846 RrAppearanceCopy(theme
->a_hover_focused_max
);
847 theme
->a_hover_unfocused_iconify
=
848 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
849 theme
->a_unfocused_unpressed_iconify
=
850 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
851 theme
->a_unfocused_pressed_iconify
=
852 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
853 theme
->a_focused_unpressed_iconify
=
854 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
855 theme
->a_focused_pressed_iconify
=
856 RrAppearanceCopy(theme
->a_focused_pressed_max
);
858 theme
->a_icon
->surface
.grad
=
859 theme
->a_clear
->surface
.grad
=
860 theme
->a_clear_tex
->surface
.grad
=
861 theme
->a_menu_text_title
->surface
.grad
=
862 theme
->a_menu_normal
->surface
.grad
=
863 theme
->a_menu_disabled
->surface
.grad
=
864 theme
->a_menu_text_normal
->surface
.grad
=
865 theme
->a_menu_text_selected
->surface
.grad
=
866 theme
->a_menu_text_disabled
->surface
.grad
=
867 theme
->a_menu_text_disabled_selected
->surface
.grad
=
868 theme
->a_menu_bullet_normal
->surface
.grad
=
869 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
871 /* set up the textures */
872 theme
->a_focused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
873 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
874 theme
->a_focused_label
->texture
[0].data
.text
.font
=theme
->win_font_focused
;
875 theme
->a_focused_label
->texture
[0].data
.text
.color
=
876 theme
->title_focused_color
;
878 if (read_string(db
, "window.active.label.text.font", &str
)) {
882 if (strstr(str
, "shadow=y")) {
883 if ((p
= strstr(str
, "shadowoffset=")))
884 i
= parse_inline_number(p
+ strlen("shadowoffset="));
887 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
888 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
890 if ((p
= strstr(str
, "shadowtint=")))
892 i
= parse_inline_number(p
+ strlen("shadowtint="));
893 j
= (i
> 0 ? 0 : 255);
896 theme
->title_focused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
897 theme
->title_focused_shadow_alpha
= i
;
899 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
900 theme
->title_focused_shadow_alpha
= 50;
904 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
905 theme
->title_focused_shadow_color
;
906 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
907 theme
->title_focused_shadow_alpha
;
909 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
910 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
911 theme
->osd_hilite_label
->texture
[0].data
.text
.font
= theme
->osd_font
;
912 theme
->osd_hilite_label
->texture
[0].data
.text
.color
= theme
->osd_color
;
914 if (read_string(db
, "osd.label.text.font", &str
)) {
918 if (strstr(str
, "shadow=y")) {
919 if ((p
= strstr(str
, "shadowoffset=")))
920 i
= parse_inline_number(p
+ strlen("shadowoffset="));
923 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
924 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
925 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
926 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
928 if ((p
= strstr(str
, "shadowtint=")))
930 i
= parse_inline_number(p
+ strlen("shadowtint="));
931 j
= (i
> 0 ? 0 : 255);
934 theme
->osd_shadow_color
= RrColorNew(inst
, j
, j
, j
);
935 theme
->osd_shadow_alpha
= i
;
937 theme
->osd_shadow_color
= RrColorNew(inst
, 0, 0, 0);
938 theme
->osd_shadow_alpha
= 50;
941 /* inherit the font settings from the focused label */
942 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
943 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
944 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
945 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
946 if (theme
->title_focused_shadow_color
)
947 theme
->osd_shadow_color
=
949 theme
->title_focused_shadow_color
->r
,
950 theme
->title_focused_shadow_color
->g
,
951 theme
->title_focused_shadow_color
->b
);
953 theme
->osd_shadow_color
= RrColorNew(inst
, 0, 0, 0);
954 theme
->osd_shadow_alpha
= theme
->title_focused_shadow_alpha
;
957 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
958 theme
->osd_shadow_color
;
959 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
960 theme
->osd_shadow_alpha
;
962 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
963 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
964 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
965 theme
->win_font_unfocused
;
966 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
967 theme
->title_unfocused_color
;
969 if (read_string(db
, "window.inactive.label.text.font", &str
)) {
973 if (strstr(str
, "shadow=y")) {
974 if ((p
= strstr(str
, "shadowoffset=")))
975 i
= parse_inline_number(p
+ strlen("shadowoffset="));
978 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
979 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
981 if ((p
= strstr(str
, "shadowtint=")))
983 i
= parse_inline_number(p
+ strlen("shadowtint="));
984 j
= (i
> 0 ? 0 : 255);
987 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
988 theme
->title_unfocused_shadow_alpha
= i
;
990 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
991 theme
->title_unfocused_shadow_alpha
= 50;
995 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
996 theme
->title_unfocused_shadow_color
;
997 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
998 theme
->title_unfocused_shadow_alpha
;
1000 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
1001 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
1002 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
1003 theme
->menu_title_font
;
1004 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
1005 theme
->menu_title_color
;
1007 if (read_string(db
, "menu.title.text.font", &str
)) {
1011 if (strstr(str
, "shadow=y")) {
1012 if ((p
= strstr(str
, "shadowoffset=")))
1013 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1016 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
= i
;
1017 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= i
;
1019 if ((p
= strstr(str
, "shadowtint=")))
1021 i
= parse_inline_number(p
+ strlen("shadowtint="));
1022 j
= (i
> 0 ? 0 : 255);
1025 theme
->menu_title_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1026 theme
->menu_title_shadow_alpha
= i
;
1028 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1029 theme
->menu_title_shadow_alpha
= 50;
1033 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
1034 theme
->menu_title_shadow_color
;
1035 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
1036 theme
->menu_title_shadow_alpha
;
1038 theme
->a_menu_text_normal
->texture
[0].type
=
1039 theme
->a_menu_text_selected
->texture
[0].type
=
1040 theme
->a_menu_text_disabled
->texture
[0].type
=
1041 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
1043 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
1044 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
1045 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
1046 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
1048 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
1049 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
1050 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
1051 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
1053 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
1054 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
1055 theme
->menu_selected_color
;
1056 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
1057 theme
->menu_disabled_color
;
1058 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
1059 theme
->menu_disabled_selected_color
;
1061 if (read_string(db
, "menu.items.font", &str
)) {
1065 if (strstr(str
, "shadow=y")) {
1066 if ((p
= strstr(str
, "shadowoffset=")))
1067 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1070 theme
->a_menu_text_normal
->
1071 texture
[0].data
.text
.shadow_offset_x
= i
;
1072 theme
->a_menu_text_normal
->
1073 texture
[0].data
.text
.shadow_offset_y
= i
;
1074 theme
->a_menu_text_selected
->
1075 texture
[0].data
.text
.shadow_offset_x
= i
;
1076 theme
->a_menu_text_selected
->
1077 texture
[0].data
.text
.shadow_offset_y
= i
;
1078 theme
->a_menu_text_disabled
->
1079 texture
[0].data
.text
.shadow_offset_x
= i
;
1080 theme
->a_menu_text_disabled
->
1081 texture
[0].data
.text
.shadow_offset_y
= i
;
1082 theme
->a_menu_text_disabled_selected
->
1083 texture
[0].data
.text
.shadow_offset_x
= i
;
1084 theme
->a_menu_text_disabled_selected
->
1085 texture
[0].data
.text
.shadow_offset_y
= i
;
1087 if ((p
= strstr(str
, "shadowtint=")))
1089 i
= parse_inline_number(p
+ strlen("shadowtint="));
1090 j
= (i
> 0 ? 0 : 255);
1093 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1094 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1095 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1096 theme
->menu_text_normal_shadow_alpha
= i
;
1097 theme
->menu_text_selected_shadow_alpha
= i
;
1098 theme
->menu_text_disabled_shadow_alpha
= i
;
1099 theme
->menu_text_disabled_selected_shadow_alpha
= i
;
1101 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1102 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1103 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1104 theme
->menu_text_normal_shadow_alpha
= 50;
1105 theme
->menu_text_selected_shadow_alpha
= 50;
1106 theme
->menu_text_disabled_selected_shadow_alpha
= 50;
1110 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
1111 theme
->menu_text_normal_shadow_color
;
1112 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
1113 theme
->menu_text_normal_shadow_alpha
;
1114 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
1115 theme
->menu_text_selected_shadow_color
;
1116 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
1117 theme
->menu_text_selected_shadow_alpha
;
1118 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
1119 theme
->menu_text_disabled_shadow_color
;
1120 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
1121 theme
->menu_text_disabled_shadow_alpha
;
1122 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
1123 theme
->menu_text_disabled_shadow_color
;
1124 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
1125 theme
->menu_text_disabled_shadow_alpha
;
1127 theme
->a_disabled_focused_max
->texture
[0].type
=
1128 theme
->a_disabled_unfocused_max
->texture
[0].type
=
1129 theme
->a_hover_focused_max
->texture
[0].type
=
1130 theme
->a_hover_unfocused_max
->texture
[0].type
=
1131 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
1132 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
1133 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
1134 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
1135 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
1136 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
1137 theme
->a_focused_unpressed_max
->texture
[0].type
=
1138 theme
->a_focused_pressed_max
->texture
[0].type
=
1139 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
1140 theme
->a_unfocused_pressed_max
->texture
[0].type
=
1141 theme
->a_disabled_focused_close
->texture
[0].type
=
1142 theme
->a_disabled_unfocused_close
->texture
[0].type
=
1143 theme
->a_hover_focused_close
->texture
[0].type
=
1144 theme
->a_hover_unfocused_close
->texture
[0].type
=
1145 theme
->a_focused_unpressed_close
->texture
[0].type
=
1146 theme
->a_focused_pressed_close
->texture
[0].type
=
1147 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
1148 theme
->a_unfocused_pressed_close
->texture
[0].type
=
1149 theme
->a_disabled_focused_desk
->texture
[0].type
=
1150 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
1151 theme
->a_hover_focused_desk
->texture
[0].type
=
1152 theme
->a_hover_unfocused_desk
->texture
[0].type
=
1153 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
1154 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
1155 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
1156 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
1157 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
1158 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
1159 theme
->a_focused_unpressed_desk
->texture
[0].type
=
1160 theme
->a_focused_pressed_desk
->texture
[0].type
=
1161 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
1162 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
1163 theme
->a_disabled_focused_shade
->texture
[0].type
=
1164 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
1165 theme
->a_hover_focused_shade
->texture
[0].type
=
1166 theme
->a_hover_unfocused_shade
->texture
[0].type
=
1167 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
1168 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
1169 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
1170 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
1171 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
1172 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
1173 theme
->a_focused_unpressed_shade
->texture
[0].type
=
1174 theme
->a_focused_pressed_shade
->texture
[0].type
=
1175 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
1176 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
1177 theme
->a_disabled_focused_iconify
->texture
[0].type
=
1178 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
1179 theme
->a_hover_focused_iconify
->texture
[0].type
=
1180 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
1181 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
1182 theme
->a_focused_pressed_iconify
->texture
[0].type
=
1183 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
1184 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
1185 theme
->a_menu_bullet_normal
->texture
[0].type
=
1186 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
1188 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
1189 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
1190 theme
->max_disabled_mask
;
1191 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
1192 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1193 theme
->max_hover_mask
;
1194 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1195 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1196 theme
->max_pressed_mask
;
1197 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1198 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1200 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
1201 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1202 theme
->max_toggled_hover_mask
;
1203 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1204 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1205 theme
->max_toggled_mask
;
1206 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1207 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1208 theme
->max_toggled_pressed_mask
;
1209 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
1210 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
1211 theme
->close_disabled_mask
;
1212 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
1213 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
1214 theme
->close_hover_mask
;
1215 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
1216 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
1217 theme
->close_pressed_mask
;
1218 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
1219 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
1221 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
1222 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
1223 theme
->desk_disabled_mask
;
1224 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1225 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1226 theme
->desk_hover_mask
;
1227 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1228 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1229 theme
->desk_pressed_mask
;
1230 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1231 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1233 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1234 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1235 theme
->desk_toggled_hover_mask
;
1236 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1237 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1238 theme
->desk_toggled_mask
;
1239 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1240 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1241 theme
->desk_toggled_pressed_mask
;
1242 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1243 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1244 theme
->shade_disabled_mask
;
1245 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1246 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1247 theme
->shade_hover_mask
;
1248 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1249 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1250 theme
->shade_pressed_mask
;
1251 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1252 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1254 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1255 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1256 theme
->shade_toggled_hover_mask
;
1257 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1258 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1259 theme
->shade_toggled_mask
;
1260 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1261 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1262 theme
->shade_toggled_pressed_mask
;
1263 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1264 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1265 theme
->iconify_disabled_mask
;
1266 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1267 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1268 theme
->iconify_hover_mask
;
1269 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1270 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1271 theme
->iconify_pressed_mask
;
1272 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1273 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1274 theme
->iconify_mask
;
1275 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1276 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1277 theme
->menu_bullet_mask
;
1278 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1279 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1280 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1281 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1282 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1283 theme
->titlebut_disabled_focused_color
;
1284 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1285 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1286 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1287 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1288 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1289 theme
->titlebut_disabled_unfocused_color
;
1290 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1291 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1292 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1293 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1294 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1295 theme
->titlebut_hover_focused_color
;
1296 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1297 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1298 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1299 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1300 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1301 theme
->titlebut_hover_unfocused_color
;
1302 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1303 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1304 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1305 theme
->titlebut_toggled_hover_focused_color
;
1306 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1307 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1308 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1309 theme
->titlebut_toggled_hover_unfocused_color
;
1310 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1311 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1312 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1313 theme
->titlebut_toggled_focused_unpressed_color
;
1314 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1315 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1316 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1317 theme
->titlebut_toggled_unfocused_unpressed_color
;
1318 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1319 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1320 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1321 theme
->titlebut_toggled_focused_pressed_color
;
1322 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1323 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1324 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1325 theme
->titlebut_toggled_unfocused_pressed_color
;
1326 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1327 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1328 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1329 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1330 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1331 theme
->titlebut_focused_unpressed_color
;
1332 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1333 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1334 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1335 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1336 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1337 theme
->titlebut_focused_pressed_color
;
1338 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1339 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1340 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1341 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1342 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1343 theme
->titlebut_unfocused_unpressed_color
;
1344 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1345 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1346 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1347 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1348 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1349 theme
->titlebut_unfocused_pressed_color
;
1350 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1352 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1353 theme
->menu_selected_color
;
1356 XrmDestroyDatabase(db
);
1358 /* set the font heights */
1359 theme
->win_font_height
= RrFontHeight
1360 (theme
->win_font_focused
,
1361 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
);
1362 theme
->win_font_height
=
1363 MAX(theme
->win_font_height
,
1365 (theme
->win_font_focused
,
1366 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
));
1367 theme
->menu_title_font_height
= RrFontHeight
1368 (theme
->menu_title_font
,
1369 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
);
1370 theme
->menu_font_height
= RrFontHeight
1372 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
);
1374 /* calculate some last extents */
1376 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1378 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1379 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1380 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1381 theme
->label_height
+= theme
->label_height
% 2;
1383 /* this would be nice I think, since padding.width can now be 0,
1384 but it breaks frame.c horribly and I don't feel like fixing that
1385 right now, so if anyone complains, here is how to keep text from
1386 going over the title's bevel/border with a padding.width of 0 and a
1387 bevelless/borderless label
1388 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1389 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1390 theme->title_height = theme->label_height +
1391 MAX(MAX(theme->padding * 2, ft + fb),
1392 MAX(theme->padding * 2, ut + ub));
1394 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1396 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1397 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1398 theme
->menu_title_height
= theme
->menu_title_label_height
+
1399 theme
->paddingy
* 2;
1401 theme
->button_size
= theme
->label_height
- 2;
1402 theme
->grip_width
= 25;
1407 void RrThemeFree(RrTheme
*theme
)
1410 g_free(theme
->name
);
1412 RrColorFree(theme
->menu_border_color
);
1413 RrColorFree(theme
->osd_border_color
);
1414 RrColorFree(theme
->frame_focused_border_color
);
1415 RrColorFree(theme
->frame_unfocused_border_color
);
1416 RrColorFree(theme
->title_separator_focused_color
);
1417 RrColorFree(theme
->title_separator_unfocused_color
);
1418 RrColorFree(theme
->cb_unfocused_color
);
1419 RrColorFree(theme
->cb_focused_color
);
1420 RrColorFree(theme
->title_focused_color
);
1421 RrColorFree(theme
->title_unfocused_color
);
1422 RrColorFree(theme
->titlebut_disabled_focused_color
);
1423 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1424 RrColorFree(theme
->titlebut_hover_focused_color
);
1425 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1426 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1427 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1428 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1429 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1430 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1431 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1432 RrColorFree(theme
->titlebut_focused_pressed_color
);
1433 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1434 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1435 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1436 RrColorFree(theme
->menu_title_color
);
1437 RrColorFree(theme
->menu_sep_color
);
1438 RrColorFree(theme
->menu_color
);
1439 RrColorFree(theme
->menu_selected_color
);
1440 RrColorFree(theme
->menu_disabled_color
);
1441 RrColorFree(theme
->menu_disabled_selected_color
);
1442 RrColorFree(theme
->title_focused_shadow_color
);
1443 RrColorFree(theme
->title_unfocused_shadow_color
);
1444 RrColorFree(theme
->osd_color
);
1445 RrColorFree(theme
->osd_shadow_color
);
1446 RrColorFree(theme
->menu_title_shadow_color
);
1447 RrColorFree(theme
->menu_text_normal_shadow_color
);
1448 RrColorFree(theme
->menu_text_selected_shadow_color
);
1449 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1450 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1452 g_free(theme
->def_win_icon
);
1454 RrPixmapMaskFree(theme
->max_mask
);
1455 RrPixmapMaskFree(theme
->max_toggled_mask
);
1456 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1457 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1458 RrPixmapMaskFree(theme
->max_disabled_mask
);
1459 RrPixmapMaskFree(theme
->max_hover_mask
);
1460 RrPixmapMaskFree(theme
->max_pressed_mask
);
1461 RrPixmapMaskFree(theme
->desk_mask
);
1462 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1463 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1464 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1465 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1466 RrPixmapMaskFree(theme
->desk_hover_mask
);
1467 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1468 RrPixmapMaskFree(theme
->shade_mask
);
1469 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1470 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1471 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1472 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1473 RrPixmapMaskFree(theme
->shade_hover_mask
);
1474 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1475 RrPixmapMaskFree(theme
->iconify_mask
);
1476 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1477 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1478 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1479 RrPixmapMaskFree(theme
->close_mask
);
1480 RrPixmapMaskFree(theme
->close_disabled_mask
);
1481 RrPixmapMaskFree(theme
->close_hover_mask
);
1482 RrPixmapMaskFree(theme
->close_pressed_mask
);
1483 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1484 RrPixmapMaskFree(theme
->down_arrow_mask
);
1485 RrPixmapMaskFree(theme
->up_arrow_mask
);
1487 RrFontClose(theme
->win_font_focused
);
1488 RrFontClose(theme
->win_font_unfocused
);
1489 RrFontClose(theme
->menu_title_font
);
1490 RrFontClose(theme
->menu_font
);
1491 RrFontClose(theme
->osd_font
);
1493 RrAppearanceFree(theme
->a_disabled_focused_max
);
1494 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1495 RrAppearanceFree(theme
->a_hover_focused_max
);
1496 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1497 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1498 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1499 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1500 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1501 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1502 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1503 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1504 RrAppearanceFree(theme
->a_focused_pressed_max
);
1505 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1506 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1507 RrAppearanceFree(theme
->a_disabled_focused_close
);
1508 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1509 RrAppearanceFree(theme
->a_hover_focused_close
);
1510 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1511 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1512 RrAppearanceFree(theme
->a_focused_pressed_close
);
1513 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1514 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1515 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1516 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1517 RrAppearanceFree(theme
->a_hover_focused_desk
);
1518 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1519 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1520 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1521 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1522 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1523 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1524 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1525 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1526 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1527 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1528 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1529 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1530 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1531 RrAppearanceFree(theme
->a_hover_focused_shade
);
1532 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1533 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1534 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1535 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1536 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1537 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1538 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1539 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1540 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1541 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1542 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1543 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1544 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1545 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1546 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1547 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1548 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1549 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1550 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1551 RrAppearanceFree(theme
->a_focused_grip
);
1552 RrAppearanceFree(theme
->a_unfocused_grip
);
1553 RrAppearanceFree(theme
->a_focused_title
);
1554 RrAppearanceFree(theme
->a_unfocused_title
);
1555 RrAppearanceFree(theme
->a_focused_label
);
1556 RrAppearanceFree(theme
->a_unfocused_label
);
1557 RrAppearanceFree(theme
->a_icon
);
1558 RrAppearanceFree(theme
->a_focused_handle
);
1559 RrAppearanceFree(theme
->a_unfocused_handle
);
1560 RrAppearanceFree(theme
->a_menu
);
1561 RrAppearanceFree(theme
->a_menu_title
);
1562 RrAppearanceFree(theme
->a_menu_text_title
);
1563 RrAppearanceFree(theme
->a_menu_normal
);
1564 RrAppearanceFree(theme
->a_menu_selected
);
1565 RrAppearanceFree(theme
->a_menu_disabled
);
1566 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1567 RrAppearanceFree(theme
->a_menu_text_normal
);
1568 RrAppearanceFree(theme
->a_menu_text_selected
);
1569 RrAppearanceFree(theme
->a_menu_text_disabled
);
1570 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1571 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1572 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1573 RrAppearanceFree(theme
->a_clear
);
1574 RrAppearanceFree(theme
->a_clear_tex
);
1575 RrAppearanceFree(theme
->osd_hilite_bg
);
1576 RrAppearanceFree(theme
->osd_hilite_fg
);
1577 RrAppearanceFree(theme
->osd_hilite_label
);
1578 RrAppearanceFree(theme
->osd_unhilite_fg
);
1584 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
)
1587 XrmDatabase db
= NULL
;
1590 if (name
[0] == '/') {
1591 s
= g_build_filename(name
, "openbox-3", "themerc", NULL
);
1592 if ((db
= XrmGetFileDatabase(s
)))
1593 *path
= g_path_get_dirname(s
);
1598 p
= obt_paths_new();
1600 /* XXX backwards compatibility, remove me sometime later */
1601 s
= g_build_filename(g_get_home_dir(), ".themes", name
,
1602 "openbox-3", "themerc", NULL
);
1603 if ((db
= XrmGetFileDatabase(s
)))
1604 *path
= g_path_get_dirname(s
);
1607 for (it
= obt_paths_data_dirs(p
); !db
&& it
; it
= g_slist_next(it
))
1609 s
= g_build_filename(it
->data
, "themes", name
,
1610 "openbox-3", "themerc", NULL
);
1611 if ((db
= XrmGetFileDatabase(s
)))
1612 *path
= g_path_get_dirname(s
);
1620 s
= g_build_filename(name
, "themerc", NULL
);
1621 if ((db
= XrmGetFileDatabase(s
)))
1622 *path
= g_path_get_dirname(s
);
1629 static gchar
*create_class_name(const gchar
*rname
)
1631 gchar
*rclass
= g_strdup(rname
);
1636 p
= strchr(p
+1, '.');
1637 if (p
== NULL
) break;
1639 if (*p
== '\0') break;
1644 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
)
1646 gboolean ret
= FALSE
;
1647 gchar
*rclass
= create_class_name(rname
);
1648 gchar
*rettype
, *end
;
1651 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1652 retvalue
.addr
!= NULL
) {
1653 *value
= (gint
)strtol(retvalue
.addr
, &end
, 10);
1654 if (end
!= retvalue
.addr
)
1662 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
)
1664 gboolean ret
= FALSE
;
1665 gchar
*rclass
= create_class_name(rname
);
1669 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1670 retvalue
.addr
!= NULL
) {
1671 *value
= retvalue
.addr
;
1679 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
1680 const gchar
*rname
, RrColor
**value
)
1682 gboolean ret
= FALSE
;
1683 gchar
*rclass
= create_class_name(rname
);
1687 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1688 retvalue
.addr
!= NULL
) {
1689 RrColor
*c
= RrColorParse(inst
, retvalue
.addr
);
1700 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
1701 RrTheme
*theme
, const gchar
*maskname
,
1702 RrPixmapMask
**value
)
1704 gboolean ret
= FALSE
;
1706 gint hx
, hy
; /* ignored */
1710 s
= g_build_filename(path
, maskname
, NULL
);
1711 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1713 *value
= RrPixmapMaskNew(inst
, w
, h
, (gchar
*)b
);
1721 static void parse_appearance(gchar
*tex
, RrSurfaceColorType
*grad
,
1722 RrReliefType
*relief
, RrBevelType
*bevel
,
1723 gboolean
*interlaced
, gboolean
*border
,
1724 gboolean allow_trans
)
1728 /* convert to all lowercase */
1729 for (t
= tex
; *t
!= '\0'; ++t
)
1730 *t
= g_ascii_tolower(*t
);
1732 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1733 *grad
= RR_SURFACE_PARENTREL
;
1735 if (strstr(tex
, "gradient") != NULL
) {
1736 if (strstr(tex
, "crossdiagonal") != NULL
)
1737 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1738 else if (strstr(tex
, "pyramid") != NULL
)
1739 *grad
= RR_SURFACE_PYRAMID
;
1740 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1741 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1742 else if (strstr(tex
, "horizontal") != NULL
)
1743 *grad
= RR_SURFACE_HORIZONTAL
;
1744 else if (strstr(tex
, "splitvertical") != NULL
)
1745 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1746 else if (strstr(tex
, "vertical") != NULL
)
1747 *grad
= RR_SURFACE_VERTICAL
;
1749 *grad
= RR_SURFACE_DIAGONAL
;
1751 *grad
= RR_SURFACE_SOLID
;
1755 if (strstr(tex
, "sunken") != NULL
)
1756 *relief
= RR_RELIEF_SUNKEN
;
1757 else if (strstr(tex
, "flat") != NULL
)
1758 *relief
= RR_RELIEF_FLAT
;
1759 else if (strstr(tex
, "raised") != NULL
)
1760 *relief
= RR_RELIEF_RAISED
;
1762 *relief
= (*grad
== RR_SURFACE_PARENTREL
) ?
1763 RR_RELIEF_FLAT
: RR_RELIEF_RAISED
;
1766 if (*relief
== RR_RELIEF_FLAT
) {
1767 if (strstr(tex
, "border") != NULL
)
1770 if (strstr(tex
, "bevel2") != NULL
)
1771 *bevel
= RR_BEVEL_2
;
1773 *bevel
= RR_BEVEL_1
;
1776 if (strstr(tex
, "interlaced") != NULL
)
1779 *interlaced
= FALSE
;
1782 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
1783 const gchar
*rname
, RrAppearance
*value
,
1784 gboolean allow_trans
)
1786 gboolean ret
= FALSE
;
1787 gchar
*rclass
= create_class_name(rname
);
1788 gchar
*cname
, *ctoname
, *bcname
, *icname
, *hname
, *sname
;
1789 gchar
*csplitname
, *ctosplitname
;
1794 cname
= g_strconcat(rname
, ".color", NULL
);
1795 ctoname
= g_strconcat(rname
, ".colorTo", NULL
);
1796 bcname
= g_strconcat(rname
, ".border.color", NULL
);
1797 icname
= g_strconcat(rname
, ".interlace.color", NULL
);
1798 hname
= g_strconcat(rname
, ".highlight", NULL
);
1799 sname
= g_strconcat(rname
, ".shadow", NULL
);
1800 csplitname
= g_strconcat(rname
, ".color.splitTo", NULL
);
1801 ctosplitname
= g_strconcat(rname
, ".colorTo.splitTo", NULL
);
1803 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1804 retvalue
.addr
!= NULL
) {
1805 parse_appearance(retvalue
.addr
,
1806 &value
->surface
.grad
,
1807 &value
->surface
.relief
,
1808 &value
->surface
.bevel
,
1809 &value
->surface
.interlaced
,
1810 &value
->surface
.border
,
1812 if (!read_color(db
, inst
, cname
, &value
->surface
.primary
))
1813 value
->surface
.primary
= RrColorNew(inst
, 0, 0, 0);
1814 if (!read_color(db
, inst
, ctoname
, &value
->surface
.secondary
))
1815 value
->surface
.secondary
= RrColorNew(inst
, 0, 0, 0);
1816 if (value
->surface
.border
)
1817 if (!read_color(db
, inst
, bcname
,
1818 &value
->surface
.border_color
))
1819 value
->surface
.border_color
= RrColorNew(inst
, 0, 0, 0);
1820 if (value
->surface
.interlaced
)
1821 if (!read_color(db
, inst
, icname
,
1822 &value
->surface
.interlace_color
))
1823 value
->surface
.interlace_color
= RrColorNew(inst
, 0, 0, 0);
1824 if (read_int(db
, hname
, &i
) && i
>= 0)
1825 value
->surface
.bevel_light_adjust
= i
;
1826 if (read_int(db
, sname
, &i
) && i
>= 0 && i
<= 256)
1827 value
->surface
.bevel_dark_adjust
= i
;
1829 if (value
->surface
.grad
== RR_SURFACE_SPLIT_VERTICAL
) {
1832 if (!read_color(db
, inst
, csplitname
,
1833 &value
->surface
.split_primary
))
1835 r
= value
->surface
.primary
->r
;
1837 g
= value
->surface
.primary
->g
;
1839 b
= value
->surface
.primary
->b
;
1841 if (r
> 0xFF) r
= 0xFF;
1842 if (g
> 0xFF) g
= 0xFF;
1843 if (b
> 0xFF) b
= 0xFF;
1844 value
->surface
.split_primary
= RrColorNew(inst
, r
, g
, b
);
1847 if (!read_color(db
, inst
, ctosplitname
,
1848 &value
->surface
.split_secondary
))
1850 r
= value
->surface
.secondary
->r
;
1852 g
= value
->surface
.secondary
->g
;
1854 b
= value
->surface
.secondary
->b
;
1856 if (r
> 0xFF) r
= 0xFF;
1857 if (g
> 0xFF) g
= 0xFF;
1858 if (b
> 0xFF) b
= 0xFF;
1859 value
->surface
.split_secondary
= RrColorNew(inst
, r
, g
, b
);
1866 g_free(ctosplitname
);
1878 static int parse_inline_number(const char *p
)
1886 for (; isdigit(*p
); ++p
)
1887 res
= res
* 10 + *p
- '0';
1892 static void set_default_appearance(RrAppearance
*a
)
1894 a
->surface
.grad
= RR_SURFACE_SOLID
;
1895 a
->surface
.relief
= RR_RELIEF_FLAT
;
1896 a
->surface
.bevel
= RR_BEVEL_1
;
1897 a
->surface
.interlaced
= FALSE
;
1898 a
->surface
.border
= FALSE
;
1899 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1900 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1903 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1904 an RrTextureRGBA. */
1905 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1910 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1912 for (i
= 0; i
< width
* height
; ++i
) {
1913 guchar a
= ((*p
>> 24) & 0xff);
1914 guchar b
= ((*p
>> 16) & 0xff);
1915 guchar g
= ((*p
>> 8) & 0xff);
1916 guchar r
= ((*p
>> 0) & 0xff);
1918 *p
= ((r
<< RrDefaultRedOffset
) +
1919 (g
<< RrDefaultGreenOffset
) +
1920 (b
<< RrDefaultBlueOffset
) +
1921 (a
<< RrDefaultAlphaOffset
));