Fixed reordering of tabs, patch from Rob Stevens
This commit is contained in:
parent
97aa10ece4
commit
4dec832b6b
4 changed files with 28 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue