all repos — fluxbox @ 8f88c1fecb28dc15ecfd2ee210a8e466afe5456c

custom fork of the fluxbox windowmanager

toolbar fixes, updates and optimisations
rathnor rathnor
commit

8f88c1fecb28dc15ecfd2ee210a8e466afe5456c

parent

db6e78bba9fbd0e216f0ebbe5d4f55090ca62069

M ChangeLogChangeLog

@@ -1,5 +1,12 @@

(Format: Year/Month/Day) Changes for 0.9.10: +*04/06/17: + * Improve rendering speed of toolbar (Simon) + - remove many redundant renders (esp. startup) + - only update clock if the text has changed + - fix transparency and border on most items + IconbarTool.hh/cc IconButton.cc Toolbar.cc Container.cc + ClockTool.cc WorkspaceNameTool.cc *04/06/14: * More menu transparency improvements (Henrik) Menu.cc
M src/ClockTool.ccsrc/ClockTool.cc

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ClockTool.cc,v 1.10 2004/01/13 14:41:32 rathnor Exp $ +// $Id: ClockTool.cc,v 1.11 2004/06/16 15:38:19 rathnor Exp $ #include "ClockTool.hh"

@@ -231,7 +231,7 @@ if (time_type == 0)

return; #ifdef HAVE_STRFTIME - if (!strftime(time_string, 255, m_timeformat->c_str(), time_type)) + if (!strftime(time_string, 255, m_timeformat->c_str(), time_type) || m_button.text() == time_string) return; m_button.setText(time_string); #else // dont have strftime so we have to set it to hour:minut

@@ -240,7 +240,6 @@ #endif // HAVE_STRFTIME

} m_button.clear(); - m_button.updateTransparent(); } void ClockTool::renderTheme() {

@@ -261,5 +260,4 @@ m_button.setBorderWidth(m_theme.border().width());

m_button.setBorderColor(m_theme.border().color()); m_button.setAlpha(m_theme.alpha()); m_button.clear(); - m_button.updateTransparent(); }
M src/Container.ccsrc/Container.cc

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Container.cc,v 1.14 2004/05/04 14:33:37 rathnor Exp $ +// $Id: Container.cc,v 1.15 2004/06/16 15:38:19 rathnor Exp $ #include "Container.hh"

@@ -160,10 +160,7 @@ ItemList::iterator it = m_item_list.begin();

for (; pos != 0; --pos, ++it) continue; m_selected = *it; - if (m_selected) { - m_selected->clear(); - m_selected->updateTransparent(); - } + // caller does any graphics stuff if appropriate } }

@@ -218,8 +215,7 @@ (*it)->moveResize(next_x,

-borderW, max_width_per_client + extra, height()); - (*it)->clear(); - (*it)->updateTransparent(); + // moveresize does a clear } }
M src/IconButton.ccsrc/IconButton.cc

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconButton.cc,v 1.20 2004/05/04 14:33:37 rathnor Exp $ +// $Id: IconButton.cc,v 1.21 2004/06/16 15:38:19 rathnor Exp $ #include "IconButton.hh"

@@ -107,7 +107,7 @@ setOnClick(menu_cmd, 3);

m_win.hintSig().attach(this); FbTk::EventManager::instance()->add(*this, m_icon_window); - + update(0); }

@@ -122,21 +122,24 @@ m_icon_window.clear();

else FbTk::TextButton::exposeEvent(event); } + void IconButton::moveResize(int x, int y, unsigned int width, unsigned int height) { FbTk::TextButton::moveResize(x, y, width, height); if (m_icon_window.width() != FbTk::Button::width() || - m_icon_window.height() != FbTk::Button::height()) + m_icon_window.height() != FbTk::Button::height()) { update(0); // update icon window + } } void IconButton::resize(unsigned int width, unsigned int height) { FbTk::TextButton::resize(width, height); if (m_icon_window.width() != FbTk::Button::width() || - m_icon_window.height() != FbTk::Button::height()) + m_icon_window.height() != FbTk::Button::height()) { update(0); // update icon window + } } void IconButton::clear() {

@@ -210,7 +213,11 @@ }

#endif // SHAPE - setupWindow(); + if (subj != 0) { + setupWindow(); + } else { + m_icon_window.clear(); + } } void IconButton::setupWindow() {
M src/IconbarTool.ccsrc/IconbarTool.cc

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTool.cc,v 1.38 2004/06/07 21:43:02 fluxgen Exp $ +// $Id: IconbarTool.cc,v 1.39 2004/06/16 15:38:19 rathnor Exp $ #include "IconbarTool.hh"

@@ -436,7 +436,6 @@

if (mode() == NONE) { if (subj != 0 && typeid(*subj) == typeid(IconbarTheme)) renderTheme(); - return; }

