8 #include <X11/Xresource.h>
10 static XrmDatabase
loaddb(RrTheme
*theme
, char *name
);
11 static gboolean
read_int(XrmDatabase db
, char *rname
, int *value
);
12 static gboolean
read_string(XrmDatabase db
, char *rname
, char **value
);
13 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
14 gchar
*rname
, RrColor
**value
);
15 static gboolean
read_mask(const RrInstance
*inst
,
16 gchar
*maskname
, RrTheme
*theme
,
17 RrPixmapMask
**value
);
18 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
19 gchar
*rname
, RrAppearance
*value
,
20 gboolean allow_trans
);
21 static void set_default_appearance(RrAppearance
*a
);
23 RrTheme
* RrThemeNew(const RrInstance
*inst
, gchar
*name
)
25 XrmDatabase db
= NULL
;
26 RrJustify winjust
, mtitlejust
, mjust
;
31 theme
= g_new0(RrTheme
, 1);
35 theme
->a_disabled_focused_max
= RrAppearanceNew(inst
, 1);
36 theme
->a_disabled_unfocused_max
= RrAppearanceNew(inst
, 1);
37 theme
->a_hover_focused_max
= RrAppearanceNew(inst
, 1);
38 theme
->a_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
39 theme
->a_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
40 theme
->a_focused_pressed_max
= RrAppearanceNew(inst
, 1);
41 theme
->a_focused_pressed_set_max
= RrAppearanceNew(inst
, 1);
42 theme
->a_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
43 theme
->a_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
44 theme
->a_unfocused_pressed_set_max
= RrAppearanceNew(inst
, 1);
45 theme
->a_focused_grip
= RrAppearanceNew(inst
, 0);
46 theme
->a_unfocused_grip
= RrAppearanceNew(inst
, 0);
47 theme
->a_focused_title
= RrAppearanceNew(inst
, 0);
48 theme
->a_unfocused_title
= RrAppearanceNew(inst
, 0);
49 theme
->a_focused_label
= RrAppearanceNew(inst
, 1);
50 theme
->a_unfocused_label
= RrAppearanceNew(inst
, 1);
51 theme
->a_icon
= RrAppearanceNew(inst
, 1);
52 theme
->a_focused_handle
= RrAppearanceNew(inst
, 0);
53 theme
->a_unfocused_handle
= RrAppearanceNew(inst
, 0);
54 theme
->a_menu
= RrAppearanceNew(inst
, 0);
55 theme
->a_menu_title
= RrAppearanceNew(inst
, 1);
56 theme
->a_menu_item
= RrAppearanceNew(inst
, 1);
57 theme
->a_menu_disabled
= RrAppearanceNew(inst
, 1);
58 theme
->a_menu_hilite
= RrAppearanceNew(inst
, 1);
60 theme
->app_hilite_bg
= RrAppearanceNew(inst
, 0);
61 theme
->app_unhilite_bg
= RrAppearanceNew(inst
, 0);
62 theme
->app_hilite_label
= RrAppearanceNew(inst
, 1);
63 theme
->app_unhilite_label
= RrAppearanceNew(inst
, 1);
64 theme
->app_icon
= RrAppearanceNew(inst
, 1);
67 db
= loaddb(theme
, name
);
69 g_warning("Failed to load the theme '%s'\n"
70 "Falling back to the default: '%s'",
73 theme
->name
= g_path_get_basename(name
);
76 db
= loaddb(theme
, DEFAULT_THEME
);
78 g_warning("Failed to load the theme '%s'.", DEFAULT_THEME
);
81 theme
->name
= g_path_get_basename(DEFAULT_THEME
);
84 /* load the font stuff */
85 if (!read_string(db
, "window.title.xftfont", &font_str
))
86 font_str
= "arial,sans:bold:pixelsize=10:shadow=y:shadowtint=50";
88 if (!(theme
->winfont
= RrFontOpen(inst
, font_str
))) {
92 theme
->winfont_height
= RrFontHeight(theme
->winfont
);
94 winjust
= RR_JUSTIFY_LEFT
;
95 if (read_string(db
, "window.justify", &str
)) {
96 if (!g_ascii_strcasecmp(str
, "right"))
97 winjust
= RR_JUSTIFY_RIGHT
;
98 else if (!g_ascii_strcasecmp(str
, "center"))
99 winjust
= RR_JUSTIFY_CENTER
;
102 if (!read_string(db
, "menu.title.xftfont", &font_str
))
103 font_str
= "arial,sans:bold:pixelsize=12:shadow=y";
105 if (!(theme
->mtitlefont
= RrFontOpen(inst
, font_str
))) {
109 theme
->mtitlefont_height
= RrFontHeight(theme
->mtitlefont
);
111 mtitlejust
= RR_JUSTIFY_LEFT
;
112 if (read_string(db
, "menu.title.justify", &str
)) {
113 if (!g_ascii_strcasecmp(str
, "right"))
114 mtitlejust
= RR_JUSTIFY_RIGHT
;
115 else if (!g_ascii_strcasecmp(str
, "center"))
116 mtitlejust
= RR_JUSTIFY_CENTER
;
119 if (!read_string(db
, "menu.frame.xftfont", &font_str
))
120 font_str
= "arial,sans:bold:pixelsize=11:shadow=y";
122 if (!(theme
->mfont
= RrFontOpen(inst
, font_str
))) {
126 theme
->mfont_height
= RrFontHeight(theme
->mfont
);
128 mjust
= RR_JUSTIFY_LEFT
;
129 if (read_string(db
, "menu.frame.justify", &str
)) {
130 if (!g_ascii_strcasecmp(str
, "right"))
131 mjust
= RR_JUSTIFY_RIGHT
;
132 else if (!g_ascii_strcasecmp(str
, "center"))
133 mjust
= RR_JUSTIFY_CENTER
;
136 /* load the title layout */
137 if (!read_string(db
, "window.title.layout", &font_str
))
139 theme
->title_layout
= g_strdup(font_str
);
141 /* load direct dimensions */
142 if (!read_int(db
, "menuOverlap", &theme
->menu_overlap
) ||
143 theme
->menu_overlap
< 0 || theme
->menu_overlap
> 20)
144 theme
->handle_height
= 0;
145 if (!read_int(db
, "handleWidth", &theme
->handle_height
) ||
146 theme
->handle_height
< 0 || theme
->handle_height
> 100)
147 theme
->handle_height
= 6;
148 if (!read_int(db
, "bevelWidth", &theme
->bevel
) ||
149 theme
->bevel
<= 0 || theme
->bevel
> 100) theme
->bevel
= 3;
150 if (!read_int(db
, "borderWidth", &theme
->bwidth
) ||
151 theme
->bwidth
< 0 || theme
->bwidth
> 100) theme
->bwidth
= 1;
152 if (!read_int(db
, "frameWidth", &theme
->cbwidth
) ||
153 theme
->cbwidth
< 0 || theme
->cbwidth
> 100)
154 theme
->cbwidth
= theme
->bevel
;
157 if (!read_color(db
, inst
,
158 "borderColor", &theme
->b_color
))
159 theme
->b_color
= RrColorNew(inst
, 0, 0, 0);
160 if (!read_color(db
, inst
,
161 "window.frame.focusColor", &theme
->cb_focused_color
))
162 theme
->cb_focused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
163 if (!read_color(db
, inst
,
164 "window.frame.unfocusColor",&theme
->cb_unfocused_color
))
165 theme
->cb_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
166 if (!read_color(db
, inst
,
167 "window.label.focus.textColor",
168 &theme
->title_focused_color
))
169 theme
->title_focused_color
= RrColorNew(inst
, 0x0, 0x0, 0x0);
170 if (!read_color(db
, inst
,
171 "window.label.unfocus.textColor",
172 &theme
->title_unfocused_color
))
173 theme
->title_unfocused_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
174 if (!read_color(db
, inst
,
175 "window.button.focus.picColor",
176 &theme
->titlebut_focused_unpressed_color
))
177 theme
->titlebut_focused_unpressed_color
= RrColorNew(inst
, 0, 0, 0);
178 if (!read_color(db
, inst
,
179 "window.button.unfocus.picColor",
180 &theme
->titlebut_unfocused_unpressed_color
))
181 theme
->titlebut_unfocused_unpressed_color
=
182 RrColorNew(inst
, 0xff, 0xff, 0xff);
183 if (!read_color(db
, inst
,
184 "window.button.pressed.focus.picColor",
185 &theme
->titlebut_focused_pressed_color
))
186 theme
->titlebut_focused_pressed_color
=
187 theme
->titlebut_focused_unpressed_color
;
188 if (!read_color(db
, inst
,
189 "window.button.pressed.unfocus.picColor",
190 &theme
->titlebut_unfocused_pressed_color
))
191 theme
->titlebut_unfocused_pressed_color
=
192 theme
->titlebut_unfocused_unpressed_color
;
193 if (!read_color(db
, inst
,
194 "window.button.disabled.focus.picColor",
195 &theme
->titlebut_disabled_focused_color
))
196 theme
->titlebut_disabled_focused_color
=
197 RrColorNew(inst
, 0xff, 0xff, 0xff);
198 if (!read_color(db
, inst
,
199 "window.button.disabled.unfocus.picColor",
200 &theme
->titlebut_disabled_unfocused_color
))
201 theme
->titlebut_hover_unfocused_color
= RrColorNew(inst
, 0, 0, 0);
202 if (!read_color(db
, inst
,
203 "window.button.hover.focus.picColor",
204 &theme
->titlebut_hover_focused_color
))
205 theme
->titlebut_hover_focused_color
=
206 theme
->titlebut_focused_unpressed_color
;
207 if (!read_color(db
, inst
,
208 "window.button.hover.unfocus.picColor",
209 &theme
->titlebut_hover_unfocused_color
))
210 theme
->titlebut_hover_unfocused_color
=
211 theme
->titlebut_unfocused_unpressed_color
;
212 if (!read_color(db
, inst
,
213 "menu.title.textColor", &theme
->menu_title_color
))
214 theme
->menu_title_color
= RrColorNew(inst
, 0, 0, 0);
215 if (!read_color(db
, inst
,
216 "menu.frame.textColor", &theme
->menu_color
))
217 theme
->menu_color
= RrColorNew(inst
, 0xff, 0xff, 0xff);
218 if (!read_color(db
, inst
,
219 "menu.frame.disableColor", &theme
->menu_disabled_color
))
220 theme
->menu_disabled_color
= RrColorNew(inst
, 0, 0, 0);
221 if (!read_color(db
, inst
,
222 "menu.hilite.textColor", &theme
->menu_hilite_color
))
223 theme
->menu_hilite_color
= RrColorNew(inst
, 0, 0, 0);
225 if (read_mask(inst
, "max.xbm", theme
, &theme
->max_unset_mask
)){
226 if (!read_mask(inst
, "max_t.xbm", theme
, &theme
->max_set_mask
)) {
227 theme
->max_set_mask
= RrPixmapMaskCopy(theme
->max_unset_mask
);
231 char data
[] = { 0x7f, 0x7f, 0x7f, 0x41, 0x41, 0x41, 0x7f };
232 theme
->max_unset_mask
= RrPixmapMaskNew(inst
, 7, 7, data
);
235 char data
[] = { 0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f };
236 theme
->max_set_mask
= RrPixmapMaskNew(inst
, 7, 7, data
);
240 if (!read_mask(inst
, "iconify.xbm", theme
, &theme
->iconify_mask
)) {
241 char data
[] = { 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f };
242 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 7, 7, data
);
245 if (read_mask(inst
, "stick.xbm", theme
, &theme
->desk_unset_mask
)) {
246 if (!read_mask(inst
, "stick_t.xbm", theme
, &theme
->desk_set_mask
)) {
247 theme
->desk_set_mask
=
248 RrPixmapMaskCopy(theme
->desk_unset_mask
);
252 char data
[] = { 0x63, 0x63, 0x00, 0x00, 0x00, 0x63, 0x63 };
253 theme
->desk_unset_mask
= RrPixmapMaskNew(inst
, 7, 7, data
);
256 char data
[] = { 0x00, 0x36, 0x36, 0x08, 0x36, 0x36, 0x00 };
257 theme
->desk_set_mask
= RrPixmapMaskNew(inst
, 7, 7, data
);
261 if (read_mask(inst
, "shade.xbm", theme
, &theme
->shade_unset_mask
)) {
262 if (!read_mask(inst
, "shade_t.xbm", theme
, &theme
->shade_set_mask
)) {
263 theme
->shade_set_mask
=
264 RrPixmapMaskCopy(theme
->shade_unset_mask
);
268 char data
[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00 };
269 theme
->shade_unset_mask
= RrPixmapMaskNew(inst
, 7, 7, data
);
272 char data
[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x7f };
273 theme
->shade_set_mask
= RrPixmapMaskNew(inst
, 7, 7, data
);
277 if (!read_mask(inst
, "close.xbm", theme
, &theme
->close_mask
)) {
278 char data
[] = { 0x63, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x63 };
279 theme
->close_mask
= RrPixmapMaskNew(inst
, 7, 7, data
);
282 /* read the decoration textures */
283 if (!read_appearance(db
, inst
,
284 "window.title.focus", theme
->a_focused_title
,
286 set_default_appearance(theme
->a_focused_title
);
287 if (!read_appearance(db
, inst
,
288 "window.title.unfocus", theme
->a_unfocused_title
,
290 set_default_appearance(theme
->a_unfocused_title
);
291 if (!read_appearance(db
, inst
,
292 "window.label.focus", theme
->a_focused_label
,
294 set_default_appearance(theme
->a_focused_label
);
295 if (!read_appearance(db
, inst
,
296 "window.label.unfocus", theme
->a_unfocused_label
,
298 set_default_appearance(theme
->a_unfocused_label
);
299 if (!read_appearance(db
, inst
,
300 "window.handle.focus", theme
->a_focused_handle
,
302 set_default_appearance(theme
->a_focused_handle
);
303 if (!read_appearance(db
, inst
,
304 "window.handle.unfocus",theme
->a_unfocused_handle
,
306 set_default_appearance(theme
->a_unfocused_handle
);
307 if (!read_appearance(db
, inst
,
308 "window.grip.focus", theme
->a_focused_grip
,
310 set_default_appearance(theme
->a_focused_grip
);
311 if (!read_appearance(db
, inst
,
312 "window.grip.unfocus", theme
->a_unfocused_grip
,
314 set_default_appearance(theme
->a_unfocused_grip
);
315 if (!read_appearance(db
, inst
,
316 "menu.frame", theme
->a_menu
,
318 set_default_appearance(theme
->a_menu
);
319 if (!read_appearance(db
, inst
,
320 "menu.title", theme
->a_menu_title
,
322 set_default_appearance(theme
->a_menu_title
);
323 if (!read_appearance(db
, inst
,
324 "menu.hilite", theme
->a_menu_hilite
,
326 set_default_appearance(theme
->a_menu_hilite
);
328 /* read the appearances for rendering non-decorations */
329 if (!read_appearance(db
, inst
,
330 "window.title.focus", theme
->app_hilite_bg
,
332 set_default_appearance(theme
->app_hilite_bg
);
333 if (!read_appearance(db
, inst
,
334 "window.label.focus", theme
->app_hilite_label
,
336 set_default_appearance(theme
->app_hilite_label
);
337 if (!read_appearance(db
, inst
,
338 "window.title.unfocus", theme
->app_unhilite_bg
,
340 set_default_appearance(theme
->app_unhilite_bg
);
341 if (!read_appearance(db
, inst
,
342 "window.label.unfocus", theme
->app_unhilite_label
,
344 set_default_appearance(theme
->app_unhilite_label
);
346 /* read buttons textures */
347 if (!read_appearance(db
, inst
,
348 "window.button.disabled.focus",
349 theme
->a_disabled_focused_max
,
351 set_default_appearance(theme
->a_disabled_focused_max
);
352 if (!read_appearance(db
, inst
,
353 "window.button.disabled.unfocus",
354 theme
->a_disabled_unfocused_max
,
356 set_default_appearance(theme
->a_disabled_unfocused_max
);
357 if (!read_appearance(db
, inst
,
358 "window.button.pressed.focus",
359 theme
->a_focused_pressed_max
,
361 if (!read_appearance(db
, inst
,
362 "window.button.pressed",
363 theme
->a_focused_pressed_max
,
365 set_default_appearance(theme
->a_focused_pressed_max
);
366 if (!read_appearance(db
, inst
,
367 "window.button.pressed.unfocus",
368 theme
->a_unfocused_pressed_max
,
370 if (!read_appearance(db
, inst
,
371 "window.button.pressed",
372 theme
->a_unfocused_pressed_max
,
374 set_default_appearance(theme
->a_unfocused_pressed_max
);
375 if (!read_appearance(db
, inst
,
376 "window.button.focus",
377 theme
->a_focused_unpressed_max
,
379 set_default_appearance(theme
->a_focused_unpressed_max
);
380 if (!read_appearance(db
, inst
,
381 "window.button.unfocus",
382 theme
->a_unfocused_unpressed_max
,
384 set_default_appearance(theme
->a_unfocused_unpressed_max
);
385 if (!read_appearance(db
, inst
,
386 "window.button.hover.focus",
387 theme
->a_hover_focused_max
,
389 theme
->a_hover_focused_max
=
390 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
391 if (!read_appearance(db
, inst
,
392 "window.button.hover.unfocus",
393 theme
->a_hover_unfocused_max
,
395 theme
->a_hover_unfocused_max
=
396 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
398 theme
->a_disabled_focused_close
=
399 RrAppearanceCopy(theme
->a_disabled_focused_max
);
400 theme
->a_disabled_unfocused_close
=
401 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
402 theme
->a_hover_focused_close
=
403 RrAppearanceCopy(theme
->a_hover_focused_max
);
404 theme
->a_hover_unfocused_close
=
405 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
406 theme
->a_unfocused_unpressed_close
=
407 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
408 theme
->a_unfocused_pressed_close
=
409 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
410 theme
->a_focused_unpressed_close
=
411 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
412 theme
->a_focused_pressed_close
=
413 RrAppearanceCopy(theme
->a_focused_pressed_max
);
414 theme
->a_disabled_focused_desk
=
415 RrAppearanceCopy(theme
->a_disabled_focused_max
);
416 theme
->a_disabled_unfocused_desk
=
417 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
418 theme
->a_hover_focused_desk
=
419 RrAppearanceCopy(theme
->a_hover_focused_max
);
420 theme
->a_hover_unfocused_desk
=
421 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
422 theme
->a_unfocused_unpressed_desk
=
423 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
424 theme
->a_unfocused_pressed_desk
=
425 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
426 theme
->a_unfocused_pressed_set_desk
=
427 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
428 theme
->a_focused_unpressed_desk
=
429 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
430 theme
->a_focused_pressed_desk
=
431 RrAppearanceCopy(theme
->a_focused_pressed_max
);
432 theme
->a_focused_pressed_set_desk
=
433 RrAppearanceCopy(theme
->a_focused_pressed_max
);
434 theme
->a_disabled_focused_shade
=
435 RrAppearanceCopy(theme
->a_disabled_focused_max
);
436 theme
->a_disabled_unfocused_shade
=
437 RrAppearanceCopy(theme
->a_disabled_unfocused_max
);
438 theme
->a_hover_focused_shade
=
439 RrAppearanceCopy(theme
->a_hover_focused_max
);
440 theme
->a_hover_unfocused_shade
=
441 RrAppearanceCopy(theme
->a_hover_unfocused_max
);
442 theme
->a_unfocused_unpressed_shade
=
443 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
444 theme
->a_unfocused_pressed_shade
=
445 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
446 theme
->a_unfocused_pressed_set_shade
=
447 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
448 theme
->a_focused_unpressed_shade
=
449 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
450 theme
->a_focused_pressed_shade
=
451 RrAppearanceCopy(theme
->a_focused_pressed_max
);
452 theme
->a_focused_pressed_set_shade
=
453 RrAppearanceCopy(theme
->a_focused_pressed_max
);
454 theme
->a_disabled_focused_iconify
=
455 RrAppearanceCopy(theme
->a_disabled_focused_max
);
456 theme
->a_disabled_unfocused_iconify
=
457 RrAppearanceCopy(theme
->a_disabled_focused_max
);
458 theme
->a_hover_focused_iconify
=
459 RrAppearanceCopy(theme
->a_hover_focused_max
);
460 theme
->a_hover_unfocused_iconify
=
461 RrAppearanceCopy(theme
->a_hover_focused_max
);
462 theme
->a_unfocused_unpressed_iconify
=
463 RrAppearanceCopy(theme
->a_unfocused_unpressed_max
);
464 theme
->a_unfocused_pressed_iconify
=
465 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
466 theme
->a_focused_unpressed_iconify
=
467 RrAppearanceCopy(theme
->a_focused_unpressed_max
);
468 theme
->a_focused_pressed_iconify
=
469 RrAppearanceCopy(theme
->a_focused_pressed_max
);
470 theme
->a_unfocused_pressed_set_max
=
471 RrAppearanceCopy(theme
->a_unfocused_pressed_max
);
472 theme
->a_focused_pressed_set_max
=
473 RrAppearanceCopy(theme
->a_focused_pressed_max
);
475 theme
->a_icon
->surface
.grad
= RR_SURFACE_PARENTREL
;
477 /* set up the textures */
478 theme
->a_focused_label
->texture
[0].type
=
479 theme
->app_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
480 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
481 theme
->app_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
482 theme
->a_focused_label
->texture
[0].data
.text
.font
=
483 theme
->app_hilite_label
->texture
[0].data
.text
.font
= theme
->winfont
;
484 theme
->a_focused_label
->texture
[0].data
.text
.color
=
485 theme
->app_hilite_label
->texture
[0].data
.text
.color
=
486 theme
->title_focused_color
;
488 theme
->a_unfocused_label
->texture
[0].type
=
489 theme
->app_unhilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
490 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
491 theme
->app_unhilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
492 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
493 theme
->app_unhilite_label
->texture
[0].data
.text
.font
= theme
->winfont
;
494 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
495 theme
->app_unhilite_label
->texture
[0].data
.text
.color
=
496 theme
->title_unfocused_color
;
498 theme
->a_menu_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
499 theme
->a_menu_title
->texture
[0].data
.text
.justify
= mtitlejust
;
500 theme
->a_menu_title
->texture
[0].data
.text
.font
= theme
->mtitlefont
;
501 theme
->a_menu_title
->texture
[0].data
.text
.color
= theme
->menu_title_color
;
503 theme
->a_menu_item
->surface
.grad
=
504 theme
->a_menu_disabled
->surface
.grad
=
505 theme
->app_icon
->surface
.grad
= RR_SURFACE_PARENTREL
;
507 theme
->a_menu_item
->texture
[0].type
=
508 theme
->a_menu_disabled
->texture
[0].type
=
509 theme
->a_menu_hilite
->texture
[0].type
= RR_TEXTURE_TEXT
;
510 theme
->a_menu_item
->texture
[0].data
.text
.justify
=
511 theme
->a_menu_disabled
->texture
[0].data
.text
.justify
=
512 theme
->a_menu_hilite
->texture
[0].data
.text
.justify
= mjust
;
513 theme
->a_menu_item
->texture
[0].data
.text
.font
=
514 theme
->a_menu_disabled
->texture
[0].data
.text
.font
=
515 theme
->a_menu_hilite
->texture
[0].data
.text
.font
= theme
->mfont
;
516 theme
->a_menu_item
->texture
[0].data
.text
.color
= theme
->menu_color
;
517 theme
->a_menu_disabled
->texture
[0].data
.text
.color
=
518 theme
->menu_disabled_color
;
519 theme
->a_menu_hilite
->texture
[0].data
.text
.color
=
520 theme
->menu_hilite_color
;
522 theme
->a_disabled_focused_max
->texture
[0].type
=
523 theme
->a_disabled_unfocused_max
->texture
[0].type
=
524 theme
->a_hover_focused_max
->texture
[0].type
=
525 theme
->a_hover_unfocused_max
->texture
[0].type
=
526 theme
->a_focused_unpressed_max
->texture
[0].type
=
527 theme
->a_focused_pressed_max
->texture
[0].type
=
528 theme
->a_focused_pressed_set_max
->texture
[0].type
=
529 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
530 theme
->a_unfocused_pressed_max
->texture
[0].type
=
531 theme
->a_unfocused_pressed_set_max
->texture
[0].type
=
532 theme
->a_disabled_focused_close
->texture
[0].type
=
533 theme
->a_disabled_unfocused_close
->texture
[0].type
=
534 theme
->a_hover_focused_close
->texture
[0].type
=
535 theme
->a_hover_unfocused_close
->texture
[0].type
=
536 theme
->a_focused_unpressed_close
->texture
[0].type
=
537 theme
->a_focused_pressed_close
->texture
[0].type
=
538 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
539 theme
->a_unfocused_pressed_close
->texture
[0].type
=
540 theme
->a_disabled_focused_desk
->texture
[0].type
=
541 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
542 theme
->a_hover_focused_desk
->texture
[0].type
=
543 theme
->a_hover_unfocused_desk
->texture
[0].type
=
544 theme
->a_focused_unpressed_desk
->texture
[0].type
=
545 theme
->a_focused_pressed_desk
->texture
[0].type
=
546 theme
->a_focused_pressed_set_desk
->texture
[0].type
=
547 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
548 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
549 theme
->a_unfocused_pressed_set_desk
->texture
[0].type
=
550 theme
->a_disabled_focused_shade
->texture
[0].type
=
551 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
552 theme
->a_hover_focused_shade
->texture
[0].type
=
553 theme
->a_hover_unfocused_shade
->texture
[0].type
=
554 theme
->a_focused_unpressed_shade
->texture
[0].type
=
555 theme
->a_focused_pressed_shade
->texture
[0].type
=
556 theme
->a_focused_pressed_set_shade
->texture
[0].type
=
557 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
558 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
559 theme
->a_unfocused_pressed_set_shade
->texture
[0].type
=
560 theme
->a_disabled_focused_iconify
->texture
[0].type
=
561 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
562 theme
->a_hover_focused_iconify
->texture
[0].type
=
563 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
564 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
565 theme
->a_focused_pressed_iconify
->texture
[0].type
=
566 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
567 theme
->a_unfocused_pressed_iconify
->texture
[0].type
= RR_TEXTURE_MASK
;
568 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
569 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
570 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
571 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
572 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
573 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
574 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
575 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
576 theme
->max_unset_mask
;
577 theme
->a_focused_pressed_set_max
->texture
[0].data
.mask
.mask
=
578 theme
->a_unfocused_pressed_set_max
->texture
[0].data
.mask
.mask
=
580 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
581 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
582 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
583 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
584 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
585 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
586 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
587 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
589 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
590 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
591 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
592 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
593 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
594 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
595 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
596 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
597 theme
->desk_unset_mask
;
598 theme
->a_focused_pressed_set_desk
->texture
[0].data
.mask
.mask
=
599 theme
->a_unfocused_pressed_set_desk
->texture
[0].data
.mask
.mask
=
600 theme
->desk_set_mask
;
601 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
602 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
603 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
604 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
605 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
606 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
607 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
608 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
609 theme
->shade_unset_mask
;
610 theme
->a_focused_pressed_set_shade
->texture
[0].data
.mask
.mask
=
611 theme
->a_unfocused_pressed_set_shade
->texture
[0].data
.mask
.mask
=
612 theme
->shade_set_mask
;
613 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
614 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
615 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
616 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
617 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
618 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
619 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
620 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
622 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
623 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
624 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
625 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
626 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
627 theme
->titlebut_disabled_focused_color
;
628 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
629 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
630 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
631 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
632 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
633 theme
->titlebut_disabled_unfocused_color
;
634 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
635 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
636 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
637 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
638 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
639 theme
->titlebut_hover_focused_color
;
640 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
641 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
642 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
643 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
644 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
645 theme
->titlebut_hover_unfocused_color
;
646 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
647 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
648 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
649 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
650 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
651 theme
->titlebut_focused_unpressed_color
;
652 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
653 theme
->a_focused_pressed_set_max
->texture
[0].data
.mask
.color
=
654 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
655 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
656 theme
->a_focused_pressed_set_desk
->texture
[0].data
.mask
.color
=
657 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
658 theme
->a_focused_pressed_set_shade
->texture
[0].data
.mask
.color
=
659 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
660 theme
->titlebut_focused_pressed_color
;
661 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
662 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
663 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
664 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
665 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
666 theme
->titlebut_unfocused_unpressed_color
;
667 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
668 theme
->a_unfocused_pressed_set_max
->texture
[0].data
.mask
.color
=
669 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
670 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
671 theme
->a_unfocused_pressed_set_desk
->texture
[0].data
.mask
.color
=
672 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
673 theme
->a_unfocused_pressed_set_shade
->texture
[0].data
.mask
.color
=
674 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
675 theme
->titlebut_unfocused_pressed_color
;
677 XrmDestroyDatabase(db
);
679 theme
->label_height
= theme
->winfont_height
;
680 theme
->title_height
= theme
->label_height
+ theme
->bevel
* 2;
681 theme
->button_size
= theme
->label_height
- 2;
682 theme
->grip_width
= theme
->button_size
* 2;
687 void RrThemeFree(RrTheme
*theme
)
692 RrColorFree(theme
->b_color
);
693 RrColorFree(theme
->cb_unfocused_color
);
694 RrColorFree(theme
->cb_focused_color
);
695 RrColorFree(theme
->title_unfocused_color
);
696 RrColorFree(theme
->title_focused_color
);
697 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
698 RrColorFree(theme
->titlebut_focused_pressed_color
);
699 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
700 RrColorFree(theme
->titlebut_focused_unpressed_color
);
701 RrColorFree(theme
->menu_color
);
702 RrColorFree(theme
->menu_title_color
);
703 RrColorFree(theme
->menu_disabled_color
);
704 RrColorFree(theme
->menu_hilite_color
);
706 RrPixmapMaskFree(theme
->max_set_mask
);
707 RrPixmapMaskFree(theme
->max_unset_mask
);
708 RrPixmapMaskFree(theme
->desk_set_mask
);
709 RrPixmapMaskFree(theme
->desk_unset_mask
);
710 RrPixmapMaskFree(theme
->shade_set_mask
);
711 RrPixmapMaskFree(theme
->shade_unset_mask
);
712 RrPixmapMaskFree(theme
->iconify_mask
);
713 RrPixmapMaskFree(theme
->close_mask
);
715 RrFontClose(theme
->winfont
);
716 RrFontClose(theme
->mtitlefont
);
717 RrFontClose(theme
->mfont
);
719 g_free(theme
->title_layout
);
721 RrAppearanceFree(theme
->a_disabled_focused_max
);
722 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
723 RrAppearanceFree(theme
->a_hover_focused_max
);
724 RrAppearanceFree(theme
->a_hover_unfocused_max
);
725 RrAppearanceFree(theme
->a_focused_unpressed_max
);
726 RrAppearanceFree(theme
->a_focused_pressed_max
);
727 RrAppearanceFree(theme
->a_focused_pressed_set_max
);
728 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
729 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
730 RrAppearanceFree(theme
->a_unfocused_pressed_set_max
);
731 RrAppearanceFree(theme
->a_disabled_focused_close
);
732 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
733 RrAppearanceFree(theme
->a_hover_focused_close
);
734 RrAppearanceFree(theme
->a_hover_unfocused_close
);
735 RrAppearanceFree(theme
->a_focused_unpressed_close
);
736 RrAppearanceFree(theme
->a_focused_pressed_close
);
737 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
738 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
739 RrAppearanceFree(theme
->a_disabled_focused_desk
);
740 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
741 RrAppearanceFree(theme
->a_hover_focused_desk
);
742 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
743 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
744 RrAppearanceFree(theme
->a_focused_pressed_desk
);
745 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
746 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
747 RrAppearanceFree(theme
->a_disabled_focused_shade
);
748 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
749 RrAppearanceFree(theme
->a_hover_focused_shade
);
750 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
751 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
752 RrAppearanceFree(theme
->a_focused_pressed_shade
);
753 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
754 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
755 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
756 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
757 RrAppearanceFree(theme
->a_hover_focused_iconify
);
758 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
759 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
760 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
761 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
762 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
763 RrAppearanceFree(theme
->a_focused_grip
);
764 RrAppearanceFree(theme
->a_unfocused_grip
);
765 RrAppearanceFree(theme
->a_focused_title
);
766 RrAppearanceFree(theme
->a_unfocused_title
);
767 RrAppearanceFree(theme
->a_focused_label
);
768 RrAppearanceFree(theme
->a_unfocused_label
);
769 RrAppearanceFree(theme
->a_icon
);
770 RrAppearanceFree(theme
->a_focused_handle
);
771 RrAppearanceFree(theme
->a_unfocused_handle
);
772 RrAppearanceFree(theme
->a_menu
);
773 RrAppearanceFree(theme
->a_menu_title
);
774 RrAppearanceFree(theme
->a_menu_item
);
775 RrAppearanceFree(theme
->a_menu_disabled
);
776 RrAppearanceFree(theme
->a_menu_hilite
);
777 RrAppearanceFree(theme
->app_hilite_bg
);
778 RrAppearanceFree(theme
->app_unhilite_bg
);
779 RrAppearanceFree(theme
->app_hilite_label
);
780 RrAppearanceFree(theme
->app_unhilite_label
);
781 RrAppearanceFree(theme
->app_icon
);
785 static XrmDatabase
loaddb(RrTheme
*theme
, char *name
)
789 if ((db
= XrmGetFileDatabase(name
)))
790 theme
->path
= g_path_get_dirname(name
);
792 char *s
= g_build_filename(g_get_home_dir(), ".openbox", "themes",
794 if ((db
= XrmGetFileDatabase(s
)))
795 theme
->path
= g_path_get_dirname(s
);
799 char *s
= g_build_filename(THEMEDIR
, name
, NULL
);
800 if ((db
= XrmGetFileDatabase(s
)))
801 theme
->path
= g_path_get_dirname(s
);
808 static char *create_class_name(char *rname
)
810 char *rclass
= g_strdup(rname
);
815 p
= strchr(p
+1, '.');
816 if (p
== NULL
) break;
818 if (*p
== '\0') break;
823 static gboolean
read_int(XrmDatabase db
, char *rname
, int *value
)
825 gboolean ret
= FALSE
;
826 char *rclass
= create_class_name(rname
);
830 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
831 retvalue
.addr
!= NULL
) {
832 *value
= (int)strtol(retvalue
.addr
, &end
, 10);
833 if (end
!= retvalue
.addr
)
841 static gboolean
read_string(XrmDatabase db
, char *rname
, char **value
)
843 gboolean ret
= FALSE
;
844 char *rclass
= create_class_name(rname
);
848 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
849 retvalue
.addr
!= NULL
) {
850 *value
= retvalue
.addr
;
858 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
859 gchar
*rname
, RrColor
**value
)
861 gboolean ret
= FALSE
;
862 char *rclass
= create_class_name(rname
);
866 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
867 retvalue
.addr
!= NULL
) {
868 RrColor
*c
= RrColorParse(inst
, retvalue
.addr
);
879 static gboolean
read_mask(const RrInstance
*inst
,
880 gchar
*maskname
, RrTheme
*theme
,
881 RrPixmapMask
**value
)
883 gboolean ret
= FALSE
;
886 int hx
, hy
; /* ignored */
890 data_dir
= g_strdup_printf("%s_data", theme
->name
);
892 s
= g_build_filename(g_get_home_dir(), ".openbox", "themes",
893 data_dir
, maskname
, NULL
);
894 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
)
898 s
= g_build_filename(THEMEDIR
, data_dir
, maskname
, NULL
);
899 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
)
903 s
= g_build_filename(theme
->path
, data_dir
, maskname
, NULL
);
904 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
)
910 *value
= RrPixmapMaskNew(inst
, w
, h
, (char*)b
);
920 static void parse_appearance(gchar
*tex
, RrSurfaceColorType
*grad
,
921 RrReliefType
*relief
, RrBevelType
*bevel
,
922 gboolean
*interlaced
, gboolean
*border
,
923 gboolean allow_trans
)
927 /* convert to all lowercase */
928 for (t
= tex
; *t
!= '\0'; ++t
)
929 *t
= g_ascii_tolower(*t
);
931 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
932 *grad
= RR_SURFACE_PARENTREL
;
934 if (strstr(tex
, "gradient") != NULL
) {
935 if (strstr(tex
, "crossdiagonal") != NULL
)
936 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
937 else if (strstr(tex
, "pyramid") != NULL
)
938 *grad
= RR_SURFACE_PYRAMID
;
939 else if (strstr(tex
, "horizontal") != NULL
)
940 *grad
= RR_SURFACE_HORIZONTAL
;
941 else if (strstr(tex
, "vertical") != NULL
)
942 *grad
= RR_SURFACE_VERTICAL
;
944 *grad
= RR_SURFACE_DIAGONAL
;
946 *grad
= RR_SURFACE_SOLID
;
949 if (strstr(tex
, "sunken") != NULL
)
950 *relief
= RR_RELIEF_SUNKEN
;
951 else if (strstr(tex
, "flat") != NULL
)
952 *relief
= RR_RELIEF_FLAT
;
954 *relief
= RR_RELIEF_RAISED
;
957 if (*relief
== RR_RELIEF_FLAT
) {
958 if (strstr(tex
, "border") != NULL
)
961 if (strstr(tex
, "bevel2") != NULL
)
967 if (strstr(tex
, "interlaced") != NULL
)
975 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
976 gchar
*rname
, RrAppearance
*value
,
977 gboolean allow_trans
)
979 gboolean ret
= FALSE
;
980 char *rclass
= create_class_name(rname
), *cname
, *ctoname
, *bcname
;
984 cname
= g_strconcat(rname
, ".color", NULL
);
985 ctoname
= g_strconcat(rname
, ".colorTo", NULL
);
986 bcname
= g_strconcat(rname
, ".borderColor", NULL
);
988 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
989 retvalue
.addr
!= NULL
) {
990 parse_appearance(retvalue
.addr
,
991 &value
->surface
.grad
,
992 &value
->surface
.relief
,
993 &value
->surface
.bevel
,
994 &value
->surface
.interlaced
,
995 &value
->surface
.border
,
997 if (!read_color(db
, inst
, cname
, &value
->surface
.primary
))
998 value
->surface
.primary
= RrColorNew(inst
, 0, 0, 0);
999 if (!read_color(db
, inst
, ctoname
, &value
->surface
.secondary
))
1000 value
->surface
.secondary
= RrColorNew(inst
, 0, 0, 0);
1001 if (value
->surface
.border
)
1002 if (!read_color(db
, inst
, bcname
,
1003 &value
->surface
.border_color
))
1004 value
->surface
.border_color
= RrColorNew(inst
, 0, 0, 0);
1015 static void set_default_appearance(RrAppearance
*a
)
1017 a
->surface
.grad
= RR_SURFACE_SOLID
;
1018 a
->surface
.relief
= RR_RELIEF_FLAT
;
1019 a
->surface
.bevel
= RR_BEVEL_1
;
1020 a
->surface
.interlaced
= FALSE
;
1021 a
->surface
.border
= FALSE
;
1022 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1023 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);