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
simonb simonb
9 files changed,
46 insertions(+),
36 deletions(-)
M
ChangeLog
→
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)
M
src/ClockTool.cc
→
src/ClockTool.cc
@@ -46,8 +46,6 @@ #else
#include <time.h> #endif #include <string> -#include <iostream> -using namespace std; class ClockMenuItem: public FbTk::MenuItem { public:@@ -220,6 +218,10 @@ if (new_width != m_button.width()) {
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 @@ #ifdef HAVE_STRFTIME
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 @@ update(0);
} 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(); }
M
src/FbTk/FbWindow.hh
→
src/FbTk/FbWindow.hh
@@ -116,7 +116,7 @@ return;
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 @@ m_x = x;
m_y = y; m_width = width; m_height = height; - updateBackground(true); + updateBackground(false); } virtual void lower();@@ -185,8 +185,10 @@ // used for composite
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)@@ -204,8 +206,6 @@ bool override_redirect,
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
M
src/FbTk/MenuSeparator.cc
→
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() ) ); + + 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); + drawable.drawRectangle(tgc.gc(), + x + theme.bevelWidth() + height + 1, y + height / 2, + width - ((theme.bevelWidth() + height) * 2) - 1, 0); + } } }
M
src/FbTk/MenuSeparator.hh
→
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;
M
src/FbTk/TextButton.cc
→
src/FbTk/TextButton.cc
@@ -63,7 +63,7 @@
void TextButton::setText(const std::string &text) { if (m_text != text) { m_text = text; - parentMoved(); + updateBackground(false); clear(); } }
M
src/IconbarTool.cc
→
src/IconbarTool.cc
@@ -558,7 +558,10 @@
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
M
src/TextTheme.cc
→
src/TextTheme.cc
@@ -34,10 +34,6 @@ m_font(theme, name + ".font", altname + ".Font"),
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(); }
M
src/ToolFactory.cc
→
src/ToolFactory.cc
@@ -153,9 +153,13 @@ }
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(); }