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
);
48 static void read_button_colors(XrmDatabase db
, const RrInstance
*inst
,
49 const RrTheme
*theme
, RrButton
*btn
,
50 const gchar
*btnname
);
52 static RrFont
*get_font(RrFont
*target
, RrFont
**default_font
,
53 const RrInstance
*inst
)
59 /* Only load the default font once */
61 RrFontRef(*default_font
);
63 *default_font
= RrFontOpenDefault(inst
);
69 #define READ_INT(x_resstr, x_var, x_min, x_max, x_def) \
70 if (!read_int(db, x_resstr, & x_var) || \
71 x_var < x_min || x_var > x_max) \
74 #define READ_COLOR(x_resstr, x_var, x_def) \
75 if (!read_color(db, inst, x_resstr, & x_var)) \
78 #define READ_COLOR_(x_res1, x_res2, x_var, x_def) \
79 if (!read_color(db, inst, x_res1, & x_var) && \
80 !read_color(db, inst, x_res2, & x_var)) \
83 #define READ_MASK_COPY(x_file, x_var, x_copysrc) \
84 if (!read_mask(inst, path, theme, x_file, & x_var)) \
85 x_var = RrPixmapMaskCopy(x_copysrc);
87 #define READ_APPEARANCE(x_resstr, x_var, x_parrel) \
88 if (!read_appearance(db, inst, x_resstr, x_var, x_parrel)) \
89 set_default_appearance(x_var);
91 #define READ_APPEARANCE_COPY(x_resstr, x_var, x_parrel, x_defval) \
92 if (!read_appearance(db, inst, x_resstr, x_var, x_parrel)) {\
93 RrAppearanceFree(x_var); \
94 x_var = RrAppearanceCopy(x_defval); }
96 #define READ_APPEARANCE_COPY_TEXTURES(x_resstr, x_var, x_parrel, x_defval, n_tex) \
97 if (!read_appearance(db, inst, x_resstr, x_var, x_parrel)) {\
98 RrAppearanceFree(x_var); \
99 x_var = RrAppearanceCopy(x_defval); \
100 RrAppearanceRemoveTextures(x_var); \
101 RrAppearanceAddTextures(x_var, 5); }
103 #define READ_APPEARANCE_(x_res1, x_res2, x_var, x_parrel, x_defval) \
104 if (!read_appearance(db, inst, x_res1, x_var, x_parrel) && \
105 !read_appearance(db, inst, x_res2, x_var, x_parrel)) {\
106 RrAppearanceFree(x_var); \
107 x_var = RrAppearanceCopy(x_defval); }
109 RrTheme
* RrThemeNew(const RrInstance
*inst
, const gchar
*name
,
110 gboolean allow_fallback
,
111 RrFont
*active_window_font
, RrFont
*inactive_window_font
,
112 RrFont
*menu_title_font
, RrFont
*menu_item_font
,
113 RrFont
*active_osd_font
, RrFont
*inactive_osd_font
)
115 XrmDatabase db
= NULL
;
116 RrJustify winjust
, mtitlejust
;
119 RrFont
*default_font
= NULL
;
122 gint menu_overlap
= 0;
123 RrAppearance
*a_disabled_focused_tmp
;
124 RrAppearance
*a_disabled_unfocused_tmp
;
125 RrAppearance
*a_hover_focused_tmp
;
126 RrAppearance
*a_hover_unfocused_tmp
;
127 RrAppearance
*a_focused_unpressed_tmp
;
128 RrAppearance
*a_focused_pressed_tmp
;
129 RrAppearance
*a_unfocused_unpressed_tmp
;
130 RrAppearance
*a_unfocused_pressed_tmp
;
131 RrAppearance
*a_toggled_hover_focused_tmp
;
132 RrAppearance
*a_toggled_hover_unfocused_tmp
;
133 RrAppearance
*a_toggled_focused_unpressed_tmp
;
134 RrAppearance
*a_toggled_focused_pressed_tmp
;
135 RrAppearance
*a_toggled_unfocused_unpressed_tmp
;
136 RrAppearance
*a_toggled_unfocused_pressed_tmp
;
139 db
= loaddb(name
, &path
);
141 g_message("Unable to load the theme '%s'", name
);
143 g_message("Falling back to the default theme '%s'",
145 /* fallback to the default theme */
150 if (allow_fallback
) {
151 db
= loaddb(DEFAULT_THEME
, &path
);
153 g_message("Unable to load the theme '%s'", DEFAULT_THEME
);
160 /* initialize temp reading textures */
161 a_disabled_focused_tmp
= RrAppearanceNew(inst
, 1);
162 a_disabled_unfocused_tmp
= RrAppearanceNew(inst
, 1);
163 a_hover_focused_tmp
= RrAppearanceNew(inst
, 1);
164 a_hover_unfocused_tmp
= RrAppearanceNew(inst
, 1);
165 a_toggled_focused_unpressed_tmp
= RrAppearanceNew(inst
, 1);
166 a_toggled_unfocused_unpressed_tmp
= RrAppearanceNew(inst
, 1);
167 a_toggled_hover_focused_tmp
= RrAppearanceNew(inst
, 1);
168 a_toggled_hover_unfocused_tmp
= RrAppearanceNew(inst
, 1);
169 a_toggled_focused_pressed_tmp
= RrAppearanceNew(inst
, 1);
170 a_toggled_unfocused_pressed_tmp
= RrAppearanceNew(inst
, 1);
171 a_focused_unpressed_tmp
= RrAppearanceNew(inst
, 1);
172 a_focused_pressed_tmp
= RrAppearanceNew(inst
, 1);
173 a_unfocused_unpressed_tmp
= RrAppearanceNew(inst
, 1);
174 a_unfocused_pressed_tmp
= RrAppearanceNew(inst
, 1);
176 /* initialize theme */
177 theme
= g_slice_new0(RrTheme
);
180 theme
->name
= g_strdup(name
? name
: DEFAULT_THEME
);
183 theme
->btn_max
= RrButtonNew(inst
);
184 theme
->btn_close
= RrButtonNew(inst
);
185 theme
->btn_desk
= RrButtonNew(inst
);
186 theme
->btn_shade
= RrButtonNew(inst
);
187 theme
->btn_iconify
= RrButtonNew(inst
);
189 /* init appearances */
190 theme
->a_focused_grip
= RrAppearanceNew(inst
, 0);
191 theme
->a_unfocused_grip
= RrAppearanceNew(inst
, 0);
192 theme
->a_focused_title
= RrAppearanceNew(inst
, 0);
193 theme
->a_unfocused_title
= RrAppearanceNew(inst
, 0);
194 theme
->a_focused_label
= RrAppearanceNew(inst
, 1);
195 theme
->a_unfocused_label
= RrAppearanceNew(inst
, 1);
196 theme
->a_icon
= RrAppearanceNew(inst
, 1);
197 theme
->a_focused_handle
= RrAppearanceNew(inst
, 0);
198 theme
->a_unfocused_handle
= RrAppearanceNew(inst
, 0);
199 theme
->a_menu
= RrAppearanceNew(inst
, 0);
200 theme
->a_menu_title
= RrAppearanceNew(inst
, 0);
201 theme
->a_menu_text_title
= RrAppearanceNew(inst
, 1);
202 theme
->a_menu_normal
= RrAppearanceNew(inst
, 0);
203 theme
->a_menu_selected
= RrAppearanceNew(inst
, 0);
204 theme
->a_menu_disabled
= RrAppearanceNew(inst
, 0);
205 /* a_menu_disabled_selected is copied from a_menu_selected */
206 theme
->a_menu_text_normal
= RrAppearanceNew(inst
, 1);
207 theme
->a_menu_text_selected
= RrAppearanceNew(inst
, 1);
208 theme
->a_menu_text_disabled
= RrAppearanceNew(inst
, 1);
209 theme
->a_menu_text_disabled_selected
= RrAppearanceNew(inst
, 1);
210 theme
->a_menu_bullet_normal
= RrAppearanceNew(inst
, 1);
211 theme
->a_menu_bullet_selected
= RrAppearanceNew(inst
, 1);
212 theme
->a_clear
= RrAppearanceNew(inst
, 0);
213 theme
->a_clear_tex
= RrAppearanceNew(inst
, 1);
214 theme
->osd_bg
= RrAppearanceNew(inst
, 0);
215 theme
->osd_hilite_label
= RrAppearanceNew(inst
, 1);
216 theme
->osd_hilite_bg
= RrAppearanceNew(inst
, 0);
217 theme
->osd_unhilite_label
= RrAppearanceNew(inst
, 1);
218 theme
->osd_unhilite_bg
= RrAppearanceNew(inst
, 0);
219 theme
->osd_unpressed_button
= RrAppearanceNew(inst
, 1);
220 theme
->osd_pressed_button
= RrAppearanceNew(inst
, 5);
221 theme
->osd_focused_button
= RrAppearanceNew(inst
, 5);
223 /* load the font stuff */
224 theme
->win_font_focused
= get_font(active_window_font
,
225 &default_font
, inst
);
226 theme
->win_font_unfocused
= get_font(inactive_window_font
,
227 &default_font
, inst
);
229 winjust
= RR_JUSTIFY_LEFT
;
230 if (read_string(db
, "window.label.text.justify", &str
)) {
231 if (!g_ascii_strcasecmp(str
, "right"))
232 winjust
= RR_JUSTIFY_RIGHT
;
233 else if (!g_ascii_strcasecmp(str
, "center"))
234 winjust
= RR_JUSTIFY_CENTER
;
237 theme
->menu_title_font
= get_font(menu_title_font
, &default_font
, inst
);
239 mtitlejust
= RR_JUSTIFY_LEFT
;
240 if (read_string(db
, "menu.title.text.justify", &str
)) {
241 if (!g_ascii_strcasecmp(str
, "right"))
242 mtitlejust
= RR_JUSTIFY_RIGHT
;
243 else if (!g_ascii_strcasecmp(str
, "center"))
244 mtitlejust
= RR_JUSTIFY_CENTER
;
247 theme
->menu_font
= get_font(menu_item_font
, &default_font
, inst
);
249 theme
->osd_font_hilite
= get_font(active_osd_font
, &default_font
, inst
);
250 theme
->osd_font_unhilite
= get_font(inactive_osd_font
, &default_font
,inst
);
252 /* load direct dimensions */
253 READ_INT("menu.overlap", menu_overlap
, -100, 100, 0);
254 READ_INT("menu.overlap.x", theme
->menu_overlap_x
, -100, 100, menu_overlap
);
255 READ_INT("menu.overlap.y", theme
->menu_overlap_y
, -100, 100, menu_overlap
);
256 READ_INT("window.handle.width", theme
->handle_height
, 0, 100, 6);
257 READ_INT("padding.width", theme
->paddingx
, 0, 100, 3);
258 READ_INT("padding.height", theme
->paddingy
, 0, 100, theme
->paddingx
);
259 READ_INT("border.width", theme
->fbwidth
, 0, 100, 1);
260 READ_INT("menu.border.width", theme
->mbwidth
, 0, 100, theme
->fbwidth
);
261 READ_INT("osd.border.width", theme
->obwidth
, 0, 100, theme
->fbwidth
);
262 READ_INT("menu.separator.width", theme
->menu_sep_width
, 1, 100, 1);
263 READ_INT("menu.separator.padding.width", theme
->menu_sep_paddingx
, 0, 100, 6);
264 READ_INT("menu.separator.padding.height", theme
->menu_sep_paddingy
, 0, 100, 3);
265 READ_INT("window.client.padding.width", theme
->cbwidthx
, 0, 100,
267 READ_INT("window.client.padding.height", theme
->cbwidthy
, 0, 100,
271 READ_COLOR_("window.active.border.color", "border.color",
272 theme
->frame_focused_border_color
, RrColorNew(inst
, 0, 0, 0));
274 /* title separator focused color inherits from focused border color */
275 READ_COLOR("window.active.title.separator.color",
276 theme
->title_separator_focused_color
,
277 RrColorCopy(theme
->frame_focused_border_color
));
279 /* unfocused border color inherits from frame focused border color */
280 READ_COLOR("window.inactive.border.color",
281 theme
->frame_unfocused_border_color
,
282 RrColorCopy(theme
->frame_focused_border_color
));
284 /* title separator unfocused color inherits from unfocused border color */
285 READ_COLOR("window.inactive.title.separator.color",
286 theme
->title_separator_unfocused_color
,
287 RrColorCopy(theme
->frame_unfocused_border_color
));
289 /* menu border color inherits from frame focused border color */
290 READ_COLOR("menu.border.color", theme
->menu_border_color
,
291 RrColorCopy(theme
->frame_focused_border_color
));
293 /* osd border color inherits from frame focused border color */
294 READ_COLOR("osd.border.color", theme
->osd_border_color
,
295 RrColorCopy(theme
->frame_focused_border_color
));
297 READ_COLOR("window.active.client.color", theme
->cb_focused_color
,
298 RrColorNew(inst
, 0xff, 0xff, 0xff));
300 READ_COLOR("window.inactive.client.color", theme
->cb_unfocused_color
,
301 RrColorNew(inst
, 0xff, 0xff, 0xff));
303 READ_COLOR("window.active.label.text.color", theme
->title_focused_color
,
304 RrColorNew(inst
, 0x0, 0x0, 0x0));
306 READ_COLOR_("osd.active.label.text.color",
307 "osd.label.text.color",
308 theme
->osd_text_active_color
, RrColorCopy(theme
->title_focused_color
));
310 READ_COLOR("window.inactive.label.text.color", theme
->title_unfocused_color
,
311 RrColorCopy(theme
->title_unfocused_color
));
313 READ_COLOR("osd.inactive.label.text.color", theme
->osd_text_inactive_color
,
314 RrColorNew(inst
, 0xff, 0xff, 0xff));
316 READ_COLOR("window.inactive.label.text.color",
317 theme
->title_unfocused_color
,
318 RrColorNew(inst
, 0xff, 0xff, 0xff));
320 READ_COLOR("window.active.button.unpressed.image.color",
321 theme
->titlebut_focused_unpressed_color
,
322 RrColorNew(inst
, 0, 0, 0));
324 READ_COLOR("window.inactive.button.unpressed.image.color",
325 theme
->titlebut_unfocused_unpressed_color
,
326 RrColorNew(inst
, 0xff, 0xff, 0xff));
328 READ_COLOR("window.active.button.pressed.image.color",
329 theme
->titlebut_focused_pressed_color
,
330 RrColorCopy(theme
->titlebut_focused_unpressed_color
));
332 READ_COLOR("window.inactive.button.pressed.image.color",
333 theme
->titlebut_unfocused_pressed_color
,
334 RrColorCopy(theme
->titlebut_unfocused_unpressed_color
));
336 READ_COLOR("window.active.button.disabled.image.color",
337 theme
->titlebut_disabled_focused_color
,
338 RrColorNew(inst
, 0xff, 0xff, 0xff));
340 READ_COLOR("window.inactive.button.disabled.image.color",
341 theme
->titlebut_disabled_unfocused_color
,
342 RrColorNew(inst
, 0, 0, 0));
344 READ_COLOR("window.active.button.hover.image.color",
345 theme
->titlebut_hover_focused_color
,
346 RrColorCopy(theme
->titlebut_focused_unpressed_color
));
348 READ_COLOR("window.inactive.button.hover.image.color",
349 theme
->titlebut_hover_unfocused_color
,
350 RrColorCopy(theme
->titlebut_unfocused_unpressed_color
));
352 READ_COLOR_("window.active.button.toggled.unpressed.image.color",
353 "window.active.button.toggled.image.color",
354 theme
->titlebut_toggled_focused_unpressed_color
,
355 RrColorCopy(theme
->titlebut_focused_pressed_color
));
357 READ_COLOR_("window.inactive.button.toggled.unpressed.image.color",
358 "window.inactive.button.toggled.image.color",
359 theme
->titlebut_toggled_unfocused_unpressed_color
,
360 RrColorCopy(theme
->titlebut_unfocused_pressed_color
));
362 READ_COLOR("window.active.button.toggled.hover.image.color",
363 theme
->titlebut_toggled_hover_focused_color
,
364 RrColorCopy(theme
->titlebut_toggled_focused_unpressed_color
));
366 READ_COLOR("window.inactive.button.toggled.hover.image.color",
367 theme
->titlebut_toggled_hover_unfocused_color
,
368 RrColorCopy(theme
->titlebut_toggled_unfocused_unpressed_color
));
370 READ_COLOR("window.active.button.toggled.pressed.image.color",
371 theme
->titlebut_toggled_focused_pressed_color
,
372 RrColorCopy(theme
->titlebut_focused_pressed_color
));
374 READ_COLOR("window.inactive.button.toggled.pressed.image.color",
375 theme
->titlebut_toggled_unfocused_pressed_color
,
376 RrColorCopy(theme
->titlebut_unfocused_pressed_color
));
378 READ_COLOR("menu.title.text.color", theme
->menu_title_color
,
379 RrColorNew(inst
, 0, 0, 0));
381 READ_COLOR("menu.items.text.color", theme
->menu_color
,
382 RrColorNew(inst
, 0xff, 0xff, 0xff));
384 READ_COLOR("menu.bullet.image.color", theme
->menu_bullet_color
,
385 RrColorCopy(theme
->menu_color
));
387 READ_COLOR("menu.items.disabled.text.color", theme
->menu_disabled_color
,
388 RrColorNew(inst
, 0, 0, 0));
390 READ_COLOR("menu.items.active.disabled.text.color",
391 theme
->menu_disabled_selected_color
,
392 RrColorCopy(theme
->menu_disabled_color
));
394 READ_COLOR("menu.items.active.text.color", theme
->menu_selected_color
,
395 RrColorNew(inst
, 0, 0, 0));
397 READ_COLOR("menu.separator.color", theme
->menu_sep_color
,
398 RrColorCopy(theme
->menu_color
));
400 READ_COLOR("menu.bullet.selected.image.color",
401 theme
->menu_bullet_selected_color
,
402 RrColorCopy(theme
->menu_selected_color
));
404 READ_COLOR("osd.button.unpressed.text.color", theme
->osd_unpressed_color
,
405 RrColorCopy(theme
->osd_text_active_color
));
406 READ_COLOR("osd.button.pressed.text.color", theme
->osd_pressed_color
,
407 RrColorCopy(theme
->osd_text_active_color
));
408 READ_COLOR("osd.button.focused.text.color", theme
->osd_focused_color
,
409 RrColorCopy(theme
->osd_text_active_color
));
410 READ_COLOR("osd.button.pressed.box.color", theme
->osd_pressed_lineart
,
411 RrColorCopy(theme
->titlebut_focused_pressed_color
));
412 READ_COLOR("osd.button.focused.box.color", theme
->osd_focused_lineart
,
413 RrColorCopy(theme
->titlebut_hover_focused_color
));
415 /* load the image masks */
417 /* maximize button masks */
419 if (!read_mask(inst
, path
, theme
, "max.xbm", &theme
->btn_max
->mask
)) {
420 guchar data
[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
421 theme
->btn_max
->mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
424 if (!read_mask(inst
, path
, theme
, "max_toggled.xbm",
425 &theme
->btn_max
->toggled_mask
))
428 theme
->btn_max
->toggled_mask
= RrPixmapMaskCopy(theme
->btn_max
->mask
);
430 guchar data
[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
431 theme
->btn_max
->toggled_mask
= RrPixmapMaskNew(inst
, 6, 6,(gchar
*)data
);
434 READ_MASK_COPY("max_pressed.xbm", theme
->btn_max
->pressed_mask
,
435 theme
->btn_max
->mask
);
436 READ_MASK_COPY("max_disabled.xbm", theme
->btn_max
->disabled_mask
,
437 theme
->btn_max
->mask
);
438 READ_MASK_COPY("max_hover.xbm", theme
->btn_max
->hover_mask
,
439 theme
->btn_max
->mask
);
440 READ_MASK_COPY("max_toggled_pressed.xbm",
441 theme
->btn_max
->toggled_pressed_mask
,
442 theme
->btn_max
->toggled_mask
);
443 READ_MASK_COPY("max_toggled_hover.xbm",
444 theme
->btn_max
->toggled_hover_mask
,
445 theme
->btn_max
->toggled_mask
);
447 /* iconify button masks */
448 if (!read_mask(inst
, path
, theme
, "iconify.xbm", &theme
->btn_iconify
->mask
)) {
449 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
450 theme
->btn_iconify
->mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
452 READ_MASK_COPY("iconify_pressed.xbm", theme
->btn_iconify
->pressed_mask
,
453 theme
->btn_iconify
->mask
);
454 READ_MASK_COPY("iconify_disabled.xbm", theme
->btn_iconify
->disabled_mask
,
455 theme
->btn_iconify
->mask
);
456 READ_MASK_COPY("iconify_hover.xbm", theme
->btn_iconify
->hover_mask
,
457 theme
->btn_iconify
->mask
);
459 /* all desktops button masks */
461 if (!read_mask(inst
, path
, theme
, "desk.xbm", &theme
->btn_desk
->mask
)) {
462 guchar data
[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
463 theme
->btn_desk
->mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
466 if (!read_mask(inst
, path
, theme
, "desk_toggled.xbm",
467 &theme
->btn_desk
->toggled_mask
)) {
469 theme
->btn_desk
->toggled_mask
= RrPixmapMaskCopy(theme
->btn_desk
->mask
);
471 guchar data
[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
472 theme
->btn_desk
->toggled_mask
=
473 RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
476 READ_MASK_COPY("desk_pressed.xbm", theme
->btn_desk
->pressed_mask
,
477 theme
->btn_desk
->mask
);
478 READ_MASK_COPY("desk_disabled.xbm", theme
->btn_desk
->disabled_mask
,
479 theme
->btn_desk
->mask
);
480 READ_MASK_COPY("desk_hover.xbm", theme
->btn_desk
->hover_mask
, theme
->btn_desk
->mask
);
481 READ_MASK_COPY("desk_toggled_pressed.xbm",
482 theme
->btn_desk
->toggled_pressed_mask
, theme
->btn_desk
->toggled_mask
);
483 READ_MASK_COPY("desk_toggled_hover.xbm", theme
->btn_desk
->toggled_hover_mask
,
484 theme
->btn_desk
->toggled_mask
);
486 /* shade button masks */
487 if (!read_mask(inst
, path
, theme
, "shade.xbm", &theme
->btn_shade
->mask
)) {
488 guchar data
[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
489 theme
->btn_shade
->mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
491 READ_MASK_COPY("shade_toggled.xbm", theme
->btn_shade
->toggled_mask
,
492 theme
->btn_shade
->mask
);
493 READ_MASK_COPY("shade_pressed.xbm", theme
->btn_shade
->pressed_mask
,
494 theme
->btn_shade
->mask
);
495 READ_MASK_COPY("shade_disabled.xbm", theme
->btn_shade
->disabled_mask
,
496 theme
->btn_shade
->mask
);
497 READ_MASK_COPY("shade_hover.xbm", theme
->btn_shade
->hover_mask
,
498 theme
->btn_shade
->mask
);
499 READ_MASK_COPY("shade_toggled_pressed.xbm",
500 theme
->btn_shade
->toggled_pressed_mask
,
501 theme
->btn_shade
->toggled_mask
);
502 READ_MASK_COPY("shade_toggled_hover.xbm",
503 theme
->btn_shade
->toggled_hover_mask
,
504 theme
->btn_shade
->toggled_mask
);
506 /* close button masks */
507 if (!read_mask(inst
, path
, theme
, "close.xbm", &theme
->btn_close
->mask
)) {
508 guchar data
[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
509 theme
->btn_close
->mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
511 READ_MASK_COPY("close_pressed.xbm", theme
->btn_close
->pressed_mask
,
512 theme
->btn_close
->mask
);
513 READ_MASK_COPY("close_disabled.xbm", theme
->btn_close
->disabled_mask
,
514 theme
->btn_close
->mask
);
515 READ_MASK_COPY("close_hover.xbm", theme
->btn_close
->hover_mask
,
516 theme
->btn_close
->mask
);
518 /* submenu bullet mask */
519 if (!read_mask(inst
, path
, theme
, "bullet.xbm", &theme
->menu_bullet_mask
))
521 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
522 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
525 /* up and down arrows */
527 guchar data
[] = { 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00 };
528 theme
->down_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
531 guchar data
[] = { 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00 };
532 theme
->up_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
535 /* setup the default window icon */
536 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
537 OB_DEFAULT_ICON_HEIGHT
,
538 OB_DEFAULT_ICON_pixel_data
);
539 theme
->def_win_icon_w
= OB_DEFAULT_ICON_WIDTH
;
540 theme
->def_win_icon_h
= OB_DEFAULT_ICON_HEIGHT
;
542 /* the toggled hover mask = the toggled unpressed mask (i.e. no change) */
543 theme
->btn_max
->toggled_hover_mask
=
544 RrPixmapMaskCopy(theme
->btn_max
->toggled_mask
);
545 theme
->btn_desk
->toggled_hover_mask
=
546 RrPixmapMaskCopy(theme
->btn_desk
->toggled_mask
);
547 theme
->btn_shade
->toggled_hover_mask
=
548 RrPixmapMaskCopy(theme
->btn_shade
->toggled_mask
);
549 /* the toggled pressed mask = the toggled unpressed mask (i.e. no change)*/
550 theme
->btn_max
->toggled_pressed_mask
=
551 RrPixmapMaskCopy(theme
->btn_max
->toggled_mask
);
552 theme
->btn_desk
->toggled_pressed_mask
=
553 RrPixmapMaskCopy(theme
->btn_desk
->toggled_mask
);
554 theme
->btn_shade
->toggled_pressed_mask
=
555 RrPixmapMaskCopy(theme
->btn_shade
->toggled_mask
);
557 /* read the decoration textures */
558 READ_APPEARANCE("window.active.title.bg", theme
->a_focused_title
, FALSE
);
559 READ_APPEARANCE("window.inactive.title.bg", theme
->a_unfocused_title
,
561 READ_APPEARANCE("window.active.label.bg", theme
->a_focused_label
, TRUE
);
562 READ_APPEARANCE("window.inactive.label.bg", theme
->a_unfocused_label
,
564 READ_APPEARANCE("window.active.handle.bg", theme
->a_focused_handle
, FALSE
);
565 READ_APPEARANCE("window.inactive.handle.bg",theme
->a_unfocused_handle
,
567 READ_APPEARANCE("window.active.grip.bg", theme
->a_focused_grip
, TRUE
);
568 READ_APPEARANCE("window.inactive.grip.bg", theme
->a_unfocused_grip
, TRUE
);
569 READ_APPEARANCE("menu.items.bg", theme
->a_menu
, FALSE
);
570 READ_APPEARANCE("menu.title.bg", theme
->a_menu_title
, TRUE
);
571 READ_APPEARANCE("menu.items.active.bg", theme
->a_menu_selected
, TRUE
);
573 theme
->a_menu_disabled_selected
=
574 RrAppearanceCopy(theme
->a_menu_selected
);
576 /* read appearances for non-decorations (on-screen-display) */
577 if (!read_appearance(db
, inst
, "osd.bg", theme
->osd_bg
, FALSE
)) {
578 RrAppearanceFree(theme
->osd_bg
);
579 theme
->osd_bg
= RrAppearanceCopy(theme
->a_focused_title
);
581 if (!read_appearance(db
, inst
, "osd.active.label.bg",
582 theme
->osd_hilite_label
, TRUE
) &&
583 !read_appearance(db
, inst
, "osd.label.bg",
584 theme
->osd_hilite_label
, TRUE
)) {
585 RrAppearanceFree(theme
->osd_hilite_label
);
586 theme
->osd_hilite_label
= RrAppearanceCopy(theme
->a_focused_label
);
588 if (!read_appearance(db
, inst
, "osd.inactive.label.bg",
589 theme
->osd_unhilite_label
, TRUE
)) {
590 RrAppearanceFree(theme
->osd_unhilite_label
);
591 theme
->osd_unhilite_label
= RrAppearanceCopy(theme
->a_unfocused_label
);
593 /* osd_hilite_fg can't be parentrel */
594 if (!read_appearance(db
, inst
, "osd.hilight.bg",
595 theme
->osd_hilite_bg
, FALSE
)) {
596 RrAppearanceFree(theme
->osd_hilite_bg
);
597 if (theme
->a_focused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
598 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_label
);
600 theme
->osd_hilite_bg
= RrAppearanceCopy(theme
->a_focused_title
);
602 /* osd_unhilite_fg can't be parentrel either */
603 if (!read_appearance(db
, inst
, "osd.unhilight.bg",
604 theme
->osd_unhilite_bg
, FALSE
)) {
605 RrAppearanceFree(theme
->osd_unhilite_bg
);
606 if (theme
->a_unfocused_label
->surface
.grad
!= RR_SURFACE_PARENTREL
)
607 theme
->osd_unhilite_bg
=RrAppearanceCopy(theme
->a_unfocused_label
);
609 theme
->osd_unhilite_bg
=RrAppearanceCopy(theme
->a_unfocused_title
);
612 /* read buttons textures */
614 /* bases: unpressed, pressed, disabled */
615 READ_APPEARANCE("window.active.button.unpressed.bg",
616 a_focused_unpressed_tmp
, TRUE
);
617 READ_APPEARANCE("window.inactive.button.unpressed.bg",
618 a_unfocused_unpressed_tmp
, TRUE
);
619 READ_APPEARANCE("window.active.button.pressed.bg",
620 a_focused_pressed_tmp
, TRUE
);
621 READ_APPEARANCE("window.inactive.button.pressed.bg",
622 a_unfocused_pressed_tmp
, TRUE
);
623 READ_APPEARANCE("window.active.button.disabled.bg",
624 a_disabled_focused_tmp
, TRUE
);
625 READ_APPEARANCE("window.inactive.button.disabled.bg",
626 a_disabled_unfocused_tmp
, TRUE
);
629 READ_APPEARANCE_COPY("window.active.button.hover.bg",
630 a_hover_focused_tmp
, TRUE
,
631 a_focused_unpressed_tmp
);
632 READ_APPEARANCE_COPY("window.inactive.button.hover.bg",
633 a_hover_unfocused_tmp
, TRUE
,
634 a_unfocused_unpressed_tmp
);
636 /* toggled unpressed */
637 READ_APPEARANCE_("window.active.button.toggled.unpressed.bg",
638 "window.active.button.toggled.bg",
639 a_toggled_focused_unpressed_tmp
, TRUE
,
640 a_focused_pressed_tmp
);
641 READ_APPEARANCE_("window.inactive.button.toggled.unpressed.bg",
642 "window.inactive.button.toggled.bg",
643 a_toggled_unfocused_unpressed_tmp
, TRUE
,
644 a_unfocused_pressed_tmp
);
646 /* toggled pressed */
647 READ_APPEARANCE_COPY("window.active.button.toggled.pressed.bg",
648 a_toggled_focused_pressed_tmp
, TRUE
,
649 a_focused_pressed_tmp
);
650 READ_APPEARANCE_COPY("window.inactive.button.toggled.pressed.bg",
651 a_toggled_unfocused_pressed_tmp
, TRUE
,
652 a_unfocused_pressed_tmp
);
655 READ_APPEARANCE_COPY("window.active.button.toggled.hover.bg",
656 a_toggled_hover_focused_tmp
, TRUE
,
657 a_toggled_focused_unpressed_tmp
);
658 READ_APPEARANCE_COPY("window.inactive.button.toggled.hover.bg",
659 a_toggled_hover_unfocused_tmp
, TRUE
,
660 a_toggled_unfocused_unpressed_tmp
);
663 /* now do individual buttons, if specified */
666 read_button_colors(db
, inst
, theme
, theme
->btn_max
, "max");
668 /* bases: unpressed, pressed, disabled */
669 READ_APPEARANCE_COPY("window.active.button.max.unpressed.bg",
670 theme
->btn_max
->a_focused_unpressed
, TRUE
,
671 a_focused_unpressed_tmp
);
672 READ_APPEARANCE_COPY("window.inactive.button.max.unpressed.bg",
673 theme
->btn_max
->a_unfocused_unpressed
, TRUE
,
674 a_unfocused_unpressed_tmp
);
675 READ_APPEARANCE_COPY("window.active.button.max.pressed.bg",
676 theme
->btn_max
->a_focused_pressed
, TRUE
,
677 a_focused_pressed_tmp
);
678 READ_APPEARANCE_COPY("window.inactive.button.max.pressed.bg",
679 theme
->btn_max
->a_unfocused_pressed
, TRUE
,
680 a_unfocused_pressed_tmp
);
681 READ_APPEARANCE_COPY("window.active.button.max.disabled.bg",
682 theme
->btn_max
->a_disabled_focused
, TRUE
,
683 a_disabled_focused_tmp
);
684 READ_APPEARANCE_COPY("window.inactive.button.max.disabled.bg",
685 theme
->btn_max
->a_disabled_unfocused
, TRUE
,
686 a_disabled_unfocused_tmp
);
689 READ_APPEARANCE_COPY("window.active.button.max.hover.bg",
690 theme
->btn_max
->a_hover_focused
, TRUE
,
691 theme
->btn_max
->a_focused_unpressed
);
692 READ_APPEARANCE_COPY("window.inactive.button.max.hover.bg",
693 theme
->btn_max
->a_hover_unfocused
, TRUE
,
694 theme
->btn_max
->a_unfocused_unpressed
);
696 /* toggled unpressed */
697 READ_APPEARANCE_("window.active.button.max.toggled.unpressed.bg",
698 "window.active.button.max.toggled.bg",
699 theme
->btn_max
->a_toggled_focused_unpressed
, TRUE
,
700 theme
->btn_max
->a_focused_pressed
);
701 READ_APPEARANCE_("window.inactive.button.max.toggled.unpressed.bg",
702 "window.inactive.button.max.toggled.bg",
703 theme
->btn_max
->a_toggled_unfocused_unpressed
, TRUE
,
704 theme
->btn_max
->a_unfocused_pressed
);
706 /* toggled pressed */
707 READ_APPEARANCE_COPY("window.active.button.max.toggled.pressed.bg",
708 theme
->btn_max
->a_toggled_focused_pressed
, TRUE
,
709 theme
->btn_max
->a_focused_pressed
);
710 READ_APPEARANCE_COPY("window.inactive.button.max.toggled.pressed.bg",
711 theme
->btn_max
->a_toggled_unfocused_pressed
, TRUE
,
712 theme
->btn_max
->a_unfocused_pressed
);
715 READ_APPEARANCE_COPY("window.active.button.max.toggled.hover.bg",
716 theme
->btn_max
->a_toggled_hover_focused
, TRUE
,
717 theme
->btn_max
->a_toggled_focused_unpressed
);
718 READ_APPEARANCE_COPY("window.inactive.button.max.toggled.hover.bg",
719 theme
->btn_max
->a_toggled_hover_unfocused
, TRUE
,
720 theme
->btn_max
->a_toggled_unfocused_unpressed
);
723 read_button_colors(db
, inst
, theme
, theme
->btn_close
, "close");
725 READ_APPEARANCE_COPY("window.active.button.close.unpressed.bg",
726 theme
->btn_close
->a_focused_unpressed
, TRUE
,
727 a_focused_unpressed_tmp
);
728 READ_APPEARANCE_COPY("window.inactive.button.close.unpressed.bg",
729 theme
->btn_close
->a_unfocused_unpressed
, TRUE
,
730 a_unfocused_unpressed_tmp
);
731 READ_APPEARANCE_COPY("window.active.button.close.pressed.bg",
732 theme
->btn_close
->a_focused_pressed
, TRUE
,
733 a_focused_pressed_tmp
);
734 READ_APPEARANCE_COPY("window.inactive.button.close.pressed.bg",
735 theme
->btn_close
->a_unfocused_pressed
, TRUE
,
736 a_unfocused_pressed_tmp
);
737 READ_APPEARANCE_COPY("window.active.button.close.disabled.bg",
738 theme
->btn_close
->a_disabled_focused
, TRUE
,
739 a_disabled_focused_tmp
);
740 READ_APPEARANCE_COPY("window.inactive.button.close.disabled.bg",
741 theme
->btn_close
->a_disabled_unfocused
, TRUE
,
742 a_disabled_unfocused_tmp
);
743 READ_APPEARANCE_COPY("window.active.button.close.hover.bg",
744 theme
->btn_close
->a_hover_focused
, TRUE
,
745 theme
->btn_close
->a_focused_unpressed
);
746 READ_APPEARANCE_COPY("window.inactive.button.close.hover.bg",
747 theme
->btn_close
->a_hover_unfocused
, TRUE
,
748 theme
->btn_close
->a_unfocused_unpressed
);
751 read_button_colors(db
, inst
, theme
, theme
->btn_desk
, "desk");
753 /* bases: unpressed, pressed, disabled */
754 READ_APPEARANCE_COPY("window.active.button.desk.unpressed.bg",
755 theme
->btn_desk
->a_focused_unpressed
, TRUE
,
756 a_focused_unpressed_tmp
);
757 READ_APPEARANCE_COPY("window.inactive.button.desk.unpressed.bg",
758 theme
->btn_desk
->a_unfocused_unpressed
, TRUE
,
759 a_unfocused_unpressed_tmp
);
760 READ_APPEARANCE_COPY("window.active.button.desk.pressed.bg",
761 theme
->btn_desk
->a_focused_pressed
, TRUE
,
762 a_focused_pressed_tmp
);
763 READ_APPEARANCE_COPY("window.inactive.button.desk.pressed.bg",
764 theme
->btn_desk
->a_unfocused_pressed
, TRUE
,
765 a_unfocused_pressed_tmp
);
766 READ_APPEARANCE_COPY("window.active.button.desk.disabled.bg",
767 theme
->btn_desk
->a_disabled_focused
, TRUE
,
768 a_disabled_focused_tmp
);
769 READ_APPEARANCE_COPY("window.inactive.button.desk.disabled.bg",
770 theme
->btn_desk
->a_disabled_unfocused
, TRUE
,
771 a_disabled_unfocused_tmp
);
774 READ_APPEARANCE_COPY("window.active.button.desk.hover.bg",
775 theme
->btn_desk
->a_hover_focused
, TRUE
,
776 theme
->btn_desk
->a_focused_unpressed
);
777 READ_APPEARANCE_COPY("window.inactive.button.desk.hover.bg",
778 theme
->btn_desk
->a_hover_unfocused
, TRUE
,
779 theme
->btn_desk
->a_unfocused_unpressed
);
781 /* toggled unpressed */
782 READ_APPEARANCE_("window.active.button.desk.toggled.unpressed.bg",
783 "window.active.button.desk.toggled.bg",
784 theme
->btn_desk
->a_toggled_focused_unpressed
, TRUE
,
785 theme
->btn_desk
->a_focused_pressed
);
786 READ_APPEARANCE_("window.inactive.button.desk.toggled.unpressed.bg",
787 "window.inactive.button.desk.toggled.bg",
788 theme
->btn_desk
->a_toggled_unfocused_unpressed
, TRUE
,
789 theme
->btn_desk
->a_unfocused_pressed
);
791 /* toggled pressed */
792 READ_APPEARANCE_COPY("window.active.button.desk.toggled.pressed.bg",
793 theme
->btn_desk
->a_toggled_focused_pressed
, TRUE
,
794 theme
->btn_desk
->a_focused_pressed
);
795 READ_APPEARANCE_COPY("window.inactive.button.desk.toggled.pressed.bg",
796 theme
->btn_desk
->a_toggled_unfocused_pressed
, TRUE
,
797 theme
->btn_desk
->a_unfocused_pressed
);
800 READ_APPEARANCE_COPY("window.active.button.desk.toggled.hover.bg",
801 theme
->btn_desk
->a_toggled_hover_focused
, TRUE
,
802 theme
->btn_desk
->a_toggled_focused_unpressed
);
803 READ_APPEARANCE_COPY("window.inactive.button.desk.toggled.hover.bg",
804 theme
->btn_desk
->a_toggled_hover_unfocused
, TRUE
,
805 theme
->btn_desk
->a_toggled_unfocused_unpressed
);
808 read_button_colors(db
, inst
, theme
, theme
->btn_shade
, "shade");
810 /* bases: unpressed, pressed, disabled */
811 READ_APPEARANCE_COPY("window.active.button.shade.unpressed.bg",
812 theme
->btn_shade
->a_focused_unpressed
, TRUE
,
813 a_focused_unpressed_tmp
);
814 READ_APPEARANCE_COPY("window.inactive.button.shade.unpressed.bg",
815 theme
->btn_shade
->a_unfocused_unpressed
, TRUE
,
816 a_unfocused_unpressed_tmp
);
817 READ_APPEARANCE_COPY("window.active.button.shade.pressed.bg",
818 theme
->btn_shade
->a_focused_pressed
, TRUE
,
819 a_focused_pressed_tmp
);
820 READ_APPEARANCE_COPY("window.inactive.button.shade.pressed.bg",
821 theme
->btn_shade
->a_unfocused_pressed
, TRUE
,
822 a_unfocused_pressed_tmp
);
823 READ_APPEARANCE_COPY("window.active.button.shade.disabled.bg",
824 theme
->btn_shade
->a_disabled_focused
, TRUE
,
825 a_disabled_focused_tmp
);
826 READ_APPEARANCE_COPY("window.inactive.button.shade.disabled.bg",
827 theme
->btn_shade
->a_disabled_unfocused
, TRUE
,
828 a_disabled_unfocused_tmp
);
831 READ_APPEARANCE_COPY("window.active.button.shade.hover.bg",
832 theme
->btn_shade
->a_hover_focused
, TRUE
,
833 theme
->btn_shade
->a_focused_unpressed
);
834 READ_APPEARANCE_COPY("window.inactive.button.shade.hover.bg",
835 theme
->btn_shade
->a_hover_unfocused
, TRUE
,
836 theme
->btn_shade
->a_unfocused_unpressed
);
838 /* toggled unpressed */
839 READ_APPEARANCE_("window.active.button.shade.toggled.unpressed.bg",
840 "window.active.button.shade.toggled.bg",
841 theme
->btn_shade
->a_toggled_focused_unpressed
, TRUE
,
842 theme
->btn_shade
->a_focused_pressed
);
843 READ_APPEARANCE_("window.inactive.button.shade.toggled.unpressed.bg",
844 "window.inactive.button.shade.toggled.bg",
845 theme
->btn_shade
->a_toggled_unfocused_unpressed
, TRUE
,
846 theme
->btn_shade
->a_unfocused_pressed
);
848 /* toggled pressed */
849 READ_APPEARANCE_COPY("window.active.button.shade.toggled.pressed.bg",
850 theme
->btn_shade
->a_toggled_focused_pressed
, TRUE
,
851 theme
->btn_shade
->a_focused_pressed
);
852 READ_APPEARANCE_COPY("window.inactive.button.shade.toggled.pressed.bg",
853 theme
->btn_shade
->a_toggled_unfocused_pressed
, TRUE
,
854 theme
->btn_shade
->a_unfocused_pressed
);
857 READ_APPEARANCE_COPY("window.active.button.shade.toggled.hover.bg",
858 theme
->btn_shade
->a_toggled_hover_focused
, TRUE
,
859 theme
->btn_shade
->a_toggled_focused_unpressed
);
860 READ_APPEARANCE_COPY("window.inactive.button.shade.toggled.hover.bg",
861 theme
->btn_shade
->a_toggled_hover_unfocused
, TRUE
,
862 theme
->btn_shade
->a_toggled_unfocused_unpressed
);
865 read_button_colors(db
, inst
, theme
, theme
->btn_iconify
, "iconify");
867 READ_APPEARANCE_COPY("window.active.button.iconify.unpressed.bg",
868 theme
->btn_iconify
->a_focused_unpressed
, TRUE
,
869 a_focused_unpressed_tmp
);
870 READ_APPEARANCE_COPY("window.inactive.button.iconify.unpressed.bg",
871 theme
->btn_iconify
->a_unfocused_unpressed
, TRUE
,
872 a_unfocused_unpressed_tmp
);
873 READ_APPEARANCE_COPY("window.active.button.iconify.pressed.bg",
874 theme
->btn_iconify
->a_focused_pressed
, TRUE
,
875 a_focused_pressed_tmp
);
876 READ_APPEARANCE_COPY("window.inactive.button.iconify.pressed.bg",
877 theme
->btn_iconify
->a_unfocused_pressed
, TRUE
,
878 a_unfocused_pressed_tmp
);
879 READ_APPEARANCE_COPY("window.active.button.iconify.disabled.bg",
880 theme
->btn_iconify
->a_disabled_focused
, TRUE
,
881 a_disabled_focused_tmp
);
882 READ_APPEARANCE_COPY("window.inactive.button.iconify.disabled.bg",
883 theme
->btn_iconify
->a_disabled_unfocused
, TRUE
,
884 a_disabled_unfocused_tmp
);
885 READ_APPEARANCE_COPY("window.active.button.iconify.hover.bg",
886 theme
->btn_iconify
->a_hover_focused
, TRUE
,
887 theme
->btn_iconify
->a_focused_unpressed
);
888 READ_APPEARANCE_COPY("window.inactive.button.iconify.hover.bg",
889 theme
->btn_iconify
->a_hover_unfocused
, TRUE
,
890 theme
->btn_iconify
->a_unfocused_unpressed
);
893 READ_APPEARANCE_COPY("osd.button.unpressed.bg", theme
->osd_unpressed_button
, TRUE
, a_focused_unpressed_tmp
);
894 READ_APPEARANCE_COPY_TEXTURES("osd.button.pressed.bg", theme
->osd_pressed_button
, TRUE
, a_focused_pressed_tmp
, 5);
895 READ_APPEARANCE_COPY_TEXTURES("osd.button.focused.bg", theme
->osd_focused_button
, TRUE
, a_focused_unpressed_tmp
, 5);
897 theme
->a_icon
->surface
.grad
=
898 theme
->a_clear
->surface
.grad
=
899 theme
->a_clear_tex
->surface
.grad
=
900 theme
->a_menu_text_title
->surface
.grad
=
901 theme
->a_menu_normal
->surface
.grad
=
902 theme
->a_menu_disabled
->surface
.grad
=
903 theme
->a_menu_text_normal
->surface
.grad
=
904 theme
->a_menu_text_selected
->surface
.grad
=
905 theme
->a_menu_text_disabled
->surface
.grad
=
906 theme
->a_menu_text_disabled_selected
->surface
.grad
=
907 theme
->a_menu_bullet_normal
->surface
.grad
=
908 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
910 /* set up the textures */
911 theme
->a_focused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
912 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
913 theme
->a_focused_label
->texture
[0].data
.text
.font
=theme
->win_font_focused
;
914 theme
->a_focused_label
->texture
[0].data
.text
.color
=
915 theme
->title_focused_color
;
917 if (read_string(db
, "window.active.label.text.font", &str
)) {
921 if (strstr(str
, "shadow=y")) {
922 if ((p
= strstr(str
, "shadowoffset=")))
923 i
= parse_inline_number(p
+ strlen("shadowoffset="));
926 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
927 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
929 if ((p
= strstr(str
, "shadowtint=")))
931 i
= parse_inline_number(p
+ strlen("shadowtint="));
932 j
= (i
> 0 ? 0 : 255);
935 theme
->title_focused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
936 theme
->title_focused_shadow_alpha
= i
;
938 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
939 theme
->title_focused_shadow_alpha
= 50;
943 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
944 theme
->title_focused_shadow_color
;
945 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
946 theme
->title_focused_shadow_alpha
;
948 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
949 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
950 theme
->osd_hilite_label
->texture
[0].data
.text
.font
=
951 theme
->osd_font_hilite
;
952 theme
->osd_hilite_label
->texture
[0].data
.text
.color
=
953 theme
->osd_text_active_color
;
955 if (read_string(db
, "osd.active.label.text.font", &str
) ||
956 read_string(db
, "osd.label.text.font", &str
))
961 if (strstr(str
, "shadow=y")) {
962 if ((p
= strstr(str
, "shadowoffset=")))
963 i
= parse_inline_number(p
+ strlen("shadowoffset="));
966 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
967 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
969 if ((p
= strstr(str
, "shadowtint=")))
971 i
= parse_inline_number(p
+ strlen("shadowtint="));
972 j
= (i
> 0 ? 0 : 255);
975 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, j
, j
, j
);
976 theme
->osd_text_active_shadow_alpha
= i
;
978 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, 0, 0, 0);
979 theme
->osd_text_active_shadow_alpha
= 50;
982 /* inherit the font settings from the focused label */
983 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
984 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
985 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
986 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
987 if (theme
->title_focused_shadow_color
)
988 theme
->osd_text_active_shadow_color
=
990 theme
->title_focused_shadow_color
->r
,
991 theme
->title_focused_shadow_color
->g
,
992 theme
->title_focused_shadow_color
->b
);
994 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, 0, 0, 0);
995 theme
->osd_text_active_shadow_alpha
=
996 theme
->title_focused_shadow_alpha
;
999 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
1000 theme
->osd_text_active_shadow_color
;
1001 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
1002 theme
->osd_text_active_shadow_alpha
;
1004 theme
->osd_unpressed_button
->texture
[0] =
1005 theme
->osd_pressed_button
->texture
[0] =
1006 theme
->osd_focused_button
->texture
[0] =
1007 theme
->osd_hilite_label
->texture
[0];
1009 theme
->osd_unpressed_button
->texture
[0].data
.text
.justify
=
1010 theme
->osd_pressed_button
->texture
[0].data
.text
.justify
=
1011 theme
->osd_focused_button
->texture
[0].data
.text
.justify
=
1014 theme
->osd_unpressed_button
->texture
[0].data
.text
.color
=
1015 theme
->osd_unpressed_color
;
1016 theme
->osd_pressed_button
->texture
[0].data
.text
.color
=
1017 theme
->osd_pressed_color
;
1018 theme
->osd_focused_button
->texture
[0].data
.text
.color
=
1019 theme
->osd_focused_color
;
1021 theme
->osd_pressed_button
->texture
[1].data
.lineart
.color
=
1022 theme
->osd_pressed_button
->texture
[2].data
.lineart
.color
=
1023 theme
->osd_pressed_button
->texture
[3].data
.lineart
.color
=
1024 theme
->osd_pressed_button
->texture
[4].data
.lineart
.color
=
1025 theme
->osd_pressed_lineart
;
1027 theme
->osd_focused_button
->texture
[1].data
.lineart
.color
=
1028 theme
->osd_focused_button
->texture
[2].data
.lineart
.color
=
1029 theme
->osd_focused_button
->texture
[3].data
.lineart
.color
=
1030 theme
->osd_focused_button
->texture
[4].data
.lineart
.color
=
1031 theme
->osd_focused_lineart
;
1033 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
1034 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
1035 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
1036 theme
->win_font_unfocused
;
1037 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
1038 theme
->title_unfocused_color
;
1040 if (read_string(db
, "window.inactive.label.text.font", &str
)) {
1044 if (strstr(str
, "shadow=y")) {
1045 if ((p
= strstr(str
, "shadowoffset=")))
1046 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1049 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
1050 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
1052 if ((p
= strstr(str
, "shadowtint=")))
1054 i
= parse_inline_number(p
+ strlen("shadowtint="));
1055 j
= (i
> 0 ? 0 : 255);
1058 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1059 theme
->title_unfocused_shadow_alpha
= i
;
1061 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1062 theme
->title_unfocused_shadow_alpha
= 50;
1066 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
1067 theme
->title_unfocused_shadow_color
;
1068 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
1069 theme
->title_unfocused_shadow_alpha
;
1071 theme
->osd_unhilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
1072 theme
->osd_unhilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
1073 theme
->osd_unhilite_label
->texture
[0].data
.text
.font
=
1074 theme
->osd_font_unhilite
;
1075 theme
->osd_unhilite_label
->texture
[0].data
.text
.color
=
1076 theme
->osd_text_inactive_color
;
1078 if (read_string(db
, "osd.inactive.label.text.font", &str
))
1083 if (strstr(str
, "shadow=y")) {
1084 if ((p
= strstr(str
, "shadowoffset=")))
1085 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1088 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_x
=i
;
1089 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_y
=i
;
1091 if ((p
= strstr(str
, "shadowtint=")))
1093 i
= parse_inline_number(p
+ strlen("shadowtint="));
1094 j
= (i
> 0 ? 0 : 255);
1097 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1098 theme
->osd_text_inactive_shadow_alpha
= i
;
1100 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1101 theme
->osd_text_inactive_shadow_alpha
= 50;
1104 /* inherit the font settings from the unfocused label */
1105 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_x
=
1106 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
;
1107 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_y
=
1108 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
;
1109 if (theme
->title_unfocused_shadow_color
)
1110 theme
->osd_text_inactive_shadow_color
=
1112 theme
->title_unfocused_shadow_color
->r
,
1113 theme
->title_unfocused_shadow_color
->g
,
1114 theme
->title_unfocused_shadow_color
->b
);
1116 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1117 theme
->osd_text_inactive_shadow_alpha
=
1118 theme
->title_unfocused_shadow_alpha
;
1121 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_color
=
1122 theme
->osd_text_inactive_shadow_color
;
1123 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_alpha
=
1124 theme
->osd_text_inactive_shadow_alpha
;
1126 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
1127 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
1128 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
1129 theme
->menu_title_font
;
1130 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
1131 theme
->menu_title_color
;
1133 if (read_string(db
, "menu.title.text.font", &str
)) {
1137 if (strstr(str
, "shadow=y")) {
1138 if ((p
= strstr(str
, "shadowoffset=")))
1139 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1142 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
= i
;
1143 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= i
;
1145 if ((p
= strstr(str
, "shadowtint=")))
1147 i
= parse_inline_number(p
+ strlen("shadowtint="));
1148 j
= (i
> 0 ? 0 : 255);
1151 theme
->menu_title_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1152 theme
->menu_title_shadow_alpha
= i
;
1154 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1155 theme
->menu_title_shadow_alpha
= 50;
1159 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
1160 theme
->menu_title_shadow_color
;
1161 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
1162 theme
->menu_title_shadow_alpha
;
1164 theme
->a_menu_text_normal
->texture
[0].type
=
1165 theme
->a_menu_text_selected
->texture
[0].type
=
1166 theme
->a_menu_text_disabled
->texture
[0].type
=
1167 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
1169 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
1170 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
1171 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
1172 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
1174 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
1175 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
1176 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
1177 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
1179 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
1180 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
1181 theme
->menu_selected_color
;
1182 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
1183 theme
->menu_disabled_color
;
1184 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
1185 theme
->menu_disabled_selected_color
;
1187 if (read_string(db
, "menu.items.font", &str
)) {
1191 if (strstr(str
, "shadow=y")) {
1192 if ((p
= strstr(str
, "shadowoffset=")))
1193 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1196 theme
->a_menu_text_normal
->
1197 texture
[0].data
.text
.shadow_offset_x
= i
;
1198 theme
->a_menu_text_normal
->
1199 texture
[0].data
.text
.shadow_offset_y
= i
;
1200 theme
->a_menu_text_selected
->
1201 texture
[0].data
.text
.shadow_offset_x
= i
;
1202 theme
->a_menu_text_selected
->
1203 texture
[0].data
.text
.shadow_offset_y
= i
;
1204 theme
->a_menu_text_disabled
->
1205 texture
[0].data
.text
.shadow_offset_x
= i
;
1206 theme
->a_menu_text_disabled
->
1207 texture
[0].data
.text
.shadow_offset_y
= i
;
1208 theme
->a_menu_text_disabled_selected
->
1209 texture
[0].data
.text
.shadow_offset_x
= i
;
1210 theme
->a_menu_text_disabled_selected
->
1211 texture
[0].data
.text
.shadow_offset_y
= i
;
1213 if ((p
= strstr(str
, "shadowtint=")))
1215 i
= parse_inline_number(p
+ strlen("shadowtint="));
1216 j
= (i
> 0 ? 0 : 255);
1219 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1220 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1221 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1222 theme
->menu_text_normal_shadow_alpha
= i
;
1223 theme
->menu_text_selected_shadow_alpha
= i
;
1224 theme
->menu_text_disabled_shadow_alpha
= i
;
1225 theme
->menu_text_disabled_selected_shadow_alpha
= i
;
1227 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1228 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1229 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1230 theme
->menu_text_normal_shadow_alpha
= 50;
1231 theme
->menu_text_selected_shadow_alpha
= 50;
1232 theme
->menu_text_disabled_selected_shadow_alpha
= 50;
1236 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
1237 theme
->menu_text_normal_shadow_color
;
1238 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
1239 theme
->menu_text_normal_shadow_alpha
;
1240 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
1241 theme
->menu_text_selected_shadow_color
;
1242 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
1243 theme
->menu_text_selected_shadow_alpha
;
1244 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
1245 theme
->menu_text_disabled_shadow_color
;
1246 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
1247 theme
->menu_text_disabled_shadow_alpha
;
1248 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
1249 theme
->menu_text_disabled_shadow_color
;
1250 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
1251 theme
->menu_text_disabled_shadow_alpha
;
1253 theme
->btn_max
->a_disabled_focused
->texture
[0].type
=
1254 theme
->btn_max
->a_disabled_unfocused
->texture
[0].type
=
1255 theme
->btn_max
->a_hover_focused
->texture
[0].type
=
1256 theme
->btn_max
->a_hover_unfocused
->texture
[0].type
=
1257 theme
->btn_max
->a_toggled_hover_focused
->texture
[0].type
=
1258 theme
->btn_max
->a_toggled_hover_unfocused
->texture
[0].type
=
1259 theme
->btn_max
->a_toggled_focused_unpressed
->texture
[0].type
=
1260 theme
->btn_max
->a_toggled_unfocused_unpressed
->texture
[0].type
=
1261 theme
->btn_max
->a_toggled_focused_pressed
->texture
[0].type
=
1262 theme
->btn_max
->a_toggled_unfocused_pressed
->texture
[0].type
=
1263 theme
->btn_max
->a_focused_unpressed
->texture
[0].type
=
1264 theme
->btn_max
->a_focused_pressed
->texture
[0].type
=
1265 theme
->btn_max
->a_unfocused_unpressed
->texture
[0].type
=
1266 theme
->btn_max
->a_unfocused_pressed
->texture
[0].type
=
1267 theme
->btn_close
->a_disabled_focused
->texture
[0].type
=
1268 theme
->btn_close
->a_disabled_unfocused
->texture
[0].type
=
1269 theme
->btn_close
->a_hover_focused
->texture
[0].type
=
1270 theme
->btn_close
->a_hover_unfocused
->texture
[0].type
=
1271 theme
->btn_close
->a_focused_unpressed
->texture
[0].type
=
1272 theme
->btn_close
->a_focused_pressed
->texture
[0].type
=
1273 theme
->btn_close
->a_unfocused_unpressed
->texture
[0].type
=
1274 theme
->btn_close
->a_unfocused_pressed
->texture
[0].type
=
1275 theme
->btn_desk
->a_disabled_focused
->texture
[0].type
=
1276 theme
->btn_desk
->a_disabled_unfocused
->texture
[0].type
=
1277 theme
->btn_desk
->a_hover_focused
->texture
[0].type
=
1278 theme
->btn_desk
->a_hover_unfocused
->texture
[0].type
=
1279 theme
->btn_desk
->a_toggled_hover_focused
->texture
[0].type
=
1280 theme
->btn_desk
->a_toggled_hover_unfocused
->texture
[0].type
=
1281 theme
->btn_desk
->a_toggled_focused_unpressed
->texture
[0].type
=
1282 theme
->btn_desk
->a_toggled_unfocused_unpressed
->texture
[0].type
=
1283 theme
->btn_desk
->a_toggled_focused_pressed
->texture
[0].type
=
1284 theme
->btn_desk
->a_toggled_unfocused_pressed
->texture
[0].type
=
1285 theme
->btn_desk
->a_focused_unpressed
->texture
[0].type
=
1286 theme
->btn_desk
->a_focused_pressed
->texture
[0].type
=
1287 theme
->btn_desk
->a_unfocused_unpressed
->texture
[0].type
=
1288 theme
->btn_desk
->a_unfocused_pressed
->texture
[0].type
=
1289 theme
->btn_shade
->a_disabled_focused
->texture
[0].type
=
1290 theme
->btn_shade
->a_disabled_unfocused
->texture
[0].type
=
1291 theme
->btn_shade
->a_hover_focused
->texture
[0].type
=
1292 theme
->btn_shade
->a_hover_unfocused
->texture
[0].type
=
1293 theme
->btn_shade
->a_toggled_hover_focused
->texture
[0].type
=
1294 theme
->btn_shade
->a_toggled_hover_unfocused
->texture
[0].type
=
1295 theme
->btn_shade
->a_toggled_focused_unpressed
->texture
[0].type
=
1296 theme
->btn_shade
->a_toggled_unfocused_unpressed
->texture
[0].type
=
1297 theme
->btn_shade
->a_toggled_focused_pressed
->texture
[0].type
=
1298 theme
->btn_shade
->a_toggled_unfocused_pressed
->texture
[0].type
=
1299 theme
->btn_shade
->a_focused_unpressed
->texture
[0].type
=
1300 theme
->btn_shade
->a_focused_pressed
->texture
[0].type
=
1301 theme
->btn_shade
->a_unfocused_unpressed
->texture
[0].type
=
1302 theme
->btn_shade
->a_unfocused_pressed
->texture
[0].type
=
1303 theme
->btn_iconify
->a_disabled_focused
->texture
[0].type
=
1304 theme
->btn_iconify
->a_disabled_unfocused
->texture
[0].type
=
1305 theme
->btn_iconify
->a_hover_focused
->texture
[0].type
=
1306 theme
->btn_iconify
->a_hover_unfocused
->texture
[0].type
=
1307 theme
->btn_iconify
->a_focused_unpressed
->texture
[0].type
=
1308 theme
->btn_iconify
->a_focused_pressed
->texture
[0].type
=
1309 theme
->btn_iconify
->a_unfocused_unpressed
->texture
[0].type
=
1310 theme
->btn_iconify
->a_unfocused_pressed
->texture
[0].type
=
1311 theme
->a_menu_bullet_normal
->texture
[0].type
=
1312 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
1314 theme
->btn_max
->a_disabled_focused
->texture
[0].data
.mask
.mask
=
1315 theme
->btn_max
->a_disabled_unfocused
->texture
[0].data
.mask
.mask
=
1316 theme
->btn_max
->disabled_mask
;
1317 theme
->btn_max
->a_hover_focused
->texture
[0].data
.mask
.mask
=
1318 theme
->btn_max
->a_hover_unfocused
->texture
[0].data
.mask
.mask
=
1319 theme
->btn_max
->hover_mask
;
1320 theme
->btn_max
->a_focused_pressed
->texture
[0].data
.mask
.mask
=
1321 theme
->btn_max
->a_unfocused_pressed
->texture
[0].data
.mask
.mask
=
1322 theme
->btn_max
->pressed_mask
;
1323 theme
->btn_max
->a_focused_unpressed
->texture
[0].data
.mask
.mask
=
1324 theme
->btn_max
->a_unfocused_unpressed
->texture
[0].data
.mask
.mask
=
1325 theme
->btn_max
->mask
;
1326 theme
->btn_max
->a_toggled_hover_focused
->texture
[0].data
.mask
.mask
=
1327 theme
->btn_max
->a_toggled_hover_unfocused
->texture
[0].data
.mask
.mask
=
1328 theme
->btn_max
->toggled_hover_mask
;
1329 theme
->btn_max
->a_toggled_focused_unpressed
->texture
[0].data
.mask
.mask
=
1330 theme
->btn_max
->a_toggled_unfocused_unpressed
->
1331 texture
[0].data
.mask
.mask
= theme
->btn_max
->toggled_mask
;
1332 theme
->btn_max
->a_toggled_focused_pressed
->texture
[0].data
.mask
.mask
=
1333 theme
->btn_max
->a_toggled_unfocused_pressed
->texture
[0].data
.mask
.mask
1334 = theme
->btn_max
->toggled_pressed_mask
;
1335 theme
->btn_close
->a_disabled_focused
->texture
[0].data
.mask
.mask
=
1336 theme
->btn_close
->a_disabled_unfocused
->texture
[0].data
.mask
.mask
=
1337 theme
->btn_close
->disabled_mask
;
1338 theme
->btn_close
->a_hover_focused
->texture
[0].data
.mask
.mask
=
1339 theme
->btn_close
->a_hover_unfocused
->texture
[0].data
.mask
.mask
=
1340 theme
->btn_close
->hover_mask
;
1341 theme
->btn_close
->a_focused_pressed
->texture
[0].data
.mask
.mask
=
1342 theme
->btn_close
->a_unfocused_pressed
->texture
[0].data
.mask
.mask
=
1343 theme
->btn_close
->pressed_mask
;
1344 theme
->btn_close
->a_focused_unpressed
->texture
[0].data
.mask
.mask
=
1345 theme
->btn_close
->a_unfocused_unpressed
->texture
[0].data
.mask
.mask
=
1346 theme
->btn_close
->mask
;
1347 theme
->btn_desk
->a_disabled_focused
->texture
[0].data
.mask
.mask
=
1348 theme
->btn_desk
->a_disabled_unfocused
->texture
[0].data
.mask
.mask
=
1349 theme
->btn_desk
->disabled_mask
;
1350 theme
->btn_desk
->a_hover_focused
->texture
[0].data
.mask
.mask
=
1351 theme
->btn_desk
->a_hover_unfocused
->texture
[0].data
.mask
.mask
=
1352 theme
->btn_desk
->hover_mask
;
1353 theme
->btn_desk
->a_focused_pressed
->texture
[0].data
.mask
.mask
=
1354 theme
->btn_desk
->a_unfocused_pressed
->texture
[0].data
.mask
.mask
=
1355 theme
->btn_desk
->pressed_mask
;
1356 theme
->btn_desk
->a_focused_unpressed
->texture
[0].data
.mask
.mask
=
1357 theme
->btn_desk
->a_unfocused_unpressed
->texture
[0].data
.mask
.mask
=
1358 theme
->btn_desk
->mask
;
1359 theme
->btn_desk
->a_toggled_hover_focused
->texture
[0].data
.mask
.mask
=
1360 theme
->btn_desk
->a_toggled_hover_unfocused
->texture
[0].data
.mask
.mask
=
1361 theme
->btn_desk
->toggled_hover_mask
;
1362 theme
->btn_desk
->a_toggled_focused_unpressed
->texture
[0].data
.mask
.mask
=
1363 theme
->btn_desk
->a_toggled_unfocused_unpressed
->
1364 texture
[0].data
.mask
.mask
= theme
->btn_desk
->toggled_mask
;
1365 theme
->btn_desk
->a_toggled_focused_pressed
->texture
[0].data
.mask
.mask
=
1366 theme
->btn_desk
->a_toggled_unfocused_pressed
->texture
[0].data
.mask
.mask
1367 = theme
->btn_desk
->toggled_pressed_mask
;
1368 theme
->btn_shade
->a_disabled_focused
->texture
[0].data
.mask
.mask
=
1369 theme
->btn_shade
->a_disabled_unfocused
->texture
[0].data
.mask
.mask
=
1370 theme
->btn_shade
->disabled_mask
;
1371 theme
->btn_shade
->a_hover_focused
->texture
[0].data
.mask
.mask
=
1372 theme
->btn_shade
->a_hover_unfocused
->texture
[0].data
.mask
.mask
=
1373 theme
->btn_shade
->hover_mask
;
1374 theme
->btn_shade
->a_focused_pressed
->texture
[0].data
.mask
.mask
=
1375 theme
->btn_shade
->a_unfocused_pressed
->texture
[0].data
.mask
.mask
=
1376 theme
->btn_shade
->pressed_mask
;
1377 theme
->btn_shade
->a_focused_unpressed
->texture
[0].data
.mask
.mask
=
1378 theme
->btn_shade
->a_unfocused_unpressed
->texture
[0].data
.mask
.mask
=
1379 theme
->btn_shade
->mask
;
1380 theme
->btn_shade
->a_toggled_hover_focused
->texture
[0].data
.mask
.mask
=
1381 theme
->btn_shade
->a_toggled_hover_unfocused
->texture
[0].data
.mask
.mask
1382 = theme
->btn_shade
->toggled_hover_mask
;
1383 theme
->btn_shade
->a_toggled_focused_unpressed
->texture
[0].data
.mask
.mask
=
1384 theme
->btn_shade
->a_toggled_unfocused_unpressed
->
1385 texture
[0].data
.mask
.mask
= theme
->btn_shade
->toggled_mask
;
1386 theme
->btn_shade
->a_toggled_focused_pressed
->texture
[0].data
.mask
.mask
=
1387 theme
->btn_shade
->a_toggled_unfocused_pressed
->
1388 texture
[0].data
.mask
.mask
= theme
->btn_shade
->toggled_pressed_mask
;
1389 theme
->btn_iconify
->a_disabled_focused
->texture
[0].data
.mask
.mask
=
1390 theme
->btn_iconify
->a_disabled_unfocused
->texture
[0].data
.mask
.mask
=
1391 theme
->btn_iconify
->disabled_mask
;
1392 theme
->btn_iconify
->a_hover_focused
->texture
[0].data
.mask
.mask
=
1393 theme
->btn_iconify
->a_hover_unfocused
->texture
[0].data
.mask
.mask
=
1394 theme
->btn_iconify
->hover_mask
;
1395 theme
->btn_iconify
->a_focused_pressed
->texture
[0].data
.mask
.mask
=
1396 theme
->btn_iconify
->a_unfocused_pressed
->texture
[0].data
.mask
.mask
=
1397 theme
->btn_iconify
->pressed_mask
;
1398 theme
->btn_iconify
->a_focused_unpressed
->texture
[0].data
.mask
.mask
=
1399 theme
->btn_iconify
->a_unfocused_unpressed
->texture
[0].data
.mask
.mask
=
1400 theme
->btn_iconify
->mask
;
1401 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1402 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1403 theme
->menu_bullet_mask
;
1404 theme
->btn_max
->a_disabled_focused
->texture
[0].data
.mask
.color
=
1405 theme
->btn_max
->disabled_focused_color
;
1406 theme
->btn_close
->a_disabled_focused
->texture
[0].data
.mask
.color
=
1407 theme
->btn_close
->disabled_focused_color
;
1408 theme
->btn_desk
->a_disabled_focused
->texture
[0].data
.mask
.color
=
1409 theme
->btn_desk
->disabled_focused_color
;
1410 theme
->btn_shade
->a_disabled_focused
->texture
[0].data
.mask
.color
=
1411 theme
->btn_shade
->disabled_focused_color
;
1412 theme
->btn_iconify
->a_disabled_focused
->texture
[0].data
.mask
.color
=
1413 theme
->btn_iconify
->disabled_focused_color
;
1414 theme
->btn_max
->a_disabled_unfocused
->texture
[0].data
.mask
.color
=
1415 theme
->btn_max
->disabled_unfocused_color
;
1416 theme
->btn_close
->a_disabled_unfocused
->texture
[0].data
.mask
.color
=
1417 theme
->btn_close
->disabled_unfocused_color
;
1418 theme
->btn_desk
->a_disabled_unfocused
->texture
[0].data
.mask
.color
=
1419 theme
->btn_desk
->disabled_unfocused_color
;
1420 theme
->btn_shade
->a_disabled_unfocused
->texture
[0].data
.mask
.color
=
1421 theme
->btn_shade
->disabled_unfocused_color
;
1422 theme
->btn_iconify
->a_disabled_unfocused
->texture
[0].data
.mask
.color
=
1423 theme
->btn_iconify
->disabled_unfocused_color
;
1424 theme
->btn_max
->a_hover_focused
->texture
[0].data
.mask
.color
=
1425 theme
->btn_max
->hover_focused_color
;
1426 theme
->btn_close
->a_hover_focused
->texture
[0].data
.mask
.color
=
1427 theme
->btn_close
->hover_focused_color
;
1428 theme
->btn_desk
->a_hover_focused
->texture
[0].data
.mask
.color
=
1429 theme
->btn_desk
->hover_focused_color
;
1430 theme
->btn_shade
->a_hover_focused
->texture
[0].data
.mask
.color
=
1431 theme
->btn_shade
->hover_focused_color
;
1432 theme
->btn_iconify
->a_hover_focused
->texture
[0].data
.mask
.color
=
1433 theme
->btn_iconify
->hover_focused_color
;
1434 theme
->btn_max
->a_hover_unfocused
->texture
[0].data
.mask
.color
=
1435 theme
->btn_max
->hover_unfocused_color
;
1436 theme
->btn_close
->a_hover_unfocused
->texture
[0].data
.mask
.color
=
1437 theme
->btn_close
->hover_unfocused_color
;
1438 theme
->btn_desk
->a_hover_unfocused
->texture
[0].data
.mask
.color
=
1439 theme
->btn_desk
->hover_unfocused_color
;
1440 theme
->btn_shade
->a_hover_unfocused
->texture
[0].data
.mask
.color
=
1441 theme
->btn_shade
->hover_unfocused_color
;
1442 theme
->btn_iconify
->a_hover_unfocused
->texture
[0].data
.mask
.color
=
1443 theme
->btn_iconify
->hover_unfocused_color
;
1444 theme
->btn_max
->a_toggled_hover_focused
->texture
[0].data
.mask
.color
=
1445 theme
->btn_max
->toggled_hover_focused_color
;
1446 theme
->btn_desk
->a_toggled_hover_focused
->texture
[0].data
.mask
.color
=
1447 theme
->btn_desk
->toggled_hover_focused_color
;
1448 theme
->btn_shade
->a_toggled_hover_focused
->texture
[0].data
.mask
.color
=
1449 theme
->btn_shade
->toggled_hover_focused_color
;
1450 theme
->btn_max
->a_toggled_hover_unfocused
->texture
[0].data
.mask
.color
=
1451 theme
->btn_max
->toggled_hover_unfocused_color
;
1452 theme
->btn_desk
->a_toggled_hover_unfocused
->texture
[0].data
.mask
.color
=
1453 theme
->btn_desk
->toggled_hover_unfocused_color
;
1454 theme
->btn_shade
->a_toggled_hover_unfocused
->texture
[0].data
.mask
.color
=
1455 theme
->btn_shade
->toggled_hover_unfocused_color
;
1456 theme
->btn_max
->a_toggled_focused_unpressed
->texture
[0].data
.mask
.color
=
1457 theme
->btn_max
->toggled_focused_unpressed_color
;
1458 theme
->btn_desk
->a_toggled_focused_unpressed
->texture
[0].data
.mask
.color
=
1459 theme
->btn_desk
->toggled_focused_unpressed_color
;
1460 theme
->btn_shade
->a_toggled_focused_unpressed
->texture
[0].data
.mask
.color
=
1461 theme
->btn_shade
->toggled_focused_unpressed_color
;
1462 theme
->btn_max
->a_toggled_unfocused_unpressed
->texture
[0].data
.mask
.color
=
1463 theme
->btn_max
->toggled_unfocused_unpressed_color
;
1464 theme
->btn_desk
->a_toggled_unfocused_unpressed
->texture
[0].data
.mask
.color
1465 = theme
->btn_desk
->toggled_unfocused_unpressed_color
;
1466 theme
->btn_shade
->a_toggled_unfocused_unpressed
->texture
[0].data
.mask
.color
1467 = theme
->btn_shade
->toggled_unfocused_unpressed_color
;
1468 theme
->btn_max
->a_toggled_focused_pressed
->texture
[0].data
.mask
.color
=
1469 theme
->btn_max
->toggled_focused_pressed_color
;
1470 theme
->btn_desk
->a_toggled_focused_pressed
->texture
[0].data
.mask
.color
=
1471 theme
->btn_desk
->toggled_focused_pressed_color
;
1472 theme
->btn_shade
->a_toggled_focused_pressed
->texture
[0].data
.mask
.color
=
1473 theme
->btn_shade
->toggled_focused_pressed_color
;
1474 theme
->btn_max
->a_toggled_unfocused_pressed
->texture
[0].data
.mask
.color
=
1475 theme
->btn_max
->toggled_unfocused_pressed_color
;
1476 theme
->btn_desk
->a_toggled_unfocused_pressed
->texture
[0].data
.mask
.color
=
1477 theme
->btn_desk
->toggled_unfocused_pressed_color
;
1478 theme
->btn_shade
->a_toggled_unfocused_pressed
->texture
[0].data
.mask
.color
=
1479 theme
->btn_shade
->toggled_unfocused_pressed_color
;
1480 theme
->btn_max
->a_focused_unpressed
->texture
[0].data
.mask
.color
=
1481 theme
->btn_max
->focused_unpressed_color
;
1482 theme
->btn_close
->a_focused_unpressed
->texture
[0].data
.mask
.color
=
1483 theme
->btn_close
->focused_unpressed_color
;
1484 theme
->btn_desk
->a_focused_unpressed
->texture
[0].data
.mask
.color
=
1485 theme
->btn_desk
->focused_unpressed_color
;
1486 theme
->btn_shade
->a_focused_unpressed
->texture
[0].data
.mask
.color
=
1487 theme
->btn_shade
->focused_unpressed_color
;
1488 theme
->btn_iconify
->a_focused_unpressed
->texture
[0].data
.mask
.color
=
1489 theme
->btn_iconify
->focused_unpressed_color
;
1490 theme
->btn_max
->a_focused_pressed
->texture
[0].data
.mask
.color
=
1491 theme
->btn_max
->focused_pressed_color
;
1492 theme
->btn_close
->a_focused_pressed
->texture
[0].data
.mask
.color
=
1493 theme
->btn_close
->focused_pressed_color
;
1494 theme
->btn_desk
->a_focused_pressed
->texture
[0].data
.mask
.color
=
1495 theme
->btn_desk
->focused_pressed_color
;
1496 theme
->btn_shade
->a_focused_pressed
->texture
[0].data
.mask
.color
=
1497 theme
->btn_shade
->focused_pressed_color
;
1498 theme
->btn_iconify
->a_focused_pressed
->texture
[0].data
.mask
.color
=
1499 theme
->btn_iconify
->focused_pressed_color
;
1500 theme
->btn_max
->a_unfocused_unpressed
->texture
[0].data
.mask
.color
=
1501 theme
->btn_max
->unfocused_unpressed_color
;
1502 theme
->btn_close
->a_unfocused_unpressed
->texture
[0].data
.mask
.color
=
1503 theme
->btn_close
->unfocused_unpressed_color
;
1504 theme
->btn_desk
->a_unfocused_unpressed
->texture
[0].data
.mask
.color
=
1505 theme
->btn_desk
->unfocused_unpressed_color
;
1506 theme
->btn_shade
->a_unfocused_unpressed
->texture
[0].data
.mask
.color
=
1507 theme
->btn_shade
->unfocused_unpressed_color
;
1508 theme
->btn_iconify
->a_unfocused_unpressed
->texture
[0].data
.mask
.color
=
1509 theme
->btn_iconify
->unfocused_unpressed_color
;
1510 theme
->btn_max
->a_unfocused_pressed
->texture
[0].data
.mask
.color
=
1511 theme
->btn_max
->unfocused_pressed_color
;
1512 theme
->btn_close
->a_unfocused_pressed
->texture
[0].data
.mask
.color
=
1513 theme
->btn_close
->unfocused_pressed_color
;
1514 theme
->btn_desk
->a_unfocused_pressed
->texture
[0].data
.mask
.color
=
1515 theme
->btn_desk
->unfocused_pressed_color
;
1516 theme
->btn_shade
->a_unfocused_pressed
->texture
[0].data
.mask
.color
=
1517 theme
->btn_shade
->unfocused_pressed_color
;
1518 theme
->btn_iconify
->a_unfocused_pressed
->texture
[0].data
.mask
.color
=
1519 theme
->btn_iconify
->unfocused_pressed_color
;
1520 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1521 theme
->menu_bullet_color
;
1522 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1523 theme
->menu_bullet_selected_color
;
1526 XrmDestroyDatabase(db
);
1528 /* set the font heights */
1529 theme
->win_font_height
= RrFontHeight
1530 (theme
->win_font_focused
,
1531 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
);
1532 theme
->win_font_height
=
1533 MAX(theme
->win_font_height
,
1535 (theme
->win_font_focused
,
1536 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
));
1537 theme
->menu_title_font_height
= RrFontHeight
1538 (theme
->menu_title_font
,
1539 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
);
1540 theme
->menu_font_height
= RrFontHeight
1542 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
);
1544 /* calculate some last extents */
1546 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1548 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1549 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1550 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1551 theme
->label_height
+= theme
->label_height
% 2;
1553 /* this would be nice I think, since padding.width can now be 0,
1554 but it breaks frame.c horribly and I don't feel like fixing that
1555 right now, so if anyone complains, here is how to keep text from
1556 going over the title's bevel/border with a padding.width of 0 and a
1557 bevelless/borderless label
1558 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1559 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1560 theme->title_height = theme->label_height +
1561 MAX(MAX(theme->padding * 2, ft + fb),
1562 MAX(theme->padding * 2, ut + ub));
1564 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1566 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1567 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1568 theme
->menu_title_height
= theme
->menu_title_label_height
+
1569 theme
->paddingy
* 2;
1571 theme
->button_size
= theme
->label_height
- 2;
1572 theme
->grip_width
= 25;
1574 RrAppearanceFree(a_disabled_focused_tmp
);
1575 RrAppearanceFree(a_disabled_unfocused_tmp
);
1576 RrAppearanceFree(a_hover_focused_tmp
);
1577 RrAppearanceFree(a_hover_unfocused_tmp
);
1578 RrAppearanceFree(a_focused_unpressed_tmp
);
1579 RrAppearanceFree(a_focused_pressed_tmp
);
1580 RrAppearanceFree(a_unfocused_unpressed_tmp
);
1581 RrAppearanceFree(a_unfocused_pressed_tmp
);
1582 RrAppearanceFree(a_toggled_hover_focused_tmp
);
1583 RrAppearanceFree(a_toggled_hover_unfocused_tmp
);
1584 RrAppearanceFree(a_toggled_focused_unpressed_tmp
);
1585 RrAppearanceFree(a_toggled_focused_pressed_tmp
);
1586 RrAppearanceFree(a_toggled_unfocused_unpressed_tmp
);
1587 RrAppearanceFree(a_toggled_unfocused_pressed_tmp
);
1592 void RrThemeFree(RrTheme
*theme
)
1595 g_free(theme
->name
);
1597 RrButtonFree(theme
->btn_max
);
1598 RrButtonFree(theme
->btn_close
);
1599 RrButtonFree(theme
->btn_desk
);
1600 RrButtonFree(theme
->btn_shade
);
1601 RrButtonFree(theme
->btn_iconify
);
1603 RrColorFree(theme
->menu_border_color
);
1604 RrColorFree(theme
->osd_border_color
);
1605 RrColorFree(theme
->frame_focused_border_color
);
1606 RrColorFree(theme
->frame_unfocused_border_color
);
1607 RrColorFree(theme
->title_separator_focused_color
);
1608 RrColorFree(theme
->title_separator_unfocused_color
);
1609 RrColorFree(theme
->cb_unfocused_color
);
1610 RrColorFree(theme
->cb_focused_color
);
1611 RrColorFree(theme
->title_focused_color
);
1612 RrColorFree(theme
->title_unfocused_color
);
1613 RrColorFree(theme
->titlebut_disabled_focused_color
);
1614 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1615 RrColorFree(theme
->titlebut_hover_focused_color
);
1616 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1617 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1618 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1619 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1620 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1621 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1622 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1623 RrColorFree(theme
->titlebut_focused_pressed_color
);
1624 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1625 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1626 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1627 RrColorFree(theme
->menu_title_color
);
1628 RrColorFree(theme
->menu_sep_color
);
1629 RrColorFree(theme
->menu_color
);
1630 RrColorFree(theme
->menu_bullet_color
);
1631 RrColorFree(theme
->menu_bullet_selected_color
);
1632 RrColorFree(theme
->menu_selected_color
);
1633 RrColorFree(theme
->menu_disabled_color
);
1634 RrColorFree(theme
->menu_disabled_selected_color
);
1635 RrColorFree(theme
->title_focused_shadow_color
);
1636 RrColorFree(theme
->title_unfocused_shadow_color
);
1637 RrColorFree(theme
->osd_text_active_color
);
1638 RrColorFree(theme
->osd_text_inactive_color
);
1639 RrColorFree(theme
->osd_text_active_shadow_color
);
1640 RrColorFree(theme
->osd_text_inactive_shadow_color
);
1641 RrColorFree(theme
->osd_pressed_color
);
1642 RrColorFree(theme
->osd_unpressed_color
);
1643 RrColorFree(theme
->osd_focused_color
);
1644 RrColorFree(theme
->osd_pressed_lineart
);
1645 RrColorFree(theme
->osd_focused_lineart
);
1646 RrColorFree(theme
->menu_title_shadow_color
);
1647 RrColorFree(theme
->menu_text_normal_shadow_color
);
1648 RrColorFree(theme
->menu_text_selected_shadow_color
);
1649 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1650 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1652 g_free(theme
->def_win_icon
);
1654 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1655 RrPixmapMaskFree(theme
->down_arrow_mask
);
1656 RrPixmapMaskFree(theme
->up_arrow_mask
);
1658 RrFontClose(theme
->win_font_focused
);
1659 RrFontClose(theme
->win_font_unfocused
);
1660 RrFontClose(theme
->menu_title_font
);
1661 RrFontClose(theme
->menu_font
);
1662 RrFontClose(theme
->osd_font_hilite
);
1663 RrFontClose(theme
->osd_font_unhilite
);
1665 RrAppearanceFree(theme
->a_focused_grip
);
1666 RrAppearanceFree(theme
->a_unfocused_grip
);
1667 RrAppearanceFree(theme
->a_focused_title
);
1668 RrAppearanceFree(theme
->a_unfocused_title
);
1669 RrAppearanceFree(theme
->a_focused_label
);
1670 RrAppearanceFree(theme
->a_unfocused_label
);
1671 RrAppearanceFree(theme
->a_icon
);
1672 RrAppearanceFree(theme
->a_focused_handle
);
1673 RrAppearanceFree(theme
->a_unfocused_handle
);
1674 RrAppearanceFree(theme
->a_menu
);
1675 RrAppearanceFree(theme
->a_menu_title
);
1676 RrAppearanceFree(theme
->a_menu_text_title
);
1677 RrAppearanceFree(theme
->a_menu_normal
);
1678 RrAppearanceFree(theme
->a_menu_selected
);
1679 RrAppearanceFree(theme
->a_menu_disabled
);
1680 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1681 RrAppearanceFree(theme
->a_menu_text_normal
);
1682 RrAppearanceFree(theme
->a_menu_text_selected
);
1683 RrAppearanceFree(theme
->a_menu_text_disabled
);
1684 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1685 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1686 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1687 RrAppearanceFree(theme
->a_clear
);
1688 RrAppearanceFree(theme
->a_clear_tex
);
1689 RrAppearanceFree(theme
->osd_bg
);
1690 RrAppearanceFree(theme
->osd_hilite_bg
);
1691 RrAppearanceFree(theme
->osd_hilite_label
);
1692 RrAppearanceFree(theme
->osd_unhilite_bg
);
1693 RrAppearanceFree(theme
->osd_unhilite_label
);
1694 RrAppearanceFree(theme
->osd_pressed_button
);
1695 RrAppearanceFree(theme
->osd_unpressed_button
);
1696 RrAppearanceFree(theme
->osd_focused_button
);
1698 g_slice_free(RrTheme
, theme
);
1702 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
)
1705 XrmDatabase db
= NULL
;
1708 if (name
[0] == '/') {
1709 s
= g_build_filename(name
, "openbox-3", "themerc", NULL
);
1710 if ((db
= XrmGetFileDatabase(s
)))
1711 *path
= g_path_get_dirname(s
);
1716 p
= obt_paths_new();
1718 /* XXX backwards compatibility, remove me sometime later */
1719 s
= g_build_filename(g_get_home_dir(), ".themes", name
,
1720 "openbox-3", "themerc", NULL
);
1721 if ((db
= XrmGetFileDatabase(s
)))
1722 *path
= g_path_get_dirname(s
);
1725 for (it
= obt_paths_data_dirs(p
); !db
&& it
; it
= g_slist_next(it
))
1727 s
= g_build_filename(it
->data
, "themes", name
,
1728 "openbox-3", "themerc", NULL
);
1729 if ((db
= XrmGetFileDatabase(s
)))
1730 *path
= g_path_get_dirname(s
);
1738 s
= g_build_filename(name
, "themerc", NULL
);
1739 if ((db
= XrmGetFileDatabase(s
)))
1740 *path
= g_path_get_dirname(s
);
1747 static gchar
*create_class_name(const gchar
*rname
)
1749 gchar
*rclass
= g_strdup(rname
);
1754 p
= strchr(p
+1, '.');
1755 if (p
== NULL
) break;
1757 if (*p
== '\0') break;
1762 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
)
1764 gboolean ret
= FALSE
;
1765 gchar
*rclass
= create_class_name(rname
);
1766 gchar
*rettype
, *end
;
1769 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1770 retvalue
.addr
!= NULL
) {
1771 *value
= (gint
)strtol(retvalue
.addr
, &end
, 10);
1772 if (end
!= retvalue
.addr
)
1780 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
)
1782 gboolean ret
= FALSE
;
1783 gchar
*rclass
= create_class_name(rname
);
1787 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1788 retvalue
.addr
!= NULL
) {
1789 *value
= retvalue
.addr
;
1797 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
1798 const gchar
*rname
, RrColor
**value
)
1800 gboolean ret
= FALSE
;
1801 gchar
*rclass
= create_class_name(rname
);
1805 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1806 retvalue
.addr
!= NULL
) {
1807 RrColor
*c
= RrColorParse(inst
, retvalue
.addr
);
1818 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
1819 RrTheme
*theme
, const gchar
*maskname
,
1820 RrPixmapMask
**value
)
1822 gboolean ret
= FALSE
;
1824 gint hx
, hy
; /* ignored */
1828 s
= g_build_filename(path
, maskname
, NULL
);
1829 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1831 *value
= RrPixmapMaskNew(inst
, w
, h
, (gchar
*)b
);
1839 static void parse_appearance(gchar
*tex
, RrSurfaceColorType
*grad
,
1840 RrReliefType
*relief
, RrBevelType
*bevel
,
1841 gboolean
*interlaced
, gboolean
*border
,
1842 gboolean allow_trans
)
1846 /* convert to all lowercase */
1847 for (t
= tex
; *t
!= '\0'; ++t
)
1848 *t
= g_ascii_tolower(*t
);
1850 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1851 *grad
= RR_SURFACE_PARENTREL
;
1853 if (strstr(tex
, "gradient") != NULL
) {
1854 if (strstr(tex
, "crossdiagonal") != NULL
)
1855 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1856 else if (strstr(tex
, "pyramid") != NULL
)
1857 *grad
= RR_SURFACE_PYRAMID
;
1858 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1859 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1860 else if (strstr(tex
, "horizontal") != NULL
)
1861 *grad
= RR_SURFACE_HORIZONTAL
;
1862 else if (strstr(tex
, "splitvertical") != NULL
)
1863 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1864 else if (strstr(tex
, "vertical") != NULL
)
1865 *grad
= RR_SURFACE_VERTICAL
;
1867 *grad
= RR_SURFACE_DIAGONAL
;
1869 *grad
= RR_SURFACE_SOLID
;
1873 if (strstr(tex
, "sunken") != NULL
)
1874 *relief
= RR_RELIEF_SUNKEN
;
1875 else if (strstr(tex
, "flat") != NULL
)
1876 *relief
= RR_RELIEF_FLAT
;
1877 else if (strstr(tex
, "raised") != NULL
)
1878 *relief
= RR_RELIEF_RAISED
;
1880 *relief
= (*grad
== RR_SURFACE_PARENTREL
) ?
1881 RR_RELIEF_FLAT
: RR_RELIEF_RAISED
;
1884 if (*relief
== RR_RELIEF_FLAT
) {
1885 if (strstr(tex
, "border") != NULL
)
1888 if (strstr(tex
, "bevel2") != NULL
)
1889 *bevel
= RR_BEVEL_2
;
1891 *bevel
= RR_BEVEL_1
;
1894 if (strstr(tex
, "interlaced") != NULL
)
1897 *interlaced
= FALSE
;
1900 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
1901 const gchar
*rname
, RrAppearance
*value
,
1902 gboolean allow_trans
)
1904 gboolean ret
= FALSE
;
1905 gchar
*rclass
= create_class_name(rname
);
1906 gchar
*cname
, *ctoname
, *bcname
, *icname
, *hname
, *sname
;
1907 gchar
*csplitname
, *ctosplitname
;
1912 cname
= g_strconcat(rname
, ".color", NULL
);
1913 ctoname
= g_strconcat(rname
, ".colorTo", NULL
);
1914 bcname
= g_strconcat(rname
, ".border.color", NULL
);
1915 icname
= g_strconcat(rname
, ".interlace.color", NULL
);
1916 hname
= g_strconcat(rname
, ".highlight", NULL
);
1917 sname
= g_strconcat(rname
, ".shadow", NULL
);
1918 csplitname
= g_strconcat(rname
, ".color.splitTo", NULL
);
1919 ctosplitname
= g_strconcat(rname
, ".colorTo.splitTo", NULL
);
1921 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1922 retvalue
.addr
!= NULL
) {
1923 parse_appearance(retvalue
.addr
,
1924 &value
->surface
.grad
,
1925 &value
->surface
.relief
,
1926 &value
->surface
.bevel
,
1927 &value
->surface
.interlaced
,
1928 &value
->surface
.border
,
1930 if (!read_color(db
, inst
, cname
, &value
->surface
.primary
))
1931 value
->surface
.primary
= RrColorNew(inst
, 0, 0, 0);
1932 if (!read_color(db
, inst
, ctoname
, &value
->surface
.secondary
))
1933 value
->surface
.secondary
= RrColorNew(inst
, 0, 0, 0);
1934 if (value
->surface
.border
)
1935 if (!read_color(db
, inst
, bcname
,
1936 &value
->surface
.border_color
))
1937 value
->surface
.border_color
= RrColorNew(inst
, 0, 0, 0);
1938 if (value
->surface
.interlaced
)
1939 if (!read_color(db
, inst
, icname
,
1940 &value
->surface
.interlace_color
))
1941 value
->surface
.interlace_color
= RrColorNew(inst
, 0, 0, 0);
1942 if (read_int(db
, hname
, &i
) && i
>= 0)
1943 value
->surface
.bevel_light_adjust
= i
;
1944 if (read_int(db
, sname
, &i
) && i
>= 0 && i
<= 256)
1945 value
->surface
.bevel_dark_adjust
= i
;
1947 if (value
->surface
.grad
== RR_SURFACE_SPLIT_VERTICAL
) {
1950 if (!read_color(db
, inst
, csplitname
,
1951 &value
->surface
.split_primary
))
1953 r
= value
->surface
.primary
->r
;
1955 g
= value
->surface
.primary
->g
;
1957 b
= value
->surface
.primary
->b
;
1959 if (r
> 0xFF) r
= 0xFF;
1960 if (g
> 0xFF) g
= 0xFF;
1961 if (b
> 0xFF) b
= 0xFF;
1962 value
->surface
.split_primary
= RrColorNew(inst
, r
, g
, b
);
1965 if (!read_color(db
, inst
, ctosplitname
,
1966 &value
->surface
.split_secondary
))
1968 r
= value
->surface
.secondary
->r
;
1970 g
= value
->surface
.secondary
->g
;
1972 b
= value
->surface
.secondary
->b
;
1974 if (r
> 0xFF) r
= 0xFF;
1975 if (g
> 0xFF) g
= 0xFF;
1976 if (b
> 0xFF) b
= 0xFF;
1977 value
->surface
.split_secondary
= RrColorNew(inst
, r
, g
, b
);
1984 g_free(ctosplitname
);
1996 static int parse_inline_number(const char *p
)
2004 for (; isdigit(*p
); ++p
)
2005 res
= res
* 10 + *p
- '0';
2010 static void set_default_appearance(RrAppearance
*a
)
2012 a
->surface
.grad
= RR_SURFACE_SOLID
;
2013 a
->surface
.relief
= RR_RELIEF_FLAT
;
2014 a
->surface
.bevel
= RR_BEVEL_1
;
2015 a
->surface
.interlaced
= FALSE
;
2016 a
->surface
.border
= FALSE
;
2017 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
2018 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
2021 /* Reads the output from gimp's C-Source file format into valid RGBA data for
2022 an RrTextureRGBA. */
2023 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
2028 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
2030 for (i
= 0; i
< width
* height
; ++i
) {
2031 guchar a
= ((*p
>> 24) & 0xff);
2032 guchar b
= ((*p
>> 16) & 0xff);
2033 guchar g
= ((*p
>> 8) & 0xff);
2034 guchar r
= ((*p
>> 0) & 0xff);
2036 *p
= ((r
<< RrDefaultRedOffset
) +
2037 (g
<< RrDefaultGreenOffset
) +
2038 (b
<< RrDefaultBlueOffset
) +
2039 (a
<< RrDefaultAlphaOffset
));
2046 static void read_button_colors(XrmDatabase db
, const RrInstance
*inst
,
2047 const RrTheme
*theme
, RrButton
*btn
,
2048 const gchar
*btnname
)
2052 /* active unpressed */
2053 name
= g_strdup_printf("window.active.button.%s.unpressed.image.color",
2055 READ_COLOR(name
, btn
->focused_unpressed_color
,
2056 RrColorCopy(theme
->titlebut_focused_unpressed_color
));
2059 /* inactive unpressed */
2060 name
= g_strdup_printf("window.inactive.button.%s.unpressed.image.color",
2062 READ_COLOR(name
, btn
->unfocused_unpressed_color
,
2063 RrColorCopy(theme
->titlebut_unfocused_unpressed_color
));
2066 /* active pressed */
2067 name
= g_strdup_printf("window.active.button.%s.pressed.image.color",
2069 READ_COLOR(name
, btn
->focused_pressed_color
,
2070 RrColorCopy(theme
->titlebut_focused_pressed_color
));
2073 /* inactive pressed */
2074 name
= g_strdup_printf("window.inactive.button.%s.pressed.image.color",
2076 READ_COLOR(name
, btn
->unfocused_pressed_color
,
2077 RrColorCopy(theme
->titlebut_unfocused_pressed_color
));
2080 /* active disabled */
2081 name
= g_strdup_printf("window.active.button.%s.disabled.image.color",
2083 READ_COLOR(name
, btn
->disabled_focused_color
,
2084 RrColorCopy(theme
->titlebut_disabled_focused_color
));
2087 /* inactive disabled */
2088 name
= g_strdup_printf("window.inactive.button.%s.disabled.image.color",
2090 READ_COLOR(name
, btn
->disabled_unfocused_color
,
2091 RrColorCopy(theme
->titlebut_disabled_unfocused_color
));
2095 name
= g_strdup_printf("window.active.button.%s.hover.image.color",
2097 READ_COLOR(name
, btn
->hover_focused_color
,
2098 RrColorCopy(theme
->titlebut_hover_focused_color
));
2101 /* inactive hover */
2102 name
= g_strdup_printf("window.inactive.button.%s.hover.image.color",
2104 READ_COLOR(name
, btn
->hover_unfocused_color
,
2105 RrColorCopy(theme
->titlebut_hover_unfocused_color
));
2108 /* active toggled unpressed */
2109 name
= g_strdup_printf("window.active.button.%s.toggled."
2110 "unpressed.image.color", btnname
);
2111 READ_COLOR(name
, btn
->toggled_focused_unpressed_color
,
2112 RrColorCopy(theme
->titlebut_toggled_focused_unpressed_color
));
2115 /* inactive toggled unpressed */
2116 name
= g_strdup_printf("window.inactive.button.%s.toggled."
2117 "unpressed.image.color", btnname
);
2118 READ_COLOR(name
, btn
->toggled_unfocused_unpressed_color
,
2119 RrColorCopy(theme
->titlebut_toggled_unfocused_unpressed_color
));
2122 /* active toggled hover */
2123 name
= g_strdup_printf("window.active.button.%s.toggled.hover.image.color",
2125 READ_COLOR(name
, btn
->toggled_hover_focused_color
,
2126 RrColorCopy(theme
->titlebut_toggled_hover_focused_color
));
2130 /* inactive toggled hover */
2131 name
= g_strdup_printf("window.inactive.button.%s.toggled.hover."
2132 "image.color", btnname
);
2133 READ_COLOR(name
, btn
->toggled_hover_unfocused_color
,
2134 RrColorCopy(theme
->titlebut_toggled_hover_unfocused_color
));
2137 /* active toggled pressed */
2138 name
= g_strdup_printf("window.active.button.%s.toggled.pressed."
2139 "image.color", btnname
);
2140 READ_COLOR(name
, btn
->toggled_focused_pressed_color
,
2141 RrColorCopy(theme
->titlebut_toggled_focused_pressed_color
));
2144 /* inactive toggled pressed */
2145 name
= g_strdup_printf("window.inactive.button.%s.toggled.pressed."
2146 "image.color", btnname
);
2147 READ_COLOR(name
, btn
->toggled_unfocused_pressed_color
,
2148 RrColorCopy(theme
->titlebut_toggled_unfocused_pressed_color
));