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
FluxboxWindow *win;
if ((win = findGroupLeft(*winclient)) != 0) {
WinClient *other;
if ((other = findGroupLeft(*winclient)) && (win = other->fbwindow())) {
win->attachClient(*winclient);
Fluxbox::instance()->attachSignals(*winclient);
} else {
@ -1369,11 +1370,10 @@ FluxboxWindow *BScreen::createWindow(Window client) {
// we also need to check if another window expects this window to the left
// and if so, then join it.
FluxboxWindow *otherwin = 0;
// TODO: does this do the right stuff focus-wise?
if ((otherwin = findGroupRight(*winclient)) && otherwin != win) {
win->attachClient(otherwin->winClient());
}
if ((other = findGroupRight(*winclient)) && other->fbwindow() != win)
win->attachClient(*other);
else if (other)
win->moveClientRightOf(*other, *winclient);
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
*/
FluxboxWindow *BScreen::findGroupLeft(WinClient &winclient) {
WinClient *BScreen::findGroupLeft(WinClient &winclient) {
Window w = winclient.getGroupLeftWindow();
if (w == None)
return 0;
@ -2051,13 +2051,10 @@ FluxboxWindow *BScreen::findGroupLeft(WinClient &winclient) {
// something is not consistent
return 0;
if (have_client)
return have_client->fbwindow();
else
return 0;
return have_client;
}
FluxboxWindow *BScreen::findGroupRight(WinClient &winclient) {
WinClient *BScreen::findGroupRight(WinClient &winclient) {
Groupables::iterator it = m_expecting_groups.find(winclient.window());
if (it == m_expecting_groups.end())
return 0;
@ -2073,8 +2070,9 @@ FluxboxWindow *BScreen::findGroupRight(WinClient &winclient) {
other->getGroupLeftWindow() != None)
return 0;
return other->fbwindow();
return other;
}
void BScreen::initXinerama() {
#ifdef XINERAMA
Display *display = FbTk::App::instance()->display();

View file

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

View file

@ -623,6 +623,8 @@ Window WinClient::getGroupLeftWindow() const {
void WinClient::setGroupLeftWindow(Window win) {
if (m_screen.isShuttingdown())
return;
Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False);
changeProperty(group_left_hint, XA_WINDOW, 32,
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 *focused_win = FocusControl::focusedWindow();
WinClient *other = m_screen.findGroupLeft(client);
// get the current window on the end of our client list
Window leftwin = None;
if (!clientList().empty())
@ -691,6 +692,9 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
client.saveBlackboxAttribs(m_blackbox_attrib);
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