diff options
author | simonb <simonb> | 2005-04-27 15:15:36 (GMT) |
---|---|---|
committer | simonb <simonb> | 2005-04-27 15:15:36 (GMT) |
commit | 9970dd11c7f9c0d9d91601c9e9785a857ca2c6d8 (patch) | |
tree | 5c2ed44be50661b590b7a2771a1fad6d4e845177 /src | |
parent | 8a43bec0e8da33da4b8147658af0516c536a3309 (diff) | |
download | fluxbox-9970dd11c7f9c0d9d91601c9e9785a857ca2c6d8.zip fluxbox-9970dd11c7f9c0d9d91601c9e9785a857ca2c6d8.tar.bz2 |
fix a few more bugs with recent reworking stuff
Some fixes could incidentally fix a few other bugs... the flaws were
pre-existing, I've just been weeding out a lot of duplication
Diffstat (limited to 'src')
-rw-r--r-- | src/ClockTool.cc | 32 | ||||
-rw-r--r-- | src/FbTk/FbWindow.hh | 10 | ||||
-rw-r--r-- | src/FbTk/MenuSeparator.cc | 17 | ||||
-rw-r--r-- | src/FbTk/MenuSeparator.hh | 2 | ||||
-rw-r--r-- | src/FbTk/TextButton.cc | 2 | ||||
-rw-r--r-- | src/IconbarTool.cc | 5 | ||||
-rw-r--r-- | src/TextTheme.cc | 4 | ||||
-rw-r--r-- | src/ToolFactory.cc | 4 |
8 files changed, 40 insertions, 36 deletions
diff --git a/src/ClockTool.cc b/src/ClockTool.cc index 6b23ee7..ce50132 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc | |||
@@ -46,8 +46,6 @@ | |||
46 | #include <time.h> | 46 | #include <time.h> |
47 | #endif | 47 | #endif |
48 | #include <string> | 48 | #include <string> |
49 | #include <iostream> | ||
50 | using namespace std; | ||
51 | 49 | ||
52 | class ClockMenuItem: public FbTk::MenuItem { | 50 | class ClockMenuItem: public FbTk::MenuItem { |
53 | public: | 51 | public: |
@@ -220,6 +218,10 @@ void ClockTool::update(FbTk::Subject *subj) { | |||
220 | resize(new_width, m_button.height()); | 218 | resize(new_width, m_button.height()); |
221 | resizeSig().notify(); | 219 | resizeSig().notify(); |
222 | } | 220 | } |
221 | |||
222 | if (subj != 0 && typeid(*subj) == typeid(ToolTheme)) | ||
223 | renderTheme(m_button.alpha()); | ||
224 | |||
223 | } | 225 | } |
224 | 226 | ||
225 | unsigned int ClockTool::borderWidth() const { | 227 | unsigned int ClockTool::borderWidth() const { |
@@ -249,13 +251,10 @@ void ClockTool::updateTime() { | |||
249 | if (!strftime(time_string, 255, m_timeformat->c_str(), time_type) || m_button.text() == time_string) | 251 | if (!strftime(time_string, 255, m_timeformat->c_str(), time_type) || m_button.text() == time_string) |
250 | return; | 252 | return; |
251 | m_button.setText(time_string); | 253 | m_button.setText(time_string); |
252 | m_button.parentMoved(); | ||
253 | #else // dont have strftime so we have to set it to hour:minut | 254 | #else // dont have strftime so we have to set it to hour:minut |
254 | // sprintf(time_string, "%d:%d", ); | 255 | // sprintf(time_string, "%d:%d", ); |
255 | #endif // HAVE_STRFTIME | 256 | #endif // HAVE_STRFTIME |
256 | } | 257 | } |
257 | |||
258 | m_button.clear(); | ||
259 | } | 258 | } |
260 | 259 | ||
261 | // Just change things that affect the size | 260 | // Just change things that affect the size |
@@ -266,28 +265,27 @@ void ClockTool::updateSizing() { | |||
266 | } | 265 | } |
267 | 266 | ||
268 | void ClockTool::reRender() { | 267 | void ClockTool::reRender() { |
268 | if (m_pixmap) | ||
269 | m_screen.imageControl().removeImage(m_pixmap); | ||
270 | |||
269 | if (m_theme.texture().usePixmap()) { | 271 | if (m_theme.texture().usePixmap()) { |
270 | if (m_pixmap) | ||
271 | m_screen.imageControl().removeImage(m_pixmap); | ||
272 | m_pixmap = m_screen.imageControl().renderImage(width(), height(), | 272 | m_pixmap = m_screen.imageControl().renderImage(width(), height(), |
273 | m_theme.texture()); | 273 | m_theme.texture()); |
274 | m_button.setBackgroundPixmap(m_pixmap); | 274 | m_button.setBackgroundPixmap(m_pixmap); |
275 | } | 275 | } else { |
276 | } | ||
277 | |||
278 | void ClockTool::renderTheme(unsigned char alpha) { | ||
279 | if (!m_theme.texture().usePixmap()) { | ||
280 | if (m_pixmap) | ||
281 | m_screen.imageControl().removeImage(m_pixmap); | ||
282 | m_pixmap = 0; | 276 | m_pixmap = 0; |
283 | m_button.setBackgroundColor(m_theme.texture().color()); | 277 | m_button.setBackgroundColor(m_theme.texture().color()); |
284 | } else { | ||
285 | reRender(); | ||
286 | } | 278 | } |
279 | } | ||
287 | 280 | ||
281 | |||
282 | void ClockTool::renderTheme(unsigned char alpha) { | ||
283 | m_button.setAlpha(alpha); | ||
288 | m_button.setJustify(m_theme.justify()); | 284 | m_button.setJustify(m_theme.justify()); |
285 | |||
286 | reRender(); | ||
287 | |||
289 | m_button.setBorderWidth(m_theme.border().width()); | 288 | m_button.setBorderWidth(m_theme.border().width()); |
290 | m_button.setBorderColor(m_theme.border().color()); | 289 | m_button.setBorderColor(m_theme.border().color()); |
291 | m_button.setAlpha(alpha); | ||
292 | m_button.clear(); | 290 | m_button.clear(); |
293 | } | 291 | } |
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh index f02c63e..b08df5e 100644 --- a/src/FbTk/FbWindow.hh +++ b/src/FbTk/FbWindow.hh | |||
@@ -116,7 +116,7 @@ public: | |||
116 | XResizeWindow(s_display, m_window, width, height); | 116 | XResizeWindow(s_display, m_window, width, height); |
117 | m_width = width; | 117 | m_width = width; |
118 | m_height = height; | 118 | m_height = height; |
119 | updateBackground(true); | 119 | updateBackground(false); |
120 | } | 120 | } |
121 | 121 | ||
122 | virtual inline void moveResize(int x, int y, unsigned int width, unsigned int height) { | 122 | virtual inline void moveResize(int x, int y, unsigned int width, unsigned int height) { |
@@ -127,7 +127,7 @@ public: | |||
127 | m_y = y; | 127 | m_y = y; |
128 | m_width = width; | 128 | m_width = width; |
129 | m_height = height; | 129 | m_height = height; |
130 | updateBackground(true); | 130 | updateBackground(false); |
131 | 131 | ||
132 | } | 132 | } |
133 | virtual void lower(); | 133 | virtual void lower(); |
@@ -185,9 +185,11 @@ public: | |||
185 | void setOpaque(unsigned char alpha); | 185 | void setOpaque(unsigned char alpha); |
186 | 186 | ||
187 | void setRenderer(FbWindowRenderer &renderer) { m_renderer = &renderer; } | 187 | void setRenderer(FbWindowRenderer &renderer) { m_renderer = &renderer; } |
188 | |||
189 | void sendConfigureNotify(int x, int y, unsigned int width, unsigned int height); | 188 | void sendConfigureNotify(int x, int y, unsigned int width, unsigned int height); |
190 | 189 | ||
190 | /// forces full background change, recalcing of alpha values if necessary | ||
191 | void updateBackground(bool only_if_alpha); | ||
192 | |||
191 | protected: | 193 | protected: |
192 | /// creates a window with x window client (m_window = client) | 194 | /// creates a window with x window client (m_window = client) |
193 | explicit FbWindow(Window client); | 195 | explicit FbWindow(Window client); |
@@ -204,8 +206,6 @@ private: | |||
204 | bool save_unders, | 206 | bool save_unders, |
205 | int depth, | 207 | int depth, |
206 | int class_type); | 208 | int class_type); |
207 | /// forces full background change, recalcing of alpha values if necessary | ||
208 | void updateBackground(bool only_if_alpha); | ||
209 | 209 | ||
210 | const FbWindow *m_parent; ///< parent FbWindow | 210 | const FbWindow *m_parent; ///< parent FbWindow |
211 | int m_screen_num; ///< screen num on which this window exist | 211 | int m_screen_num; ///< screen num on which this window exist |
diff --git a/src/FbTk/MenuSeparator.cc b/src/FbTk/MenuSeparator.cc index a82ccdb..01aa24a 100644 --- a/src/FbTk/MenuSeparator.cc +++ b/src/FbTk/MenuSeparator.cc | |||
@@ -32,16 +32,19 @@ namespace FbTk { | |||
32 | 32 | ||
33 | void MenuSeparator::draw(FbDrawable &drawable, | 33 | void MenuSeparator::draw(FbDrawable &drawable, |
34 | const MenuTheme &theme, | 34 | const MenuTheme &theme, |
35 | bool highlight, | 35 | bool highlight, bool draw_foreground, bool draw_background, |
36 | int x, int y, | 36 | int x, int y, |
37 | unsigned int width, unsigned int height) const { | 37 | unsigned int width, unsigned int height) const { |
38 | const GContext &tgc = | ||
39 | (highlight ? theme.hiliteTextGC() : | ||
40 | (isEnabled() ? theme.frameTextGC() : theme.disableTextGC() ) ); | ||
41 | 38 | ||
42 | drawable.drawRectangle(tgc.gc(), | 39 | if (draw_background) { |
43 | x + theme.bevelWidth() + height + 1, y + height / 2, | 40 | const GContext &tgc = |
44 | width - ((theme.bevelWidth() + height) * 2) - 1, 0); | 41 | (highlight ? theme.hiliteTextGC() : |
42 | (isEnabled() ? theme.frameTextGC() : theme.disableTextGC() ) ); | ||
43 | |||
44 | drawable.drawRectangle(tgc.gc(), | ||
45 | x + theme.bevelWidth() + height + 1, y + height / 2, | ||
46 | width - ((theme.bevelWidth() + height) * 2) - 1, 0); | ||
47 | } | ||
45 | } | 48 | } |
46 | 49 | ||
47 | } | 50 | } |
diff --git a/src/FbTk/MenuSeparator.hh b/src/FbTk/MenuSeparator.hh index 1cab4fc..3162193 100644 --- a/src/FbTk/MenuSeparator.hh +++ b/src/FbTk/MenuSeparator.hh | |||
@@ -33,7 +33,7 @@ class MenuSeparator: public MenuItem { | |||
33 | public: | 33 | public: |
34 | virtual void draw(FbDrawable &drawable, | 34 | virtual void draw(FbDrawable &drawable, |
35 | const MenuTheme &theme, | 35 | const MenuTheme &theme, |
36 | bool highlight, | 36 | bool highlight, bool draw_foreground, bool draw_background, |
37 | int x, int y, | 37 | int x, int y, |
38 | unsigned int width, unsigned int height) const; | 38 | unsigned int width, unsigned int height) const; |
39 | 39 | ||
diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc index 9a16c2c..e95b1c9 100644 --- a/src/FbTk/TextButton.cc +++ b/src/FbTk/TextButton.cc | |||
@@ -63,7 +63,7 @@ void TextButton::setJustify(FbTk::Justify just) { | |||
63 | void TextButton::setText(const std::string &text) { | 63 | void TextButton::setText(const std::string &text) { |
64 | if (m_text != text) { | 64 | if (m_text != text) { |
65 | m_text = text; | 65 | m_text = text; |
66 | parentMoved(); | 66 | updateBackground(false); |
67 | clear(); | 67 | clear(); |
68 | } | 68 | } |
69 | } | 69 | } |
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index cea8c1a..f8299b8 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc | |||
@@ -558,7 +558,10 @@ void IconbarTool::update(FbTk::Subject *subj) { | |||
558 | return; | 558 | return; |
559 | 559 | ||
560 | } else if (subj == &(winsubj->win().titleSig())) { | 560 | } else if (subj == &(winsubj->win().titleSig())) { |
561 | renderWindow(winsubj->win()); | 561 | IconButton *button = findButton(winsubj->win()); |
562 | if (button == 0) | ||
563 | return; | ||
564 | button->setText(winsubj->win().title()); | ||
562 | return; | 565 | return; |
563 | } else { | 566 | } else { |
564 | // signal not handled | 567 | // signal not handled |
diff --git a/src/TextTheme.cc b/src/TextTheme.cc index 11b1051..da5b371 100644 --- a/src/TextTheme.cc +++ b/src/TextTheme.cc | |||
@@ -34,10 +34,6 @@ TextTheme::TextTheme(FbTk::Theme &theme, | |||
34 | m_text_color(theme, name + ".textColor", altname + ".TextColor"), | 34 | m_text_color(theme, name + ".textColor", altname + ".TextColor"), |
35 | m_justify(theme, name + ".justify", altname + ".Justify"), | 35 | m_justify(theme, name + ".justify", altname + ".Justify"), |
36 | m_text_gc(RootWindow(FbTk::App::instance()->display(), theme.screenNum())) { | 36 | m_text_gc(RootWindow(FbTk::App::instance()->display(), theme.screenNum())) { |
37 | *m_justify = FbTk::LEFT; | ||
38 | // set default values | ||
39 | m_font->load("fixed"); | ||
40 | m_text_color->setFromString("white", theme.screenNum()); | ||
41 | 37 | ||
42 | update(); | 38 | update(); |
43 | } | 39 | } |
diff --git a/src/ToolFactory.cc b/src/ToolFactory.cc index 47dc6bc..90dd70e 100644 --- a/src/ToolFactory.cc +++ b/src/ToolFactory.cc | |||
@@ -153,9 +153,13 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow & | |||
153 | 153 | ||
154 | void ToolFactory::updateThemes() { | 154 | void ToolFactory::updateThemes() { |
155 | m_clock_theme.setAntialias(screen().antialias()); | 155 | m_clock_theme.setAntialias(screen().antialias()); |
156 | m_clock_theme.reconfigTheme(); | ||
156 | m_iconbar_theme.setAntialias(screen().antialias()); | 157 | m_iconbar_theme.setAntialias(screen().antialias()); |
158 | m_iconbar_theme.reconfigTheme(); | ||
157 | m_button_theme->setAntialias(screen().antialias()); | 159 | m_button_theme->setAntialias(screen().antialias()); |
160 | m_button_theme->reconfigTheme(); | ||
158 | m_workspace_theme->setAntialias(screen().antialias()); | 161 | m_workspace_theme->setAntialias(screen().antialias()); |
162 | m_workspace_theme->reconfigTheme(); | ||
159 | } | 163 | } |
160 | 164 | ||
161 | 165 | ||