keep tabs in same order on restart (except some extremely unlikely cases)

This commit is contained in:
markt 2006-07-20 03:25:28 +00:00
parent a736f12ac5
commit f4d1af1208
4 changed files with 20 additions and 16 deletions

View file

@ -1343,7 +1343,8 @@ FluxboxWindow *BScreen::createWindow(Window client) {
// check if it should be grouped with something else // check if it should be grouped with something else
FluxboxWindow *win; FluxboxWindow *win;
if ((win = findGroupLeft(*winclient)) != 0) { WinClient *other;
if ((other = findGroupLeft(*winclient)) && (win = other->fbwindow())) {
win->attachClient(*winclient); win->attachClient(*winclient);
Fluxbox::instance()->attachSignals(*winclient); Fluxbox::instance()->attachSignals(*winclient);
} else { } else {
@ -1369,11 +1370,10 @@ FluxboxWindow *BScreen::createWindow(Window client) {
// we also need to check if another window expects this window to the left // we also need to check if another window expects this window to the left
// and if so, then join it. // and if so, then join it.
FluxboxWindow *otherwin = 0; if ((other = findGroupRight(*winclient)) && other->fbwindow() != win)
// TODO: does this do the right stuff focus-wise? win->attachClient(*other);
if ((otherwin = findGroupRight(*winclient)) && otherwin != win) { else if (other)
win->attachClient(otherwin->winClient()); win->moveClientRightOf(*other, *winclient);
}
m_clientlist_sig.notify(); m_clientlist_sig.notify();
@ -2034,10 +2034,10 @@ void BScreen::updateSize() {
/** /**
* Find the group of windows to this window's left * Find the winclient to this window's left
* So, we check the leftgroup hint, and see if we know any windows * So, we check the leftgroup hint, and see if we know any windows
*/ */
FluxboxWindow *BScreen::findGroupLeft(WinClient &winclient) { WinClient *BScreen::findGroupLeft(WinClient &winclient) {
Window w = winclient.getGroupLeftWindow(); Window w = winclient.getGroupLeftWindow();
if (w == None) if (w == None)
return 0; return 0;
@ -2051,13 +2051,10 @@ FluxboxWindow *BScreen::findGroupLeft(WinClient &winclient) {
// something is not consistent // something is not consistent
return 0; return 0;
if (have_client) return have_client;
return have_client->fbwindow();
else
return 0;
} }
FluxboxWindow *BScreen::findGroupRight(WinClient &winclient) { WinClient *BScreen::findGroupRight(WinClient &winclient) {
Groupables::iterator it = m_expecting_groups.find(winclient.window()); Groupables::iterator it = m_expecting_groups.find(winclient.window());
if (it == m_expecting_groups.end()) if (it == m_expecting_groups.end())
return 0; return 0;
@ -2073,8 +2070,9 @@ FluxboxWindow *BScreen::findGroupRight(WinClient &winclient) {
other->getGroupLeftWindow() != None) other->getGroupLeftWindow() != None)
return 0; return 0;
return other->fbwindow(); return other;
} }
void BScreen::initXinerama() { void BScreen::initXinerama() {
#ifdef XINERAMA #ifdef XINERAMA
Display *display = FbTk::App::instance()->display(); Display *display = FbTk::App::instance()->display();

View file

@ -327,8 +327,8 @@ public:
// grouping - we want ordering, so we can either search for a // grouping - we want ordering, so we can either search for a
// group to the left, or to the right (they'll be different if // group to the left, or to the right (they'll be different if
// they exist). // they exist).
FluxboxWindow *findGroupLeft(WinClient &winclient); WinClient *findGroupLeft(WinClient &winclient);
FluxboxWindow *findGroupRight(WinClient &winclient); WinClient *findGroupRight(WinClient &winclient);
// notify netizens // notify netizens
void updateNetizenCurrentWorkspace(); void updateNetizenCurrentWorkspace();

View file

@ -623,6 +623,8 @@ Window WinClient::getGroupLeftWindow() const {
void WinClient::setGroupLeftWindow(Window win) { void WinClient::setGroupLeftWindow(Window win) {
if (m_screen.isShuttingdown())
return;
Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False); Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False);
changeProperty(group_left_hint, XA_WINDOW, 32, changeProperty(group_left_hint, XA_WINDOW, 32,
PropModeReplace, (unsigned char *) &win, 1); PropModeReplace, (unsigned char *) &win, 1);

View file

@ -628,6 +628,7 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
WinClient *was_focused = 0; WinClient *was_focused = 0;
WinClient *focused_win = FocusControl::focusedWindow(); WinClient *focused_win = FocusControl::focusedWindow();
WinClient *other = m_screen.findGroupLeft(client);
// get the current window on the end of our client list // get the current window on the end of our client list
Window leftwin = None; Window leftwin = None;
if (!clientList().empty()) if (!clientList().empty())
@ -691,6 +692,9 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
client.saveBlackboxAttribs(m_blackbox_attrib); client.saveBlackboxAttribs(m_blackbox_attrib);
m_clientlist.push_back(&client); m_clientlist.push_back(&client);
if (other && other->fbwindow() == this)
moveClientRightOf(client, *other);
} }
// make sure that the state etc etc is updated for the new client // make sure that the state etc etc is updated for the new client