aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-07-04 01:03:41 (GMT)
committerrathnor <rathnor>2003-07-04 01:03:41 (GMT)
commit3144086eef171f6c402182f23bfc80a101e71fa2 (patch)
tree0df61dbcb4a7ce44fd90369b031e5a39037807c0 /src/Window.cc
parent672ac023526d61af2e102a3a27b67eeedb2c4f10 (diff)
downloadfluxbox-3144086eef171f6c402182f23bfc80a101e71fa2.zip
fluxbox-3144086eef171f6c402182f23bfc80a101e71fa2.tar.bz2
support in remember for specifying groups.
Also split atomhandler::setupWindow
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc55
1 files changed, 47 insertions, 8 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 7b14cb5..f5c4fb9 100644
--- a/src/Window.cc
+++ b/src/Window.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: Window.cc,v 1.201 2003/07/02 05:27:40 fluxgen Exp $ 25// $Id: Window.cc,v 1.202 2003/07/04 01:03:40 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -557,11 +557,8 @@ void FluxboxWindow::attachClient(WinClient &client) {
557 557
558 // get the current window on the end of our client list 558 // get the current window on the end of our client list
559 Window leftwin = None; 559 Window leftwin = None;
560 ClientList::iterator client_it = clientList().end(); 560 if (!clientList().empty())
561 ClientList::iterator client_it_end = clientList().end(); 561 leftwin = clientList().back()->window();
562 --client_it;
563 if (client_it != client_it_end)
564 leftwin = (*client_it)->window();
565 562
566 client.setGroupLeftWindow(leftwin); 563 client.setGroupLeftWindow(leftwin);
567 564
@@ -570,8 +567,8 @@ void FluxboxWindow::attachClient(WinClient &client) {
570 567
571 Fluxbox *fb = Fluxbox::instance(); 568 Fluxbox *fb = Fluxbox::instance();
572 // make sure we set new window search for each client 569 // make sure we set new window search for each client
573 client_it = old_win->clientList().begin(); 570 ClientList::iterator client_it = old_win->clientList().begin();
574 client_it_end = old_win->clientList().end(); 571 ClientList::iterator client_it_end = old_win->clientList().end();
575 for (; client_it != client_it_end; ++client_it) { 572 for (; client_it != client_it_end; ++client_it) {
576 // setup eventhandlers for client 573 // setup eventhandlers for client
577 fb->saveWindowSearch((*client_it)->window(), this); 574 fb->saveWindowSearch((*client_it)->window(), this);
@@ -638,6 +635,7 @@ void FluxboxWindow::attachClient(WinClient &client) {
638 635
639 Fluxbox::instance()->saveWindowSearch(client.window(), this); 636 Fluxbox::instance()->saveWindowSearch(client.window(), this);
640 client.saveBlackboxAttribs(m_blackbox_attrib); 637 client.saveBlackboxAttribs(m_blackbox_attrib);
638 m_clientlist.push_back(&client);
641 } 639 }
642 640
643 // make sure that the state etc etc is updated for the new client 641 // make sure that the state etc etc is updated for the new client
@@ -659,6 +657,46 @@ bool FluxboxWindow::detachClient(WinClient &client) {
659 if (client.m_win != this || numClients() <= 1) 657 if (client.m_win != this || numClients() <= 1)
660 return false; 658 return false;
661 659
660 // I'm not sure how to do this bit better
661 // we need to find the window we've got, and update the
662 // window to its right to have a left window set to the
663 // window which is to the left of the current.
664 // Think in terms of:
665 // window1 <- my_window <- window2
666 // we need to take out my_window, so update window2 leftwin to be window1
667
668 Window leftwin = None;
669 ClientList::iterator client_it_end = clientList().end();
670 ClientList::iterator client_it = clientList().begin();
671 ClientList::iterator client_it_before = client_it_end;
672 ClientList::iterator client_it_after = clientList().begin();
673 if (!clientList().empty()) {
674 ++client_it_after;
675 if (clientList().front() == &client) {
676 leftwin = None;
677 } else {
678 ++client_it;
679 client_it_before = clientList().begin();
680 ++client_it_after;
681
682 while (client_it != client_it_end) {
683 if (*client_it == &client) {
684 break;
685 }
686 ++client_it_before;
687 ++client_it;
688 ++client_it_after;
689 }
690 }
691 }
692
693 // update the leftwin of the window to the right
694 if (client_it_before != client_it_end)
695 leftwin = (*client_it_before)->window();
696
697 if (client_it_after != client_it_end)
698 (*client_it_after)->setGroupLeftWindow(leftwin);
699
662 removeClient(client); 700 removeClient(client);
663 701
664 client.m_win = screen().createWindow(client); 702 client.m_win = screen().createWindow(client);
@@ -2998,6 +3036,7 @@ void FluxboxWindow::restore(bool remap) {
2998 3036
2999 while (!clientList().empty()) { 3037 while (!clientList().empty()) {
3000 restore(clientList().back(), remap); 3038 restore(clientList().back(), remap);
3039 // deleting winClient removes it from the clientList
3001 } 3040 }
3002} 3041}
3003 3042