aboutsummaryrefslogtreecommitdiff
path: root/src/Workspace.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r--src/Workspace.cc70
1 files changed, 20 insertions, 50 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index ae986ad..f7bcb83 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Workspace.cc,v 1.58 2003/05/04 23:38:06 rathnor Exp $ 25// $Id: Workspace.cc,v 1.59 2003/05/07 16:21:26 rathnor Exp $
26 26
27#include "Workspace.hh" 27#include "Workspace.hh"
28 28
@@ -57,13 +57,13 @@ using namespace std;
57 57
58namespace { // anonymous 58namespace { // anonymous
59 59
60int countTransients(const FluxboxWindow &win) { 60int countTransients(const WinClient &client) {
61 if (win.getTransients().size() == 0) 61 if (client.transientList().empty())
62 return 0; 62 return 0;
63 // now go throu the entire tree and count transients 63 // now go throu the entire tree and count transients
64 size_t ret = win.getTransients().size(); 64 size_t ret = client.transientList().size();
65 std::list<FluxboxWindow *>::const_iterator it = win.getTransients().begin(); 65 WinClient::TransientList::const_iterator it = client.transientList().begin();
66 std::list<FluxboxWindow *>::const_iterator it_end = win.getTransients().end(); 66 WinClient::TransientList::const_iterator it_end = client.transientList().end();
67 for (; it != it_end; ++it) 67 for (; it != it_end; ++it)
68 ret += countTransients(*(*it)); 68 ret += countTransients(*(*it));
69 69
@@ -219,52 +219,22 @@ int Workspace::removeWindow(FluxboxWindow *w) {
219 if (w->isFocused()) { 219 if (w->isFocused()) {
220 if (screen.isSloppyFocus()) { 220 if (screen.isSloppyFocus()) {
221 Fluxbox::instance()->revertFocus(&screen); 221 Fluxbox::instance()->revertFocus(&screen);
222 } else if (w->isTransient() && w->getTransientFor() &&
223 w->getTransientFor()->isVisible()) {
224 w->getTransientFor()->setInputFocus();
225 } else { 222 } else {
226 FluxboxWindow *top = 0; 223 // go up the transient tree looking for a focusable window
227 224 WinClient *client = 0;
228 // this bit is pretty dodgy at present 225 if (w->numClients() > 0) {
229 // it gets the next item down, then scans through our windowlist to see if it is 226 client = w->winClient().transientFor();
230 // in this workspace. If not, goes down more 227 while (client) {
231 /* //!! TODO! FbTk::XLayerItem *item = 0, *lastitem = w->getLayerItem(); 228 if (client->fbwindow() &&
232 do { 229 client->fbwindow() != w && // can't be this window
233 item = m_layermanager.getItemBelow(*lastitem); 230 client->fbwindow()->isVisible() &&
234 Windows::iterator it = m_windowlist.begin(); 231 client->fbwindow()->setCurrentClient(*client, true))
235 Windows::iterator it_end = m_windowlist.end(); 232 break;
236 for (; it != it_end; ++it) { 233 client = client->transientFor();
237 if ((*it)->getLayerItem() == item) { 234 }
238 // found one!
239 top = *it;
240 }
241 }
242
243 lastitem = item;
244
245 } while (item && !top);
246
247 if (!top) {
248 // look upwards
249 lastitem = w->getLayerItem();
250 do {
251 item = m_layermanager.getItemAbove(*lastitem);
252 Windows::iterator it = m_windowlist.begin();
253 Windows::iterator it_end = m_windowlist.end();
254 for (; it != it_end; ++it) {
255 if ((*it)->getLayerItem() == item) {
256 // found one!
257 top = *it;
258 }
259 }
260 lastitem = item;
261 } while (item && !top);
262
263 }
264 */
265 if (top == 0|| !top->setInputFocus()) {
266 Fluxbox::instance()->revertFocus(&screen);
267 } 235 }
236 if (client == 0) // we were unsuccessful
237 Fluxbox::instance()->revertFocus(&screen);
268 } 238 }
269 } 239 }
270 240