1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 theme.c for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 See the COPYING file for a copy of the GNU General Public License.
26 #include "obt/paths.h"
29 #include <X11/Xresource.h>
34 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
);
35 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
);
36 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
);
37 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
38 const gchar
*rname
, RrColor
**value
);
39 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
40 RrTheme
*theme
, const gchar
*maskname
,
41 RrPixmapMask
**value
);
42 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
43 const gchar
*rname
, RrAppearance
*value
,
44 gboolean allow_trans
);
45 static int parse_inline_number(const char *p
);
46 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
);
47 static void set_default_appearance(RrAppearance
*a
);
49 RrTheme
* RrThemeNew(const RrInstance
*inst
, const gchar
*name
,
50 gboolean allow_fallback
,
51 RrFont
*active_window_font
, RrFont
*inactive_window_font
,
52 RrFont
*menu_title_font
, RrFont
*menu_item_font
,
55 XrmDatabase db
= NULL
;
56 RrJustify winjust
, mtitlejust
;
63 db
= loaddb(name
, &path
);
65 g_message("Unable to load the theme '%s'", name
);
67 g_message("Falling back to the default theme '%s'",
69 /* fallback to the default theme */
75 db
= loaddb(DEFAULT_THEME
, &path
);
77 g_message("Unable to load the theme '%s'", DEFAULT_THEME
);
84 theme
= g_new0(RrTheme
, 1);
87 theme
->name
= g_strdup(name
? name
: DEFAULT_THEME
);
89 theme
->a_disabled_focused_max
= RrAppearanceNew(inst
, 1);
90 theme
->a_disabled_unfocused_max
= RrAppearanceNew(inst
, 1);
91 theme
->a_hover_focused_max
= RrAppearanceNew(inst
, 1);
92 theme
->a_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
93 theme
->a_toggled_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
94 theme
->a_toggled_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
95 theme
->a_toggled_hover_focused_max
= RrAppearanceNew(inst
, 1);
96 theme
->a_toggled_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
97 theme
->a_toggled_focused_pressed_max
= RrAppearanceNew(inst
, 1);
98 theme
->a_toggled_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
99 theme
->a_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
100 theme
->a_focused_pressed_max
= RrAppearanceNew(inst
, 1);
101 theme
->a_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
102 theme
->a_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
103 theme
->a_focused_grip
= RrAppearanceNew(inst
, 0);
104 theme
->a_unfocused_grip
= RrAppearanceNew(inst
, 0);
105 theme
->a_focused_title
= RrAppearanceNew(inst
, 0);
106 theme
->a_unfocused_title
= RrAppearanceNew(inst
, 0);
107 theme
->a_focused_label
= RrAppearanceNew(inst
, 1);
108 theme
->a_unfocused_label
= RrAppearanceNew(inst
, 1);
109 theme
->a_icon
= RrAppearanceNew(inst
, 1);
110 theme
->a_focused_handle
= RrAppearanceNew(inst
, 0);
111 theme
->a_unfocused_handle
= RrAppearanceNew(inst
, 0);
112 theme
->a_menu
= RrAppearanceNew(inst
, 0);
113 theme
->a_menu_title
= RrAppearanceNew(inst
, 0);
114 theme
->a_menu_text_title
= RrAppearanceNew(inst
, 1);
115 theme
->a_menu_normal
= RrAppearanceNew(inst
, 0);
116 theme
->a_menu_selected
= RrAppearanceNew(inst
, 0);
117 theme
->a_menu_disabled
= RrAppearanceNew(inst
, 0);
118 /* a_menu_disabled_selected is copied from a_menu_selected */
119 theme
->a_menu_text_normal
= RrAppearanceNew(inst
, 1);
120 theme
->a_menu_text_selected
= RrAppearanceNew(inst
, 1);
121 theme
->a_menu_text_disabled
= RrAppearanceNew(inst
, 1);
122 theme
->a_menu_text_disabled_selected
= RrAppearanceNew(inst
, 1);
123 theme
->a_menu_bullet_normal
= RrAppearanceNew(inst
, 1);
124 theme
->a_menu_bullet_selected
= RrAppearanceNew(inst
, 1);
125 theme
->a_clear
= RrAppearanceNew(inst
, 0);
126 theme
->a_clear_tex
= RrAppearanceNew(inst
, 1);
127 theme
->osd_hilite_bg
= RrAppearanceNew(inst
, 0);
128 theme
->osd_hilite_label
= RrAppearanceNew(inst
, 1);
129 theme
->osd_hilite_fg
= RrAppearanceNew(inst
, 0);
130 theme
->osd_unhilite_fg
= RrAppearanceNew(inst
, 0);
132 /* load the font stuff */
133 if (active_window_font
) {
134 theme
->win_font_focused
= active_window_font
;
135 RrFontRef(active_window_font
);
137 theme
->win_font_focused
= RrFontOpenDefault(inst
);
139 if (inactive_window_font
) {
140 theme
->win_font_unfocused
= inactive_window_font
;
141 RrFontRef(inactive_window_font
);
143 theme
->win_font_unfocused
= RrFontOpenDefault(inst
);
145 winjust
= RR_JUSTIFY_LEFT
;
146 if (read_string(db
, "window.label.text.justify", &str
)) {
147 if (!g_ascii_strcasecmp(str
, "right"))
148 winjust
= RR_JUSTIFY_RIGHT
;
149 else if (!g_ascii_strcasecmp(str
, "center"))
150 winjust
= RR_JUSTIFY_CENTER
;
153 if (menu_title_font
) {
154 theme
->menu_title_font
= menu_title_font
;
155 RrFontRef(menu_title_font
);
157 theme
->menu_title_font
= RrFontOpenDefault(inst
);
159 mtitlejust
= RR_JUSTIFY_LEFT
;
160 if (read_string(db
, "menu.title.text.justify", &str
)) {
161 if (!g_ascii_strcasecmp(str
, "right"))
162 mtitlejust
= RR_JUSTIFY_RIGHT
;
163 else if (!g_ascii_strcasecmp(str
, "center"))
164 mtitlejust
= RR_JUSTIFY_CENTER
;
167 if (menu_item_font
) {
168 theme
->menu_font
= menu_item_font
;
169 RrFontRef(menu_item_font
);
171 theme
->menu_font
= RrFontOpenDefault(inst
);
174 theme
->osd_font
= osd_font
;
177 theme
->osd_font
= RrFontOpenDefault(inst
);
179 /* load direct dimensions */
180 if ((!read_int(db
, "menu.overlap.x", &theme
->menu_overlap_x
) &&
181 !read_int(db
, "menu.overlap", &theme
->menu_overlap_x
)) ||
182 theme
->menu_overlap_x
< -100 || theme
->menu_overlap_x
> 100)
183 theme
->menu_overlap_x
= 0;
184 if ((!read_int(db
, "menu.overlap.y", &theme
->menu_overlap_y
) &&
185 !read_int(db
, "menu.overlap", &theme
->menu_overlap_y
)) ||
186 theme
->menu_overlap_y
< -100 || theme
->menu_overlap_y
> 100)
187 theme
->menu_overlap_y
= 0;
188 if (!read_int(db
, "window.handle.width", &theme
->handle_height
) ||
189 theme
->handle_height
< 0 || theme
->handle_height
> 100)
190 theme
->handle_height
= 6;
191 if (!read_int(db
, "padding.width", &theme
->paddingx
) ||
192 theme
->paddingx
< 0 || theme
->paddingx
> 100)
194 if (!read_int(db
, "padding.height", &theme
->paddingy
) ||
195 theme
->paddingy
< 0 || theme
->paddingy
> 100)
196 theme
->paddingy
= theme
->paddingx
;
197 if (!read_int(db
, "border.width", &theme
->fbwidth
) ||
198 theme
->fbwidth
< 0 || theme
->fbwidth
> 100)
200 /* menu border width inherits from the frame border width */
201 if (!read_int(db
, "menu.border.width", &theme
->mbwidth
) ||
202 theme
->mbwidth
< 0 || theme
->mbwidth
> 100)
203 theme
->mbwidth
= theme
->fbwidth
;
204 /* osd border width inherits from the frame border width */
205 if (!read_int(db
, "osd.border.width", &theme
->obwidth
) ||
206 theme
->obwidth
< 0 || theme
->obwidth
> 100)
207 theme
->obwidth
= theme
->fbwidth
;
208 if (!read_int(db
, "window.client.padding.width", &theme
->cbwidthx
) ||
209 theme
->cbwidthx
< 0 || theme
->cbwidthx
> 100)
210 theme
->cbwidthx
= theme
->paddingx
;
211 if (!read_int(db
, "window.client.padding.height", &theme
->cbwidthy
) ||
212 theme
->cbwidthy
< 0 || theme
->cbwidthy
> 100)
213 theme
->cbwidthy
= theme
->cbwidthx
;
216 if (!read_color(db
, inst
,
217 "window.active.border.color",
218 &theme
->frame_focused_border_color
) &&
219 !read_color(db
, inst
,
221 &theme
->frame_focused_border_color
))
222 theme
->frame_focused_border_color
= RrColorNew(inst
, 0, 0, 0);
223 /* title separator focused color inherits from focused boder color */
224 if (!read_color(db
, inst
,
225 "window.active.title.separator.color",
226 &theme
->title_separator_focused_color
))
227 theme
->title_separator_focused_color
=
229 theme
->frame_focused_border_color
->r
,
230 theme
->frame_focused_border_color
->g
,
231 theme
->frame_focused_border_color
->b
);
232 /* unfocused border color inherits from frame focused border color */
233 if (!read_color(db
, inst
,
234 "window.inactive.border.color",
235 &theme
->frame_unfocused_border_color
))
236 theme
->frame_unfocused_border_color
=
237 RrColorNew(inst
, theme
->frame_focused_border_color
->r
,
238 theme
->frame_focused_border_color
->g
,
239 theme
->frame_focused_border_color
->b
);
240 /* title separator unfocused color inherits from unfocused boder color */
241 if (!read_color(db
, inst
,
242 "window.inactive.title.separator.color",
243 &theme
->title_separator_unfocused_color
))
244 theme
->title_separator_unfocused_color
=
246 theme
->frame_unfocused_border_color
->r
,
247 theme
->frame_unfocused_border_color
->g
,
248 theme
->frame_unfocused_border_color
->b
);
250 /* menu border color inherits from frame focused border color */
251 if (!read_color(db
, inst
, "menu.border.color", &theme
->menu_border_color
))
252 theme
->menu_border_color
=
254 theme
->frame_focused_border_color
->r
,
255 theme
->frame_focused_border_color
->g
,
256 theme
->frame_focused_border_color
->b
);
257 /* osd border color inherits from frame focused border color */
258 if (!read_color(db
, inst
, "osd.border.color", &theme
->osd_border_color
))
259 theme
->osd_border_color
=
261 theme
->frame_focused_border_color
->r
,
262 theme
->frame_focused_border_color
->g
,
263 theme
->frame_focused_border_color
->b
);
264 if (!read_color(db
, inst
,
265 "window.active.client.color",
266 &theme
->cb_focused_color
))
267 theme
->cb_focused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
268 if (!read_color(db
, inst
,
269 "window.inactive.client.color",
270 &theme
->cb_unfocused_color
))
271 theme
->cb_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
272 if (!read_color(db
, inst
,
273 "window.active.label.text.color",
274 &theme
->title_focused_color
))
275 theme
->title_focused_color
= RrColorNew(inst
, 0x0, 0x0, 0x0);
276 if (!read_color(db
, inst
, "osd.label.text.color", &theme
->osd_color
))
277 theme
->osd_color
= RrColorNew(inst
,
278 theme
->title_focused_color
->r
,
279 theme
->title_focused_color
->g
,
280 theme
->title_focused_color
->b
);
281 if (!read_color(db
, inst
,
282 "window.inactive.label.text.color",
283 &theme
->title_unfocused_color
))
284 theme
->title_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
285 if (!read_color(db
, inst
,
286 "window.active.button.unpressed.image.color",
287 &theme
->titlebut_focused_unpressed_color
))
288 theme
->titlebut_focused_unpressed_color
= RrColorNew(inst
, 0, 0, 0);
289 if (!read_color(db
, inst
,
290 "window.inactive.button.unpressed.image.color",
291 &theme
->titlebut_unfocused_unpressed_color
))
292 theme
->titlebut_unfocused_unpressed_color
=
293 RrColorNew(inst
, 0xff, 0xff, 0xff);
294 if (!read_color(db
, inst
,
295 "window.active.button.pressed.image.color",
296 &theme
->titlebut_focused_pressed_color
))
297 theme
->titlebut_focused_pressed_color
=
299 theme
->titlebut_focused_unpressed_color
->r
,
300 theme
->titlebut_focused_unpressed_color
->g
,
301 theme
->titlebut_focused_unpressed_color
->b
);
302 if (!read_color(db
, inst
,
303 "window.inactive.button.pressed.image.color",
304 &theme
->titlebut_unfocused_pressed_color
))
305 theme
->titlebut_unfocused_pressed_color
=
307 theme
->titlebut_unfocused_unpressed_color
->r
,
308 theme
->titlebut_unfocused_unpressed_color
->g
,
309 theme
->titlebut_unfocused_unpressed_color
->b
);
310 if (!read_color(db
, inst
,
311 "window.active.button.disabled.image.color",
312 &theme
->titlebut_disabled_focused_color
))
313 theme
->titlebut_disabled_focused_color
=
314 RrColorNew(inst
, 0xff, 0xff, 0xff);
315 if (!read_color(db
, inst
,
316 "window.inactive.button.disabled.image.color",
317 &theme
->titlebut_disabled_unfocused_color
))
318 theme
->titlebut_disabled_unfocused_color
= RrColorNew(inst
, 0, 0, 0);
319 if (!read_color(db
, inst
,
320 "window.active.button.hover.image.color",
321 &theme
->titlebut_hover_focused_color
))
322 theme
->titlebut_hover_focused_color
=
324 theme
->titlebut_focused_unpressed_color
->r
,
325 theme
->titlebut_focused_unpressed_color
->g
,
326 theme
->titlebut_focused_unpressed_color
->b
);
327 if (!read_color(db
, inst
,
328 "window.inactive.button.hover.image.color",
329 &theme
->titlebut_hover_unfocused_color
))
330 theme
->titlebut_hover_unfocused_color
=
332 theme
->titlebut_unfocused_unpressed_color
->r
,
333 theme
->titlebut_unfocused_unpressed_color
->g
,
334 theme
->titlebut_unfocused_unpressed_color
->b
);
335 if (!read_color(db
, inst
,
336 "window.active.button.toggled.unpressed.image.color",
337 &theme
->titlebut_toggled_focused_unpressed_color
) &&
338 !read_color(db
, inst
,
339 "window.active.button.toggled.image.color",
340 &theme
->titlebut_toggled_focused_unpressed_color
))
341 theme
->titlebut_toggled_focused_unpressed_color
=
343 theme
->titlebut_focused_pressed_color
->r
,
344 theme
->titlebut_focused_pressed_color
->g
,
345 theme
->titlebut_focused_pressed_color
->b
);
346 if (!read_color(db
, inst
,
347 "window.inactive.button.toggled.unpressed.image.color",
348 &theme
->titlebut_toggled_unfocused_unpressed_color
) &&
349 !read_color(db
, inst
,
350 "window.inactive.button.toggled.image.color",
351 &theme
->titlebut_toggled_unfocused_unpressed_color
))
352 theme
->titlebut_toggled_unfocused_unpressed_color
=
354 theme
->titlebut_unfocused_pressed_color
->r
,
355 theme
->titlebut_unfocused_pressed_color
->g
,
356 theme
->titlebut_unfocused_pressed_color
->b
);
357 if (!read_color(db
, inst
,
358 "window.active.button.toggled.hover.image.color",
359 &theme
->titlebut_toggled_hover_focused_color
))
360 theme
->titlebut_toggled_hover_focused_color
=
362 theme
->titlebut_toggled_focused_unpressed_color
->r
,
363 theme
->titlebut_toggled_focused_unpressed_color
->g
,
364 theme
->titlebut_toggled_focused_unpressed_color
->b
);
365 if (!read_color(db
, inst
,
366 "window.inactive.button.toggled.hover.image.color",
367 &theme
->titlebut_toggled_hover_unfocused_color
))
368 theme
->titlebut_toggled_hover_unfocused_color
=
370 theme
->titlebut_toggled_unfocused_unpressed_color
->r
,
371 theme
->titlebut_toggled_unfocused_unpressed_color
->g
,
372 theme
->titlebut_toggled_unfocused_unpressed_color
->b
);
373 if (!read_color(db
, inst
,
374 "window.active.button.toggled.pressed.image.color",
375 &theme
->titlebut_toggled_focused_pressed_color
))
376 theme
->titlebut_toggled_focused_pressed_color
=
378 theme
->titlebut_focused_pressed_color
->r
,
379 theme
->titlebut_focused_pressed_color
->g
,
380 theme
->titlebut_focused_pressed_color
->b
);
381 if (!read_color(db
, inst
,
382 "window.inactive.button.toggled.pressed.image.color",
383 &theme
->titlebut_toggled_unfocused_pressed_color
))
384 theme
->titlebut_toggled_unfocused_pressed_color
=
386 theme
->titlebut_unfocused_pressed_color
->r
,
387 theme
->titlebut_unfocused_pressed_color
->g
,
388 theme
->titlebut_unfocused_pressed_color
->b
);
389 if (!read_color(db
, inst
,
390 "menu.title.text.color", &theme
->menu_title_color
))
391 theme
->menu_title_color
= RrColorNew(inst
, 0, 0, 0);
392 if (!read_color(db
, inst
,
393 "menu.items.text.color", &theme
->menu_color
))
394 theme
->menu_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
395 if (!read_color(db
, inst
,
396 "menu.items.disabled.text.color",
397 &theme
->menu_disabled_color
))
398 theme
->menu_disabled_color
= RrColorNew(inst
, 0, 0, 0);
399 if (!read_color(db
, inst
,
400 "menu.items.active.disabled.text.color",
401 &theme
->menu_disabled_selected_color
))
402 theme
->menu_disabled_selected_color
=
404 theme
->menu_disabled_color
->r
,
405 theme
->menu_disabled_color
->g
,
406 theme
->menu_disabled_color
->b
);
407 if (!read_color(db
, inst
,
408 "menu.items.active.text.color",
409 &theme
->menu_selected_color
))
410 theme
->menu_selected_color
= RrColorNew(inst
, 0, 0, 0);
412 /* load the image masks */
414 /* maximize button masks */
416 if (!read_mask(inst
, path
, theme
, "max.xbm", &theme
->max_mask
)) {
417 guchar data
[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
418 theme
->max_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
421 if (!read_mask(inst
, path
, theme
, "max_toggled.xbm",
422 &theme
->max_toggled_mask
))
425 theme
->max_toggled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
427 guchar data
[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
428 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 6, 6,(gchar
*)data
);
431 if (!read_mask(inst
, path
, theme
, "max_pressed.xbm",
432 &theme
->max_pressed_mask
))
433 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
434 if (!read_mask(inst
,path
,theme
,"max_disabled.xbm",
435 &theme
->max_disabled_mask
))
436 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
437 if (!read_mask(inst
, path
, theme
, "max_hover.xbm", &theme
->max_hover_mask
))
438 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
439 if (!read_mask(inst
, path
, theme
, "max_toggled_pressed.xbm",
440 &theme
->max_toggled_pressed_mask
))
441 theme
->max_toggled_pressed_mask
=
442 RrPixmapMaskCopy(theme
->max_toggled_mask
);
443 if (!read_mask(inst
, path
, theme
, "max_toggled_hover.xbm",
444 &theme
->max_toggled_hover_mask
))
445 theme
->max_toggled_hover_mask
=
446 RrPixmapMaskCopy(theme
->max_toggled_mask
);
448 /* iconify button masks */
449 if (!read_mask(inst
, path
, theme
, "iconify.xbm", &theme
->iconify_mask
)) {
450 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
451 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
453 if (!read_mask(inst
, path
, theme
, "iconify_pressed.xbm",
454 &theme
->iconify_pressed_mask
))
455 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
456 if (!read_mask(inst
, path
, theme
, "iconify_disabled.xbm",
457 &theme
->iconify_disabled_mask
))
458 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
459 if (!read_mask(inst
, path
, theme
, "iconify_hover.xbm",
460 &theme
->iconify_hover_mask
))
461 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
463 /* all desktops button masks */
465 if (!read_mask(inst
, path
, theme
, "desk.xbm", &theme
->desk_mask
)) {
466 guchar data
[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
467 theme
->desk_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
470 if (!read_mask(inst
, path
, theme
, "desk_toggled.xbm",
471 &theme
->desk_toggled_mask
)) {
473 theme
->desk_toggled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
475 guchar data
[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
476 theme
->desk_toggled_mask
=
477 RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
480 if (!read_mask(inst
, path
, theme
, "desk_pressed.xbm",
481 &theme
->desk_pressed_mask
))
482 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
483 if (!read_mask(inst
, path
, theme
, "desk_disabled.xbm",
484 &theme
->desk_disabled_mask
))
485 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
486 if (!read_mask(inst
, path
, theme
, "desk_hover.xbm",
487 &theme
->desk_hover_mask
))
488 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
489 if (!read_mask(inst
, path
, theme
, "desk_toggled_pressed.xbm",
490 &theme
->desk_toggled_pressed_mask
))
491 theme
->desk_toggled_pressed_mask
=
492 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
493 if (!read_mask(inst
, path
, theme
, "desk_toggled_hover.xbm",
494 &theme
->desk_toggled_hover_mask
))
495 theme
->desk_toggled_hover_mask
=
496 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
498 /* shade button masks */
499 if (!read_mask(inst
, path
, theme
, "shade.xbm", &theme
->shade_mask
)) {
500 guchar data
[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
501 theme
->shade_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
503 if (!read_mask(inst
, path
, theme
, "shade_toggled.xbm",
504 &theme
->shade_toggled_mask
))
505 theme
->shade_toggled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
506 if (!read_mask(inst
, path
, theme
, "shade_pressed.xbm",
507 &theme
->shade_pressed_mask
))
508 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
509 if (!read_mask(inst
, path
, theme
, "shade_disabled.xbm",
510 &theme
->shade_disabled_mask
))
511 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
512 if (!read_mask(inst
, path
, theme
, "shade_hover.xbm",
513 &theme
->shade_hover_mask
))
514 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
515 if (!read_mask(inst
, path
, theme
, "shade_toggled_pressed.xbm",
516 &theme
->shade_toggled_pressed_mask
))
517 theme
->shade_toggled_pressed_mask
=
518 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
519 if (!read_mask(inst
, path
, theme
, "shade_toggled_hover.xbm",
520 &theme
->shade_toggled_hover_mask
))
521 theme
->shade_toggled_hover_mask
=
522 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
524 /* close button masks */
525 if (!read_mask(inst
, path
, theme
, "close.xbm", &theme
->close_mask
)) {
526 guchar data
[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
527 theme
->close_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
529 if (!read_mask(inst
, path
, theme
, "close_pressed.xbm",
530 &theme
->close_pressed_mask
))
531 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
532 if (!read_mask(inst
, path
, theme
, "close_disabled.xbm",
533 &theme
->close_disabled_mask
))
534 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
535 if (!read_mask(inst
, path
, theme
, "close_hover.xbm",
536 &theme
->close_hover_mask
))
537 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
539 /* submenu bullet mask */
540 if (!read_mask(inst
, path
, theme
, "bullet.xbm", &theme
->menu_bullet_mask
))
542 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
543 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
546 /* up and down arrows */
548 guchar data
[] = { 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00 };
549 theme
->down_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
552 guchar data
[] = { 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00 };
553 theme
->up_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
556 /* setup the default window icon */
557 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
558 OB_DEFAULT_ICON_HEIGHT
,
559 OB_DEFAULT_ICON_pixel_data
);
560 theme
->def_win_icon_w
= OB_DEFAULT_ICON_WIDTH
;
561 theme
->def_win_icon_h
= OB_DEFAULT_ICON_HEIGHT
;
564 /* read the decoration textures */
565 if (!read_appearance(db
, inst
,
566 "window.active.title.bg", theme
->a_focused_title
,
568 set_default_appearance(theme
->a_focused_title
);
569 if (!read_appearance(db
, inst
,
570 "window.inactive.title.bg", theme
->a_unfocused_title
,
572 set_default_appearance(theme
->a_unfocused_title
);
573 if (!read_appearance(db
, inst
,
574 "window.active.label.bg", theme
->a_focused_label
,
576 set_default_appearance(theme
->a_focused_label
);
577 if (!read_appearance(db
, inst
,
578 "window.inactive.label.bg", theme
->a_unfocused_label
,
580 set_default_appearance(theme
->a_unfocused_label
);
581 if (!read_appearance(db
, inst
,
582 "window.active.handle.bg", theme
->a_focused_handle
,
584 set_default_appearance(theme
->a_focused_handle
);
585 if (!read_appearance(db
, inst
,
586 "window.inactive.handle.bg",theme
->a_unfocused_handle
,
588 set_default_appearance(theme
->a_unfocused_handle
);
589 if (!read_appearance(db
, inst
,
590 "window.active.grip.bg", theme
->a_focused_grip
,
592 set_default_appearance(theme
->a_focused_grip
);
593 if (!read_appearance(db
, inst
,
594 "window.inactive.grip.bg", theme
->a_unfocused_grip
,
596 set_default_appearance(theme
->a_unfocused_grip
);
597 if (!read_appearance(db
, inst
,
598 "menu.items.bg", theme
->a_menu
,
600 set_default_appearance(theme
->a_menu
);
601 if (!read_appearance(db
, inst
,
602 "menu.title.bg", theme
->a_menu_title
,
604 set_default_appearance(theme
->a_menu_title
);
605 if (!read_appearance(db
, inst
,
606 "menu.items.active.bg", theme
->a_menu_selected
,
608 set_default_appearance(theme
->a_menu_selected
);
609 theme
->a_menu_disabled_selected
=
610 RrAppearanceCopy(theme
->a_menu_selected
);
612 /* read appearances for non-decorations (on-screen-display) */
613 if (!read_appearance(db
, inst
, "osd.bg", theme
->osd_hilite_bg
, FALSE
)) {
614 RrAppearanceFree(theme
->osd_hilite_bg
);
615 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
617 if (!read_appearance(db
, inst
, "osd.label.bg",
618 theme
->osd_hilite_label
, TRUE
)) {
619 RrAppearanceFree(theme
->osd_hilite_label
);
620 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
622 /* osd_hilite_fg can't be parentrel */
623 if (!read_appearance(db
, inst
, "osd.hilight.bg",
624 theme
->osd_hilite_fg
, FALSE
)) {
625 RrAppearanceFree(theme
->osd_hilite_fg
);
626 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
627 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_label
);
629 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_title
);
631 /* osd_unhilite_fg can't be parentrel either */
632 if (!read_appearance(db
, inst
, "osd.unhilight.bg",
633 theme
->osd_unhilite_fg
, FALSE
)) {
634 RrAppearanceFree(theme
->osd_unhilite_fg
);
635 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
636 theme
->osd_unhilite_fg
=RrAppearanceCopy(theme
->a_unfocused_label
);
638 theme
->osd_unhilite_fg
=RrAppearanceCopy(theme
->a_unfocused_title
);
641 /* read buttons textures */
642 if (!read_appearance(db
, inst
,
643 "window.active.button.disabled.bg",
644 theme
->a_disabled_focused_max
,
646 set_default_appearance(theme
->a_disabled_focused_max
);
647 if (!read_appearance(db
, inst
,
648 "window.inactive.button.disabled.bg",
649 theme
->a_disabled_unfocused_max
,
651 set_default_appearance(theme
->a_disabled_unfocused_max
);
652 if (!read_appearance(db
, inst
,
653 "window.active.button.pressed.bg",
654 theme
->a_focused_pressed_max
,
656 set_default_appearance(theme
->a_focused_pressed_max
);
657 if (!read_appearance(db
, inst
,
658 "window.inactive.button.pressed.bg",
659 theme
->a_unfocused_pressed_max
,
661 set_default_appearance(theme
->a_unfocused_pressed_max
);
662 if (!read_appearance(db
, inst
,
663 "window.active.button.toggled.unpressed.bg",
664 theme
->a_toggled_focused_unpressed_max
,
666 !read_appearance(db
, inst
,
667 "window.active.button.toggled.bg",
668 theme
->a_toggled_focused_unpressed_max
,
671 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
672 theme
->a_toggled_focused_unpressed_max
=
673 RrAppearanceCopy(theme
->a_focused_pressed_max
);
675 if (!read_appearance(db
, inst
,
676 "window.inactive.button.toggled.unpressed.bg",
677 theme
->a_toggled_unfocused_unpressed_max
,
679 !read_appearance(db
, inst
,
680 "window.inactive.button.toggled.bg",
681 theme
->a_toggled_unfocused_unpressed_max
,
684 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
685 theme
->a_toggled_unfocused_unpressed_max
=
686 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
688 if (!read_appearance(db
, inst
,
689 "window.active.button.toggled.hover.bg",
690 theme
->a_toggled_hover_focused_max
,
693 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
694 theme
->a_toggled_hover_focused_max
=
695 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
697 if (!read_appearance(db
, inst
,
698 "window.inactive.button.toggled.hover.bg",
699 theme
->a_toggled_hover_unfocused_max
,
702 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
703 theme
->a_toggled_hover_unfocused_max
=
704 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
706 if (!read_appearance(db
, inst
,
707 "window.active.button.toggled.pressed.bg",
708 theme
->a_toggled_focused_pressed_max
,
711 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
712 theme
->a_toggled_focused_pressed_max
=
713 RrAppearanceCopy(theme
->a_focused_pressed_max
);
715 if (!read_appearance(db
, inst
,
716 "window.inactive.button.toggled.pressed.bg",
717 theme
->a_toggled_unfocused_pressed_max
,
720 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
721 theme
->a_toggled_unfocused_pressed_max
=
722 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
724 if (!read_appearance(db
, inst
,
725 "window.active.button.unpressed.bg",
726 theme
->a_focused_unpressed_max
,
728 set_default_appearance(theme
->a_focused_unpressed_max
);
729 if (!read_appearance(db
, inst
,
730 "window.inactive.button.unpressed.bg",
731 theme
->a_unfocused_unpressed_max
,
733 set_default_appearance(theme
->a_unfocused_unpressed_max
);
734 if (!read_appearance(db
, inst
,
735 "window.active.button.hover.bg",
736 theme
->a_hover_focused_max
,
739 RrAppearanceFree(theme
->a_hover_focused_max
);
740 theme
->a_hover_focused_max
=
741 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
743 if (!read_appearance(db
, inst
,
744 "window.inactive.button.hover.bg",
745 theme
->a_hover_unfocused_max
,
748 RrAppearanceFree(theme
->a_hover_unfocused_max
);
749 theme
->a_hover_unfocused_max
=
750 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
753 theme
->a_disabled_focused_close
=
754 RrAppearanceCopy(theme
->a_disabled_focused_max
);
755 theme
->a_disabled_unfocused_close
=
756 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
757 theme
->a_hover_focused_close
=
758 RrAppearanceCopy(theme
->a_hover_focused_max
);
759 theme
->a_hover_unfocused_close
=
760 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
761 theme
->a_unfocused_unpressed_close
=
762 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
763 theme
->a_unfocused_pressed_close
=
764 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
765 theme
->a_focused_unpressed_close
=
766 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
767 theme
->a_focused_pressed_close
=
768 RrAppearanceCopy(theme
->a_focused_pressed_max
);
769 theme
->a_disabled_focused_desk
=
770 RrAppearanceCopy(theme
->a_disabled_focused_max
);
771 theme
->a_disabled_unfocused_desk
=
772 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
773 theme
->a_hover_focused_desk
=
774 RrAppearanceCopy(theme
->a_hover_focused_max
);
775 theme
->a_hover_unfocused_desk
=
776 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
777 theme
->a_toggled_hover_focused_desk
=
778 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
779 theme
->a_toggled_hover_unfocused_desk
=
780 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
781 theme
->a_toggled_focused_unpressed_desk
=
782 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
783 theme
->a_toggled_unfocused_unpressed_desk
=
784 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
785 theme
->a_toggled_focused_pressed_desk
=
786 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
787 theme
->a_toggled_unfocused_pressed_desk
=
788 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
789 theme
->a_unfocused_unpressed_desk
=
790 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
791 theme
->a_unfocused_pressed_desk
=
792 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
793 theme
->a_focused_unpressed_desk
=
794 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
795 theme
->a_focused_pressed_desk
=
796 RrAppearanceCopy(theme
->a_focused_pressed_max
);
797 theme
->a_disabled_focused_shade
=
798 RrAppearanceCopy(theme
->a_disabled_focused_max
);
799 theme
->a_disabled_unfocused_shade
=
800 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
801 theme
->a_hover_focused_shade
=
802 RrAppearanceCopy(theme
->a_hover_focused_max
);
803 theme
->a_hover_unfocused_shade
=
804 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
805 theme
->a_toggled_hover_focused_shade
=
806 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
807 theme
->a_toggled_hover_unfocused_shade
=
808 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
809 theme
->a_toggled_focused_unpressed_shade
=
810 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
811 theme
->a_toggled_unfocused_unpressed_shade
=
812 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
813 theme
->a_toggled_focused_pressed_shade
=
814 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
815 theme
->a_toggled_unfocused_pressed_shade
=
816 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
817 theme
->a_unfocused_unpressed_shade
=
818 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
819 theme
->a_unfocused_pressed_shade
=
820 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
821 theme
->a_focused_unpressed_shade
=
822 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
823 theme
->a_focused_pressed_shade
=
824 RrAppearanceCopy(theme
->a_focused_pressed_max
);
825 theme
->a_disabled_focused_iconify
=
826 RrAppearanceCopy(theme
->a_disabled_focused_max
);
827 theme
->a_disabled_unfocused_iconify
=
828 RrAppearanceCopy(theme
->a_disabled_focused_max
);
829 theme
->a_hover_focused_iconify
=
830 RrAppearanceCopy(theme
->a_hover_focused_max
);
831 theme
->a_hover_unfocused_iconify
=
832 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
833 theme
->a_unfocused_unpressed_iconify
=
834 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
835 theme
->a_unfocused_pressed_iconify
=
836 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
837 theme
->a_focused_unpressed_iconify
=
838 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
839 theme
->a_focused_pressed_iconify
=
840 RrAppearanceCopy(theme
->a_focused_pressed_max
);
842 theme
->a_icon
->surface
.grad
=
843 theme
->a_clear
->surface
.grad
=
844 theme
->a_clear_tex
->surface
.grad
=
845 theme
->a_menu_text_title
->surface
.grad
=
846 theme
->a_menu_normal
->surface
.grad
=
847 theme
->a_menu_disabled
->surface
.grad
=
848 theme
->a_menu_text_normal
->surface
.grad
=
849 theme
->a_menu_text_selected
->surface
.grad
=
850 theme
->a_menu_text_disabled
->surface
.grad
=
851 theme
->a_menu_text_disabled_selected
->surface
.grad
=
852 theme
->a_menu_bullet_normal
->surface
.grad
=
853 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
855 /* set up the textures */
856 theme
->a_focused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
857 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
858 theme
->a_focused_label
->texture
[0].data
.text
.font
=theme
->win_font_focused
;
859 theme
->a_focused_label
->texture
[0].data
.text
.color
=
860 theme
->title_focused_color
;
862 if (read_string(db
, "window.active.label.text.font", &str
)) {
866 if (strstr(str
, "shadow=y")) {
867 if ((p
= strstr(str
, "shadowoffset=")))
868 i
= parse_inline_number(p
+ strlen("shadowoffset="));
871 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
872 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
874 if ((p
= strstr(str
, "shadowtint=")))
876 i
= parse_inline_number(p
+ strlen("shadowtint="));
877 j
= (i
> 0 ? 0 : 255);
880 theme
->title_focused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
881 theme
->title_focused_shadow_alpha
= i
;
883 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
884 theme
->title_focused_shadow_alpha
= 50;
888 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
889 theme
->title_focused_shadow_color
;
890 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
891 theme
->title_focused_shadow_alpha
;
893 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
894 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
895 theme
->osd_hilite_label
->texture
[0].data
.text
.font
= theme
->osd_font
;
896 theme
->osd_hilite_label
->texture
[0].data
.text
.color
= theme
->osd_color
;
898 if (read_string(db
, "osd.label.text.font", &str
)) {
902 if (strstr(str
, "shadow=y")) {
903 if ((p
= strstr(str
, "shadowoffset=")))
904 i
= parse_inline_number(p
+ strlen("shadowoffset="));
907 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
908 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
909 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
910 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
912 if ((p
= strstr(str
, "shadowtint=")))
914 i
= parse_inline_number(p
+ strlen("shadowtint="));
915 j
= (i
> 0 ? 0 : 255);
918 theme
->osd_shadow_color
= RrColorNew(inst
, j
, j
, j
);
919 theme
->osd_shadow_alpha
= i
;
921 theme
->osd_shadow_color
= RrColorNew(inst
, 0, 0, 0);
922 theme
->osd_shadow_alpha
= 50;
925 /* inherit the font settings from the focused label */
926 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
927 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
928 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
929 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
930 if (theme
->title_focused_shadow_color
)
931 theme
->osd_shadow_color
=
933 theme
->title_focused_shadow_color
->r
,
934 theme
->title_focused_shadow_color
->g
,
935 theme
->title_focused_shadow_color
->b
);
937 theme
->osd_shadow_color
= RrColorNew(inst
, 0, 0, 0);
938 theme
->osd_shadow_alpha
= theme
->title_focused_shadow_alpha
;
941 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
942 theme
->osd_shadow_color
;
943 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
944 theme
->osd_shadow_alpha
;
946 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
947 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
948 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
949 theme
->win_font_unfocused
;
950 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
951 theme
->title_unfocused_color
;
953 if (read_string(db
, "window.inactive.label.text.font", &str
)) {
957 if (strstr(str
, "shadow=y")) {
958 if ((p
= strstr(str
, "shadowoffset=")))
959 i
= parse_inline_number(p
+ strlen("shadowoffset="));
962 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
963 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
965 if ((p
= strstr(str
, "shadowtint=")))
967 i
= parse_inline_number(p
+ strlen("shadowtint="));
968 j
= (i
> 0 ? 0 : 255);
971 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
972 theme
->title_unfocused_shadow_alpha
= i
;
974 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
975 theme
->title_unfocused_shadow_alpha
= 50;
979 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
980 theme
->title_unfocused_shadow_color
;
981 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
982 theme
->title_unfocused_shadow_alpha
;
984 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
985 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
986 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
987 theme
->menu_title_font
;
988 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
989 theme
->menu_title_color
;
991 if (read_string(db
, "menu.title.text.font", &str
)) {
995 if (strstr(str
, "shadow=y")) {
996 if ((p
= strstr(str
, "shadowoffset=")))
997 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1000 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
= i
;
1001 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= i
;
1003 if ((p
= strstr(str
, "shadowtint=")))
1005 i
= parse_inline_number(p
+ strlen("shadowtint="));
1006 j
= (i
> 0 ? 0 : 255);
1009 theme
->menu_title_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1010 theme
->menu_title_shadow_alpha
= i
;
1012 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1013 theme
->menu_title_shadow_alpha
= 50;
1017 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
1018 theme
->menu_title_shadow_color
;
1019 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
1020 theme
->menu_title_shadow_alpha
;
1022 theme
->a_menu_text_normal
->texture
[0].type
=
1023 theme
->a_menu_text_selected
->texture
[0].type
=
1024 theme
->a_menu_text_disabled
->texture
[0].type
=
1025 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
1027 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
1028 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
1029 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
1030 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
1032 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
1033 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
1034 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
1035 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
1037 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
1038 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
1039 theme
->menu_selected_color
;
1040 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
1041 theme
->menu_disabled_color
;
1042 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
1043 theme
->menu_disabled_selected_color
;
1045 if (read_string(db
, "menu.items.font", &str
)) {
1049 if (strstr(str
, "shadow=y")) {
1050 if ((p
= strstr(str
, "shadowoffset=")))
1051 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1054 theme
->a_menu_text_normal
->
1055 texture
[0].data
.text
.shadow_offset_x
= i
;
1056 theme
->a_menu_text_normal
->
1057 texture
[0].data
.text
.shadow_offset_y
= i
;
1058 theme
->a_menu_text_selected
->
1059 texture
[0].data
.text
.shadow_offset_x
= i
;
1060 theme
->a_menu_text_selected
->
1061 texture
[0].data
.text
.shadow_offset_y
= i
;
1062 theme
->a_menu_text_disabled
->
1063 texture
[0].data
.text
.shadow_offset_x
= i
;
1064 theme
->a_menu_text_disabled
->
1065 texture
[0].data
.text
.shadow_offset_y
= i
;
1066 theme
->a_menu_text_disabled_selected
->
1067 texture
[0].data
.text
.shadow_offset_x
= i
;
1068 theme
->a_menu_text_disabled_selected
->
1069 texture
[0].data
.text
.shadow_offset_y
= i
;
1071 if ((p
= strstr(str
, "shadowtint=")))
1073 i
= parse_inline_number(p
+ strlen("shadowtint="));
1074 j
= (i
> 0 ? 0 : 255);
1077 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1078 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1079 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1080 theme
->menu_text_normal_shadow_alpha
= i
;
1081 theme
->menu_text_selected_shadow_alpha
= i
;
1082 theme
->menu_text_disabled_shadow_alpha
= i
;
1083 theme
->menu_text_disabled_selected_shadow_alpha
= i
;
1085 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1086 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1087 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1088 theme
->menu_text_normal_shadow_alpha
= 50;
1089 theme
->menu_text_selected_shadow_alpha
= 50;
1090 theme
->menu_text_disabled_selected_shadow_alpha
= 50;
1094 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
1095 theme
->menu_text_normal_shadow_color
;
1096 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
1097 theme
->menu_text_normal_shadow_alpha
;
1098 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
1099 theme
->menu_text_selected_shadow_color
;
1100 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
1101 theme
->menu_text_selected_shadow_alpha
;
1102 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
1103 theme
->menu_text_disabled_shadow_color
;
1104 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
1105 theme
->menu_text_disabled_shadow_alpha
;
1106 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
1107 theme
->menu_text_disabled_shadow_color
;
1108 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
1109 theme
->menu_text_disabled_shadow_alpha
;
1111 theme
->a_disabled_focused_max
->texture
[0].type
=
1112 theme
->a_disabled_unfocused_max
->texture
[0].type
=
1113 theme
->a_hover_focused_max
->texture
[0].type
=
1114 theme
->a_hover_unfocused_max
->texture
[0].type
=
1115 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
1116 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
1117 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
1118 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
1119 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
1120 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
1121 theme
->a_focused_unpressed_max
->texture
[0].type
=
1122 theme
->a_focused_pressed_max
->texture
[0].type
=
1123 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
1124 theme
->a_unfocused_pressed_max
->texture
[0].type
=
1125 theme
->a_disabled_focused_close
->texture
[0].type
=
1126 theme
->a_disabled_unfocused_close
->texture
[0].type
=
1127 theme
->a_hover_focused_close
->texture
[0].type
=
1128 theme
->a_hover_unfocused_close
->texture
[0].type
=
1129 theme
->a_focused_unpressed_close
->texture
[0].type
=
1130 theme
->a_focused_pressed_close
->texture
[0].type
=
1131 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
1132 theme
->a_unfocused_pressed_close
->texture
[0].type
=
1133 theme
->a_disabled_focused_desk
->texture
[0].type
=
1134 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
1135 theme
->a_hover_focused_desk
->texture
[0].type
=
1136 theme
->a_hover_unfocused_desk
->texture
[0].type
=
1137 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
1138 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
1139 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
1140 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
1141 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
1142 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
1143 theme
->a_focused_unpressed_desk
->texture
[0].type
=
1144 theme
->a_focused_pressed_desk
->texture
[0].type
=
1145 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
1146 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
1147 theme
->a_disabled_focused_shade
->texture
[0].type
=
1148 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
1149 theme
->a_hover_focused_shade
->texture
[0].type
=
1150 theme
->a_hover_unfocused_shade
->texture
[0].type
=
1151 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
1152 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
1153 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
1154 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
1155 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
1156 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
1157 theme
->a_focused_unpressed_shade
->texture
[0].type
=
1158 theme
->a_focused_pressed_shade
->texture
[0].type
=
1159 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
1160 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
1161 theme
->a_disabled_focused_iconify
->texture
[0].type
=
1162 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
1163 theme
->a_hover_focused_iconify
->texture
[0].type
=
1164 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
1165 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
1166 theme
->a_focused_pressed_iconify
->texture
[0].type
=
1167 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
1168 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
1169 theme
->a_menu_bullet_normal
->texture
[0].type
=
1170 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
1172 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
1173 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
1174 theme
->max_disabled_mask
;
1175 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
1176 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1177 theme
->max_hover_mask
;
1178 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1179 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1180 theme
->max_pressed_mask
;
1181 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1182 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1184 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
1185 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1186 theme
->max_toggled_hover_mask
;
1187 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1188 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1189 theme
->max_toggled_mask
;
1190 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1191 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1192 theme
->max_toggled_pressed_mask
;
1193 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
1194 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
1195 theme
->close_disabled_mask
;
1196 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
1197 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
1198 theme
->close_hover_mask
;
1199 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
1200 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
1201 theme
->close_pressed_mask
;
1202 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
1203 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
1205 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
1206 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
1207 theme
->desk_disabled_mask
;
1208 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1209 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1210 theme
->desk_hover_mask
;
1211 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1212 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1213 theme
->desk_pressed_mask
;
1214 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1215 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1217 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1218 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1219 theme
->desk_toggled_hover_mask
;
1220 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1221 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1222 theme
->desk_toggled_mask
;
1223 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1224 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1225 theme
->desk_toggled_pressed_mask
;
1226 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1227 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1228 theme
->shade_disabled_mask
;
1229 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1230 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1231 theme
->shade_hover_mask
;
1232 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1233 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1234 theme
->shade_pressed_mask
;
1235 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1236 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1238 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1239 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1240 theme
->shade_toggled_hover_mask
;
1241 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1242 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1243 theme
->shade_toggled_mask
;
1244 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1245 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1246 theme
->shade_toggled_pressed_mask
;
1247 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1248 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1249 theme
->iconify_disabled_mask
;
1250 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1251 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1252 theme
->iconify_hover_mask
;
1253 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1254 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1255 theme
->iconify_pressed_mask
;
1256 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1257 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1258 theme
->iconify_mask
;
1259 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1260 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1261 theme
->menu_bullet_mask
;
1262 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1263 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1264 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1265 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1266 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1267 theme
->titlebut_disabled_focused_color
;
1268 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1269 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1270 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1271 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1272 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1273 theme
->titlebut_disabled_unfocused_color
;
1274 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1275 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1276 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1277 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1278 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1279 theme
->titlebut_hover_focused_color
;
1280 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1281 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1282 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1283 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1284 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1285 theme
->titlebut_hover_unfocused_color
;
1286 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1287 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1288 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1289 theme
->titlebut_toggled_hover_focused_color
;
1290 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1291 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1292 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1293 theme
->titlebut_toggled_hover_unfocused_color
;
1294 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1295 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1296 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1297 theme
->titlebut_toggled_focused_unpressed_color
;
1298 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1299 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1300 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1301 theme
->titlebut_toggled_unfocused_unpressed_color
;
1302 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1303 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1304 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1305 theme
->titlebut_toggled_focused_pressed_color
;
1306 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1307 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1308 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1309 theme
->titlebut_toggled_unfocused_pressed_color
;
1310 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1311 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1312 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1313 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1314 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1315 theme
->titlebut_focused_unpressed_color
;
1316 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1317 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1318 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1319 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1320 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1321 theme
->titlebut_focused_pressed_color
;
1322 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1323 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1324 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1325 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1326 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1327 theme
->titlebut_unfocused_unpressed_color
;
1328 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1329 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1330 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1331 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1332 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1333 theme
->titlebut_unfocused_pressed_color
;
1334 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1336 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1337 theme
->menu_selected_color
;
1340 XrmDestroyDatabase(db
);
1342 /* set the font heights */
1343 theme
->win_font_height
= RrFontHeight
1344 (theme
->win_font_focused
,
1345 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
);
1346 theme
->win_font_height
=
1347 MAX(theme
->win_font_height
,
1349 (theme
->win_font_focused
,
1350 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
));
1351 theme
->menu_title_font_height
= RrFontHeight
1352 (theme
->menu_title_font
,
1353 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
);
1354 theme
->menu_font_height
= RrFontHeight
1356 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
);
1358 /* calculate some last extents */
1360 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1362 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1363 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1364 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1365 theme
->label_height
+= theme
->label_height
% 2;
1367 /* this would be nice I think, since padding.width can now be 0,
1368 but it breaks frame.c horribly and I don't feel like fixing that
1369 right now, so if anyone complains, here is how to keep text from
1370 going over the title's bevel/border with a padding.width of 0 and a
1371 bevelless/borderless label
1372 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1373 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1374 theme->title_height = theme->label_height +
1375 MAX(MAX(theme->padding * 2, ft + fb),
1376 MAX(theme->padding * 2, ut + ub));
1378 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1380 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1381 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1382 theme
->menu_title_height
= theme
->menu_title_label_height
+
1383 theme
->paddingy
* 2;
1385 theme
->button_size
= theme
->label_height
- 2;
1386 theme
->grip_width
= 25;
1391 void RrThemeFree(RrTheme
*theme
)
1394 g_free(theme
->name
);
1396 RrColorFree(theme
->menu_border_color
);
1397 RrColorFree(theme
->osd_border_color
);
1398 RrColorFree(theme
->frame_focused_border_color
);
1399 RrColorFree(theme
->frame_unfocused_border_color
);
1400 RrColorFree(theme
->title_separator_focused_color
);
1401 RrColorFree(theme
->title_separator_unfocused_color
);
1402 RrColorFree(theme
->cb_unfocused_color
);
1403 RrColorFree(theme
->cb_focused_color
);
1404 RrColorFree(theme
->title_focused_color
);
1405 RrColorFree(theme
->title_unfocused_color
);
1406 RrColorFree(theme
->titlebut_disabled_focused_color
);
1407 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1408 RrColorFree(theme
->titlebut_hover_focused_color
);
1409 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1410 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1411 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1412 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1413 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1414 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1415 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1416 RrColorFree(theme
->titlebut_focused_pressed_color
);
1417 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1418 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1419 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1420 RrColorFree(theme
->menu_title_color
);
1421 RrColorFree(theme
->menu_color
);
1422 RrColorFree(theme
->menu_selected_color
);
1423 RrColorFree(theme
->menu_disabled_color
);
1424 RrColorFree(theme
->menu_disabled_selected_color
);
1425 RrColorFree(theme
->title_focused_shadow_color
);
1426 RrColorFree(theme
->title_unfocused_shadow_color
);
1427 RrColorFree(theme
->osd_color
);
1428 RrColorFree(theme
->osd_shadow_color
);
1429 RrColorFree(theme
->menu_title_shadow_color
);
1430 RrColorFree(theme
->menu_text_normal_shadow_color
);
1431 RrColorFree(theme
->menu_text_selected_shadow_color
);
1432 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1433 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1435 g_free(theme
->def_win_icon
);
1437 RrPixmapMaskFree(theme
->max_mask
);
1438 RrPixmapMaskFree(theme
->max_toggled_mask
);
1439 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1440 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1441 RrPixmapMaskFree(theme
->max_disabled_mask
);
1442 RrPixmapMaskFree(theme
->max_hover_mask
);
1443 RrPixmapMaskFree(theme
->max_pressed_mask
);
1444 RrPixmapMaskFree(theme
->desk_mask
);
1445 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1446 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1447 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1448 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1449 RrPixmapMaskFree(theme
->desk_hover_mask
);
1450 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1451 RrPixmapMaskFree(theme
->shade_mask
);
1452 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1453 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1454 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1455 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1456 RrPixmapMaskFree(theme
->shade_hover_mask
);
1457 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1458 RrPixmapMaskFree(theme
->iconify_mask
);
1459 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1460 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1461 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1462 RrPixmapMaskFree(theme
->close_mask
);
1463 RrPixmapMaskFree(theme
->close_disabled_mask
);
1464 RrPixmapMaskFree(theme
->close_hover_mask
);
1465 RrPixmapMaskFree(theme
->close_pressed_mask
);
1466 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1467 RrPixmapMaskFree(theme
->down_arrow_mask
);
1468 RrPixmapMaskFree(theme
->up_arrow_mask
);
1470 RrFontClose(theme
->win_font_focused
);
1471 RrFontClose(theme
->win_font_unfocused
);
1472 RrFontClose(theme
->menu_title_font
);
1473 RrFontClose(theme
->menu_font
);
1474 RrFontClose(theme
->osd_font
);
1476 RrAppearanceFree(theme
->a_disabled_focused_max
);
1477 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1478 RrAppearanceFree(theme
->a_hover_focused_max
);
1479 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1480 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1481 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1482 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1483 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1484 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1485 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1486 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1487 RrAppearanceFree(theme
->a_focused_pressed_max
);
1488 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1489 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1490 RrAppearanceFree(theme
->a_disabled_focused_close
);
1491 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1492 RrAppearanceFree(theme
->a_hover_focused_close
);
1493 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1494 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1495 RrAppearanceFree(theme
->a_focused_pressed_close
);
1496 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1497 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1498 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1499 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1500 RrAppearanceFree(theme
->a_hover_focused_desk
);
1501 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1502 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1503 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1504 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1505 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1506 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1507 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1508 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1509 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1510 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1511 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1512 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1513 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1514 RrAppearanceFree(theme
->a_hover_focused_shade
);
1515 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1516 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1517 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1518 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1519 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1520 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1521 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1522 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1523 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1524 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1525 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1526 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1527 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1528 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1529 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1530 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1531 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1532 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1533 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1534 RrAppearanceFree(theme
->a_focused_grip
);
1535 RrAppearanceFree(theme
->a_unfocused_grip
);
1536 RrAppearanceFree(theme
->a_focused_title
);
1537 RrAppearanceFree(theme
->a_unfocused_title
);
1538 RrAppearanceFree(theme
->a_focused_label
);
1539 RrAppearanceFree(theme
->a_unfocused_label
);
1540 RrAppearanceFree(theme
->a_icon
);
1541 RrAppearanceFree(theme
->a_focused_handle
);
1542 RrAppearanceFree(theme
->a_unfocused_handle
);
1543 RrAppearanceFree(theme
->a_menu
);
1544 RrAppearanceFree(theme
->a_menu_title
);
1545 RrAppearanceFree(theme
->a_menu_text_title
);
1546 RrAppearanceFree(theme
->a_menu_normal
);
1547 RrAppearanceFree(theme
->a_menu_selected
);
1548 RrAppearanceFree(theme
->a_menu_disabled
);
1549 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1550 RrAppearanceFree(theme
->a_menu_text_normal
);
1551 RrAppearanceFree(theme
->a_menu_text_selected
);
1552 RrAppearanceFree(theme
->a_menu_text_disabled
);
1553 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1554 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1555 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1556 RrAppearanceFree(theme
->a_clear
);
1557 RrAppearanceFree(theme
->a_clear_tex
);
1558 RrAppearanceFree(theme
->osd_hilite_bg
);
1559 RrAppearanceFree(theme
->osd_hilite_fg
);
1560 RrAppearanceFree(theme
->osd_hilite_label
);
1561 RrAppearanceFree(theme
->osd_unhilite_fg
);
1567 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
)
1570 XrmDatabase db
= NULL
;
1573 if (name
[0] == '/') {
1574 s
= g_build_filename(name
, "openbox-3", "themerc", NULL
);
1575 if ((db
= XrmGetFileDatabase(s
)))
1576 *path
= g_path_get_dirname(s
);
1581 p
= obt_paths_new();
1583 /* XXX backwards compatibility, remove me sometime later */
1584 s
= g_build_filename(g_get_home_dir(), ".themes", name
,
1585 "openbox-3", "themerc", NULL
);
1586 if ((db
= XrmGetFileDatabase(s
)))
1587 *path
= g_path_get_dirname(s
);
1590 for (it
= obt_paths_data_dirs(p
); !db
&& it
; it
= g_slist_next(it
))
1592 s
= g_build_filename(it
->data
, "themes", name
,
1593 "openbox-3", "themerc", NULL
);
1594 if ((db
= XrmGetFileDatabase(s
)))
1595 *path
= g_path_get_dirname(s
);
1603 s
= g_build_filename(name
, "themerc", NULL
);
1604 if ((db
= XrmGetFileDatabase(s
)))
1605 *path
= g_path_get_dirname(s
);
1612 static gchar
*create_class_name(const gchar
*rname
)
1614 gchar
*rclass
= g_strdup(rname
);
1619 p
= strchr(p
+1, '.');
1620 if (p
== NULL
) break;
1622 if (*p
== '\0') break;
1627 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
)
1629 gboolean ret
= FALSE
;
1630 gchar
*rclass
= create_class_name(rname
);
1631 gchar
*rettype
, *end
;
1634 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1635 retvalue
.addr
!= NULL
) {
1636 *value
= (gint
)strtol(retvalue
.addr
, &end
, 10);
1637 if (end
!= retvalue
.addr
)
1645 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
)
1647 gboolean ret
= FALSE
;
1648 gchar
*rclass
= create_class_name(rname
);
1652 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1653 retvalue
.addr
!= NULL
) {
1654 *value
= retvalue
.addr
;
1662 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
1663 const gchar
*rname
, RrColor
**value
)
1665 gboolean ret
= FALSE
;
1666 gchar
*rclass
= create_class_name(rname
);
1670 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1671 retvalue
.addr
!= NULL
) {
1672 RrColor
*c
= RrColorParse(inst
, retvalue
.addr
);
1683 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
1684 RrTheme
*theme
, const gchar
*maskname
,
1685 RrPixmapMask
**value
)
1687 gboolean ret
= FALSE
;
1689 gint hx
, hy
; /* ignored */
1693 s
= g_build_filename(path
, maskname
, NULL
);
1694 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1696 *value
= RrPixmapMaskNew(inst
, w
, h
, (gchar
*)b
);
1704 static void parse_appearance(gchar
*tex
, RrSurfaceColorType
*grad
,
1705 RrReliefType
*relief
, RrBevelType
*bevel
,
1706 gboolean
*interlaced
, gboolean
*border
,
1707 gboolean allow_trans
)
1711 /* convert to all lowercase */
1712 for (t
= tex
; *t
!= '\0'; ++t
)
1713 *t
= g_ascii_tolower(*t
);
1715 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1716 *grad
= RR_SURFACE_PARENTREL
;
1718 if (strstr(tex
, "gradient") != NULL
) {
1719 if (strstr(tex
, "crossdiagonal") != NULL
)
1720 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1721 else if (strstr(tex
, "pyramid") != NULL
)
1722 *grad
= RR_SURFACE_PYRAMID
;
1723 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1724 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1725 else if (strstr(tex
, "horizontal") != NULL
)
1726 *grad
= RR_SURFACE_HORIZONTAL
;
1727 else if (strstr(tex
, "splitvertical") != NULL
)
1728 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1729 else if (strstr(tex
, "vertical") != NULL
)
1730 *grad
= RR_SURFACE_VERTICAL
;
1732 *grad
= RR_SURFACE_DIAGONAL
;
1734 *grad
= RR_SURFACE_SOLID
;
1738 if (strstr(tex
, "sunken") != NULL
)
1739 *relief
= RR_RELIEF_SUNKEN
;
1740 else if (strstr(tex
, "flat") != NULL
)
1741 *relief
= RR_RELIEF_FLAT
;
1742 else if (strstr(tex
, "raised") != NULL
)
1743 *relief
= RR_RELIEF_RAISED
;
1745 *relief
= (*grad
== RR_SURFACE_PARENTREL
) ?
1746 RR_RELIEF_FLAT
: RR_RELIEF_RAISED
;
1749 if (*relief
== RR_RELIEF_FLAT
) {
1750 if (strstr(tex
, "border") != NULL
)
1753 if (strstr(tex
, "bevel2") != NULL
)
1754 *bevel
= RR_BEVEL_2
;
1756 *bevel
= RR_BEVEL_1
;
1759 if (strstr(tex
, "interlaced") != NULL
)
1762 *interlaced
= FALSE
;
1766 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
1767 const gchar
*rname
, RrAppearance
*value
,
1768 gboolean allow_trans
)
1770 gboolean ret
= FALSE
;
1771 gchar
*rclass
= create_class_name(rname
);
1772 gchar
*cname
, *ctoname
, *bcname
, *icname
, *hname
, *sname
;
1773 gchar
*csplitname
, *ctosplitname
;
1778 cname
= g_strconcat(rname
, ".color", NULL
);
1779 ctoname
= g_strconcat(rname
, ".colorTo", NULL
);
1780 bcname
= g_strconcat(rname
, ".border.color", NULL
);
1781 icname
= g_strconcat(rname
, ".interlace.color", NULL
);
1782 hname
= g_strconcat(rname
, ".highlight", NULL
);
1783 sname
= g_strconcat(rname
, ".shadow", NULL
);
1784 csplitname
= g_strconcat(rname
, ".color.splitTo", NULL
);
1785 ctosplitname
= g_strconcat(rname
, ".colorTo.splitTo", NULL
);
1787 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1788 retvalue
.addr
!= NULL
) {
1789 parse_appearance(retvalue
.addr
,
1790 &value
->surface
.grad
,
1791 &value
->surface
.relief
,
1792 &value
->surface
.bevel
,
1793 &value
->surface
.interlaced
,
1794 &value
->surface
.border
,
1796 if (!read_color(db
, inst
, cname
, &value
->surface
.primary
))
1797 value
->surface
.primary
= RrColorNew(inst
, 0, 0, 0);
1798 if (!read_color(db
, inst
, ctoname
, &value
->surface
.secondary
))
1799 value
->surface
.secondary
= RrColorNew(inst
, 0, 0, 0);
1800 if (value
->surface
.border
)
1801 if (!read_color(db
, inst
, bcname
,
1802 &value
->surface
.border_color
))
1803 value
->surface
.border_color
= RrColorNew(inst
, 0, 0, 0);
1804 if (value
->surface
.interlaced
)
1805 if (!read_color(db
, inst
, icname
,
1806 &value
->surface
.interlace_color
))
1807 value
->surface
.interlace_color
= RrColorNew(inst
, 0, 0, 0);
1808 if (read_int(db
, hname
, &i
) && i
>= 0)
1809 value
->surface
.bevel_light_adjust
= i
;
1810 if (read_int(db
, sname
, &i
) && i
>= 0 && i
<= 256)
1811 value
->surface
.bevel_dark_adjust
= i
;
1813 if (value
->surface
.grad
== RR_SURFACE_SPLIT_VERTICAL
) {
1816 if (!read_color(db
, inst
, csplitname
,
1817 &value
->surface
.split_primary
))
1819 r
= value
->surface
.primary
->r
;
1821 g
= value
->surface
.primary
->g
;
1823 b
= value
->surface
.primary
->b
;
1825 if (r
> 0xFF) r
= 0xFF;
1826 if (g
> 0xFF) g
= 0xFF;
1827 if (b
> 0xFF) b
= 0xFF;
1828 value
->surface
.split_primary
= RrColorNew(inst
, r
, g
, b
);
1831 if (!read_color(db
, inst
, ctosplitname
,
1832 &value
->surface
.split_secondary
))
1834 r
= value
->surface
.secondary
->r
;
1836 g
= value
->surface
.secondary
->g
;
1838 b
= value
->surface
.secondary
->b
;
1840 if (r
> 0xFF) r
= 0xFF;
1841 if (g
> 0xFF) g
= 0xFF;
1842 if (b
> 0xFF) b
= 0xFF;
1843 value
->surface
.split_secondary
= RrColorNew(inst
, r
, g
, b
);
1850 g_free(ctosplitname
);
1862 static int parse_inline_number(const char *p
)
1870 for (; isdigit(*p
); ++p
)
1871 res
= res
* 10 + *p
- '0';
1876 static void set_default_appearance(RrAppearance
*a
)
1878 a
->surface
.grad
= RR_SURFACE_SOLID
;
1879 a
->surface
.relief
= RR_RELIEF_FLAT
;
1880 a
->surface
.bevel
= RR_BEVEL_1
;
1881 a
->surface
.interlaced
= FALSE
;
1882 a
->surface
.border
= FALSE
;
1883 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1884 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1887 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1888 an RrTextureRGBA. */
1889 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1894 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1896 for (i
= 0; i
< width
* height
; ++i
) {
1897 guchar a
= ((*p
>> 24) & 0xff);
1898 guchar b
= ((*p
>> 16) & 0xff);
1899 guchar g
= ((*p
>> 8) & 0xff);
1900 guchar r
= ((*p
>> 0) & 0xff);
1902 *p
= ((r
<< RrDefaultRedOffset
) +
1903 (g
<< RrDefaultGreenOffset
) +
1904 (b
<< RrDefaultBlueOffset
) +
1905 (a
<< RrDefaultAlphaOffset
));