1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 theme.c for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 See the COPYING file for a copy of the GNU General Public License.
26 #include "parser/parse.h"
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
, const RrInstance
*inst
)
55 /* Only load the default font once */
57 RrFontRef(*default_font
);
59 *default_font
= RrFontOpenDefault(inst
);
65 RrTheme
* RrThemeNew(const RrInstance
*inst
, const gchar
*name
,
66 gboolean allow_fallback
,
67 RrFont
*active_window_font
, RrFont
*inactive_window_font
,
68 RrFont
*menu_title_font
, RrFont
*menu_item_font
,
71 XrmDatabase db
= NULL
;
72 RrJustify winjust
, mtitlejust
;
75 RrFont
*default_font
= NULL
;
80 db
= loaddb(name
, &path
);
82 g_message("Unable to load the theme '%s'", name
);
84 g_message("Falling back to the default theme '%s'",
86 /* fallback to the default theme */
92 db
= loaddb(DEFAULT_THEME
, &path
);
94 g_message("Unable to load the theme '%s'", DEFAULT_THEME
);
101 theme
= g_new0(RrTheme
, 1);
104 theme
->name
= g_strdup(name
? name
: DEFAULT_THEME
);
106 theme
->a_disabled_focused_max
= RrAppearanceNew(inst
, 1);
107 theme
->a_disabled_unfocused_max
= RrAppearanceNew(inst
, 1);
108 theme
->a_hover_focused_max
= RrAppearanceNew(inst
, 1);
109 theme
->a_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
110 theme
->a_toggled_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
111 theme
->a_toggled_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
112 theme
->a_toggled_hover_focused_max
= RrAppearanceNew(inst
, 1);
113 theme
->a_toggled_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
114 theme
->a_toggled_focused_pressed_max
= RrAppearanceNew(inst
, 1);
115 theme
->a_toggled_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
116 theme
->a_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
117 theme
->a_focused_pressed_max
= RrAppearanceNew(inst
, 1);
118 theme
->a_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
119 theme
->a_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
120 theme
->a_focused_grip
= RrAppearanceNew(inst
, 0);
121 theme
->a_unfocused_grip
= RrAppearanceNew(inst
, 0);
122 theme
->a_focused_title
= RrAppearanceNew(inst
, 0);
123 theme
->a_unfocused_title
= RrAppearanceNew(inst
, 0);
124 theme
->a_focused_label
= RrAppearanceNew(inst
, 1);
125 theme
->a_unfocused_label
= RrAppearanceNew(inst
, 1);
126 theme
->a_icon
= RrAppearanceNew(inst
, 1);
127 theme
->a_focused_handle
= RrAppearanceNew(inst
, 0);
128 theme
->a_unfocused_handle
= RrAppearanceNew(inst
, 0);
129 theme
->a_menu
= RrAppearanceNew(inst
, 0);
130 theme
->a_menu_title
= RrAppearanceNew(inst
, 0);
131 theme
->a_menu_text_title
= RrAppearanceNew(inst
, 1);
132 theme
->a_menu_normal
= RrAppearanceNew(inst
, 0);
133 theme
->a_menu_selected
= RrAppearanceNew(inst
, 0);
134 theme
->a_menu_disabled
= RrAppearanceNew(inst
, 0);
135 /* a_menu_disabled_selected is copied from a_menu_selected */
136 theme
->a_menu_text_normal
= RrAppearanceNew(inst
, 1);
137 theme
->a_menu_text_selected
= RrAppearanceNew(inst
, 1);
138 theme
->a_menu_text_disabled
= RrAppearanceNew(inst
, 1);
139 theme
->a_menu_text_disabled_selected
= RrAppearanceNew(inst
, 1);
140 theme
->a_menu_bullet_normal
= RrAppearanceNew(inst
, 1);
141 theme
->a_menu_bullet_selected
= RrAppearanceNew(inst
, 1);
142 theme
->a_clear
= RrAppearanceNew(inst
, 0);
143 theme
->a_clear_tex
= RrAppearanceNew(inst
, 1);
144 theme
->osd_hilite_bg
= RrAppearanceNew(inst
, 0);
145 theme
->osd_hilite_label
= RrAppearanceNew(inst
, 1);
146 theme
->osd_hilite_fg
= RrAppearanceNew(inst
, 0);
147 theme
->osd_unhilite_fg
= RrAppearanceNew(inst
, 0);
149 /* load the font stuff */
150 theme
->win_font_focused
= get_font(active_window_font
, &default_font
, inst
);
151 theme
->win_font_unfocused
= get_font(inactive_window_font
, &default_font
, inst
);
153 winjust
= RR_JUSTIFY_LEFT
;
154 if (read_string(db
, "window.label.text.justify", &str
)) {
155 if (!g_ascii_strcasecmp(str
, "right"))
156 winjust
= RR_JUSTIFY_RIGHT
;
157 else if (!g_ascii_strcasecmp(str
, "center"))
158 winjust
= RR_JUSTIFY_CENTER
;
161 theme
->menu_title_font
= get_font(menu_title_font
, &default_font
, inst
);
163 mtitlejust
= RR_JUSTIFY_LEFT
;
164 if (read_string(db
, "menu.title.text.justify", &str
)) {
165 if (!g_ascii_strcasecmp(str
, "right"))
166 mtitlejust
= RR_JUSTIFY_RIGHT
;
167 else if (!g_ascii_strcasecmp(str
, "center"))
168 mtitlejust
= RR_JUSTIFY_CENTER
;
171 theme
->menu_font
= get_font(menu_item_font
, &default_font
, inst
);
173 theme
->osd_font
= get_font(osd_font
, &default_font
, inst
);
175 /* load direct dimensions */
176 if ((!read_int(db
, "menu.overlap.x", &theme
->menu_overlap_x
) &&
177 !read_int(db
, "menu.overlap", &theme
->menu_overlap_x
)) ||
178 theme
->menu_overlap_x
< -100 || theme
->menu_overlap_x
> 100)
179 theme
->menu_overlap_x
= 0;
180 if ((!read_int(db
, "menu.overlap.y", &theme
->menu_overlap_y
) &&
181 !read_int(db
, "menu.overlap", &theme
->menu_overlap_y
)) ||
182 theme
->menu_overlap_y
< -100 || theme
->menu_overlap_y
> 100)
183 theme
->menu_overlap_y
= 0;
184 if (!read_int(db
, "window.handle.width", &theme
->handle_height
) ||
185 theme
->handle_height
< 0 || theme
->handle_height
> 100)
186 theme
->handle_height
= 6;
187 if (!read_int(db
, "padding.width", &theme
->paddingx
) ||
188 theme
->paddingx
< 0 || theme
->paddingx
> 100)
190 if (!read_int(db
, "padding.height", &theme
->paddingy
) ||
191 theme
->paddingy
< 0 || theme
->paddingy
> 100)
192 theme
->paddingy
= theme
->paddingx
;
193 if (!read_int(db
, "border.width", &theme
->fbwidth
) ||
194 theme
->fbwidth
< 0 || theme
->fbwidth
> 100)
196 /* menu border width inherits from the frame border width */
197 if (!read_int(db
, "menu.border.width", &theme
->mbwidth
) ||
198 theme
->mbwidth
< 0 || theme
->mbwidth
> 100)
199 theme
->mbwidth
= theme
->fbwidth
;
200 /* osd border width inherits from the frame border width */
201 if (!read_int(db
, "osd.border.width", &theme
->obwidth
) ||
202 theme
->obwidth
< 0 || theme
->obwidth
> 100)
203 theme
->obwidth
= theme
->fbwidth
;
204 if (!read_int(db
, "window.client.padding.width", &theme
->cbwidthx
) ||
205 theme
->cbwidthx
< 0 || theme
->cbwidthx
> 100)
206 theme
->cbwidthx
= theme
->paddingx
;
207 if (!read_int(db
, "window.client.padding.height", &theme
->cbwidthy
) ||
208 theme
->cbwidthy
< 0 || theme
->cbwidthy
> 100)
209 theme
->cbwidthy
= theme
->cbwidthx
;
210 if (!read_int(db
, "menu.separator.width", &theme
->menu_sep_width
) ||
211 theme
->menu_sep_width
< 1 || theme
->menu_sep_width
> 100)
212 theme
->menu_sep_width
= 1;
213 if (!read_int(db
, "menu.separator.padding.width",
214 &theme
->menu_sep_paddingx
) ||
215 theme
->menu_sep_paddingx
< 0 || theme
->menu_sep_paddingx
> 100)
216 theme
->menu_sep_paddingx
= 6;
217 if (!read_int(db
, "menu.separator.padding.height",
218 &theme
->menu_sep_paddingy
) ||
219 theme
->menu_sep_paddingy
< 0 || theme
->menu_sep_paddingy
> 100)
220 theme
->menu_sep_paddingy
= 3;
223 if (!read_color(db
, inst
,
224 "window.active.border.color",
225 &theme
->frame_focused_border_color
) &&
226 !read_color(db
, inst
,
228 &theme
->frame_focused_border_color
))
229 theme
->frame_focused_border_color
= RrColorNew(inst
, 0, 0, 0);
230 /* title separator focused color inherits from focused border color */
231 if (!read_color(db
, inst
,
232 "window.active.title.separator.color",
233 &theme
->title_separator_focused_color
))
234 theme
->title_separator_focused_color
=
236 theme
->frame_focused_border_color
->r
,
237 theme
->frame_focused_border_color
->g
,
238 theme
->frame_focused_border_color
->b
);
239 /* unfocused border color inherits from frame focused border color */
240 if (!read_color(db
, inst
,
241 "window.inactive.border.color",
242 &theme
->frame_unfocused_border_color
))
243 theme
->frame_unfocused_border_color
=
244 RrColorNew(inst
, theme
->frame_focused_border_color
->r
,
245 theme
->frame_focused_border_color
->g
,
246 theme
->frame_focused_border_color
->b
);
247 /* title separator unfocused color inherits from unfocused border color */
248 if (!read_color(db
, inst
,
249 "window.inactive.title.separator.color",
250 &theme
->title_separator_unfocused_color
))
251 theme
->title_separator_unfocused_color
=
253 theme
->frame_unfocused_border_color
->r
,
254 theme
->frame_unfocused_border_color
->g
,
255 theme
->frame_unfocused_border_color
->b
);
257 /* menu border color inherits from frame focused border color */
258 if (!read_color(db
, inst
, "menu.border.color", &theme
->menu_border_color
))
259 theme
->menu_border_color
=
261 theme
->frame_focused_border_color
->r
,
262 theme
->frame_focused_border_color
->g
,
263 theme
->frame_focused_border_color
->b
);
264 /* osd border color inherits from frame focused border color */
265 if (!read_color(db
, inst
, "osd.border.color", &theme
->osd_border_color
))
266 theme
->osd_border_color
=
268 theme
->frame_focused_border_color
->r
,
269 theme
->frame_focused_border_color
->g
,
270 theme
->frame_focused_border_color
->b
);
271 if (!read_color(db
, inst
,
272 "window.active.client.color",
273 &theme
->cb_focused_color
))
274 theme
->cb_focused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
275 if (!read_color(db
, inst
,
276 "window.inactive.client.color",
277 &theme
->cb_unfocused_color
))
278 theme
->cb_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
279 if (!read_color(db
, inst
,
280 "window.active.label.text.color",
281 &theme
->title_focused_color
))
282 theme
->title_focused_color
= RrColorNew(inst
, 0x0, 0x0, 0x0);
283 if (!read_color(db
, inst
, "osd.label.text.color", &theme
->osd_color
))
284 theme
->osd_color
= RrColorNew(inst
,
285 theme
->title_focused_color
->r
,
286 theme
->title_focused_color
->g
,
287 theme
->title_focused_color
->b
);
288 if (!read_color(db
, inst
,
289 "window.inactive.label.text.color",
290 &theme
->title_unfocused_color
))
291 theme
->title_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
292 if (!read_color(db
, inst
,
293 "window.active.button.unpressed.image.color",
294 &theme
->titlebut_focused_unpressed_color
))
295 theme
->titlebut_focused_unpressed_color
= RrColorNew(inst
, 0, 0, 0);
296 if (!read_color(db
, inst
,
297 "window.inactive.button.unpressed.image.color",
298 &theme
->titlebut_unfocused_unpressed_color
))
299 theme
->titlebut_unfocused_unpressed_color
=
300 RrColorNew(inst
, 0xff, 0xff, 0xff);
301 if (!read_color(db
, inst
,
302 "window.active.button.pressed.image.color",
303 &theme
->titlebut_focused_pressed_color
))
304 theme
->titlebut_focused_pressed_color
=
306 theme
->titlebut_focused_unpressed_color
->r
,
307 theme
->titlebut_focused_unpressed_color
->g
,
308 theme
->titlebut_focused_unpressed_color
->b
);
309 if (!read_color(db
, inst
,
310 "window.inactive.button.pressed.image.color",
311 &theme
->titlebut_unfocused_pressed_color
))
312 theme
->titlebut_unfocused_pressed_color
=
314 theme
->titlebut_unfocused_unpressed_color
->r
,
315 theme
->titlebut_unfocused_unpressed_color
->g
,
316 theme
->titlebut_unfocused_unpressed_color
->b
);
317 if (!read_color(db
, inst
,
318 "window.active.button.disabled.image.color",
319 &theme
->titlebut_disabled_focused_color
))
320 theme
->titlebut_disabled_focused_color
=
321 RrColorNew(inst
, 0xff, 0xff, 0xff);
322 if (!read_color(db
, inst
,
323 "window.inactive.button.disabled.image.color",
324 &theme
->titlebut_disabled_unfocused_color
))
325 theme
->titlebut_disabled_unfocused_color
= RrColorNew(inst
, 0, 0, 0);
326 if (!read_color(db
, inst
,
327 "window.active.button.hover.image.color",
328 &theme
->titlebut_hover_focused_color
))
329 theme
->titlebut_hover_focused_color
=
331 theme
->titlebut_focused_unpressed_color
->r
,
332 theme
->titlebut_focused_unpressed_color
->g
,
333 theme
->titlebut_focused_unpressed_color
->b
);
334 if (!read_color(db
, inst
,
335 "window.inactive.button.hover.image.color",
336 &theme
->titlebut_hover_unfocused_color
))
337 theme
->titlebut_hover_unfocused_color
=
339 theme
->titlebut_unfocused_unpressed_color
->r
,
340 theme
->titlebut_unfocused_unpressed_color
->g
,
341 theme
->titlebut_unfocused_unpressed_color
->b
);
342 if (!read_color(db
, inst
,
343 "window.active.button.toggled.unpressed.image.color",
344 &theme
->titlebut_toggled_focused_unpressed_color
) &&
345 !read_color(db
, inst
,
346 "window.active.button.toggled.image.color",
347 &theme
->titlebut_toggled_focused_unpressed_color
))
348 theme
->titlebut_toggled_focused_unpressed_color
=
350 theme
->titlebut_focused_pressed_color
->r
,
351 theme
->titlebut_focused_pressed_color
->g
,
352 theme
->titlebut_focused_pressed_color
->b
);
353 if (!read_color(db
, inst
,
354 "window.inactive.button.toggled.unpressed.image.color",
355 &theme
->titlebut_toggled_unfocused_unpressed_color
) &&
356 !read_color(db
, inst
,
357 "window.inactive.button.toggled.image.color",
358 &theme
->titlebut_toggled_unfocused_unpressed_color
))
359 theme
->titlebut_toggled_unfocused_unpressed_color
=
361 theme
->titlebut_unfocused_pressed_color
->r
,
362 theme
->titlebut_unfocused_pressed_color
->g
,
363 theme
->titlebut_unfocused_pressed_color
->b
);
364 if (!read_color(db
, inst
,
365 "window.active.button.toggled.hover.image.color",
366 &theme
->titlebut_toggled_hover_focused_color
))
367 theme
->titlebut_toggled_hover_focused_color
=
369 theme
->titlebut_toggled_focused_unpressed_color
->r
,
370 theme
->titlebut_toggled_focused_unpressed_color
->g
,
371 theme
->titlebut_toggled_focused_unpressed_color
->b
);
372 if (!read_color(db
, inst
,
373 "window.inactive.button.toggled.hover.image.color",
374 &theme
->titlebut_toggled_hover_unfocused_color
))
375 theme
->titlebut_toggled_hover_unfocused_color
=
377 theme
->titlebut_toggled_unfocused_unpressed_color
->r
,
378 theme
->titlebut_toggled_unfocused_unpressed_color
->g
,
379 theme
->titlebut_toggled_unfocused_unpressed_color
->b
);
380 if (!read_color(db
, inst
,
381 "window.active.button.toggled.pressed.image.color",
382 &theme
->titlebut_toggled_focused_pressed_color
))
383 theme
->titlebut_toggled_focused_pressed_color
=
385 theme
->titlebut_focused_pressed_color
->r
,
386 theme
->titlebut_focused_pressed_color
->g
,
387 theme
->titlebut_focused_pressed_color
->b
);
388 if (!read_color(db
, inst
,
389 "window.inactive.button.toggled.pressed.image.color",
390 &theme
->titlebut_toggled_unfocused_pressed_color
))
391 theme
->titlebut_toggled_unfocused_pressed_color
=
393 theme
->titlebut_unfocused_pressed_color
->r
,
394 theme
->titlebut_unfocused_pressed_color
->g
,
395 theme
->titlebut_unfocused_pressed_color
->b
);
396 if (!read_color(db
, inst
,
397 "menu.title.text.color", &theme
->menu_title_color
))
398 theme
->menu_title_color
= RrColorNew(inst
, 0, 0, 0);
399 if (!read_color(db
, inst
,
400 "menu.items.text.color", &theme
->menu_color
))
401 theme
->menu_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
402 if (!read_color(db
, inst
,
403 "menu.items.disabled.text.color",
404 &theme
->menu_disabled_color
))
405 theme
->menu_disabled_color
= RrColorNew(inst
, 0, 0, 0);
406 if (!read_color(db
, inst
,
407 "menu.items.active.disabled.text.color",
408 &theme
->menu_disabled_selected_color
))
409 theme
->menu_disabled_selected_color
=
411 theme
->menu_disabled_color
->r
,
412 theme
->menu_disabled_color
->g
,
413 theme
->menu_disabled_color
->b
);
414 if (!read_color(db
, inst
,
415 "menu.items.active.text.color",
416 &theme
->menu_selected_color
))
417 theme
->menu_selected_color
= RrColorNew(inst
, 0, 0, 0);
418 if (!read_color(db
, inst
,
419 "menu.separator.color", &theme
->menu_sep_color
))
420 theme
->menu_sep_color
= RrColorNew(inst
,
421 theme
->menu_color
->r
,
422 theme
->menu_color
->g
,
423 theme
->menu_color
->b
);
425 /* load the image masks */
427 /* maximize button masks */
429 if (!read_mask(inst
, path
, theme
, "max.xbm", &theme
->max_mask
)) {
430 guchar data
[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
431 theme
->max_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
434 if (!read_mask(inst
, path
, theme
, "max_toggled.xbm",
435 &theme
->max_toggled_mask
))
438 theme
->max_toggled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
440 guchar data
[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
441 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 6, 6,(gchar
*)data
);
444 if (!read_mask(inst
, path
, theme
, "max_pressed.xbm",
445 &theme
->max_pressed_mask
))
446 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
447 if (!read_mask(inst
,path
,theme
,"max_disabled.xbm",
448 &theme
->max_disabled_mask
))
449 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
450 if (!read_mask(inst
, path
, theme
, "max_hover.xbm", &theme
->max_hover_mask
))
451 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
452 if (!read_mask(inst
, path
, theme
, "max_toggled_pressed.xbm",
453 &theme
->max_toggled_pressed_mask
))
454 theme
->max_toggled_pressed_mask
=
455 RrPixmapMaskCopy(theme
->max_toggled_mask
);
456 if (!read_mask(inst
, path
, theme
, "max_toggled_hover.xbm",
457 &theme
->max_toggled_hover_mask
))
458 theme
->max_toggled_hover_mask
=
459 RrPixmapMaskCopy(theme
->max_toggled_mask
);
461 /* iconify button masks */
462 if (!read_mask(inst
, path
, theme
, "iconify.xbm", &theme
->iconify_mask
)) {
463 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
464 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
466 if (!read_mask(inst
, path
, theme
, "iconify_pressed.xbm",
467 &theme
->iconify_pressed_mask
))
468 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
469 if (!read_mask(inst
, path
, theme
, "iconify_disabled.xbm",
470 &theme
->iconify_disabled_mask
))
471 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
472 if (!read_mask(inst
, path
, theme
, "iconify_hover.xbm",
473 &theme
->iconify_hover_mask
))
474 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
476 /* all desktops button masks */
478 if (!read_mask(inst
, path
, theme
, "desk.xbm", &theme
->desk_mask
)) {
479 guchar data
[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
480 theme
->desk_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
483 if (!read_mask(inst
, path
, theme
, "desk_toggled.xbm",
484 &theme
->desk_toggled_mask
)) {
486 theme
->desk_toggled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
488 guchar data
[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
489 theme
->desk_toggled_mask
=
490 RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
493 if (!read_mask(inst
, path
, theme
, "desk_pressed.xbm",
494 &theme
->desk_pressed_mask
))
495 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
496 if (!read_mask(inst
, path
, theme
, "desk_disabled.xbm",
497 &theme
->desk_disabled_mask
))
498 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
499 if (!read_mask(inst
, path
, theme
, "desk_hover.xbm",
500 &theme
->desk_hover_mask
))
501 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
502 if (!read_mask(inst
, path
, theme
, "desk_toggled_pressed.xbm",
503 &theme
->desk_toggled_pressed_mask
))
504 theme
->desk_toggled_pressed_mask
=
505 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
506 if (!read_mask(inst
, path
, theme
, "desk_toggled_hover.xbm",
507 &theme
->desk_toggled_hover_mask
))
508 theme
->desk_toggled_hover_mask
=
509 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
511 /* shade button masks */
512 if (!read_mask(inst
, path
, theme
, "shade.xbm", &theme
->shade_mask
)) {
513 guchar data
[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
514 theme
->shade_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
516 if (!read_mask(inst
, path
, theme
, "shade_toggled.xbm",
517 &theme
->shade_toggled_mask
))
518 theme
->shade_toggled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
519 if (!read_mask(inst
, path
, theme
, "shade_pressed.xbm",
520 &theme
->shade_pressed_mask
))
521 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
522 if (!read_mask(inst
, path
, theme
, "shade_disabled.xbm",
523 &theme
->shade_disabled_mask
))
524 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
525 if (!read_mask(inst
, path
, theme
, "shade_hover.xbm",
526 &theme
->shade_hover_mask
))
527 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
528 if (!read_mask(inst
, path
, theme
, "shade_toggled_pressed.xbm",
529 &theme
->shade_toggled_pressed_mask
))
530 theme
->shade_toggled_pressed_mask
=
531 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
532 if (!read_mask(inst
, path
, theme
, "shade_toggled_hover.xbm",
533 &theme
->shade_toggled_hover_mask
))
534 theme
->shade_toggled_hover_mask
=
535 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
537 /* close button masks */
538 if (!read_mask(inst
, path
, theme
, "close.xbm", &theme
->close_mask
)) {
539 guchar data
[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
540 theme
->close_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
542 if (!read_mask(inst
, path
, theme
, "close_pressed.xbm",
543 &theme
->close_pressed_mask
))
544 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
545 if (!read_mask(inst
, path
, theme
, "close_disabled.xbm",
546 &theme
->close_disabled_mask
))
547 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
548 if (!read_mask(inst
, path
, theme
, "close_hover.xbm",
549 &theme
->close_hover_mask
))
550 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
552 /* submenu bullet mask */
553 if (!read_mask(inst
, path
, theme
, "bullet.xbm", &theme
->menu_bullet_mask
))
555 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
556 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
559 /* setup the default window icon */
560 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
561 OB_DEFAULT_ICON_HEIGHT
,
562 OB_DEFAULT_ICON_pixel_data
);
563 theme
->def_win_icon_w
= OB_DEFAULT_ICON_WIDTH
;
564 theme
->def_win_icon_h
= OB_DEFAULT_ICON_HEIGHT
;
566 /* read the decoration textures */
567 if (!read_appearance(db
, inst
,
568 "window.active.title.bg", theme
->a_focused_title
,
570 set_default_appearance(theme
->a_focused_title
);
571 if (!read_appearance(db
, inst
,
572 "window.inactive.title.bg", theme
->a_unfocused_title
,
574 set_default_appearance(theme
->a_unfocused_title
);
575 if (!read_appearance(db
, inst
,
576 "window.active.label.bg", theme
->a_focused_label
,
578 set_default_appearance(theme
->a_focused_label
);
579 if (!read_appearance(db
, inst
,
580 "window.inactive.label.bg", theme
->a_unfocused_label
,
582 set_default_appearance(theme
->a_unfocused_label
);
583 if (!read_appearance(db
, inst
,
584 "window.active.handle.bg", theme
->a_focused_handle
,
586 set_default_appearance(theme
->a_focused_handle
);
587 if (!read_appearance(db
, inst
,
588 "window.inactive.handle.bg",theme
->a_unfocused_handle
,
590 set_default_appearance(theme
->a_unfocused_handle
);
591 if (!read_appearance(db
, inst
,
592 "window.active.grip.bg", theme
->a_focused_grip
,
594 set_default_appearance(theme
->a_focused_grip
);
595 if (!read_appearance(db
, inst
,
596 "window.inactive.grip.bg", theme
->a_unfocused_grip
,
598 set_default_appearance(theme
->a_unfocused_grip
);
599 if (!read_appearance(db
, inst
,
600 "menu.items.bg", theme
->a_menu
,
602 set_default_appearance(theme
->a_menu
);
603 if (!read_appearance(db
, inst
,
604 "menu.title.bg", theme
->a_menu_title
,
606 set_default_appearance(theme
->a_menu_title
);
607 if (!read_appearance(db
, inst
,
608 "menu.items.active.bg", theme
->a_menu_selected
,
610 set_default_appearance(theme
->a_menu_selected
);
611 theme
->a_menu_disabled_selected
=
612 RrAppearanceCopy(theme
->a_menu_selected
);
614 /* read appearances for non-decorations (on-screen-display) */
615 if (!read_appearance(db
, inst
, "osd.bg", theme
->osd_hilite_bg
, FALSE
)) {
616 RrAppearanceFree(theme
->osd_hilite_bg
);
617 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
619 if (!read_appearance(db
, inst
, "osd.label.bg",
620 theme
->osd_hilite_label
, TRUE
)) {
621 RrAppearanceFree(theme
->osd_hilite_label
);
622 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
624 /* osd_hilite_fg can't be parentrel */
625 if (!read_appearance(db
, inst
, "osd.hilight.bg",
626 theme
->osd_hilite_fg
, FALSE
)) {
627 RrAppearanceFree(theme
->osd_hilite_fg
);
628 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
629 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_label
);
631 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_title
);
633 /* osd_unhilite_fg can't be parentrel either */
634 if (!read_appearance(db
, inst
, "osd.unhilight.bg",
635 theme
->osd_unhilite_fg
, FALSE
)) {
636 RrAppearanceFree(theme
->osd_unhilite_fg
);
637 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
638 theme
->osd_unhilite_fg
=RrAppearanceCopy(theme
->a_unfocused_label
);
640 theme
->osd_unhilite_fg
=RrAppearanceCopy(theme
->a_unfocused_title
);
643 /* read buttons textures */
644 if (!read_appearance(db
, inst
,
645 "window.active.button.disabled.bg",
646 theme
->a_disabled_focused_max
,
648 set_default_appearance(theme
->a_disabled_focused_max
);
649 if (!read_appearance(db
, inst
,
650 "window.inactive.button.disabled.bg",
651 theme
->a_disabled_unfocused_max
,
653 set_default_appearance(theme
->a_disabled_unfocused_max
);
654 if (!read_appearance(db
, inst
,
655 "window.active.button.pressed.bg",
656 theme
->a_focused_pressed_max
,
658 set_default_appearance(theme
->a_focused_pressed_max
);
659 if (!read_appearance(db
, inst
,
660 "window.inactive.button.pressed.bg",
661 theme
->a_unfocused_pressed_max
,
663 set_default_appearance(theme
->a_unfocused_pressed_max
);
664 if (!read_appearance(db
, inst
,
665 "window.active.button.toggled.unpressed.bg",
666 theme
->a_toggled_focused_unpressed_max
,
668 !read_appearance(db
, inst
,
669 "window.active.button.toggled.bg",
670 theme
->a_toggled_focused_unpressed_max
,
673 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
674 theme
->a_toggled_focused_unpressed_max
=
675 RrAppearanceCopy(theme
->a_focused_pressed_max
);
677 if (!read_appearance(db
, inst
,
678 "window.inactive.button.toggled.unpressed.bg",
679 theme
->a_toggled_unfocused_unpressed_max
,
681 !read_appearance(db
, inst
,
682 "window.inactive.button.toggled.bg",
683 theme
->a_toggled_unfocused_unpressed_max
,
686 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
687 theme
->a_toggled_unfocused_unpressed_max
=
688 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
690 if (!read_appearance(db
, inst
,
691 "window.active.button.toggled.hover.bg",
692 theme
->a_toggled_hover_focused_max
,
695 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
696 theme
->a_toggled_hover_focused_max
=
697 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
699 if (!read_appearance(db
, inst
,
700 "window.inactive.button.toggled.hover.bg",
701 theme
->a_toggled_hover_unfocused_max
,
704 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
705 theme
->a_toggled_hover_unfocused_max
=
706 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
708 if (!read_appearance(db
, inst
,
709 "window.active.button.toggled.pressed.bg",
710 theme
->a_toggled_focused_pressed_max
,
713 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
714 theme
->a_toggled_focused_pressed_max
=
715 RrAppearanceCopy(theme
->a_focused_pressed_max
);
717 if (!read_appearance(db
, inst
,
718 "window.inactive.button.toggled.pressed.bg",
719 theme
->a_toggled_unfocused_pressed_max
,
722 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
723 theme
->a_toggled_unfocused_pressed_max
=
724 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
726 if (!read_appearance(db
, inst
,
727 "window.active.button.unpressed.bg",
728 theme
->a_focused_unpressed_max
,
730 set_default_appearance(theme
->a_focused_unpressed_max
);
731 if (!read_appearance(db
, inst
,
732 "window.inactive.button.unpressed.bg",
733 theme
->a_unfocused_unpressed_max
,
735 set_default_appearance(theme
->a_unfocused_unpressed_max
);
736 if (!read_appearance(db
, inst
,
737 "window.active.button.hover.bg",
738 theme
->a_hover_focused_max
,
741 RrAppearanceFree(theme
->a_hover_focused_max
);
742 theme
->a_hover_focused_max
=
743 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
745 if (!read_appearance(db
, inst
,
746 "window.inactive.button.hover.bg",
747 theme
->a_hover_unfocused_max
,
750 RrAppearanceFree(theme
->a_hover_unfocused_max
);
751 theme
->a_hover_unfocused_max
=
752 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
755 theme
->a_disabled_focused_close
=
756 RrAppearanceCopy(theme
->a_disabled_focused_max
);
757 theme
->a_disabled_unfocused_close
=
758 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
759 theme
->a_hover_focused_close
=
760 RrAppearanceCopy(theme
->a_hover_focused_max
);
761 theme
->a_hover_unfocused_close
=
762 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
763 theme
->a_unfocused_unpressed_close
=
764 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
765 theme
->a_unfocused_pressed_close
=
766 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
767 theme
->a_focused_unpressed_close
=
768 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
769 theme
->a_focused_pressed_close
=
770 RrAppearanceCopy(theme
->a_focused_pressed_max
);
771 theme
->a_disabled_focused_desk
=
772 RrAppearanceCopy(theme
->a_disabled_focused_max
);
773 theme
->a_disabled_unfocused_desk
=
774 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
775 theme
->a_hover_focused_desk
=
776 RrAppearanceCopy(theme
->a_hover_focused_max
);
777 theme
->a_hover_unfocused_desk
=
778 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
779 theme
->a_toggled_hover_focused_desk
=
780 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
781 theme
->a_toggled_hover_unfocused_desk
=
782 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
783 theme
->a_toggled_focused_unpressed_desk
=
784 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
785 theme
->a_toggled_unfocused_unpressed_desk
=
786 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
787 theme
->a_toggled_focused_pressed_desk
=
788 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
789 theme
->a_toggled_unfocused_pressed_desk
=
790 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
791 theme
->a_unfocused_unpressed_desk
=
792 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
793 theme
->a_unfocused_pressed_desk
=
794 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
795 theme
->a_focused_unpressed_desk
=
796 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
797 theme
->a_focused_pressed_desk
=
798 RrAppearanceCopy(theme
->a_focused_pressed_max
);
799 theme
->a_disabled_focused_shade
=
800 RrAppearanceCopy(theme
->a_disabled_focused_max
);
801 theme
->a_disabled_unfocused_shade
=
802 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
803 theme
->a_hover_focused_shade
=
804 RrAppearanceCopy(theme
->a_hover_focused_max
);
805 theme
->a_hover_unfocused_shade
=
806 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
807 theme
->a_toggled_hover_focused_shade
=
808 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
809 theme
->a_toggled_hover_unfocused_shade
=
810 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
811 theme
->a_toggled_focused_unpressed_shade
=
812 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
813 theme
->a_toggled_unfocused_unpressed_shade
=
814 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
815 theme
->a_toggled_focused_pressed_shade
=
816 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
817 theme
->a_toggled_unfocused_pressed_shade
=
818 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
819 theme
->a_unfocused_unpressed_shade
=
820 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
821 theme
->a_unfocused_pressed_shade
=
822 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
823 theme
->a_focused_unpressed_shade
=
824 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
825 theme
->a_focused_pressed_shade
=
826 RrAppearanceCopy(theme
->a_focused_pressed_max
);
827 theme
->a_disabled_focused_iconify
=
828 RrAppearanceCopy(theme
->a_disabled_focused_max
);
829 theme
->a_disabled_unfocused_iconify
=
830 RrAppearanceCopy(theme
->a_disabled_focused_max
);
831 theme
->a_hover_focused_iconify
=
832 RrAppearanceCopy(theme
->a_hover_focused_max
);
833 theme
->a_hover_unfocused_iconify
=
834 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
835 theme
->a_unfocused_unpressed_iconify
=
836 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
837 theme
->a_unfocused_pressed_iconify
=
838 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
839 theme
->a_focused_unpressed_iconify
=
840 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
841 theme
->a_focused_pressed_iconify
=
842 RrAppearanceCopy(theme
->a_focused_pressed_max
);
844 theme
->a_icon
->surface
.grad
=
845 theme
->a_clear
->surface
.grad
=
846 theme
->a_clear_tex
->surface
.grad
=
847 theme
->a_menu_text_title
->surface
.grad
=
848 theme
->a_menu_normal
->surface
.grad
=
849 theme
->a_menu_disabled
->surface
.grad
=
850 theme
->a_menu_text_normal
->surface
.grad
=
851 theme
->a_menu_text_selected
->surface
.grad
=
852 theme
->a_menu_text_disabled
->surface
.grad
=
853 theme
->a_menu_text_disabled_selected
->surface
.grad
=
854 theme
->a_menu_bullet_normal
->surface
.grad
=
855 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
857 /* set up the textures */
858 theme
->a_focused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
859 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
860 theme
->a_focused_label
->texture
[0].data
.text
.font
=theme
->win_font_focused
;
861 theme
->a_focused_label
->texture
[0].data
.text
.color
=
862 theme
->title_focused_color
;
864 if (read_string(db
, "window.active.label.text.font", &str
)) {
868 if (strstr(str
, "shadow=y")) {
869 if ((p
= strstr(str
, "shadowoffset=")))
870 i
= parse_inline_number(p
+ strlen("shadowoffset="));
873 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
874 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
876 if ((p
= strstr(str
, "shadowtint=")))
878 i
= parse_inline_number(p
+ strlen("shadowtint="));
879 j
= (i
> 0 ? 0 : 255);
882 theme
->title_focused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
883 theme
->title_focused_shadow_alpha
= i
;
885 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
886 theme
->title_focused_shadow_alpha
= 50;
890 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
891 theme
->title_focused_shadow_color
;
892 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
893 theme
->title_focused_shadow_alpha
;
895 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
896 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
897 theme
->osd_hilite_label
->texture
[0].data
.text
.font
= theme
->osd_font
;
898 theme
->osd_hilite_label
->texture
[0].data
.text
.color
= theme
->osd_color
;
900 if (read_string(db
, "osd.label.text.font", &str
)) {
904 if (strstr(str
, "shadow=y")) {
905 if ((p
= strstr(str
, "shadowoffset=")))
906 i
= parse_inline_number(p
+ strlen("shadowoffset="));
909 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
910 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
911 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
912 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
914 if ((p
= strstr(str
, "shadowtint=")))
916 i
= parse_inline_number(p
+ strlen("shadowtint="));
917 j
= (i
> 0 ? 0 : 255);
920 theme
->osd_shadow_color
= RrColorNew(inst
, j
, j
, j
);
921 theme
->osd_shadow_alpha
= i
;
923 theme
->osd_shadow_color
= RrColorNew(inst
, 0, 0, 0);
924 theme
->osd_shadow_alpha
= 50;
927 /* inherit the font settings from the focused label */
928 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
929 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
930 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
931 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
932 if (theme
->title_focused_shadow_color
)
933 theme
->osd_shadow_color
=
935 theme
->title_focused_shadow_color
->r
,
936 theme
->title_focused_shadow_color
->g
,
937 theme
->title_focused_shadow_color
->b
);
939 theme
->osd_shadow_color
= RrColorNew(inst
, 0, 0, 0);
940 theme
->osd_shadow_alpha
= theme
->title_focused_shadow_alpha
;
943 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
944 theme
->osd_shadow_color
;
945 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
946 theme
->osd_shadow_alpha
;
948 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
949 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
950 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
951 theme
->win_font_unfocused
;
952 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
953 theme
->title_unfocused_color
;
955 if (read_string(db
, "window.inactive.label.text.font", &str
)) {
959 if (strstr(str
, "shadow=y")) {
960 if ((p
= strstr(str
, "shadowoffset=")))
961 i
= parse_inline_number(p
+ strlen("shadowoffset="));
964 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
965 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
967 if ((p
= strstr(str
, "shadowtint=")))
969 i
= parse_inline_number(p
+ strlen("shadowtint="));
970 j
= (i
> 0 ? 0 : 255);
973 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
974 theme
->title_unfocused_shadow_alpha
= i
;
976 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
977 theme
->title_unfocused_shadow_alpha
= 50;
981 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
982 theme
->title_unfocused_shadow_color
;
983 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
984 theme
->title_unfocused_shadow_alpha
;
986 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
987 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
988 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
989 theme
->menu_title_font
;
990 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
991 theme
->menu_title_color
;
993 if (read_string(db
, "menu.title.text.font", &str
)) {
997 if (strstr(str
, "shadow=y")) {
998 if ((p
= strstr(str
, "shadowoffset=")))
999 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1002 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
= i
;
1003 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= i
;
1005 if ((p
= strstr(str
, "shadowtint=")))
1007 i
= parse_inline_number(p
+ strlen("shadowtint="));
1008 j
= (i
> 0 ? 0 : 255);
1011 theme
->menu_title_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1012 theme
->menu_title_shadow_alpha
= i
;
1014 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1015 theme
->menu_title_shadow_alpha
= 50;
1019 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
1020 theme
->menu_title_shadow_color
;
1021 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
1022 theme
->menu_title_shadow_alpha
;
1024 theme
->a_menu_text_normal
->texture
[0].type
=
1025 theme
->a_menu_text_selected
->texture
[0].type
=
1026 theme
->a_menu_text_disabled
->texture
[0].type
=
1027 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
1029 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
1030 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
1031 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
1032 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
1034 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
1035 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
1036 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
1037 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
1039 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
1040 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
1041 theme
->menu_selected_color
;
1042 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
1043 theme
->menu_disabled_color
;
1044 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
1045 theme
->menu_disabled_selected_color
;
1047 if (read_string(db
, "menu.items.font", &str
)) {
1051 if (strstr(str
, "shadow=y")) {
1052 if ((p
= strstr(str
, "shadowoffset=")))
1053 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1056 theme
->a_menu_text_normal
->
1057 texture
[0].data
.text
.shadow_offset_x
= i
;
1058 theme
->a_menu_text_normal
->
1059 texture
[0].data
.text
.shadow_offset_y
= i
;
1060 theme
->a_menu_text_selected
->
1061 texture
[0].data
.text
.shadow_offset_x
= i
;
1062 theme
->a_menu_text_selected
->
1063 texture
[0].data
.text
.shadow_offset_y
= i
;
1064 theme
->a_menu_text_disabled
->
1065 texture
[0].data
.text
.shadow_offset_x
= i
;
1066 theme
->a_menu_text_disabled
->
1067 texture
[0].data
.text
.shadow_offset_y
= i
;
1068 theme
->a_menu_text_disabled_selected
->
1069 texture
[0].data
.text
.shadow_offset_x
= i
;
1070 theme
->a_menu_text_disabled_selected
->
1071 texture
[0].data
.text
.shadow_offset_y
= i
;
1073 if ((p
= strstr(str
, "shadowtint=")))
1075 i
= parse_inline_number(p
+ strlen("shadowtint="));
1076 j
= (i
> 0 ? 0 : 255);
1079 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1080 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1081 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1082 theme
->menu_text_normal_shadow_alpha
= i
;
1083 theme
->menu_text_selected_shadow_alpha
= i
;
1084 theme
->menu_text_disabled_shadow_alpha
= i
;
1085 theme
->menu_text_disabled_selected_shadow_alpha
= i
;
1087 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1088 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1089 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1090 theme
->menu_text_normal_shadow_alpha
= 50;
1091 theme
->menu_text_selected_shadow_alpha
= 50;
1092 theme
->menu_text_disabled_selected_shadow_alpha
= 50;
1096 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
1097 theme
->menu_text_normal_shadow_color
;
1098 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
1099 theme
->menu_text_normal_shadow_alpha
;
1100 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
1101 theme
->menu_text_selected_shadow_color
;
1102 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
1103 theme
->menu_text_selected_shadow_alpha
;
1104 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
1105 theme
->menu_text_disabled_shadow_color
;
1106 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
1107 theme
->menu_text_disabled_shadow_alpha
;
1108 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
1109 theme
->menu_text_disabled_shadow_color
;
1110 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
1111 theme
->menu_text_disabled_shadow_alpha
;
1113 theme
->a_disabled_focused_max
->texture
[0].type
=
1114 theme
->a_disabled_unfocused_max
->texture
[0].type
=
1115 theme
->a_hover_focused_max
->texture
[0].type
=
1116 theme
->a_hover_unfocused_max
->texture
[0].type
=
1117 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
1118 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
1119 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
1120 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
1121 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
1122 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
1123 theme
->a_focused_unpressed_max
->texture
[0].type
=
1124 theme
->a_focused_pressed_max
->texture
[0].type
=
1125 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
1126 theme
->a_unfocused_pressed_max
->texture
[0].type
=
1127 theme
->a_disabled_focused_close
->texture
[0].type
=
1128 theme
->a_disabled_unfocused_close
->texture
[0].type
=
1129 theme
->a_hover_focused_close
->texture
[0].type
=
1130 theme
->a_hover_unfocused_close
->texture
[0].type
=
1131 theme
->a_focused_unpressed_close
->texture
[0].type
=
1132 theme
->a_focused_pressed_close
->texture
[0].type
=
1133 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
1134 theme
->a_unfocused_pressed_close
->texture
[0].type
=
1135 theme
->a_disabled_focused_desk
->texture
[0].type
=
1136 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
1137 theme
->a_hover_focused_desk
->texture
[0].type
=
1138 theme
->a_hover_unfocused_desk
->texture
[0].type
=
1139 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
1140 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
1141 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
1142 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
1143 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
1144 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
1145 theme
->a_focused_unpressed_desk
->texture
[0].type
=
1146 theme
->a_focused_pressed_desk
->texture
[0].type
=
1147 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
1148 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
1149 theme
->a_disabled_focused_shade
->texture
[0].type
=
1150 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
1151 theme
->a_hover_focused_shade
->texture
[0].type
=
1152 theme
->a_hover_unfocused_shade
->texture
[0].type
=
1153 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
1154 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
1155 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
1156 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
1157 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
1158 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
1159 theme
->a_focused_unpressed_shade
->texture
[0].type
=
1160 theme
->a_focused_pressed_shade
->texture
[0].type
=
1161 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
1162 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
1163 theme
->a_disabled_focused_iconify
->texture
[0].type
=
1164 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
1165 theme
->a_hover_focused_iconify
->texture
[0].type
=
1166 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
1167 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
1168 theme
->a_focused_pressed_iconify
->texture
[0].type
=
1169 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
1170 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
1171 theme
->a_menu_bullet_normal
->texture
[0].type
=
1172 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
1174 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
1175 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
1176 theme
->max_disabled_mask
;
1177 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
1178 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1179 theme
->max_hover_mask
;
1180 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1181 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1182 theme
->max_pressed_mask
;
1183 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1184 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1186 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
1187 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1188 theme
->max_toggled_hover_mask
;
1189 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1190 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1191 theme
->max_toggled_mask
;
1192 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1193 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1194 theme
->max_toggled_pressed_mask
;
1195 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
1196 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
1197 theme
->close_disabled_mask
;
1198 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
1199 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
1200 theme
->close_hover_mask
;
1201 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
1202 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
1203 theme
->close_pressed_mask
;
1204 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
1205 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
1207 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
1208 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
1209 theme
->desk_disabled_mask
;
1210 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1211 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1212 theme
->desk_hover_mask
;
1213 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1214 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1215 theme
->desk_pressed_mask
;
1216 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1217 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1219 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1220 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1221 theme
->desk_toggled_hover_mask
;
1222 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1223 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1224 theme
->desk_toggled_mask
;
1225 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1226 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1227 theme
->desk_toggled_pressed_mask
;
1228 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1229 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1230 theme
->shade_disabled_mask
;
1231 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1232 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1233 theme
->shade_hover_mask
;
1234 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1235 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1236 theme
->shade_pressed_mask
;
1237 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1238 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1240 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1241 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1242 theme
->shade_toggled_hover_mask
;
1243 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1244 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1245 theme
->shade_toggled_mask
;
1246 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1247 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1248 theme
->shade_toggled_pressed_mask
;
1249 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1250 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1251 theme
->iconify_disabled_mask
;
1252 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1253 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1254 theme
->iconify_hover_mask
;
1255 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1256 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1257 theme
->iconify_pressed_mask
;
1258 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1259 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1260 theme
->iconify_mask
;
1261 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1262 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1263 theme
->menu_bullet_mask
;
1264 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1265 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1266 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1267 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1268 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1269 theme
->titlebut_disabled_focused_color
;
1270 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1271 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1272 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1273 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1274 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1275 theme
->titlebut_disabled_unfocused_color
;
1276 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1277 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1278 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1279 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1280 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1281 theme
->titlebut_hover_focused_color
;
1282 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1283 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1284 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1285 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1286 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1287 theme
->titlebut_hover_unfocused_color
;
1288 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1289 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1290 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1291 theme
->titlebut_toggled_hover_focused_color
;
1292 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1293 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1294 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1295 theme
->titlebut_toggled_hover_unfocused_color
;
1296 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1297 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1298 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1299 theme
->titlebut_toggled_focused_unpressed_color
;
1300 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1301 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1302 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1303 theme
->titlebut_toggled_unfocused_unpressed_color
;
1304 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1305 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1306 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1307 theme
->titlebut_toggled_focused_pressed_color
;
1308 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1309 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1310 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1311 theme
->titlebut_toggled_unfocused_pressed_color
;
1312 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1313 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1314 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1315 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1316 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1317 theme
->titlebut_focused_unpressed_color
;
1318 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1319 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1320 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1321 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1322 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1323 theme
->titlebut_focused_pressed_color
;
1324 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1325 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1326 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1327 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1328 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1329 theme
->titlebut_unfocused_unpressed_color
;
1330 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1331 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1332 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1333 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1334 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1335 theme
->titlebut_unfocused_pressed_color
;
1336 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1338 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1339 theme
->menu_selected_color
;
1342 XrmDestroyDatabase(db
);
1344 /* set the font heights */
1345 theme
->win_font_height
= RrFontHeight
1346 (theme
->win_font_focused
,
1347 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
);
1348 theme
->win_font_height
=
1349 MAX(theme
->win_font_height
,
1351 (theme
->win_font_focused
,
1352 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
));
1353 theme
->menu_title_font_height
= RrFontHeight
1354 (theme
->menu_title_font
,
1355 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
);
1356 theme
->menu_font_height
= RrFontHeight
1358 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
);
1360 /* calculate some last extents */
1362 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1364 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1365 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1366 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1367 theme
->label_height
+= theme
->label_height
% 2;
1369 /* this would be nice I think, since padding.width can now be 0,
1370 but it breaks frame.c horribly and I don't feel like fixing that
1371 right now, so if anyone complains, here is how to keep text from
1372 going over the title's bevel/border with a padding.width of 0 and a
1373 bevelless/borderless label
1374 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1375 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1376 theme->title_height = theme->label_height +
1377 MAX(MAX(theme->padding * 2, ft + fb),
1378 MAX(theme->padding * 2, ut + ub));
1380 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1382 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1383 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1384 theme
->menu_title_height
= theme
->menu_title_label_height
+
1385 theme
->paddingy
* 2;
1387 theme
->button_size
= theme
->label_height
- 2;
1388 theme
->grip_width
= 25;
1393 void RrThemeFree(RrTheme
*theme
)
1396 g_free(theme
->name
);
1398 RrColorFree(theme
->menu_border_color
);
1399 RrColorFree(theme
->osd_border_color
);
1400 RrColorFree(theme
->frame_focused_border_color
);
1401 RrColorFree(theme
->frame_unfocused_border_color
);
1402 RrColorFree(theme
->title_separator_focused_color
);
1403 RrColorFree(theme
->title_separator_unfocused_color
);
1404 RrColorFree(theme
->cb_unfocused_color
);
1405 RrColorFree(theme
->cb_focused_color
);
1406 RrColorFree(theme
->title_focused_color
);
1407 RrColorFree(theme
->title_unfocused_color
);
1408 RrColorFree(theme
->titlebut_disabled_focused_color
);
1409 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1410 RrColorFree(theme
->titlebut_hover_focused_color
);
1411 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1412 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1413 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1414 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1415 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1416 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1417 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1418 RrColorFree(theme
->titlebut_focused_pressed_color
);
1419 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1420 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1421 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1422 RrColorFree(theme
->menu_title_color
);
1423 RrColorFree(theme
->menu_sep_color
);
1424 RrColorFree(theme
->menu_color
);
1425 RrColorFree(theme
->menu_selected_color
);
1426 RrColorFree(theme
->menu_disabled_color
);
1427 RrColorFree(theme
->menu_disabled_selected_color
);
1428 RrColorFree(theme
->title_focused_shadow_color
);
1429 RrColorFree(theme
->title_unfocused_shadow_color
);
1430 RrColorFree(theme
->osd_color
);
1431 RrColorFree(theme
->osd_shadow_color
);
1432 RrColorFree(theme
->menu_title_shadow_color
);
1433 RrColorFree(theme
->menu_text_normal_shadow_color
);
1434 RrColorFree(theme
->menu_text_selected_shadow_color
);
1435 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1436 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1438 g_free(theme
->def_win_icon
);
1440 RrPixmapMaskFree(theme
->max_mask
);
1441 RrPixmapMaskFree(theme
->max_toggled_mask
);
1442 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1443 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1444 RrPixmapMaskFree(theme
->max_disabled_mask
);
1445 RrPixmapMaskFree(theme
->max_hover_mask
);
1446 RrPixmapMaskFree(theme
->max_pressed_mask
);
1447 RrPixmapMaskFree(theme
->desk_mask
);
1448 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1449 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1450 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1451 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1452 RrPixmapMaskFree(theme
->desk_hover_mask
);
1453 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1454 RrPixmapMaskFree(theme
->shade_mask
);
1455 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1456 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1457 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1458 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1459 RrPixmapMaskFree(theme
->shade_hover_mask
);
1460 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1461 RrPixmapMaskFree(theme
->iconify_mask
);
1462 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1463 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1464 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1465 RrPixmapMaskFree(theme
->close_mask
);
1466 RrPixmapMaskFree(theme
->close_disabled_mask
);
1467 RrPixmapMaskFree(theme
->close_hover_mask
);
1468 RrPixmapMaskFree(theme
->close_pressed_mask
);
1469 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1471 RrFontClose(theme
->win_font_focused
);
1472 RrFontClose(theme
->win_font_unfocused
);
1473 RrFontClose(theme
->menu_title_font
);
1474 RrFontClose(theme
->menu_font
);
1475 RrFontClose(theme
->osd_font
);
1477 RrAppearanceFree(theme
->a_disabled_focused_max
);
1478 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1479 RrAppearanceFree(theme
->a_hover_focused_max
);
1480 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1481 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1482 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1483 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1484 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1485 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1486 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1487 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1488 RrAppearanceFree(theme
->a_focused_pressed_max
);
1489 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1490 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1491 RrAppearanceFree(theme
->a_disabled_focused_close
);
1492 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1493 RrAppearanceFree(theme
->a_hover_focused_close
);
1494 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1495 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1496 RrAppearanceFree(theme
->a_focused_pressed_close
);
1497 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1498 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1499 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1500 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1501 RrAppearanceFree(theme
->a_hover_focused_desk
);
1502 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1503 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1504 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1505 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1506 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1507 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1508 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1509 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1510 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1511 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1512 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1513 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1514 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1515 RrAppearanceFree(theme
->a_hover_focused_shade
);
1516 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1517 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1518 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1519 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1520 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1521 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1522 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1523 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1524 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1525 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1526 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1527 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1528 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1529 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1530 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1531 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1532 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1533 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1534 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1535 RrAppearanceFree(theme
->a_focused_grip
);
1536 RrAppearanceFree(theme
->a_unfocused_grip
);
1537 RrAppearanceFree(theme
->a_focused_title
);
1538 RrAppearanceFree(theme
->a_unfocused_title
);
1539 RrAppearanceFree(theme
->a_focused_label
);
1540 RrAppearanceFree(theme
->a_unfocused_label
);
1541 RrAppearanceFree(theme
->a_icon
);
1542 RrAppearanceFree(theme
->a_focused_handle
);
1543 RrAppearanceFree(theme
->a_unfocused_handle
);
1544 RrAppearanceFree(theme
->a_menu
);
1545 RrAppearanceFree(theme
->a_menu_title
);
1546 RrAppearanceFree(theme
->a_menu_text_title
);
1547 RrAppearanceFree(theme
->a_menu_normal
);
1548 RrAppearanceFree(theme
->a_menu_selected
);
1549 RrAppearanceFree(theme
->a_menu_disabled
);
1550 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1551 RrAppearanceFree(theme
->a_menu_text_normal
);
1552 RrAppearanceFree(theme
->a_menu_text_selected
);
1553 RrAppearanceFree(theme
->a_menu_text_disabled
);
1554 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1555 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1556 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1557 RrAppearanceFree(theme
->a_clear
);
1558 RrAppearanceFree(theme
->a_clear_tex
);
1559 RrAppearanceFree(theme
->osd_hilite_bg
);
1560 RrAppearanceFree(theme
->osd_hilite_fg
);
1561 RrAppearanceFree(theme
->osd_hilite_label
);
1562 RrAppearanceFree(theme
->osd_unhilite_fg
);
1568 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
)
1571 XrmDatabase db
= NULL
;
1574 if (name
[0] == '/') {
1575 s
= g_build_filename(name
, "openbox-3", "themerc", NULL
);
1576 if ((db
= XrmGetFileDatabase(s
)))
1577 *path
= g_path_get_dirname(s
);
1580 /* XXX backwards compatibility, remove me sometime later */
1581 s
= g_build_filename(g_get_home_dir(), ".themes", name
,
1582 "openbox-3", "themerc", NULL
);
1583 if ((db
= XrmGetFileDatabase(s
)))
1584 *path
= g_path_get_dirname(s
);
1587 for (it
= parse_xdg_data_dir_paths(); !db
&& it
;
1588 it
= g_slist_next(it
))
1590 s
= g_build_filename(it
->data
, "themes", name
,
1591 "openbox-3", "themerc", NULL
);
1592 if ((db
= XrmGetFileDatabase(s
)))
1593 *path
= g_path_get_dirname(s
);
1599 s
= g_build_filename(name
, "themerc", NULL
);
1600 if ((db
= XrmGetFileDatabase(s
)))
1601 *path
= g_path_get_dirname(s
);
1608 static gchar
*create_class_name(const gchar
*rname
)
1610 gchar
*rclass
= g_strdup(rname
);
1615 p
= strchr(p
+1, '.');
1616 if (p
== NULL
) break;
1618 if (*p
== '\0') break;
1623 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
)
1625 gboolean ret
= FALSE
;
1626 gchar
*rclass
= create_class_name(rname
);
1627 gchar
*rettype
, *end
;
1630 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1631 retvalue
.addr
!= NULL
) {
1632 *value
= (gint
)strtol(retvalue
.addr
, &end
, 10);
1633 if (end
!= retvalue
.addr
)
1641 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
)
1643 gboolean ret
= FALSE
;
1644 gchar
*rclass
= create_class_name(rname
);
1648 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1649 retvalue
.addr
!= NULL
) {
1650 *value
= retvalue
.addr
;
1658 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
1659 const gchar
*rname
, RrColor
**value
)
1661 gboolean ret
= FALSE
;
1662 gchar
*rclass
= create_class_name(rname
);
1666 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1667 retvalue
.addr
!= NULL
) {
1668 RrColor
*c
= RrColorParse(inst
, retvalue
.addr
);
1679 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
1680 RrTheme
*theme
, const gchar
*maskname
,
1681 RrPixmapMask
**value
)
1683 gboolean ret
= FALSE
;
1685 gint hx
, hy
; /* ignored */
1689 s
= g_build_filename(path
, maskname
, NULL
);
1690 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1692 *value
= RrPixmapMaskNew(inst
, w
, h
, (gchar
*)b
);
1700 static void parse_appearance(gchar
*tex
, RrSurfaceColorType
*grad
,
1701 RrReliefType
*relief
, RrBevelType
*bevel
,
1702 gboolean
*interlaced
, gboolean
*border
,
1703 gboolean allow_trans
)
1707 /* convert to all lowercase */
1708 for (t
= tex
; *t
!= '\0'; ++t
)
1709 *t
= g_ascii_tolower(*t
);
1711 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1712 *grad
= RR_SURFACE_PARENTREL
;
1714 if (strstr(tex
, "gradient") != NULL
) {
1715 if (strstr(tex
, "crossdiagonal") != NULL
)
1716 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1717 else if (strstr(tex
, "pyramid") != NULL
)
1718 *grad
= RR_SURFACE_PYRAMID
;
1719 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1720 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1721 else if (strstr(tex
, "horizontal") != NULL
)
1722 *grad
= RR_SURFACE_HORIZONTAL
;
1723 else if (strstr(tex
, "splitvertical") != NULL
)
1724 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1725 else if (strstr(tex
, "vertical") != NULL
)
1726 *grad
= RR_SURFACE_VERTICAL
;
1728 *grad
= RR_SURFACE_DIAGONAL
;
1730 *grad
= RR_SURFACE_SOLID
;
1734 if (strstr(tex
, "sunken") != NULL
)
1735 *relief
= RR_RELIEF_SUNKEN
;
1736 else if (strstr(tex
, "flat") != NULL
)
1737 *relief
= RR_RELIEF_FLAT
;
1738 else if (strstr(tex
, "raised") != NULL
)
1739 *relief
= RR_RELIEF_RAISED
;
1741 *relief
= (*grad
== RR_SURFACE_PARENTREL
) ?
1742 RR_RELIEF_FLAT
: RR_RELIEF_RAISED
;
1745 if (*relief
== RR_RELIEF_FLAT
) {
1746 if (strstr(tex
, "border") != NULL
)
1749 if (strstr(tex
, "bevel2") != NULL
)
1750 *bevel
= RR_BEVEL_2
;
1752 *bevel
= RR_BEVEL_1
;
1755 if (strstr(tex
, "interlaced") != NULL
)
1758 *interlaced
= FALSE
;
1761 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
1762 const gchar
*rname
, RrAppearance
*value
,
1763 gboolean allow_trans
)
1765 gboolean ret
= FALSE
;
1766 gchar
*rclass
= create_class_name(rname
);
1767 gchar
*cname
, *ctoname
, *bcname
, *icname
, *hname
, *sname
;
1768 gchar
*csplitname
, *ctosplitname
;
1773 cname
= g_strconcat(rname
, ".color", NULL
);
1774 ctoname
= g_strconcat(rname
, ".colorTo", NULL
);
1775 bcname
= g_strconcat(rname
, ".border.color", NULL
);
1776 icname
= g_strconcat(rname
, ".interlace.color", NULL
);
1777 hname
= g_strconcat(rname
, ".highlight", NULL
);
1778 sname
= g_strconcat(rname
, ".shadow", NULL
);
1779 csplitname
= g_strconcat(rname
, ".color.splitTo", NULL
);
1780 ctosplitname
= g_strconcat(rname
, ".colorTo.splitTo", NULL
);
1782 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1783 retvalue
.addr
!= NULL
) {
1784 parse_appearance(retvalue
.addr
,
1785 &value
->surface
.grad
,
1786 &value
->surface
.relief
,
1787 &value
->surface
.bevel
,
1788 &value
->surface
.interlaced
,
1789 &value
->surface
.border
,
1791 if (!read_color(db
, inst
, cname
, &value
->surface
.primary
))
1792 value
->surface
.primary
= RrColorNew(inst
, 0, 0, 0);
1793 if (!read_color(db
, inst
, ctoname
, &value
->surface
.secondary
))
1794 value
->surface
.secondary
= RrColorNew(inst
, 0, 0, 0);
1795 if (value
->surface
.border
)
1796 if (!read_color(db
, inst
, bcname
,
1797 &value
->surface
.border_color
))
1798 value
->surface
.border_color
= RrColorNew(inst
, 0, 0, 0);
1799 if (value
->surface
.interlaced
)
1800 if (!read_color(db
, inst
, icname
,
1801 &value
->surface
.interlace_color
))
1802 value
->surface
.interlace_color
= RrColorNew(inst
, 0, 0, 0);
1803 if (read_int(db
, hname
, &i
) && i
>= 0)
1804 value
->surface
.bevel_light_adjust
= i
;
1805 if (read_int(db
, sname
, &i
) && i
>= 0 && i
<= 256)
1806 value
->surface
.bevel_dark_adjust
= i
;
1808 if (value
->surface
.grad
== RR_SURFACE_SPLIT_VERTICAL
) {
1811 if (!read_color(db
, inst
, csplitname
,
1812 &value
->surface
.split_primary
))
1814 r
= value
->surface
.primary
->r
;
1816 g
= value
->surface
.primary
->g
;
1818 b
= value
->surface
.primary
->b
;
1820 if (r
> 0xFF) r
= 0xFF;
1821 if (g
> 0xFF) g
= 0xFF;
1822 if (b
> 0xFF) b
= 0xFF;
1823 value
->surface
.split_primary
= RrColorNew(inst
, r
, g
, b
);
1826 if (!read_color(db
, inst
, ctosplitname
,
1827 &value
->surface
.split_secondary
))
1829 r
= value
->surface
.secondary
->r
;
1831 g
= value
->surface
.secondary
->g
;
1833 b
= value
->surface
.secondary
->b
;
1835 if (r
> 0xFF) r
= 0xFF;
1836 if (g
> 0xFF) g
= 0xFF;
1837 if (b
> 0xFF) b
= 0xFF;
1838 value
->surface
.split_secondary
= RrColorNew(inst
, r
, g
, b
);
1845 g_free(ctosplitname
);
1857 static int parse_inline_number(const char *p
)
1865 for (; isdigit(*p
); ++p
)
1866 res
= res
* 10 + *p
- '0';
1871 static void set_default_appearance(RrAppearance
*a
)
1873 a
->surface
.grad
= RR_SURFACE_SOLID
;
1874 a
->surface
.relief
= RR_RELIEF_FLAT
;
1875 a
->surface
.bevel
= RR_BEVEL_1
;
1876 a
->surface
.interlaced
= FALSE
;
1877 a
->surface
.border
= FALSE
;
1878 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1879 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1882 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1883 an RrTextureRGBA. */
1884 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1889 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1891 for (i
= 0; i
< width
* height
; ++i
) {
1892 guchar a
= ((*p
>> 24) & 0xff);
1893 guchar b
= ((*p
>> 16) & 0xff);
1894 guchar g
= ((*p
>> 8) & 0xff);
1895 guchar r
= ((*p
>> 0) & 0xff);
1897 *p
= ((r
<< RrDefaultRedOffset
) +
1898 (g
<< RrDefaultGreenOffset
) +
1899 (b
<< RrDefaultBlueOffset
) +
1900 (a
<< RrDefaultAlphaOffset
));