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
This commit is contained in:
simonb 2005-04-27 15:15:36 +00:00
parent 8a43bec0e8
commit 9970dd11c7
9 changed files with 46 additions and 36 deletions

View file

@ -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)

View file

@ -46,8 +46,6 @@
#include <time.h>
#endif
#include <string>
#include <iostream>
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();
}

View file

@ -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

View file

@ -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);
}
}
}

View file

@ -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;

View file

@ -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();
}
}

View file

@ -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

View file

@ -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();
}

View file

@ -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();
}