all repos — fluxbox @ 0b730c76b10babe20738067ae7aec5a102d451fe

custom fork of the fluxbox windowmanager

fix more x errors due to using an invalid background
simonb simonb
commit

0b730c76b10babe20738067ae7aec5a102d451fe

parent

1d0b23bd020c9185dc9cbf8952ab97a27f061be0

M ChangeLogChangeLog

@@ -1,9 +1,13 @@

(Format: Year/Month/Day) Changes for 1.0rc2: *06/06/24: + * Fix some more X-errors (Simon) + - window was resized, triggering background re-render, but + background is invalid sometimes (during reconfiguring) + Container.hh/cc FbWinFrame.cc FbTk/FbWindow.hh/cc FbTk/TextButton.cc * Fix bug #1362463, menu selection pixmaps disappear (Simon) - pixmap from image cache was put into FbPixmap, which freed it. - FbPixmap.hh/cc MenuTheme.hh Menu.cc + FbTk/... FbPixmap.hh/cc MenuTheme.hh Menu.cc *06/06/23: * Make startfluxbox aware of --program-prefix and --program-suffix (Mark) configure.in util/Makefile.am util/startfluxbox.in
M src/Container.ccsrc/Container.cc

@@ -502,6 +502,14 @@ for (; it != it_end; ++it)

(*it)->parentMoved(); } +void Container::invalidateBackground() { + FbTk::FbWindow::invalidateBackground(); + ItemList::iterator it = m_item_list.begin(); + ItemList::iterator it_end = m_item_list.end(); + for (; it != it_end; ++it) + (*it)->invalidateBackground(); +} + void Container::clear() { ItemList::iterator it = m_item_list.begin(); ItemList::iterator it_end = m_item_list.end();

@@ -513,6 +521,8 @@

void Container::setOrientation(FbTk::Orientation orient) { if (m_orientation == orient) return; + + FbTk::FbWindow::invalidateBackground(); ItemList::iterator it = m_item_list.begin(); ItemList::iterator it_end = m_item_list.end();
M src/Container.hhsrc/Container.hh

@@ -84,6 +84,7 @@ bool tryButtonPressEvent(XButtonEvent &event);

bool tryButtonReleaseEvent(XButtonEvent &event); void parentMoved(); + void invalidateBackground(); /// accessors inline Alignment alignment() const { return m_align; }
M src/FbTk/FbWindow.ccsrc/FbTk/FbWindow.cc

@@ -153,6 +153,11 @@

updateBackground(false); } +void FbWindow::invalidateBackground() { + m_lastbg_pm = None; + m_lastbg_color_set = false; +} + void FbWindow::updateBackground(bool only_if_alpha) { Pixmap newbg = m_lastbg_pm; unsigned char alpha = 255;
M src/FbTk/FbWindow.hhsrc/FbTk/FbWindow.hh

@@ -74,6 +74,8 @@

virtual ~FbWindow(); virtual void setBackgroundColor(const FbTk::Color &bg_color); virtual void setBackgroundPixmap(Pixmap bg_pixmap); + // call when background is freed, and new one not ready yet + virtual void invalidateBackground(); virtual void setBorderColor(const FbTk::Color &border_color); virtual void setBorderWidth(unsigned int size); /// set window name ("title")
M src/FbTk/TextButton.ccsrc/FbTk/TextButton.cc

@@ -63,8 +63,10 @@ m_justify = just;

} bool TextButton::setOrientation(FbTk::Orientation orient) { - if (!m_font->validOrientation(orient)) + if (orient == m_orientation + || !m_font->validOrientation(orient)) return false; + invalidateBackground(); if ((m_orientation == FbTk::ROT0 || m_orientation == FbTk::ROT180) && (orient == FbTk::ROT90 || orient == FbTk::ROT270) ||

@@ -76,8 +78,7 @@ resize(height(), width());

} else { m_orientation = orient; } - updateBackground(false); - clear(); + return true; }
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -159,7 +159,9 @@ m_tab_container.setAlignment(Container::RELATIVE);

m_tab_container.setOrientation(FbTk::ROT0); if (m_tab_container.parent()->window() == m_screen.rootWindow().window()) { m_layeritem.removeWindow(m_tab_container); + m_tab_container.hide(); m_tab_container.reparent(m_titlebar, m_label.x(), m_label.y()); + m_tab_container.invalidateBackground(); m_tab_container.resize(m_label.width(), m_label.height()); m_tab_container.raise(); }

@@ -424,10 +426,8 @@ }

} if (m_tab_container.parent()->window() != m_screen.rootWindow().window()) { - // because the label might be using the same cached pixmap as tab container! - renderTitlebar(); - applyTitlebar(); m_tab_container.reparent(m_screen.rootWindow(), tabx, taby); + m_label.clear(); m_layeritem.addWindow(m_tab_container); } else { m_tab_container.move(tabx, taby);

@@ -1000,12 +1000,15 @@ ypos -= grip_height + handle_bw;

// we do handle settings whether on or not so that if they get toggled // then things are ok... + m_handle.invalidateBackground(); m_handle.moveResize(-handle_bw, ypos, m_window.width(), grip_height); + m_grip_left.invalidateBackground(); m_grip_left.moveResize(-handle_bw, -handle_bw, grip_width, grip_height); + m_grip_right.invalidateBackground(); m_grip_right.moveResize(m_handle.width() - grip_width - handle_bw, -handle_bw, grip_width, grip_height);

@@ -1089,6 +1092,7 @@

// if the titlebar grows in size, make sure the whole window does too if (orig_height != title_height) m_window.resize(m_window.width(), m_window.height()-orig_height+title_height); + m_titlebar.invalidateBackground(); m_titlebar.moveResize(-m_titlebar.borderWidth(), -m_titlebar.borderWidth(), m_window.width(), title_height);

@@ -1097,6 +1101,8 @@ unsigned int next_x = m_bevel;

unsigned int button_size = buttonHeight(); m_button_size = button_size; for (size_t i=0; i < m_buttons_left.size(); i++, next_x += button_size + m_bevel) { + // probably on theme reconfigure, leave bg alone for now + m_buttons_left[i]->invalidateBackground(); m_buttons_left[i]->moveResize(next_x, m_bevel, button_size, button_size); }

@@ -1114,8 +1120,10 @@

if (space_left <= 0) space_left = 1; + m_label.invalidateBackground(); m_label.moveResize(next_x, m_bevel, space_left, button_size); + m_tab_container.invalidateBackground(); if (m_tabmode == INTERNAL) m_tab_container.moveResize(next_x, m_bevel, space_left, button_size);

@@ -1134,6 +1142,7 @@

// finaly set new buttons to the right for (size_t i=0; i < m_buttons_right.size(); ++i, next_x += button_size + m_bevel) { + m_buttons_right[i]->invalidateBackground(); m_buttons_right[i]->moveResize(next_x, m_bevel, button_size, button_size); }