X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=render%2Ftheme.c;h=12e54377c9a3f866dd7274dc4ec5b0395bbce0ee;hb=62240d2b0ffc75d2a87117e2e0e282674a965495;hp=eccc2c8a7dc80dcb96786c40e9e2f6aa4dc3f700;hpb=9bd740cf71ec591a9ec23d5b1729449f22fcf4b1;p=chaz%2Fopenbox diff --git a/render/theme.c b/render/theme.c index eccc2c8a..12e54377 100644 --- a/render/theme.c +++ b/render/theme.c @@ -93,8 +93,11 @@ Appearance *theme_a_menu_item; Appearance *theme_a_menu_disabled; Appearance *theme_a_menu_hilite; +Appearance *theme_app_hilite_bg; +Appearance *theme_app_unhilite_bg; Appearance *theme_app_hilite_label; Appearance *theme_app_unhilite_label; +Appearance *theme_app_icon; void theme_startup() { @@ -110,12 +113,12 @@ void theme_startup() theme_shade_set_mask = theme_shade_unset_mask = NULL; theme_iconify_mask = theme_close_mask = NULL; - theme_a_focused_unpressed_max = appearance_new(Surface_Planar, 1); - theme_a_focused_pressed_max = appearance_new(Surface_Planar, 1); - theme_a_focused_pressed_set_max = appearance_new(Surface_Planar, 1); - theme_a_unfocused_unpressed_max = appearance_new(Surface_Planar, 1); - theme_a_unfocused_pressed_max = appearance_new(Surface_Planar, 1); - theme_a_unfocused_pressed_set_max = appearance_new(Surface_Planar, 1); + theme_a_focused_unpressed_max = appearance_new(1); + theme_a_focused_pressed_max = appearance_new(1); + theme_a_focused_pressed_set_max = appearance_new(1); + theme_a_unfocused_unpressed_max = appearance_new(1); + theme_a_unfocused_pressed_max = appearance_new(1); + theme_a_unfocused_pressed_set_max = appearance_new(1); theme_a_focused_unpressed_close = NULL; theme_a_focused_pressed_close = NULL; theme_a_unfocused_unpressed_close = NULL; @@ -136,23 +139,26 @@ void theme_startup() theme_a_focused_pressed_iconify = NULL; theme_a_unfocused_unpressed_iconify = NULL; theme_a_unfocused_pressed_iconify = NULL; - theme_a_focused_grip = appearance_new(Surface_Planar, 0); - theme_a_unfocused_grip = appearance_new(Surface_Planar, 0); - theme_a_focused_title = appearance_new(Surface_Planar, 0); - theme_a_unfocused_title = appearance_new(Surface_Planar, 0); - theme_a_focused_label = appearance_new(Surface_Planar, 1); - theme_a_unfocused_label = appearance_new(Surface_Planar, 1); - theme_a_icon = appearance_new(Surface_Planar, 1); - theme_a_focused_handle = appearance_new(Surface_Planar, 0); - theme_a_unfocused_handle = appearance_new(Surface_Planar, 0); - theme_a_menu = appearance_new(Surface_Planar, 0); - theme_a_menu_title = appearance_new(Surface_Planar, 1); - theme_a_menu_item = appearance_new(Surface_Planar, 1); - theme_a_menu_disabled = appearance_new(Surface_Planar, 1); - theme_a_menu_hilite = appearance_new(Surface_Planar, 1); - - theme_app_hilite_label = appearance_new(Surface_Planar, 1); - theme_app_unhilite_label = appearance_new(Surface_Planar, 1); + theme_a_focused_grip = appearance_new(0); + theme_a_unfocused_grip = appearance_new(0); + theme_a_focused_title = appearance_new(0); + theme_a_unfocused_title = appearance_new(0); + theme_a_focused_label = appearance_new(1); + theme_a_unfocused_label = appearance_new(1); + theme_a_icon = appearance_new(1); + theme_a_focused_handle = appearance_new(0); + theme_a_unfocused_handle = appearance_new(0); + theme_a_menu = appearance_new(0); + theme_a_menu_title = appearance_new(1); + theme_a_menu_item = appearance_new(1); + theme_a_menu_disabled = appearance_new(1); + theme_a_menu_hilite = appearance_new(1); + + theme_app_hilite_bg = appearance_new(0); + theme_app_unhilite_bg = appearance_new(0); + theme_app_hilite_label = appearance_new(1); + theme_app_unhilite_label = appearance_new(1); + theme_app_icon = appearance_new(1); } @@ -221,8 +227,11 @@ void theme_shutdown() appearance_free(theme_a_menu_item); appearance_free(theme_a_menu_disabled); appearance_free(theme_a_menu_hilite); + appearance_free(theme_app_hilite_bg); + appearance_free(theme_app_unhilite_bg); appearance_free(theme_app_hilite_label); appearance_free(theme_app_unhilite_label); + appearance_free(theme_app_icon); } static XrmDatabase loaddb(char *theme) @@ -330,7 +339,7 @@ static gboolean read_mask(XrmDatabase db, char *rname, char *theme, if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && retvalue.addr != NULL) { - button_dir = g_strdup_printf("%s_buttons", theme); + button_dir = g_strdup_printf("%s_data", theme); s = g_build_filename(g_get_home_dir(), ".openbox", "themes", button_dir, retvalue.addr, NULL); @@ -348,7 +357,7 @@ static gboolean read_mask(XrmDatabase db, char *rname, char *theme, g_free(s); themename = g_path_get_basename(theme); - s = g_strdup_printf("%s/%s_buttons/%s", theme, + s = g_strdup_printf("%s/%s_data/%s", theme, themename, retvalue.addr); g_free(themename); if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) == @@ -395,7 +404,7 @@ static void parse_appearance(char *tex, SurfaceColorType *grad, else if (strstr(tex, "pipecross") != NULL) *grad = Background_PipeCross; else if (strstr(tex, "elliptic") != NULL) - *grad = Background_Elliptic; + *grad = Background_Rectangle; else if (strstr(tex, "horizontal") != NULL) *grad = Background_Horizontal; else if (strstr(tex, "vertical") != NULL) @@ -446,19 +455,19 @@ static gboolean read_appearance(XrmDatabase db, char *rname, Appearance *value) if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && retvalue.addr != NULL) { parse_appearance(retvalue.addr, - &value->surface.data.planar.grad, - &value->surface.data.planar.relief, - &value->surface.data.planar.bevel, - &value->surface.data.planar.interlaced, - &value->surface.data.planar.border); - if (!read_color(db, cname, &value->surface.data.planar.primary)) - value->surface.data.planar.primary = color_new(0, 0, 0); - if (!read_color(db, ctoname, &value->surface.data.planar.secondary)) - value->surface.data.planar.secondary = color_new(0, 0, 0); - if (value->surface.data.planar.border) + &value->surface.grad, + &value->surface.relief, + &value->surface.bevel, + &value->surface.interlaced, + &value->surface.border); + if (!read_color(db, cname, &value->surface.primary)) + value->surface.primary = color_new(0, 0, 0); + if (!read_color(db, ctoname, &value->surface.secondary)) + value->surface.secondary = color_new(0, 0, 0); + if (value->surface.border) if (!read_color(db, bcname, - &value->surface.data.planar.border_color)) - value->surface.data.planar.border_color = color_new(0, 0, 0); + &value->surface.border_color)) + value->surface.border_color = color_new(0, 0, 0); ret = TRUE; } @@ -471,13 +480,13 @@ static gboolean read_appearance(XrmDatabase db, char *rname, Appearance *value) static void set_default_appearance(Appearance *a) { - a->surface.data.planar.grad = Background_Solid; - a->surface.data.planar.relief = Flat; - a->surface.data.planar.bevel = Bevel1; - a->surface.data.planar.interlaced = FALSE; - a->surface.data.planar.border = FALSE; - a->surface.data.planar.primary = color_new(0, 0, 0); - a->surface.data.planar.secondary = color_new(0, 0, 0); + a->surface.grad = Background_Solid; + a->surface.relief = Flat; + a->surface.bevel = Bevel1; + a->surface.interlaced = FALSE; + a->surface.border = FALSE; + a->surface.primary = color_new(0, 0, 0); + a->surface.secondary = color_new(0, 0, 0); } char *theme_load(char *theme) @@ -506,7 +515,7 @@ char *theme_load(char *theme) } /* load the font stuff */ - font_str = "arial-8:bold"; + font_str = "arial:bold:pixelsize=10"; theme_winfont_shadow = FALSE; if (read_string(db, "window.xft.flags", &str)) { @@ -728,26 +737,15 @@ char *theme_load(char *theme) if (!read_appearance(db, "menu.hilite", theme_a_menu_hilite)) set_default_appearance(theme_a_menu_hilite); - /* read the appearances for rendering non-decorations. these cannot be - parent-relative */ - if (theme_a_focused_label->surface.data.planar.grad != - Background_ParentRelative) { - if (!read_appearance(db, "window.label.focus", theme_app_hilite_label)) - set_default_appearance(theme_app_hilite_label); - } else { - if (!read_appearance(db, "window.title.focus", theme_app_hilite_label)) - set_default_appearance(theme_app_hilite_label); - } - if (theme_a_unfocused_label->surface.data.planar.grad != - Background_ParentRelative) { - if (!read_appearance(db, "window.label.unfocus", - theme_app_unhilite_label)) - set_default_appearance(theme_app_unhilite_label); - } else { - if (!read_appearance(db, "window.title.unfocus", - theme_app_unhilite_label)) - set_default_appearance(theme_app_unhilite_label); - } + /* read the appearances for rendering non-decorations */ + if (!read_appearance(db, "window.title.focus", theme_app_hilite_bg)) + set_default_appearance(theme_app_hilite_bg); + if (!read_appearance(db, "window.label.focus", theme_app_hilite_label)) + set_default_appearance(theme_app_hilite_label); + if (!read_appearance(db, "window.title.unfocus", theme_app_unhilite_bg)) + set_default_appearance(theme_app_unhilite_bg); + if (!read_appearance(db, "window.label.unfocus", theme_app_unhilite_label)) + set_default_appearance(theme_app_unhilite_label); /* read buttons textures */ if (!read_appearance(db, "window.button.pressed.focus", @@ -812,13 +810,13 @@ char *theme_load(char *theme) theme_a_focused_pressed_set_max = appearance_copy(theme_a_focused_pressed_max); - theme_a_icon->surface.data.planar.grad = Background_ParentRelative; + theme_a_icon->surface.grad = Background_ParentRelative; /* set up the textures */ theme_a_focused_label->texture[0].type = theme_app_hilite_label->texture[0].type = Text; - theme_a_focused_label->texture[0].data.text.justify = - theme_app_hilite_label->texture[0].data.text.justify = winjust; + theme_a_focused_label->texture[0].data.text.justify = winjust; + theme_app_hilite_label->texture[0].data.text.justify = Justify_Left; theme_a_focused_label->texture[0].data.text.font = theme_app_hilite_label->texture[0].data.text.font = theme_winfont; theme_a_focused_label->texture[0].data.text.shadow = @@ -836,8 +834,8 @@ char *theme_load(char *theme) theme_a_unfocused_label->texture[0].type = theme_app_unhilite_label->texture[0].type = Text; - theme_a_unfocused_label->texture[0].data.text.justify = - theme_app_unhilite_label->texture[0].data.text.justify = winjust; + theme_a_unfocused_label->texture[0].data.text.justify = winjust; + theme_app_unhilite_label->texture[0].data.text.justify = Justify_Left; theme_a_unfocused_label->texture[0].data.text.font = theme_app_unhilite_label->texture[0].data.text.font = theme_winfont; theme_a_unfocused_label->texture[0].data.text.shadow = @@ -863,9 +861,9 @@ char *theme_load(char *theme) theme_mtitlefont_shadow_tint; theme_a_menu_title->texture[0].data.text.color = theme_menu_title_color; - theme_a_menu_item->surface.data.planar.grad = - theme_a_menu_disabled->surface.data.planar.grad = - Background_ParentRelative; + theme_a_menu_item->surface.grad = + theme_a_menu_disabled->surface.grad = + theme_app_icon->surface.grad = Background_ParentRelative; theme_a_menu_item->texture[0].type = theme_a_menu_disabled->texture[0].type =