X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fscreen.cc;h=d925ff5c603803b360a0b9d0db55ac34e41fd165;hb=7175ac2b5aec7aface6a2f86df32dd0386e0cc05;hp=991d3dc50aaefe3ea809cb39c13faec17ea2d91a;hpb=00e2c5aaad4a0831fd1e0d1b1c287df4d6eaac93;p=chaz%2Fopenbox diff --git a/src/screen.cc b/src/screen.cc index 991d3dc5..d925ff5c 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -502,8 +502,14 @@ void OBScreen::manageWindow(Window window) Openbox::instance->addClient(client->frame->grip_left(), client); Openbox::instance->addClient(client->frame->grip_right(), client); - // XXX: if on the current desktop.. - client->frame->show(); + bool shown = false; + + // if on the current desktop.. (or all desktops) + if (client->desktop() == _desktop || + client->desktop() == (signed)0xffffffff) { + shown = true; + client->frame->show(); + } // XXX: handle any requested states such as maximized @@ -519,9 +525,11 @@ void OBScreen::manageWindow(Window window) Openbox::instance->bindings()->grabButtons(true, client); - // XXX: make this optional or more intelligent - if (client->normal()) - client->focus(); + if (shown) { + // XXX: make this optional or more intelligent + if (client->normal()) + client->focus(); + } // call the python NEWWINDOW binding EventData *data = new_event_data(window, EventNewWindow, 0); @@ -551,7 +559,7 @@ void OBScreen::unmanageWindow(OBClient *client) OBClient *newfocus = 0; OBClient::List::iterator it, end = _stacking.end(); for (it = _stacking.begin(); it != end; ++it) - if ((*it)->normal() && (*it)->focus()) { + if ((*it)->desktop() == _desktop && (*it)->normal() && (*it)->focus()) { newfocus = *it; break; } @@ -630,6 +638,8 @@ void OBScreen::changeDesktop(long desktop) if (!(desktop >= 0 && desktop < _num_desktops)) return; + printf("Moving to desktop %ld\n", desktop); + long old = _desktop; _desktop = desktop; @@ -641,9 +651,9 @@ void OBScreen::changeDesktop(long desktop) OBClient::List::iterator it, end = clients.end(); for (it = clients.begin(); it != end; ++it) { if ((*it)->desktop() == old) { - // XXX hide + (*it)->frame->hide(); } else if ((*it)->desktop() == _desktop) { - // XXX show + (*it)->frame->show(); } } } @@ -654,6 +664,8 @@ void OBScreen::changeNumDesktops(long num) if (!(num > 0)) return; + // XXX: move windows on desktops that will no longer exist! + _num_desktops = num; Openbox::instance->property()->set(_info->rootWindow(), otk::OBProperty::net_number_of_desktops,