]> icculus.org git repositories - mikachu/openbox.git/blob - engines/openbox/obtheme.c
new build system without automake
[mikachu/openbox.git] / engines / openbox / obtheme.c
1 #include "obengine.h"
2 #include "../../kernel/config.h"
3 #include "../../kernel/openbox.h"
4
5 #include <glib.h>
6 #include <X11/Xlib.h>
7 #include <X11/Xresource.h>
8 #ifdef HAVE_STDLIB_H
9 #  include <stdlib.h>
10 #endif
11 #ifdef HAVE_CTYPE_H
12 #  include <ctype.h>
13 #endif
14 #ifdef HAVE_STRING_H
15 #  include <string.h>
16 #endif
17
18 static XrmDatabase loaddb(char *theme)
19 {
20     XrmDatabase db;
21
22     db = XrmGetFileDatabase(theme);
23     if (db == NULL) {
24         char *s = g_build_filename(g_get_home_dir(), ".openbox", "themes",
25                                    "openbox", theme, NULL);
26         db = XrmGetFileDatabase(s);
27         g_free(s);
28     }
29     if (db == NULL) {
30         char *s = g_build_filename(THEMEDIR, theme, NULL);
31         db = XrmGetFileDatabase(s);
32         g_free(s);
33     }
34     return db;
35 }
36
37 static char *create_class_name(char *rname)
38 {
39     char *rclass = g_strdup(rname);
40     char *p = rclass;
41
42     while (TRUE) {
43         *p = toupper(*p);
44         p = strchr(p+1, '.');
45         if (p == NULL) break;
46         ++p;
47         if (*p == '\0') break;
48     }
49     return rclass;
50 }
51
52 static gboolean read_int(XrmDatabase db, char *rname, int *value)
53 {
54     gboolean ret = FALSE;
55     char *rclass = create_class_name(rname);
56     char *rettype, *end;
57     XrmValue retvalue;
58   
59     if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
60         retvalue.addr != NULL) {
61         *value = (int)strtol(retvalue.addr, &end, 10);
62         if (end != retvalue.addr)
63             ret = TRUE;
64     }
65
66     g_free(rclass);
67     return ret;
68 }
69
70 static gboolean read_string(XrmDatabase db, char *rname, char **value)
71 {
72     gboolean ret = FALSE;
73     char *rclass = create_class_name(rname);
74     char *rettype;
75     XrmValue retvalue;
76   
77     if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
78         retvalue.addr != NULL) {
79         *value = g_strdup(retvalue.addr);
80         ret = TRUE;
81     }
82
83     g_free(rclass);
84     return ret;
85 }
86
87 static gboolean read_color(XrmDatabase db, char *rname, color_rgb **value)
88 {
89     gboolean ret = FALSE;
90     char *rclass = create_class_name(rname);
91     char *rettype;
92     XrmValue retvalue;
93   
94     if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
95         retvalue.addr != NULL) {
96         color_rgb *c = color_parse(retvalue.addr);
97         if (c != NULL) {
98             *value = c;
99             ret = TRUE;
100         }
101     }
102
103     g_free(rclass);
104     return ret;
105 }
106
107 static gboolean read_mask(XrmDatabase db, char *rname, pixmap_mask **value)
108 {
109     gboolean ret = FALSE;
110     char *rclass = create_class_name(rname);
111     char *rettype;
112     char *s;
113     char *button_dir;
114     XrmValue retvalue;
115     int hx, hy; /* ignored */
116     unsigned int w, h;
117     unsigned char *b;
118     ConfigValue theme;
119   
120     if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
121         retvalue.addr != NULL) {
122         if (!config_get("theme", Config_String, &theme))
123             g_assert_not_reached(); /* where's the default!? its not set? */
124
125         button_dir = g_strdup_printf("%s_buttons", theme.string);
126
127         s = g_build_filename(g_get_home_dir(), ".openbox", "themes",
128                              "openbox", button_dir, retvalue.addr, NULL);
129
130         if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) == BitmapSuccess)
131             ret = TRUE;
132         else {
133             g_free(s);
134             s = g_build_filename(THEMEDIR, button_dir, retvalue.addr, NULL);
135         
136             if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) == BitmapSuccess) 
137                 ret = TRUE;
138             else {
139                 char *themename;
140
141                 g_free(s);
142                 themename = g_path_get_basename(theme.string);
143                 s = g_strdup_printf("%s_buttons/%s", theme.string,
144                                     themename);
145                 g_free(themename);
146                 if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) ==
147                     BitmapSuccess) 
148                     ret = TRUE;
149                 else
150                     g_message("Unable to find bitmap '%s'", s);
151             }
152         }
153
154         if (ret) {
155             *value = pixmap_mask_new(w, h, (char*)b);
156             XFree(b);
157         }
158       
159         g_free(s);
160         g_free(button_dir);
161     }
162
163     g_free(rclass);
164     return ret;
165 }
166
167 static void parse_appearance(char *tex, SurfaceColorType *grad,
168                              ReliefType *relief, BevelType *bevel,
169                              gboolean *interlaced, gboolean *border)
170 {
171     char *t;
172
173     /* convert to all lowercase */
174     for (t = tex; *t != '\0'; ++t)
175         *t = g_ascii_tolower(*t);
176
177     if (strstr(tex, "parentrelative") != NULL) {
178         *grad = Background_ParentRelative;
179     } else {
180         if (strstr(tex, "gradient") != NULL) {
181             if (strstr(tex, "crossdiagonal") != NULL)
182                 *grad = Background_CrossDiagonal;
183             else if (strstr(tex, "rectangle") != NULL)
184                 *grad = Background_Rectangle;
185             else if (strstr(tex, "pyramid") != NULL)
186                 *grad = Background_Pyramid;
187             else if (strstr(tex, "pipecross") != NULL)
188                 *grad = Background_PipeCross;
189             else if (strstr(tex, "elliptic") != NULL)
190                 *grad = Background_Elliptic;
191             else if (strstr(tex, "horizontal") != NULL)
192                 *grad = Background_Horizontal;
193             else if (strstr(tex, "vertical") != NULL)
194                 *grad = Background_Vertical;
195             else
196                 *grad = Background_Diagonal;
197         } else {
198             *grad = Background_Solid;
199         }
200
201         if (strstr(tex, "sunken") != NULL)
202             *relief = Sunken;
203         else if (strstr(tex, "flat") != NULL)
204             *relief = Flat;
205         else
206             *relief = Raised;
207         
208         *border = FALSE;
209         if (*relief == Flat) {
210             if (strstr(tex, "border") != NULL)
211                 *border = TRUE;
212         } else {
213             if (strstr(tex, "bevel2") != NULL)
214                 *bevel = Bevel2;
215             else
216                 *bevel = Bevel1;
217         }
218
219         if (strstr(tex, "interlaced") != NULL)
220             *interlaced = TRUE;
221         else
222             *interlaced = FALSE;
223     }
224 }
225
226
227 static gboolean read_appearance(XrmDatabase db, char *rname, Appearance *value)
228 {
229     gboolean ret = FALSE;
230     char *rclass = create_class_name(rname), *cname, *ctoname, *bcname;
231     char *rettype;
232     XrmValue retvalue;
233
234     cname = g_strconcat(rname, ".color", NULL);
235     ctoname = g_strconcat(rname, ".colorTo", NULL);
236     bcname = g_strconcat(rname, ".borderColor", NULL);
237
238     if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
239         retvalue.addr != NULL) {
240         parse_appearance(retvalue.addr,
241                          &value->surface.data.planar.grad,
242                          &value->surface.data.planar.relief,
243                          &value->surface.data.planar.bevel,
244                          &value->surface.data.planar.interlaced,
245                          &value->surface.data.planar.border);
246         if (!read_color(db, cname, &value->surface.data.planar.primary))
247             value->surface.data.planar.primary = color_new(0, 0, 0);
248         if (!read_color(db, ctoname, &value->surface.data.planar.secondary))
249             value->surface.data.planar.secondary = color_new(0, 0, 0);
250         if (value->surface.data.planar.border)
251             if (!read_color(db, bcname,
252                             &value->surface.data.planar.border_color))
253                 value->surface.data.planar.border_color = color_new(0, 0, 0);
254         ret = TRUE;
255     }
256
257     g_free(bcname);
258     g_free(ctoname);
259     g_free(cname);
260     g_free(rclass);
261     return ret;
262 }
263
264 static void set_default_appearance(Appearance *a)
265 {
266     a->surface.data.planar.grad = Background_Solid;
267     a->surface.data.planar.relief = Flat;
268     a->surface.data.planar.bevel = Bevel1;
269     a->surface.data.planar.interlaced = FALSE;
270     a->surface.data.planar.border = FALSE;
271     a->surface.data.planar.primary = color_new(0, 0, 0);
272     a->surface.data.planar.secondary = color_new(0, 0, 0);
273 }
274
275 gboolean obtheme_load()
276 {
277     XrmDatabase db = NULL;
278     Justify winjust;
279     char *winjuststr;
280     ConfigValue theme, shadow, offset, font, tint;
281
282     if (config_get("theme", Config_String, &theme)) {
283         db = loaddb(theme.string);
284         if (db == NULL) {
285             g_warning("Failed to load the theme '%s'", theme.string);
286             g_message("Falling back to the default: '%s'", DEFAULT_THEME);
287         }
288     }
289     if (db == NULL) {
290         db = loaddb(DEFAULT_THEME);
291         if (db == NULL) {
292             g_warning("Failed to load the theme '%s'.", DEFAULT_THEME);
293             return FALSE;
294         }
295         /* change to reflect what was actually loaded */
296         theme.string = DEFAULT_THEME;
297         config_set("theme", Config_String, theme);
298     }
299
300     /* load the font, not from the theme file tho, its in the config */
301
302     if (!config_get("font.shadow", Config_Bool, &shadow))
303         g_assert_not_reached();
304     ob_s_winfont_shadow = shadow.bool;
305     if (!config_get("font.shadow.offset", Config_Integer, &offset))
306         g_assert_not_reached();
307     ob_s_winfont_shadow_offset = offset.integer;
308     if (!config_get("font.shadow.tint", Config_Integer, &tint))
309         g_assert_not_reached();
310     /* XXX put these checks into the config system somehow!!! */
311     if (tint.integer < -100) tint.integer = -100;
312     if (tint.integer > 100) tint.integer = 100;
313     config_set("font.shadow.tint", Config_Integer, tint);
314     ob_s_winfont_shadow_tint = tint.integer;
315     if (!config_get("font", Config_String, &font))
316         g_assert_not_reached();
317     ob_s_winfont = font_open(font.string);
318     ob_s_winfont_height = font_height(ob_s_winfont, ob_s_winfont_shadow,
319                                       ob_s_winfont_shadow_offset);
320
321     winjust = Justify_Left;
322     if (read_string(db, "window.justify", &winjuststr)) {
323         if (!g_ascii_strcasecmp(winjuststr, "right"))
324             winjust = Justify_Right;
325         else if (!g_ascii_strcasecmp(winjuststr, "center"))
326             winjust = Justify_Center;
327         g_free(winjuststr);
328     }
329
330     if (!read_int(db, "handleWidth", &ob_s_handle_height) ||
331         ob_s_handle_height < 0 || ob_s_handle_height > 100)
332         ob_s_handle_height = 6;
333     if (!read_int(db, "bevelWidth", &ob_s_bevel) ||
334         ob_s_bevel <= 0 || ob_s_bevel > 100) ob_s_bevel = 3;
335     if (!read_int(db, "borderWidth", &ob_s_bwidth) ||
336         ob_s_bwidth < 0 || ob_s_bwidth > 100) ob_s_bwidth = 1;
337     if (!read_int(db, "frameWidth", &ob_s_cbwidth) ||
338         ob_s_cbwidth < 0 || ob_s_cbwidth > 100) ob_s_cbwidth = ob_s_bevel;
339
340     if (!read_color(db, "borderColor", &ob_s_b_color))
341         ob_s_b_color = color_new(0, 0, 0);
342     if (!read_color(db, "window.frame.focusColor", &ob_s_cb_focused_color))
343         ob_s_cb_focused_color = color_new(0xff, 0xff, 0xff);
344     if (!read_color(db, "window.frame.unfocusColor", &ob_s_cb_unfocused_color))
345         ob_s_cb_unfocused_color = color_new(0xff, 0xff, 0xff);
346     if (!read_color(db, "window.label.focus.textColor",
347                     &ob_s_title_focused_color))
348         ob_s_title_focused_color = color_new(0x0, 0x0, 0x0);
349     if (!read_color(db, "window.label.unfocus.textColor",
350                     &ob_s_title_unfocused_color))
351         ob_s_title_unfocused_color = color_new(0xff, 0xff, 0xff);
352     if (!read_color(db, "window.button.focus.picColor",
353                     &ob_s_titlebut_focused_color))
354         ob_s_titlebut_focused_color = color_new(0, 0, 0);
355     if (!read_color(db, "window.button.unfocus.picColor",
356                     &ob_s_titlebut_unfocused_color))
357         ob_s_titlebut_unfocused_color = color_new(0xff, 0xff, 0xff);
358
359     if (read_mask(db, "window.button.max.mask", &ob_s_max_unset_mask)) {
360         if (!read_mask(db, "window.button.max.toggled.mask",
361                        &ob_s_max_set_mask)) {
362             ob_s_max_set_mask = pixmap_mask_copy(ob_s_max_unset_mask);
363         }
364     } else {
365         {
366             char data[] = { 0x7f, 0x7f, 0x7f, 0x41, 0x41, 0x41, 0x7f };
367             ob_s_max_unset_mask = pixmap_mask_new(7, 7, data);
368         }
369         {
370             char data[] = { 0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f };
371             ob_s_max_set_mask = pixmap_mask_new(7, 7, data);
372         }
373     }
374
375     if (!read_mask(db, "window.button.icon.mask",
376                    &ob_s_iconify_mask)) {
377         char data[] = { 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f };
378         ob_s_iconify_mask = pixmap_mask_new(7, 7, data);
379     }
380
381     if (read_mask(db, "window.button.stick.mask",
382                    &ob_s_desk_unset_mask)) {
383         if (!read_mask(db, "window.button.stick.toggled.mask",
384                        &ob_s_desk_set_mask)) {
385             ob_s_desk_set_mask =
386                 pixmap_mask_copy(ob_s_desk_unset_mask);
387         }
388     } else {
389         {
390             char data[] = { 0x63, 0x63, 0x00, 0x00, 0x00, 0x63, 0x63 };
391             ob_s_desk_unset_mask = pixmap_mask_new(7, 7, data);
392         }
393         {
394             char data[] = { 0x00, 0x36, 0x36, 0x08, 0x36, 0x36, 0x00 };
395             ob_s_desk_set_mask = pixmap_mask_new(7, 7, data);
396         }
397     }
398
399     if (read_mask(db, "window.button.shade.mask",
400                    &ob_s_shade_unset_mask)) {
401         if (!read_mask(db, "window.button.shade.toggled.mask",
402                        &ob_s_shade_set_mask)) {
403             ob_s_shade_set_mask =
404                 pixmap_mask_copy(ob_s_shade_unset_mask);
405         }
406     } else {
407         {
408             char data[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00 };
409             ob_s_shade_unset_mask = pixmap_mask_new(7, 7, data);
410         }
411         {
412             char data[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x7f };
413             ob_s_shade_set_mask = pixmap_mask_new(7, 7, data);
414         }
415     }
416
417     if (!read_mask(db, "window.button.close.mask",
418                    &ob_s_close_mask)) {
419         char data[] = { 0x63, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x63 };
420         ob_s_close_mask = pixmap_mask_new(7, 7, data);
421     }        
422
423     if (!read_appearance(db, "window.title.focus", ob_a_focused_title))
424         set_default_appearance(ob_a_focused_title);
425     if (!read_appearance(db, "window.title.unfocus", ob_a_unfocused_title))
426         set_default_appearance(ob_a_unfocused_title);
427     if (!read_appearance(db, "window.label.focus", ob_a_focused_label))
428         set_default_appearance(ob_a_focused_label);
429     if (!read_appearance(db, "window.label.unfocus", ob_a_unfocused_label))
430         set_default_appearance(ob_a_unfocused_label);
431     if (!read_appearance(db, "window.handle.focus", ob_a_focused_handle))
432         set_default_appearance(ob_a_focused_handle);
433     if (!read_appearance(db, "window.handle.unfocus", ob_a_unfocused_handle))
434         set_default_appearance(ob_a_unfocused_handle);
435     if (!read_appearance(db, "window.grip.focus", ob_a_focused_grip))
436         set_default_appearance(ob_a_focused_grip);
437     if (!read_appearance(db, "window.grip.unfocus", ob_a_unfocused_grip))
438         set_default_appearance(ob_a_unfocused_grip);
439
440     if (!read_appearance(db, "window.button.pressed.focus",
441                          ob_a_focused_pressed_max))
442         if (!read_appearance(db, "window.button.pressed",
443                              ob_a_focused_pressed_max))
444             set_default_appearance(ob_a_focused_pressed_max);
445     if (!read_appearance(db, "window.button.pressed.unfocus",
446                          ob_a_unfocused_pressed_max))
447         if (!read_appearance(db, "window.button.pressed",
448                              ob_a_unfocused_pressed_max))
449             set_default_appearance(ob_a_unfocused_pressed_max);
450     if (!read_appearance(db, "window.button.focus",
451                          ob_a_focused_unpressed_max))
452         set_default_appearance(ob_a_focused_unpressed_max);
453     if (!read_appearance(db, "window.button.unfocus",
454                          ob_a_unfocused_unpressed_max))
455         set_default_appearance(ob_a_unfocused_unpressed_max);
456
457     ob_a_unfocused_unpressed_close =
458         appearance_copy(ob_a_unfocused_unpressed_max);
459     ob_a_unfocused_pressed_close = appearance_copy(ob_a_unfocused_pressed_max);
460     ob_a_focused_unpressed_close = appearance_copy(ob_a_focused_unpressed_max);
461     ob_a_focused_pressed_close = appearance_copy(ob_a_focused_pressed_max);
462     ob_a_unfocused_unpressed_desk =
463         appearance_copy(ob_a_unfocused_unpressed_max);
464     ob_a_unfocused_pressed_desk = appearance_copy(ob_a_unfocused_pressed_max);
465     ob_a_unfocused_pressed_set_desk =
466         appearance_copy(ob_a_unfocused_pressed_max);
467     ob_a_focused_unpressed_desk = appearance_copy(ob_a_focused_unpressed_max);
468     ob_a_focused_pressed_desk = appearance_copy(ob_a_focused_pressed_max);
469     ob_a_focused_pressed_set_desk = appearance_copy(ob_a_focused_pressed_max);
470     ob_a_unfocused_unpressed_shade =
471         appearance_copy(ob_a_unfocused_unpressed_max);
472     ob_a_unfocused_pressed_shade = appearance_copy(ob_a_unfocused_pressed_max);
473     ob_a_unfocused_pressed_set_shade =
474         appearance_copy(ob_a_unfocused_pressed_max);
475     ob_a_focused_unpressed_shade = appearance_copy(ob_a_focused_unpressed_max);
476     ob_a_focused_pressed_shade = appearance_copy(ob_a_focused_pressed_max);
477     ob_a_focused_pressed_set_shade = appearance_copy(ob_a_focused_pressed_max);
478     ob_a_unfocused_unpressed_iconify =
479         appearance_copy(ob_a_unfocused_unpressed_max);
480     ob_a_unfocused_pressed_iconify =
481         appearance_copy(ob_a_unfocused_pressed_max);
482     ob_a_focused_unpressed_iconify =
483         appearance_copy(ob_a_focused_unpressed_max);
484     ob_a_focused_pressed_iconify = appearance_copy(ob_a_focused_pressed_max);
485     ob_a_unfocused_pressed_set_max =
486         appearance_copy(ob_a_unfocused_pressed_max);
487     ob_a_focused_pressed_set_max = appearance_copy(ob_a_focused_pressed_max);
488
489     ob_a_icon->surface.data.planar.grad = Background_ParentRelative;
490
491     /* set up the textures */
492     ob_a_focused_label->texture[0].type = Text;
493     ob_a_focused_label->texture[0].data.text.justify = winjust;
494     ob_a_focused_label->texture[0].data.text.font = ob_s_winfont;
495     ob_a_focused_label->texture[0].data.text.shadow = ob_s_winfont_shadow;
496     ob_a_focused_label->texture[0].data.text.offset =
497         ob_s_winfont_shadow_offset;
498     ob_a_focused_label->texture[0].data.text.tint = ob_s_winfont_shadow_tint;
499     ob_a_focused_label->texture[0].data.text.color = ob_s_title_focused_color;
500
501     ob_a_unfocused_label->texture[0].type = Text;
502     ob_a_unfocused_label->texture[0].data.text.justify = winjust;
503     ob_a_unfocused_label->texture[0].data.text.font = ob_s_winfont;
504     ob_a_unfocused_label->texture[0].data.text.shadow = ob_s_winfont_shadow;
505     ob_a_unfocused_label->texture[0].data.text.offset =
506         ob_s_winfont_shadow_offset;
507     ob_a_unfocused_label->texture[0].data.text.tint = ob_s_winfont_shadow_tint;
508     ob_a_unfocused_label->texture[0].data.text.color =
509         ob_s_title_unfocused_color;
510
511     ob_a_focused_unpressed_max->texture[0].type = 
512         ob_a_focused_pressed_max->texture[0].type = 
513         ob_a_focused_pressed_set_max->texture[0].type =  
514         ob_a_unfocused_unpressed_max->texture[0].type = 
515         ob_a_unfocused_pressed_max->texture[0].type = 
516         ob_a_unfocused_pressed_set_max->texture[0].type = 
517         ob_a_focused_unpressed_close->texture[0].type = 
518         ob_a_focused_pressed_close->texture[0].type = 
519         ob_a_unfocused_unpressed_close->texture[0].type = 
520         ob_a_unfocused_pressed_close->texture[0].type = 
521         ob_a_focused_unpressed_desk->texture[0].type = 
522         ob_a_focused_pressed_desk->texture[0].type = 
523         ob_a_focused_pressed_set_desk->texture[0].type = 
524         ob_a_unfocused_unpressed_desk->texture[0].type = 
525         ob_a_unfocused_pressed_desk->texture[0].type = 
526         ob_a_unfocused_pressed_set_desk->texture[0].type = 
527         ob_a_focused_unpressed_shade->texture[0].type = 
528         ob_a_focused_pressed_shade->texture[0].type = 
529         ob_a_focused_pressed_set_shade->texture[0].type = 
530         ob_a_unfocused_unpressed_shade->texture[0].type = 
531         ob_a_unfocused_pressed_shade->texture[0].type = 
532         ob_a_unfocused_pressed_set_shade->texture[0].type = 
533         ob_a_focused_unpressed_iconify->texture[0].type = 
534         ob_a_focused_pressed_iconify->texture[0].type = 
535         ob_a_unfocused_unpressed_iconify->texture[0].type = 
536         ob_a_unfocused_pressed_iconify->texture[0].type = Bitmask;
537     ob_a_focused_unpressed_max->texture[0].data.mask.mask = 
538         ob_a_unfocused_unpressed_max->texture[0].data.mask.mask = 
539         ob_a_focused_pressed_max->texture[0].data.mask.mask = 
540         ob_a_unfocused_pressed_max->texture[0].data.mask.mask =
541         ob_s_max_unset_mask;
542     ob_a_focused_pressed_set_max->texture[0].data.mask.mask = 
543         ob_a_unfocused_pressed_set_max->texture[0].data.mask.mask =
544         ob_s_max_set_mask;
545     ob_a_focused_pressed_close->texture[0].data.mask.mask = 
546         ob_a_unfocused_pressed_close->texture[0].data.mask.mask =
547         ob_a_focused_unpressed_close->texture[0].data.mask.mask = 
548         ob_a_unfocused_unpressed_close->texture[0].data.mask.mask =
549         ob_s_close_mask;
550     ob_a_focused_unpressed_desk->texture[0].data.mask.mask = 
551         ob_a_unfocused_unpressed_desk->texture[0].data.mask.mask = 
552         ob_a_focused_pressed_desk->texture[0].data.mask.mask = 
553         ob_a_unfocused_pressed_desk->texture[0].data.mask.mask =
554         ob_s_desk_unset_mask;
555     ob_a_focused_pressed_set_desk->texture[0].data.mask.mask = 
556         ob_a_unfocused_pressed_set_desk->texture[0].data.mask.mask =
557         ob_s_desk_set_mask;
558     ob_a_focused_unpressed_shade->texture[0].data.mask.mask = 
559         ob_a_unfocused_unpressed_shade->texture[0].data.mask.mask = 
560         ob_a_focused_pressed_shade->texture[0].data.mask.mask = 
561         ob_a_unfocused_pressed_shade->texture[0].data.mask.mask =
562         ob_s_shade_unset_mask;
563     ob_a_focused_pressed_set_shade->texture[0].data.mask.mask = 
564         ob_a_unfocused_pressed_set_shade->texture[0].data.mask.mask =
565         ob_s_shade_set_mask;
566     ob_a_focused_unpressed_iconify->texture[0].data.mask.mask = 
567         ob_a_unfocused_unpressed_iconify->texture[0].data.mask.mask = 
568         ob_a_focused_pressed_iconify->texture[0].data.mask.mask = 
569         ob_a_unfocused_pressed_iconify->texture[0].data.mask.mask =
570         ob_s_iconify_mask;
571     ob_a_focused_unpressed_max->texture[0].data.mask.color = 
572         ob_a_focused_pressed_max->texture[0].data.mask.color = 
573         ob_a_focused_pressed_set_max->texture[0].data.mask.color = 
574         ob_a_focused_unpressed_close->texture[0].data.mask.color = 
575         ob_a_focused_pressed_close->texture[0].data.mask.color = 
576         ob_a_focused_unpressed_desk->texture[0].data.mask.color = 
577         ob_a_focused_pressed_desk->texture[0].data.mask.color = 
578         ob_a_focused_pressed_set_desk->texture[0].data.mask.color = 
579         ob_a_focused_unpressed_shade->texture[0].data.mask.color = 
580         ob_a_focused_pressed_shade->texture[0].data.mask.color = 
581         ob_a_focused_pressed_set_shade->texture[0].data.mask.color = 
582         ob_a_focused_unpressed_iconify->texture[0].data.mask.color = 
583         ob_a_focused_pressed_iconify->texture[0].data.mask.color =
584         ob_s_titlebut_focused_color;
585     ob_a_unfocused_unpressed_max->texture[0].data.mask.color = 
586         ob_a_unfocused_pressed_max->texture[0].data.mask.color = 
587         ob_a_unfocused_pressed_set_max->texture[0].data.mask.color = 
588         ob_a_unfocused_unpressed_close->texture[0].data.mask.color = 
589         ob_a_unfocused_pressed_close->texture[0].data.mask.color = 
590         ob_a_unfocused_unpressed_desk->texture[0].data.mask.color = 
591         ob_a_unfocused_pressed_desk->texture[0].data.mask.color = 
592         ob_a_unfocused_pressed_set_desk->texture[0].data.mask.color = 
593         ob_a_unfocused_unpressed_shade->texture[0].data.mask.color = 
594         ob_a_unfocused_pressed_shade->texture[0].data.mask.color = 
595         ob_a_unfocused_pressed_set_shade->texture[0].data.mask.color = 
596         ob_a_unfocused_unpressed_iconify->texture[0].data.mask.color = 
597         ob_a_unfocused_pressed_iconify->texture[0].data.mask.color =
598         ob_s_titlebut_unfocused_color;
599
600     XrmDestroyDatabase(db);
601     return TRUE;
602 }
603
604