From 9970dd11c7f9c0d9d91601c9e9785a857ca2c6d8 Mon Sep 17 00:00:00 2001 From: simonb Date: Wed, 27 Apr 2005 15:15:36 +0000 Subject: 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 --- ChangeLog | 6 ++++++ src/ClockTool.cc | 32 +++++++++++++++----------------- src/FbTk/FbWindow.hh | 10 +++++----- src/FbTk/MenuSeparator.cc | 17 ++++++++++------- src/FbTk/MenuSeparator.hh | 2 +- src/FbTk/TextButton.cc | 2 +- src/IconbarTool.cc | 5 ++++- src/TextTheme.cc | 4 ---- src/ToolFactory.cc | 4 ++++ 9 files changed, 46 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index d10619c..2f5c26d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ (Format: Year/Month/Day) Changes for 0.9.13 *05/04/27: + * Fix a bunch more issues with recent patches (Simon) + - Clock text colour on start + - Resizing not updating in some cases + - menu separators not being drawn + FbTk/... FbWindow.hh MenuSeparator.hh/cc TextButton.cc + ClockTool.cc IconbarTool.cc TextTheme.cc ToolFactory.cc * Close #1107216, minor fbgm-issue, cosmetic startfluxbox (from the OpenBSD patches) nls/Makefile.am util/fluxbox-generate_menu.in util/startfluxbox.in * Fix #1182770 (Mathias) 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 @@ #include #endif #include -#include -using namespace std; class ClockMenuItem: public FbTk::MenuItem { public: @@ -220,6 +218,10 @@ void ClockTool::update(FbTk::Subject *subj) { resize(new_width, m_button.height()); resizeSig().notify(); } + + if (subj != 0 && typeid(*subj) == typeid(ToolTheme)) + renderTheme(m_button.alpha()); + } unsigned int ClockTool::borderWidth() const { @@ -249,13 +251,10 @@ void ClockTool::updateTime() { if (!strftime(time_string, 255, m_timeformat->c_str(), time_type) || m_button.text() == time_string) return; m_button.setText(time_string); - m_button.parentMoved(); #else // dont have strftime so we have to set it to hour:minut // sprintf(time_string, "%d:%d", ); #endif // HAVE_STRFTIME } - - m_button.clear(); } // Just change things that affect the size @@ -266,28 +265,27 @@ void ClockTool::updateSizing() { } void ClockTool::reRender() { + if (m_pixmap) + m_screen.imageControl().removeImage(m_pixmap); + if (m_theme.texture().usePixmap()) { - if (m_pixmap) - m_screen.imageControl().removeImage(m_pixmap); m_pixmap = m_screen.imageControl().renderImage(width(), height(), m_theme.texture()); m_button.setBackgroundPixmap(m_pixmap); - } -} - -void ClockTool::renderTheme(unsigned char alpha) { - if (!m_theme.texture().usePixmap()) { - if (m_pixmap) - m_screen.imageControl().removeImage(m_pixmap); + } else { m_pixmap = 0; m_button.setBackgroundColor(m_theme.texture().color()); - } else { - reRender(); } +} + +void ClockTool::renderTheme(unsigned char alpha) { + m_button.setAlpha(alpha); m_button.setJustify(m_theme.justify()); + + reRender(); + m_button.setBorderWidth(m_theme.border().width()); m_button.setBorderColor(m_theme.border().color()); - m_button.setAlpha(alpha); m_button.clear(); } 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: XResizeWindow(s_display, m_window, width, height); m_width = width; m_height = height; - updateBackground(true); + updateBackground(false); } virtual inline void moveResize(int x, int y, unsigned int width, unsigned int height) { @@ -127,7 +127,7 @@ public: m_y = y; m_width = width; m_height = height; - updateBackground(true); + updateBackground(false); } virtual void lower(); @@ -185,9 +185,11 @@ public: void setOpaque(unsigned char alpha); void setRenderer(FbWindowRenderer &renderer) { m_renderer = &renderer; } - void sendConfigureNotify(int x, int y, unsigned int width, unsigned int height); + /// forces full background change, recalcing of alpha values if necessary + void updateBackground(bool only_if_alpha); + protected: /// creates a window with x window client (m_window = client) explicit FbWindow(Window client); @@ -204,8 +206,6 @@ private: bool save_unders, int depth, int class_type); - /// forces full background change, recalcing of alpha values if necessary - void updateBackground(bool only_if_alpha); const FbWindow *m_parent; ///< parent FbWindow 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 { void MenuSeparator::draw(FbDrawable &drawable, const MenuTheme &theme, - bool highlight, + bool highlight, bool draw_foreground, bool draw_background, int x, int y, unsigned int width, unsigned int height) const { - const GContext &tgc = - (highlight ? theme.hiliteTextGC() : - (isEnabled() ? theme.frameTextGC() : theme.disableTextGC() ) ); - drawable.drawRectangle(tgc.gc(), - x + theme.bevelWidth() + height + 1, y + height / 2, - width - ((theme.bevelWidth() + height) * 2) - 1, 0); + if (draw_background) { + const GContext &tgc = + (highlight ? theme.hiliteTextGC() : + (isEnabled() ? theme.frameTextGC() : theme.disableTextGC() ) ); + + drawable.drawRectangle(tgc.gc(), + x + theme.bevelWidth() + height + 1, y + height / 2, + width - ((theme.bevelWidth() + height) * 2) - 1, 0); + } } } 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 { public: virtual void draw(FbDrawable &drawable, const MenuTheme &theme, - bool highlight, + bool highlight, bool draw_foreground, bool draw_background, int x, int y, unsigned int width, unsigned int height) const; 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) { void TextButton::setText(const std::string &text) { if (m_text != text) { m_text = text; - parentMoved(); + updateBackground(false); clear(); } } 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) { return; } else if (subj == &(winsubj->win().titleSig())) { - renderWindow(winsubj->win()); + IconButton *button = findButton(winsubj->win()); + if (button == 0) + return; + button->setText(winsubj->win().title()); return; } else { // 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, m_text_color(theme, name + ".textColor", altname + ".TextColor"), m_justify(theme, name + ".justify", altname + ".Justify"), m_text_gc(RootWindow(FbTk::App::instance()->display(), theme.screenNum())) { - *m_justify = FbTk::LEFT; - // set default values - m_font->load("fixed"); - m_text_color->setFromString("white", theme.screenNum()); update(); } 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 & void ToolFactory::updateThemes() { m_clock_theme.setAntialias(screen().antialias()); + m_clock_theme.reconfigTheme(); m_iconbar_theme.setAntialias(screen().antialias()); + m_iconbar_theme.reconfigTheme(); m_button_theme->setAntialias(screen().antialias()); + m_button_theme->reconfigTheme(); m_workspace_theme->setAntialias(screen().antialias()); + m_workspace_theme->reconfigTheme(); } -- cgit v0.11.2