diff options
-rw-r--r-- | src/IconbarTheme.cc | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/IconbarTheme.cc b/src/IconbarTheme.cc index 2ee8360..3b77d67 100644 --- a/src/IconbarTheme.cc +++ b/src/IconbarTheme.cc | |||
@@ -29,14 +29,26 @@ IconbarTheme::IconbarTheme(int screen_num, | |||
29 | const std::string &name, | 29 | const std::string &name, |
30 | const std::string &altname): | 30 | const std::string &altname): |
31 | FbTk::Theme(screen_num), | 31 | FbTk::Theme(screen_num), |
32 | m_focused_texture(*this, name + ".focused", altname + ".Focused"), | 32 | m_focused_texture(*this, |
33 | m_unfocused_texture(*this, name + ".unfocused", altname + ".Unfocused"), | 33 | name + (name == "window.label" ? ".focus" : ".focused"), |
34 | altname + (name == "window.label" ? ".Focus" : ".Focused")), | ||
35 | m_unfocused_texture(*this, | ||
36 | name + (name == "window.label" ? ".unfocus" : ".unfocused"), | ||
37 | altname + (name == "window.label" ? ".Unfocus" : ".Unfocused")), | ||
34 | m_empty_texture(*this, name + ".empty", altname + ".Empty"), | 38 | m_empty_texture(*this, name + ".empty", altname + ".Empty"), |
35 | m_focused_border(*this, name + ".focused", altname + ".Focused"), | 39 | m_focused_border(*this, |
36 | m_unfocused_border(*this, name + ".unfocused", altname + ".Unfocused"), | 40 | name + (name == "window.label" ? ".focus" : ".focused"), |
41 | altname + (name == "window.label" ? ".Focus" : ".Focused")), | ||
42 | m_unfocused_border(*this, | ||
43 | name + (name == "window.label" ? ".unfocus" : ".unfocused"), | ||
44 | altname + (name == "window.label" ? ".Unfocus" : ".Unfocused")), | ||
37 | m_border(*this, name, altname), | 45 | m_border(*this, name, altname), |
38 | m_focused_text(*this, name + ".focused", altname + ".Focused"), | 46 | m_focused_text(*this, |
39 | m_unfocused_text(*this, name + ".unfocused", altname + ".Unfocused"), | 47 | name + (name == "window.label" ? ".focus" : ".focused"), |
48 | altname + (name == "window.label" ? ".Focus" : ".Focused")), | ||
49 | m_unfocused_text(*this, | ||
50 | name + (name == "window.label" ? ".unfocus" : ".unfocused"), | ||
51 | altname + (name == "window.label" ? ".Unfocus" : ".Unfocused")), | ||
40 | m_name(name), m_altname(altname) { | 52 | m_name(name), m_altname(altname) { |
41 | 53 | ||
42 | FbTk::ThemeManager::instance().loadTheme(*this); | 54 | FbTk::ThemeManager::instance().loadTheme(*this); |
@@ -56,54 +68,42 @@ void IconbarTheme::reconfigTheme() { | |||
56 | bool IconbarTheme::fallback(FbTk::ThemeItem_base &item) { | 68 | bool IconbarTheme::fallback(FbTk::ThemeItem_base &item) { |
57 | using namespace FbTk; | 69 | using namespace FbTk; |
58 | ThemeManager &tm = ThemeManager::instance(); | 70 | ThemeManager &tm = ThemeManager::instance(); |
71 | std::string focus = (m_name == "window.label" ? ".focus" : ".focused"); | ||
72 | std::string un = (m_name == "window.label" ? ".unfocus" : ".unfocused"); | ||
59 | 73 | ||
60 | // TODO: fix fallbacks for "focused" vs. "focus" | 74 | if (&m_focused_texture == &item || &m_unfocused_texture == &item) { |
61 | if (&m_focused_texture == &item) { | 75 | return tm.loadItem(item, "toolbar.windowLabel", "toolbar.windowLabel"); |
62 | return (tm.loadItem(item, "window.label.focus", "Window.Label.Focus") || | ||
63 | tm.loadItem(item, "toolbar.windowLabel", "toolbar.windowLabel")); | ||
64 | |||
65 | } else if (&m_unfocused_texture == &item) { | ||
66 | return (tm.loadItem(item, "window.label.unfocus", | ||
67 | "Window.Label.Unfocus") || | ||
68 | tm.loadItem(item, "toolbar.windowLabel", | ||
69 | "toolbar.windowLabel")); | ||
70 | } else if (&m_empty_texture == &item) { | 76 | } else if (&m_empty_texture == &item) { |
71 | return (tm.loadItem(item, m_focused_texture.name(), | 77 | return (tm.loadItem(item, m_focused_texture.name(), |
72 | m_focused_texture.altName()) || | 78 | m_focused_texture.altName()) || |
73 | tm.loadItem(item, "toolbar.windowLabel", "toolbar.windowLabel") | 79 | tm.loadItem(item, "toolbar.windowLabel", "toolbar.windowLabel") |
74 | || tm.loadItem(item, "toolbar", "toolbar")); | 80 | || tm.loadItem(item, "toolbar", "toolbar")); |
75 | } else if (item.name() == m_name + ".focused.borderWidth" || | 81 | } else if (item.name() == m_name + focus + ".borderWidth" || |
76 | item.name() == m_name + ".unfocused.borderWidth") | 82 | item.name() == m_name + un + ".borderWidth") |
77 | // don't fallback for base border, for theme backwards compatibility | 83 | // don't fallback for base border, for theme backwards compatibility |
78 | return (tm.loadItem(item, m_name + ".borderWidth", | 84 | return (tm.loadItem(item, m_name + ".borderWidth", |
79 | m_altname + ".BorderWidth") || | 85 | m_altname + ".BorderWidth") || |
80 | tm.loadItem(item, "window.borderWidth", "Window.BorderWidth") || | 86 | tm.loadItem(item, "window.borderWidth", "Window.BorderWidth") || |
81 | tm.loadItem(item, "borderWidth", "BorderWidth")); | 87 | tm.loadItem(item, "borderWidth", "BorderWidth")); |
82 | 88 | ||
83 | else if (item.name() == m_name + ".focused.borderColor" || | 89 | else if (item.name() == m_name + focus + ".borderColor" || |
84 | item.name() == m_name + ".unfocused.borderColor") | 90 | item.name() == m_name + un + ".borderColor") |
85 | 91 | ||
86 | return (tm.loadItem(item, m_name + ".borderColor", | 92 | return (tm.loadItem(item, m_name + ".borderColor", |
87 | m_altname + ".BorderColor") || | 93 | m_altname + ".BorderColor") || |
88 | tm.loadItem(item, "window.borderColor", "Window.BorderColor") || | 94 | tm.loadItem(item, "window.borderColor", "Window.BorderColor") || |
89 | tm.loadItem(item, "borderColor", "BorderColor")); | 95 | tm.loadItem(item, "borderColor", "BorderColor")); |
90 | 96 | ||
91 | else if (item.name() == m_name + ".focused.font" || | 97 | else if (item.name() == m_name + focus + ".font" || |
92 | item.name() == m_name + ".unfocused.font") | 98 | item.name() == m_name + un + ".font") |
93 | 99 | ||
94 | return tm.loadItem(item, "window.font", "Window.Font"); | 100 | return tm.loadItem(item, "window.font", "Window.Font"); |
95 | 101 | ||
96 | else if (item.name() == m_name + ".focused.textColor") { | 102 | else if (item.name() == m_name + focus + ".justify" || |
97 | 103 | item.name() == m_name + un + ".justify") { | |
98 | return tm.loadItem(item, "window.label.focus.textColor", "Window.Label.Focus.TextColor"); | ||
99 | |||
100 | } else if (item.name() == m_name + ".unfocused.textColor") { | ||
101 | return tm.loadItem(item, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"); | ||
102 | } else if (item.name() == m_name + ".focused.justify" || | ||
103 | item.name() == m_name + ".unfocused.justify") { | ||
104 | return (tm.loadItem(item, m_name + ".justify", m_altname + ".Justify") | 104 | return (tm.loadItem(item, m_name + ".justify", m_altname + ".Justify") |
105 | || tm.loadItem(item, "window.justify", "Window.Justify")); | 105 | || tm.loadItem(item, "window.justify", "Window.Justify")); |
106 | } | 106 | } |
107 | 107 | ||
108 | return false; | 108 | return false; |
109 | } | 109 | } |