1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 theme.c for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 See the COPYING file for a copy of the GNU General Public License.
26 #include "obt/paths.h"
29 #include <X11/Xresource.h>
34 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
);
35 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
);
36 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
);
37 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
38 const gchar
*rname
, RrColor
**value
);
39 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
40 RrTheme
*theme
, const gchar
*maskname
,
41 RrPixmapMask
**value
);
42 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
43 const gchar
*rname
, RrAppearance
*value
,
44 gboolean allow_trans
);
45 static int parse_inline_number(const char *p
);
46 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
);
47 static void set_default_appearance(RrAppearance
*a
);
49 static RrFont
*get_font(RrFont
*target
, RrFont
**default_font
,
50 const RrInstance
*inst
)
56 /* Only load the default font once */
58 RrFontRef(*default_font
);
60 *default_font
= RrFontOpenDefault(inst
);
66 RrTheme
* RrThemeNew(const RrInstance
*inst
, const gchar
*name
,
67 gboolean allow_fallback
,
68 RrFont
*active_window_font
, RrFont
*inactive_window_font
,
69 RrFont
*menu_title_font
, RrFont
*menu_item_font
,
72 XrmDatabase db
= NULL
;
73 RrJustify winjust
, mtitlejust
;
76 RrFont
*default_font
= NULL
;
81 db
= loaddb(name
, &path
);
83 g_message("Unable to load the theme '%s'", name
);
85 g_message("Falling back to the default theme '%s'",
87 /* fallback to the default theme */
93 db
= loaddb(DEFAULT_THEME
, &path
);
95 g_message("Unable to load the theme '%s'", DEFAULT_THEME
);
102 theme
= g_new0(RrTheme
, 1);
105 theme
->name
= g_strdup(name
? name
: DEFAULT_THEME
);
107 theme
->a_disabled_focused_max
= RrAppearanceNew(inst
, 1);
108 theme
->a_disabled_unfocused_max
= RrAppearanceNew(inst
, 1);
109 theme
->a_hover_focused_max
= RrAppearanceNew(inst
, 1);
110 theme
->a_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
111 theme
->a_toggled_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
112 theme
->a_toggled_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
113 theme
->a_toggled_hover_focused_max
= RrAppearanceNew(inst
, 1);
114 theme
->a_toggled_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
115 theme
->a_toggled_focused_pressed_max
= RrAppearanceNew(inst
, 1);
116 theme
->a_toggled_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
117 theme
->a_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
118 theme
->a_focused_pressed_max
= RrAppearanceNew(inst
, 1);
119 theme
->a_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
120 theme
->a_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
121 theme
->a_focused_grip
= RrAppearanceNew(inst
, 0);
122 theme
->a_unfocused_grip
= RrAppearanceNew(inst
, 0);
123 theme
->a_focused_title
= RrAppearanceNew(inst
, 0);
124 theme
->a_unfocused_title
= RrAppearanceNew(inst
, 0);
125 theme
->a_focused_label
= RrAppearanceNew(inst
, 1);
126 theme
->a_unfocused_label
= RrAppearanceNew(inst
, 1);
127 theme
->a_icon
= RrAppearanceNew(inst
, 1);
128 theme
->a_focused_handle
= RrAppearanceNew(inst
, 0);
129 theme
->a_unfocused_handle
= RrAppearanceNew(inst
, 0);
130 theme
->a_menu
= RrAppearanceNew(inst
, 0);
131 theme
->a_menu_title
= RrAppearanceNew(inst
, 0);
132 theme
->a_menu_text_title
= RrAppearanceNew(inst
, 1);
133 theme
->a_menu_normal
= RrAppearanceNew(inst
, 0);
134 theme
->a_menu_selected
= RrAppearanceNew(inst
, 0);
135 theme
->a_menu_disabled
= RrAppearanceNew(inst
, 0);
136 /* a_menu_disabled_selected is copied from a_menu_selected */
137 theme
->a_menu_text_normal
= RrAppearanceNew(inst
, 1);
138 theme
->a_menu_text_selected
= RrAppearanceNew(inst
, 1);
139 theme
->a_menu_text_disabled
= RrAppearanceNew(inst
, 1);
140 theme
->a_menu_text_disabled_selected
= RrAppearanceNew(inst
, 1);
141 theme
->a_menu_bullet_normal
= RrAppearanceNew(inst
, 1);
142 theme
->a_menu_bullet_selected
= RrAppearanceNew(inst
, 1);
143 theme
->a_clear
= RrAppearanceNew(inst
, 0);
144 theme
->a_clear_tex
= RrAppearanceNew(inst
, 1);
145 theme
->osd_hilite_bg
= RrAppearanceNew(inst
, 0);
146 theme
->osd_hilite_label
= RrAppearanceNew(inst
, 1);
147 theme
->osd_hilite_fg
= RrAppearanceNew(inst
, 0);
148 theme
->osd_unhilite_fg
= RrAppearanceNew(inst
, 0);
150 /* load the font stuff */
151 theme
->win_font_focused
= get_font(active_window_font
,
152 &default_font
, inst
);
153 theme
->win_font_unfocused
= get_font(inactive_window_font
,
154 &default_font
, inst
);
156 winjust
= RR_JUSTIFY_LEFT
;
157 if (read_string(db
, "window.label.text.justify", &str
)) {
158 if (!g_ascii_strcasecmp(str
, "right"))
159 winjust
= RR_JUSTIFY_RIGHT
;
160 else if (!g_ascii_strcasecmp(str
, "center"))
161 winjust
= RR_JUSTIFY_CENTER
;
164 theme
->menu_title_font
= get_font(menu_title_font
, &default_font
, inst
);
166 mtitlejust
= RR_JUSTIFY_LEFT
;
167 if (read_string(db
, "menu.title.text.justify", &str
)) {
168 if (!g_ascii_strcasecmp(str
, "right"))
169 mtitlejust
= RR_JUSTIFY_RIGHT
;
170 else if (!g_ascii_strcasecmp(str
, "center"))
171 mtitlejust
= RR_JUSTIFY_CENTER
;
174 theme
->menu_font
= get_font(menu_item_font
, &default_font
, inst
);
176 theme
->osd_font
= get_font(osd_font
, &default_font
, inst
);
178 /* load direct dimensions */
179 if ((!read_int(db
, "menu.overlap.x", &theme
->menu_overlap_x
) &&
180 !read_int(db
, "menu.overlap", &theme
->menu_overlap_x
)) ||
181 theme
->menu_overlap_x
< -100 || theme
->menu_overlap_x
> 100)
182 theme
->menu_overlap_x
= 0;
183 if ((!read_int(db
, "menu.overlap.y", &theme
->menu_overlap_y
) &&
184 !read_int(db
, "menu.overlap", &theme
->menu_overlap_y
)) ||
185 theme
->menu_overlap_y
< -100 || theme
->menu_overlap_y
> 100)
186 theme
->menu_overlap_y
= 0;
187 if (!read_int(db
, "window.handle.width", &theme
->handle_height
) ||
188 theme
->handle_height
< 0 || theme
->handle_height
> 100)
189 theme
->handle_height
= 6;
190 if (!read_int(db
, "padding.width", &theme
->paddingx
) ||
191 theme
->paddingx
< 0 || theme
->paddingx
> 100)
193 if (!read_int(db
, "padding.height", &theme
->paddingy
) ||
194 theme
->paddingy
< 0 || theme
->paddingy
> 100)
195 theme
->paddingy
= theme
->paddingx
;
196 if (!read_int(db
, "border.width", &theme
->fbwidth
) ||
197 theme
->fbwidth
< 0 || theme
->fbwidth
> 100)
199 /* menu border width inherits from the frame border width */
200 if (!read_int(db
, "menu.border.width", &theme
->mbwidth
) ||
201 theme
->mbwidth
< 0 || theme
->mbwidth
> 100)
202 theme
->mbwidth
= theme
->fbwidth
;
203 /* osd border width inherits from the frame border width */
204 if (!read_int(db
, "osd.border.width", &theme
->obwidth
) ||
205 theme
->obwidth
< 0 || theme
->obwidth
> 100)
206 theme
->obwidth
= theme
->fbwidth
;
207 if (!read_int(db
, "window.client.padding.width", &theme
->cbwidthx
) ||
208 theme
->cbwidthx
< 0 || theme
->cbwidthx
> 100)
209 theme
->cbwidthx
= theme
->paddingx
;
210 if (!read_int(db
, "window.client.padding.height", &theme
->cbwidthy
) ||
211 theme
->cbwidthy
< 0 || theme
->cbwidthy
> 100)
212 theme
->cbwidthy
= theme
->cbwidthx
;
213 if (!read_int(db
, "menu.separator.width", &theme
->menu_sep_width
) ||
214 theme
->menu_sep_width
< 1 || theme
->menu_sep_width
> 100)
215 theme
->menu_sep_width
= 1;
216 if (!read_int(db
, "menu.separator.padding.width",
217 &theme
->menu_sep_paddingx
) ||
218 theme
->menu_sep_paddingx
< 0 || theme
->menu_sep_paddingx
> 100)
219 theme
->menu_sep_paddingx
= 6;
220 if (!read_int(db
, "menu.separator.padding.height",
221 &theme
->menu_sep_paddingy
) ||
222 theme
->menu_sep_paddingy
< 0 || theme
->menu_sep_paddingy
> 100)
223 theme
->menu_sep_paddingy
= 3;
226 if (!read_color(db
, inst
,
227 "window.active.border.color",
228 &theme
->frame_focused_border_color
) &&
229 !read_color(db
, inst
,
231 &theme
->frame_focused_border_color
))
232 theme
->frame_focused_border_color
= RrColorNew(inst
, 0, 0, 0);
233 /* title separator focused color inherits from focused border color */
234 if (!read_color(db
, inst
,
235 "window.active.title.separator.color",
236 &theme
->title_separator_focused_color
))
237 theme
->title_separator_focused_color
=
239 theme
->frame_focused_border_color
->r
,
240 theme
->frame_focused_border_color
->g
,
241 theme
->frame_focused_border_color
->b
);
242 /* unfocused border color inherits from frame focused border color */
243 if (!read_color(db
, inst
,
244 "window.inactive.border.color",
245 &theme
->frame_unfocused_border_color
))
246 theme
->frame_unfocused_border_color
=
247 RrColorNew(inst
, theme
->frame_focused_border_color
->r
,
248 theme
->frame_focused_border_color
->g
,
249 theme
->frame_focused_border_color
->b
);
250 /* title separator unfocused color inherits from unfocused border color */
251 if (!read_color(db
, inst
,
252 "window.inactive.title.separator.color",
253 &theme
->title_separator_unfocused_color
))
254 theme
->title_separator_unfocused_color
=
256 theme
->frame_unfocused_border_color
->r
,
257 theme
->frame_unfocused_border_color
->g
,
258 theme
->frame_unfocused_border_color
->b
);
260 /* menu border color inherits from frame focused border color */
261 if (!read_color(db
, inst
, "menu.border.color", &theme
->menu_border_color
))
262 theme
->menu_border_color
=
264 theme
->frame_focused_border_color
->r
,
265 theme
->frame_focused_border_color
->g
,
266 theme
->frame_focused_border_color
->b
);
267 /* osd border color inherits from frame focused border color */
268 if (!read_color(db
, inst
, "osd.border.color", &theme
->osd_border_color
))
269 theme
->osd_border_color
=
271 theme
->frame_focused_border_color
->r
,
272 theme
->frame_focused_border_color
->g
,
273 theme
->frame_focused_border_color
->b
);
274 if (!read_color(db
, inst
,
275 "window.active.client.color",
276 &theme
->cb_focused_color
))
277 theme
->cb_focused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
278 if (!read_color(db
, inst
,
279 "window.inactive.client.color",
280 &theme
->cb_unfocused_color
))
281 theme
->cb_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
282 if (!read_color(db
, inst
,
283 "window.active.label.text.color",
284 &theme
->title_focused_color
))
285 theme
->title_focused_color
= RrColorNew(inst
, 0x0, 0x0, 0x0);
286 if (!read_color(db
, inst
, "osd.label.text.color", &theme
->osd_color
))
287 theme
->osd_color
= RrColorNew(inst
,
288 theme
->title_focused_color
->r
,
289 theme
->title_focused_color
->g
,
290 theme
->title_focused_color
->b
);
291 if (!read_color(db
, inst
,
292 "window.inactive.label.text.color",
293 &theme
->title_unfocused_color
))
294 theme
->title_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
295 if (!read_color(db
, inst
,
296 "window.active.button.unpressed.image.color",
297 &theme
->titlebut_focused_unpressed_color
))
298 theme
->titlebut_focused_unpressed_color
= RrColorNew(inst
, 0, 0, 0);
299 if (!read_color(db
, inst
,
300 "window.inactive.button.unpressed.image.color",
301 &theme
->titlebut_unfocused_unpressed_color
))
302 theme
->titlebut_unfocused_unpressed_color
=
303 RrColorNew(inst
, 0xff, 0xff, 0xff);
304 if (!read_color(db
, inst
,
305 "window.active.button.pressed.image.color",
306 &theme
->titlebut_focused_pressed_color
))
307 theme
->titlebut_focused_pressed_color
=
309 theme
->titlebut_focused_unpressed_color
->r
,
310 theme
->titlebut_focused_unpressed_color
->g
,
311 theme
->titlebut_focused_unpressed_color
->b
);
312 if (!read_color(db
, inst
,
313 "window.inactive.button.pressed.image.color",
314 &theme
->titlebut_unfocused_pressed_color
))
315 theme
->titlebut_unfocused_pressed_color
=
317 theme
->titlebut_unfocused_unpressed_color
->r
,
318 theme
->titlebut_unfocused_unpressed_color
->g
,
319 theme
->titlebut_unfocused_unpressed_color
->b
);
320 if (!read_color(db
, inst
,
321 "window.active.button.disabled.image.color",
322 &theme
->titlebut_disabled_focused_color
))
323 theme
->titlebut_disabled_focused_color
=
324 RrColorNew(inst
, 0xff, 0xff, 0xff);
325 if (!read_color(db
, inst
,
326 "window.inactive.button.disabled.image.color",
327 &theme
->titlebut_disabled_unfocused_color
))
328 theme
->titlebut_disabled_unfocused_color
= RrColorNew(inst
, 0, 0, 0);
329 if (!read_color(db
, inst
,
330 "window.active.button.hover.image.color",
331 &theme
->titlebut_hover_focused_color
))
332 theme
->titlebut_hover_focused_color
=
334 theme
->titlebut_focused_unpressed_color
->r
,
335 theme
->titlebut_focused_unpressed_color
->g
,
336 theme
->titlebut_focused_unpressed_color
->b
);
337 if (!read_color(db
, inst
,
338 "window.inactive.button.hover.image.color",
339 &theme
->titlebut_hover_unfocused_color
))
340 theme
->titlebut_hover_unfocused_color
=
342 theme
->titlebut_unfocused_unpressed_color
->r
,
343 theme
->titlebut_unfocused_unpressed_color
->g
,
344 theme
->titlebut_unfocused_unpressed_color
->b
);
345 if (!read_color(db
, inst
,
346 "window.active.button.toggled.unpressed.image.color",
347 &theme
->titlebut_toggled_focused_unpressed_color
) &&
348 !read_color(db
, inst
,
349 "window.active.button.toggled.image.color",
350 &theme
->titlebut_toggled_focused_unpressed_color
))
351 theme
->titlebut_toggled_focused_unpressed_color
=
353 theme
->titlebut_focused_pressed_color
->r
,
354 theme
->titlebut_focused_pressed_color
->g
,
355 theme
->titlebut_focused_pressed_color
->b
);
356 if (!read_color(db
, inst
,
357 "window.inactive.button.toggled.unpressed.image.color",
358 &theme
->titlebut_toggled_unfocused_unpressed_color
) &&
359 !read_color(db
, inst
,
360 "window.inactive.button.toggled.image.color",
361 &theme
->titlebut_toggled_unfocused_unpressed_color
))
362 theme
->titlebut_toggled_unfocused_unpressed_color
=
364 theme
->titlebut_unfocused_pressed_color
->r
,
365 theme
->titlebut_unfocused_pressed_color
->g
,
366 theme
->titlebut_unfocused_pressed_color
->b
);
367 if (!read_color(db
, inst
,
368 "window.active.button.toggled.hover.image.color",
369 &theme
->titlebut_toggled_hover_focused_color
))
370 theme
->titlebut_toggled_hover_focused_color
=
372 theme
->titlebut_toggled_focused_unpressed_color
->r
,
373 theme
->titlebut_toggled_focused_unpressed_color
->g
,
374 theme
->titlebut_toggled_focused_unpressed_color
->b
);
375 if (!read_color(db
, inst
,
376 "window.inactive.button.toggled.hover.image.color",
377 &theme
->titlebut_toggled_hover_unfocused_color
))
378 theme
->titlebut_toggled_hover_unfocused_color
=
380 theme
->titlebut_toggled_unfocused_unpressed_color
->r
,
381 theme
->titlebut_toggled_unfocused_unpressed_color
->g
,
382 theme
->titlebut_toggled_unfocused_unpressed_color
->b
);
383 if (!read_color(db
, inst
,
384 "window.active.button.toggled.pressed.image.color",
385 &theme
->titlebut_toggled_focused_pressed_color
))
386 theme
->titlebut_toggled_focused_pressed_color
=
388 theme
->titlebut_focused_pressed_color
->r
,
389 theme
->titlebut_focused_pressed_color
->g
,
390 theme
->titlebut_focused_pressed_color
->b
);
391 if (!read_color(db
, inst
,
392 "window.inactive.button.toggled.pressed.image.color",
393 &theme
->titlebut_toggled_unfocused_pressed_color
))
394 theme
->titlebut_toggled_unfocused_pressed_color
=
396 theme
->titlebut_unfocused_pressed_color
->r
,
397 theme
->titlebut_unfocused_pressed_color
->g
,
398 theme
->titlebut_unfocused_pressed_color
->b
);
399 if (!read_color(db
, inst
,
400 "menu.title.text.color", &theme
->menu_title_color
))
401 theme
->menu_title_color
= RrColorNew(inst
, 0, 0, 0);
402 if (!read_color(db
, inst
,
403 "menu.items.text.color", &theme
->menu_color
))
404 theme
->menu_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
405 if (!read_color(db
, inst
,
406 "menu.items.disabled.text.color",
407 &theme
->menu_disabled_color
))
408 theme
->menu_disabled_color
= RrColorNew(inst
, 0, 0, 0);
409 if (!read_color(db
, inst
,
410 "menu.items.active.disabled.text.color",
411 &theme
->menu_disabled_selected_color
))
412 theme
->menu_disabled_selected_color
=
414 theme
->menu_disabled_color
->r
,
415 theme
->menu_disabled_color
->g
,
416 theme
->menu_disabled_color
->b
);
417 if (!read_color(db
, inst
,
418 "menu.items.active.text.color",
419 &theme
->menu_selected_color
))
420 theme
->menu_selected_color
= RrColorNew(inst
, 0, 0, 0);
421 if (!read_color(db
, inst
,
422 "menu.separator.color", &theme
->menu_sep_color
))
423 theme
->menu_sep_color
= RrColorNew(inst
,
424 theme
->menu_color
->r
,
425 theme
->menu_color
->g
,
426 theme
->menu_color
->b
);
428 /* load the image masks */
430 /* maximize button masks */
432 if (!read_mask(inst
, path
, theme
, "max.xbm", &theme
->max_mask
)) {
433 guchar data
[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
434 theme
->max_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
437 if (!read_mask(inst
, path
, theme
, "max_toggled.xbm",
438 &theme
->max_toggled_mask
))
441 theme
->max_toggled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
443 guchar data
[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
444 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 6, 6,(gchar
*)data
);
447 if (!read_mask(inst
, path
, theme
, "max_pressed.xbm",
448 &theme
->max_pressed_mask
))
449 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
450 if (!read_mask(inst
,path
,theme
,"max_disabled.xbm",
451 &theme
->max_disabled_mask
))
452 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
453 if (!read_mask(inst
, path
, theme
, "max_hover.xbm", &theme
->max_hover_mask
))
454 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
455 if (!read_mask(inst
, path
, theme
, "max_toggled_pressed.xbm",
456 &theme
->max_toggled_pressed_mask
))
457 theme
->max_toggled_pressed_mask
=
458 RrPixmapMaskCopy(theme
->max_toggled_mask
);
459 if (!read_mask(inst
, path
, theme
, "max_toggled_hover.xbm",
460 &theme
->max_toggled_hover_mask
))
461 theme
->max_toggled_hover_mask
=
462 RrPixmapMaskCopy(theme
->max_toggled_mask
);
464 /* iconify button masks */
465 if (!read_mask(inst
, path
, theme
, "iconify.xbm", &theme
->iconify_mask
)) {
466 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
467 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
469 if (!read_mask(inst
, path
, theme
, "iconify_pressed.xbm",
470 &theme
->iconify_pressed_mask
))
471 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
472 if (!read_mask(inst
, path
, theme
, "iconify_disabled.xbm",
473 &theme
->iconify_disabled_mask
))
474 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
475 if (!read_mask(inst
, path
, theme
, "iconify_hover.xbm",
476 &theme
->iconify_hover_mask
))
477 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
479 /* all desktops button masks */
481 if (!read_mask(inst
, path
, theme
, "desk.xbm", &theme
->desk_mask
)) {
482 guchar data
[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
483 theme
->desk_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
486 if (!read_mask(inst
, path
, theme
, "desk_toggled.xbm",
487 &theme
->desk_toggled_mask
)) {
489 theme
->desk_toggled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
491 guchar data
[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
492 theme
->desk_toggled_mask
=
493 RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
496 if (!read_mask(inst
, path
, theme
, "desk_pressed.xbm",
497 &theme
->desk_pressed_mask
))
498 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
499 if (!read_mask(inst
, path
, theme
, "desk_disabled.xbm",
500 &theme
->desk_disabled_mask
))
501 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
502 if (!read_mask(inst
, path
, theme
, "desk_hover.xbm",
503 &theme
->desk_hover_mask
))
504 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
505 if (!read_mask(inst
, path
, theme
, "desk_toggled_pressed.xbm",
506 &theme
->desk_toggled_pressed_mask
))
507 theme
->desk_toggled_pressed_mask
=
508 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
509 if (!read_mask(inst
, path
, theme
, "desk_toggled_hover.xbm",
510 &theme
->desk_toggled_hover_mask
))
511 theme
->desk_toggled_hover_mask
=
512 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
514 /* shade button masks */
515 if (!read_mask(inst
, path
, theme
, "shade.xbm", &theme
->shade_mask
)) {
516 guchar data
[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
517 theme
->shade_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
519 if (!read_mask(inst
, path
, theme
, "shade_toggled.xbm",
520 &theme
->shade_toggled_mask
))
521 theme
->shade_toggled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
522 if (!read_mask(inst
, path
, theme
, "shade_pressed.xbm",
523 &theme
->shade_pressed_mask
))
524 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
525 if (!read_mask(inst
, path
, theme
, "shade_disabled.xbm",
526 &theme
->shade_disabled_mask
))
527 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
528 if (!read_mask(inst
, path
, theme
, "shade_hover.xbm",
529 &theme
->shade_hover_mask
))
530 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
531 if (!read_mask(inst
, path
, theme
, "shade_toggled_pressed.xbm",
532 &theme
->shade_toggled_pressed_mask
))
533 theme
->shade_toggled_pressed_mask
=
534 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
535 if (!read_mask(inst
, path
, theme
, "shade_toggled_hover.xbm",
536 &theme
->shade_toggled_hover_mask
))
537 theme
->shade_toggled_hover_mask
=
538 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
540 /* close button masks */
541 if (!read_mask(inst
, path
, theme
, "close.xbm", &theme
->close_mask
)) {
542 guchar data
[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
543 theme
->close_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
545 if (!read_mask(inst
, path
, theme
, "close_pressed.xbm",
546 &theme
->close_pressed_mask
))
547 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
548 if (!read_mask(inst
, path
, theme
, "close_disabled.xbm",
549 &theme
->close_disabled_mask
))
550 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
551 if (!read_mask(inst
, path
, theme
, "close_hover.xbm",
552 &theme
->close_hover_mask
))
553 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
555 /* submenu bullet mask */
556 if (!read_mask(inst
, path
, theme
, "bullet.xbm", &theme
->menu_bullet_mask
))
558 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
559 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
562 /* up and down arrows */
564 guchar data
[] = { 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00 };
565 theme
->down_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
568 guchar data
[] = { 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00 };
569 theme
->up_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
572 /* setup the default window icon */
573 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
574 OB_DEFAULT_ICON_HEIGHT
,
575 OB_DEFAULT_ICON_pixel_data
);
576 theme
->def_win_icon_w
= OB_DEFAULT_ICON_WIDTH
;
577 theme
->def_win_icon_h
= OB_DEFAULT_ICON_HEIGHT
;
579 /* read the decoration textures */
580 if (!read_appearance(db
, inst
,
581 "window.active.title.bg", theme
->a_focused_title
,
583 set_default_appearance(theme
->a_focused_title
);
584 if (!read_appearance(db
, inst
,
585 "window.inactive.title.bg", theme
->a_unfocused_title
,
587 set_default_appearance(theme
->a_unfocused_title
);
588 if (!read_appearance(db
, inst
,
589 "window.active.label.bg", theme
->a_focused_label
,
591 set_default_appearance(theme
->a_focused_label
);
592 if (!read_appearance(db
, inst
,
593 "window.inactive.label.bg", theme
->a_unfocused_label
,
595 set_default_appearance(theme
->a_unfocused_label
);
596 if (!read_appearance(db
, inst
,
597 "window.active.handle.bg", theme
->a_focused_handle
,
599 set_default_appearance(theme
->a_focused_handle
);
600 if (!read_appearance(db
, inst
,
601 "window.inactive.handle.bg",theme
->a_unfocused_handle
,
603 set_default_appearance(theme
->a_unfocused_handle
);
604 if (!read_appearance(db
, inst
,
605 "window.active.grip.bg", theme
->a_focused_grip
,
607 set_default_appearance(theme
->a_focused_grip
);
608 if (!read_appearance(db
, inst
,
609 "window.inactive.grip.bg", theme
->a_unfocused_grip
,
611 set_default_appearance(theme
->a_unfocused_grip
);
612 if (!read_appearance(db
, inst
,
613 "menu.items.bg", theme
->a_menu
,
615 set_default_appearance(theme
->a_menu
);
616 if (!read_appearance(db
, inst
,
617 "menu.title.bg", theme
->a_menu_title
,
619 set_default_appearance(theme
->a_menu_title
);
620 if (!read_appearance(db
, inst
,
621 "menu.items.active.bg", theme
->a_menu_selected
,
623 set_default_appearance(theme
->a_menu_selected
);
624 theme
->a_menu_disabled_selected
=
625 RrAppearanceCopy(theme
->a_menu_selected
);
627 /* read appearances for non-decorations (on-screen-display) */
628 if (!read_appearance(db
, inst
, "osd.bg", theme
->osd_hilite_bg
, FALSE
)) {
629 RrAppearanceFree(theme
->osd_hilite_bg
);
630 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
632 if (!read_appearance(db
, inst
, "osd.label.bg",
633 theme
->osd_hilite_label
, TRUE
)) {
634 RrAppearanceFree(theme
->osd_hilite_label
);
635 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
637 /* osd_hilite_fg can't be parentrel */
638 if (!read_appearance(db
, inst
, "osd.hilight.bg",
639 theme
->osd_hilite_fg
, FALSE
)) {
640 RrAppearanceFree(theme
->osd_hilite_fg
);
641 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
642 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_label
);
644 theme
->osd_hilite_fg
= RrAppearanceCopy(theme
->a_focused_title
);
646 /* osd_unhilite_fg can't be parentrel either */
647 if (!read_appearance(db
, inst
, "osd.unhilight.bg",
648 theme
->osd_unhilite_fg
, FALSE
)) {
649 RrAppearanceFree(theme
->osd_unhilite_fg
);
650 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
651 theme
->osd_unhilite_fg
=RrAppearanceCopy(theme
->a_unfocused_label
);
653 theme
->osd_unhilite_fg
=RrAppearanceCopy(theme
->a_unfocused_title
);
656 /* read buttons textures */
657 if (!read_appearance(db
, inst
,
658 "window.active.button.disabled.bg",
659 theme
->a_disabled_focused_max
,
661 set_default_appearance(theme
->a_disabled_focused_max
);
662 if (!read_appearance(db
, inst
,
663 "window.inactive.button.disabled.bg",
664 theme
->a_disabled_unfocused_max
,
666 set_default_appearance(theme
->a_disabled_unfocused_max
);
667 if (!read_appearance(db
, inst
,
668 "window.active.button.pressed.bg",
669 theme
->a_focused_pressed_max
,
671 set_default_appearance(theme
->a_focused_pressed_max
);
672 if (!read_appearance(db
, inst
,
673 "window.inactive.button.pressed.bg",
674 theme
->a_unfocused_pressed_max
,
676 set_default_appearance(theme
->a_unfocused_pressed_max
);
677 if (!read_appearance(db
, inst
,
678 "window.active.button.toggled.unpressed.bg",
679 theme
->a_toggled_focused_unpressed_max
,
681 !read_appearance(db
, inst
,
682 "window.active.button.toggled.bg",
683 theme
->a_toggled_focused_unpressed_max
,
686 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
687 theme
->a_toggled_focused_unpressed_max
=
688 RrAppearanceCopy(theme
->a_focused_pressed_max
);
690 if (!read_appearance(db
, inst
,
691 "window.inactive.button.toggled.unpressed.bg",
692 theme
->a_toggled_unfocused_unpressed_max
,
694 !read_appearance(db
, inst
,
695 "window.inactive.button.toggled.bg",
696 theme
->a_toggled_unfocused_unpressed_max
,
699 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
700 theme
->a_toggled_unfocused_unpressed_max
=
701 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
703 if (!read_appearance(db
, inst
,
704 "window.active.button.toggled.hover.bg",
705 theme
->a_toggled_hover_focused_max
,
708 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
709 theme
->a_toggled_hover_focused_max
=
710 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
712 if (!read_appearance(db
, inst
,
713 "window.inactive.button.toggled.hover.bg",
714 theme
->a_toggled_hover_unfocused_max
,
717 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
718 theme
->a_toggled_hover_unfocused_max
=
719 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
721 if (!read_appearance(db
, inst
,
722 "window.active.button.toggled.pressed.bg",
723 theme
->a_toggled_focused_pressed_max
,
726 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
727 theme
->a_toggled_focused_pressed_max
=
728 RrAppearanceCopy(theme
->a_focused_pressed_max
);
730 if (!read_appearance(db
, inst
,
731 "window.inactive.button.toggled.pressed.bg",
732 theme
->a_toggled_unfocused_pressed_max
,
735 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
736 theme
->a_toggled_unfocused_pressed_max
=
737 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
739 if (!read_appearance(db
, inst
,
740 "window.active.button.unpressed.bg",
741 theme
->a_focused_unpressed_max
,
743 set_default_appearance(theme
->a_focused_unpressed_max
);
744 if (!read_appearance(db
, inst
,
745 "window.inactive.button.unpressed.bg",
746 theme
->a_unfocused_unpressed_max
,
748 set_default_appearance(theme
->a_unfocused_unpressed_max
);
749 if (!read_appearance(db
, inst
,
750 "window.active.button.hover.bg",
751 theme
->a_hover_focused_max
,
754 RrAppearanceFree(theme
->a_hover_focused_max
);
755 theme
->a_hover_focused_max
=
756 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
758 if (!read_appearance(db
, inst
,
759 "window.inactive.button.hover.bg",
760 theme
->a_hover_unfocused_max
,
763 RrAppearanceFree(theme
->a_hover_unfocused_max
);
764 theme
->a_hover_unfocused_max
=
765 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
768 theme
->a_disabled_focused_close
=
769 RrAppearanceCopy(theme
->a_disabled_focused_max
);
770 theme
->a_disabled_unfocused_close
=
771 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
772 theme
->a_hover_focused_close
=
773 RrAppearanceCopy(theme
->a_hover_focused_max
);
774 theme
->a_hover_unfocused_close
=
775 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
776 theme
->a_unfocused_unpressed_close
=
777 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
778 theme
->a_unfocused_pressed_close
=
779 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
780 theme
->a_focused_unpressed_close
=
781 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
782 theme
->a_focused_pressed_close
=
783 RrAppearanceCopy(theme
->a_focused_pressed_max
);
784 theme
->a_disabled_focused_desk
=
785 RrAppearanceCopy(theme
->a_disabled_focused_max
);
786 theme
->a_disabled_unfocused_desk
=
787 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
788 theme
->a_hover_focused_desk
=
789 RrAppearanceCopy(theme
->a_hover_focused_max
);
790 theme
->a_hover_unfocused_desk
=
791 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
792 theme
->a_toggled_hover_focused_desk
=
793 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
794 theme
->a_toggled_hover_unfocused_desk
=
795 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
796 theme
->a_toggled_focused_unpressed_desk
=
797 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
798 theme
->a_toggled_unfocused_unpressed_desk
=
799 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
800 theme
->a_toggled_focused_pressed_desk
=
801 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
802 theme
->a_toggled_unfocused_pressed_desk
=
803 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
804 theme
->a_unfocused_unpressed_desk
=
805 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
806 theme
->a_unfocused_pressed_desk
=
807 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
808 theme
->a_focused_unpressed_desk
=
809 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
810 theme
->a_focused_pressed_desk
=
811 RrAppearanceCopy(theme
->a_focused_pressed_max
);
812 theme
->a_disabled_focused_shade
=
813 RrAppearanceCopy(theme
->a_disabled_focused_max
);
814 theme
->a_disabled_unfocused_shade
=
815 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
816 theme
->a_hover_focused_shade
=
817 RrAppearanceCopy(theme
->a_hover_focused_max
);
818 theme
->a_hover_unfocused_shade
=
819 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
820 theme
->a_toggled_hover_focused_shade
=
821 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
822 theme
->a_toggled_hover_unfocused_shade
=
823 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
824 theme
->a_toggled_focused_unpressed_shade
=
825 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
826 theme
->a_toggled_unfocused_unpressed_shade
=
827 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
828 theme
->a_toggled_focused_pressed_shade
=
829 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
830 theme
->a_toggled_unfocused_pressed_shade
=
831 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
832 theme
->a_unfocused_unpressed_shade
=
833 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
834 theme
->a_unfocused_pressed_shade
=
835 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
836 theme
->a_focused_unpressed_shade
=
837 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
838 theme
->a_focused_pressed_shade
=
839 RrAppearanceCopy(theme
->a_focused_pressed_max
);
840 theme
->a_disabled_focused_iconify
=
841 RrAppearanceCopy(theme
->a_disabled_focused_max
);
842 theme
->a_disabled_unfocused_iconify
=
843 RrAppearanceCopy(theme
->a_disabled_focused_max
);
844 theme
->a_hover_focused_iconify
=
845 RrAppearanceCopy(theme
->a_hover_focused_max
);
846 theme
->a_hover_unfocused_iconify
=
847 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
848 theme
->a_unfocused_unpressed_iconify
=
849 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
850 theme
->a_unfocused_pressed_iconify
=
851 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
852 theme
->a_focused_unpressed_iconify
=
853 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
854 theme
->a_focused_pressed_iconify
=
855 RrAppearanceCopy(theme
->a_focused_pressed_max
);
857 theme
->a_icon
->surface
.grad
=
858 theme
->a_clear
->surface
.grad
=
859 theme
->a_clear_tex
->surface
.grad
=
860 theme
->a_menu_text_title
->surface
.grad
=
861 theme
->a_menu_normal
->surface
.grad
=
862 theme
->a_menu_disabled
->surface
.grad
=
863 theme
->a_menu_text_normal
->surface
.grad
=
864 theme
->a_menu_text_selected
->surface
.grad
=
865 theme
->a_menu_text_disabled
->surface
.grad
=
866 theme
->a_menu_text_disabled_selected
->surface
.grad
=
867 theme
->a_menu_bullet_normal
->surface
.grad
=
868 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
870 /* set up the textures */
871 theme
->a_focused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
872 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
873 theme
->a_focused_label
->texture
[0].data
.text
.font
=theme
->win_font_focused
;
874 theme
->a_focused_label
->texture
[0].data
.text
.color
=
875 theme
->title_focused_color
;
877 if (read_string(db
, "window.active.label.text.font", &str
)) {
881 if (strstr(str
, "shadow=y")) {
882 if ((p
= strstr(str
, "shadowoffset=")))
883 i
= parse_inline_number(p
+ strlen("shadowoffset="));
886 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
887 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
889 if ((p
= strstr(str
, "shadowtint=")))
891 i
= parse_inline_number(p
+ strlen("shadowtint="));
892 j
= (i
> 0 ? 0 : 255);
895 theme
->title_focused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
896 theme
->title_focused_shadow_alpha
= i
;
898 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
899 theme
->title_focused_shadow_alpha
= 50;
903 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
904 theme
->title_focused_shadow_color
;
905 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
906 theme
->title_focused_shadow_alpha
;
908 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
909 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
910 theme
->osd_hilite_label
->texture
[0].data
.text
.font
= theme
->osd_font
;
911 theme
->osd_hilite_label
->texture
[0].data
.text
.color
= theme
->osd_color
;
913 if (read_string(db
, "osd.label.text.font", &str
)) {
917 if (strstr(str
, "shadow=y")) {
918 if ((p
= strstr(str
, "shadowoffset=")))
919 i
= parse_inline_number(p
+ strlen("shadowoffset="));
922 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
923 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
924 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
925 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
927 if ((p
= strstr(str
, "shadowtint=")))
929 i
= parse_inline_number(p
+ strlen("shadowtint="));
930 j
= (i
> 0 ? 0 : 255);
933 theme
->osd_shadow_color
= RrColorNew(inst
, j
, j
, j
);
934 theme
->osd_shadow_alpha
= i
;
936 theme
->osd_shadow_color
= RrColorNew(inst
, 0, 0, 0);
937 theme
->osd_shadow_alpha
= 50;
940 /* inherit the font settings from the focused label */
941 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
942 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
943 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
944 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
945 if (theme
->title_focused_shadow_color
)
946 theme
->osd_shadow_color
=
948 theme
->title_focused_shadow_color
->r
,
949 theme
->title_focused_shadow_color
->g
,
950 theme
->title_focused_shadow_color
->b
);
952 theme
->osd_shadow_color
= RrColorNew(inst
, 0, 0, 0);
953 theme
->osd_shadow_alpha
= theme
->title_focused_shadow_alpha
;
956 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
957 theme
->osd_shadow_color
;
958 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
959 theme
->osd_shadow_alpha
;
961 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
962 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
963 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
964 theme
->win_font_unfocused
;
965 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
966 theme
->title_unfocused_color
;
968 if (read_string(db
, "window.inactive.label.text.font", &str
)) {
972 if (strstr(str
, "shadow=y")) {
973 if ((p
= strstr(str
, "shadowoffset=")))
974 i
= parse_inline_number(p
+ strlen("shadowoffset="));
977 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
978 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
980 if ((p
= strstr(str
, "shadowtint=")))
982 i
= parse_inline_number(p
+ strlen("shadowtint="));
983 j
= (i
> 0 ? 0 : 255);
986 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
987 theme
->title_unfocused_shadow_alpha
= i
;
989 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
990 theme
->title_unfocused_shadow_alpha
= 50;
994 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
995 theme
->title_unfocused_shadow_color
;
996 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
997 theme
->title_unfocused_shadow_alpha
;
999 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
1000 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
1001 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
1002 theme
->menu_title_font
;
1003 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
1004 theme
->menu_title_color
;
1006 if (read_string(db
, "menu.title.text.font", &str
)) {
1010 if (strstr(str
, "shadow=y")) {
1011 if ((p
= strstr(str
, "shadowoffset=")))
1012 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1015 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
= i
;
1016 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= i
;
1018 if ((p
= strstr(str
, "shadowtint=")))
1020 i
= parse_inline_number(p
+ strlen("shadowtint="));
1021 j
= (i
> 0 ? 0 : 255);
1024 theme
->menu_title_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1025 theme
->menu_title_shadow_alpha
= i
;
1027 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1028 theme
->menu_title_shadow_alpha
= 50;
1032 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
1033 theme
->menu_title_shadow_color
;
1034 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
1035 theme
->menu_title_shadow_alpha
;
1037 theme
->a_menu_text_normal
->texture
[0].type
=
1038 theme
->a_menu_text_selected
->texture
[0].type
=
1039 theme
->a_menu_text_disabled
->texture
[0].type
=
1040 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
1042 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
1043 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
1044 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
1045 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
1047 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
1048 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
1049 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
1050 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
1052 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
1053 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
1054 theme
->menu_selected_color
;
1055 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
1056 theme
->menu_disabled_color
;
1057 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
1058 theme
->menu_disabled_selected_color
;
1060 if (read_string(db
, "menu.items.font", &str
)) {
1064 if (strstr(str
, "shadow=y")) {
1065 if ((p
= strstr(str
, "shadowoffset=")))
1066 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1069 theme
->a_menu_text_normal
->
1070 texture
[0].data
.text
.shadow_offset_x
= i
;
1071 theme
->a_menu_text_normal
->
1072 texture
[0].data
.text
.shadow_offset_y
= i
;
1073 theme
->a_menu_text_selected
->
1074 texture
[0].data
.text
.shadow_offset_x
= i
;
1075 theme
->a_menu_text_selected
->
1076 texture
[0].data
.text
.shadow_offset_y
= i
;
1077 theme
->a_menu_text_disabled
->
1078 texture
[0].data
.text
.shadow_offset_x
= i
;
1079 theme
->a_menu_text_disabled
->
1080 texture
[0].data
.text
.shadow_offset_y
= i
;
1081 theme
->a_menu_text_disabled_selected
->
1082 texture
[0].data
.text
.shadow_offset_x
= i
;
1083 theme
->a_menu_text_disabled_selected
->
1084 texture
[0].data
.text
.shadow_offset_y
= i
;
1086 if ((p
= strstr(str
, "shadowtint=")))
1088 i
= parse_inline_number(p
+ strlen("shadowtint="));
1089 j
= (i
> 0 ? 0 : 255);
1092 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1093 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1094 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1095 theme
->menu_text_normal_shadow_alpha
= i
;
1096 theme
->menu_text_selected_shadow_alpha
= i
;
1097 theme
->menu_text_disabled_shadow_alpha
= i
;
1098 theme
->menu_text_disabled_selected_shadow_alpha
= i
;
1100 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1101 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1102 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1103 theme
->menu_text_normal_shadow_alpha
= 50;
1104 theme
->menu_text_selected_shadow_alpha
= 50;
1105 theme
->menu_text_disabled_selected_shadow_alpha
= 50;
1109 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
1110 theme
->menu_text_normal_shadow_color
;
1111 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
1112 theme
->menu_text_normal_shadow_alpha
;
1113 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
1114 theme
->menu_text_selected_shadow_color
;
1115 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
1116 theme
->menu_text_selected_shadow_alpha
;
1117 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
1118 theme
->menu_text_disabled_shadow_color
;
1119 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
1120 theme
->menu_text_disabled_shadow_alpha
;
1121 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
1122 theme
->menu_text_disabled_shadow_color
;
1123 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
1124 theme
->menu_text_disabled_shadow_alpha
;
1126 theme
->a_disabled_focused_max
->texture
[0].type
=
1127 theme
->a_disabled_unfocused_max
->texture
[0].type
=
1128 theme
->a_hover_focused_max
->texture
[0].type
=
1129 theme
->a_hover_unfocused_max
->texture
[0].type
=
1130 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
1131 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
1132 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
1133 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
1134 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
1135 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
1136 theme
->a_focused_unpressed_max
->texture
[0].type
=
1137 theme
->a_focused_pressed_max
->texture
[0].type
=
1138 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
1139 theme
->a_unfocused_pressed_max
->texture
[0].type
=
1140 theme
->a_disabled_focused_close
->texture
[0].type
=
1141 theme
->a_disabled_unfocused_close
->texture
[0].type
=
1142 theme
->a_hover_focused_close
->texture
[0].type
=
1143 theme
->a_hover_unfocused_close
->texture
[0].type
=
1144 theme
->a_focused_unpressed_close
->texture
[0].type
=
1145 theme
->a_focused_pressed_close
->texture
[0].type
=
1146 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
1147 theme
->a_unfocused_pressed_close
->texture
[0].type
=
1148 theme
->a_disabled_focused_desk
->texture
[0].type
=
1149 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
1150 theme
->a_hover_focused_desk
->texture
[0].type
=
1151 theme
->a_hover_unfocused_desk
->texture
[0].type
=
1152 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
1153 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
1154 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
1155 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
1156 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
1157 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
1158 theme
->a_focused_unpressed_desk
->texture
[0].type
=
1159 theme
->a_focused_pressed_desk
->texture
[0].type
=
1160 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
1161 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
1162 theme
->a_disabled_focused_shade
->texture
[0].type
=
1163 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
1164 theme
->a_hover_focused_shade
->texture
[0].type
=
1165 theme
->a_hover_unfocused_shade
->texture
[0].type
=
1166 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
1167 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
1168 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
1169 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
1170 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
1171 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
1172 theme
->a_focused_unpressed_shade
->texture
[0].type
=
1173 theme
->a_focused_pressed_shade
->texture
[0].type
=
1174 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
1175 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
1176 theme
->a_disabled_focused_iconify
->texture
[0].type
=
1177 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
1178 theme
->a_hover_focused_iconify
->texture
[0].type
=
1179 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
1180 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
1181 theme
->a_focused_pressed_iconify
->texture
[0].type
=
1182 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
1183 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
1184 theme
->a_menu_bullet_normal
->texture
[0].type
=
1185 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
1187 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
1188 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
1189 theme
->max_disabled_mask
;
1190 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
1191 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1192 theme
->max_hover_mask
;
1193 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1194 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1195 theme
->max_pressed_mask
;
1196 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1197 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1199 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
1200 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1201 theme
->max_toggled_hover_mask
;
1202 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1203 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1204 theme
->max_toggled_mask
;
1205 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1206 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1207 theme
->max_toggled_pressed_mask
;
1208 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
1209 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
1210 theme
->close_disabled_mask
;
1211 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
1212 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
1213 theme
->close_hover_mask
;
1214 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
1215 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
1216 theme
->close_pressed_mask
;
1217 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
1218 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
1220 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
1221 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
1222 theme
->desk_disabled_mask
;
1223 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1224 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1225 theme
->desk_hover_mask
;
1226 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1227 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1228 theme
->desk_pressed_mask
;
1229 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1230 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1232 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1233 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1234 theme
->desk_toggled_hover_mask
;
1235 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1236 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1237 theme
->desk_toggled_mask
;
1238 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1239 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1240 theme
->desk_toggled_pressed_mask
;
1241 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1242 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1243 theme
->shade_disabled_mask
;
1244 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1245 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1246 theme
->shade_hover_mask
;
1247 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1248 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1249 theme
->shade_pressed_mask
;
1250 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1251 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1253 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1254 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1255 theme
->shade_toggled_hover_mask
;
1256 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1257 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1258 theme
->shade_toggled_mask
;
1259 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1260 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1261 theme
->shade_toggled_pressed_mask
;
1262 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1263 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1264 theme
->iconify_disabled_mask
;
1265 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1266 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1267 theme
->iconify_hover_mask
;
1268 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1269 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1270 theme
->iconify_pressed_mask
;
1271 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1272 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1273 theme
->iconify_mask
;
1274 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1275 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1276 theme
->menu_bullet_mask
;
1277 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1278 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1279 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1280 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1281 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1282 theme
->titlebut_disabled_focused_color
;
1283 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1284 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1285 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1286 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1287 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1288 theme
->titlebut_disabled_unfocused_color
;
1289 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1290 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1291 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1292 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1293 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1294 theme
->titlebut_hover_focused_color
;
1295 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1296 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1297 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1298 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1299 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1300 theme
->titlebut_hover_unfocused_color
;
1301 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1302 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1303 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1304 theme
->titlebut_toggled_hover_focused_color
;
1305 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1306 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1307 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1308 theme
->titlebut_toggled_hover_unfocused_color
;
1309 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1310 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1311 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1312 theme
->titlebut_toggled_focused_unpressed_color
;
1313 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1314 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1315 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1316 theme
->titlebut_toggled_unfocused_unpressed_color
;
1317 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1318 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1319 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1320 theme
->titlebut_toggled_focused_pressed_color
;
1321 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1322 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1323 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1324 theme
->titlebut_toggled_unfocused_pressed_color
;
1325 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1326 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1327 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1328 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1329 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1330 theme
->titlebut_focused_unpressed_color
;
1331 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1332 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1333 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1334 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1335 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1336 theme
->titlebut_focused_pressed_color
;
1337 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1338 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1339 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1340 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1341 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1342 theme
->titlebut_unfocused_unpressed_color
;
1343 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1344 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1345 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1346 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1347 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1348 theme
->titlebut_unfocused_pressed_color
;
1349 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1351 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1352 theme
->menu_selected_color
;
1355 XrmDestroyDatabase(db
);
1357 /* set the font heights */
1358 theme
->win_font_height
= RrFontHeight
1359 (theme
->win_font_focused
,
1360 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
);
1361 theme
->win_font_height
=
1362 MAX(theme
->win_font_height
,
1364 (theme
->win_font_focused
,
1365 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
));
1366 theme
->menu_title_font_height
= RrFontHeight
1367 (theme
->menu_title_font
,
1368 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
);
1369 theme
->menu_font_height
= RrFontHeight
1371 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
);
1373 /* calculate some last extents */
1375 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1377 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1378 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1379 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1380 theme
->label_height
+= theme
->label_height
% 2;
1382 /* this would be nice I think, since padding.width can now be 0,
1383 but it breaks frame.c horribly and I don't feel like fixing that
1384 right now, so if anyone complains, here is how to keep text from
1385 going over the title's bevel/border with a padding.width of 0 and a
1386 bevelless/borderless label
1387 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1388 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1389 theme->title_height = theme->label_height +
1390 MAX(MAX(theme->padding * 2, ft + fb),
1391 MAX(theme->padding * 2, ut + ub));
1393 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1395 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1396 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1397 theme
->menu_title_height
= theme
->menu_title_label_height
+
1398 theme
->paddingy
* 2;
1400 theme
->button_size
= theme
->label_height
- 2;
1401 theme
->grip_width
= 25;
1406 void RrThemeFree(RrTheme
*theme
)
1409 g_free(theme
->name
);
1411 RrColorFree(theme
->menu_border_color
);
1412 RrColorFree(theme
->osd_border_color
);
1413 RrColorFree(theme
->frame_focused_border_color
);
1414 RrColorFree(theme
->frame_unfocused_border_color
);
1415 RrColorFree(theme
->title_separator_focused_color
);
1416 RrColorFree(theme
->title_separator_unfocused_color
);
1417 RrColorFree(theme
->cb_unfocused_color
);
1418 RrColorFree(theme
->cb_focused_color
);
1419 RrColorFree(theme
->title_focused_color
);
1420 RrColorFree(theme
->title_unfocused_color
);
1421 RrColorFree(theme
->titlebut_disabled_focused_color
);
1422 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1423 RrColorFree(theme
->titlebut_hover_focused_color
);
1424 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1425 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1426 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1427 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1428 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1429 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1430 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1431 RrColorFree(theme
->titlebut_focused_pressed_color
);
1432 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1433 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1434 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1435 RrColorFree(theme
->menu_title_color
);
1436 RrColorFree(theme
->menu_sep_color
);
1437 RrColorFree(theme
->menu_color
);
1438 RrColorFree(theme
->menu_selected_color
);
1439 RrColorFree(theme
->menu_disabled_color
);
1440 RrColorFree(theme
->menu_disabled_selected_color
);
1441 RrColorFree(theme
->title_focused_shadow_color
);
1442 RrColorFree(theme
->title_unfocused_shadow_color
);
1443 RrColorFree(theme
->osd_color
);
1444 RrColorFree(theme
->osd_shadow_color
);
1445 RrColorFree(theme
->menu_title_shadow_color
);
1446 RrColorFree(theme
->menu_text_normal_shadow_color
);
1447 RrColorFree(theme
->menu_text_selected_shadow_color
);
1448 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1449 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1451 g_free(theme
->def_win_icon
);
1453 RrPixmapMaskFree(theme
->max_mask
);
1454 RrPixmapMaskFree(theme
->max_toggled_mask
);
1455 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1456 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1457 RrPixmapMaskFree(theme
->max_disabled_mask
);
1458 RrPixmapMaskFree(theme
->max_hover_mask
);
1459 RrPixmapMaskFree(theme
->max_pressed_mask
);
1460 RrPixmapMaskFree(theme
->desk_mask
);
1461 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1462 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1463 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1464 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1465 RrPixmapMaskFree(theme
->desk_hover_mask
);
1466 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1467 RrPixmapMaskFree(theme
->shade_mask
);
1468 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1469 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1470 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1471 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1472 RrPixmapMaskFree(theme
->shade_hover_mask
);
1473 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1474 RrPixmapMaskFree(theme
->iconify_mask
);
1475 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1476 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1477 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1478 RrPixmapMaskFree(theme
->close_mask
);
1479 RrPixmapMaskFree(theme
->close_disabled_mask
);
1480 RrPixmapMaskFree(theme
->close_hover_mask
);
1481 RrPixmapMaskFree(theme
->close_pressed_mask
);
1482 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1483 RrPixmapMaskFree(theme
->down_arrow_mask
);
1484 RrPixmapMaskFree(theme
->up_arrow_mask
);
1486 RrFontClose(theme
->win_font_focused
);
1487 RrFontClose(theme
->win_font_unfocused
);
1488 RrFontClose(theme
->menu_title_font
);
1489 RrFontClose(theme
->menu_font
);
1490 RrFontClose(theme
->osd_font
);
1492 RrAppearanceFree(theme
->a_disabled_focused_max
);
1493 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1494 RrAppearanceFree(theme
->a_hover_focused_max
);
1495 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1496 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1497 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1498 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1499 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1500 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1501 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1502 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1503 RrAppearanceFree(theme
->a_focused_pressed_max
);
1504 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1505 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1506 RrAppearanceFree(theme
->a_disabled_focused_close
);
1507 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1508 RrAppearanceFree(theme
->a_hover_focused_close
);
1509 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1510 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1511 RrAppearanceFree(theme
->a_focused_pressed_close
);
1512 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1513 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1514 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1515 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1516 RrAppearanceFree(theme
->a_hover_focused_desk
);
1517 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1518 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1519 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1520 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1521 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1522 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1523 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1524 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1525 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1526 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1527 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1528 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1529 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1530 RrAppearanceFree(theme
->a_hover_focused_shade
);
1531 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1532 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1533 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1534 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1535 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1536 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1537 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1538 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1539 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1540 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1541 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1542 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1543 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1544 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1545 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1546 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1547 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1548 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1549 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1550 RrAppearanceFree(theme
->a_focused_grip
);
1551 RrAppearanceFree(theme
->a_unfocused_grip
);
1552 RrAppearanceFree(theme
->a_focused_title
);
1553 RrAppearanceFree(theme
->a_unfocused_title
);
1554 RrAppearanceFree(theme
->a_focused_label
);
1555 RrAppearanceFree(theme
->a_unfocused_label
);
1556 RrAppearanceFree(theme
->a_icon
);
1557 RrAppearanceFree(theme
->a_focused_handle
);
1558 RrAppearanceFree(theme
->a_unfocused_handle
);
1559 RrAppearanceFree(theme
->a_menu
);
1560 RrAppearanceFree(theme
->a_menu_title
);
1561 RrAppearanceFree(theme
->a_menu_text_title
);
1562 RrAppearanceFree(theme
->a_menu_normal
);
1563 RrAppearanceFree(theme
->a_menu_selected
);
1564 RrAppearanceFree(theme
->a_menu_disabled
);
1565 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1566 RrAppearanceFree(theme
->a_menu_text_normal
);
1567 RrAppearanceFree(theme
->a_menu_text_selected
);
1568 RrAppearanceFree(theme
->a_menu_text_disabled
);
1569 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1570 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1571 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1572 RrAppearanceFree(theme
->a_clear
);
1573 RrAppearanceFree(theme
->a_clear_tex
);
1574 RrAppearanceFree(theme
->osd_hilite_bg
);
1575 RrAppearanceFree(theme
->osd_hilite_fg
);
1576 RrAppearanceFree(theme
->osd_hilite_label
);
1577 RrAppearanceFree(theme
->osd_unhilite_fg
);
1583 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
)
1586 XrmDatabase db
= NULL
;
1589 if (name
[0] == '/') {
1590 s
= g_build_filename(name
, "openbox-3", "themerc", NULL
);
1591 if ((db
= XrmGetFileDatabase(s
)))
1592 *path
= g_path_get_dirname(s
);
1597 p
= obt_paths_new();
1599 /* XXX backwards compatibility, remove me sometime later */
1600 s
= g_build_filename(g_get_home_dir(), ".themes", name
,
1601 "openbox-3", "themerc", NULL
);
1602 if ((db
= XrmGetFileDatabase(s
)))
1603 *path
= g_path_get_dirname(s
);
1606 for (it
= obt_paths_data_dirs(p
); !db
&& it
; it
= g_slist_next(it
))
1608 s
= g_build_filename(it
->data
, "themes", name
,
1609 "openbox-3", "themerc", NULL
);
1610 if ((db
= XrmGetFileDatabase(s
)))
1611 *path
= g_path_get_dirname(s
);
1619 s
= g_build_filename(name
, "themerc", NULL
);
1620 if ((db
= XrmGetFileDatabase(s
)))
1621 *path
= g_path_get_dirname(s
);
1628 static gchar
*create_class_name(const gchar
*rname
)
1630 gchar
*rclass
= g_strdup(rname
);
1635 p
= strchr(p
+1, '.');
1636 if (p
== NULL
) break;
1638 if (*p
== '\0') break;
1643 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
)
1645 gboolean ret
= FALSE
;
1646 gchar
*rclass
= create_class_name(rname
);
1647 gchar
*rettype
, *end
;
1650 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1651 retvalue
.addr
!= NULL
) {
1652 *value
= (gint
)strtol(retvalue
.addr
, &end
, 10);
1653 if (end
!= retvalue
.addr
)
1661 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
)
1663 gboolean ret
= FALSE
;
1664 gchar
*rclass
= create_class_name(rname
);
1668 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1669 retvalue
.addr
!= NULL
) {
1670 *value
= retvalue
.addr
;
1678 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
1679 const gchar
*rname
, RrColor
**value
)
1681 gboolean ret
= FALSE
;
1682 gchar
*rclass
= create_class_name(rname
);
1686 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1687 retvalue
.addr
!= NULL
) {
1688 RrColor
*c
= RrColorParse(inst
, retvalue
.addr
);
1699 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
1700 RrTheme
*theme
, const gchar
*maskname
,
1701 RrPixmapMask
**value
)
1703 gboolean ret
= FALSE
;
1705 gint hx
, hy
; /* ignored */
1709 s
= g_build_filename(path
, maskname
, NULL
);
1710 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1712 *value
= RrPixmapMaskNew(inst
, w
, h
, (gchar
*)b
);
1720 static void parse_appearance(gchar
*tex
, RrSurfaceColorType
*grad
,
1721 RrReliefType
*relief
, RrBevelType
*bevel
,
1722 gboolean
*interlaced
, gboolean
*border
,
1723 gboolean allow_trans
)
1727 /* convert to all lowercase */
1728 for (t
= tex
; *t
!= '\0'; ++t
)
1729 *t
= g_ascii_tolower(*t
);
1731 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1732 *grad
= RR_SURFACE_PARENTREL
;
1734 if (strstr(tex
, "gradient") != NULL
) {
1735 if (strstr(tex
, "crossdiagonal") != NULL
)
1736 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1737 else if (strstr(tex
, "pyramid") != NULL
)
1738 *grad
= RR_SURFACE_PYRAMID
;
1739 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1740 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1741 else if (strstr(tex
, "horizontal") != NULL
)
1742 *grad
= RR_SURFACE_HORIZONTAL
;
1743 else if (strstr(tex
, "splitvertical") != NULL
)
1744 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1745 else if (strstr(tex
, "vertical") != NULL
)
1746 *grad
= RR_SURFACE_VERTICAL
;
1748 *grad
= RR_SURFACE_DIAGONAL
;
1750 *grad
= RR_SURFACE_SOLID
;
1754 if (strstr(tex
, "sunken") != NULL
)
1755 *relief
= RR_RELIEF_SUNKEN
;
1756 else if (strstr(tex
, "flat") != NULL
)
1757 *relief
= RR_RELIEF_FLAT
;
1758 else if (strstr(tex
, "raised") != NULL
)
1759 *relief
= RR_RELIEF_RAISED
;
1761 *relief
= (*grad
== RR_SURFACE_PARENTREL
) ?
1762 RR_RELIEF_FLAT
: RR_RELIEF_RAISED
;
1765 if (*relief
== RR_RELIEF_FLAT
) {
1766 if (strstr(tex
, "border") != NULL
)
1769 if (strstr(tex
, "bevel2") != NULL
)
1770 *bevel
= RR_BEVEL_2
;
1772 *bevel
= RR_BEVEL_1
;
1775 if (strstr(tex
, "interlaced") != NULL
)
1778 *interlaced
= FALSE
;
1781 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
1782 const gchar
*rname
, RrAppearance
*value
,
1783 gboolean allow_trans
)
1785 gboolean ret
= FALSE
;
1786 gchar
*rclass
= create_class_name(rname
);
1787 gchar
*cname
, *ctoname
, *bcname
, *icname
, *hname
, *sname
;
1788 gchar
*csplitname
, *ctosplitname
;
1793 cname
= g_strconcat(rname
, ".color", NULL
);
1794 ctoname
= g_strconcat(rname
, ".colorTo", NULL
);
1795 bcname
= g_strconcat(rname
, ".border.color", NULL
);
1796 icname
= g_strconcat(rname
, ".interlace.color", NULL
);
1797 hname
= g_strconcat(rname
, ".highlight", NULL
);
1798 sname
= g_strconcat(rname
, ".shadow", NULL
);
1799 csplitname
= g_strconcat(rname
, ".color.splitTo", NULL
);
1800 ctosplitname
= g_strconcat(rname
, ".colorTo.splitTo", NULL
);
1802 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1803 retvalue
.addr
!= NULL
) {
1804 parse_appearance(retvalue
.addr
,
1805 &value
->surface
.grad
,
1806 &value
->surface
.relief
,
1807 &value
->surface
.bevel
,
1808 &value
->surface
.interlaced
,
1809 &value
->surface
.border
,
1811 if (!read_color(db
, inst
, cname
, &value
->surface
.primary
))
1812 value
->surface
.primary
= RrColorNew(inst
, 0, 0, 0);
1813 if (!read_color(db
, inst
, ctoname
, &value
->surface
.secondary
))
1814 value
->surface
.secondary
= RrColorNew(inst
, 0, 0, 0);
1815 if (value
->surface
.border
)
1816 if (!read_color(db
, inst
, bcname
,
1817 &value
->surface
.border_color
))
1818 value
->surface
.border_color
= RrColorNew(inst
, 0, 0, 0);
1819 if (value
->surface
.interlaced
)
1820 if (!read_color(db
, inst
, icname
,
1821 &value
->surface
.interlace_color
))
1822 value
->surface
.interlace_color
= RrColorNew(inst
, 0, 0, 0);
1823 if (read_int(db
, hname
, &i
) && i
>= 0)
1824 value
->surface
.bevel_light_adjust
= i
;
1825 if (read_int(db
, sname
, &i
) && i
>= 0 && i
<= 256)
1826 value
->surface
.bevel_dark_adjust
= i
;
1828 if (value
->surface
.grad
== RR_SURFACE_SPLIT_VERTICAL
) {
1831 if (!read_color(db
, inst
, csplitname
,
1832 &value
->surface
.split_primary
))
1834 r
= value
->surface
.primary
->r
;
1836 g
= value
->surface
.primary
->g
;
1838 b
= value
->surface
.primary
->b
;
1840 if (r
> 0xFF) r
= 0xFF;
1841 if (g
> 0xFF) g
= 0xFF;
1842 if (b
> 0xFF) b
= 0xFF;
1843 value
->surface
.split_primary
= RrColorNew(inst
, r
, g
, b
);
1846 if (!read_color(db
, inst
, ctosplitname
,
1847 &value
->surface
.split_secondary
))
1849 r
= value
->surface
.secondary
->r
;
1851 g
= value
->surface
.secondary
->g
;
1853 b
= value
->surface
.secondary
->b
;
1855 if (r
> 0xFF) r
= 0xFF;
1856 if (g
> 0xFF) g
= 0xFF;
1857 if (b
> 0xFF) b
= 0xFF;
1858 value
->surface
.split_secondary
= RrColorNew(inst
, r
, g
, b
);
1865 g_free(ctosplitname
);
1877 static int parse_inline_number(const char *p
)
1885 for (; isdigit(*p
); ++p
)
1886 res
= res
* 10 + *p
- '0';
1891 static void set_default_appearance(RrAppearance
*a
)
1893 a
->surface
.grad
= RR_SURFACE_SOLID
;
1894 a
->surface
.relief
= RR_RELIEF_FLAT
;
1895 a
->surface
.bevel
= RR_BEVEL_1
;
1896 a
->surface
.interlaced
= FALSE
;
1897 a
->surface
.border
= FALSE
;
1898 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1899 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1902 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1903 an RrTextureRGBA. */
1904 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1909 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1911 for (i
= 0; i
< width
* height
; ++i
) {
1912 guchar a
= ((*p
>> 24) & 0xff);
1913 guchar b
= ((*p
>> 16) & 0xff);
1914 guchar g
= ((*p
>> 8) & 0xff);
1915 guchar r
= ((*p
>> 0) & 0xff);
1917 *p
= ((r
<< RrDefaultRedOffset
) +
1918 (g
<< RrDefaultGreenOffset
) +
1919 (b
<< RrDefaultBlueOffset
) +
1920 (a
<< RrDefaultAlphaOffset
));