all repos — fluxbox @ b8dc91871e116f51a061597e40e60d89d9f715cb

custom fork of the fluxbox windowmanager

couple of alignment fixes, esp for external tabs
simonb simonb
commit

b8dc91871e116f51a061597e40e60d89d9f715cb

parent

891205c10a124f278b4eb9500ba69efa8c443423

3 files changed, 28 insertions(+), 29 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,10 @@

(Format: Year/Month/Day) Changes for 0.9.16: +*06/06/10: + * Fix some external tab alignment on shade (Simon) + FbWinFrame.cc + * Fix container size rounding for right alignment (Simon) + Container.cc *06/06/01: * Update of new manpage (thanx Guillermo Patterer) *06/05/23:
M src/Container.ccsrc/Container.cc

@@ -272,35 +272,10 @@ void Container::setMaxTotalSize(unsigned int size) {

if (m_max_total_size == size) return; - unsigned int old = m_max_total_size; m_max_total_size = size; repositionItems(); return; - - if (m_max_total_size && width() > m_max_total_size) { - resize(m_max_total_size, height()); - } else if (!m_max_total_size && old) { // going from restricted to unrestricted - repositionItems(); - } else { - // this is a bit of duplication from repositionItems - // for when we are allowed to grow ourself - Alignment align = alignment(); - size_t num_items = m_item_list.size(); - if (m_max_total_size && (align == RIGHT || align == LEFT) && - num_items) { - unsigned int max_width_per_client = maxWidthPerClient(); - unsigned int borderW = m_item_list.front()->borderWidth(); - - unsigned int preferred_width = (max_width_per_client + borderW) * num_items - borderW; - - if (preferred_width > m_max_total_size) - preferred_width = m_max_total_size; - - if (preferred_width != width()) - repositionItems(); - } - } } void Container::setAlignment(Container::Alignment a) {

@@ -401,7 +376,6 @@ if (total_width > m_max_total_size) {

total_width = m_max_total_size; if (m_max_total_size > ((num_items - 1)*borderW)) { // don't go negative with unsigned nums max_width_per_client = ( m_max_total_size - (num_items - 1)*borderW ) / num_items; - total_width = (max_width_per_client + borderW) * num_items - borderW; } else max_width_per_client = 1; }

@@ -429,7 +403,11 @@

ItemList::iterator it = m_item_list.begin(); const ItemList::iterator it_end = m_item_list.end(); - int rounding_error = total_width - ((max_width_per_client + borderW)* num_items - borderW); + int rounding_error = 0; + + if (align == RELATIVE || total_width == m_max_total_size) { + rounding_error = total_width - ((max_width_per_client + borderW)* num_items - borderW); + } int next_x = -borderW; // zero so the border of the first shows int extra = 0;

@@ -443,10 +421,16 @@ int tmpx, tmpy;

unsigned int tmpw, tmph; for (; it != it_end; ++it, next_x += direction*(max_width_per_client + borderW + extra)) { // we only need to do error stuff with alignment RELATIVE - if (rounding_error != 0 && align == RELATIVE) { + // OR with max_total_size triggered + if (rounding_error) { --rounding_error; extra = 1; + //counter for different direction + if (align == RIGHT && !extra) + --next_x; } else { + if (extra && align == RIGHT) // last extra + ++next_x; extra = 0; } // rotate the x and y coords
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -348,6 +348,7 @@ case TOPLEFT:

if (orig_orient != FbTk::ROT0) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT0); m_tab_container.setAlignment(Container::LEFT); + m_tab_container.setMaxTotalSize(m_window.width()); tabx = x(); taby = y() - yOffset(); break;

@@ -355,6 +356,7 @@ case TOPRIGHT:

if (orig_orient != FbTk::ROT0) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT0); m_tab_container.setAlignment(Container::RIGHT); + m_tab_container.setMaxTotalSize(m_window.width()); tabx = x() + width() - m_tab_container.width(); taby = y() - yOffset(); break;

@@ -362,6 +364,7 @@ case LEFTTOP:

if (orig_orient != FbTk::ROT270) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT270); m_tab_container.setAlignment(Container::RIGHT); + m_tab_container.setMaxTotalSize(m_window.height()); tabx = x() - xOffset(); taby = y(); break;

@@ -369,6 +372,7 @@ case LEFTBOTTOM:

if (orig_orient != FbTk::ROT270) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT270); m_tab_container.setAlignment(Container::LEFT); + m_tab_container.setMaxTotalSize(m_window.height()); tabx = x() - xOffset(); taby = y() + height() - m_tab_container.height(); break;

@@ -376,6 +380,7 @@ case RIGHTTOP:

if (orig_orient != FbTk::ROT90) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT90); m_tab_container.setAlignment(Container::LEFT); + m_tab_container.setMaxTotalSize(m_window.height()); tabx = x() + width() + m_window.borderWidth(); taby = y(); break;

@@ -383,6 +388,7 @@ case RIGHTBOTTOM:

if (orig_orient != FbTk::ROT90) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT90); m_tab_container.setAlignment(Container::RIGHT); + m_tab_container.setMaxTotalSize(m_window.height()); tabx = x() + width() + m_window.borderWidth(); taby = y() + height() - m_tab_container.height(); break;

@@ -390,6 +396,7 @@ case BOTTOMLEFT:

if (orig_orient != FbTk::ROT0) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT0); m_tab_container.setAlignment(Container::LEFT); + m_tab_container.setMaxTotalSize(m_window.width()); tabx = x(); taby = y() + height() + m_window.borderWidth(); break;

@@ -397,6 +404,7 @@ case BOTTOMRIGHT:

if (orig_orient != FbTk::ROT0) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT0); m_tab_container.setAlignment(Container::RIGHT); + m_tab_container.setMaxTotalSize(m_window.width()); tabx = x() + width() - m_tab_container.width(); taby = y() + height() + m_window.borderWidth(); break;

@@ -404,7 +412,6 @@ }

unsigned int w = m_window.width(), h = m_window.height(); translateSize(m_tab_container.orientation(), w, h); - m_tab_container.setMaxTotalSize(w); if (m_tab_container.orientation() != orig_orient || m_tab_container.maxWidthPerClient() != orig_tabwidth) {

@@ -417,6 +424,9 @@ }

} 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_layeritem.addWindow(m_tab_container); } else {