@@ -448,7 +447,6 @@ if (subj == &(winsubj->win().focusSig())) {

// start focus timer, so we can update without flicker m_focus_timer.start(); - //renderWindow(winsubj->win()); return; } else if (subj == &(winsubj->win().workspaceSig())) { // we can ignore this signal if we're in ALLWINDOWS mode

@@ -524,7 +522,9 @@ m_icon_container.setUpdateLock(false);

m_icon_container.update(); m_icon_container.showSubwindows(); - renderTheme(); + // another renderTheme we hopefully shouldn't need? These renders + // should be done individually above + // renderTheme(); } IconButton *IconbarTool::findButton(FluxboxWindow &win) {

@@ -613,17 +613,18 @@

if (tmp) m_screen.imageControl().removeImage(tmp); - m_icon_container.setBorderWidth(m_theme.border().width()); - m_icon_container.setBorderColor(m_theme.border().color()); + // set to zero so its consistent and not ugly + m_icon_container.setBorderWidth(0); m_icon_container.setAlpha(m_theme.alpha()); // update buttons icon_it = m_icon_list.begin(); - for (; icon_it != icon_it_end; ++icon_it) + for (; icon_it != icon_it_end; ++icon_it) { renderButton(*(*icon_it)); + } } -void IconbarTool::renderButton(IconButton &button) { +void IconbarTool::renderButton(IconButton &button, bool clear) { button.setPixmap(*m_rc_use_pixmap); button.setAlpha(m_theme.alpha());

@@ -635,6 +636,7 @@ wider_button = (button.width() != m_icon_container.back()->width());

if (button.win().isFocused()) { // focused texture m_icon_container.setSelected(m_icon_container.find(&button)); + button.setGC(m_theme.focusedText().textGC()); button.setFont(m_theme.focusedText().font()); button.setJustify(m_theme.focusedText().justify());

@@ -646,9 +648,7 @@ button.setBackgroundPixmap(m_focused_pm);

else if (wider_button && m_focused_err_pm != 0) button.setBackgroundPixmap(m_focused_err_pm); else - button.setBackgroundColor(m_theme.focusedTexture().color()); - - + button.setBackgroundColor(m_theme.focusedTexture().color()); } else { // unfocused if (m_icon_container.selected() == &button)

@@ -666,11 +666,10 @@ else if (wider_button && m_unfocused_err_pm != 0)

button.setBackgroundPixmap(m_unfocused_err_pm); else button.setBackgroundColor(m_theme.unfocusedTexture().color()); - } - button.clear(); - button.updateTransparent(); + if (clear) + button.clear(); // the clear also updates transparent } void IconbarTool::deleteIcons() {

@@ -717,7 +716,8 @@ if (win.clientList().empty() || win.isIconHidden() )

return; IconButton *button = new IconButton(m_icon_container, m_theme.focusedText().font(), win); - renderButton(*button); + + renderButton(*button, false); m_icon_container.insertItem(button); m_icon_list.push_back(button);

@@ -809,6 +809,5 @@ if (button != 0)

renderButton(*button); if (current_button != 0) renderButton(*current_button); - }
M src/IconbarTool.hhsrc/IconbarTool.hh

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTool.hh,v 1.13 2003/12/23 01:55:07 rathnor Exp $ +// $Id: IconbarTool.hh,v 1.14 2004/06/16 15:38:19 rathnor Exp $ #ifndef ICONBARTOOL_HH #define ICONBARTOOL_HH

@@ -81,8 +81,8 @@ IconButton *findButton(FluxboxWindow &win);

/// render single button that holds win void renderWindow(FluxboxWindow &win); - /// render single button - void renderButton(IconButton &button); + /// render single button, and probably apply changes (clear) + void renderButton(IconButton &button, bool clear = true); /// render all buttons void renderTheme(); /// destroy all icons
M src/Toolbar.ccsrc/Toolbar.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.143 2004/06/10 17:07:58 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.144 2004/06/16 15:38:19 rathnor Exp $ #include "Toolbar.hh"

@@ -267,7 +267,8 @@ scrn.resourceManager().unlock();

// setup to listen to child events FbTk::EventManager::instance()->addParent(*this, window()); // get everything together - reconfigure(); + //reconfigure(); + // this gets done by the screen later as it loads }

@@ -423,7 +424,7 @@ else if (theme().shape() && m_shape.get() == 0) {

m_shape.reset(new Shape(frame.window, 0)); } - // recallibrate size + // recalibrate size setPlacement(placement()); if (isHidden()) {

@@ -552,9 +553,13 @@ }

void Toolbar::handleEvent(XEvent &event) { + /* Commented out by Simon 16jun04, since it causes LOTS of rearrangeItems + particularly on startup. Can't figure out why this is needed. if (event.type == ConfigureNotify && - event.xconfigure.window != window().window()) - rearrangeItems(); + event.xconfigure.window != window().window()) { + rearrangeItems(); + } + */ } void Toolbar::update(FbTk::Subject *subj) {

@@ -911,7 +916,7 @@ }

} // now move and resize the items // borderWidth added back on straight away - int next_x = -2*m_item_list.front()->borderWidth(); // list isn't empty + int next_x = -m_item_list.front()->borderWidth(); // list isn't empty last_bw = 0; for (item_it = m_item_list.begin(); item_it != item_it_end; ++item_it) { if (!(*item_it)->active()) {

@@ -934,9 +939,9 @@ extra = 1;

--rounding_error; } - (*item_it)->moveResize(next_x, -borderW, extra + relative_width, height()); + (*item_it)->moveResize(next_x - borderW, -borderW, extra + relative_width, height()); } else { // fixed size - (*item_it)->moveResize(next_x, -borderW, + (*item_it)->moveResize(next_x - borderW, -borderW, (*item_it)->width(), height()); } next_x += (*item_it)->width();
M src/WorkspaceNameTool.ccsrc/WorkspaceNameTool.cc

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: WorkspaceNameTool.cc,v 1.7 2004/01/13 14:41:32 rathnor Exp $ +// $Id: WorkspaceNameTool.cc,v 1.8 2004/06/16 15:38:19 rathnor Exp $ #include "WorkspaceNameTool.hh"

@@ -125,5 +125,4 @@ m_button.setBorderWidth(m_theme.border().width());

m_button.setBorderColor(m_theme.border().color()); m_button.setAlpha(m_theme.alpha()); m_button.clear(); - m_button.updateTransparent(); }