1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 theme.c for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 See the COPYING file for a copy of the GNU General Public License.
26 #include "obt/paths.h"
29 #include <X11/Xresource.h>
34 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
);
35 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
);
36 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
);
37 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
38 const gchar
*rname
, RrColor
**value
);
39 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
40 RrTheme
*theme
, const gchar
*maskname
,
41 RrPixmapMask
**value
);
42 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
43 const gchar
*rname
, RrAppearance
*value
,
44 gboolean allow_trans
);
45 static int parse_inline_number(const char *p
);
46 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
);
47 static void set_default_appearance(RrAppearance
*a
);
49 static RrFont
*get_font(RrFont
*target
, RrFont
**default_font
,
50 const RrInstance
*inst
)
56 /* Only load the default font once */
58 RrFontRef(*default_font
);
60 *default_font
= RrFontOpenDefault(inst
);
66 #define READ_INT(x_resstr, x_var, x_min, x_max, x_def) \
67 if (!read_int(db, x_resstr, & x_var) || \
68 x_var < x_min || x_var > x_max) \
71 #define READ_COLOR(x_resstr, x_var, x_def) \
72 if (!read_color(db, inst, x_resstr, & x_var)) \
75 #define READ_COLOR_(x_res1, x_res2, x_var, x_def) \
76 if (!read_color(db, inst, x_res1, & x_var) && \
77 !read_color(db, inst, x_res2, & x_var)) \
80 #define READ_MASK_COPY(x_file, x_var, x_copysrc) \
81 if (!read_mask(inst, path, theme, x_file, & x_var)) \
82 x_var = RrPixmapMaskCopy(x_copysrc);
84 #define READ_APPEARANCE(x_resstr, x_var, x_parrel) \
85 if (!read_appearance(db, inst, x_resstr, x_var, x_parrel)) \
86 set_default_appearance(x_var);
88 #define READ_APPEARANCE_COPY(x_resstr, x_var, x_parrel, x_defval) \
89 if (!read_appearance(db, inst, x_resstr, x_var, x_parrel)) {\
90 RrAppearanceFree(x_var); \
91 x_var = RrAppearanceCopy(x_defval); }
93 #define READ_APPEARANCE_(x_res1, x_res2, x_var, x_parrel, x_defval) \
94 if (!read_appearance(db, inst, x_res1, x_var, x_parrel) && \
95 !read_appearance(db, inst, x_res2, x_var, x_parrel)) {\
96 RrAppearanceFree(x_var); \
97 x_var = RrAppearanceCopy(x_defval); }
99 RrTheme
* RrThemeNew(const RrInstance
*inst
, const gchar
*name
,
100 gboolean allow_fallback
,
101 RrFont
*active_window_font
, RrFont
*inactive_window_font
,
102 RrFont
*menu_title_font
, RrFont
*menu_item_font
,
103 RrFont
*active_osd_font
, RrFont
*inactive_osd_font
)
105 XrmDatabase db
= NULL
;
106 RrJustify winjust
, mtitlejust
;
109 RrFont
*default_font
= NULL
;
112 gint menu_overlap
= 0;
113 RrAppearance
*a_disabled_focused_tmp
;
114 RrAppearance
*a_disabled_unfocused_tmp
;
115 RrAppearance
*a_hover_focused_tmp
;
116 RrAppearance
*a_hover_unfocused_tmp
;
117 RrAppearance
*a_focused_unpressed_tmp
;
118 RrAppearance
*a_focused_pressed_tmp
;
119 RrAppearance
*a_unfocused_unpressed_tmp
;
120 RrAppearance
*a_unfocused_pressed_tmp
;
121 RrAppearance
*a_toggled_hover_focused_tmp
;
122 RrAppearance
*a_toggled_hover_unfocused_tmp
;
123 RrAppearance
*a_toggled_focused_unpressed_tmp
;
124 RrAppearance
*a_toggled_focused_pressed_tmp
;
125 RrAppearance
*a_toggled_unfocused_unpressed_tmp
;
126 RrAppearance
*a_toggled_unfocused_pressed_tmp
;
129 db
= loaddb(name
, &path
);
131 g_message("Unable to load the theme '%s'", name
);
133 g_message("Falling back to the default theme '%s'",
135 /* fallback to the default theme */
140 if (allow_fallback
) {
141 db
= loaddb(DEFAULT_THEME
, &path
);
143 g_message("Unable to load the theme '%s'", DEFAULT_THEME
);
150 /* initialize temp reading textures */
151 a_disabled_focused_tmp
= RrAppearanceNew(inst
, 1);
152 a_disabled_unfocused_tmp
= RrAppearanceNew(inst
, 1);
153 a_hover_focused_tmp
= RrAppearanceNew(inst
, 1);
154 a_hover_unfocused_tmp
= RrAppearanceNew(inst
, 1);
155 a_toggled_focused_unpressed_tmp
= RrAppearanceNew(inst
, 1);
156 a_toggled_unfocused_unpressed_tmp
= RrAppearanceNew(inst
, 1);
157 a_toggled_hover_focused_tmp
= RrAppearanceNew(inst
, 1);
158 a_toggled_hover_unfocused_tmp
= RrAppearanceNew(inst
, 1);
159 a_toggled_focused_pressed_tmp
= RrAppearanceNew(inst
, 1);
160 a_toggled_unfocused_pressed_tmp
= RrAppearanceNew(inst
, 1);
161 a_focused_unpressed_tmp
= RrAppearanceNew(inst
, 1);
162 a_focused_pressed_tmp
= RrAppearanceNew(inst
, 1);
163 a_unfocused_unpressed_tmp
= RrAppearanceNew(inst
, 1);
164 a_unfocused_pressed_tmp
= RrAppearanceNew(inst
, 1);
166 /* initialize theme */
167 theme
= g_slice_new0(RrTheme
, 1);
170 theme
->name
= g_strdup(name
? name
: DEFAULT_THEME
);
172 theme
->a_disabled_focused_max
= RrAppearanceNew(inst
, 1);
173 theme
->a_disabled_unfocused_max
= RrAppearanceNew(inst
, 1);
174 theme
->a_hover_focused_max
= RrAppearanceNew(inst
, 1);
175 theme
->a_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
176 theme
->a_toggled_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
177 theme
->a_toggled_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
178 theme
->a_toggled_hover_focused_max
= RrAppearanceNew(inst
, 1);
179 theme
->a_toggled_hover_unfocused_max
= RrAppearanceNew(inst
, 1);
180 theme
->a_toggled_focused_pressed_max
= RrAppearanceNew(inst
, 1);
181 theme
->a_toggled_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
182 theme
->a_focused_unpressed_max
= RrAppearanceNew(inst
, 1);
183 theme
->a_focused_pressed_max
= RrAppearanceNew(inst
, 1);
184 theme
->a_unfocused_unpressed_max
= RrAppearanceNew(inst
, 1);
185 theme
->a_unfocused_pressed_max
= RrAppearanceNew(inst
, 1);
186 theme
->a_disabled_focused_desk
= RrAppearanceNew(inst
, 1);
187 theme
->a_disabled_unfocused_desk
= RrAppearanceNew(inst
, 1);
188 theme
->a_hover_focused_desk
= RrAppearanceNew(inst
, 1);
189 theme
->a_hover_unfocused_desk
= RrAppearanceNew(inst
, 1);
190 theme
->a_toggled_focused_unpressed_desk
= RrAppearanceNew(inst
, 1);
191 theme
->a_toggled_unfocused_unpressed_desk
= RrAppearanceNew(inst
, 1);
192 theme
->a_toggled_hover_focused_desk
= RrAppearanceNew(inst
, 1);
193 theme
->a_toggled_hover_unfocused_desk
= RrAppearanceNew(inst
, 1);
194 theme
->a_toggled_focused_pressed_desk
= RrAppearanceNew(inst
, 1);
195 theme
->a_toggled_unfocused_pressed_desk
= RrAppearanceNew(inst
, 1);
196 theme
->a_focused_unpressed_desk
= RrAppearanceNew(inst
, 1);
197 theme
->a_focused_pressed_desk
= RrAppearanceNew(inst
, 1);
198 theme
->a_unfocused_unpressed_desk
= RrAppearanceNew(inst
, 1);
199 theme
->a_unfocused_pressed_desk
= RrAppearanceNew(inst
, 1);
200 theme
->a_disabled_focused_shade
= RrAppearanceNew(inst
, 1);
201 theme
->a_disabled_unfocused_shade
= RrAppearanceNew(inst
, 1);
202 theme
->a_hover_focused_shade
= RrAppearanceNew(inst
, 1);
203 theme
->a_hover_unfocused_shade
= RrAppearanceNew(inst
, 1);
204 theme
->a_toggled_focused_unpressed_shade
= RrAppearanceNew(inst
, 1);
205 theme
->a_toggled_unfocused_unpressed_shade
= RrAppearanceNew(inst
, 1);
206 theme
->a_toggled_hover_focused_shade
= RrAppearanceNew(inst
, 1);
207 theme
->a_toggled_hover_unfocused_shade
= RrAppearanceNew(inst
, 1);
208 theme
->a_toggled_focused_pressed_shade
= RrAppearanceNew(inst
, 1);
209 theme
->a_toggled_unfocused_pressed_shade
= RrAppearanceNew(inst
, 1);
210 theme
->a_focused_unpressed_shade
= RrAppearanceNew(inst
, 1);
211 theme
->a_focused_pressed_shade
= RrAppearanceNew(inst
, 1);
212 theme
->a_unfocused_unpressed_shade
= RrAppearanceNew(inst
, 1);
213 theme
->a_unfocused_pressed_shade
= RrAppearanceNew(inst
, 1);
214 theme
->a_disabled_focused_close
= RrAppearanceNew(inst
, 1);
215 theme
->a_disabled_unfocused_close
= RrAppearanceNew(inst
, 1);
216 theme
->a_hover_focused_close
= RrAppearanceNew(inst
, 1);
217 theme
->a_hover_unfocused_close
= RrAppearanceNew(inst
, 1);
218 theme
->a_focused_unpressed_close
= RrAppearanceNew(inst
, 1);
219 theme
->a_focused_pressed_close
= RrAppearanceNew(inst
, 1);
220 theme
->a_unfocused_unpressed_close
= RrAppearanceNew(inst
, 1);
221 theme
->a_unfocused_pressed_close
= RrAppearanceNew(inst
, 1);
222 theme
->a_disabled_focused_iconify
= RrAppearanceNew(inst
, 1);
223 theme
->a_disabled_unfocused_iconify
= RrAppearanceNew(inst
, 1);
224 theme
->a_hover_focused_iconify
= RrAppearanceNew(inst
, 1);
225 theme
->a_hover_unfocused_iconify
= RrAppearanceNew(inst
, 1);
226 theme
->a_focused_unpressed_iconify
= RrAppearanceNew(inst
, 1);
227 theme
->a_focused_pressed_iconify
= RrAppearanceNew(inst
, 1);
228 theme
->a_unfocused_unpressed_iconify
= RrAppearanceNew(inst
, 1);
229 theme
->a_unfocused_pressed_iconify
= RrAppearanceNew(inst
, 1);
230 theme
->a_focused_grip
= RrAppearanceNew(inst
, 0);
231 theme
->a_unfocused_grip
= RrAppearanceNew(inst
, 0);
232 theme
->a_focused_title
= RrAppearanceNew(inst
, 0);
233 theme
->a_unfocused_title
= RrAppearanceNew(inst
, 0);
234 theme
->a_focused_label
= RrAppearanceNew(inst
, 1);
235 theme
->a_unfocused_label
= RrAppearanceNew(inst
, 1);
236 theme
->a_icon
= RrAppearanceNew(inst
, 1);
237 theme
->a_focused_handle
= RrAppearanceNew(inst
, 0);
238 theme
->a_unfocused_handle
= RrAppearanceNew(inst
, 0);
239 theme
->a_menu
= RrAppearanceNew(inst
, 0);
240 theme
->a_menu_title
= RrAppearanceNew(inst
, 0);
241 theme
->a_menu_text_title
= RrAppearanceNew(inst
, 1);
242 theme
->a_menu_normal
= RrAppearanceNew(inst
, 0);
243 theme
->a_menu_selected
= RrAppearanceNew(inst
, 0);
244 theme
->a_menu_disabled
= RrAppearanceNew(inst
, 0);
245 /* a_menu_disabled_selected is copied from a_menu_selected */
246 theme
->a_menu_text_normal
= RrAppearanceNew(inst
, 1);
247 theme
->a_menu_text_selected
= RrAppearanceNew(inst
, 1);
248 theme
->a_menu_text_disabled
= RrAppearanceNew(inst
, 1);
249 theme
->a_menu_text_disabled_selected
= RrAppearanceNew(inst
, 1);
250 theme
->a_menu_bullet_normal
= RrAppearanceNew(inst
, 1);
251 theme
->a_menu_bullet_selected
= RrAppearanceNew(inst
, 1);
252 theme
->a_clear
= RrAppearanceNew(inst
, 0);
253 theme
->a_clear_tex
= RrAppearanceNew(inst
, 1);
254 theme
->osd_bg
= RrAppearanceNew(inst
, 0);
255 theme
->osd_hilite_label
= RrAppearanceNew(inst
, 1);
256 theme
->osd_hilite_bg
= RrAppearanceNew(inst
, 0);
257 theme
->osd_unhilite_label
= RrAppearanceNew(inst
, 1);
258 theme
->osd_unhilite_bg
= RrAppearanceNew(inst
, 0);
260 /* load the font stuff */
261 theme
->win_font_focused
= get_font(active_window_font
,
262 &default_font
, inst
);
263 theme
->win_font_unfocused
= get_font(inactive_window_font
,
264 &default_font
, inst
);
266 winjust
= RR_JUSTIFY_LEFT
;
267 if (read_string(db
, "window.label.text.justify", &str
)) {
268 if (!g_ascii_strcasecmp(str
, "right"))
269 winjust
= RR_JUSTIFY_RIGHT
;
270 else if (!g_ascii_strcasecmp(str
, "center"))
271 winjust
= RR_JUSTIFY_CENTER
;
274 theme
->menu_title_font
= get_font(menu_title_font
, &default_font
, inst
);
276 mtitlejust
= RR_JUSTIFY_LEFT
;
277 if (read_string(db
, "menu.title.text.justify", &str
)) {
278 if (!g_ascii_strcasecmp(str
, "right"))
279 mtitlejust
= RR_JUSTIFY_RIGHT
;
280 else if (!g_ascii_strcasecmp(str
, "center"))
281 mtitlejust
= RR_JUSTIFY_CENTER
;
284 theme
->menu_font
= get_font(menu_item_font
, &default_font
, inst
);
286 theme
->osd_font_hilite
= get_font(active_osd_font
, &default_font
, inst
);
287 theme
->osd_font_unhilite
= get_font(inactive_osd_font
, &default_font
,inst
);
289 /* load direct dimensions */
290 READ_INT("menu.overlap", menu_overlap
, -100, 100, 0);
291 READ_INT("menu.overlap.x", theme
->menu_overlap_x
, -100, 100, menu_overlap
);
292 READ_INT("menu.overlap.y", theme
->menu_overlap_y
, -100, 100, menu_overlap
);
293 READ_INT("window.handle.width", theme
->handle_height
, 0, 100, 6);
294 READ_INT("padding.width", theme
->paddingx
, 0, 100, 3);
295 READ_INT("padding.height", theme
->paddingy
, 0, 100, theme
->paddingx
);
296 READ_INT("border.width", theme
->fbwidth
, 0, 100, 1);
297 READ_INT("menu.border.width", theme
->mbwidth
, 0, 100, theme
->fbwidth
);
298 READ_INT("osd.border.width", theme
->obwidth
, 0, 100, theme
->fbwidth
);
299 READ_INT("menu.separator.width", theme
->menu_sep_width
, 1, 100, 1);
300 READ_INT("menu.separator.padding.width", theme
->menu_sep_paddingx
, 0, 100, 6);
301 READ_INT("menu.separator.padding.height", theme
->menu_sep_paddingy
, 0, 100, 3);
302 READ_INT("window.client.padding.width", theme
->cbwidthx
, 0, 100,
304 READ_INT("window.client.padding.height", theme
->cbwidthy
, 0, 100,
308 READ_COLOR_("window.active.border.color", "border.color",
309 theme
->frame_focused_border_color
, RrColorNew(inst
, 0, 0, 0));
311 /* title separator focused color inherits from focused border color */
312 READ_COLOR("window.active.title.separator.color",
313 theme
->title_separator_focused_color
,
314 RrColorCopy(theme
->frame_focused_border_color
));
316 /* unfocused border color inherits from frame focused border color */
317 READ_COLOR("window.inactive.border.color",
318 theme
->frame_unfocused_border_color
,
319 RrColorCopy(theme
->frame_focused_border_color
));
321 /* title separator unfocused color inherits from unfocused border color */
322 READ_COLOR("window.inactive.title.separator.color",
323 theme
->title_separator_unfocused_color
,
324 RrColorCopy(theme
->frame_unfocused_border_color
));
326 /* menu border color inherits from frame focused border color */
327 READ_COLOR("menu.border.color", theme
->menu_border_color
,
328 RrColorCopy(theme
->frame_focused_border_color
));
330 /* osd border color inherits from frame focused border color */
331 READ_COLOR("osd.border.color", theme
->osd_border_color
,
332 RrColorCopy(theme
->frame_focused_border_color
));
334 READ_COLOR("window.active.client.color", theme
->cb_focused_color
,
335 RrColorNew(inst
, 0xff, 0xff, 0xff));
337 READ_COLOR("window.inactive.client.color", theme
->cb_unfocused_color
,
338 RrColorNew(inst
, 0xff, 0xff, 0xff));
340 READ_COLOR("window.active.label.text.color", theme
->title_focused_color
,
341 RrColorNew(inst
, 0x0, 0x0, 0x0));
343 READ_COLOR_("osd.active.label.text.color",
344 "osd.label.text.color",
345 theme
->osd_color
, RrColorCopy(theme
->title_focused_color
));
347 READ_COLOR("window.inactive.label.text.color", theme
->title_unfocused_color
,
348 RrColorCopy(theme
->title_unfocused_color
));
350 READ_COLOR("osd.inactive.label.text.color", theme
->osd_text_inactive_color
,
351 RrColorNew(inst
, 0xff, 0xff, 0xff));
353 READ_COLOR("window.inactive.label.text.color",
354 theme
->title_unfocused_color
,
355 RrColorNew(inst
, 0xff, 0xff, 0xff));
357 READ_COLOR("window.active.button.unpressed.image.color",
358 theme
->titlebut_focused_unpressed_color
,
359 RrColorNew(inst
, 0, 0, 0));
361 READ_COLOR("window.inactive.button.unpressed.image.color",
362 theme
->titlebut_unfocused_unpressed_color
,
363 RrColorNew(inst
, 0xff, 0xff, 0xff));
365 READ_COLOR("window.active.button.pressed.image.color",
366 theme
->titlebut_focused_pressed_color
,
367 RrColorCopy(theme
->titlebut_focused_unpressed_color
));
369 READ_COLOR("window.inactive.button.pressed.image.color",
370 theme
->titlebut_unfocused_pressed_color
,
371 RrColorCopy(theme
->titlebut_unfocused_unpressed_color
));
373 READ_COLOR("window.active.button.disabled.image.color",
374 theme
->titlebut_disabled_focused_color
,
375 RrColorNew(inst
, 0xff, 0xff, 0xff));
377 READ_COLOR("window.inactive.button.disabled.image.color",
378 theme
->titlebut_disabled_unfocused_color
,
379 RrColorNew(inst
, 0, 0, 0));
381 READ_COLOR("window.active.button.hover.image.color",
382 theme
->titlebut_hover_focused_color
,
383 RrColorCopy(theme
->titlebut_focused_unpressed_color
));
385 READ_COLOR("window.inactive.button.hover.image.color",
386 theme
->titlebut_hover_unfocused_color
,
387 RrColorCopy(theme
->titlebut_unfocused_unpressed_color
));
389 READ_COLOR_("window.active.button.toggled.unpressed.image.color",
390 "window.active.button.toggled.image.color",
391 theme
->titlebut_toggled_focused_unpressed_color
,
392 RrColorCopy(theme
->titlebut_focused_pressed_color
));
394 READ_COLOR_("window.inactive.button.toggled.unpressed.image.color",
395 "window.inactive.button.toggled.image.color",
396 theme
->titlebut_toggled_unfocused_unpressed_color
,
397 RrColorCopy(theme
->titlebut_unfocused_pressed_color
));
399 READ_COLOR("window.active.button.toggled.hover.image.color",
400 theme
->titlebut_toggled_hover_focused_color
,
401 RrColorCopy(theme
->titlebut_toggled_focused_unpressed_color
));
403 READ_COLOR("window.inactive.button.toggled.hover.image.color",
404 theme
->titlebut_toggled_hover_unfocused_color
,
405 RrColorCopy(theme
->titlebut_toggled_unfocused_unpressed_color
));
407 READ_COLOR("window.active.button.toggled.pressed.image.color",
408 theme
->titlebut_toggled_focused_pressed_color
,
409 RrColorCopy(theme
->titlebut_focused_pressed_color
));
411 READ_COLOR("window.inactive.button.toggled.pressed.image.color",
412 theme
->titlebut_toggled_unfocused_pressed_color
,
413 RrColorCopy(theme
->titlebut_unfocused_pressed_color
));
415 READ_COLOR("menu.title.text.color", theme
->menu_title_color
,
416 RrColorNew(inst
, 0, 0, 0));
418 READ_COLOR("menu.items.text.color", theme
->menu_color
,
419 RrColorNew(inst
, 0xff, 0xff, 0xff));
421 READ_COLOR("menu.items.disabled.text.color", theme
->menu_disabled_color
,
422 RrColorNew(inst
, 0, 0, 0));
424 READ_COLOR("menu.items.active.disabled.text.color",
425 theme
->menu_disabled_selected_color
,
426 RrColorCopy(theme
->menu_disabled_color
));
428 READ_COLOR("menu.items.active.text.color", theme
->menu_selected_color
,
429 RrColorNew(inst
, 0, 0, 0));
431 READ_COLOR("menu.separator.color", theme
->menu_sep_color
,
432 RrColorCopy(theme
->menu_color
));
434 /* load the image masks */
436 /* maximize button masks */
438 if (!read_mask(inst
, path
, theme
, "max.xbm", &theme
->max_mask
)) {
439 guchar data
[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
440 theme
->max_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
443 if (!read_mask(inst
, path
, theme
, "max_toggled.xbm",
444 &theme
->max_toggled_mask
))
447 theme
->max_toggled_mask
= RrPixmapMaskCopy(theme
->max_mask
);
449 guchar data
[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
450 theme
->max_toggled_mask
= RrPixmapMaskNew(inst
, 6, 6,(gchar
*)data
);
453 READ_MASK_COPY("max_pressed.xbm", theme
->max_pressed_mask
,
455 READ_MASK_COPY("max_disabled.xbm", theme
->max_disabled_mask
,
457 READ_MASK_COPY("max_hover.xbm", theme
->max_hover_mask
, theme
->max_mask
);
458 READ_MASK_COPY("max_toggled_pressed.xbm", theme
->max_toggled_pressed_mask
,
459 theme
->max_toggled_mask
);
460 READ_MASK_COPY("max_toggled_hover.xbm", theme
->max_toggled_hover_mask
,
461 theme
->max_toggled_mask
);
463 /* iconify button masks */
464 if (!read_mask(inst
, path
, theme
, "iconify.xbm", &theme
->iconify_mask
)) {
465 guchar data
[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
466 theme
->iconify_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
468 READ_MASK_COPY("iconify_pressed.xbm", theme
->iconify_pressed_mask
,
469 theme
->iconify_mask
);
470 READ_MASK_COPY("iconify_disabled.xbm", theme
->iconify_disabled_mask
,
471 theme
->iconify_mask
);
472 READ_MASK_COPY("iconify_hover.xbm", theme
->iconify_hover_mask
,
473 theme
->iconify_mask
);
475 /* all desktops button masks */
477 if (!read_mask(inst
, path
, theme
, "desk.xbm", &theme
->desk_mask
)) {
478 guchar data
[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
479 theme
->desk_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
482 if (!read_mask(inst
, path
, theme
, "desk_toggled.xbm",
483 &theme
->desk_toggled_mask
)) {
485 theme
->desk_toggled_mask
= RrPixmapMaskCopy(theme
->desk_mask
);
487 guchar data
[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
488 theme
->desk_toggled_mask
=
489 RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
492 READ_MASK_COPY("desk_pressed.xbm", theme
->desk_pressed_mask
,
494 READ_MASK_COPY("desk_disabled.xbm", theme
->desk_disabled_mask
,
496 READ_MASK_COPY("desk_hover.xbm", theme
->desk_hover_mask
, theme
->desk_mask
);
497 READ_MASK_COPY("desk_toggled_pressed.xbm",
498 theme
->desk_toggled_pressed_mask
, theme
->desk_toggled_mask
);
499 READ_MASK_COPY("desk_toggled_hover.xbm", theme
->desk_toggled_hover_mask
,
500 theme
->desk_toggled_mask
);
502 /* shade button masks */
503 if (!read_mask(inst
, path
, theme
, "shade.xbm", &theme
->shade_mask
)) {
504 guchar data
[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
505 theme
->shade_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
507 READ_MASK_COPY("shade_toggled.xbm", theme
->shade_toggled_mask
,
509 READ_MASK_COPY("shade_pressed.xbm", theme
->shade_pressed_mask
,
511 READ_MASK_COPY("shade_disabled.xbm", theme
->shade_disabled_mask
,
513 READ_MASK_COPY("shade_hover.xbm", theme
->shade_hover_mask
,
515 READ_MASK_COPY("shade_toggled_pressed.xbm",
516 theme
->shade_toggled_pressed_mask
,
517 theme
->shade_toggled_mask
);
518 READ_MASK_COPY("shade_toggled_hover.xbm",
519 theme
->shade_toggled_hover_mask
, theme
->shade_toggled_mask
);
521 /* close button masks */
522 if (!read_mask(inst
, path
, theme
, "close.xbm", &theme
->close_mask
)) {
523 guchar data
[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
524 theme
->close_mask
= RrPixmapMaskNew(inst
, 6, 6, (gchar
*)data
);
526 READ_MASK_COPY("close_pressed.xbm", theme
->close_pressed_mask
,
528 READ_MASK_COPY("close_disabled.xbm", theme
->close_disabled_mask
,
530 READ_MASK_COPY("close_hover.xbm", theme
->close_hover_mask
,
533 /* submenu bullet mask */
534 if (!read_mask(inst
, path
, theme
, "bullet.xbm", &theme
->menu_bullet_mask
))
536 guchar data
[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
537 theme
->menu_bullet_mask
= RrPixmapMaskNew(inst
, 4, 7, (gchar
*)data
);
540 /* up and down arrows */
542 guchar data
[] = { 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00 };
543 theme
->down_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
546 guchar data
[] = { 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00 };
547 theme
->up_arrow_mask
= RrPixmapMaskNew(inst
, 9, 4, (gchar
*)data
);
550 /* setup the default window icon */
551 theme
->def_win_icon
= read_c_image(OB_DEFAULT_ICON_WIDTH
,
552 OB_DEFAULT_ICON_HEIGHT
,
553 OB_DEFAULT_ICON_pixel_data
);
554 theme
->def_win_icon_w
= OB_DEFAULT_ICON_WIDTH
;
555 theme
->def_win_icon_h
= OB_DEFAULT_ICON_HEIGHT
;
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 */
667 /* bases: unpressed, pressed, disabled */
668 READ_APPEARANCE_COPY("window.active.button-max.unpressed.bg",
669 theme
->a_focused_unpressed_max
, TRUE
,
670 a_focused_unpressed_tmp
);
671 READ_APPEARANCE_COPY("window.inactive.button-max.unpressed.bg",
672 theme
->a_unfocused_unpressed_max
, TRUE
,
673 a_unfocused_unpressed_tmp
);
674 READ_APPEARANCE_COPY("window.active.button-max.pressed.bg",
675 theme
->a_focused_pressed_max
, TRUE
,
676 a_focused_pressed_tmp
);
677 READ_APPEARANCE_COPY("window.inactive.button-max.pressed.bg",
678 theme
->a_unfocused_pressed_max
, TRUE
,
679 a_unfocused_pressed_tmp
);
680 READ_APPEARANCE_COPY("window.active.button-max.disabled.bg",
681 theme
->a_disabled_focused_max
, TRUE
,
682 a_disabled_focused_tmp
);
683 READ_APPEARANCE_COPY("window.inactive.button-max.disabled.bg",
684 theme
->a_disabled_unfocused_max
, TRUE
,
685 a_disabled_unfocused_tmp
);
688 READ_APPEARANCE_COPY("window.active.button-max.hover.bg",
689 theme
->a_hover_focused_max
, TRUE
,
690 theme
->a_focused_unpressed_max
);
691 READ_APPEARANCE_COPY("window.inactive.button-max.hover.bg",
692 theme
->a_hover_unfocused_max
, TRUE
,
693 theme
->a_unfocused_unpressed_max
);
695 /* toggled unpressed */
696 READ_APPEARANCE_COPY("window.active.button-max.toggled.unpressed.bg",
697 theme
->a_toggled_focused_unpressed_max
, TRUE
,
698 theme
->a_focused_pressed_max
);
699 READ_APPEARANCE_COPY("window.inactive.button-max.toggled.unpressed.bg",
700 theme
->a_toggled_unfocused_unpressed_max
, TRUE
,
701 theme
->a_unfocused_pressed_max
);
703 /* toggled pressed */
704 READ_APPEARANCE_COPY("window.active.button-max.toggled.pressed.bg",
705 theme
->a_toggled_focused_pressed_max
, TRUE
,
706 theme
->a_focused_pressed_max
);
707 READ_APPEARANCE_COPY("window.inactive.button-max.toggled.pressed.bg",
708 theme
->a_toggled_unfocused_pressed_max
, TRUE
,
709 theme
->a_unfocused_pressed_max
);
712 READ_APPEARANCE_COPY("window.active.button-max.toggled.hover.bg",
713 theme
->a_toggled_hover_focused_max
, TRUE
,
714 theme
->a_toggled_focused_unpressed_max
);
715 READ_APPEARANCE_COPY("window.inactive.button-max.toggled.hover.bg",
716 theme
->a_toggled_hover_unfocused_max
, TRUE
,
717 theme
->a_toggled_unfocused_unpressed_max
);
720 READ_APPEARANCE_COPY("window.active.button-close.unpressed.bg",
721 theme
->a_focused_unpressed_close
, TRUE
,
722 a_focused_unpressed_tmp
);
723 READ_APPEARANCE_COPY("window.inactive.button-close.unpressed.bg",
724 theme
->a_unfocused_unpressed_close
, TRUE
,
725 a_unfocused_unpressed_tmp
);
726 READ_APPEARANCE_COPY("window.active.button-close.pressed.bg",
727 theme
->a_focused_pressed_close
, TRUE
,
728 a_focused_pressed_tmp
);
729 READ_APPEARANCE_COPY("window.inactive.button-close.pressed.bg",
730 theme
->a_unfocused_pressed_close
, TRUE
,
731 a_unfocused_pressed_tmp
);
732 READ_APPEARANCE_COPY("window.active.button-close.disabled.bg",
733 theme
->a_disabled_focused_close
, TRUE
,
734 a_disabled_focused_tmp
);
735 READ_APPEARANCE_COPY("window.inactive.button-close.disabled.bg",
736 theme
->a_disabled_unfocused_close
, TRUE
,
737 a_disabled_unfocused_tmp
);
738 READ_APPEARANCE_COPY("window.active.button-close.hover.bg",
739 theme
->a_hover_focused_close
, TRUE
,
740 theme
->a_focused_unpressed_close
);
741 READ_APPEARANCE_COPY("window.inactive.button-close.hover.bg",
742 theme
->a_hover_unfocused_close
, TRUE
,
743 theme
->a_unfocused_unpressed_close
);
747 /* bases: unpressed, pressed, disabled */
748 READ_APPEARANCE_COPY("window.active.button-desk.unpressed.bg",
749 theme
->a_focused_unpressed_desk
, TRUE
,
750 a_focused_unpressed_tmp
);
751 READ_APPEARANCE_COPY("window.inactive.button-desk.unpressed.bg",
752 theme
->a_unfocused_unpressed_desk
, TRUE
,
753 a_unfocused_unpressed_tmp
);
754 READ_APPEARANCE_COPY("window.active.button-desk.pressed.bg",
755 theme
->a_focused_pressed_desk
, TRUE
,
756 a_focused_pressed_tmp
);
757 READ_APPEARANCE_COPY("window.inactive.button-desk.pressed.bg",
758 theme
->a_unfocused_pressed_desk
, TRUE
,
759 a_unfocused_pressed_tmp
);
760 READ_APPEARANCE_COPY("window.active.button-desk.disabled.bg",
761 theme
->a_disabled_focused_desk
, TRUE
,
762 a_disabled_focused_tmp
);
763 READ_APPEARANCE_COPY("window.inactive.button-desk.disabled.bg",
764 theme
->a_disabled_unfocused_desk
, TRUE
,
765 a_disabled_unfocused_tmp
);
768 READ_APPEARANCE_COPY("window.active.button-desk.hover.bg",
769 theme
->a_hover_focused_desk
, TRUE
,
770 theme
->a_focused_unpressed_desk
);
771 READ_APPEARANCE_COPY("window.inactive.button-desk.hover.bg",
772 theme
->a_hover_unfocused_desk
, TRUE
,
773 theme
->a_unfocused_unpressed_desk
);
775 /* toggled unpressed */
776 READ_APPEARANCE_COPY("window.active.button-desk.toggled.unpressed.bg",
777 theme
->a_toggled_focused_unpressed_desk
, TRUE
,
778 theme
->a_focused_pressed_desk
);
779 READ_APPEARANCE_COPY("window.inactive.button-desk.toggled.unpressed.bg",
780 theme
->a_toggled_unfocused_unpressed_desk
, TRUE
,
781 theme
->a_unfocused_pressed_desk
);
783 /* toggled pressed */
784 READ_APPEARANCE_COPY("window.active.button-desk.toggled.pressed.bg",
785 theme
->a_toggled_focused_pressed_desk
, TRUE
,
786 theme
->a_focused_pressed_desk
);
787 READ_APPEARANCE_COPY("window.inactive.button-desk.toggled.pressed.bg",
788 theme
->a_toggled_unfocused_pressed_desk
, TRUE
,
789 theme
->a_unfocused_pressed_desk
);
792 READ_APPEARANCE_COPY("window.active.button-desk.toggled.hover.bg",
793 theme
->a_toggled_hover_focused_desk
, TRUE
,
794 theme
->a_toggled_focused_unpressed_desk
);
795 READ_APPEARANCE_COPY("window.inactive.button-desk.toggled.hover.bg",
796 theme
->a_toggled_hover_unfocused_desk
, TRUE
,
797 theme
->a_toggled_unfocused_unpressed_desk
);
801 /* bases: unpressed, pressed, disabled */
802 READ_APPEARANCE_COPY("window.active.button-shade.unpressed.bg",
803 theme
->a_focused_unpressed_shade
, TRUE
,
804 a_focused_unpressed_tmp
);
805 READ_APPEARANCE_COPY("window.inactive.button-shade.unpressed.bg",
806 theme
->a_unfocused_unpressed_shade
, TRUE
,
807 a_unfocused_unpressed_tmp
);
808 READ_APPEARANCE_COPY("window.active.button-shade.pressed.bg",
809 theme
->a_focused_pressed_shade
, TRUE
,
810 a_focused_pressed_tmp
);
811 READ_APPEARANCE_COPY("window.inactive.button-shade.pressed.bg",
812 theme
->a_unfocused_pressed_shade
, TRUE
,
813 a_unfocused_pressed_tmp
);
814 READ_APPEARANCE_COPY("window.active.button-shade.disabled.bg",
815 theme
->a_disabled_focused_shade
, TRUE
,
816 a_disabled_focused_tmp
);
817 READ_APPEARANCE_COPY("window.inactive.button-shade.disabled.bg",
818 theme
->a_disabled_unfocused_shade
, TRUE
,
819 a_disabled_unfocused_tmp
);
822 READ_APPEARANCE_COPY("window.active.button-shade.hover.bg",
823 theme
->a_hover_focused_shade
, TRUE
,
824 theme
->a_focused_unpressed_shade
);
825 READ_APPEARANCE_COPY("window.inactive.button-shade.hover.bg",
826 theme
->a_hover_unfocused_shade
, TRUE
,
827 theme
->a_unfocused_unpressed_shade
);
829 /* toggled unpressed */
830 READ_APPEARANCE_COPY("window.active.button-shade.toggled.unpressed.bg",
831 theme
->a_toggled_focused_unpressed_shade
, TRUE
,
832 theme
->a_focused_pressed_shade
);
833 READ_APPEARANCE_COPY("window.inactive.button-shade.toggled.unpressed.bg",
834 theme
->a_toggled_unfocused_unpressed_shade
, TRUE
,
835 theme
->a_unfocused_pressed_shade
);
837 /* toggled pressed */
838 READ_APPEARANCE_COPY("window.active.button-shade.toggled.pressed.bg",
839 theme
->a_toggled_focused_pressed_shade
, TRUE
,
840 theme
->a_focused_pressed_shade
);
841 READ_APPEARANCE_COPY("window.inactive.button-shade.toggled.pressed.bg",
842 theme
->a_toggled_unfocused_pressed_shade
, TRUE
,
843 theme
->a_unfocused_pressed_shade
);
846 READ_APPEARANCE_COPY("window.active.button-shade.toggled.hover.bg",
847 theme
->a_toggled_hover_focused_shade
, TRUE
,
848 theme
->a_toggled_focused_unpressed_shade
);
849 READ_APPEARANCE_COPY("window.inactive.button-shade.toggled.hover.bg",
850 theme
->a_toggled_hover_unfocused_shade
, TRUE
,
851 theme
->a_toggled_unfocused_unpressed_shade
);
854 READ_APPEARANCE_COPY("window.active.button-iconify.unpressed.bg",
855 theme
->a_focused_unpressed_iconify
, TRUE
,
856 a_focused_unpressed_tmp
);
857 READ_APPEARANCE_COPY("window.inactive.button-iconify.unpressed.bg",
858 theme
->a_unfocused_unpressed_iconify
, TRUE
,
859 a_unfocused_unpressed_tmp
);
860 READ_APPEARANCE_COPY("window.active.button-iconify.pressed.bg",
861 theme
->a_focused_pressed_iconify
, TRUE
,
862 a_focused_pressed_tmp
);
863 READ_APPEARANCE_COPY("window.inactive.button-iconify.pressed.bg",
864 theme
->a_unfocused_pressed_iconify
, TRUE
,
865 a_unfocused_pressed_tmp
);
866 READ_APPEARANCE_COPY("window.active.button-iconify.disabled.bg",
867 theme
->a_disabled_focused_iconify
, TRUE
,
868 a_disabled_focused_tmp
);
869 READ_APPEARANCE_COPY("window.inactive.button-iconify.disabled.bg",
870 theme
->a_disabled_unfocused_iconify
, TRUE
,
871 a_disabled_unfocused_tmp
);
872 READ_APPEARANCE_COPY("window.active.button-iconify.hover.bg",
873 theme
->a_hover_focused_iconify
, TRUE
,
874 theme
->a_focused_unpressed_iconify
);
875 READ_APPEARANCE_COPY("window.inactive.button-iconify.hover.bg",
876 theme
->a_hover_unfocused_iconify
, TRUE
,
877 theme
->a_unfocused_unpressed_iconify
);
879 theme
->a_icon
->surface
.grad
=
880 theme
->a_clear
->surface
.grad
=
881 theme
->a_clear_tex
->surface
.grad
=
882 theme
->a_menu_text_title
->surface
.grad
=
883 theme
->a_menu_normal
->surface
.grad
=
884 theme
->a_menu_disabled
->surface
.grad
=
885 theme
->a_menu_text_normal
->surface
.grad
=
886 theme
->a_menu_text_selected
->surface
.grad
=
887 theme
->a_menu_text_disabled
->surface
.grad
=
888 theme
->a_menu_text_disabled_selected
->surface
.grad
=
889 theme
->a_menu_bullet_normal
->surface
.grad
=
890 theme
->a_menu_bullet_selected
->surface
.grad
= RR_SURFACE_PARENTREL
;
892 /* set up the textures */
893 theme
->a_focused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
894 theme
->a_focused_label
->texture
[0].data
.text
.justify
= winjust
;
895 theme
->a_focused_label
->texture
[0].data
.text
.font
=theme
->win_font_focused
;
896 theme
->a_focused_label
->texture
[0].data
.text
.color
=
897 theme
->title_focused_color
;
899 if (read_string(db
, "window.active.label.text.font", &str
)) {
903 if (strstr(str
, "shadow=y")) {
904 if ((p
= strstr(str
, "shadowoffset=")))
905 i
= parse_inline_number(p
+ strlen("shadowoffset="));
908 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
909 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
911 if ((p
= strstr(str
, "shadowtint=")))
913 i
= parse_inline_number(p
+ strlen("shadowtint="));
914 j
= (i
> 0 ? 0 : 255);
917 theme
->title_focused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
918 theme
->title_focused_shadow_alpha
= i
;
920 theme
->title_focused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
921 theme
->title_focused_shadow_alpha
= 50;
925 theme
->a_focused_label
->texture
[0].data
.text
.shadow_color
=
926 theme
->title_focused_shadow_color
;
927 theme
->a_focused_label
->texture
[0].data
.text
.shadow_alpha
=
928 theme
->title_focused_shadow_alpha
;
930 theme
->osd_hilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
931 theme
->osd_hilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
932 theme
->osd_hilite_label
->texture
[0].data
.text
.font
=
933 theme
->osd_font_hilite
;
934 theme
->osd_hilite_label
->texture
[0].data
.text
.color
=
935 theme
->osd_text_active_color
;
937 if (read_string(db
, "osd.active.label.text.font", &str
) ||
938 read_string(db
, "osd.label.text.font", &str
))
943 if (strstr(str
, "shadow=y")) {
944 if ((p
= strstr(str
, "shadowoffset=")))
945 i
= parse_inline_number(p
+ strlen("shadowoffset="));
948 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
949 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
951 if ((p
= strstr(str
, "shadowtint=")))
953 i
= parse_inline_number(p
+ strlen("shadowtint="));
954 j
= (i
> 0 ? 0 : 255);
957 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, j
, j
, j
);
958 theme
->osd_text_active_shadow_alpha
= i
;
960 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, 0, 0, 0);
961 theme
->osd_text_active_shadow_alpha
= 50;
964 /* inherit the font settings from the focused label */
965 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_x
=
966 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_x
;
967 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_offset_y
=
968 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
;
969 if (theme
->title_focused_shadow_color
)
970 theme
->osd_text_active_shadow_color
=
972 theme
->title_focused_shadow_color
->r
,
973 theme
->title_focused_shadow_color
->g
,
974 theme
->title_focused_shadow_color
->b
);
976 theme
->osd_text_active_shadow_color
= RrColorNew(inst
, 0, 0, 0);
977 theme
->osd_text_active_shadow_alpha
=
978 theme
->title_focused_shadow_alpha
;
981 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_color
=
982 theme
->osd_text_active_shadow_color
;
983 theme
->osd_hilite_label
->texture
[0].data
.text
.shadow_alpha
=
984 theme
->osd_text_active_shadow_alpha
;
986 theme
->a_unfocused_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
987 theme
->a_unfocused_label
->texture
[0].data
.text
.justify
= winjust
;
988 theme
->a_unfocused_label
->texture
[0].data
.text
.font
=
989 theme
->win_font_unfocused
;
990 theme
->a_unfocused_label
->texture
[0].data
.text
.color
=
991 theme
->title_unfocused_color
;
993 if (read_string(db
, "window.inactive.label.text.font", &str
)) {
997 if (strstr(str
, "shadow=y")) {
998 if ((p
= strstr(str
, "shadowoffset=")))
999 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1002 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
= i
;
1003 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
= i
;
1005 if ((p
= strstr(str
, "shadowtint=")))
1007 i
= parse_inline_number(p
+ strlen("shadowtint="));
1008 j
= (i
> 0 ? 0 : 255);
1011 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1012 theme
->title_unfocused_shadow_alpha
= i
;
1014 theme
->title_unfocused_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1015 theme
->title_unfocused_shadow_alpha
= 50;
1019 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_color
=
1020 theme
->title_unfocused_shadow_color
;
1021 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_alpha
=
1022 theme
->title_unfocused_shadow_alpha
;
1024 theme
->osd_unhilite_label
->texture
[0].type
= RR_TEXTURE_TEXT
;
1025 theme
->osd_unhilite_label
->texture
[0].data
.text
.justify
= RR_JUSTIFY_LEFT
;
1026 theme
->osd_unhilite_label
->texture
[0].data
.text
.font
=
1027 theme
->osd_font_unhilite
;
1028 theme
->osd_unhilite_label
->texture
[0].data
.text
.color
=
1029 theme
->osd_text_inactive_color
;
1031 if (read_string(db
, "osd.inactive.label.text.font", &str
))
1036 if (strstr(str
, "shadow=y")) {
1037 if ((p
= strstr(str
, "shadowoffset=")))
1038 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1041 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_x
=i
;
1042 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_y
=i
;
1044 if ((p
= strstr(str
, "shadowtint=")))
1046 i
= parse_inline_number(p
+ strlen("shadowtint="));
1047 j
= (i
> 0 ? 0 : 255);
1050 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1051 theme
->osd_text_inactive_shadow_alpha
= i
;
1053 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1054 theme
->osd_text_inactive_shadow_alpha
= 50;
1057 /* inherit the font settings from the unfocused label */
1058 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_x
=
1059 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_x
;
1060 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_offset_y
=
1061 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
;
1062 if (theme
->title_unfocused_shadow_color
)
1063 theme
->osd_text_inactive_shadow_color
=
1065 theme
->title_unfocused_shadow_color
->r
,
1066 theme
->title_unfocused_shadow_color
->g
,
1067 theme
->title_unfocused_shadow_color
->b
);
1069 theme
->osd_text_inactive_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1070 theme
->osd_text_inactive_shadow_alpha
=
1071 theme
->title_unfocused_shadow_alpha
;
1074 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_color
=
1075 theme
->osd_text_inactive_shadow_color
;
1076 theme
->osd_unhilite_label
->texture
[0].data
.text
.shadow_alpha
=
1077 theme
->osd_text_inactive_shadow_alpha
;
1079 theme
->a_menu_text_title
->texture
[0].type
= RR_TEXTURE_TEXT
;
1080 theme
->a_menu_text_title
->texture
[0].data
.text
.justify
= mtitlejust
;
1081 theme
->a_menu_text_title
->texture
[0].data
.text
.font
=
1082 theme
->menu_title_font
;
1083 theme
->a_menu_text_title
->texture
[0].data
.text
.color
=
1084 theme
->menu_title_color
;
1086 if (read_string(db
, "menu.title.text.font", &str
)) {
1090 if (strstr(str
, "shadow=y")) {
1091 if ((p
= strstr(str
, "shadowoffset=")))
1092 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1095 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_x
= i
;
1096 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
= i
;
1098 if ((p
= strstr(str
, "shadowtint=")))
1100 i
= parse_inline_number(p
+ strlen("shadowtint="));
1101 j
= (i
> 0 ? 0 : 255);
1104 theme
->menu_title_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1105 theme
->menu_title_shadow_alpha
= i
;
1107 theme
->menu_title_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1108 theme
->menu_title_shadow_alpha
= 50;
1112 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_color
=
1113 theme
->menu_title_shadow_color
;
1114 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_alpha
=
1115 theme
->menu_title_shadow_alpha
;
1117 theme
->a_menu_text_normal
->texture
[0].type
=
1118 theme
->a_menu_text_selected
->texture
[0].type
=
1119 theme
->a_menu_text_disabled
->texture
[0].type
=
1120 theme
->a_menu_text_disabled_selected
->texture
[0].type
=
1122 theme
->a_menu_text_normal
->texture
[0].data
.text
.justify
=
1123 theme
->a_menu_text_selected
->texture
[0].data
.text
.justify
=
1124 theme
->a_menu_text_disabled
->texture
[0].data
.text
.justify
=
1125 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.justify
=
1127 theme
->a_menu_text_normal
->texture
[0].data
.text
.font
=
1128 theme
->a_menu_text_selected
->texture
[0].data
.text
.font
=
1129 theme
->a_menu_text_disabled
->texture
[0].data
.text
.font
=
1130 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.font
=
1132 theme
->a_menu_text_normal
->texture
[0].data
.text
.color
= theme
->menu_color
;
1133 theme
->a_menu_text_selected
->texture
[0].data
.text
.color
=
1134 theme
->menu_selected_color
;
1135 theme
->a_menu_text_disabled
->texture
[0].data
.text
.color
=
1136 theme
->menu_disabled_color
;
1137 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.color
=
1138 theme
->menu_disabled_selected_color
;
1140 if (read_string(db
, "menu.items.font", &str
)) {
1144 if (strstr(str
, "shadow=y")) {
1145 if ((p
= strstr(str
, "shadowoffset=")))
1146 i
= parse_inline_number(p
+ strlen("shadowoffset="));
1149 theme
->a_menu_text_normal
->
1150 texture
[0].data
.text
.shadow_offset_x
= i
;
1151 theme
->a_menu_text_normal
->
1152 texture
[0].data
.text
.shadow_offset_y
= i
;
1153 theme
->a_menu_text_selected
->
1154 texture
[0].data
.text
.shadow_offset_x
= i
;
1155 theme
->a_menu_text_selected
->
1156 texture
[0].data
.text
.shadow_offset_y
= i
;
1157 theme
->a_menu_text_disabled
->
1158 texture
[0].data
.text
.shadow_offset_x
= i
;
1159 theme
->a_menu_text_disabled
->
1160 texture
[0].data
.text
.shadow_offset_y
= i
;
1161 theme
->a_menu_text_disabled_selected
->
1162 texture
[0].data
.text
.shadow_offset_x
= i
;
1163 theme
->a_menu_text_disabled_selected
->
1164 texture
[0].data
.text
.shadow_offset_y
= i
;
1166 if ((p
= strstr(str
, "shadowtint=")))
1168 i
= parse_inline_number(p
+ strlen("shadowtint="));
1169 j
= (i
> 0 ? 0 : 255);
1172 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1173 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1174 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, j
, j
, j
);
1175 theme
->menu_text_normal_shadow_alpha
= i
;
1176 theme
->menu_text_selected_shadow_alpha
= i
;
1177 theme
->menu_text_disabled_shadow_alpha
= i
;
1178 theme
->menu_text_disabled_selected_shadow_alpha
= i
;
1180 theme
->menu_text_normal_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1181 theme
->menu_text_selected_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1182 theme
->menu_text_disabled_shadow_color
= RrColorNew(inst
, 0, 0, 0);
1183 theme
->menu_text_normal_shadow_alpha
= 50;
1184 theme
->menu_text_selected_shadow_alpha
= 50;
1185 theme
->menu_text_disabled_selected_shadow_alpha
= 50;
1189 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_color
=
1190 theme
->menu_text_normal_shadow_color
;
1191 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_alpha
=
1192 theme
->menu_text_normal_shadow_alpha
;
1193 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_color
=
1194 theme
->menu_text_selected_shadow_color
;
1195 theme
->a_menu_text_selected
->texture
[0].data
.text
.shadow_alpha
=
1196 theme
->menu_text_selected_shadow_alpha
;
1197 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_color
=
1198 theme
->menu_text_disabled_shadow_color
;
1199 theme
->a_menu_text_disabled
->texture
[0].data
.text
.shadow_alpha
=
1200 theme
->menu_text_disabled_shadow_alpha
;
1201 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_color
=
1202 theme
->menu_text_disabled_shadow_color
;
1203 theme
->a_menu_text_disabled_selected
->texture
[0].data
.text
.shadow_alpha
=
1204 theme
->menu_text_disabled_shadow_alpha
;
1206 theme
->a_disabled_focused_max
->texture
[0].type
=
1207 theme
->a_disabled_unfocused_max
->texture
[0].type
=
1208 theme
->a_hover_focused_max
->texture
[0].type
=
1209 theme
->a_hover_unfocused_max
->texture
[0].type
=
1210 theme
->a_toggled_hover_focused_max
->texture
[0].type
=
1211 theme
->a_toggled_hover_unfocused_max
->texture
[0].type
=
1212 theme
->a_toggled_focused_unpressed_max
->texture
[0].type
=
1213 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].type
=
1214 theme
->a_toggled_focused_pressed_max
->texture
[0].type
=
1215 theme
->a_toggled_unfocused_pressed_max
->texture
[0].type
=
1216 theme
->a_focused_unpressed_max
->texture
[0].type
=
1217 theme
->a_focused_pressed_max
->texture
[0].type
=
1218 theme
->a_unfocused_unpressed_max
->texture
[0].type
=
1219 theme
->a_unfocused_pressed_max
->texture
[0].type
=
1220 theme
->a_disabled_focused_close
->texture
[0].type
=
1221 theme
->a_disabled_unfocused_close
->texture
[0].type
=
1222 theme
->a_hover_focused_close
->texture
[0].type
=
1223 theme
->a_hover_unfocused_close
->texture
[0].type
=
1224 theme
->a_focused_unpressed_close
->texture
[0].type
=
1225 theme
->a_focused_pressed_close
->texture
[0].type
=
1226 theme
->a_unfocused_unpressed_close
->texture
[0].type
=
1227 theme
->a_unfocused_pressed_close
->texture
[0].type
=
1228 theme
->a_disabled_focused_desk
->texture
[0].type
=
1229 theme
->a_disabled_unfocused_desk
->texture
[0].type
=
1230 theme
->a_hover_focused_desk
->texture
[0].type
=
1231 theme
->a_hover_unfocused_desk
->texture
[0].type
=
1232 theme
->a_toggled_hover_focused_desk
->texture
[0].type
=
1233 theme
->a_toggled_hover_unfocused_desk
->texture
[0].type
=
1234 theme
->a_toggled_focused_unpressed_desk
->texture
[0].type
=
1235 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].type
=
1236 theme
->a_toggled_focused_pressed_desk
->texture
[0].type
=
1237 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].type
=
1238 theme
->a_focused_unpressed_desk
->texture
[0].type
=
1239 theme
->a_focused_pressed_desk
->texture
[0].type
=
1240 theme
->a_unfocused_unpressed_desk
->texture
[0].type
=
1241 theme
->a_unfocused_pressed_desk
->texture
[0].type
=
1242 theme
->a_disabled_focused_shade
->texture
[0].type
=
1243 theme
->a_disabled_unfocused_shade
->texture
[0].type
=
1244 theme
->a_hover_focused_shade
->texture
[0].type
=
1245 theme
->a_hover_unfocused_shade
->texture
[0].type
=
1246 theme
->a_toggled_hover_focused_shade
->texture
[0].type
=
1247 theme
->a_toggled_hover_unfocused_shade
->texture
[0].type
=
1248 theme
->a_toggled_focused_unpressed_shade
->texture
[0].type
=
1249 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].type
=
1250 theme
->a_toggled_focused_pressed_shade
->texture
[0].type
=
1251 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].type
=
1252 theme
->a_focused_unpressed_shade
->texture
[0].type
=
1253 theme
->a_focused_pressed_shade
->texture
[0].type
=
1254 theme
->a_unfocused_unpressed_shade
->texture
[0].type
=
1255 theme
->a_unfocused_pressed_shade
->texture
[0].type
=
1256 theme
->a_disabled_focused_iconify
->texture
[0].type
=
1257 theme
->a_disabled_unfocused_iconify
->texture
[0].type
=
1258 theme
->a_hover_focused_iconify
->texture
[0].type
=
1259 theme
->a_hover_unfocused_iconify
->texture
[0].type
=
1260 theme
->a_focused_unpressed_iconify
->texture
[0].type
=
1261 theme
->a_focused_pressed_iconify
->texture
[0].type
=
1262 theme
->a_unfocused_unpressed_iconify
->texture
[0].type
=
1263 theme
->a_unfocused_pressed_iconify
->texture
[0].type
=
1264 theme
->a_menu_bullet_normal
->texture
[0].type
=
1265 theme
->a_menu_bullet_selected
->texture
[0].type
= RR_TEXTURE_MASK
;
1267 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.mask
=
1268 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.mask
=
1269 theme
->max_disabled_mask
;
1270 theme
->a_hover_focused_max
->texture
[0].data
.mask
.mask
=
1271 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1272 theme
->max_hover_mask
;
1273 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1274 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1275 theme
->max_pressed_mask
;
1276 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1277 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1279 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.mask
=
1280 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.mask
=
1281 theme
->max_toggled_hover_mask
;
1282 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.mask
=
1283 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.mask
=
1284 theme
->max_toggled_mask
;
1285 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.mask
=
1286 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.mask
=
1287 theme
->max_toggled_pressed_mask
;
1288 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.mask
=
1289 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.mask
=
1290 theme
->close_disabled_mask
;
1291 theme
->a_hover_focused_close
->texture
[0].data
.mask
.mask
=
1292 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.mask
=
1293 theme
->close_hover_mask
;
1294 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.mask
=
1295 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.mask
=
1296 theme
->close_pressed_mask
;
1297 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.mask
=
1298 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.mask
=
1300 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.mask
=
1301 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.mask
=
1302 theme
->desk_disabled_mask
;
1303 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1304 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1305 theme
->desk_hover_mask
;
1306 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1307 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1308 theme
->desk_pressed_mask
;
1309 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1310 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1312 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.mask
=
1313 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.mask
=
1314 theme
->desk_toggled_hover_mask
;
1315 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1316 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.mask
=
1317 theme
->desk_toggled_mask
;
1318 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.mask
=
1319 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.mask
=
1320 theme
->desk_toggled_pressed_mask
;
1321 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.mask
=
1322 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.mask
=
1323 theme
->shade_disabled_mask
;
1324 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1325 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1326 theme
->shade_hover_mask
;
1327 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1328 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1329 theme
->shade_pressed_mask
;
1330 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1331 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1333 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.mask
=
1334 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.mask
=
1335 theme
->shade_toggled_hover_mask
;
1336 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1337 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.mask
=
1338 theme
->shade_toggled_mask
;
1339 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.mask
=
1340 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.mask
=
1341 theme
->shade_toggled_pressed_mask
;
1342 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.mask
=
1343 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1344 theme
->iconify_disabled_mask
;
1345 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.mask
=
1346 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.mask
=
1347 theme
->iconify_hover_mask
;
1348 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1349 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.mask
=
1350 theme
->iconify_pressed_mask
;
1351 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1352 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.mask
=
1353 theme
->iconify_mask
;
1354 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.mask
=
1355 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.mask
=
1356 theme
->menu_bullet_mask
;
1357 theme
->a_disabled_focused_max
->texture
[0].data
.mask
.color
=
1358 theme
->a_disabled_focused_close
->texture
[0].data
.mask
.color
=
1359 theme
->a_disabled_focused_desk
->texture
[0].data
.mask
.color
=
1360 theme
->a_disabled_focused_shade
->texture
[0].data
.mask
.color
=
1361 theme
->a_disabled_focused_iconify
->texture
[0].data
.mask
.color
=
1362 theme
->titlebut_disabled_focused_color
;
1363 theme
->a_disabled_unfocused_max
->texture
[0].data
.mask
.color
=
1364 theme
->a_disabled_unfocused_close
->texture
[0].data
.mask
.color
=
1365 theme
->a_disabled_unfocused_desk
->texture
[0].data
.mask
.color
=
1366 theme
->a_disabled_unfocused_shade
->texture
[0].data
.mask
.color
=
1367 theme
->a_disabled_unfocused_iconify
->texture
[0].data
.mask
.color
=
1368 theme
->titlebut_disabled_unfocused_color
;
1369 theme
->a_hover_focused_max
->texture
[0].data
.mask
.color
=
1370 theme
->a_hover_focused_close
->texture
[0].data
.mask
.color
=
1371 theme
->a_hover_focused_desk
->texture
[0].data
.mask
.color
=
1372 theme
->a_hover_focused_shade
->texture
[0].data
.mask
.color
=
1373 theme
->a_hover_focused_iconify
->texture
[0].data
.mask
.color
=
1374 theme
->titlebut_hover_focused_color
;
1375 theme
->a_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1376 theme
->a_hover_unfocused_close
->texture
[0].data
.mask
.color
=
1377 theme
->a_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1378 theme
->a_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1379 theme
->a_hover_unfocused_iconify
->texture
[0].data
.mask
.color
=
1380 theme
->titlebut_hover_unfocused_color
;
1381 theme
->a_toggled_hover_focused_max
->texture
[0].data
.mask
.color
=
1382 theme
->a_toggled_hover_focused_desk
->texture
[0].data
.mask
.color
=
1383 theme
->a_toggled_hover_focused_shade
->texture
[0].data
.mask
.color
=
1384 theme
->titlebut_toggled_hover_focused_color
;
1385 theme
->a_toggled_hover_unfocused_max
->texture
[0].data
.mask
.color
=
1386 theme
->a_toggled_hover_unfocused_desk
->texture
[0].data
.mask
.color
=
1387 theme
->a_toggled_hover_unfocused_shade
->texture
[0].data
.mask
.color
=
1388 theme
->titlebut_toggled_hover_unfocused_color
;
1389 theme
->a_toggled_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1390 theme
->a_toggled_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1391 theme
->a_toggled_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1392 theme
->titlebut_toggled_focused_unpressed_color
;
1393 theme
->a_toggled_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1394 theme
->a_toggled_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1395 theme
->a_toggled_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1396 theme
->titlebut_toggled_unfocused_unpressed_color
;
1397 theme
->a_toggled_focused_pressed_max
->texture
[0].data
.mask
.color
=
1398 theme
->a_toggled_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1399 theme
->a_toggled_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1400 theme
->titlebut_toggled_focused_pressed_color
;
1401 theme
->a_toggled_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1402 theme
->a_toggled_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1403 theme
->a_toggled_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1404 theme
->titlebut_toggled_unfocused_pressed_color
;
1405 theme
->a_focused_unpressed_max
->texture
[0].data
.mask
.color
=
1406 theme
->a_focused_unpressed_close
->texture
[0].data
.mask
.color
=
1407 theme
->a_focused_unpressed_desk
->texture
[0].data
.mask
.color
=
1408 theme
->a_focused_unpressed_shade
->texture
[0].data
.mask
.color
=
1409 theme
->a_focused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1410 theme
->titlebut_focused_unpressed_color
;
1411 theme
->a_focused_pressed_max
->texture
[0].data
.mask
.color
=
1412 theme
->a_focused_pressed_close
->texture
[0].data
.mask
.color
=
1413 theme
->a_focused_pressed_desk
->texture
[0].data
.mask
.color
=
1414 theme
->a_focused_pressed_shade
->texture
[0].data
.mask
.color
=
1415 theme
->a_focused_pressed_iconify
->texture
[0].data
.mask
.color
=
1416 theme
->titlebut_focused_pressed_color
;
1417 theme
->a_unfocused_unpressed_max
->texture
[0].data
.mask
.color
=
1418 theme
->a_unfocused_unpressed_close
->texture
[0].data
.mask
.color
=
1419 theme
->a_unfocused_unpressed_desk
->texture
[0].data
.mask
.color
=
1420 theme
->a_unfocused_unpressed_shade
->texture
[0].data
.mask
.color
=
1421 theme
->a_unfocused_unpressed_iconify
->texture
[0].data
.mask
.color
=
1422 theme
->titlebut_unfocused_unpressed_color
;
1423 theme
->a_unfocused_pressed_max
->texture
[0].data
.mask
.color
=
1424 theme
->a_unfocused_pressed_close
->texture
[0].data
.mask
.color
=
1425 theme
->a_unfocused_pressed_desk
->texture
[0].data
.mask
.color
=
1426 theme
->a_unfocused_pressed_shade
->texture
[0].data
.mask
.color
=
1427 theme
->a_unfocused_pressed_iconify
->texture
[0].data
.mask
.color
=
1428 theme
->titlebut_unfocused_pressed_color
;
1429 theme
->a_menu_bullet_normal
->texture
[0].data
.mask
.color
=
1431 theme
->a_menu_bullet_selected
->texture
[0].data
.mask
.color
=
1432 theme
->menu_selected_color
;
1435 XrmDestroyDatabase(db
);
1437 /* set the font heights */
1438 theme
->win_font_height
= RrFontHeight
1439 (theme
->win_font_focused
,
1440 theme
->a_focused_label
->texture
[0].data
.text
.shadow_offset_y
);
1441 theme
->win_font_height
=
1442 MAX(theme
->win_font_height
,
1444 (theme
->win_font_focused
,
1445 theme
->a_unfocused_label
->texture
[0].data
.text
.shadow_offset_y
));
1446 theme
->menu_title_font_height
= RrFontHeight
1447 (theme
->menu_title_font
,
1448 theme
->a_menu_text_title
->texture
[0].data
.text
.shadow_offset_y
);
1449 theme
->menu_font_height
= RrFontHeight
1451 theme
->a_menu_text_normal
->texture
[0].data
.text
.shadow_offset_y
);
1453 /* calculate some last extents */
1455 gint ft
, fb
, fl
, fr
, ut
, ub
, ul
, ur
;
1457 RrMargins(theme
->a_focused_label
, &fl
, &ft
, &fr
, &fb
);
1458 RrMargins(theme
->a_unfocused_label
, &ul
, &ut
, &ur
, &ub
);
1459 theme
->label_height
= theme
->win_font_height
+ MAX(ft
+ fb
, ut
+ ub
);
1460 theme
->label_height
+= theme
->label_height
% 2;
1462 /* this would be nice I think, since padding.width can now be 0,
1463 but it breaks frame.c horribly and I don't feel like fixing that
1464 right now, so if anyone complains, here is how to keep text from
1465 going over the title's bevel/border with a padding.width of 0 and a
1466 bevelless/borderless label
1467 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1468 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1469 theme->title_height = theme->label_height +
1470 MAX(MAX(theme->padding * 2, ft + fb),
1471 MAX(theme->padding * 2, ut + ub));
1473 theme
->title_height
= theme
->label_height
+ theme
->paddingy
* 2;
1475 RrMargins(theme
->a_menu_title
, &ul
, &ut
, &ur
, &ub
);
1476 theme
->menu_title_label_height
= theme
->menu_title_font_height
+ut
+ub
;
1477 theme
->menu_title_height
= theme
->menu_title_label_height
+
1478 theme
->paddingy
* 2;
1480 theme
->button_size
= theme
->label_height
- 2;
1481 theme
->grip_width
= 25;
1483 RrAppearanceFree(a_disabled_focused_tmp
);
1484 RrAppearanceFree(a_disabled_unfocused_tmp
);
1485 RrAppearanceFree(a_hover_focused_tmp
);
1486 RrAppearanceFree(a_hover_unfocused_tmp
);
1487 RrAppearanceFree(a_focused_unpressed_tmp
);
1488 RrAppearanceFree(a_focused_pressed_tmp
);
1489 RrAppearanceFree(a_unfocused_unpressed_tmp
);
1490 RrAppearanceFree(a_unfocused_pressed_tmp
);
1491 RrAppearanceFree(a_toggled_hover_focused_tmp
);
1492 RrAppearanceFree(a_toggled_hover_unfocused_tmp
);
1493 RrAppearanceFree(a_toggled_focused_unpressed_tmp
);
1494 RrAppearanceFree(a_toggled_focused_pressed_tmp
);
1495 RrAppearanceFree(a_toggled_unfocused_unpressed_tmp
);
1496 RrAppearanceFree(a_toggled_unfocused_pressed_tmp
);
1501 void RrThemeFree(RrTheme
*theme
)
1504 g_free(theme
->name
);
1506 RrColorFree(theme
->menu_border_color
);
1507 RrColorFree(theme
->osd_border_color
);
1508 RrColorFree(theme
->frame_focused_border_color
);
1509 RrColorFree(theme
->frame_unfocused_border_color
);
1510 RrColorFree(theme
->title_separator_focused_color
);
1511 RrColorFree(theme
->title_separator_unfocused_color
);
1512 RrColorFree(theme
->cb_unfocused_color
);
1513 RrColorFree(theme
->cb_focused_color
);
1514 RrColorFree(theme
->title_focused_color
);
1515 RrColorFree(theme
->title_unfocused_color
);
1516 RrColorFree(theme
->titlebut_disabled_focused_color
);
1517 RrColorFree(theme
->titlebut_disabled_unfocused_color
);
1518 RrColorFree(theme
->titlebut_hover_focused_color
);
1519 RrColorFree(theme
->titlebut_hover_unfocused_color
);
1520 RrColorFree(theme
->titlebut_toggled_hover_focused_color
);
1521 RrColorFree(theme
->titlebut_toggled_hover_unfocused_color
);
1522 RrColorFree(theme
->titlebut_toggled_focused_pressed_color
);
1523 RrColorFree(theme
->titlebut_toggled_unfocused_pressed_color
);
1524 RrColorFree(theme
->titlebut_toggled_focused_unpressed_color
);
1525 RrColorFree(theme
->titlebut_toggled_unfocused_unpressed_color
);
1526 RrColorFree(theme
->titlebut_focused_pressed_color
);
1527 RrColorFree(theme
->titlebut_unfocused_pressed_color
);
1528 RrColorFree(theme
->titlebut_focused_unpressed_color
);
1529 RrColorFree(theme
->titlebut_unfocused_unpressed_color
);
1530 RrColorFree(theme
->menu_title_color
);
1531 RrColorFree(theme
->menu_sep_color
);
1532 RrColorFree(theme
->menu_color
);
1533 RrColorFree(theme
->menu_selected_color
);
1534 RrColorFree(theme
->menu_disabled_color
);
1535 RrColorFree(theme
->menu_disabled_selected_color
);
1536 RrColorFree(theme
->title_focused_shadow_color
);
1537 RrColorFree(theme
->title_unfocused_shadow_color
);
1538 RrColorFree(theme
->osd_text_active_color
);
1539 RrColorFree(theme
->osd_text_inactive_color
);
1540 RrColorFree(theme
->osd_text_active_shadow_color
);
1541 RrColorFree(theme
->osd_text_inactive_shadow_color
);
1542 RrColorFree(theme
->menu_title_shadow_color
);
1543 RrColorFree(theme
->menu_text_normal_shadow_color
);
1544 RrColorFree(theme
->menu_text_selected_shadow_color
);
1545 RrColorFree(theme
->menu_text_disabled_shadow_color
);
1546 RrColorFree(theme
->menu_text_disabled_selected_shadow_color
);
1548 g_free(theme
->def_win_icon
);
1550 RrPixmapMaskFree(theme
->max_mask
);
1551 RrPixmapMaskFree(theme
->max_toggled_mask
);
1552 RrPixmapMaskFree(theme
->max_toggled_hover_mask
);
1553 RrPixmapMaskFree(theme
->max_toggled_pressed_mask
);
1554 RrPixmapMaskFree(theme
->max_disabled_mask
);
1555 RrPixmapMaskFree(theme
->max_hover_mask
);
1556 RrPixmapMaskFree(theme
->max_pressed_mask
);
1557 RrPixmapMaskFree(theme
->desk_mask
);
1558 RrPixmapMaskFree(theme
->desk_toggled_mask
);
1559 RrPixmapMaskFree(theme
->desk_toggled_hover_mask
);
1560 RrPixmapMaskFree(theme
->desk_toggled_pressed_mask
);
1561 RrPixmapMaskFree(theme
->desk_disabled_mask
);
1562 RrPixmapMaskFree(theme
->desk_hover_mask
);
1563 RrPixmapMaskFree(theme
->desk_pressed_mask
);
1564 RrPixmapMaskFree(theme
->shade_mask
);
1565 RrPixmapMaskFree(theme
->shade_toggled_mask
);
1566 RrPixmapMaskFree(theme
->shade_toggled_hover_mask
);
1567 RrPixmapMaskFree(theme
->shade_toggled_pressed_mask
);
1568 RrPixmapMaskFree(theme
->shade_disabled_mask
);
1569 RrPixmapMaskFree(theme
->shade_hover_mask
);
1570 RrPixmapMaskFree(theme
->shade_pressed_mask
);
1571 RrPixmapMaskFree(theme
->iconify_mask
);
1572 RrPixmapMaskFree(theme
->iconify_disabled_mask
);
1573 RrPixmapMaskFree(theme
->iconify_hover_mask
);
1574 RrPixmapMaskFree(theme
->iconify_pressed_mask
);
1575 RrPixmapMaskFree(theme
->close_mask
);
1576 RrPixmapMaskFree(theme
->close_disabled_mask
);
1577 RrPixmapMaskFree(theme
->close_hover_mask
);
1578 RrPixmapMaskFree(theme
->close_pressed_mask
);
1579 RrPixmapMaskFree(theme
->menu_bullet_mask
);
1580 RrPixmapMaskFree(theme
->down_arrow_mask
);
1581 RrPixmapMaskFree(theme
->up_arrow_mask
);
1583 RrFontClose(theme
->win_font_focused
);
1584 RrFontClose(theme
->win_font_unfocused
);
1585 RrFontClose(theme
->menu_title_font
);
1586 RrFontClose(theme
->menu_font
);
1587 RrFontClose(theme
->osd_font_hilite
);
1588 RrFontClose(theme
->osd_font_unhilite
);
1590 RrAppearanceFree(theme
->a_disabled_focused_max
);
1591 RrAppearanceFree(theme
->a_disabled_unfocused_max
);
1592 RrAppearanceFree(theme
->a_hover_focused_max
);
1593 RrAppearanceFree(theme
->a_hover_unfocused_max
);
1594 RrAppearanceFree(theme
->a_toggled_hover_focused_max
);
1595 RrAppearanceFree(theme
->a_toggled_hover_unfocused_max
);
1596 RrAppearanceFree(theme
->a_toggled_focused_unpressed_max
);
1597 RrAppearanceFree(theme
->a_toggled_focused_pressed_max
);
1598 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_max
);
1599 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_max
);
1600 RrAppearanceFree(theme
->a_focused_unpressed_max
);
1601 RrAppearanceFree(theme
->a_focused_pressed_max
);
1602 RrAppearanceFree(theme
->a_unfocused_unpressed_max
);
1603 RrAppearanceFree(theme
->a_unfocused_pressed_max
);
1604 RrAppearanceFree(theme
->a_disabled_focused_close
);
1605 RrAppearanceFree(theme
->a_disabled_unfocused_close
);
1606 RrAppearanceFree(theme
->a_hover_focused_close
);
1607 RrAppearanceFree(theme
->a_hover_unfocused_close
);
1608 RrAppearanceFree(theme
->a_focused_unpressed_close
);
1609 RrAppearanceFree(theme
->a_focused_pressed_close
);
1610 RrAppearanceFree(theme
->a_unfocused_unpressed_close
);
1611 RrAppearanceFree(theme
->a_unfocused_pressed_close
);
1612 RrAppearanceFree(theme
->a_disabled_focused_desk
);
1613 RrAppearanceFree(theme
->a_disabled_unfocused_desk
);
1614 RrAppearanceFree(theme
->a_hover_focused_desk
);
1615 RrAppearanceFree(theme
->a_hover_unfocused_desk
);
1616 RrAppearanceFree(theme
->a_toggled_hover_focused_desk
);
1617 RrAppearanceFree(theme
->a_toggled_hover_unfocused_desk
);
1618 RrAppearanceFree(theme
->a_toggled_focused_unpressed_desk
);
1619 RrAppearanceFree(theme
->a_toggled_focused_pressed_desk
);
1620 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_desk
);
1621 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_desk
);
1622 RrAppearanceFree(theme
->a_focused_unpressed_desk
);
1623 RrAppearanceFree(theme
->a_focused_pressed_desk
);
1624 RrAppearanceFree(theme
->a_unfocused_unpressed_desk
);
1625 RrAppearanceFree(theme
->a_unfocused_pressed_desk
);
1626 RrAppearanceFree(theme
->a_disabled_focused_shade
);
1627 RrAppearanceFree(theme
->a_disabled_unfocused_shade
);
1628 RrAppearanceFree(theme
->a_hover_focused_shade
);
1629 RrAppearanceFree(theme
->a_hover_unfocused_shade
);
1630 RrAppearanceFree(theme
->a_toggled_hover_focused_shade
);
1631 RrAppearanceFree(theme
->a_toggled_hover_unfocused_shade
);
1632 RrAppearanceFree(theme
->a_toggled_focused_unpressed_shade
);
1633 RrAppearanceFree(theme
->a_toggled_focused_pressed_shade
);
1634 RrAppearanceFree(theme
->a_toggled_unfocused_unpressed_shade
);
1635 RrAppearanceFree(theme
->a_toggled_unfocused_pressed_shade
);
1636 RrAppearanceFree(theme
->a_focused_unpressed_shade
);
1637 RrAppearanceFree(theme
->a_focused_pressed_shade
);
1638 RrAppearanceFree(theme
->a_unfocused_unpressed_shade
);
1639 RrAppearanceFree(theme
->a_unfocused_pressed_shade
);
1640 RrAppearanceFree(theme
->a_disabled_focused_iconify
);
1641 RrAppearanceFree(theme
->a_disabled_unfocused_iconify
);
1642 RrAppearanceFree(theme
->a_hover_focused_iconify
);
1643 RrAppearanceFree(theme
->a_hover_unfocused_iconify
);
1644 RrAppearanceFree(theme
->a_focused_unpressed_iconify
);
1645 RrAppearanceFree(theme
->a_focused_pressed_iconify
);
1646 RrAppearanceFree(theme
->a_unfocused_unpressed_iconify
);
1647 RrAppearanceFree(theme
->a_unfocused_pressed_iconify
);
1648 RrAppearanceFree(theme
->a_focused_grip
);
1649 RrAppearanceFree(theme
->a_unfocused_grip
);
1650 RrAppearanceFree(theme
->a_focused_title
);
1651 RrAppearanceFree(theme
->a_unfocused_title
);
1652 RrAppearanceFree(theme
->a_focused_label
);
1653 RrAppearanceFree(theme
->a_unfocused_label
);
1654 RrAppearanceFree(theme
->a_icon
);
1655 RrAppearanceFree(theme
->a_focused_handle
);
1656 RrAppearanceFree(theme
->a_unfocused_handle
);
1657 RrAppearanceFree(theme
->a_menu
);
1658 RrAppearanceFree(theme
->a_menu_title
);
1659 RrAppearanceFree(theme
->a_menu_text_title
);
1660 RrAppearanceFree(theme
->a_menu_normal
);
1661 RrAppearanceFree(theme
->a_menu_selected
);
1662 RrAppearanceFree(theme
->a_menu_disabled
);
1663 RrAppearanceFree(theme
->a_menu_disabled_selected
);
1664 RrAppearanceFree(theme
->a_menu_text_normal
);
1665 RrAppearanceFree(theme
->a_menu_text_selected
);
1666 RrAppearanceFree(theme
->a_menu_text_disabled
);
1667 RrAppearanceFree(theme
->a_menu_text_disabled_selected
);
1668 RrAppearanceFree(theme
->a_menu_bullet_normal
);
1669 RrAppearanceFree(theme
->a_menu_bullet_selected
);
1670 RrAppearanceFree(theme
->a_clear
);
1671 RrAppearanceFree(theme
->a_clear_tex
);
1672 RrAppearanceFree(theme
->osd_bg
);
1673 RrAppearanceFree(theme
->osd_hilite_bg
);
1674 RrAppearanceFree(theme
->osd_hilite_label
);
1675 RrAppearanceFree(theme
->osd_unhilite_bg
);
1676 RrAppearanceFree(theme
->osd_unhilite_label
);
1678 g_slice_free(RrTheme
, theme
);
1682 static XrmDatabase
loaddb(const gchar
*name
, gchar
**path
)
1685 XrmDatabase db
= NULL
;
1688 if (name
[0] == '/') {
1689 s
= g_build_filename(name
, "openbox-3", "themerc", NULL
);
1690 if ((db
= XrmGetFileDatabase(s
)))
1691 *path
= g_path_get_dirname(s
);
1696 p
= obt_paths_new();
1698 /* XXX backwards compatibility, remove me sometime later */
1699 s
= g_build_filename(g_get_home_dir(), ".themes", name
,
1700 "openbox-3", "themerc", NULL
);
1701 if ((db
= XrmGetFileDatabase(s
)))
1702 *path
= g_path_get_dirname(s
);
1705 for (it
= obt_paths_data_dirs(p
); !db
&& it
; it
= g_slist_next(it
))
1707 s
= g_build_filename(it
->data
, "themes", name
,
1708 "openbox-3", "themerc", NULL
);
1709 if ((db
= XrmGetFileDatabase(s
)))
1710 *path
= g_path_get_dirname(s
);
1718 s
= g_build_filename(name
, "themerc", NULL
);
1719 if ((db
= XrmGetFileDatabase(s
)))
1720 *path
= g_path_get_dirname(s
);
1727 static gchar
*create_class_name(const gchar
*rname
)
1729 gchar
*rclass
= g_strdup(rname
);
1734 p
= strchr(p
+1, '.');
1735 if (p
== NULL
) break;
1737 if (*p
== '\0') break;
1742 static gboolean
read_int(XrmDatabase db
, const gchar
*rname
, gint
*value
)
1744 gboolean ret
= FALSE
;
1745 gchar
*rclass
= create_class_name(rname
);
1746 gchar
*rettype
, *end
;
1749 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1750 retvalue
.addr
!= NULL
) {
1751 *value
= (gint
)strtol(retvalue
.addr
, &end
, 10);
1752 if (end
!= retvalue
.addr
)
1760 static gboolean
read_string(XrmDatabase db
, const gchar
*rname
, gchar
**value
)
1762 gboolean ret
= FALSE
;
1763 gchar
*rclass
= create_class_name(rname
);
1767 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1768 retvalue
.addr
!= NULL
) {
1769 *value
= retvalue
.addr
;
1777 static gboolean
read_color(XrmDatabase db
, const RrInstance
*inst
,
1778 const gchar
*rname
, RrColor
**value
)
1780 gboolean ret
= FALSE
;
1781 gchar
*rclass
= create_class_name(rname
);
1785 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1786 retvalue
.addr
!= NULL
) {
1787 RrColor
*c
= RrColorParse(inst
, retvalue
.addr
);
1798 static gboolean
read_mask(const RrInstance
*inst
, const gchar
*path
,
1799 RrTheme
*theme
, const gchar
*maskname
,
1800 RrPixmapMask
**value
)
1802 gboolean ret
= FALSE
;
1804 gint hx
, hy
; /* ignored */
1808 s
= g_build_filename(path
, maskname
, NULL
);
1809 if (XReadBitmapFileData(s
, &w
, &h
, &b
, &hx
, &hy
) == BitmapSuccess
) {
1811 *value
= RrPixmapMaskNew(inst
, w
, h
, (gchar
*)b
);
1819 static void parse_appearance(gchar
*tex
, RrSurfaceColorType
*grad
,
1820 RrReliefType
*relief
, RrBevelType
*bevel
,
1821 gboolean
*interlaced
, gboolean
*border
,
1822 gboolean allow_trans
)
1826 /* convert to all lowercase */
1827 for (t
= tex
; *t
!= '\0'; ++t
)
1828 *t
= g_ascii_tolower(*t
);
1830 if (allow_trans
&& strstr(tex
, "parentrelative") != NULL
) {
1831 *grad
= RR_SURFACE_PARENTREL
;
1833 if (strstr(tex
, "gradient") != NULL
) {
1834 if (strstr(tex
, "crossdiagonal") != NULL
)
1835 *grad
= RR_SURFACE_CROSS_DIAGONAL
;
1836 else if (strstr(tex
, "pyramid") != NULL
)
1837 *grad
= RR_SURFACE_PYRAMID
;
1838 else if (strstr(tex
, "mirrorhorizontal") != NULL
)
1839 *grad
= RR_SURFACE_MIRROR_HORIZONTAL
;
1840 else if (strstr(tex
, "horizontal") != NULL
)
1841 *grad
= RR_SURFACE_HORIZONTAL
;
1842 else if (strstr(tex
, "splitvertical") != NULL
)
1843 *grad
= RR_SURFACE_SPLIT_VERTICAL
;
1844 else if (strstr(tex
, "vertical") != NULL
)
1845 *grad
= RR_SURFACE_VERTICAL
;
1847 *grad
= RR_SURFACE_DIAGONAL
;
1849 *grad
= RR_SURFACE_SOLID
;
1853 if (strstr(tex
, "sunken") != NULL
)
1854 *relief
= RR_RELIEF_SUNKEN
;
1855 else if (strstr(tex
, "flat") != NULL
)
1856 *relief
= RR_RELIEF_FLAT
;
1857 else if (strstr(tex
, "raised") != NULL
)
1858 *relief
= RR_RELIEF_RAISED
;
1860 *relief
= (*grad
== RR_SURFACE_PARENTREL
) ?
1861 RR_RELIEF_FLAT
: RR_RELIEF_RAISED
;
1864 if (*relief
== RR_RELIEF_FLAT
) {
1865 if (strstr(tex
, "border") != NULL
)
1868 if (strstr(tex
, "bevel2") != NULL
)
1869 *bevel
= RR_BEVEL_2
;
1871 *bevel
= RR_BEVEL_1
;
1874 if (strstr(tex
, "interlaced") != NULL
)
1877 *interlaced
= FALSE
;
1880 static gboolean
read_appearance(XrmDatabase db
, const RrInstance
*inst
,
1881 const gchar
*rname
, RrAppearance
*value
,
1882 gboolean allow_trans
)
1884 gboolean ret
= FALSE
;
1885 gchar
*rclass
= create_class_name(rname
);
1886 gchar
*cname
, *ctoname
, *bcname
, *icname
, *hname
, *sname
;
1887 gchar
*csplitname
, *ctosplitname
;
1892 cname
= g_strconcat(rname
, ".color", NULL
);
1893 ctoname
= g_strconcat(rname
, ".colorTo", NULL
);
1894 bcname
= g_strconcat(rname
, ".border.color", NULL
);
1895 icname
= g_strconcat(rname
, ".interlace.color", NULL
);
1896 hname
= g_strconcat(rname
, ".highlight", NULL
);
1897 sname
= g_strconcat(rname
, ".shadow", NULL
);
1898 csplitname
= g_strconcat(rname
, ".color.splitTo", NULL
);
1899 ctosplitname
= g_strconcat(rname
, ".colorTo.splitTo", NULL
);
1901 if (XrmGetResource(db
, rname
, rclass
, &rettype
, &retvalue
) &&
1902 retvalue
.addr
!= NULL
) {
1903 parse_appearance(retvalue
.addr
,
1904 &value
->surface
.grad
,
1905 &value
->surface
.relief
,
1906 &value
->surface
.bevel
,
1907 &value
->surface
.interlaced
,
1908 &value
->surface
.border
,
1910 if (!read_color(db
, inst
, cname
, &value
->surface
.primary
))
1911 value
->surface
.primary
= RrColorNew(inst
, 0, 0, 0);
1912 if (!read_color(db
, inst
, ctoname
, &value
->surface
.secondary
))
1913 value
->surface
.secondary
= RrColorNew(inst
, 0, 0, 0);
1914 if (value
->surface
.border
)
1915 if (!read_color(db
, inst
, bcname
,
1916 &value
->surface
.border_color
))
1917 value
->surface
.border_color
= RrColorNew(inst
, 0, 0, 0);
1918 if (value
->surface
.interlaced
)
1919 if (!read_color(db
, inst
, icname
,
1920 &value
->surface
.interlace_color
))
1921 value
->surface
.interlace_color
= RrColorNew(inst
, 0, 0, 0);
1922 if (read_int(db
, hname
, &i
) && i
>= 0)
1923 value
->surface
.bevel_light_adjust
= i
;
1924 if (read_int(db
, sname
, &i
) && i
>= 0 && i
<= 256)
1925 value
->surface
.bevel_dark_adjust
= i
;
1927 if (value
->surface
.grad
== RR_SURFACE_SPLIT_VERTICAL
) {
1930 if (!read_color(db
, inst
, csplitname
,
1931 &value
->surface
.split_primary
))
1933 r
= value
->surface
.primary
->r
;
1935 g
= value
->surface
.primary
->g
;
1937 b
= value
->surface
.primary
->b
;
1939 if (r
> 0xFF) r
= 0xFF;
1940 if (g
> 0xFF) g
= 0xFF;
1941 if (b
> 0xFF) b
= 0xFF;
1942 value
->surface
.split_primary
= RrColorNew(inst
, r
, g
, b
);
1945 if (!read_color(db
, inst
, ctosplitname
,
1946 &value
->surface
.split_secondary
))
1948 r
= value
->surface
.secondary
->r
;
1950 g
= value
->surface
.secondary
->g
;
1952 b
= value
->surface
.secondary
->b
;
1954 if (r
> 0xFF) r
= 0xFF;
1955 if (g
> 0xFF) g
= 0xFF;
1956 if (b
> 0xFF) b
= 0xFF;
1957 value
->surface
.split_secondary
= RrColorNew(inst
, r
, g
, b
);
1964 g_free(ctosplitname
);
1976 static int parse_inline_number(const char *p
)
1984 for (; isdigit(*p
); ++p
)
1985 res
= res
* 10 + *p
- '0';
1990 static void set_default_appearance(RrAppearance
*a
)
1992 a
->surface
.grad
= RR_SURFACE_SOLID
;
1993 a
->surface
.relief
= RR_RELIEF_FLAT
;
1994 a
->surface
.bevel
= RR_BEVEL_1
;
1995 a
->surface
.interlaced
= FALSE
;
1996 a
->surface
.border
= FALSE
;
1997 a
->surface
.primary
= RrColorNew(a
->inst
, 0, 0, 0);
1998 a
->surface
.secondary
= RrColorNew(a
->inst
, 0, 0, 0);
2001 /* Reads the output from gimp's C-Source file format into valid RGBA data for
2002 an RrTextureRGBA. */
2003 static RrPixel32
* read_c_image(gint width
, gint height
, const guint8
*data
)
2008 p
= im
= g_memdup(data
, width
* height
* sizeof(RrPixel32
));
2010 for (i
= 0; i
< width
* height
; ++i
) {
2011 guchar a
= ((*p
>> 24) & 0xff);
2012 guchar b
= ((*p
>> 16) & 0xff);
2013 guchar g
= ((*p
>> 8) & 0xff);
2014 guchar r
= ((*p
>> 0) & 0xff);
2016 *p
= ((r
<< RrDefaultRedOffset
) +
2017 (g
<< RrDefaultGreenOffset
) +
2018 (b
<< RrDefaultBlueOffset
) +
2019 (a
<< RrDefaultAlphaOffset
));