Fixed reordering of tabs, patch from Rob Stevens
mathias mathias
4 files changed,
28 insertions(+),
11 deletions(-)
M
ChangeLog
→
ChangeLog
@@ -1,5 +1,8 @@
(Format: Year/Month/Day) Changes for 0.9.15: +*05/10/19: + * Fixed reordering of tabs (thanx Rob Stevens) + Window.cc FbWinFrame.hh FbWinFrame.cc *05/10/12: * Small changes, coming from fbsd-ports (thanx Jeremy Messenger <mezz at FreeBSD dot org>) util/fluxbox-generate_menu.in util/startfluxbox.in
M
src/FbWinFrame.cc
→
src/FbWinFrame.cc
@@ -382,19 +382,29 @@
void FbWinFrame::moveLabelButtonLeftOf(FbTk::TextButton &btn, const FbTk::TextButton &dest) { - int pos = m_tab_container.find(&dest); - if (pos < 0) + int dest_pos = m_tab_container.find(&dest); + int cur_pos = m_tab_container.find(&btn); + if (dest_pos < 0 || cur_pos < 0) return; + int movement=dest_pos - cur_pos; + if(movement>0) + movement-=1; +// else + // movement-=1; - m_tab_container.moveItem(&btn, pos-1); + m_tab_container.moveItem(&btn, movement); } void FbWinFrame::moveLabelButtonRightOf(FbTk::TextButton &btn, const FbTk::TextButton &dest) { - int pos = m_tab_container.find(&dest); - if (pos < 0) + int dest_pos = m_tab_container.find(&dest); + int cur_pos = m_tab_container.find(&btn); + if (dest_pos < 0 || cur_pos < 0 ) return; + int movement=dest_pos - cur_pos; + if(movement<0) + movement+=1; - m_tab_container.moveItem(&btn, pos+1); + m_tab_container.moveItem(&btn, movement); } void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn) {
M
src/FbWinFrame.hh
→
src/FbWinFrame.hh
@@ -179,6 +179,10 @@ inline const FbTk::FbWindow &titlebar() const { return m_titlebar; }
inline FbTk::FbWindow &titlebar() { return m_titlebar; } inline const FbTk::FbWindow &label() const { return m_label; } inline FbTk::FbWindow &label() { return m_label; } + + inline const Container &tabcontainer() const { return m_tab_container; } + inline Container &tabcontainer() { return m_tab_container; } + /// @return clientarea window inline const FbTk::FbWindow &clientArea() const { return m_clientarea; } inline FbTk::FbWindow &clientArea() { return m_clientarea; }
M
src/Window.cc
→
src/Window.cc
@@ -895,7 +895,7 @@
int dest_x = 0, dest_y = 0; Window labelbutton = 0; if (!XTranslateCoordinates(FbTk::App::instance()->display(), - parent().window(), frame().label().window(), + parent().window(), frame().tabcontainer().window(), x, y, &dest_x, &dest_y, &labelbutton)) return m_clientlist.end();@@ -915,7 +915,7 @@
Window child_return=0; // make x and y relative to our labelbutton if (!XTranslateCoordinates(FbTk::App::instance()->display(), - frame().label().window(), labelbutton, + frame().tabcontainer().window(), labelbutton, dest_x, dest_y, &x, &y, &child_return)) return m_clientlist.end();@@ -936,7 +936,7 @@ void FluxboxWindow::moveClientTo(WinClient &win, int x, int y) {
int dest_x = 0, dest_y = 0; Window labelbutton = 0; if (!XTranslateCoordinates(FbTk::App::instance()->display(), - parent().window(), frame().label().window(), + parent().window(), frame().tabcontainer().window(), x, y, &dest_x, &dest_y, &labelbutton)) return;@@ -955,11 +955,11 @@
Window child_return = 0; //make x and y relative to our labelbutton if (!XTranslateCoordinates(FbTk::App::instance()->display(), - frame().label().window(), labelbutton, + frame().tabcontainer().window(), labelbutton, dest_x, dest_y, &x, &y, &child_return)) return; - if (x > (*it).second->width() / 2) + if (x > (*it).second->width() / 2) moveClientRightOf(win, *it->first); else moveClientLeftOf(win, *it->first);