From 4dec832b6bcef0503ac092a8cfdc370ab65f8f8f Mon Sep 17 00:00:00 2001 From: mathias Date: Wed, 19 Oct 2005 04:46:05 +0000 Subject: Fixed reordering of tabs, patch from Rob Stevens --- ChangeLog | 3 +++ src/FbWinFrame.cc | 22 ++++++++++++++++------ src/FbWinFrame.hh | 4 ++++ src/Window.cc | 10 +++++----- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f249a5..4491073 100644 --- a/ChangeLog +++ b/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 ) util/fluxbox-generate_menu.in util/startfluxbox.in diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 53d1d2c..b2ce864 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -382,19 +382,29 @@ void FbWinFrame::moveLabelButtonTo(FbTk::TextButton &btn, int x, int y) { 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) { diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh index 961e8c5..9b625fc 100644 --- a/src/FbWinFrame.hh +++ b/src/FbWinFrame.hh @@ -179,6 +179,10 @@ public: 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; } diff --git a/src/Window.cc b/src/Window.cc index 2190c5c..82df391 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -895,7 +895,7 @@ FluxboxWindow::ClientList::iterator FluxboxWindow::getClientInsertPosition(int x 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 @@ FluxboxWindow::ClientList::iterator FluxboxWindow::getClientInsertPosition(int x 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 @@ void FluxboxWindow::moveClientTo(WinClient &win, int x, int y) { 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); -- cgit v0.11.2