1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 frame_minimal_config.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.
20 #include "frame_minimal_config.h"
21 #include "frame_minimal_plugin.h"
23 #include "render/render.h"
24 #include "render/color.h"
25 #include "render/font.h"
26 #include "render/mask.h"
27 #include "render/icon.h"
28 #include "parser/parse.h"
36 static XrmDatabase loaddb(const gchar *name, gchar **path);
37 static gboolean read_int(XrmDatabase db, const gchar *rname, gint *value);
38 static gboolean read_string(XrmDatabase db, const gchar *rname, gchar **value);
39 static gboolean read_color(XrmDatabase db, const RrInstance *inst,
40 const gchar *rname, RrColor **value);
41 static gboolean read_mask(const RrInstance *inst, const gchar *path,
42 ObFrameThemeConfig *theme, const gchar *maskname, RrPixmapMask **value);
43 static gboolean read_appearance(XrmDatabase db, const RrInstance *inst,
44 const gchar *rname, RrAppearance *value, 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 gint load_theme_config(const RrInstance *inst, const gchar *name,
50 const gchar * path, XrmDatabase db, RrFont *active_window_font,
51 RrFont *inactive_window_font, RrFont *menu_title_font,
52 RrFont *menu_item_font, RrFont *osd_font)
54 RrJustify winjust, mtitlejust;
56 ObFrameThemeConfig * theme = &theme_config;
59 //theme = g_new0(ObFrameTheme, 1);
62 theme->name = g_strdup(name ? name : DEFAULT_THEME);
64 theme->a_disabled_focused_max = RrAppearanceNew(inst, 1);
65 theme->a_disabled_unfocused_max = RrAppearanceNew(inst, 1);
66 theme->a_hover_focused_max = RrAppearanceNew(inst, 1);
67 theme->a_hover_unfocused_max = RrAppearanceNew(inst, 1);
68 theme->a_toggled_focused_unpressed_max = RrAppearanceNew(inst, 1);
69 theme->a_toggled_unfocused_unpressed_max = RrAppearanceNew(inst, 1);
70 theme->a_toggled_hover_focused_max = RrAppearanceNew(inst, 1);
71 theme->a_toggled_hover_unfocused_max = RrAppearanceNew(inst, 1);
72 theme->a_toggled_focused_pressed_max = RrAppearanceNew(inst, 1);
73 theme->a_toggled_unfocused_pressed_max = RrAppearanceNew(inst, 1);
74 theme->a_focused_unpressed_max = RrAppearanceNew(inst, 1);
75 theme->a_focused_pressed_max = RrAppearanceNew(inst, 1);
76 theme->a_unfocused_unpressed_max = RrAppearanceNew(inst, 1);
77 theme->a_unfocused_pressed_max = RrAppearanceNew(inst, 1);
78 theme->a_focused_grip = RrAppearanceNew(inst, 0);
79 theme->a_unfocused_grip = RrAppearanceNew(inst, 0);
80 theme->a_focused_title = RrAppearanceNew(inst, 0);
81 theme->a_unfocused_title = RrAppearanceNew(inst, 0);
82 theme->a_focused_label = RrAppearanceNew(inst, 1);
83 theme->a_unfocused_label = RrAppearanceNew(inst, 1);
84 theme->a_icon = RrAppearanceNew(inst, 1);
85 theme->a_focused_handle = RrAppearanceNew(inst, 0);
86 theme->a_unfocused_handle = RrAppearanceNew(inst, 0);
87 theme->a_menu = RrAppearanceNew(inst, 0);
88 theme->a_menu_title = RrAppearanceNew(inst, 0);
89 theme->a_menu_text_title = RrAppearanceNew(inst, 1);
90 theme->a_menu_normal = RrAppearanceNew(inst, 0);
91 theme->a_menu_selected = RrAppearanceNew(inst, 0);
92 theme->a_menu_disabled = RrAppearanceNew(inst, 0);
93 theme->a_menu_disabled_selected = RrAppearanceNew(inst, 0);
94 theme->a_menu_text_normal = RrAppearanceNew(inst, 1);
95 theme->a_menu_text_selected = RrAppearanceNew(inst, 1);
96 theme->a_menu_text_disabled = RrAppearanceNew(inst, 1);
97 theme->a_menu_text_disabled_selected = RrAppearanceNew(inst, 1);
98 theme->a_menu_bullet_normal = RrAppearanceNew(inst, 1);
99 theme->a_menu_bullet_selected = RrAppearanceNew(inst, 1);
100 theme->a_clear = RrAppearanceNew(inst, 0);
101 theme->a_clear_tex = RrAppearanceNew(inst, 1);
102 theme->osd_hilite_bg = RrAppearanceNew(inst, 0);
103 theme->osd_hilite_label = RrAppearanceNew(inst, 1);
104 theme->osd_hilite_fg = RrAppearanceNew(inst, 0);
105 theme->osd_unhilite_fg = RrAppearanceNew(inst, 0);
107 /* load the font stuff */
108 if (active_window_font) {
109 theme->win_font_focused = active_window_font;
110 RrFontRef(active_window_font);
113 theme->win_font_focused = RrFontOpenDefault(inst);
115 if (inactive_window_font) {
116 theme->win_font_unfocused = inactive_window_font;
117 RrFontRef(inactive_window_font);
120 theme->win_font_unfocused = RrFontOpenDefault(inst);
122 winjust = RR_JUSTIFY_LEFT;
124 if (!g_ascii_strcasecmp(str, "right"))
125 winjust = RR_JUSTIFY_RIGHT;
126 else if (!g_ascii_strcasecmp(str, "center"))
127 winjust = RR_JUSTIFY_CENTER;
129 if (menu_title_font) {
130 theme->menu_title_font = menu_title_font;
131 RrFontRef(menu_title_font);
134 theme->menu_title_font = RrFontOpenDefault(inst);
136 mtitlejust = RR_JUSTIFY_LEFT;
138 if (!g_ascii_strcasecmp(str, "right"))
139 mtitlejust = RR_JUSTIFY_RIGHT;
140 else if (!g_ascii_strcasecmp(str, "center"))
141 mtitlejust = RR_JUSTIFY_CENTER;
143 if (menu_item_font) {
144 theme->menu_font = menu_item_font;
145 RrFontRef(menu_item_font);
148 theme->menu_font = RrFontOpenDefault(inst);
151 theme->osd_font = osd_font;
155 theme->osd_font = RrFontOpenDefault(inst);
157 /* load direct dimensions */
158 theme->menu_overlap = 0;
159 theme->handle_height = 6;
161 theme->paddingy = theme->paddingx;
163 /* menu border width inherits from the frame border width */
164 theme->mbwidth = theme->fbwidth;
165 /* osd border width inherits from the frame border width */
166 theme->obwidth = theme->fbwidth;
167 theme->cbwidthx = theme->paddingx;
168 theme->cbwidthy = theme->cbwidthx;
171 theme->frame_focused_border_color = RrColorNew(inst, 0, 0, 0);
172 /* title separator focused color inherits from focused boder color */
173 theme->title_separator_focused_color = RrColorNew(inst,
174 theme->frame_focused_border_color->r,
175 theme->frame_focused_border_color->g,
176 theme->frame_focused_border_color->b);
177 /* unfocused border color inherits from frame focused border color */
178 theme->frame_unfocused_border_color = RrColorNew(inst,
179 theme->frame_focused_border_color->r,
180 theme->frame_focused_border_color->g,
181 theme->frame_focused_border_color->b);
182 /* title separator unfocused color inherits from unfocused boder color */
183 theme->title_separator_unfocused_color = RrColorNew(inst,
184 theme->frame_unfocused_border_color->r,
185 theme->frame_unfocused_border_color->g,
186 theme->frame_unfocused_border_color->b);
188 /* menu border color inherits from frame focused border color */
189 theme->menu_border_color = RrColorNew(inst,
190 theme->frame_focused_border_color->r,
191 theme->frame_focused_border_color->g,
192 theme->frame_focused_border_color->b);
193 /* osd border color inherits from frame focused border color */
194 theme->osd_border_color = RrColorNew(inst,
195 theme->frame_focused_border_color->r,
196 theme->frame_focused_border_color->g,
197 theme->frame_focused_border_color->b);
198 theme->cb_focused_color = RrColorNew(inst, 0xff, 0xff, 0xff);
199 theme->cb_unfocused_color = RrColorNew(inst, 0x44, 0x44, 0x44);
200 theme->title_focused_color = RrColorNew(inst, 0xff, 0xff, 0xff);
201 theme->osd_color = RrColorNew(inst, theme->title_focused_color->r,
202 theme->title_focused_color->g, theme->title_focused_color->b);
203 theme->title_unfocused_color = RrColorNew(inst, 0x44, 0x44, 0x44);
204 theme->titlebut_focused_unpressed_color
205 = RrColorNew(inst, 0xff, 0xff, 0xff);
206 theme->titlebut_unfocused_unpressed_color = RrColorNew(inst, 0x44, 0x44,
208 theme->titlebut_focused_pressed_color = RrColorNew(inst,
209 theme->titlebut_focused_unpressed_color->r,
210 theme->titlebut_focused_unpressed_color->g,
211 theme->titlebut_focused_unpressed_color->b);
212 theme->titlebut_unfocused_pressed_color = RrColorNew(inst,
213 theme->titlebut_unfocused_unpressed_color->r,
214 theme->titlebut_unfocused_unpressed_color->g,
215 theme->titlebut_unfocused_unpressed_color->b);
216 theme->titlebut_disabled_focused_color = RrColorNew(inst, 0xff, 0xff, 0xff);
217 theme->titlebut_disabled_unfocused_color = RrColorNew(inst, 0, 0, 0);
218 theme->titlebut_hover_focused_color = RrColorNew(inst,
219 theme->titlebut_focused_unpressed_color->r,
220 theme->titlebut_focused_unpressed_color->g,
221 theme->titlebut_focused_unpressed_color->b);
222 theme->titlebut_hover_unfocused_color = RrColorNew(inst,
223 theme->titlebut_unfocused_unpressed_color->r,
224 theme->titlebut_unfocused_unpressed_color->g,
225 theme->titlebut_unfocused_unpressed_color->b);
226 theme->titlebut_toggled_focused_unpressed_color = RrColorNew(inst,
227 theme->titlebut_focused_pressed_color->r,
228 theme->titlebut_focused_pressed_color->g,
229 theme->titlebut_focused_pressed_color->b);
230 theme->titlebut_toggled_unfocused_unpressed_color = RrColorNew(inst,
231 theme->titlebut_unfocused_pressed_color->r,
232 theme->titlebut_unfocused_pressed_color->g,
233 theme->titlebut_unfocused_pressed_color->b);
234 theme->titlebut_toggled_hover_focused_color = RrColorNew(inst,
235 theme->titlebut_toggled_focused_unpressed_color->r,
236 theme->titlebut_toggled_focused_unpressed_color->g,
237 theme->titlebut_toggled_focused_unpressed_color->b);
238 theme->titlebut_toggled_hover_unfocused_color = RrColorNew(inst,
239 theme->titlebut_toggled_unfocused_unpressed_color->r,
240 theme->titlebut_toggled_unfocused_unpressed_color->g,
241 theme->titlebut_toggled_unfocused_unpressed_color->b);
242 theme->titlebut_toggled_focused_pressed_color = RrColorNew(inst,
243 theme->titlebut_focused_pressed_color->r,
244 theme->titlebut_focused_pressed_color->g,
245 theme->titlebut_focused_pressed_color->b);
246 theme->titlebut_toggled_unfocused_pressed_color = RrColorNew(inst,
247 theme->titlebut_unfocused_pressed_color->r,
248 theme->titlebut_unfocused_pressed_color->g,
249 theme->titlebut_unfocused_pressed_color->b);
250 theme->menu_title_color = RrColorNew(inst, 0, 0, 0);
251 theme->menu_color = RrColorNew(inst, 0xff, 0xff, 0xff);
252 theme->menu_disabled_color = RrColorNew(inst, 0, 0, 0);
253 theme->menu_disabled_selected_color = RrColorNew(inst,
254 theme->menu_disabled_color->r, theme->menu_disabled_color->g,
255 theme->menu_disabled_color->b);
256 theme->menu_selected_color = RrColorNew(inst, 0, 0, 0);
258 /* load the image masks */
260 /* maximize button masks */
262 if (!read_mask(inst, path, theme, "max.xbm", &theme->max_mask)) {
263 guchar data[] = { 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f };
264 theme->max_mask = RrPixmapMaskNew(inst, 6, 6, (gchar*)data);
267 if (!read_mask(inst, path, theme, "max_toggled.xbm",
268 &theme->max_toggled_mask)) {
270 theme->max_toggled_mask = RrPixmapMaskCopy(theme->max_mask);
272 guchar data[] = { 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f };
273 theme->max_toggled_mask = RrPixmapMaskNew(inst, 6, 6, (gchar*)data);
277 theme->max_pressed_mask = RrPixmapMaskCopy(theme->max_mask);
278 theme->max_disabled_mask = RrPixmapMaskCopy(theme->max_mask);
279 theme->max_hover_mask = RrPixmapMaskCopy(theme->max_mask);
280 theme->max_toggled_pressed_mask = RrPixmapMaskCopy(theme->max_toggled_mask);
281 theme->max_toggled_hover_mask = RrPixmapMaskCopy(theme->max_toggled_mask);
283 /* iconify button masks */
284 if (!read_mask(inst, path, theme, "iconify.xbm", &theme->iconify_mask)) {
285 guchar data[] = { 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f };
286 theme->iconify_mask = RrPixmapMaskNew(inst, 6, 6, (gchar*)data);
288 theme->iconify_pressed_mask = RrPixmapMaskCopy(theme->iconify_mask);
289 theme->iconify_disabled_mask = RrPixmapMaskCopy(theme->iconify_mask);
290 theme->iconify_hover_mask = RrPixmapMaskCopy(theme->iconify_mask);
292 /* all desktops button masks */
294 if (!read_mask(inst, path, theme, "desk.xbm", &theme->desk_mask)) {
295 guchar data[] = { 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 };
296 theme->desk_mask = RrPixmapMaskNew(inst, 6, 6, (gchar*)data);
299 if (!read_mask(inst, path, theme, "desk_toggled.xbm",
300 &theme->desk_toggled_mask)) {
302 theme->desk_toggled_mask = RrPixmapMaskCopy(theme->desk_mask);
304 guchar data[] = { 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 };
305 theme->desk_toggled_mask
306 = RrPixmapMaskNew(inst, 6, 6, (gchar*)data);
309 theme->desk_pressed_mask = RrPixmapMaskCopy(theme->desk_mask);
310 theme->desk_disabled_mask = RrPixmapMaskCopy(theme->desk_mask);
311 theme->desk_hover_mask = RrPixmapMaskCopy(theme->desk_mask);
312 theme->desk_toggled_pressed_mask
313 = RrPixmapMaskCopy(theme->desk_toggled_mask);
314 theme->desk_toggled_hover_mask = RrPixmapMaskCopy(theme->desk_toggled_mask);
316 /* shade button masks */
317 if (!read_mask(inst, path, theme, "shade.xbm", &theme->shade_mask)) {
318 guchar data[] = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 };
319 theme->shade_mask = RrPixmapMaskNew(inst, 6, 6, (gchar*)data);
321 theme->shade_toggled_mask = RrPixmapMaskCopy(theme->shade_mask);
322 theme->shade_pressed_mask = RrPixmapMaskCopy(theme->shade_mask);
323 theme->shade_disabled_mask = RrPixmapMaskCopy(theme->shade_mask);
324 theme->shade_hover_mask = RrPixmapMaskCopy(theme->shade_mask);
325 theme->shade_toggled_pressed_mask
326 = RrPixmapMaskCopy(theme->shade_toggled_mask);
327 theme->shade_toggled_hover_mask
328 = RrPixmapMaskCopy(theme->shade_toggled_mask);
330 /* close button masks */
331 if (!read_mask(inst, path, theme, "close.xbm", &theme->close_mask)) {
332 guchar data[] = { 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 };
333 theme->close_mask = RrPixmapMaskNew(inst, 6, 6, (gchar*)data);
335 theme->close_pressed_mask = RrPixmapMaskCopy(theme->close_mask);
336 theme->close_disabled_mask = RrPixmapMaskCopy(theme->close_mask);
337 theme->close_hover_mask = RrPixmapMaskCopy(theme->close_mask);
339 /* submenu bullet mask */
340 if (!read_mask(inst, path, theme, "bullet.xbm", &theme->menu_bullet_mask)) {
341 guchar data[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
342 theme->menu_bullet_mask = RrPixmapMaskNew(inst, 4, 7, (gchar*)data);
345 /* setup the default window icon */
346 theme->def_win_icon = read_c_image(OB_DEFAULT_ICON_WIDTH,
347 OB_DEFAULT_ICON_HEIGHT, OB_DEFAULT_ICON_pixel_data);
349 /* the toggled hover mask = the toggled unpressed mask (i.e. no change) */
350 theme->max_toggled_hover_mask = RrPixmapMaskCopy(theme->max_toggled_mask);
351 theme->desk_toggled_hover_mask = RrPixmapMaskCopy(theme->desk_toggled_mask);
352 theme->shade_toggled_hover_mask
353 = RrPixmapMaskCopy(theme->shade_toggled_mask);
354 /* the toggled pressed mask = the toggled unpressed mask (i.e. no change)*/
355 theme->max_toggled_pressed_mask = RrPixmapMaskCopy(theme->max_toggled_mask);
356 theme->desk_toggled_pressed_mask
357 = RrPixmapMaskCopy(theme->desk_toggled_mask);
358 theme->shade_toggled_pressed_mask
359 = RrPixmapMaskCopy(theme->shade_toggled_mask);
361 /* read the decoration textures */
362 set_default_appearance(theme->a_focused_title);
363 set_default_appearance(theme->a_unfocused_title);
364 set_default_appearance(theme->a_focused_label);
365 set_default_appearance(theme->a_unfocused_label);
366 set_default_appearance(theme->a_focused_handle);
367 set_default_appearance(theme->a_unfocused_handle);
368 set_default_appearance(theme->a_focused_grip);
369 set_default_appearance(theme->a_unfocused_grip);
370 set_default_appearance(theme->a_menu);
371 set_default_appearance(theme->a_menu_title);
372 set_default_appearance(theme->a_menu_selected);
373 theme->a_menu_disabled_selected = RrAppearanceCopy(theme->a_menu_selected);
375 /* read appearances for non-decorations (on-screen-display) */
376 if (!read_appearance(db, inst, "osd.bg", theme->osd_hilite_bg, FALSE)) {
377 RrAppearanceFree(theme->osd_hilite_bg);
378 theme->osd_hilite_bg = RrAppearanceCopy(theme->a_focused_title);
380 if (!read_appearance(db, inst, "osd.label.bg", theme->osd_hilite_label,
382 RrAppearanceFree(theme->osd_hilite_label);
383 theme->osd_hilite_label = RrAppearanceCopy(theme->a_focused_label);
385 /* osd_hilite_fg can't be parentrel */
386 if (!read_appearance(db, inst, "osd.hilight.bg", theme->osd_hilite_fg,
388 RrAppearanceFree(theme->osd_hilite_fg);
389 if (theme->a_focused_label->surface.grad != RR_SURFACE_PARENTREL)
390 theme->osd_hilite_fg = RrAppearanceCopy(theme->a_focused_label);
392 theme->osd_hilite_fg = RrAppearanceCopy(theme->a_focused_title);
394 /* osd_unhilite_fg can't be parentrel either */
395 if (!read_appearance(db, inst, "osd.unhilight.bg", theme->osd_unhilite_fg,
397 RrAppearanceFree(theme->osd_unhilite_fg);
398 if (theme->a_unfocused_label->surface.grad != RR_SURFACE_PARENTREL)
399 theme->osd_unhilite_fg=RrAppearanceCopy(theme->a_unfocused_label);
401 theme->osd_unhilite_fg=RrAppearanceCopy(theme->a_unfocused_title);
404 /* read buttons textures */
405 set_default_appearance(theme->a_disabled_focused_max);
406 set_default_appearance(theme->a_disabled_unfocused_max);
407 set_default_appearance(theme->a_focused_pressed_max);
408 set_default_appearance(theme->a_unfocused_pressed_max);
409 if (!read_appearance(db, inst, "window.active.button.toggled.unpressed.bg",
410 theme->a_toggled_focused_unpressed_max, TRUE) && !read_appearance(
411 db, inst, "window.active.button.toggled.bg",
412 theme->a_toggled_focused_unpressed_max, TRUE)) {
413 RrAppearanceFree(theme->a_toggled_focused_unpressed_max);
414 theme->a_toggled_focused_unpressed_max
415 = RrAppearanceCopy(theme->a_focused_pressed_max);
417 if (!read_appearance(db, inst,
418 "window.inactive.button.toggled.unpressed.bg",
419 theme->a_toggled_unfocused_unpressed_max, TRUE)
420 && !read_appearance(db, inst, "window.inactive.button.toggled.bg",
421 theme->a_toggled_unfocused_unpressed_max, TRUE)) {
422 RrAppearanceFree(theme->a_toggled_unfocused_unpressed_max);
423 theme->a_toggled_unfocused_unpressed_max
424 = RrAppearanceCopy(theme->a_unfocused_pressed_max);
426 if (!read_appearance(db, inst, "window.active.button.toggled.hover.bg",
427 theme->a_toggled_hover_focused_max, TRUE)) {
428 RrAppearanceFree(theme->a_toggled_hover_focused_max);
429 theme->a_toggled_hover_focused_max
430 = RrAppearanceCopy(theme->a_toggled_focused_unpressed_max);
432 if (!read_appearance(db, inst, "window.inactive.button.toggled.hover.bg",
433 theme->a_toggled_hover_unfocused_max, TRUE)) {
434 RrAppearanceFree(theme->a_toggled_hover_unfocused_max);
435 theme->a_toggled_hover_unfocused_max
436 = RrAppearanceCopy(theme->a_toggled_unfocused_unpressed_max);
438 if (!read_appearance(db, inst, "window.active.button.toggled.pressed.bg",
439 theme->a_toggled_focused_pressed_max, TRUE)) {
440 RrAppearanceFree(theme->a_toggled_focused_pressed_max);
441 theme->a_toggled_focused_pressed_max
442 = RrAppearanceCopy(theme->a_focused_pressed_max);
444 if (!read_appearance(db, inst, "window.inactive.button.toggled.pressed.bg",
445 theme->a_toggled_unfocused_pressed_max, TRUE)) {
446 RrAppearanceFree(theme->a_toggled_unfocused_pressed_max);
447 theme->a_toggled_unfocused_pressed_max
448 = RrAppearanceCopy(theme->a_unfocused_pressed_max);
450 set_default_appearance(theme->a_focused_unpressed_max);
451 set_default_appearance(theme->a_unfocused_unpressed_max);
452 if (!read_appearance(db, inst, "window.active.button.hover.bg",
453 theme->a_hover_focused_max, TRUE)) {
454 RrAppearanceFree(theme->a_hover_focused_max);
455 theme->a_hover_focused_max
456 = RrAppearanceCopy(theme->a_focused_unpressed_max);
458 if (!read_appearance(db, inst, "window.inactive.button.hover.bg",
459 theme->a_hover_unfocused_max, TRUE)) {
460 RrAppearanceFree(theme->a_hover_unfocused_max);
461 theme->a_hover_unfocused_max
462 = RrAppearanceCopy(theme->a_unfocused_unpressed_max);
465 theme->a_disabled_focused_close
466 = RrAppearanceCopy(theme->a_disabled_focused_max);
467 theme->a_disabled_unfocused_close
468 = RrAppearanceCopy(theme->a_disabled_unfocused_max);
469 theme->a_hover_focused_close = RrAppearanceCopy(theme->a_hover_focused_max);
470 theme->a_hover_unfocused_close
471 = RrAppearanceCopy(theme->a_hover_unfocused_max);
472 theme->a_unfocused_unpressed_close
473 = RrAppearanceCopy(theme->a_unfocused_unpressed_max);
474 theme->a_unfocused_pressed_close
475 = RrAppearanceCopy(theme->a_unfocused_pressed_max);
476 theme->a_focused_unpressed_close
477 = RrAppearanceCopy(theme->a_focused_unpressed_max);
478 theme->a_focused_pressed_close
479 = RrAppearanceCopy(theme->a_focused_pressed_max);
480 theme->a_disabled_focused_desk
481 = RrAppearanceCopy(theme->a_disabled_focused_max);
482 theme->a_disabled_unfocused_desk
483 = RrAppearanceCopy(theme->a_disabled_unfocused_max);
484 theme->a_hover_focused_desk = RrAppearanceCopy(theme->a_hover_focused_max);
485 theme->a_hover_unfocused_desk
486 = RrAppearanceCopy(theme->a_hover_unfocused_max);
487 theme->a_toggled_hover_focused_desk
488 = RrAppearanceCopy(theme->a_toggled_hover_focused_max);
489 theme->a_toggled_hover_unfocused_desk
490 = RrAppearanceCopy(theme->a_toggled_hover_unfocused_max);
491 theme->a_toggled_focused_unpressed_desk
492 = RrAppearanceCopy(theme->a_toggled_focused_unpressed_max);
493 theme->a_toggled_unfocused_unpressed_desk
494 = RrAppearanceCopy(theme->a_toggled_unfocused_unpressed_max);
495 theme->a_toggled_focused_pressed_desk
496 = RrAppearanceCopy(theme->a_toggled_focused_pressed_max);
497 theme->a_toggled_unfocused_pressed_desk
498 = RrAppearanceCopy(theme->a_toggled_unfocused_pressed_max);
499 theme->a_unfocused_unpressed_desk
500 = RrAppearanceCopy(theme->a_unfocused_unpressed_max);
501 theme->a_unfocused_pressed_desk
502 = RrAppearanceCopy(theme->a_unfocused_pressed_max);
503 theme->a_focused_unpressed_desk
504 = RrAppearanceCopy(theme->a_focused_unpressed_max);
505 theme->a_focused_pressed_desk
506 = RrAppearanceCopy(theme->a_focused_pressed_max);
507 theme->a_disabled_focused_shade
508 = RrAppearanceCopy(theme->a_disabled_focused_max);
509 theme->a_disabled_unfocused_shade
510 = RrAppearanceCopy(theme->a_disabled_unfocused_max);
511 theme->a_hover_focused_shade = RrAppearanceCopy(theme->a_hover_focused_max);
512 theme->a_hover_unfocused_shade
513 = RrAppearanceCopy(theme->a_hover_unfocused_max);
514 theme->a_toggled_hover_focused_shade
515 = RrAppearanceCopy(theme->a_toggled_hover_focused_max);
516 theme->a_toggled_hover_unfocused_shade
517 = RrAppearanceCopy(theme->a_toggled_hover_unfocused_max);
518 theme->a_toggled_focused_unpressed_shade
519 = RrAppearanceCopy(theme->a_toggled_focused_unpressed_max);
520 theme->a_toggled_unfocused_unpressed_shade
521 = RrAppearanceCopy(theme->a_toggled_unfocused_unpressed_max);
522 theme->a_toggled_focused_pressed_shade
523 = RrAppearanceCopy(theme->a_toggled_focused_pressed_max);
524 theme->a_toggled_unfocused_pressed_shade
525 = RrAppearanceCopy(theme->a_toggled_unfocused_pressed_max);
526 theme->a_unfocused_unpressed_shade
527 = RrAppearanceCopy(theme->a_unfocused_unpressed_max);
528 theme->a_unfocused_pressed_shade
529 = RrAppearanceCopy(theme->a_unfocused_pressed_max);
530 theme->a_focused_unpressed_shade
531 = RrAppearanceCopy(theme->a_focused_unpressed_max);
532 theme->a_focused_pressed_shade
533 = RrAppearanceCopy(theme->a_focused_pressed_max);
534 theme->a_disabled_focused_iconify
535 = RrAppearanceCopy(theme->a_disabled_focused_max);
536 theme->a_disabled_unfocused_iconify
537 = RrAppearanceCopy(theme->a_disabled_focused_max);
538 theme->a_hover_focused_iconify
539 = RrAppearanceCopy(theme->a_hover_focused_max);
540 theme->a_hover_unfocused_iconify
541 = RrAppearanceCopy(theme->a_hover_unfocused_max);
542 theme->a_unfocused_unpressed_iconify
543 = RrAppearanceCopy(theme->a_unfocused_unpressed_max);
544 theme->a_unfocused_pressed_iconify
545 = RrAppearanceCopy(theme->a_unfocused_pressed_max);
546 theme->a_focused_unpressed_iconify
547 = RrAppearanceCopy(theme->a_focused_unpressed_max);
548 theme->a_focused_pressed_iconify
549 = RrAppearanceCopy(theme->a_focused_pressed_max);
551 theme->a_icon->surface.grad
552 = theme->a_clear->surface.grad
553 = theme->a_clear_tex->surface.grad
554 = theme->a_menu_text_title->surface.grad
555 = theme->a_menu_normal->surface.grad
556 = theme->a_menu_disabled->surface.grad
557 = theme->a_menu_text_normal->surface.grad
558 = theme->a_menu_text_selected->surface.grad
559 = theme->a_menu_text_disabled->surface.grad
560 = theme->a_menu_text_disabled_selected->surface.grad
561 = theme->a_menu_bullet_normal->surface.grad
562 = theme->a_menu_bullet_selected->surface.grad
563 = RR_SURFACE_PARENTREL;
565 /* set up the textures */
566 theme->a_focused_label->texture[0].type = RR_TEXTURE_TEXT;
567 theme->a_focused_label->texture[0].data.text.justify = winjust;
568 theme->a_focused_label->texture[0].data.text.font=theme->win_font_focused;
569 theme->a_focused_label->texture[0].data.text.color
570 = theme->title_focused_color;
572 if (read_string(db, "window.active.label.text.font", &str)) {
576 if (strstr(str, "shadow=y")) {
577 if ((p = strstr(str, "shadowoffset=")))
578 i = parse_inline_number(p + strlen("shadowoffset="));
581 theme->a_focused_label->texture[0].data.text.shadow_offset_x = i;
582 theme->a_focused_label->texture[0].data.text.shadow_offset_y = i;
584 if ((p = strstr(str, "shadowtint="))) {
585 i = parse_inline_number(p + strlen("shadowtint="));
586 j = (i > 0 ? 0 : 255);
589 theme->title_focused_shadow_color = RrColorNew(inst, j, j, j);
590 theme->title_focused_shadow_alpha = i;
593 theme->title_focused_shadow_color = RrColorNew(inst, 0, 0, 0);
594 theme->title_focused_shadow_alpha = 50;
598 theme->a_focused_label->texture[0].data.text.shadow_color
599 = theme->title_focused_shadow_color;
600 theme->a_focused_label->texture[0].data.text.shadow_alpha
601 = theme->title_focused_shadow_alpha;
603 theme->osd_hilite_label->texture[0].type = RR_TEXTURE_TEXT;
604 theme->osd_hilite_label->texture[0].data.text.justify = RR_JUSTIFY_LEFT;
605 theme->osd_hilite_label->texture[0].data.text.font = theme->osd_font;
606 theme->osd_hilite_label->texture[0].data.text.color = theme->osd_color;
608 if (read_string(db, "osd.label.text.font", &str)) {
612 if (strstr(str, "shadow=y")) {
613 if ((p = strstr(str, "shadowoffset=")))
614 i = parse_inline_number(p + strlen("shadowoffset="));
617 theme->a_focused_label->texture[0].data.text.shadow_offset_x = i;
618 theme->a_focused_label->texture[0].data.text.shadow_offset_y = i;
619 theme->osd_hilite_label->texture[0].data.text.shadow_offset_x = i;
620 theme->osd_hilite_label->texture[0].data.text.shadow_offset_y = i;
622 if ((p = strstr(str, "shadowtint="))) {
623 i = parse_inline_number(p + strlen("shadowtint="));
624 j = (i > 0 ? 0 : 255);
627 theme->title_focused_shadow_color = RrColorNew(inst, j, j, j);
628 theme->title_focused_shadow_alpha = i;
629 theme->osd_shadow_color = RrColorNew(inst, j, j, j);
630 theme->osd_shadow_alpha = i;
633 theme->title_focused_shadow_color = RrColorNew(inst, 0, 0, 0);
634 theme->title_focused_shadow_alpha = 50;
635 theme->osd_shadow_color = RrColorNew(inst, 0, 0, 0);
636 theme->osd_shadow_alpha = 50;
640 /* inherit the font settings from the focused label */
641 theme->osd_hilite_label->texture[0].data.text.shadow_offset_x
642 = theme->a_focused_label->texture[0].data.text.shadow_offset_x;
643 theme->osd_hilite_label->texture[0].data.text.shadow_offset_y
644 = theme->a_focused_label->texture[0].data.text.shadow_offset_y;
645 if (theme->title_focused_shadow_color)
646 theme->osd_shadow_color = RrColorNew(inst,
647 theme->title_focused_shadow_color->r,
648 theme->title_focused_shadow_color->g,
649 theme->title_focused_shadow_color->b);
651 theme->osd_shadow_color = RrColorNew(inst, 0, 0, 0);
652 theme->osd_shadow_alpha = theme->title_focused_shadow_alpha;
655 theme->osd_hilite_label->texture[0].data.text.shadow_color
656 = theme->osd_shadow_color;
657 theme->osd_hilite_label->texture[0].data.text.shadow_alpha
658 = theme->osd_shadow_alpha;
660 theme->a_unfocused_label->texture[0].type = RR_TEXTURE_TEXT;
661 theme->a_unfocused_label->texture[0].data.text.justify = winjust;
662 theme->a_unfocused_label->texture[0].data.text.font
663 = theme->win_font_unfocused;
664 theme->a_unfocused_label->texture[0].data.text.color
665 = theme->title_unfocused_color;
667 if (read_string(db, "window.inactive.label.text.font", &str)) {
671 if (strstr(str, "shadow=y")) {
672 if ((p = strstr(str, "shadowoffset=")))
673 i = parse_inline_number(p + strlen("shadowoffset="));
676 theme->a_unfocused_label->texture[0].data.text.shadow_offset_x = i;
677 theme->a_unfocused_label->texture[0].data.text.shadow_offset_y = i;
679 if ((p = strstr(str, "shadowtint="))) {
680 i = parse_inline_number(p + strlen("shadowtint="));
681 j = (i > 0 ? 0 : 255);
684 theme->title_unfocused_shadow_color = RrColorNew(inst, j, j, j);
685 theme->title_unfocused_shadow_alpha = i;
688 theme->title_unfocused_shadow_color = RrColorNew(inst, 0, 0, 0);
689 theme->title_unfocused_shadow_alpha = 50;
693 theme->a_unfocused_label->texture[0].data.text.shadow_color
694 = theme->title_unfocused_shadow_color;
695 theme->a_unfocused_label->texture[0].data.text.shadow_alpha
696 = theme->title_unfocused_shadow_alpha;
698 theme->a_menu_text_title->texture[0].type = RR_TEXTURE_TEXT;
699 theme->a_menu_text_title->texture[0].data.text.justify = mtitlejust;
700 theme->a_menu_text_title->texture[0].data.text.font
701 = theme->menu_title_font;
702 theme->a_menu_text_title->texture[0].data.text.color
703 = theme->menu_title_color;
705 if (read_string(db, "menu.title.text.font", &str)) {
709 if (strstr(str, "shadow=y")) {
710 if ((p = strstr(str, "shadowoffset=")))
711 i = parse_inline_number(p + strlen("shadowoffset="));
714 theme->a_menu_text_title->texture[0].data.text.shadow_offset_x = i;
715 theme->a_menu_text_title->texture[0].data.text.shadow_offset_y = i;
717 if ((p = strstr(str, "shadowtint="))) {
718 i = parse_inline_number(p + strlen("shadowtint="));
719 j = (i > 0 ? 0 : 255);
722 theme->menu_title_shadow_color = RrColorNew(inst, j, j, j);
723 theme->menu_title_shadow_alpha = i;
726 theme->menu_title_shadow_color = RrColorNew(inst, 0, 0, 0);
727 theme->menu_title_shadow_alpha = 50;
731 theme->a_menu_text_title->texture[0].data.text.shadow_color
732 = theme->menu_title_shadow_color;
733 theme->a_menu_text_title->texture[0].data.text.shadow_alpha
734 = theme->menu_title_shadow_alpha;
736 theme->a_menu_text_normal->texture[0].type
737 = theme->a_menu_text_selected->texture[0].type
738 = theme->a_menu_text_disabled->texture[0].type
739 = theme->a_menu_text_disabled_selected->texture[0].type
741 theme->a_menu_text_normal->texture[0].data.text.justify
742 = theme->a_menu_text_selected->texture[0].data.text.justify
743 = theme->a_menu_text_disabled->texture[0].data.text.justify
744 = theme->a_menu_text_disabled_selected->texture[0].data.text.justify
746 theme->a_menu_text_normal->texture[0].data.text.font
747 = theme->a_menu_text_selected->texture[0].data.text.font
748 = theme->a_menu_text_disabled->texture[0].data.text.font
749 = theme->a_menu_text_disabled_selected->texture[0].data.text.font
751 theme->a_menu_text_normal->texture[0].data.text.color = theme->menu_color;
752 theme->a_menu_text_selected->texture[0].data.text.color
753 = theme->menu_selected_color;
754 theme->a_menu_text_disabled->texture[0].data.text.color
755 = theme->menu_disabled_color;
756 theme->a_menu_text_disabled_selected->texture[0].data.text.color
757 = theme->menu_disabled_selected_color;
759 if (read_string(db, "menu.items.font", &str)) {
763 if (strstr(str, "shadow=y")) {
764 if ((p = strstr(str, "shadowoffset=")))
765 i = parse_inline_number(p + strlen("shadowoffset="));
768 theme->a_menu_text_normal->
769 texture[0].data.text.shadow_offset_x = i;
770 theme->a_menu_text_normal->
771 texture[0].data.text.shadow_offset_y = i;
772 theme->a_menu_text_selected->
773 texture[0].data.text.shadow_offset_x = i;
774 theme->a_menu_text_selected->
775 texture[0].data.text.shadow_offset_y = i;
776 theme->a_menu_text_disabled->
777 texture[0].data.text.shadow_offset_x = i;
778 theme->a_menu_text_disabled->
779 texture[0].data.text.shadow_offset_y = i;
780 theme->a_menu_text_disabled_selected->
781 texture[0].data.text.shadow_offset_x = i;
782 theme->a_menu_text_disabled_selected->
783 texture[0].data.text.shadow_offset_y = i;
785 if ((p = strstr(str, "shadowtint="))) {
786 i = parse_inline_number(p + strlen("shadowtint="));
787 j = (i > 0 ? 0 : 255);
790 theme->menu_text_normal_shadow_color = RrColorNew(inst, j, j, j);
791 theme->menu_text_selected_shadow_color = RrColorNew(inst, j, j, j);
792 theme->menu_text_disabled_shadow_color = RrColorNew(inst, j, j, j);
793 theme->menu_text_normal_shadow_alpha = i;
794 theme->menu_text_selected_shadow_alpha = i;
795 theme->menu_text_disabled_shadow_alpha = i;
796 theme->menu_text_disabled_selected_shadow_alpha = i;
799 theme->menu_text_normal_shadow_color = RrColorNew(inst, 0, 0, 0);
800 theme->menu_text_selected_shadow_color = RrColorNew(inst, 0, 0, 0);
801 theme->menu_text_disabled_shadow_color = RrColorNew(inst, 0, 0, 0);
802 theme->menu_text_normal_shadow_alpha = 50;
803 theme->menu_text_selected_shadow_alpha = 50;
804 theme->menu_text_disabled_selected_shadow_alpha = 50;
808 theme->a_menu_text_normal->texture[0].data.text.shadow_color
809 = theme->menu_text_normal_shadow_color;
810 theme->a_menu_text_normal->texture[0].data.text.shadow_alpha
811 = theme->menu_text_normal_shadow_alpha;
812 theme->a_menu_text_selected->texture[0].data.text.shadow_color
813 = theme->menu_text_selected_shadow_color;
814 theme->a_menu_text_selected->texture[0].data.text.shadow_alpha
815 = theme->menu_text_selected_shadow_alpha;
816 theme->a_menu_text_disabled->texture[0].data.text.shadow_color
817 = theme->menu_text_disabled_shadow_color;
818 theme->a_menu_text_disabled->texture[0].data.text.shadow_alpha
819 = theme->menu_text_disabled_shadow_alpha;
820 theme->a_menu_text_disabled_selected->texture[0].data.text.shadow_color
821 = theme->menu_text_disabled_shadow_color;
822 theme->a_menu_text_disabled_selected->texture[0].data.text.shadow_alpha
823 = theme->menu_text_disabled_shadow_alpha;
825 theme->a_disabled_focused_max->texture[0].type
826 = theme->a_disabled_unfocused_max->texture[0].type
827 = theme->a_hover_focused_max->texture[0].type
828 = theme->a_hover_unfocused_max->texture[0].type
829 = theme->a_toggled_hover_focused_max->texture[0].type
830 = theme->a_toggled_hover_unfocused_max->texture[0].type
831 = theme->a_toggled_focused_unpressed_max->texture[0].type
832 = theme->a_toggled_unfocused_unpressed_max->texture[0].type
833 = theme->a_toggled_focused_pressed_max->texture[0].type
834 = theme->a_toggled_unfocused_pressed_max->texture[0].type
835 = theme->a_focused_unpressed_max->texture[0].type
836 = theme->a_focused_pressed_max->texture[0].type
837 = theme->a_unfocused_unpressed_max->texture[0].type
838 = theme->a_unfocused_pressed_max->texture[0].type
839 = theme->a_disabled_focused_close->texture[0].type
840 = theme->a_disabled_unfocused_close->texture[0].type
841 = theme->a_hover_focused_close->texture[0].type
842 = theme->a_hover_unfocused_close->texture[0].type
843 = theme->a_focused_unpressed_close->texture[0].type
844 = theme->a_focused_pressed_close->texture[0].type
845 = theme->a_unfocused_unpressed_close->texture[0].type
846 = theme->a_unfocused_pressed_close->texture[0].type
847 = theme->a_disabled_focused_desk->texture[0].type
848 = theme->a_disabled_unfocused_desk->texture[0].type
849 = theme->a_hover_focused_desk->texture[0].type
850 = theme->a_hover_unfocused_desk->texture[0].type
851 = theme->a_toggled_hover_focused_desk->texture[0].type
852 = theme->a_toggled_hover_unfocused_desk->texture[0].type
853 = theme->a_toggled_focused_unpressed_desk->texture[0].type
854 = theme->a_toggled_unfocused_unpressed_desk->texture[0].type
855 = theme->a_toggled_focused_pressed_desk->texture[0].type
856 = theme->a_toggled_unfocused_pressed_desk->texture[0].type
857 = theme->a_focused_unpressed_desk->texture[0].type
858 = theme->a_focused_pressed_desk->texture[0].type
859 = theme->a_unfocused_unpressed_desk->texture[0].type
860 = theme->a_unfocused_pressed_desk->texture[0].type
861 = theme->a_disabled_focused_shade->texture[0].type
862 = theme->a_disabled_unfocused_shade->texture[0].type
863 = theme->a_hover_focused_shade->texture[0].type
864 = theme->a_hover_unfocused_shade->texture[0].type
865 = theme->a_toggled_hover_focused_shade->texture[0].type
866 = theme->a_toggled_hover_unfocused_shade->texture[0].type
867 = theme->a_toggled_focused_unpressed_shade->texture[0].type
868 = theme->a_toggled_unfocused_unpressed_shade->texture[0].type
869 = theme->a_toggled_focused_pressed_shade->texture[0].type
870 = theme->a_toggled_unfocused_pressed_shade->texture[0].type
871 = theme->a_focused_unpressed_shade->texture[0].type
872 = theme->a_focused_pressed_shade->texture[0].type
873 = theme->a_unfocused_unpressed_shade->texture[0].type
874 = theme->a_unfocused_pressed_shade->texture[0].type
875 = theme->a_disabled_focused_iconify->texture[0].type
876 = theme->a_disabled_unfocused_iconify->texture[0].type
877 = theme->a_hover_focused_iconify->texture[0].type
878 = theme->a_hover_unfocused_iconify->texture[0].type
879 = theme->a_focused_unpressed_iconify->texture[0].type
880 = theme->a_focused_pressed_iconify->texture[0].type
881 = theme->a_unfocused_unpressed_iconify->texture[0].type
882 = theme->a_unfocused_pressed_iconify->texture[0].type
883 = theme->a_menu_bullet_normal->texture[0].type
884 = theme->a_menu_bullet_selected->texture[0].type
887 theme->a_disabled_focused_max->texture[0].data.mask.mask
888 = theme->a_disabled_unfocused_max->texture[0].data.mask.mask
889 = theme->max_disabled_mask;
890 theme->a_hover_focused_max->texture[0].data.mask.mask
891 = theme->a_hover_unfocused_max->texture[0].data.mask.mask
892 = theme->max_hover_mask;
893 theme->a_focused_pressed_max->texture[0].data.mask.mask
894 = theme->a_unfocused_pressed_max->texture[0].data.mask.mask
895 = theme->max_pressed_mask;
896 theme->a_focused_unpressed_max->texture[0].data.mask.mask
897 = theme->a_unfocused_unpressed_max->texture[0].data.mask.mask
899 theme->a_toggled_hover_focused_max->texture[0].data.mask.mask
900 = theme->a_toggled_hover_unfocused_max->texture[0].data.mask.mask
901 = theme->max_toggled_hover_mask;
902 theme->a_toggled_focused_unpressed_max->texture[0].data.mask.mask
903 = theme->a_toggled_unfocused_unpressed_max->texture[0].data.mask.mask
904 = theme->max_toggled_mask;
905 theme->a_toggled_focused_pressed_max->texture[0].data.mask.mask
906 = theme->a_toggled_unfocused_pressed_max->texture[0].data.mask.mask
907 = theme->max_toggled_pressed_mask;
908 theme->a_disabled_focused_close->texture[0].data.mask.mask
909 = theme->a_disabled_unfocused_close->texture[0].data.mask.mask
910 = theme->close_disabled_mask;
911 theme->a_hover_focused_close->texture[0].data.mask.mask
912 = theme->a_hover_unfocused_close->texture[0].data.mask.mask
913 = theme->close_hover_mask;
914 theme->a_focused_pressed_close->texture[0].data.mask.mask
915 = theme->a_unfocused_pressed_close->texture[0].data.mask.mask
916 = theme->close_pressed_mask;
917 theme->a_focused_unpressed_close->texture[0].data.mask.mask
918 = theme->a_unfocused_unpressed_close->texture[0].data.mask.mask
920 theme->a_disabled_focused_desk->texture[0].data.mask.mask
921 = theme->a_disabled_unfocused_desk->texture[0].data.mask.mask
922 = theme->desk_disabled_mask;
923 theme->a_hover_focused_desk->texture[0].data.mask.mask
924 = theme->a_hover_unfocused_desk->texture[0].data.mask.mask
925 = theme->desk_hover_mask;
926 theme->a_focused_pressed_desk->texture[0].data.mask.mask
927 = theme->a_unfocused_pressed_desk->texture[0].data.mask.mask
928 = theme->desk_pressed_mask;
929 theme->a_focused_unpressed_desk->texture[0].data.mask.mask
930 = theme->a_unfocused_unpressed_desk->texture[0].data.mask.mask
932 theme->a_toggled_hover_focused_desk->texture[0].data.mask.mask
933 = theme->a_toggled_hover_unfocused_desk->texture[0].data.mask.mask
934 = theme->desk_toggled_hover_mask;
935 theme->a_toggled_focused_unpressed_desk->texture[0].data.mask.mask
936 = theme->a_toggled_unfocused_unpressed_desk->texture[0].data.mask.mask
937 = theme->desk_toggled_mask;
938 theme->a_toggled_focused_pressed_desk->texture[0].data.mask.mask
939 = theme->a_toggled_unfocused_pressed_desk->texture[0].data.mask.mask
940 = theme->desk_toggled_pressed_mask;
941 theme->a_disabled_focused_shade->texture[0].data.mask.mask
942 = theme->a_disabled_unfocused_shade->texture[0].data.mask.mask
943 = theme->shade_disabled_mask;
944 theme->a_hover_focused_shade->texture[0].data.mask.mask
945 = theme->a_hover_unfocused_shade->texture[0].data.mask.mask
946 = theme->shade_hover_mask;
947 theme->a_focused_pressed_shade->texture[0].data.mask.mask
948 = theme->a_unfocused_pressed_shade->texture[0].data.mask.mask
949 = theme->shade_pressed_mask;
950 theme->a_focused_unpressed_shade->texture[0].data.mask.mask
951 = theme->a_unfocused_unpressed_shade->texture[0].data.mask.mask
953 theme->a_toggled_hover_focused_shade->texture[0].data.mask.mask
954 = theme->a_toggled_hover_unfocused_shade->texture[0].data.mask.mask
955 = theme->shade_toggled_hover_mask;
956 theme->a_toggled_focused_unpressed_shade->texture[0].data.mask.mask
957 = theme->a_toggled_unfocused_unpressed_shade->texture[0].data.mask.mask
958 = theme->shade_toggled_mask;
959 theme->a_toggled_focused_pressed_shade->texture[0].data.mask.mask
960 = theme->a_toggled_unfocused_pressed_shade->texture[0].data.mask.mask
961 = theme->shade_toggled_pressed_mask;
962 theme->a_disabled_focused_iconify->texture[0].data.mask.mask
963 = theme->a_disabled_unfocused_iconify->texture[0].data.mask.mask
964 = theme->iconify_disabled_mask;
965 theme->a_hover_focused_iconify->texture[0].data.mask.mask
966 = theme->a_hover_unfocused_iconify->texture[0].data.mask.mask
967 = theme->iconify_hover_mask;
968 theme->a_focused_pressed_iconify->texture[0].data.mask.mask
969 = theme->a_unfocused_pressed_iconify->texture[0].data.mask.mask
970 = theme->iconify_pressed_mask;
971 theme->a_focused_unpressed_iconify->texture[0].data.mask.mask
972 = theme->a_unfocused_unpressed_iconify->texture[0].data.mask.mask
973 = theme->iconify_mask;
974 theme->a_menu_bullet_normal->texture[0].data.mask.mask
975 = theme->a_menu_bullet_selected->texture[0].data.mask.mask
976 = theme->menu_bullet_mask;
977 theme->a_disabled_focused_max->texture[0].data.mask.color
978 = theme->a_disabled_focused_close->texture[0].data.mask.color
979 = theme->a_disabled_focused_desk->texture[0].data.mask.color
980 = theme->a_disabled_focused_shade->texture[0].data.mask.color
981 = theme->a_disabled_focused_iconify->texture[0].data.mask.color
982 = theme->titlebut_disabled_focused_color;
983 theme->a_disabled_unfocused_max->texture[0].data.mask.color
984 = theme->a_disabled_unfocused_close->texture[0].data.mask.color
985 = theme->a_disabled_unfocused_desk->texture[0].data.mask.color
986 = theme->a_disabled_unfocused_shade->texture[0].data.mask.color
987 = theme->a_disabled_unfocused_iconify->texture[0].data.mask.color
988 = theme->titlebut_disabled_unfocused_color;
989 theme->a_hover_focused_max->texture[0].data.mask.color
990 = theme->a_hover_focused_close->texture[0].data.mask.color
991 = theme->a_hover_focused_desk->texture[0].data.mask.color
992 = theme->a_hover_focused_shade->texture[0].data.mask.color
993 = theme->a_hover_focused_iconify->texture[0].data.mask.color
994 = theme->titlebut_hover_focused_color;
995 theme->a_hover_unfocused_max->texture[0].data.mask.color
996 = theme->a_hover_unfocused_close->texture[0].data.mask.color
997 = theme->a_hover_unfocused_desk->texture[0].data.mask.color
998 = theme->a_hover_unfocused_shade->texture[0].data.mask.color
999 = theme->a_hover_unfocused_iconify->texture[0].data.mask.color
1000 = theme->titlebut_hover_unfocused_color;
1001 theme->a_toggled_hover_focused_max->texture[0].data.mask.color
1002 = theme->a_toggled_hover_focused_desk->texture[0].data.mask.color
1003 = theme->a_toggled_hover_focused_shade->texture[0].data.mask.color
1004 = theme->titlebut_toggled_hover_focused_color;
1005 theme->a_toggled_hover_unfocused_max->texture[0].data.mask.color
1006 = theme->a_toggled_hover_unfocused_desk->texture[0].data.mask.color
1007 = theme->a_toggled_hover_unfocused_shade->texture[0].data.mask.color
1008 = theme->titlebut_toggled_hover_unfocused_color;
1009 theme->a_toggled_focused_unpressed_max->texture[0].data.mask.color
1010 = theme->a_toggled_focused_unpressed_desk->texture[0].data.mask.color
1011 = theme->a_toggled_focused_unpressed_shade->texture[0].data.mask.color
1012 = theme->titlebut_toggled_focused_unpressed_color;
1013 theme->a_toggled_unfocused_unpressed_max->texture[0].data.mask.color
1014 = theme->a_toggled_unfocused_unpressed_desk->texture[0].data.mask.color
1015 = theme->a_toggled_unfocused_unpressed_shade->texture[0].data.mask.color
1016 = theme->titlebut_toggled_unfocused_unpressed_color;
1017 theme->a_toggled_focused_pressed_max->texture[0].data.mask.color
1018 = theme->a_toggled_focused_pressed_desk->texture[0].data.mask.color
1019 = theme->a_toggled_focused_pressed_shade->texture[0].data.mask.color
1020 = theme->titlebut_toggled_focused_pressed_color;
1021 theme->a_toggled_unfocused_pressed_max->texture[0].data.mask.color
1022 = theme->a_toggled_unfocused_pressed_desk->texture[0].data.mask.color
1023 = theme->a_toggled_unfocused_pressed_shade->texture[0].data.mask.color
1024 = theme->titlebut_toggled_unfocused_pressed_color;
1025 theme->a_focused_unpressed_max->texture[0].data.mask.color
1026 = theme->a_focused_unpressed_close->texture[0].data.mask.color
1027 = theme->a_focused_unpressed_desk->texture[0].data.mask.color
1028 = theme->a_focused_unpressed_shade->texture[0].data.mask.color
1029 = theme->a_focused_unpressed_iconify->texture[0].data.mask.color
1030 = theme->titlebut_focused_unpressed_color;
1031 theme->a_focused_pressed_max->texture[0].data.mask.color
1032 = theme->a_focused_pressed_close->texture[0].data.mask.color
1033 = theme->a_focused_pressed_desk->texture[0].data.mask.color
1034 = theme->a_focused_pressed_shade->texture[0].data.mask.color
1035 = theme->a_focused_pressed_iconify->texture[0].data.mask.color
1036 = theme->titlebut_focused_pressed_color;
1037 theme->a_unfocused_unpressed_max->texture[0].data.mask.color
1038 = theme->a_unfocused_unpressed_close->texture[0].data.mask.color
1039 = theme->a_unfocused_unpressed_desk->texture[0].data.mask.color
1040 = theme->a_unfocused_unpressed_shade->texture[0].data.mask.color
1041 = theme->a_unfocused_unpressed_iconify->texture[0].data.mask.color
1042 = theme->titlebut_unfocused_unpressed_color;
1043 theme->a_unfocused_pressed_max->texture[0].data.mask.color
1044 = theme->a_unfocused_pressed_close->texture[0].data.mask.color
1045 = theme->a_unfocused_pressed_desk->texture[0].data.mask.color
1046 = theme->a_unfocused_pressed_shade->texture[0].data.mask.color
1047 = theme->a_unfocused_pressed_iconify->texture[0].data.mask.color
1048 = theme->titlebut_unfocused_pressed_color;
1049 theme->a_menu_bullet_normal->texture[0].data.mask.color = theme->menu_color;
1050 theme->a_menu_bullet_selected->texture[0].data.mask.color
1051 = theme->menu_selected_color;
1053 /* set the font heights */
1054 theme->win_font_height = RrFontHeight(theme->win_font_focused,
1055 theme->a_focused_label->texture[0].data.text.shadow_offset_y);
1056 theme->win_font_height = MAX(theme->win_font_height, RrFontHeight(
1057 theme->win_font_focused,
1058 theme->a_unfocused_label->texture[0].data.text.shadow_offset_y));
1059 theme->menu_title_font_height = RrFontHeight(theme->menu_title_font,
1060 theme->a_menu_text_title->texture[0].data.text.shadow_offset_y);
1061 theme->menu_font_height = RrFontHeight(theme->menu_font,
1062 theme->a_menu_text_normal->texture[0].data.text.shadow_offset_y);
1064 /* calculate some last extents */
1066 gint ft, fb, fl, fr, ut, ub, ul, ur;
1068 RrMargins(theme->a_focused_label, &fl, &ft, &fr, &fb);
1069 RrMargins(theme->a_unfocused_label, &ul, &ut, &ur, &ub);
1070 theme->label_height = theme->win_font_height + MAX(ft + fb, ut + ub);
1071 theme->label_height += theme->label_height % 2;
1073 /* this would be nice I think, since padding.width can now be 0,
1074 but it breaks frame.c horribly and I don't feel like fixing that
1075 right now, so if anyone complains, here is how to keep text from
1076 going over the title's bevel/border with a padding.width of 0 and a
1077 bevelless/borderless label
1078 RrMargins(theme->a_focused_title, &fl, &ft, &fr, &fb);
1079 RrMargins(theme->a_unfocused_title, &ul, &ut, &ur, &ub);
1080 theme->title_height = theme->label_height +
1081 MAX(MAX(theme->padding * 2, ft + fb),
1082 MAX(theme->padding * 2, ut + ub));
1084 theme->title_height = theme->label_height + theme->paddingy * 2;
1086 RrMargins(theme->a_menu_title, &ul, &ut, &ur, &ub);
1087 theme->menu_title_label_height = theme->menu_title_font_height+ut+ub;
1088 theme->menu_title_height = theme->menu_title_label_height
1089 + theme->paddingy * 2;
1091 theme->button_size = theme->label_height - 2;
1092 theme->grip_width = 25;
1097 static XrmDatabase loaddb(const gchar *name, gchar **path)
1100 XrmDatabase db = NULL;
1103 if (name[0] == '/') {
1104 s = g_build_filename(name, "openbox-3", "themerc", NULL);
1105 if ((db = XrmGetFileDatabase(s)))
1106 *path = g_path_get_dirname(s);
1110 /* XXX backwards compatibility, remove me sometime later */
1111 s = g_build_filename(g_get_home_dir(), ".themes", name, "openbox-3",
1113 if ((db = XrmGetFileDatabase(s)))
1114 *path = g_path_get_dirname(s);
1117 for (it = parse_xdg_data_dir_paths(); !db && it; it = g_slist_next(it)) {
1118 s = g_build_filename(it->data, "themes", name, "openbox-3",
1120 if ((db = XrmGetFileDatabase(s)))
1121 *path = g_path_get_dirname(s);
1127 s = g_build_filename(name, "themerc", NULL);
1128 if ((db = XrmGetFileDatabase(s)))
1129 *path = g_path_get_dirname(s);
1136 static gchar *create_class_name(const gchar *rname)
1138 gchar *rclass = g_strdup(rname);
1143 p = strchr(p+1, '.');
1153 static gboolean read_int(XrmDatabase db, const gchar *rname, gint *value)
1155 gboolean ret = FALSE;
1156 gchar *rclass = create_class_name(rname);
1157 gchar *rettype, *end;
1160 if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && retvalue.addr
1162 *value = (gint)strtol(retvalue.addr, &end, 10);
1163 if (end != retvalue.addr)
1171 static gboolean read_string(XrmDatabase db, const gchar *rname, gchar **value)
1173 gboolean ret = FALSE;
1174 gchar *rclass = create_class_name(rname);
1178 if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && retvalue.addr
1180 *value = retvalue.addr;
1188 static gboolean read_color(XrmDatabase db, const RrInstance *inst,
1189 const gchar *rname, RrColor **value)
1191 gboolean ret = FALSE;
1192 gchar *rclass = create_class_name(rname);
1196 if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && retvalue.addr
1198 RrColor *c = RrColorParse(inst, retvalue.addr);
1209 static gboolean read_mask(const RrInstance *inst, const gchar *path,
1210 ObFrameThemeConfig *theme, const gchar *maskname, RrPixmapMask **value)
1212 gboolean ret = FALSE;
1214 gint hx, hy; /* ignored */
1218 s = g_build_filename(path, maskname, NULL);
1219 if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) == BitmapSuccess) {
1221 *value = RrPixmapMaskNew(inst, w, h, (gchar*)b);
1229 static void parse_appearance(gchar *tex, RrSurfaceColorType *grad,
1230 RrReliefType *relief, RrBevelType *bevel, gboolean *interlaced,
1231 gboolean *border, gboolean allow_trans)
1235 /* convert to all lowercase */
1236 for (t = tex; *t != '\0'; ++t)
1237 *t = g_ascii_tolower(*t);
1239 if (allow_trans && strstr(tex, "parentrelative") != NULL) {
1240 *grad = RR_SURFACE_PARENTREL;
1243 if (strstr(tex, "gradient") != NULL) {
1244 if (strstr(tex, "crossdiagonal") != NULL)
1245 *grad = RR_SURFACE_CROSS_DIAGONAL;
1246 else if (strstr(tex, "pyramid") != NULL)
1247 *grad = RR_SURFACE_PYRAMID;
1248 else if (strstr(tex, "mirrorhorizontal") != NULL)
1249 *grad = RR_SURFACE_MIRROR_HORIZONTAL;
1250 else if (strstr(tex, "horizontal") != NULL)
1251 *grad = RR_SURFACE_HORIZONTAL;
1252 else if (strstr(tex, "splitvertical") != NULL)
1253 *grad = RR_SURFACE_SPLIT_VERTICAL;
1254 else if (strstr(tex, "vertical") != NULL)
1255 *grad = RR_SURFACE_VERTICAL;
1257 *grad = RR_SURFACE_DIAGONAL;
1260 *grad = RR_SURFACE_SOLID;
1264 if (strstr(tex, "sunken") != NULL)
1265 *relief = RR_RELIEF_SUNKEN;
1266 else if (strstr(tex, "flat") != NULL)
1267 *relief = RR_RELIEF_FLAT;
1268 else if (strstr(tex, "raised") != NULL)
1269 *relief = RR_RELIEF_RAISED;
1271 *relief = (*grad == RR_SURFACE_PARENTREL) ? RR_RELIEF_FLAT
1275 if (*relief == RR_RELIEF_FLAT) {
1276 if (strstr(tex, "border") != NULL)
1280 if (strstr(tex, "bevel2") != NULL)
1281 *bevel = RR_BEVEL_2;
1283 *bevel = RR_BEVEL_1;
1286 if (strstr(tex, "interlaced") != NULL)
1289 *interlaced = FALSE;
1292 static gboolean read_appearance(XrmDatabase db, const RrInstance *inst,
1293 const gchar *rname, RrAppearance *value, gboolean allow_trans)
1295 gboolean ret = FALSE;
1296 gchar *rclass = create_class_name(rname);
1297 gchar *cname, *ctoname, *bcname, *icname, *hname, *sname;
1298 gchar *csplitname, *ctosplitname;
1303 cname = g_strconcat(rname, ".color", NULL);
1304 ctoname = g_strconcat(rname, ".colorTo", NULL);
1305 bcname = g_strconcat(rname, ".border.color", NULL);
1306 icname = g_strconcat(rname, ".interlace.color", NULL);
1307 hname = g_strconcat(rname, ".highlight", NULL);
1308 sname = g_strconcat(rname, ".shadow", NULL);
1309 csplitname = g_strconcat(rname, ".color.splitTo", NULL);
1310 ctosplitname = g_strconcat(rname, ".colorTo.splitTo", NULL);
1312 if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && retvalue.addr
1314 parse_appearance(retvalue.addr, &value->surface.grad,
1315 &value->surface.relief, &value->surface.bevel,
1316 &value->surface.interlaced, &value->surface.border, allow_trans);
1317 if (!read_color(db, inst, cname, &value->surface.primary))
1318 value->surface.primary = RrColorNew(inst, 0, 0, 0);
1319 if (!read_color(db, inst, ctoname, &value->surface.secondary))
1320 value->surface.secondary = RrColorNew(inst, 0, 0, 0);
1321 if (value->surface.border)
1322 if (!read_color(db, inst, bcname, &value->surface.border_color))
1323 value->surface.border_color = RrColorNew(inst, 0, 0, 0);
1324 if (value->surface.interlaced)
1325 if (!read_color(db, inst, icname, &value->surface.interlace_color))
1326 value->surface.interlace_color = RrColorNew(inst, 0, 0, 0);
1327 if (read_int(db, hname, &i) && i >= 0)
1328 value->surface.bevel_light_adjust = i;
1329 if (read_int(db, sname, &i) && i >= 0 && i <= 256)
1330 value->surface.bevel_dark_adjust = i;
1332 if (value->surface.grad == RR_SURFACE_SPLIT_VERTICAL) {
1335 if (!read_color(db, inst, csplitname, &value->surface.split_primary)) {
1336 r = value->surface.primary->r;
1338 g = value->surface.primary->g;
1340 b = value->surface.primary->b;
1348 value->surface.split_primary = RrColorNew(inst, r, g, b);
1351 if (!read_color(db, inst, ctosplitname,
1352 &value->surface.split_secondary)) {
1353 r = value->surface.secondary->r;
1355 g = value->surface.secondary->g;
1357 b = value->surface.secondary->b;
1365 value->surface.split_secondary = RrColorNew(inst, r, g, b);
1372 g_free(ctosplitname);
1384 static int parse_inline_number(const char *p)
1392 for (; isdigit(*p); ++p)
1393 res = res * 10 + *p - '0';
1398 static void set_default_appearance(RrAppearance *a)
1400 a->surface.grad = RR_SURFACE_SOLID;
1401 a->surface.relief = RR_RELIEF_FLAT;
1402 a->surface.bevel = RR_BEVEL_1;
1403 a->surface.interlaced = FALSE;
1404 a->surface.border = FALSE;
1405 a->surface.primary = RrColorNew(a->inst, 0, 0, 0);
1406 a->surface.secondary = RrColorNew(a->inst, 0, 0, 0);
1409 /* Reads the output from gimp's C-Source file format into valid RGBA data for
1410 an RrTextureRGBA. */
1411 static RrPixel32* read_c_image(gint width, gint height, const guint8 *data)
1416 p = im = g_memdup(data, width * height * sizeof(RrPixel32));
1418 for (i = 0; i < width * height; ++i) {
1419 guchar a = ((*p >> 24) & 0xff);
1420 guchar b = ((*p >> 16) & 0xff);
1421 guchar g = ((*p >> 8) & 0xff);
1422 guchar r = ((*p >> 0) & 0xff);
1424 *p = ((r << RrDefaultRedOffset) + (g << RrDefaultGreenOffset) + (b
1425 << RrDefaultBlueOffset) + (a << RrDefaultAlphaOffset));