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 static RrFont
*get_font(RrFont
*target
, RrFont
**default_font
,
50 const RrInstance
*inst
)
56 /* Only load the default font once */
58 RrFontRef(*default_font
);
60 *default_font
= RrFontOpenDefault(inst
);
66 #define READ_INT(x_resstr, x_var, x_min, x_max, x_def) \
67 if (!read_int(db, x_resstr, & x_var) || \
68 x_var < x_min || x_var > x_max) \
71 #define READ_COLOR(x_resstr, x_var, x_def) \
72 if (!read_color(db, inst, x_resstr, & x_var)) \
75 #define READ_COLOR_(x_res1, x_res2, x_var, x_def) \
76 if (!read_color(db, inst, x_res1, & x_var) && \
77 !read_color(db, inst, x_res2, & x_var)) \
80 RrTheme
* RrThemeNew(const RrInstance
*inst
, const gchar
*name
,
81 gboolean allow_fallback
,
82 RrFont
*active_window_font
, RrFont
*inactive_window_font
,
83 RrFont
*menu_title_font
, RrFont
*menu_item_font
,
84 RrFont
*active_osd_font
, RrFont
*inactive_osd_font
)
86 XrmDatabase db
= NULL
;
87 RrJustify winjust
, mtitlejust
;
90 RrFont
*default_font
= NULL
;
95 db
= loaddb(name
, &path
);
97 g_message("Unable to load the theme '%s'", name
);
99 g_message("Falling back to the default theme '%s'",
101 /* fallback to the default theme */
106 if (allow_fallback
) {
107 db
= loaddb(DEFAULT_THEME
, &path
);
109 g_message("Unable to load the theme '%s'", DEFAULT_THEME
);
116 theme
= g_slice_new0(RrTheme
);
119 theme
->name
= g_strdup(name
? name
: DEFAULT_THEME
);
121 theme
->a_disabled_focused_max
= RrAppearanceNew(inst
, 1);
122 theme
->a_disabled_unfocused_max
= RrAppearanceNew(inst
, 1);
123 theme
->a_hover_focused_max
= RrAppearanceNew(inst
, 1);
124 theme
->a_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
125 theme
->a_toggled_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
126 theme
->a_toggled_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
127 theme
->a_toggled_hover_focused_max
= RrAppearanceNew(inst
, 1);
128 theme
->a_toggled_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
129 theme
->a_toggled_focused_pressed_max
= RrAppearanceNew(inst
, 1);
130 theme
->a_toggled_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
131 theme
->a_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
132 theme
->a_focused_pressed_max
= RrAppearanceNew(inst
, 1);
133 theme
->a_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
134 theme
->a_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
135 theme
->a_focused_grip
= RrAppearanceNew(inst
, 0);
136 theme
->a_unfocused_grip
= RrAppearanceNew(inst
, 0);
137 theme
->a_focused_title
= RrAppearanceNew(inst
, 0);
138 theme
->a_unfocused_title
= RrAppearanceNew(inst
, 0);
139 theme
->a_focused_label
= RrAppearanceNew(inst
, 1);
140 theme
->a_unfocused_label
= RrAppearanceNew(inst
, 1);
141 theme
->a_icon
= RrAppearanceNew(inst
, 1);
142 theme
->a_focused_handle
= RrAppearanceNew(inst
, 0);
143 theme
->a_unfocused_handle
= RrAppearanceNew(inst
, 0);
144 theme
->a_menu
= RrAppearanceNew(inst
, 0);
145 theme
->a_menu_title
= RrAppearanceNew(inst
, 0);
146 theme
->a_menu_text_title
= RrAppearanceNew(inst
, 1);
147 theme
->a_menu_normal
= RrAppearanceNew(inst
, 0);
148 theme
->a_menu_selected
= RrAppearanceNew(inst
, 0);
149 theme
->a_menu_disabled
= RrAppearanceNew(inst
, 0);
150 /* a_menu_disabled_selected is copied from a_menu_selected */
151 theme
->a_menu_text_normal
= RrAppearanceNew(inst
, 1);
152 theme
->a_menu_text_selected
= RrAppearanceNew(inst
, 1);
153 theme
->a_menu_text_disabled
= RrAppearanceNew(inst
, 1);
154 theme
->a_menu_text_disabled_selected
= RrAppearanceNew(inst
, 1);
155 theme
->a_menu_bullet_normal
= RrAppearanceNew(inst
, 1);
156 theme
->a_menu_bullet_selected
= RrAppearanceNew(inst
, 1);
157 theme
->a_clear
= RrAppearanceNew(inst
, 0);
158 theme
->a_clear_tex
= RrAppearanceNew(inst
, 1);
159 theme
->osd_bg
= RrAppearanceNew(inst
, 0);
160 theme
->osd_hilite_label
= RrAppearanceNew(inst
, 1);
161 theme
->osd_hilite_bg
= RrAppearanceNew(inst
, 0);
162 theme
->osd_unhilite_label
= RrAppearanceNew(inst
, 1);
163 theme
->osd_unhilite_bg
= RrAppearanceNew(inst
, 0);
165 /* load the font stuff */
166 theme
->win_font_focused
= get_font(active_window_font
,
167 &default_font
, inst
);
168 theme
->win_font_unfocused
= get_font(inactive_window_font
,
169 &default_font
, inst
);
171 winjust
= RR_JUSTIFY_LEFT
;
172 if (read_string(db
, "window.label.text.justify", &str
)) {
173 if (!g_ascii_strcasecmp(str
, "right"))
174 winjust
= RR_JUSTIFY_RIGHT
;
175 else if (!g_ascii_strcasecmp(str
, "center"))
176 winjust
= RR_JUSTIFY_CENTER
;
179 theme
->menu_title_font
= get_font(menu_title_font
, &default_font
, inst
);
181 mtitlejust
= RR_JUSTIFY_LEFT
;
182 if (read_string(db
, "menu.title.text.justify", &str
)) {
183 if (!g_ascii_strcasecmp(str
, "right"))
184 mtitlejust
= RR_JUSTIFY_RIGHT
;
185 else if (!g_ascii_strcasecmp(str
, "center"))
186 mtitlejust
= RR_JUSTIFY_CENTER
;
189 theme
->menu_font
= get_font(menu_item_font
, &default_font
, inst
);
191 theme
->osd_font_hilite
= get_font(active_osd_font
, &default_font
, inst
);
192 theme
->osd_font_unhilite
= get_font(inactive_osd_font
, &default_font
,inst
);
194 /* load direct dimensions */
196 /* TODO: Need fallback for menu.overlap */
197 READ_INT("menu.overlap.x", theme
->menu_overlap_x
, -100, 100, 0);
198 READ_INT("menu.overlap.y", theme
->menu_overlap_y
, -100, 100, 0);
199 READ_INT("window.handle.width", theme
->handle_height
, 0, 100, 6);
200 READ_INT("padding.width", theme
->paddingx
, 0, 100, 3);
201 READ_INT("padding.height", theme
->paddingy
, 0, 100, theme
->paddingx
);
202 READ_INT("border.width", theme
->fbwidth
, 0, 100, 1);
203 READ_INT("menu.border.width", theme
->mbwidth
, 0, 100, theme
->fbwidth
);
204 READ_INT("osd.border.width", theme
->obwidth
, 0, 100, theme
->fbwidth
);
205 READ_INT("window.client.padding.width", theme
->cbwidthx
, 0, 100, theme
->paddingx
);
206 READ_INT("window.client.padding.height", theme
->cbwidthy
, 0, 100, theme
->cbwidthx
);
207 READ_INT("menu.separator.width", theme
->menu_sep_width
, 1, 100, 1);
208 READ_INT("menu.separator.padding.width", theme
->menu_sep_paddingx
, 0, 100, 6);
209 READ_INT("menu.separator.padding.height", theme
->menu_sep_paddingy
, 0, 100, 3);
210 READ_INT("window.client.padding.width", theme
->cbwidthx
, 0, 100,
212 READ_INT("window.client.padding.height", theme
->cbwidthy
, 0, 100,
216 READ_COLOR_("window.active.border.color", "border.color",
217 theme
->frame_focused_border_color
, RrColorNew(inst
, 0, 0, 0));
219 /* title separator focused color inherits from focused border color */
220 READ_COLOR("window.active.title.separator.color",
221 theme
->title_separator_focused_color
,
222 RrColorCopy(theme
->frame_focused_border_color
));
224 /* unfocused border color inherits from frame focused border color */
225 READ_COLOR("window.inactive.border.color",
226 theme
->frame_unfocused_border_color
,
227 RrColorCopy(theme
->frame_focused_border_color
));
229 /* title separator unfocused color inherits from unfocused border color */
230 READ_COLOR("window.inactive.title.separator.color",
231 theme
->title_separator_unfocused_color
,
232 RrColorCopy(theme
->frame_unfocused_border_color
));
234 /* menu border color inherits from frame focused border color */
235 READ_COLOR("menu.border.color", theme
->menu_border_color
,
236 RrColorCopy(theme
->frame_focused_border_color
));
238 /* osd border color inherits from frame focused border color */
239 READ_COLOR("osd.border.color", theme
->osd_border_color
,
240 RrColorCopy(theme
->frame_focused_border_color
));
242 READ_COLOR("window.active.client.color", theme
->cb_focused_color
,
243 RrColorNew(inst
, 0xff, 0xff, 0xff));
245 READ_COLOR("window.inactive.client.color", theme
->cb_unfocused_color
,
246 RrColorNew(inst
, 0xff, 0xff, 0xff));
248 READ_COLOR("window.active.label.text.color", theme
->title_focused_color
,
249 RrColorNew(inst
, 0x0, 0x0, 0x0));
251 READ_COLOR_("osd.active.label.text.color",
252 "osd.label.text.color",
253 theme
->osd_color
, RrColorCopy(theme
->title_focused_color
));
255 READ_COLOR("window.inactive.label.text.color", theme
->title_unfocused_color
,
256 RrColorCopy(theme
->title_unfocused_color
));
258 READ_COLOR("osd.inactive.label.text.color", theme
->osd_text_inactive_color
,
259 RrColorNew(inst
, 0xff, 0xff, 0xff));
261 READ_COLOR("window.active.button.unpressed.image.color",
262 theme
->titlebut_focused_unpressed_color
,
263 RrColorNew(inst
, 0, 0, 0));
265 READ_COLOR("window.inactive.button.unpressed.image.color",
266 theme
->titlebut_unfocused_unpressed_color
,
267 RrColorNew(inst
, 0xff, 0xff, 0xff));
269 READ_COLOR("window.active.button.pressed.image.color",
270 theme
->titlebut_focused_pressed_color
,
271 RrColorCopy(theme
->titlebut_focused_unpressed_color
));
273 READ_COLOR("window.inactive.button.pressed.image.color",
274 theme
->titlebut_unfocused_pressed_color
,
275 RrColorCopy(theme
->titlebut_unfocused_unpressed_color
));
277 READ_COLOR("window.active.button.disabled.image.color",
278 theme
->titlebut_disabled_focused_color
,
279 RrColorNew(inst
, 0xff, 0xff, 0xff));
281 READ_COLOR("window.inactive.button.disabled.image.color",
282 theme
->titlebut_disabled_unfocused_color
,
283 RrColorNew(inst
, 0, 0, 0));
285 READ_COLOR("window.active.button.hover.image.color",
286 theme
->titlebut_hover_focused_color
,
287 RrColorCopy(theme
->titlebut_focused_unpressed_color
));
289 READ_COLOR("window.inactive.button.hover.image.color",
290 theme
->titlebut_hover_unfocused_color
,
291 RrColorCopy(theme
->titlebut_unfocused_unpressed_color
));
293 READ_COLOR_("window.active.button.toggled.unpressed.image.color",
294 "window.active.button.toggled.image.color",
295 theme
->titlebut_toggled_focused_unpressed_color
,
296 RrColorCopy(theme
->titlebut_focused_pressed_color
));
298 READ_COLOR_("window.inactive.button.toggled.unpressed.image.color",
299 "window.inactive.button.toggled.image.color",
300 theme
->titlebut_toggled_unfocused_unpressed_color
,
301 RrColorCopy(theme
->titlebut_unfocused_pressed_color
));
303 READ_COLOR("window.active.button.toggled.hover.image.color",
304 theme
->titlebut_toggled_hover_focused_color
,
305 RrColorCopy(theme
->titlebut_toggled_focused_unpressed_color
));
307 READ_COLOR("window.inactive.button.toggled.hover.image.color",
308 theme
->titlebut_toggled_hover_unfocused_color
,
309 RrColorCopy(theme
->titlebut_toggled_unfocused_unpressed_color
));
311 READ_COLOR("window.active.button.toggled.pressed.image.color",
312 theme
->titlebut_toggled_focused_pressed_color
,
313 RrColorCopy(theme
->titlebut_focused_pressed_color
));
315 READ_COLOR("window.inactive.button.toggled.pressed.image.color",
316 theme
->titlebut_toggled_unfocused_pressed_color
,
317 RrColorCopy(theme
->titlebut_unfocused_pressed_color
));
319 READ_COLOR("menu.title.text.color", theme
->menu_title_color
,
320 RrColorNew(inst
, 0, 0, 0));
322 READ_COLOR("menu.items.text.color", theme
->menu_color
,
323 RrColorNew(inst
, 0xff, 0xff, 0xff));
325 READ_COLOR("menu.items.disabled.text.color", theme
->menu_disabled_color
,
326 RrColorNew(inst
, 0, 0, 0));
328 READ_COLOR("menu.items.active.disabled.text.color",
329 theme
->menu_disabled_selected_color
,
330 RrColorCopy(theme
->menu_disabled_color
));
332 READ_COLOR("menu.items.active.text.color", theme
->menu_selected_color
,
333 RrColorNew(inst
, 0, 0, 0));
335 READ_COLOR("menu.separator.color", theme
->menu_sep_color
,
336 RrColorCopy(inst
, theme
->menu_color
));
338 /* load the image masks */
340 /* maximize button masks */
342 if (!read_mask(inst
, path
, theme
, "max.xbm", &theme
->max_mask
)) {
343 guchar data
[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
344 theme
->max_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
347 if (!read_mask(inst
, path
, theme
, "max_toggled.xbm",
348 &theme
->max_toggled_mask
))
351 theme
->max_toggled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
353 guchar data
[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
354 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 6, 6,(gchar
*)data
);
357 if (!read_mask(inst
, path
, theme
, "max_pressed.xbm",
358 &theme
->max_pressed_mask
))
359 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
360 if (!read_mask(inst
,path
,theme
,"max_disabled.xbm",
361 &theme
->max_disabled_mask
))
362 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
363 if (!read_mask(inst
, path
, theme
, "max_hover.xbm", &theme
->max_hover_mask
))
364 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
365 if (!read_mask(inst
, path
, theme
, "max_toggled_pressed.xbm",
366 &theme
->max_toggled_pressed_mask
))
367 theme
->max_toggled_pressed_mask
=
368 RrPixmapMaskCopy(theme
->max_toggled_mask
);
369 if (!read_mask(inst
, path
, theme
, "max_toggled_hover.xbm",
370 &theme
->max_toggled_hover_mask
))
371 theme
->max_toggled_hover_mask
=
372 RrPixmapMaskCopy(theme
->max_toggled_mask
);
374 /* iconify button masks */
375 if (!read_mask(inst
, path
, theme
, "iconify.xbm", &theme
->iconify_mask
)) {
376 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
377 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
379 if (!read_mask(inst
, path
, theme
, "iconify_pressed.xbm",
380 &theme
->iconify_pressed_mask
))
381 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
382 if (!read_mask(inst
, path
, theme
, "iconify_disabled.xbm",
383 &theme
->iconify_disabled_mask
))
384 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
385 if (!read_mask(inst
, path
, theme
, "iconify_hover.xbm",
386 &theme
->iconify_hover_mask
))
387 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
389 /* all desktops button masks */
391 if (!read_mask(inst
, path
, theme
, "desk.xbm", &theme
->desk_mask
)) {
392 guchar data
[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
393 theme
->desk_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
396 if (!read_mask(inst
, path
, theme
, "desk_toggled.xbm",
397 &theme
->desk_toggled_mask
)) {
399 theme
->desk_toggled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
401 guchar data
[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
402 theme
->desk_toggled_mask
=
403 RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
406 if (!read_mask(inst
, path
, theme
, "desk_pressed.xbm",
407 &theme
->desk_pressed_mask
))
408 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
409 if (!read_mask(inst
, path
, theme
, "desk_disabled.xbm",
410 &theme
->desk_disabled_mask
))
411 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
412 if (!read_mask(inst
, path
, theme
, "desk_hover.xbm",
413 &theme
->desk_hover_mask
))
414 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
415 if (!read_mask(inst
, path
, theme
, "desk_toggled_pressed.xbm",
416 &theme
->desk_toggled_pressed_mask
))
417 theme
->desk_toggled_pressed_mask
=
418 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
419 if (!read_mask(inst
, path
, theme
, "desk_toggled_hover.xbm",
420 &theme
->desk_toggled_hover_mask
))
421 theme
->desk_toggled_hover_mask
=
422 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
424 /* shade button masks */
425 if (!read_mask(inst
, path
, theme
, "shade.xbm", &theme
->shade_mask
)) {
426 guchar data
[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
427 theme
->shade_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
429 if (!read_mask(inst
, path
, theme
, "shade_toggled.xbm",
430 &theme
->shade_toggled_mask
))
431 theme
->shade_toggled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
432 if (!read_mask(inst
, path
, theme
, "shade_pressed.xbm",
433 &theme
->shade_pressed_mask
))
434 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
435 if (!read_mask(inst
, path
, theme
, "shade_disabled.xbm",
436 &theme
->shade_disabled_mask
))
437 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
438 if (!read_mask(inst
, path
, theme
, "shade_hover.xbm",
439 &theme
->shade_hover_mask
))
440 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
441 if (!read_mask(inst
, path
, theme
, "shade_toggled_pressed.xbm",
442 &theme
->shade_toggled_pressed_mask
))
443 theme
->shade_toggled_pressed_mask
=
444 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
445 if (!read_mask(inst
, path
, theme
, "shade_toggled_hover.xbm",
446 &theme
->shade_toggled_hover_mask
))
447 theme
->shade_toggled_hover_mask
=
448 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
450 /* close button masks */
451 if (!read_mask(inst
, path
, theme
, "close.xbm", &theme
->close_mask
)) {
452 guchar data
[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
453 theme
->close_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
455 if (!read_mask(inst
, path
, theme
, "close_pressed.xbm",
456 &theme
->close_pressed_mask
))
457 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
458 if (!read_mask(inst
, path
, theme
, "close_disabled.xbm",
459 &theme
->close_disabled_mask
))
460 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
461 if (!read_mask(inst
, path
, theme
, "close_hover.xbm",
462 &theme
->close_hover_mask
))
463 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
465 /* submenu bullet mask */
466 if (!read_mask(inst
, path
, theme
, "bullet.xbm", &theme
->menu_bullet_mask
))
468 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
469 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
472 /* up and down arrows */
474 guchar data
[] = { 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00 };
475 theme
->down_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
478 guchar data
[] = { 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00 };
479 theme
->up_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
482 /* setup the default window icon */
483 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
484 OB_DEFAULT_ICON_HEIGHT
,
485 OB_DEFAULT_ICON_pixel_data
);
486 theme
->def_win_icon_w
= OB_DEFAULT_ICON_WIDTH
;
487 theme
->def_win_icon_h
= OB_DEFAULT_ICON_HEIGHT
;
489 /* read the decoration textures */
490 if (!read_appearance(db
, inst
,
491 "window.active.title.bg", theme
->a_focused_title
,
493 set_default_appearance(theme
->a_focused_title
);
494 if (!read_appearance(db
, inst
,
495 "window.inactive.title.bg", theme
->a_unfocused_title
,
497 set_default_appearance(theme
->a_unfocused_title
);
498 if (!read_appearance(db
, inst
,
499 "window.active.label.bg", theme
->a_focused_label
,
501 set_default_appearance(theme
->a_focused_label
);
502 if (!read_appearance(db
, inst
,
503 "window.inactive.label.bg", theme
->a_unfocused_label
,
505 set_default_appearance(theme
->a_unfocused_label
);
506 if (!read_appearance(db
, inst
,
507 "window.active.handle.bg", theme
->a_focused_handle
,
509 set_default_appearance(theme
->a_focused_handle
);
510 if (!read_appearance(db
, inst
,
511 "window.inactive.handle.bg",theme
->a_unfocused_handle
,
513 set_default_appearance(theme
->a_unfocused_handle
);
514 if (!read_appearance(db
, inst
,
515 "window.active.grip.bg", theme
->a_focused_grip
,
517 set_default_appearance(theme
->a_focused_grip
);
518 if (!read_appearance(db
, inst
,
519 "window.inactive.grip.bg", theme
->a_unfocused_grip
,
521 set_default_appearance(theme
->a_unfocused_grip
);
522 if (!read_appearance(db
, inst
,
523 "menu.items.bg", theme
->a_menu
,
525 set_default_appearance(theme
->a_menu
);
526 if (!read_appearance(db
, inst
,
527 "menu.title.bg", theme
->a_menu_title
,
529 set_default_appearance(theme
->a_menu_title
);
530 if (!read_appearance(db
, inst
,
531 "menu.items.active.bg", theme
->a_menu_selected
,
533 set_default_appearance(theme
->a_menu_selected
);
534 theme
->a_menu_disabled_selected
=
535 RrAppearanceCopy(theme
->a_menu_selected
);
537 /* read appearances for non-decorations (on-screen-display) */
538 if (!read_appearance(db
, inst
, "osd.bg", theme
->osd_bg
, FALSE
)) {
539 RrAppearanceFree(theme
->osd_bg
);
540 theme
->osd_bg
= RrAppearanceCopy(theme
->a_focused_title
);
542 if (!read_appearance(db
, inst
, "osd.active.label.bg",
543 theme
->osd_hilite_label
, TRUE
) &&
544 !read_appearance(db
, inst
, "osd.label.bg",
545 theme
->osd_hilite_label
, TRUE
)) {
546 RrAppearanceFree(theme
->osd_hilite_label
);
547 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
549 if (!read_appearance(db
, inst
, "osd.inactive.label.bg",
550 theme
->osd_unhilite_label
, TRUE
)) {
551 RrAppearanceFree(theme
->osd_unhilite_label
);
552 theme
->osd_unhilite_label
= RrAppearanceCopy(theme
->a_unfocused_label
);
554 /* osd_hilite_fg can't be parentrel */
555 if (!read_appearance(db
, inst
, "osd.hilight.bg",
556 theme
->osd_hilite_bg
, FALSE
)) {
557 RrAppearanceFree(theme
->osd_hilite_bg
);
558 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
559 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_label
);
561 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
563 /* osd_unhilite_fg can't be parentrel either */
564 if (!read_appearance(db
, inst
, "osd.unhilight.bg",
565 theme
->osd_unhilite_bg
, FALSE
)) {
566 RrAppearanceFree(theme
->osd_unhilite_bg
);
567 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
568 theme
->osd_unhilite_bg
=RrAppearanceCopy(theme
->a_unfocused_label
);
570 theme
->osd_unhilite_bg
=RrAppearanceCopy(theme
->a_unfocused_title
);
573 /* read buttons textures */
574 if (!read_appearance(db
, inst
,
575 "window.active.button.disabled.bg",
576 theme
->a_disabled_focused_max
,
578 set_default_appearance(theme
->a_disabled_focused_max
);
579 if (!read_appearance(db
, inst
,
580 "window.inactive.button.disabled.bg",
581 theme
->a_disabled_unfocused_max
,
583 set_default_appearance(theme
->a_disabled_unfocused_max
);
584 if (!read_appearance(db
, inst
,
585 "window.active.button.pressed.bg",
586 theme
->a_focused_pressed_max
,
588 set_default_appearance(theme
->a_focused_pressed_max
);
589 if (!read_appearance(db
, inst
,
590 "window.inactive.button.pressed.bg",
591 theme
->a_unfocused_pressed_max
,
593 set_default_appearance(theme
->a_unfocused_pressed_max
);
594 if (!read_appearance(db
, inst
,
595 "window.active.button.toggled.unpressed.bg",
596 theme
->a_toggled_focused_unpressed_max
,
598 !read_appearance(db
, inst
,
599 "window.active.button.toggled.bg",
600 theme
->a_toggled_focused_unpressed_max
,
603 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
604 theme
->a_toggled_focused_unpressed_max
=
605 RrAppearanceCopy(theme
->a_focused_pressed_max
);
607 if (!read_appearance(db
, inst
,
608 "window.inactive.button.toggled.unpressed.bg",
609 theme
->a_toggled_unfocused_unpressed_max
,
611 !read_appearance(db
, inst
,
612 "window.inactive.button.toggled.bg",
613 theme
->a_toggled_unfocused_unpressed_max
,
616 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
617 theme
->a_toggled_unfocused_unpressed_max
=
618 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
620 if (!read_appearance(db
, inst
,
621 "window.active.button.toggled.hover.bg",
622 theme
->a_toggled_hover_focused_max
,
625 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
626 theme
->a_toggled_hover_focused_max
=
627 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
629 if (!read_appearance(db
, inst
,
630 "window.inactive.button.toggled.hover.bg",
631 theme
->a_toggled_hover_unfocused_max
,
634 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
635 theme
->a_toggled_hover_unfocused_max
=
636 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
638 if (!read_appearance(db
, inst
,
639 "window.active.button.toggled.pressed.bg",
640 theme
->a_toggled_focused_pressed_max
,
643 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
644 theme
->a_toggled_focused_pressed_max
=
645 RrAppearanceCopy(theme
->a_focused_pressed_max
);
647 if (!read_appearance(db
, inst
,
648 "window.inactive.button.toggled.pressed.bg",
649 theme
->a_toggled_unfocused_pressed_max
,
652 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
653 theme
->a_toggled_unfocused_pressed_max
=
654 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
656 if (!read_appearance(db
, inst
,
657 "window.active.button.unpressed.bg",
658 theme
->a_focused_unpressed_max
,
660 set_default_appearance(theme
->a_focused_unpressed_max
);
661 if (!read_appearance(db
, inst
,
662 "window.inactive.button.unpressed.bg",
663 theme
->a_unfocused_unpressed_max
,
665 set_default_appearance(theme
->a_unfocused_unpressed_max
);
666 if (!read_appearance(db
, inst
,
667 "window.active.button.hover.bg",
668 theme
->a_hover_focused_max
,
671 RrAppearanceFree(theme
->a_hover_focused_max
);
672 theme
->a_hover_focused_max
=
673 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
675 if (!read_appearance(db
, inst
,
676 "window.inactive.button.hover.bg",
677 theme
->a_hover_unfocused_max
,
680 RrAppearanceFree(theme
->a_hover_unfocused_max
);
681 theme
->a_hover_unfocused_max
=
682 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
685 theme
->a_disabled_focused_close
=
686 RrAppearanceCopy(theme
->a_disabled_focused_max
);
687 theme
->a_disabled_unfocused_close
=
688 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
689 theme
->a_hover_focused_close
=
690 RrAppearanceCopy(theme
->a_hover_focused_max
);
691 theme
->a_hover_unfocused_close
=
692 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
693 theme
->a_unfocused_unpressed_close
=
694 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
695 theme
->a_unfocused_pressed_close
=
696 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
697 theme
->a_focused_unpressed_close
=
698 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
699 theme
->a_focused_pressed_close
=
700 RrAppearanceCopy(theme
->a_focused_pressed_max
);
701 theme
->a_disabled_focused_desk
=
702 RrAppearanceCopy(theme
->a_disabled_focused_max
);
703 theme
->a_disabled_unfocused_desk
=
704 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
705 theme
->a_hover_focused_desk
=
706 RrAppearanceCopy(theme
->a_hover_focused_max
);
707 theme
->a_hover_unfocused_desk
=
708 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
709 theme
->a_toggled_hover_focused_desk
=
710 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
711 theme
->a_toggled_hover_unfocused_desk
=
712 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
713 theme
->a_toggled_focused_unpressed_desk
=
714 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
715 theme
->a_toggled_unfocused_unpressed_desk
=
716 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
717 theme
->a_toggled_focused_pressed_desk
=
718 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
719 theme
->a_toggled_unfocused_pressed_desk
=
720 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
721 theme
->a_unfocused_unpressed_desk
=
722 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
723 theme
->a_unfocused_pressed_desk
=
724 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
725 theme
->a_focused_unpressed_desk
=
726 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
727 theme
->a_focused_pressed_desk
=
728 RrAppearanceCopy(theme
->a_focused_pressed_max
);
729 theme
->a_disabled_focused_shade
=
730 RrAppearanceCopy(theme
->a_disabled_focused_max
);
731 theme
->a_disabled_unfocused_shade
=
732 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
733 theme
->a_hover_focused_shade
=
734 RrAppearanceCopy(theme
->a_hover_focused_max
);
735 theme
->a_hover_unfocused_shade
=
736 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
737 theme
->a_toggled_hover_focused_shade
=
738 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
739 theme
->a_toggled_hover_unfocused_shade
=
740 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
741 theme
->a_toggled_focused_unpressed_shade
=
742 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
743 theme
->a_toggled_unfocused_unpressed_shade
=
744 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
745 theme
->a_toggled_focused_pressed_shade
=
746 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
747 theme
->a_toggled_unfocused_pressed_shade
=
748 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
749 theme
->a_unfocused_unpressed_shade
=
750 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
751 theme
->a_unfocused_pressed_shade
=
752 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
753 theme
->a_focused_unpressed_shade
=
754 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
755 theme
->a_focused_pressed_shade
=
756 RrAppearanceCopy(theme
->a_focused_pressed_max
);
757 theme
->a_disabled_focused_iconify
=
758 RrAppearanceCopy(theme
->a_disabled_focused_max
);
759 theme
->a_disabled_unfocused_iconify
=
760 RrAppearanceCopy(theme
->a_disabled_focused_max
);
761 theme
->a_hover_focused_iconify
=
762 RrAppearanceCopy(theme
->a_hover_focused_max
);
763 theme
->a_hover_unfocused_iconify
=
764 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
765 theme
->a_unfocused_unpressed_iconify
=
766 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
767 theme
->a_unfocused_pressed_iconify
=
768 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
769 theme
->a_focused_unpressed_iconify
=
770 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
771 theme
->a_focused_pressed_iconify
=
772 RrAppearanceCopy(theme
->a_focused_pressed_max
);
774 theme
->a_icon
->surface
.grad
=
775 theme
->a_clear
->surface
.grad
=
776 theme
->a_clear_tex
->surface
.grad
=
777 theme
->a_menu_text_title
->surface
.grad
=
778 theme
->a_menu_normal
->surface
.grad
=
779 theme
->a_menu_disabled
->surface
.grad
=
780 theme
->a_menu_text_normal
->surface
.grad
=
781 theme
->a_menu_text_selected
->surface
.grad
=
782 theme
->a_menu_text_disabled
->surface
.grad
=
783 theme
->a_menu_text_disabled_selected
->surface
.grad
=
784 theme
->a_menu_bullet_normal
->surface
.grad
=
785 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
787 /* set up the textures */
788 theme
->a_focused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
789 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
790 theme
->a_focused_label
->texture
[0].data
.text
.font
=theme
->win_font_focused
;
791 theme
->a_focused_label
->texture
[0].data
.text
.color
=
792 theme
->title_focused_color
;
794 if (read_string(db
, "window.active.label.text.font", &str
)) {
798 if (strstr(str
, "shadow=y")) {
799 if ((p
= strstr(str
, "shadowoffset=")))
800 i
= parse_inline_number(p
+ strlen("shadowoffset="));
803 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
804 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
806 if ((p
= strstr(str
, "shadowtint=")))
808 i
= parse_inline_number(p
+ strlen("shadowtint="));
809 j
= (i
> 0 ? 0 : 255);
812 theme
->title_focused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
813 theme
->title_focused_shadow_alpha
= i
;
815 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
816 theme
->title_focused_shadow_alpha
= 50;
820 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
821 theme
->title_focused_shadow_color
;
822 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
823 theme
->title_focused_shadow_alpha
;
825 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
826 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
827 theme
->osd_hilite_label
->texture
[0].data
.text
.font
=
828 theme
->osd_font_hilite
;
829 theme
->osd_hilite_label
->texture
[0].data
.text
.color
=
830 theme
->osd_text_active_color
;
832 if (read_string(db
, "osd.active.label.text.font", &str
) ||
833 read_string(db
, "osd.label.text.font", &str
))
838 if (strstr(str
, "shadow=y")) {
839 if ((p
= strstr(str
, "shadowoffset=")))
840 i
= parse_inline_number(p
+ strlen("shadowoffset="));
843 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
844 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
846 if ((p
= strstr(str
, "shadowtint=")))
848 i
= parse_inline_number(p
+ strlen("shadowtint="));
849 j
= (i
> 0 ? 0 : 255);
852 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, j
, j
, j
);
853 theme
->osd_text_active_shadow_alpha
= i
;
855 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, 0, 0, 0);
856 theme
->osd_text_active_shadow_alpha
= 50;
859 /* inherit the font settings from the focused label */
860 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
861 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
862 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
863 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
864 if (theme
->title_focused_shadow_color
)
865 theme
->osd_text_active_shadow_color
=
867 theme
->title_focused_shadow_color
->r
,
868 theme
->title_focused_shadow_color
->g
,
869 theme
->title_focused_shadow_color
->b
);
871 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, 0, 0, 0);
872 theme
->osd_text_active_shadow_alpha
=
873 theme
->title_focused_shadow_alpha
;
876 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
877 theme
->osd_text_active_shadow_color
;
878 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
879 theme
->osd_text_active_shadow_alpha
;
881 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
882 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
883 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
884 theme
->win_font_unfocused
;
885 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
886 theme
->title_unfocused_color
;
888 if (read_string(db
, "window.inactive.label.text.font", &str
)) {
892 if (strstr(str
, "shadow=y")) {
893 if ((p
= strstr(str
, "shadowoffset=")))
894 i
= parse_inline_number(p
+ strlen("shadowoffset="));
897 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
898 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
900 if ((p
= strstr(str
, "shadowtint=")))
902 i
= parse_inline_number(p
+ strlen("shadowtint="));
903 j
= (i
> 0 ? 0 : 255);
906 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
907 theme
->title_unfocused_shadow_alpha
= i
;
909 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
910 theme
->title_unfocused_shadow_alpha
= 50;
914 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
915 theme
->title_unfocused_shadow_color
;
916 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
917 theme
->title_unfocused_shadow_alpha
;
919 theme
->osd_unhilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
920 theme
->osd_unhilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
921 theme
->osd_unhilite_label
->texture
[0].data
.text
.font
=
922 theme
->osd_font_unhilite
;
923 theme
->osd_unhilite_label
->texture
[0].data
.text
.color
=
924 theme
->osd_text_inactive_color
;
926 if (read_string(db
, "osd.inactive.label.text.font", &str
))
931 if (strstr(str
, "shadow=y")) {
932 if ((p
= strstr(str
, "shadowoffset=")))
933 i
= parse_inline_number(p
+ strlen("shadowoffset="));
936 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_x
=i
;
937 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_y
=i
;
939 if ((p
= strstr(str
, "shadowtint=")))
941 i
= parse_inline_number(p
+ strlen("shadowtint="));
942 j
= (i
> 0 ? 0 : 255);
945 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, j
, j
, j
);
946 theme
->osd_text_inactive_shadow_alpha
= i
;
948 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, 0, 0, 0);
949 theme
->osd_text_inactive_shadow_alpha
= 50;
952 /* inherit the font settings from the unfocused label */
953 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_x
=
954 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
;
955 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_y
=
956 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
;
957 if (theme
->title_unfocused_shadow_color
)
958 theme
->osd_text_inactive_shadow_color
=
960 theme
->title_unfocused_shadow_color
->r
,
961 theme
->title_unfocused_shadow_color
->g
,
962 theme
->title_unfocused_shadow_color
->b
);
964 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, 0, 0, 0);
965 theme
->osd_text_inactive_shadow_alpha
=
966 theme
->title_unfocused_shadow_alpha
;
969 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_color
=
970 theme
->osd_text_inactive_shadow_color
;
971 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_alpha
=
972 theme
->osd_text_inactive_shadow_alpha
;
974 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
975 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
976 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
977 theme
->menu_title_font
;
978 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
979 theme
->menu_title_color
;
981 if (read_string(db
, "menu.title.text.font", &str
)) {
985 if (strstr(str
, "shadow=y")) {
986 if ((p
= strstr(str
, "shadowoffset=")))
987 i
= parse_inline_number(p
+ strlen("shadowoffset="));
990 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
= i
;
991 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= i
;
993 if ((p
= strstr(str
, "shadowtint=")))
995 i
= parse_inline_number(p
+ strlen("shadowtint="));
996 j
= (i
> 0 ? 0 : 255);
999 theme
->menu_title_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1000 theme
->menu_title_shadow_alpha
= i
;
1002 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1003 theme
->menu_title_shadow_alpha
= 50;
1007 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
1008 theme
->menu_title_shadow_color
;
1009 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
1010 theme
->menu_title_shadow_alpha
;
1012 theme
->a_menu_text_normal
->texture
[0].type
=
1013 theme
->a_menu_text_selected
->texture
[0].type
=
1014 theme
->a_menu_text_disabled
->texture
[0].type
=
1015 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
1017 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
1018 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
1019 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
1020 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
1022 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
1023 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
1024 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
1025 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
1027 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
1028 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
1029 theme
->menu_selected_color
;
1030 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
1031 theme
->menu_disabled_color
;
1032 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
1033 theme
->menu_disabled_selected_color
;
1035 if (read_string(db
, "menu.items.font", &str
)) {
1039 if (strstr(str
, "shadow=y")) {
1040 if ((p
= strstr(str
, "shadowoffset=")))
1041 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1044 theme
->a_menu_text_normal
->
1045 texture
[0].data
.text
.shadow_offset_x
= i
;
1046 theme
->a_menu_text_normal
->
1047 texture
[0].data
.text
.shadow_offset_y
= i
;
1048 theme
->a_menu_text_selected
->
1049 texture
[0].data
.text
.shadow_offset_x
= i
;
1050 theme
->a_menu_text_selected
->
1051 texture
[0].data
.text
.shadow_offset_y
= i
;
1052 theme
->a_menu_text_disabled
->
1053 texture
[0].data
.text
.shadow_offset_x
= i
;
1054 theme
->a_menu_text_disabled
->
1055 texture
[0].data
.text
.shadow_offset_y
= i
;
1056 theme
->a_menu_text_disabled_selected
->
1057 texture
[0].data
.text
.shadow_offset_x
= i
;
1058 theme
->a_menu_text_disabled_selected
->
1059 texture
[0].data
.text
.shadow_offset_y
= i
;
1061 if ((p
= strstr(str
, "shadowtint=")))
1063 i
= parse_inline_number(p
+ strlen("shadowtint="));
1064 j
= (i
> 0 ? 0 : 255);
1067 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1068 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1069 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1070 theme
->menu_text_normal_shadow_alpha
= i
;
1071 theme
->menu_text_selected_shadow_alpha
= i
;
1072 theme
->menu_text_disabled_shadow_alpha
= i
;
1073 theme
->menu_text_disabled_selected_shadow_alpha
= i
;
1075 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1076 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1077 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1078 theme
->menu_text_normal_shadow_alpha
= 50;
1079 theme
->menu_text_selected_shadow_alpha
= 50;
1080 theme
->menu_text_disabled_selected_shadow_alpha
= 50;
1084 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
1085 theme
->menu_text_normal_shadow_color
;
1086 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
1087 theme
->menu_text_normal_shadow_alpha
;
1088 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
1089 theme
->menu_text_selected_shadow_color
;
1090 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
1091 theme
->menu_text_selected_shadow_alpha
;
1092 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
1093 theme
->menu_text_disabled_shadow_color
;
1094 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
1095 theme
->menu_text_disabled_shadow_alpha
;
1096 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
1097 theme
->menu_text_disabled_shadow_color
;
1098 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
1099 theme
->menu_text_disabled_shadow_alpha
;
1101 theme
->a_disabled_focused_max
->texture
[0].type
=
1102 theme
->a_disabled_unfocused_max
->texture
[0].type
=
1103 theme
->a_hover_focused_max
->texture
[0].type
=
1104 theme
->a_hover_unfocused_max
->texture
[0].type
=
1105 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
1106 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
1107 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
1108 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
1109 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
1110 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
1111 theme
->a_focused_unpressed_max
->texture
[0].type
=
1112 theme
->a_focused_pressed_max
->texture
[0].type
=
1113 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
1114 theme
->a_unfocused_pressed_max
->texture
[0].type
=
1115 theme
->a_disabled_focused_close
->texture
[0].type
=
1116 theme
->a_disabled_unfocused_close
->texture
[0].type
=
1117 theme
->a_hover_focused_close
->texture
[0].type
=
1118 theme
->a_hover_unfocused_close
->texture
[0].type
=
1119 theme
->a_focused_unpressed_close
->texture
[0].type
=
1120 theme
->a_focused_pressed_close
->texture
[0].type
=
1121 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
1122 theme
->a_unfocused_pressed_close
->texture
[0].type
=
1123 theme
->a_disabled_focused_desk
->texture
[0].type
=
1124 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
1125 theme
->a_hover_focused_desk
->texture
[0].type
=
1126 theme
->a_hover_unfocused_desk
->texture
[0].type
=
1127 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
1128 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
1129 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
1130 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
1131 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
1132 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
1133 theme
->a_focused_unpressed_desk
->texture
[0].type
=
1134 theme
->a_focused_pressed_desk
->texture
[0].type
=
1135 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
1136 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
1137 theme
->a_disabled_focused_shade
->texture
[0].type
=
1138 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
1139 theme
->a_hover_focused_shade
->texture
[0].type
=
1140 theme
->a_hover_unfocused_shade
->texture
[0].type
=
1141 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
1142 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
1143 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
1144 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
1145 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
1146 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
1147 theme
->a_focused_unpressed_shade
->texture
[0].type
=
1148 theme
->a_focused_pressed_shade
->texture
[0].type
=
1149 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
1150 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
1151 theme
->a_disabled_focused_iconify
->texture
[0].type
=
1152 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
1153 theme
->a_hover_focused_iconify
->texture
[0].type
=
1154 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
1155 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
1156 theme
->a_focused_pressed_iconify
->texture
[0].type
=
1157 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
1158 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
1159 theme
->a_menu_bullet_normal
->texture
[0].type
=
1160 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
1162 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
1163 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
1164 theme
->max_disabled_mask
;
1165 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
1166 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1167 theme
->max_hover_mask
;
1168 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1169 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1170 theme
->max_pressed_mask
;
1171 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1172 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1174 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
1175 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1176 theme
->max_toggled_hover_mask
;
1177 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1178 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1179 theme
->max_toggled_mask
;
1180 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1181 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1182 theme
->max_toggled_pressed_mask
;
1183 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
1184 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
1185 theme
->close_disabled_mask
;
1186 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
1187 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
1188 theme
->close_hover_mask
;
1189 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
1190 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
1191 theme
->close_pressed_mask
;
1192 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
1193 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
1195 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
1196 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
1197 theme
->desk_disabled_mask
;
1198 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1199 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1200 theme
->desk_hover_mask
;
1201 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1202 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1203 theme
->desk_pressed_mask
;
1204 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1205 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1207 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1208 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1209 theme
->desk_toggled_hover_mask
;
1210 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1211 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1212 theme
->desk_toggled_mask
;
1213 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1214 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1215 theme
->desk_toggled_pressed_mask
;
1216 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1217 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1218 theme
->shade_disabled_mask
;
1219 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1220 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1221 theme
->shade_hover_mask
;
1222 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1223 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1224 theme
->shade_pressed_mask
;
1225 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1226 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1228 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1229 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1230 theme
->shade_toggled_hover_mask
;
1231 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1232 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1233 theme
->shade_toggled_mask
;
1234 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1235 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1236 theme
->shade_toggled_pressed_mask
;
1237 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1238 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1239 theme
->iconify_disabled_mask
;
1240 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1241 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1242 theme
->iconify_hover_mask
;
1243 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1244 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1245 theme
->iconify_pressed_mask
;
1246 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1247 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1248 theme
->iconify_mask
;
1249 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1250 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1251 theme
->menu_bullet_mask
;
1252 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1253 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1254 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1255 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1256 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1257 theme
->titlebut_disabled_focused_color
;
1258 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1259 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1260 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1261 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1262 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1263 theme
->titlebut_disabled_unfocused_color
;
1264 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1265 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1266 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1267 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1268 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1269 theme
->titlebut_hover_focused_color
;
1270 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1271 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1272 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1273 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1274 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1275 theme
->titlebut_hover_unfocused_color
;
1276 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1277 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1278 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1279 theme
->titlebut_toggled_hover_focused_color
;
1280 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1281 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1282 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1283 theme
->titlebut_toggled_hover_unfocused_color
;
1284 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1285 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1286 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1287 theme
->titlebut_toggled_focused_unpressed_color
;
1288 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1289 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1290 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1291 theme
->titlebut_toggled_unfocused_unpressed_color
;
1292 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1293 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1294 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1295 theme
->titlebut_toggled_focused_pressed_color
;
1296 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1297 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1298 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1299 theme
->titlebut_toggled_unfocused_pressed_color
;
1300 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1301 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1302 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1303 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1304 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1305 theme
->titlebut_focused_unpressed_color
;
1306 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1307 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1308 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1309 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1310 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1311 theme
->titlebut_focused_pressed_color
;
1312 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1313 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1314 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1315 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1316 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1317 theme
->titlebut_unfocused_unpressed_color
;
1318 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1319 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1320 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1321 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1322 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1323 theme
->titlebut_unfocused_pressed_color
;
1324 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1326 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1327 theme
->menu_selected_color
;
1330 XrmDestroyDatabase(db
);
1332 /* set the font heights */
1333 theme
->win_font_height
= RrFontHeight
1334 (theme
->win_font_focused
,
1335 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
);
1336 theme
->win_font_height
=
1337 MAX(theme
->win_font_height
,
1339 (theme
->win_font_focused
,
1340 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
));
1341 theme
->menu_title_font_height
= RrFontHeight
1342 (theme
->menu_title_font
,
1343 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
);
1344 theme
->menu_font_height
= RrFontHeight
1346 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
);
1348 /* calculate some last extents */
1350 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1352 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1353 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1354 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1355 theme
->label_height
+= theme
->label_height
% 2;
1357 /* this would be nice I think, since padding.width can now be 0,
1358 but it breaks frame.c horribly and I don't feel like fixing that
1359 right now, so if anyone complains, here is how to keep text from
1360 going over the title's bevel/border with a padding.width of 0 and a
1361 bevelless/borderless label
1362 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1363 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1364 theme->title_height = theme->label_height +
1365 MAX(MAX(theme->padding * 2, ft + fb),
1366 MAX(theme->padding * 2, ut + ub));
1368 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1370 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1371 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1372 theme
->menu_title_height
= theme
->menu_title_label_height
+
1373 theme
->paddingy
* 2;
1375 theme
->button_size
= theme
->label_height
- 2;
1376 theme
->grip_width
= 25;
1381 void RrThemeFree(RrTheme
*theme
)
1384 g_free(theme
->name
);
1386 RrColorFree(theme
->menu_border_color
);
1387 RrColorFree(theme
->osd_border_color
);
1388 RrColorFree(theme
->frame_focused_border_color
);
1389 RrColorFree(theme
->frame_unfocused_border_color
);
1390 RrColorFree(theme
->title_separator_focused_color
);
1391 RrColorFree(theme
->title_separator_unfocused_color
);
1392 RrColorFree(theme
->cb_unfocused_color
);
1393 RrColorFree(theme
->cb_focused_color
);
1394 RrColorFree(theme
->title_focused_color
);
1395 RrColorFree(theme
->title_unfocused_color
);
1396 RrColorFree(theme
->titlebut_disabled_focused_color
);
1397 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1398 RrColorFree(theme
->titlebut_hover_focused_color
);
1399 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1400 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1401 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1402 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1403 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1404 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1405 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1406 RrColorFree(theme
->titlebut_focused_pressed_color
);
1407 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1408 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1409 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1410 RrColorFree(theme
->menu_title_color
);
1411 RrColorFree(theme
->menu_sep_color
);
1412 RrColorFree(theme
->menu_color
);
1413 RrColorFree(theme
->menu_selected_color
);
1414 RrColorFree(theme
->menu_disabled_color
);
1415 RrColorFree(theme
->menu_disabled_selected_color
);
1416 RrColorFree(theme
->title_focused_shadow_color
);
1417 RrColorFree(theme
->title_unfocused_shadow_color
);
1418 RrColorFree(theme
->osd_text_active_color
);
1419 RrColorFree(theme
->osd_text_inactive_color
);
1420 RrColorFree(theme
->osd_text_active_shadow_color
);
1421 RrColorFree(theme
->osd_text_inactive_shadow_color
);
1422 RrColorFree(theme
->menu_title_shadow_color
);
1423 RrColorFree(theme
->menu_text_normal_shadow_color
);
1424 RrColorFree(theme
->menu_text_selected_shadow_color
);
1425 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1426 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1428 g_free(theme
->def_win_icon
);
1430 RrPixmapMaskFree(theme
->max_mask
);
1431 RrPixmapMaskFree(theme
->max_toggled_mask
);
1432 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1433 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1434 RrPixmapMaskFree(theme
->max_disabled_mask
);
1435 RrPixmapMaskFree(theme
->max_hover_mask
);
1436 RrPixmapMaskFree(theme
->max_pressed_mask
);
1437 RrPixmapMaskFree(theme
->desk_mask
);
1438 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1439 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1440 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1441 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1442 RrPixmapMaskFree(theme
->desk_hover_mask
);
1443 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1444 RrPixmapMaskFree(theme
->shade_mask
);
1445 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1446 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1447 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1448 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1449 RrPixmapMaskFree(theme
->shade_hover_mask
);
1450 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1451 RrPixmapMaskFree(theme
->iconify_mask
);
1452 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1453 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1454 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1455 RrPixmapMaskFree(theme
->close_mask
);
1456 RrPixmapMaskFree(theme
->close_disabled_mask
);
1457 RrPixmapMaskFree(theme
->close_hover_mask
);
1458 RrPixmapMaskFree(theme
->close_pressed_mask
);
1459 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1460 RrPixmapMaskFree(theme
->down_arrow_mask
);
1461 RrPixmapMaskFree(theme
->up_arrow_mask
);
1463 RrFontClose(theme
->win_font_focused
);
1464 RrFontClose(theme
->win_font_unfocused
);
1465 RrFontClose(theme
->menu_title_font
);
1466 RrFontClose(theme
->menu_font
);
1467 RrFontClose(theme
->osd_font_hilite
);
1468 RrFontClose(theme
->osd_font_unhilite
);
1470 RrAppearanceFree(theme
->a_disabled_focused_max
);
1471 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1472 RrAppearanceFree(theme
->a_hover_focused_max
);
1473 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1474 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1475 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1476 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1477 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1478 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1479 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1480 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1481 RrAppearanceFree(theme
->a_focused_pressed_max
);
1482 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1483 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1484 RrAppearanceFree(theme
->a_disabled_focused_close
);
1485 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1486 RrAppearanceFree(theme
->a_hover_focused_close
);
1487 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1488 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1489 RrAppearanceFree(theme
->a_focused_pressed_close
);
1490 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1491 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1492 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1493 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1494 RrAppearanceFree(theme
->a_hover_focused_desk
);
1495 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1496 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1497 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1498 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1499 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1500 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1501 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1502 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1503 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1504 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1505 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1506 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1507 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1508 RrAppearanceFree(theme
->a_hover_focused_shade
);
1509 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1510 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1511 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1512 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1513 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1514 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1515 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1516 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1517 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1518 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1519 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1520 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1521 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1522 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1523 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1524 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1525 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1526 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1527 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1528 RrAppearanceFree(theme
->a_focused_grip
);
1529 RrAppearanceFree(theme
->a_unfocused_grip
);
1530 RrAppearanceFree(theme
->a_focused_title
);
1531 RrAppearanceFree(theme
->a_unfocused_title
);
1532 RrAppearanceFree(theme
->a_focused_label
);
1533 RrAppearanceFree(theme
->a_unfocused_label
);
1534 RrAppearanceFree(theme
->a_icon
);
1535 RrAppearanceFree(theme
->a_focused_handle
);
1536 RrAppearanceFree(theme
->a_unfocused_handle
);
1537 RrAppearanceFree(theme
->a_menu
);
1538 RrAppearanceFree(theme
->a_menu_title
);
1539 RrAppearanceFree(theme
->a_menu_text_title
);
1540 RrAppearanceFree(theme
->a_menu_normal
);
1541 RrAppearanceFree(theme
->a_menu_selected
);
1542 RrAppearanceFree(theme
->a_menu_disabled
);
1543 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1544 RrAppearanceFree(theme
->a_menu_text_normal
);
1545 RrAppearanceFree(theme
->a_menu_text_selected
);
1546 RrAppearanceFree(theme
->a_menu_text_disabled
);
1547 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1548 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1549 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1550 RrAppearanceFree(theme
->a_clear
);
1551 RrAppearanceFree(theme
->a_clear_tex
);
1552 RrAppearanceFree(theme
->osd_bg
);
1553 RrAppearanceFree(theme
->osd_hilite_bg
);
1554 RrAppearanceFree(theme
->osd_hilite_label
);
1555 RrAppearanceFree(theme
->osd_unhilite_bg
);
1556 RrAppearanceFree(theme
->osd_unhilite_label
);
1558 g_slice_free(RrTheme
, theme
);
1562 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
)
1565 XrmDatabase db
= NULL
;
1568 if (name
[0] == '/') {
1569 s
= g_build_filename(name
, "openbox-3", "themerc", NULL
);
1570 if ((db
= XrmGetFileDatabase(s
)))
1571 *path
= g_path_get_dirname(s
);
1576 p
= obt_paths_new();
1578 /* XXX backwards compatibility, remove me sometime later */
1579 s
= g_build_filename(g_get_home_dir(), ".themes", name
,
1580 "openbox-3", "themerc", NULL
);
1581 if ((db
= XrmGetFileDatabase(s
)))
1582 *path
= g_path_get_dirname(s
);
1585 for (it
= obt_paths_data_dirs(p
); !db
&& it
; it
= g_slist_next(it
))
1587 s
= g_build_filename(it
->data
, "themes", name
,
1588 "openbox-3", "themerc", NULL
);
1589 if ((db
= XrmGetFileDatabase(s
)))
1590 *path
= g_path_get_dirname(s
);
1598 s
= g_build_filename(name
, "themerc", NULL
);
1599 if ((db
= XrmGetFileDatabase(s
)))
1600 *path
= g_path_get_dirname(s
);
1607 static gchar
*create_class_name(const gchar
*rname
)
1609 gchar
*rclass
= g_strdup(rname
);
1614 p
= strchr(p
+1, '.');
1615 if (p
== NULL
) break;
1617 if (*p
== '\0') break;
1622 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
)
1624 gboolean ret
= FALSE
;
1625 gchar
*rclass
= create_class_name(rname
);
1626 gchar
*rettype
, *end
;
1629 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1630 retvalue
.addr
!= NULL
) {
1631 *value
= (gint
)strtol(retvalue
.addr
, &end
, 10);
1632 if (end
!= retvalue
.addr
)
1640 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
)
1642 gboolean ret
= FALSE
;
1643 gchar
*rclass
= create_class_name(rname
);
1647 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1648 retvalue
.addr
!= NULL
) {
1649 *value
= retvalue
.addr
;
1657 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
1658 const gchar
*rname
, RrColor
**value
)
1660 gboolean ret
= FALSE
;
1661 gchar
*rclass
= create_class_name(rname
);
1665 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1666 retvalue
.addr
!= NULL
) {
1667 RrColor
*c
= RrColorParse(inst
, retvalue
.addr
);
1678 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
1679 RrTheme
*theme
, const gchar
*maskname
,
1680 RrPixmapMask
**value
)
1682 gboolean ret
= FALSE
;
1684 gint hx
, hy
; /* ignored */
1688 s
= g_build_filename(path
, maskname
, NULL
);
1689 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1691 *value
= RrPixmapMaskNew(inst
, w
, h
, (gchar
*)b
);
1699 static void parse_appearance(gchar
*tex
, RrSurfaceColorType
*grad
,
1700 RrReliefType
*relief
, RrBevelType
*bevel
,
1701 gboolean
*interlaced
, gboolean
*border
,
1702 gboolean allow_trans
)
1706 /* convert to all lowercase */
1707 for (t
= tex
; *t
!= '\0'; ++t
)
1708 *t
= g_ascii_tolower(*t
);
1710 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1711 *grad
= RR_SURFACE_PARENTREL
;
1713 if (strstr(tex
, "gradient") != NULL
) {
1714 if (strstr(tex
, "crossdiagonal") != NULL
)
1715 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1716 else if (strstr(tex
, "pyramid") != NULL
)
1717 *grad
= RR_SURFACE_PYRAMID
;
1718 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1719 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1720 else if (strstr(tex
, "horizontal") != NULL
)
1721 *grad
= RR_SURFACE_HORIZONTAL
;
1722 else if (strstr(tex
, "splitvertical") != NULL
)
1723 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1724 else if (strstr(tex
, "vertical") != NULL
)
1725 *grad
= RR_SURFACE_VERTICAL
;
1727 *grad
= RR_SURFACE_DIAGONAL
;
1729 *grad
= RR_SURFACE_SOLID
;
1733 if (strstr(tex
, "sunken") != NULL
)
1734 *relief
= RR_RELIEF_SUNKEN
;
1735 else if (strstr(tex
, "flat") != NULL
)
1736 *relief
= RR_RELIEF_FLAT
;
1737 else if (strstr(tex
, "raised") != NULL
)
1738 *relief
= RR_RELIEF_RAISED
;
1740 *relief
= (*grad
== RR_SURFACE_PARENTREL
) ?
1741 RR_RELIEF_FLAT
: RR_RELIEF_RAISED
;
1744 if (*relief
== RR_RELIEF_FLAT
) {
1745 if (strstr(tex
, "border") != NULL
)
1748 if (strstr(tex
, "bevel2") != NULL
)
1749 *bevel
= RR_BEVEL_2
;
1751 *bevel
= RR_BEVEL_1
;
1754 if (strstr(tex
, "interlaced") != NULL
)
1757 *interlaced
= FALSE
;
1760 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
1761 const gchar
*rname
, RrAppearance
*value
,
1762 gboolean allow_trans
)
1764 gboolean ret
= FALSE
;
1765 gchar
*rclass
= create_class_name(rname
);
1766 gchar
*cname
, *ctoname
, *bcname
, *icname
, *hname
, *sname
;
1767 gchar
*csplitname
, *ctosplitname
;
1772 cname
= g_strconcat(rname
, ".color", NULL
);
1773 ctoname
= g_strconcat(rname
, ".colorTo", NULL
);
1774 bcname
= g_strconcat(rname
, ".border.color", NULL
);
1775 icname
= g_strconcat(rname
, ".interlace.color", NULL
);
1776 hname
= g_strconcat(rname
, ".highlight", NULL
);
1777 sname
= g_strconcat(rname
, ".shadow", NULL
);
1778 csplitname
= g_strconcat(rname
, ".color.splitTo", NULL
);
1779 ctosplitname
= g_strconcat(rname
, ".colorTo.splitTo", NULL
);
1781 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1782 retvalue
.addr
!= NULL
) {
1783 parse_appearance(retvalue
.addr
,
1784 &value
->surface
.grad
,
1785 &value
->surface
.relief
,
1786 &value
->surface
.bevel
,
1787 &value
->surface
.interlaced
,
1788 &value
->surface
.border
,
1790 if (!read_color(db
, inst
, cname
, &value
->surface
.primary
))
1791 value
->surface
.primary
= RrColorNew(inst
, 0, 0, 0);
1792 if (!read_color(db
, inst
, ctoname
, &value
->surface
.secondary
))
1793 value
->surface
.secondary
= RrColorNew(inst
, 0, 0, 0);
1794 if (value
->surface
.border
)
1795 if (!read_color(db
, inst
, bcname
,
1796 &value
->surface
.border_color
))
1797 value
->surface
.border_color
= RrColorNew(inst
, 0, 0, 0);
1798 if (value
->surface
.interlaced
)
1799 if (!read_color(db
, inst
, icname
,
1800 &value
->surface
.interlace_color
))
1801 value
->surface
.interlace_color
= RrColorNew(inst
, 0, 0, 0);
1802 if (read_int(db
, hname
, &i
) && i
>= 0)
1803 value
->surface
.bevel_light_adjust
= i
;
1804 if (read_int(db
, sname
, &i
) && i
>= 0 && i
<= 256)
1805 value
->surface
.bevel_dark_adjust
= i
;
1807 if (value
->surface
.grad
== RR_SURFACE_SPLIT_VERTICAL
) {
1810 if (!read_color(db
, inst
, csplitname
,
1811 &value
->surface
.split_primary
))
1813 r
= value
->surface
.primary
->r
;
1815 g
= value
->surface
.primary
->g
;
1817 b
= value
->surface
.primary
->b
;
1819 if (r
> 0xFF) r
= 0xFF;
1820 if (g
> 0xFF) g
= 0xFF;
1821 if (b
> 0xFF) b
= 0xFF;
1822 value
->surface
.split_primary
= RrColorNew(inst
, r
, g
, b
);
1825 if (!read_color(db
, inst
, ctosplitname
,
1826 &value
->surface
.split_secondary
))
1828 r
= value
->surface
.secondary
->r
;
1830 g
= value
->surface
.secondary
->g
;
1832 b
= value
->surface
.secondary
->b
;
1834 if (r
> 0xFF) r
= 0xFF;
1835 if (g
> 0xFF) g
= 0xFF;
1836 if (b
> 0xFF) b
= 0xFF;
1837 value
->surface
.split_secondary
= RrColorNew(inst
, r
, g
, b
);
1844 g_free(ctosplitname
);
1856 static int parse_inline_number(const char *p
)
1864 for (; isdigit(*p
); ++p
)
1865 res
= res
* 10 + *p
- '0';
1870 static void set_default_appearance(RrAppearance
*a
)
1872 a
->surface
.grad
= RR_SURFACE_SOLID
;
1873 a
->surface
.relief
= RR_RELIEF_FLAT
;
1874 a
->surface
.bevel
= RR_BEVEL_1
;
1875 a
->surface
.interlaced
= FALSE
;
1876 a
->surface
.border
= FALSE
;
1877 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1878 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1881 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1882 an RrTextureRGBA. */
1883 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1888 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1890 for (i
= 0; i
< width
* height
; ++i
) {
1891 guchar a
= ((*p
>> 24) & 0xff);
1892 guchar b
= ((*p
>> 16) & 0xff);
1893 guchar g
= ((*p
>> 8) & 0xff);
1894 guchar r
= ((*p
>> 0) & 0xff);
1896 *p
= ((r
<< RrDefaultRedOffset
) +
1897 (g
<< RrDefaultGreenOffset
) +
1898 (b
<< RrDefaultBlueOffset
) +
1899 (a
<< RrDefaultAlphaOffset
));