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_bg
= RrAppearanceNew(inst
, 0);
146 theme
->osd_hilite_label
= RrAppearanceNew(inst
, 1);
147 theme
->osd_hilite_bg
= RrAppearanceNew(inst
, 0);
148 theme
->osd_unhilite_label
= RrAppearanceNew(inst
, 1);
149 theme
->osd_unhilite_bg
= RrAppearanceNew(inst
, 0);
151 /* load the font stuff */
152 theme
->win_font_focused
= get_font(active_window_font
,
153 &default_font
, inst
);
154 theme
->win_font_unfocused
= get_font(inactive_window_font
,
155 &default_font
, inst
);
157 winjust
= RR_JUSTIFY_LEFT
;
158 if (read_string(db
, "window.label.text.justify", &str
)) {
159 if (!g_ascii_strcasecmp(str
, "right"))
160 winjust
= RR_JUSTIFY_RIGHT
;
161 else if (!g_ascii_strcasecmp(str
, "center"))
162 winjust
= RR_JUSTIFY_CENTER
;
165 theme
->menu_title_font
= get_font(menu_title_font
, &default_font
, inst
);
167 mtitlejust
= RR_JUSTIFY_LEFT
;
168 if (read_string(db
, "menu.title.text.justify", &str
)) {
169 if (!g_ascii_strcasecmp(str
, "right"))
170 mtitlejust
= RR_JUSTIFY_RIGHT
;
171 else if (!g_ascii_strcasecmp(str
, "center"))
172 mtitlejust
= RR_JUSTIFY_CENTER
;
175 theme
->menu_font
= get_font(menu_item_font
, &default_font
, inst
);
177 theme
->osd_font
= get_font(osd_font
, &default_font
, inst
);
179 /* load direct dimensions */
180 if ((!read_int(db
, "menu.overlap.x", &theme
->menu_overlap_x
) &&
181 !read_int(db
, "menu.overlap", &theme
->menu_overlap_x
)) ||
182 theme
->menu_overlap_x
< -100 || theme
->menu_overlap_x
> 100)
183 theme
->menu_overlap_x
= 0;
184 if ((!read_int(db
, "menu.overlap.y", &theme
->menu_overlap_y
) &&
185 !read_int(db
, "menu.overlap", &theme
->menu_overlap_y
)) ||
186 theme
->menu_overlap_y
< -100 || theme
->menu_overlap_y
> 100)
187 theme
->menu_overlap_y
= 0;
188 if (!read_int(db
, "window.handle.width", &theme
->handle_height
) ||
189 theme
->handle_height
< 0 || theme
->handle_height
> 100)
190 theme
->handle_height
= 6;
191 if (!read_int(db
, "padding.width", &theme
->paddingx
) ||
192 theme
->paddingx
< 0 || theme
->paddingx
> 100)
194 if (!read_int(db
, "padding.height", &theme
->paddingy
) ||
195 theme
->paddingy
< 0 || theme
->paddingy
> 100)
196 theme
->paddingy
= theme
->paddingx
;
197 if (!read_int(db
, "border.width", &theme
->fbwidth
) ||
198 theme
->fbwidth
< 0 || theme
->fbwidth
> 100)
200 /* menu border width inherits from the frame border width */
201 if (!read_int(db
, "menu.border.width", &theme
->mbwidth
) ||
202 theme
->mbwidth
< 0 || theme
->mbwidth
> 100)
203 theme
->mbwidth
= theme
->fbwidth
;
204 /* osd border width inherits from the frame border width */
205 if (!read_int(db
, "osd.border.width", &theme
->obwidth
) ||
206 theme
->obwidth
< 0 || theme
->obwidth
> 100)
207 theme
->obwidth
= theme
->fbwidth
;
208 if (!read_int(db
, "window.client.padding.width", &theme
->cbwidthx
) ||
209 theme
->cbwidthx
< 0 || theme
->cbwidthx
> 100)
210 theme
->cbwidthx
= theme
->paddingx
;
211 if (!read_int(db
, "window.client.padding.height", &theme
->cbwidthy
) ||
212 theme
->cbwidthy
< 0 || theme
->cbwidthy
> 100)
213 theme
->cbwidthy
= theme
->cbwidthx
;
214 if (!read_int(db
, "menu.separator.width", &theme
->menu_sep_width
) ||
215 theme
->menu_sep_width
< 1 || theme
->menu_sep_width
> 100)
216 theme
->menu_sep_width
= 1;
217 if (!read_int(db
, "menu.separator.padding.width",
218 &theme
->menu_sep_paddingx
) ||
219 theme
->menu_sep_paddingx
< 0 || theme
->menu_sep_paddingx
> 100)
220 theme
->menu_sep_paddingx
= 6;
221 if (!read_int(db
, "menu.separator.padding.height",
222 &theme
->menu_sep_paddingy
) ||
223 theme
->menu_sep_paddingy
< 0 || theme
->menu_sep_paddingy
> 100)
224 theme
->menu_sep_paddingy
= 3;
227 if (!read_color(db
, inst
,
228 "window.active.border.color",
229 &theme
->frame_focused_border_color
) &&
230 !read_color(db
, inst
,
232 &theme
->frame_focused_border_color
))
233 theme
->frame_focused_border_color
= RrColorNew(inst
, 0, 0, 0);
234 /* title separator focused color inherits from focused border color */
235 if (!read_color(db
, inst
,
236 "window.active.title.separator.color",
237 &theme
->title_separator_focused_color
))
238 theme
->title_separator_focused_color
=
240 theme
->frame_focused_border_color
->r
,
241 theme
->frame_focused_border_color
->g
,
242 theme
->frame_focused_border_color
->b
);
243 /* unfocused border color inherits from frame focused border color */
244 if (!read_color(db
, inst
,
245 "window.inactive.border.color",
246 &theme
->frame_unfocused_border_color
))
247 theme
->frame_unfocused_border_color
=
248 RrColorNew(inst
, theme
->frame_focused_border_color
->r
,
249 theme
->frame_focused_border_color
->g
,
250 theme
->frame_focused_border_color
->b
);
251 /* title separator unfocused color inherits from unfocused border color */
252 if (!read_color(db
, inst
,
253 "window.inactive.title.separator.color",
254 &theme
->title_separator_unfocused_color
))
255 theme
->title_separator_unfocused_color
=
257 theme
->frame_unfocused_border_color
->r
,
258 theme
->frame_unfocused_border_color
->g
,
259 theme
->frame_unfocused_border_color
->b
);
261 /* menu border color inherits from frame focused border color */
262 if (!read_color(db
, inst
, "menu.border.color", &theme
->menu_border_color
))
263 theme
->menu_border_color
=
265 theme
->frame_focused_border_color
->r
,
266 theme
->frame_focused_border_color
->g
,
267 theme
->frame_focused_border_color
->b
);
268 /* osd border color inherits from frame focused border color */
269 if (!read_color(db
, inst
, "osd.border.color", &theme
->osd_border_color
))
270 theme
->osd_border_color
=
272 theme
->frame_focused_border_color
->r
,
273 theme
->frame_focused_border_color
->g
,
274 theme
->frame_focused_border_color
->b
);
275 if (!read_color(db
, inst
,
276 "window.active.client.color",
277 &theme
->cb_focused_color
))
278 theme
->cb_focused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
279 if (!read_color(db
, inst
,
280 "window.inactive.client.color",
281 &theme
->cb_unfocused_color
))
282 theme
->cb_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
283 if (!read_color(db
, inst
,
284 "window.active.label.text.color",
285 &theme
->title_focused_color
))
286 theme
->title_focused_color
= RrColorNew(inst
, 0x0, 0x0, 0x0);
287 if (!read_color(db
, inst
, "osd.active.label.text.color",
288 &theme
->osd_text_active_color
) &&
289 !read_color(db
, inst
, "osd.label.text.color",
290 &theme
->osd_text_active_color
))
291 theme
->osd_text_active_color
=
293 theme
->title_focused_color
->r
,
294 theme
->title_focused_color
->g
,
295 theme
->title_focused_color
->b
);
296 if (!read_color(db
, inst
,
297 "window.inactive.label.text.color",
298 &theme
->title_unfocused_color
))
299 theme
->title_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
300 if (!read_color(db
, inst
, "osd.inactive.label.text.color",
301 &theme
->osd_text_inactive_color
))
302 theme
->osd_text_inactive_color
=
304 theme
->title_unfocused_color
->r
,
305 theme
->title_unfocused_color
->g
,
306 theme
->title_unfocused_color
->b
);
307 if (!read_color(db
, inst
,
308 "window.active.button.unpressed.image.color",
309 &theme
->titlebut_focused_unpressed_color
))
310 theme
->titlebut_focused_unpressed_color
= RrColorNew(inst
, 0, 0, 0);
311 if (!read_color(db
, inst
,
312 "window.inactive.button.unpressed.image.color",
313 &theme
->titlebut_unfocused_unpressed_color
))
314 theme
->titlebut_unfocused_unpressed_color
=
315 RrColorNew(inst
, 0xff, 0xff, 0xff);
316 if (!read_color(db
, inst
,
317 "window.active.button.pressed.image.color",
318 &theme
->titlebut_focused_pressed_color
))
319 theme
->titlebut_focused_pressed_color
=
321 theme
->titlebut_focused_unpressed_color
->r
,
322 theme
->titlebut_focused_unpressed_color
->g
,
323 theme
->titlebut_focused_unpressed_color
->b
);
324 if (!read_color(db
, inst
,
325 "window.inactive.button.pressed.image.color",
326 &theme
->titlebut_unfocused_pressed_color
))
327 theme
->titlebut_unfocused_pressed_color
=
329 theme
->titlebut_unfocused_unpressed_color
->r
,
330 theme
->titlebut_unfocused_unpressed_color
->g
,
331 theme
->titlebut_unfocused_unpressed_color
->b
);
332 if (!read_color(db
, inst
,
333 "window.active.button.disabled.image.color",
334 &theme
->titlebut_disabled_focused_color
))
335 theme
->titlebut_disabled_focused_color
=
336 RrColorNew(inst
, 0xff, 0xff, 0xff);
337 if (!read_color(db
, inst
,
338 "window.inactive.button.disabled.image.color",
339 &theme
->titlebut_disabled_unfocused_color
))
340 theme
->titlebut_disabled_unfocused_color
= RrColorNew(inst
, 0, 0, 0);
341 if (!read_color(db
, inst
,
342 "window.active.button.hover.image.color",
343 &theme
->titlebut_hover_focused_color
))
344 theme
->titlebut_hover_focused_color
=
346 theme
->titlebut_focused_unpressed_color
->r
,
347 theme
->titlebut_focused_unpressed_color
->g
,
348 theme
->titlebut_focused_unpressed_color
->b
);
349 if (!read_color(db
, inst
,
350 "window.inactive.button.hover.image.color",
351 &theme
->titlebut_hover_unfocused_color
))
352 theme
->titlebut_hover_unfocused_color
=
354 theme
->titlebut_unfocused_unpressed_color
->r
,
355 theme
->titlebut_unfocused_unpressed_color
->g
,
356 theme
->titlebut_unfocused_unpressed_color
->b
);
357 if (!read_color(db
, inst
,
358 "window.active.button.toggled.unpressed.image.color",
359 &theme
->titlebut_toggled_focused_unpressed_color
) &&
360 !read_color(db
, inst
,
361 "window.active.button.toggled.image.color",
362 &theme
->titlebut_toggled_focused_unpressed_color
))
363 theme
->titlebut_toggled_focused_unpressed_color
=
365 theme
->titlebut_focused_pressed_color
->r
,
366 theme
->titlebut_focused_pressed_color
->g
,
367 theme
->titlebut_focused_pressed_color
->b
);
368 if (!read_color(db
, inst
,
369 "window.inactive.button.toggled.unpressed.image.color",
370 &theme
->titlebut_toggled_unfocused_unpressed_color
) &&
371 !read_color(db
, inst
,
372 "window.inactive.button.toggled.image.color",
373 &theme
->titlebut_toggled_unfocused_unpressed_color
))
374 theme
->titlebut_toggled_unfocused_unpressed_color
=
376 theme
->titlebut_unfocused_pressed_color
->r
,
377 theme
->titlebut_unfocused_pressed_color
->g
,
378 theme
->titlebut_unfocused_pressed_color
->b
);
379 if (!read_color(db
, inst
,
380 "window.active.button.toggled.hover.image.color",
381 &theme
->titlebut_toggled_hover_focused_color
))
382 theme
->titlebut_toggled_hover_focused_color
=
384 theme
->titlebut_toggled_focused_unpressed_color
->r
,
385 theme
->titlebut_toggled_focused_unpressed_color
->g
,
386 theme
->titlebut_toggled_focused_unpressed_color
->b
);
387 if (!read_color(db
, inst
,
388 "window.inactive.button.toggled.hover.image.color",
389 &theme
->titlebut_toggled_hover_unfocused_color
))
390 theme
->titlebut_toggled_hover_unfocused_color
=
392 theme
->titlebut_toggled_unfocused_unpressed_color
->r
,
393 theme
->titlebut_toggled_unfocused_unpressed_color
->g
,
394 theme
->titlebut_toggled_unfocused_unpressed_color
->b
);
395 if (!read_color(db
, inst
,
396 "window.active.button.toggled.pressed.image.color",
397 &theme
->titlebut_toggled_focused_pressed_color
))
398 theme
->titlebut_toggled_focused_pressed_color
=
400 theme
->titlebut_focused_pressed_color
->r
,
401 theme
->titlebut_focused_pressed_color
->g
,
402 theme
->titlebut_focused_pressed_color
->b
);
403 if (!read_color(db
, inst
,
404 "window.inactive.button.toggled.pressed.image.color",
405 &theme
->titlebut_toggled_unfocused_pressed_color
))
406 theme
->titlebut_toggled_unfocused_pressed_color
=
408 theme
->titlebut_unfocused_pressed_color
->r
,
409 theme
->titlebut_unfocused_pressed_color
->g
,
410 theme
->titlebut_unfocused_pressed_color
->b
);
411 if (!read_color(db
, inst
,
412 "menu.title.text.color", &theme
->menu_title_color
))
413 theme
->menu_title_color
= RrColorNew(inst
, 0, 0, 0);
414 if (!read_color(db
, inst
,
415 "menu.items.text.color", &theme
->menu_color
))
416 theme
->menu_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
417 if (!read_color(db
, inst
,
418 "menu.items.disabled.text.color",
419 &theme
->menu_disabled_color
))
420 theme
->menu_disabled_color
= RrColorNew(inst
, 0, 0, 0);
421 if (!read_color(db
, inst
,
422 "menu.items.active.disabled.text.color",
423 &theme
->menu_disabled_selected_color
))
424 theme
->menu_disabled_selected_color
=
426 theme
->menu_disabled_color
->r
,
427 theme
->menu_disabled_color
->g
,
428 theme
->menu_disabled_color
->b
);
429 if (!read_color(db
, inst
,
430 "menu.items.active.text.color",
431 &theme
->menu_selected_color
))
432 theme
->menu_selected_color
= RrColorNew(inst
, 0, 0, 0);
433 if (!read_color(db
, inst
,
434 "menu.separator.color", &theme
->menu_sep_color
))
435 theme
->menu_sep_color
= RrColorNew(inst
,
436 theme
->menu_color
->r
,
437 theme
->menu_color
->g
,
438 theme
->menu_color
->b
);
440 /* load the image masks */
442 /* maximize button masks */
444 if (!read_mask(inst
, path
, theme
, "max.xbm", &theme
->max_mask
)) {
445 guchar data
[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
446 theme
->max_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
449 if (!read_mask(inst
, path
, theme
, "max_toggled.xbm",
450 &theme
->max_toggled_mask
))
453 theme
->max_toggled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
455 guchar data
[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
456 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 6, 6,(gchar
*)data
);
459 if (!read_mask(inst
, path
, theme
, "max_pressed.xbm",
460 &theme
->max_pressed_mask
))
461 theme
->max_pressed_mask
= RrPixmapMaskCopy(theme
->max_mask
);
462 if (!read_mask(inst
,path
,theme
,"max_disabled.xbm",
463 &theme
->max_disabled_mask
))
464 theme
->max_disabled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
465 if (!read_mask(inst
, path
, theme
, "max_hover.xbm", &theme
->max_hover_mask
))
466 theme
->max_hover_mask
= RrPixmapMaskCopy(theme
->max_mask
);
467 if (!read_mask(inst
, path
, theme
, "max_toggled_pressed.xbm",
468 &theme
->max_toggled_pressed_mask
))
469 theme
->max_toggled_pressed_mask
=
470 RrPixmapMaskCopy(theme
->max_toggled_mask
);
471 if (!read_mask(inst
, path
, theme
, "max_toggled_hover.xbm",
472 &theme
->max_toggled_hover_mask
))
473 theme
->max_toggled_hover_mask
=
474 RrPixmapMaskCopy(theme
->max_toggled_mask
);
476 /* iconify button masks */
477 if (!read_mask(inst
, path
, theme
, "iconify.xbm", &theme
->iconify_mask
)) {
478 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
479 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
481 if (!read_mask(inst
, path
, theme
, "iconify_pressed.xbm",
482 &theme
->iconify_pressed_mask
))
483 theme
->iconify_pressed_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
484 if (!read_mask(inst
, path
, theme
, "iconify_disabled.xbm",
485 &theme
->iconify_disabled_mask
))
486 theme
->iconify_disabled_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
487 if (!read_mask(inst
, path
, theme
, "iconify_hover.xbm",
488 &theme
->iconify_hover_mask
))
489 theme
->iconify_hover_mask
= RrPixmapMaskCopy(theme
->iconify_mask
);
491 /* all desktops button masks */
493 if (!read_mask(inst
, path
, theme
, "desk.xbm", &theme
->desk_mask
)) {
494 guchar data
[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
495 theme
->desk_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
498 if (!read_mask(inst
, path
, theme
, "desk_toggled.xbm",
499 &theme
->desk_toggled_mask
)) {
501 theme
->desk_toggled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
503 guchar data
[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
504 theme
->desk_toggled_mask
=
505 RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
508 if (!read_mask(inst
, path
, theme
, "desk_pressed.xbm",
509 &theme
->desk_pressed_mask
))
510 theme
->desk_pressed_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
511 if (!read_mask(inst
, path
, theme
, "desk_disabled.xbm",
512 &theme
->desk_disabled_mask
))
513 theme
->desk_disabled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
514 if (!read_mask(inst
, path
, theme
, "desk_hover.xbm",
515 &theme
->desk_hover_mask
))
516 theme
->desk_hover_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
517 if (!read_mask(inst
, path
, theme
, "desk_toggled_pressed.xbm",
518 &theme
->desk_toggled_pressed_mask
))
519 theme
->desk_toggled_pressed_mask
=
520 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
521 if (!read_mask(inst
, path
, theme
, "desk_toggled_hover.xbm",
522 &theme
->desk_toggled_hover_mask
))
523 theme
->desk_toggled_hover_mask
=
524 RrPixmapMaskCopy(theme
->desk_toggled_mask
);
526 /* shade button masks */
527 if (!read_mask(inst
, path
, theme
, "shade.xbm", &theme
->shade_mask
)) {
528 guchar data
[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
529 theme
->shade_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
531 if (!read_mask(inst
, path
, theme
, "shade_toggled.xbm",
532 &theme
->shade_toggled_mask
))
533 theme
->shade_toggled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
534 if (!read_mask(inst
, path
, theme
, "shade_pressed.xbm",
535 &theme
->shade_pressed_mask
))
536 theme
->shade_pressed_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
537 if (!read_mask(inst
, path
, theme
, "shade_disabled.xbm",
538 &theme
->shade_disabled_mask
))
539 theme
->shade_disabled_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
540 if (!read_mask(inst
, path
, theme
, "shade_hover.xbm",
541 &theme
->shade_hover_mask
))
542 theme
->shade_hover_mask
= RrPixmapMaskCopy(theme
->shade_mask
);
543 if (!read_mask(inst
, path
, theme
, "shade_toggled_pressed.xbm",
544 &theme
->shade_toggled_pressed_mask
))
545 theme
->shade_toggled_pressed_mask
=
546 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
547 if (!read_mask(inst
, path
, theme
, "shade_toggled_hover.xbm",
548 &theme
->shade_toggled_hover_mask
))
549 theme
->shade_toggled_hover_mask
=
550 RrPixmapMaskCopy(theme
->shade_toggled_mask
);
552 /* close button masks */
553 if (!read_mask(inst
, path
, theme
, "close.xbm", &theme
->close_mask
)) {
554 guchar data
[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
555 theme
->close_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
557 if (!read_mask(inst
, path
, theme
, "close_pressed.xbm",
558 &theme
->close_pressed_mask
))
559 theme
->close_pressed_mask
= RrPixmapMaskCopy(theme
->close_mask
);
560 if (!read_mask(inst
, path
, theme
, "close_disabled.xbm",
561 &theme
->close_disabled_mask
))
562 theme
->close_disabled_mask
= RrPixmapMaskCopy(theme
->close_mask
);
563 if (!read_mask(inst
, path
, theme
, "close_hover.xbm",
564 &theme
->close_hover_mask
))
565 theme
->close_hover_mask
= RrPixmapMaskCopy(theme
->close_mask
);
567 /* submenu bullet mask */
568 if (!read_mask(inst
, path
, theme
, "bullet.xbm", &theme
->menu_bullet_mask
))
570 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
571 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
574 /* up and down arrows */
576 guchar data
[] = { 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00 };
577 theme
->down_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
580 guchar data
[] = { 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00 };
581 theme
->up_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
584 /* setup the default window icon */
585 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
586 OB_DEFAULT_ICON_HEIGHT
,
587 OB_DEFAULT_ICON_pixel_data
);
588 theme
->def_win_icon_w
= OB_DEFAULT_ICON_WIDTH
;
589 theme
->def_win_icon_h
= OB_DEFAULT_ICON_HEIGHT
;
591 /* read the decoration textures */
592 if (!read_appearance(db
, inst
,
593 "window.active.title.bg", theme
->a_focused_title
,
595 set_default_appearance(theme
->a_focused_title
);
596 if (!read_appearance(db
, inst
,
597 "window.inactive.title.bg", theme
->a_unfocused_title
,
599 set_default_appearance(theme
->a_unfocused_title
);
600 if (!read_appearance(db
, inst
,
601 "window.active.label.bg", theme
->a_focused_label
,
603 set_default_appearance(theme
->a_focused_label
);
604 if (!read_appearance(db
, inst
,
605 "window.inactive.label.bg", theme
->a_unfocused_label
,
607 set_default_appearance(theme
->a_unfocused_label
);
608 if (!read_appearance(db
, inst
,
609 "window.active.handle.bg", theme
->a_focused_handle
,
611 set_default_appearance(theme
->a_focused_handle
);
612 if (!read_appearance(db
, inst
,
613 "window.inactive.handle.bg",theme
->a_unfocused_handle
,
615 set_default_appearance(theme
->a_unfocused_handle
);
616 if (!read_appearance(db
, inst
,
617 "window.active.grip.bg", theme
->a_focused_grip
,
619 set_default_appearance(theme
->a_focused_grip
);
620 if (!read_appearance(db
, inst
,
621 "window.inactive.grip.bg", theme
->a_unfocused_grip
,
623 set_default_appearance(theme
->a_unfocused_grip
);
624 if (!read_appearance(db
, inst
,
625 "menu.items.bg", theme
->a_menu
,
627 set_default_appearance(theme
->a_menu
);
628 if (!read_appearance(db
, inst
,
629 "menu.title.bg", theme
->a_menu_title
,
631 set_default_appearance(theme
->a_menu_title
);
632 if (!read_appearance(db
, inst
,
633 "menu.items.active.bg", theme
->a_menu_selected
,
635 set_default_appearance(theme
->a_menu_selected
);
636 theme
->a_menu_disabled_selected
=
637 RrAppearanceCopy(theme
->a_menu_selected
);
639 /* read appearances for non-decorations (on-screen-display) */
640 if (!read_appearance(db
, inst
, "osd.bg", theme
->osd_bg
, FALSE
)) {
641 RrAppearanceFree(theme
->osd_bg
);
642 theme
->osd_bg
= RrAppearanceCopy(theme
->a_focused_title
);
644 if (!read_appearance(db
, inst
, "osd.active.label.bg",
645 theme
->osd_hilite_label
, TRUE
) &&
646 !read_appearance(db
, inst
, "osd.label.bg",
647 theme
->osd_hilite_label
, TRUE
)) {
648 RrAppearanceFree(theme
->osd_hilite_label
);
649 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
651 if (!read_appearance(db
, inst
, "osd.inactive.label.bg",
652 theme
->osd_unhilite_label
, TRUE
)) {
653 RrAppearanceFree(theme
->osd_unhilite_label
);
654 theme
->osd_unhilite_label
= RrAppearanceCopy(theme
->a_unfocused_label
);
656 /* osd_hilite_fg can't be parentrel */
657 if (!read_appearance(db
, inst
, "osd.hilight.bg",
658 theme
->osd_hilite_bg
, FALSE
)) {
659 RrAppearanceFree(theme
->osd_hilite_bg
);
660 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
661 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_label
);
663 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
665 /* osd_unhilite_fg can't be parentrel either */
666 if (!read_appearance(db
, inst
, "osd.unhilight.bg",
667 theme
->osd_unhilite_bg
, FALSE
)) {
668 RrAppearanceFree(theme
->osd_unhilite_bg
);
669 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
670 theme
->osd_unhilite_bg
=RrAppearanceCopy(theme
->a_unfocused_label
);
672 theme
->osd_unhilite_bg
=RrAppearanceCopy(theme
->a_unfocused_title
);
675 /* read buttons textures */
676 if (!read_appearance(db
, inst
,
677 "window.active.button.disabled.bg",
678 theme
->a_disabled_focused_max
,
680 set_default_appearance(theme
->a_disabled_focused_max
);
681 if (!read_appearance(db
, inst
,
682 "window.inactive.button.disabled.bg",
683 theme
->a_disabled_unfocused_max
,
685 set_default_appearance(theme
->a_disabled_unfocused_max
);
686 if (!read_appearance(db
, inst
,
687 "window.active.button.pressed.bg",
688 theme
->a_focused_pressed_max
,
690 set_default_appearance(theme
->a_focused_pressed_max
);
691 if (!read_appearance(db
, inst
,
692 "window.inactive.button.pressed.bg",
693 theme
->a_unfocused_pressed_max
,
695 set_default_appearance(theme
->a_unfocused_pressed_max
);
696 if (!read_appearance(db
, inst
,
697 "window.active.button.toggled.unpressed.bg",
698 theme
->a_toggled_focused_unpressed_max
,
700 !read_appearance(db
, inst
,
701 "window.active.button.toggled.bg",
702 theme
->a_toggled_focused_unpressed_max
,
705 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
706 theme
->a_toggled_focused_unpressed_max
=
707 RrAppearanceCopy(theme
->a_focused_pressed_max
);
709 if (!read_appearance(db
, inst
,
710 "window.inactive.button.toggled.unpressed.bg",
711 theme
->a_toggled_unfocused_unpressed_max
,
713 !read_appearance(db
, inst
,
714 "window.inactive.button.toggled.bg",
715 theme
->a_toggled_unfocused_unpressed_max
,
718 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
719 theme
->a_toggled_unfocused_unpressed_max
=
720 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
722 if (!read_appearance(db
, inst
,
723 "window.active.button.toggled.hover.bg",
724 theme
->a_toggled_hover_focused_max
,
727 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
728 theme
->a_toggled_hover_focused_max
=
729 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
731 if (!read_appearance(db
, inst
,
732 "window.inactive.button.toggled.hover.bg",
733 theme
->a_toggled_hover_unfocused_max
,
736 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
737 theme
->a_toggled_hover_unfocused_max
=
738 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
740 if (!read_appearance(db
, inst
,
741 "window.active.button.toggled.pressed.bg",
742 theme
->a_toggled_focused_pressed_max
,
745 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
746 theme
->a_toggled_focused_pressed_max
=
747 RrAppearanceCopy(theme
->a_focused_pressed_max
);
749 if (!read_appearance(db
, inst
,
750 "window.inactive.button.toggled.pressed.bg",
751 theme
->a_toggled_unfocused_pressed_max
,
754 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
755 theme
->a_toggled_unfocused_pressed_max
=
756 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
758 if (!read_appearance(db
, inst
,
759 "window.active.button.unpressed.bg",
760 theme
->a_focused_unpressed_max
,
762 set_default_appearance(theme
->a_focused_unpressed_max
);
763 if (!read_appearance(db
, inst
,
764 "window.inactive.button.unpressed.bg",
765 theme
->a_unfocused_unpressed_max
,
767 set_default_appearance(theme
->a_unfocused_unpressed_max
);
768 if (!read_appearance(db
, inst
,
769 "window.active.button.hover.bg",
770 theme
->a_hover_focused_max
,
773 RrAppearanceFree(theme
->a_hover_focused_max
);
774 theme
->a_hover_focused_max
=
775 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
777 if (!read_appearance(db
, inst
,
778 "window.inactive.button.hover.bg",
779 theme
->a_hover_unfocused_max
,
782 RrAppearanceFree(theme
->a_hover_unfocused_max
);
783 theme
->a_hover_unfocused_max
=
784 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
787 theme
->a_disabled_focused_close
=
788 RrAppearanceCopy(theme
->a_disabled_focused_max
);
789 theme
->a_disabled_unfocused_close
=
790 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
791 theme
->a_hover_focused_close
=
792 RrAppearanceCopy(theme
->a_hover_focused_max
);
793 theme
->a_hover_unfocused_close
=
794 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
795 theme
->a_unfocused_unpressed_close
=
796 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
797 theme
->a_unfocused_pressed_close
=
798 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
799 theme
->a_focused_unpressed_close
=
800 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
801 theme
->a_focused_pressed_close
=
802 RrAppearanceCopy(theme
->a_focused_pressed_max
);
803 theme
->a_disabled_focused_desk
=
804 RrAppearanceCopy(theme
->a_disabled_focused_max
);
805 theme
->a_disabled_unfocused_desk
=
806 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
807 theme
->a_hover_focused_desk
=
808 RrAppearanceCopy(theme
->a_hover_focused_max
);
809 theme
->a_hover_unfocused_desk
=
810 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
811 theme
->a_toggled_hover_focused_desk
=
812 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
813 theme
->a_toggled_hover_unfocused_desk
=
814 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
815 theme
->a_toggled_focused_unpressed_desk
=
816 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
817 theme
->a_toggled_unfocused_unpressed_desk
=
818 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
819 theme
->a_toggled_focused_pressed_desk
=
820 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
821 theme
->a_toggled_unfocused_pressed_desk
=
822 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
823 theme
->a_unfocused_unpressed_desk
=
824 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
825 theme
->a_unfocused_pressed_desk
=
826 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
827 theme
->a_focused_unpressed_desk
=
828 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
829 theme
->a_focused_pressed_desk
=
830 RrAppearanceCopy(theme
->a_focused_pressed_max
);
831 theme
->a_disabled_focused_shade
=
832 RrAppearanceCopy(theme
->a_disabled_focused_max
);
833 theme
->a_disabled_unfocused_shade
=
834 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
835 theme
->a_hover_focused_shade
=
836 RrAppearanceCopy(theme
->a_hover_focused_max
);
837 theme
->a_hover_unfocused_shade
=
838 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
839 theme
->a_toggled_hover_focused_shade
=
840 RrAppearanceCopy(theme
->a_toggled_hover_focused_max
);
841 theme
->a_toggled_hover_unfocused_shade
=
842 RrAppearanceCopy(theme
->a_toggled_hover_unfocused_max
);
843 theme
->a_toggled_focused_unpressed_shade
=
844 RrAppearanceCopy(theme
->a_toggled_focused_unpressed_max
);
845 theme
->a_toggled_unfocused_unpressed_shade
=
846 RrAppearanceCopy(theme
->a_toggled_unfocused_unpressed_max
);
847 theme
->a_toggled_focused_pressed_shade
=
848 RrAppearanceCopy(theme
->a_toggled_focused_pressed_max
);
849 theme
->a_toggled_unfocused_pressed_shade
=
850 RrAppearanceCopy(theme
->a_toggled_unfocused_pressed_max
);
851 theme
->a_unfocused_unpressed_shade
=
852 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
853 theme
->a_unfocused_pressed_shade
=
854 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
855 theme
->a_focused_unpressed_shade
=
856 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
857 theme
->a_focused_pressed_shade
=
858 RrAppearanceCopy(theme
->a_focused_pressed_max
);
859 theme
->a_disabled_focused_iconify
=
860 RrAppearanceCopy(theme
->a_disabled_focused_max
);
861 theme
->a_disabled_unfocused_iconify
=
862 RrAppearanceCopy(theme
->a_disabled_focused_max
);
863 theme
->a_hover_focused_iconify
=
864 RrAppearanceCopy(theme
->a_hover_focused_max
);
865 theme
->a_hover_unfocused_iconify
=
866 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
867 theme
->a_unfocused_unpressed_iconify
=
868 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
869 theme
->a_unfocused_pressed_iconify
=
870 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
871 theme
->a_focused_unpressed_iconify
=
872 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
873 theme
->a_focused_pressed_iconify
=
874 RrAppearanceCopy(theme
->a_focused_pressed_max
);
876 theme
->a_icon
->surface
.grad
=
877 theme
->a_clear
->surface
.grad
=
878 theme
->a_clear_tex
->surface
.grad
=
879 theme
->a_menu_text_title
->surface
.grad
=
880 theme
->a_menu_normal
->surface
.grad
=
881 theme
->a_menu_disabled
->surface
.grad
=
882 theme
->a_menu_text_normal
->surface
.grad
=
883 theme
->a_menu_text_selected
->surface
.grad
=
884 theme
->a_menu_text_disabled
->surface
.grad
=
885 theme
->a_menu_text_disabled_selected
->surface
.grad
=
886 theme
->a_menu_bullet_normal
->surface
.grad
=
887 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
889 /* set up the textures */
890 theme
->a_focused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
891 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
892 theme
->a_focused_label
->texture
[0].data
.text
.font
=theme
->win_font_focused
;
893 theme
->a_focused_label
->texture
[0].data
.text
.color
=
894 theme
->title_focused_color
;
896 if (read_string(db
, "window.active.label.text.font", &str
)) {
900 if (strstr(str
, "shadow=y")) {
901 if ((p
= strstr(str
, "shadowoffset=")))
902 i
= parse_inline_number(p
+ strlen("shadowoffset="));
905 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
906 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
908 if ((p
= strstr(str
, "shadowtint=")))
910 i
= parse_inline_number(p
+ strlen("shadowtint="));
911 j
= (i
> 0 ? 0 : 255);
914 theme
->title_focused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
915 theme
->title_focused_shadow_alpha
= i
;
917 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
918 theme
->title_focused_shadow_alpha
= 50;
922 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
923 theme
->title_focused_shadow_color
;
924 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
925 theme
->title_focused_shadow_alpha
;
927 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
928 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
929 theme
->osd_hilite_label
->texture
[0].data
.text
.font
= theme
->osd_font
;
930 theme
->osd_hilite_label
->texture
[0].data
.text
.color
=
931 theme
->osd_text_active_color
;
933 theme
->osd_unhilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
934 theme
->osd_unhilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
935 theme
->osd_unhilite_label
->texture
[0].data
.text
.font
= theme
->osd_font
;
936 theme
->osd_unhilite_label
->texture
[0].data
.text
.color
=
937 theme
->osd_text_inactive_color
;
939 if (read_string(db
, "osd.active.label.text.font", &str
) ||
940 read_string(db
, "osd.label.text.font", &str
))
945 if (strstr(str
, "shadow=y")) {
946 if ((p
= strstr(str
, "shadowoffset=")))
947 i
= parse_inline_number(p
+ strlen("shadowoffset="));
950 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
951 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
953 if ((p
= strstr(str
, "shadowtint=")))
955 i
= parse_inline_number(p
+ strlen("shadowtint="));
956 j
= (i
> 0 ? 0 : 255);
959 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, j
, j
, j
);
960 theme
->osd_text_active_shadow_alpha
= i
;
962 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, 0, 0, 0);
963 theme
->osd_text_active_shadow_alpha
= 50;
966 /* inherit the font settings from the focused label */
967 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
968 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
969 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
970 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
971 if (theme
->title_focused_shadow_color
)
972 theme
->osd_text_active_shadow_color
=
974 theme
->title_focused_shadow_color
->r
,
975 theme
->title_focused_shadow_color
->g
,
976 theme
->title_focused_shadow_color
->b
);
978 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, 0, 0, 0);
979 theme
->osd_text_active_shadow_alpha
=
980 theme
->title_focused_shadow_alpha
;
983 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
984 theme
->osd_text_active_shadow_color
;
985 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
986 theme
->osd_text_active_shadow_alpha
;
988 if (read_string(db
, "osd.inactive.label.text.font", &str
))
993 if (strstr(str
, "shadow=y")) {
994 if ((p
= strstr(str
, "shadowoffset=")))
995 i
= parse_inline_number(p
+ strlen("shadowoffset="));
998 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_x
=i
;
999 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_y
=i
;
1001 if ((p
= strstr(str
, "shadowtint=")))
1003 i
= parse_inline_number(p
+ strlen("shadowtint="));
1004 j
= (i
> 0 ? 0 : 255);
1007 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1008 theme
->osd_text_inactive_shadow_alpha
= i
;
1010 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1011 theme
->osd_text_inactive_shadow_alpha
= 50;
1014 /* inherit the font settings from the focused label */
1015 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_x
=
1016 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
;
1017 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_y
=
1018 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
;
1019 if (theme
->title_unfocused_shadow_color
)
1020 theme
->osd_text_inactive_shadow_color
=
1022 theme
->title_unfocused_shadow_color
->r
,
1023 theme
->title_unfocused_shadow_color
->g
,
1024 theme
->title_unfocused_shadow_color
->b
);
1026 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1027 theme
->osd_text_inactive_shadow_alpha
=
1028 theme
->title_unfocused_shadow_alpha
;
1031 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_color
=
1032 theme
->osd_text_inactive_shadow_color
;
1033 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_alpha
=
1034 theme
->osd_text_inactive_shadow_alpha
;
1036 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
1037 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
1038 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
1039 theme
->win_font_unfocused
;
1040 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
1041 theme
->title_unfocused_color
;
1043 if (read_string(db
, "window.inactive.label.text.font", &str
)) {
1047 if (strstr(str
, "shadow=y")) {
1048 if ((p
= strstr(str
, "shadowoffset=")))
1049 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1052 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
1053 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
1055 if ((p
= strstr(str
, "shadowtint=")))
1057 i
= parse_inline_number(p
+ strlen("shadowtint="));
1058 j
= (i
> 0 ? 0 : 255);
1061 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1062 theme
->title_unfocused_shadow_alpha
= i
;
1064 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1065 theme
->title_unfocused_shadow_alpha
= 50;
1069 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
1070 theme
->title_unfocused_shadow_color
;
1071 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
1072 theme
->title_unfocused_shadow_alpha
;
1074 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
1075 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
1076 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
1077 theme
->menu_title_font
;
1078 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
1079 theme
->menu_title_color
;
1081 if (read_string(db
, "menu.title.text.font", &str
)) {
1085 if (strstr(str
, "shadow=y")) {
1086 if ((p
= strstr(str
, "shadowoffset=")))
1087 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1090 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
= i
;
1091 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= i
;
1093 if ((p
= strstr(str
, "shadowtint=")))
1095 i
= parse_inline_number(p
+ strlen("shadowtint="));
1096 j
= (i
> 0 ? 0 : 255);
1099 theme
->menu_title_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1100 theme
->menu_title_shadow_alpha
= i
;
1102 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1103 theme
->menu_title_shadow_alpha
= 50;
1107 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
1108 theme
->menu_title_shadow_color
;
1109 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
1110 theme
->menu_title_shadow_alpha
;
1112 theme
->a_menu_text_normal
->texture
[0].type
=
1113 theme
->a_menu_text_selected
->texture
[0].type
=
1114 theme
->a_menu_text_disabled
->texture
[0].type
=
1115 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
1117 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
1118 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
1119 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
1120 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
1122 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
1123 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
1124 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
1125 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
1127 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
1128 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
1129 theme
->menu_selected_color
;
1130 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
1131 theme
->menu_disabled_color
;
1132 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
1133 theme
->menu_disabled_selected_color
;
1135 if (read_string(db
, "menu.items.font", &str
)) {
1139 if (strstr(str
, "shadow=y")) {
1140 if ((p
= strstr(str
, "shadowoffset=")))
1141 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1144 theme
->a_menu_text_normal
->
1145 texture
[0].data
.text
.shadow_offset_x
= i
;
1146 theme
->a_menu_text_normal
->
1147 texture
[0].data
.text
.shadow_offset_y
= i
;
1148 theme
->a_menu_text_selected
->
1149 texture
[0].data
.text
.shadow_offset_x
= i
;
1150 theme
->a_menu_text_selected
->
1151 texture
[0].data
.text
.shadow_offset_y
= i
;
1152 theme
->a_menu_text_disabled
->
1153 texture
[0].data
.text
.shadow_offset_x
= i
;
1154 theme
->a_menu_text_disabled
->
1155 texture
[0].data
.text
.shadow_offset_y
= i
;
1156 theme
->a_menu_text_disabled_selected
->
1157 texture
[0].data
.text
.shadow_offset_x
= i
;
1158 theme
->a_menu_text_disabled_selected
->
1159 texture
[0].data
.text
.shadow_offset_y
= i
;
1161 if ((p
= strstr(str
, "shadowtint=")))
1163 i
= parse_inline_number(p
+ strlen("shadowtint="));
1164 j
= (i
> 0 ? 0 : 255);
1167 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1168 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1169 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1170 theme
->menu_text_normal_shadow_alpha
= i
;
1171 theme
->menu_text_selected_shadow_alpha
= i
;
1172 theme
->menu_text_disabled_shadow_alpha
= i
;
1173 theme
->menu_text_disabled_selected_shadow_alpha
= i
;
1175 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1176 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1177 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1178 theme
->menu_text_normal_shadow_alpha
= 50;
1179 theme
->menu_text_selected_shadow_alpha
= 50;
1180 theme
->menu_text_disabled_selected_shadow_alpha
= 50;
1184 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
1185 theme
->menu_text_normal_shadow_color
;
1186 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
1187 theme
->menu_text_normal_shadow_alpha
;
1188 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
1189 theme
->menu_text_selected_shadow_color
;
1190 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
1191 theme
->menu_text_selected_shadow_alpha
;
1192 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
1193 theme
->menu_text_disabled_shadow_color
;
1194 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
1195 theme
->menu_text_disabled_shadow_alpha
;
1196 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
1197 theme
->menu_text_disabled_shadow_color
;
1198 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
1199 theme
->menu_text_disabled_shadow_alpha
;
1201 theme
->a_disabled_focused_max
->texture
[0].type
=
1202 theme
->a_disabled_unfocused_max
->texture
[0].type
=
1203 theme
->a_hover_focused_max
->texture
[0].type
=
1204 theme
->a_hover_unfocused_max
->texture
[0].type
=
1205 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
1206 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
1207 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
1208 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
1209 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
1210 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
1211 theme
->a_focused_unpressed_max
->texture
[0].type
=
1212 theme
->a_focused_pressed_max
->texture
[0].type
=
1213 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
1214 theme
->a_unfocused_pressed_max
->texture
[0].type
=
1215 theme
->a_disabled_focused_close
->texture
[0].type
=
1216 theme
->a_disabled_unfocused_close
->texture
[0].type
=
1217 theme
->a_hover_focused_close
->texture
[0].type
=
1218 theme
->a_hover_unfocused_close
->texture
[0].type
=
1219 theme
->a_focused_unpressed_close
->texture
[0].type
=
1220 theme
->a_focused_pressed_close
->texture
[0].type
=
1221 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
1222 theme
->a_unfocused_pressed_close
->texture
[0].type
=
1223 theme
->a_disabled_focused_desk
->texture
[0].type
=
1224 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
1225 theme
->a_hover_focused_desk
->texture
[0].type
=
1226 theme
->a_hover_unfocused_desk
->texture
[0].type
=
1227 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
1228 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
1229 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
1230 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
1231 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
1232 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
1233 theme
->a_focused_unpressed_desk
->texture
[0].type
=
1234 theme
->a_focused_pressed_desk
->texture
[0].type
=
1235 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
1236 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
1237 theme
->a_disabled_focused_shade
->texture
[0].type
=
1238 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
1239 theme
->a_hover_focused_shade
->texture
[0].type
=
1240 theme
->a_hover_unfocused_shade
->texture
[0].type
=
1241 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
1242 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
1243 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
1244 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
1245 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
1246 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
1247 theme
->a_focused_unpressed_shade
->texture
[0].type
=
1248 theme
->a_focused_pressed_shade
->texture
[0].type
=
1249 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
1250 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
1251 theme
->a_disabled_focused_iconify
->texture
[0].type
=
1252 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
1253 theme
->a_hover_focused_iconify
->texture
[0].type
=
1254 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
1255 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
1256 theme
->a_focused_pressed_iconify
->texture
[0].type
=
1257 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
1258 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
1259 theme
->a_menu_bullet_normal
->texture
[0].type
=
1260 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
1262 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
1263 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
1264 theme
->max_disabled_mask
;
1265 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
1266 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1267 theme
->max_hover_mask
;
1268 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1269 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1270 theme
->max_pressed_mask
;
1271 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1272 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1274 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
1275 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1276 theme
->max_toggled_hover_mask
;
1277 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1278 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1279 theme
->max_toggled_mask
;
1280 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1281 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1282 theme
->max_toggled_pressed_mask
;
1283 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
1284 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
1285 theme
->close_disabled_mask
;
1286 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
1287 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
1288 theme
->close_hover_mask
;
1289 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
1290 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
1291 theme
->close_pressed_mask
;
1292 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
1293 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
1295 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
1296 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
1297 theme
->desk_disabled_mask
;
1298 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1299 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1300 theme
->desk_hover_mask
;
1301 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1302 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1303 theme
->desk_pressed_mask
;
1304 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1305 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1307 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1308 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1309 theme
->desk_toggled_hover_mask
;
1310 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1311 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1312 theme
->desk_toggled_mask
;
1313 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1314 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1315 theme
->desk_toggled_pressed_mask
;
1316 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1317 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1318 theme
->shade_disabled_mask
;
1319 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1320 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1321 theme
->shade_hover_mask
;
1322 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1323 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1324 theme
->shade_pressed_mask
;
1325 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1326 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1328 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1329 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1330 theme
->shade_toggled_hover_mask
;
1331 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1332 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1333 theme
->shade_toggled_mask
;
1334 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1335 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1336 theme
->shade_toggled_pressed_mask
;
1337 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1338 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1339 theme
->iconify_disabled_mask
;
1340 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1341 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1342 theme
->iconify_hover_mask
;
1343 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1344 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1345 theme
->iconify_pressed_mask
;
1346 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1347 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1348 theme
->iconify_mask
;
1349 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1350 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1351 theme
->menu_bullet_mask
;
1352 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1353 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1354 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1355 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1356 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1357 theme
->titlebut_disabled_focused_color
;
1358 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1359 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1360 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1361 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1362 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1363 theme
->titlebut_disabled_unfocused_color
;
1364 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1365 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1366 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1367 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1368 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1369 theme
->titlebut_hover_focused_color
;
1370 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1371 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1372 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1373 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1374 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1375 theme
->titlebut_hover_unfocused_color
;
1376 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1377 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1378 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1379 theme
->titlebut_toggled_hover_focused_color
;
1380 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1381 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1382 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1383 theme
->titlebut_toggled_hover_unfocused_color
;
1384 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1385 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1386 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1387 theme
->titlebut_toggled_focused_unpressed_color
;
1388 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1389 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1390 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1391 theme
->titlebut_toggled_unfocused_unpressed_color
;
1392 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1393 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1394 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1395 theme
->titlebut_toggled_focused_pressed_color
;
1396 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1397 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1398 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1399 theme
->titlebut_toggled_unfocused_pressed_color
;
1400 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1401 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1402 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1403 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1404 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1405 theme
->titlebut_focused_unpressed_color
;
1406 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1407 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1408 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1409 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1410 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1411 theme
->titlebut_focused_pressed_color
;
1412 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1413 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1414 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1415 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1416 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1417 theme
->titlebut_unfocused_unpressed_color
;
1418 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1419 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1420 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1421 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1422 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1423 theme
->titlebut_unfocused_pressed_color
;
1424 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1426 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1427 theme
->menu_selected_color
;
1430 XrmDestroyDatabase(db
);
1432 /* set the font heights */
1433 theme
->win_font_height
= RrFontHeight
1434 (theme
->win_font_focused
,
1435 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
);
1436 theme
->win_font_height
=
1437 MAX(theme
->win_font_height
,
1439 (theme
->win_font_focused
,
1440 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
));
1441 theme
->menu_title_font_height
= RrFontHeight
1442 (theme
->menu_title_font
,
1443 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
);
1444 theme
->menu_font_height
= RrFontHeight
1446 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
);
1448 /* calculate some last extents */
1450 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1452 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1453 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1454 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1455 theme
->label_height
+= theme
->label_height
% 2;
1457 /* this would be nice I think, since padding.width can now be 0,
1458 but it breaks frame.c horribly and I don't feel like fixing that
1459 right now, so if anyone complains, here is how to keep text from
1460 going over the title's bevel/border with a padding.width of 0 and a
1461 bevelless/borderless label
1462 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1463 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1464 theme->title_height = theme->label_height +
1465 MAX(MAX(theme->padding * 2, ft + fb),
1466 MAX(theme->padding * 2, ut + ub));
1468 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1470 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1471 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1472 theme
->menu_title_height
= theme
->menu_title_label_height
+
1473 theme
->paddingy
* 2;
1475 theme
->button_size
= theme
->label_height
- 2;
1476 theme
->grip_width
= 25;
1481 void RrThemeFree(RrTheme
*theme
)
1484 g_free(theme
->name
);
1486 RrColorFree(theme
->menu_border_color
);
1487 RrColorFree(theme
->osd_border_color
);
1488 RrColorFree(theme
->frame_focused_border_color
);
1489 RrColorFree(theme
->frame_unfocused_border_color
);
1490 RrColorFree(theme
->title_separator_focused_color
);
1491 RrColorFree(theme
->title_separator_unfocused_color
);
1492 RrColorFree(theme
->cb_unfocused_color
);
1493 RrColorFree(theme
->cb_focused_color
);
1494 RrColorFree(theme
->title_focused_color
);
1495 RrColorFree(theme
->title_unfocused_color
);
1496 RrColorFree(theme
->titlebut_disabled_focused_color
);
1497 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1498 RrColorFree(theme
->titlebut_hover_focused_color
);
1499 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1500 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1501 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1502 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1503 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1504 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1505 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1506 RrColorFree(theme
->titlebut_focused_pressed_color
);
1507 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1508 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1509 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1510 RrColorFree(theme
->menu_title_color
);
1511 RrColorFree(theme
->menu_sep_color
);
1512 RrColorFree(theme
->menu_color
);
1513 RrColorFree(theme
->menu_selected_color
);
1514 RrColorFree(theme
->menu_disabled_color
);
1515 RrColorFree(theme
->menu_disabled_selected_color
);
1516 RrColorFree(theme
->title_focused_shadow_color
);
1517 RrColorFree(theme
->title_unfocused_shadow_color
);
1518 RrColorFree(theme
->osd_text_active_color
);
1519 RrColorFree(theme
->osd_text_inactive_color
);
1520 RrColorFree(theme
->osd_text_active_shadow_color
);
1521 RrColorFree(theme
->osd_text_inactive_shadow_color
);
1522 RrColorFree(theme
->menu_title_shadow_color
);
1523 RrColorFree(theme
->menu_text_normal_shadow_color
);
1524 RrColorFree(theme
->menu_text_selected_shadow_color
);
1525 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1526 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1528 g_free(theme
->def_win_icon
);
1530 RrPixmapMaskFree(theme
->max_mask
);
1531 RrPixmapMaskFree(theme
->max_toggled_mask
);
1532 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1533 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1534 RrPixmapMaskFree(theme
->max_disabled_mask
);
1535 RrPixmapMaskFree(theme
->max_hover_mask
);
1536 RrPixmapMaskFree(theme
->max_pressed_mask
);
1537 RrPixmapMaskFree(theme
->desk_mask
);
1538 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1539 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1540 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1541 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1542 RrPixmapMaskFree(theme
->desk_hover_mask
);
1543 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1544 RrPixmapMaskFree(theme
->shade_mask
);
1545 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1546 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1547 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1548 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1549 RrPixmapMaskFree(theme
->shade_hover_mask
);
1550 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1551 RrPixmapMaskFree(theme
->iconify_mask
);
1552 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1553 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1554 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1555 RrPixmapMaskFree(theme
->close_mask
);
1556 RrPixmapMaskFree(theme
->close_disabled_mask
);
1557 RrPixmapMaskFree(theme
->close_hover_mask
);
1558 RrPixmapMaskFree(theme
->close_pressed_mask
);
1559 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1560 RrPixmapMaskFree(theme
->down_arrow_mask
);
1561 RrPixmapMaskFree(theme
->up_arrow_mask
);
1563 RrFontClose(theme
->win_font_focused
);
1564 RrFontClose(theme
->win_font_unfocused
);
1565 RrFontClose(theme
->menu_title_font
);
1566 RrFontClose(theme
->menu_font
);
1567 RrFontClose(theme
->osd_font
);
1569 RrAppearanceFree(theme
->a_disabled_focused_max
);
1570 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1571 RrAppearanceFree(theme
->a_hover_focused_max
);
1572 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1573 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1574 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1575 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1576 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1577 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1578 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1579 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1580 RrAppearanceFree(theme
->a_focused_pressed_max
);
1581 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1582 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1583 RrAppearanceFree(theme
->a_disabled_focused_close
);
1584 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1585 RrAppearanceFree(theme
->a_hover_focused_close
);
1586 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1587 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1588 RrAppearanceFree(theme
->a_focused_pressed_close
);
1589 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1590 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1591 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1592 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1593 RrAppearanceFree(theme
->a_hover_focused_desk
);
1594 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1595 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1596 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1597 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1598 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1599 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1600 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1601 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1602 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1603 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1604 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1605 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1606 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1607 RrAppearanceFree(theme
->a_hover_focused_shade
);
1608 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1609 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1610 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1611 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1612 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1613 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1614 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1615 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1616 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1617 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1618 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1619 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1620 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1621 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1622 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1623 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1624 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1625 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1626 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1627 RrAppearanceFree(theme
->a_focused_grip
);
1628 RrAppearanceFree(theme
->a_unfocused_grip
);
1629 RrAppearanceFree(theme
->a_focused_title
);
1630 RrAppearanceFree(theme
->a_unfocused_title
);
1631 RrAppearanceFree(theme
->a_focused_label
);
1632 RrAppearanceFree(theme
->a_unfocused_label
);
1633 RrAppearanceFree(theme
->a_icon
);
1634 RrAppearanceFree(theme
->a_focused_handle
);
1635 RrAppearanceFree(theme
->a_unfocused_handle
);
1636 RrAppearanceFree(theme
->a_menu
);
1637 RrAppearanceFree(theme
->a_menu_title
);
1638 RrAppearanceFree(theme
->a_menu_text_title
);
1639 RrAppearanceFree(theme
->a_menu_normal
);
1640 RrAppearanceFree(theme
->a_menu_selected
);
1641 RrAppearanceFree(theme
->a_menu_disabled
);
1642 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1643 RrAppearanceFree(theme
->a_menu_text_normal
);
1644 RrAppearanceFree(theme
->a_menu_text_selected
);
1645 RrAppearanceFree(theme
->a_menu_text_disabled
);
1646 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1647 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1648 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1649 RrAppearanceFree(theme
->a_clear
);
1650 RrAppearanceFree(theme
->a_clear_tex
);
1651 RrAppearanceFree(theme
->osd_bg
);
1652 RrAppearanceFree(theme
->osd_hilite_bg
);
1653 RrAppearanceFree(theme
->osd_hilite_label
);
1654 RrAppearanceFree(theme
->osd_unhilite_bg
);
1655 RrAppearanceFree(theme
->osd_unhilite_label
);
1661 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
)
1664 XrmDatabase db
= NULL
;
1667 if (name
[0] == '/') {
1668 s
= g_build_filename(name
, "openbox-3", "themerc", NULL
);
1669 if ((db
= XrmGetFileDatabase(s
)))
1670 *path
= g_path_get_dirname(s
);
1675 p
= obt_paths_new();
1677 /* XXX backwards compatibility, remove me sometime later */
1678 s
= g_build_filename(g_get_home_dir(), ".themes", name
,
1679 "openbox-3", "themerc", NULL
);
1680 if ((db
= XrmGetFileDatabase(s
)))
1681 *path
= g_path_get_dirname(s
);
1684 for (it
= obt_paths_data_dirs(p
); !db
&& it
; it
= g_slist_next(it
))
1686 s
= g_build_filename(it
->data
, "themes", name
,
1687 "openbox-3", "themerc", NULL
);
1688 if ((db
= XrmGetFileDatabase(s
)))
1689 *path
= g_path_get_dirname(s
);
1697 s
= g_build_filename(name
, "themerc", NULL
);
1698 if ((db
= XrmGetFileDatabase(s
)))
1699 *path
= g_path_get_dirname(s
);
1706 static gchar
*create_class_name(const gchar
*rname
)
1708 gchar
*rclass
= g_strdup(rname
);
1713 p
= strchr(p
+1, '.');
1714 if (p
== NULL
) break;
1716 if (*p
== '\0') break;
1721 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
)
1723 gboolean ret
= FALSE
;
1724 gchar
*rclass
= create_class_name(rname
);
1725 gchar
*rettype
, *end
;
1728 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1729 retvalue
.addr
!= NULL
) {
1730 *value
= (gint
)strtol(retvalue
.addr
, &end
, 10);
1731 if (end
!= retvalue
.addr
)
1739 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
)
1741 gboolean ret
= FALSE
;
1742 gchar
*rclass
= create_class_name(rname
);
1746 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1747 retvalue
.addr
!= NULL
) {
1748 *value
= retvalue
.addr
;
1756 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
1757 const gchar
*rname
, RrColor
**value
)
1759 gboolean ret
= FALSE
;
1760 gchar
*rclass
= create_class_name(rname
);
1764 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1765 retvalue
.addr
!= NULL
) {
1766 RrColor
*c
= RrColorParse(inst
, retvalue
.addr
);
1777 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
1778 RrTheme
*theme
, const gchar
*maskname
,
1779 RrPixmapMask
**value
)
1781 gboolean ret
= FALSE
;
1783 gint hx
, hy
; /* ignored */
1787 s
= g_build_filename(path
, maskname
, NULL
);
1788 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1790 *value
= RrPixmapMaskNew(inst
, w
, h
, (gchar
*)b
);
1798 static void parse_appearance(gchar
*tex
, RrSurfaceColorType
*grad
,
1799 RrReliefType
*relief
, RrBevelType
*bevel
,
1800 gboolean
*interlaced
, gboolean
*border
,
1801 gboolean allow_trans
)
1805 /* convert to all lowercase */
1806 for (t
= tex
; *t
!= '\0'; ++t
)
1807 *t
= g_ascii_tolower(*t
);
1809 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1810 *grad
= RR_SURFACE_PARENTREL
;
1812 if (strstr(tex
, "gradient") != NULL
) {
1813 if (strstr(tex
, "crossdiagonal") != NULL
)
1814 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1815 else if (strstr(tex
, "pyramid") != NULL
)
1816 *grad
= RR_SURFACE_PYRAMID
;
1817 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1818 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1819 else if (strstr(tex
, "horizontal") != NULL
)
1820 *grad
= RR_SURFACE_HORIZONTAL
;
1821 else if (strstr(tex
, "splitvertical") != NULL
)
1822 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1823 else if (strstr(tex
, "vertical") != NULL
)
1824 *grad
= RR_SURFACE_VERTICAL
;
1826 *grad
= RR_SURFACE_DIAGONAL
;
1828 *grad
= RR_SURFACE_SOLID
;
1832 if (strstr(tex
, "sunken") != NULL
)
1833 *relief
= RR_RELIEF_SUNKEN
;
1834 else if (strstr(tex
, "flat") != NULL
)
1835 *relief
= RR_RELIEF_FLAT
;
1836 else if (strstr(tex
, "raised") != NULL
)
1837 *relief
= RR_RELIEF_RAISED
;
1839 *relief
= (*grad
== RR_SURFACE_PARENTREL
) ?
1840 RR_RELIEF_FLAT
: RR_RELIEF_RAISED
;
1843 if (*relief
== RR_RELIEF_FLAT
) {
1844 if (strstr(tex
, "border") != NULL
)
1847 if (strstr(tex
, "bevel2") != NULL
)
1848 *bevel
= RR_BEVEL_2
;
1850 *bevel
= RR_BEVEL_1
;
1853 if (strstr(tex
, "interlaced") != NULL
)
1856 *interlaced
= FALSE
;
1859 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
1860 const gchar
*rname
, RrAppearance
*value
,
1861 gboolean allow_trans
)
1863 gboolean ret
= FALSE
;
1864 gchar
*rclass
= create_class_name(rname
);
1865 gchar
*cname
, *ctoname
, *bcname
, *icname
, *hname
, *sname
;
1866 gchar
*csplitname
, *ctosplitname
;
1871 cname
= g_strconcat(rname
, ".color", NULL
);
1872 ctoname
= g_strconcat(rname
, ".colorTo", NULL
);
1873 bcname
= g_strconcat(rname
, ".border.color", NULL
);
1874 icname
= g_strconcat(rname
, ".interlace.color", NULL
);
1875 hname
= g_strconcat(rname
, ".highlight", NULL
);
1876 sname
= g_strconcat(rname
, ".shadow", NULL
);
1877 csplitname
= g_strconcat(rname
, ".color.splitTo", NULL
);
1878 ctosplitname
= g_strconcat(rname
, ".colorTo.splitTo", NULL
);
1880 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1881 retvalue
.addr
!= NULL
) {
1882 parse_appearance(retvalue
.addr
,
1883 &value
->surface
.grad
,
1884 &value
->surface
.relief
,
1885 &value
->surface
.bevel
,
1886 &value
->surface
.interlaced
,
1887 &value
->surface
.border
,
1889 if (!read_color(db
, inst
, cname
, &value
->surface
.primary
))
1890 value
->surface
.primary
= RrColorNew(inst
, 0, 0, 0);
1891 if (!read_color(db
, inst
, ctoname
, &value
->surface
.secondary
))
1892 value
->surface
.secondary
= RrColorNew(inst
, 0, 0, 0);
1893 if (value
->surface
.border
)
1894 if (!read_color(db
, inst
, bcname
,
1895 &value
->surface
.border_color
))
1896 value
->surface
.border_color
= RrColorNew(inst
, 0, 0, 0);
1897 if (value
->surface
.interlaced
)
1898 if (!read_color(db
, inst
, icname
,
1899 &value
->surface
.interlace_color
))
1900 value
->surface
.interlace_color
= RrColorNew(inst
, 0, 0, 0);
1901 if (read_int(db
, hname
, &i
) && i
>= 0)
1902 value
->surface
.bevel_light_adjust
= i
;
1903 if (read_int(db
, sname
, &i
) && i
>= 0 && i
<= 256)
1904 value
->surface
.bevel_dark_adjust
= i
;
1906 if (value
->surface
.grad
== RR_SURFACE_SPLIT_VERTICAL
) {
1909 if (!read_color(db
, inst
, csplitname
,
1910 &value
->surface
.split_primary
))
1912 r
= value
->surface
.primary
->r
;
1914 g
= value
->surface
.primary
->g
;
1916 b
= value
->surface
.primary
->b
;
1918 if (r
> 0xFF) r
= 0xFF;
1919 if (g
> 0xFF) g
= 0xFF;
1920 if (b
> 0xFF) b
= 0xFF;
1921 value
->surface
.split_primary
= RrColorNew(inst
, r
, g
, b
);
1924 if (!read_color(db
, inst
, ctosplitname
,
1925 &value
->surface
.split_secondary
))
1927 r
= value
->surface
.secondary
->r
;
1929 g
= value
->surface
.secondary
->g
;
1931 b
= value
->surface
.secondary
->b
;
1933 if (r
> 0xFF) r
= 0xFF;
1934 if (g
> 0xFF) g
= 0xFF;
1935 if (b
> 0xFF) b
= 0xFF;
1936 value
->surface
.split_secondary
= RrColorNew(inst
, r
, g
, b
);
1943 g_free(ctosplitname
);
1955 static int parse_inline_number(const char *p
)
1963 for (; isdigit(*p
); ++p
)
1964 res
= res
* 10 + *p
- '0';
1969 static void set_default_appearance(RrAppearance
*a
)
1971 a
->surface
.grad
= RR_SURFACE_SOLID
;
1972 a
->surface
.relief
= RR_RELIEF_FLAT
;
1973 a
->surface
.bevel
= RR_BEVEL_1
;
1974 a
->surface
.interlaced
= FALSE
;
1975 a
->surface
.border
= FALSE
;
1976 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1977 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
1980 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1981 an RrTextureRGBA. */
1982 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
1987 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
1989 for (i
= 0; i
< width
* height
; ++i
) {
1990 guchar a
= ((*p
>> 24) & 0xff);
1991 guchar b
= ((*p
>> 16) & 0xff);
1992 guchar g
= ((*p
>> 8) & 0xff);
1993 guchar r
= ((*p
>> 0) & 0xff);
1995 *p
= ((r
<< RrDefaultRedOffset
) +
1996 (g
<< RrDefaultGreenOffset
) +
1997 (b
<< RrDefaultBlueOffset
) +
1998 (a
<< RrDefaultAlphaOffset
));