aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2006-07-27 00:04:11 (GMT)
committermarkt <markt>2006-07-27 00:04:11 (GMT)
commit7de8cabccfa4ad89923017198c4ace19152046b7 (patch)
tree4918f3b45ed3d7e919e1204a2b40f4410dd034cc /src
parent0954a0b61d067d86047d0755a64b953bd12e4c20 (diff)
downloadfluxbox_pavel-7de8cabccfa4ad89923017198c4ace19152046b7.zip
fluxbox_pavel-7de8cabccfa4ad89923017198c4ace19152046b7.tar.bz2
don't switch windows with transients in initWindows() - just do transient later
Diffstat (limited to 'src')
-rw-r--r--src/Screen.cc44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 38ca9ff..d067177 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -569,10 +569,19 @@ void BScreen::initWindows() {
569 Fluxbox *fluxbox = Fluxbox::instance(); 569 Fluxbox *fluxbox = Fluxbox::instance();
570 570
571 // manage shown windows 571 // manage shown windows
572 // complexity: O(n^2) if we have lots of transients to transient_for
573 // but usually O(n)
574 Window transient_for = 0; 572 Window transient_for = 0;
575 for (unsigned int i = 0; i < nchild; ++i) { 573 bool safety_flag = false;
574 unsigned int num_transients = 0;
575 for (unsigned int i = 0; i <= nchild; ++i) {
576 if (i == nchild) {
577 if (num_transients) {
578 nchild = num_transients;
579 i = num_transients = 0;
580 safety_flag = true;
581 } else
582 break;
583 }
584
576 if (children[i] == None) 585 if (children[i] == None)
577 continue; 586 continue;
578 else if (!fluxbox->validateWindow(children[i])) { 587 else if (!fluxbox->validateWindow(children[i])) {
@@ -584,33 +593,18 @@ void BScreen::initWindows() {
584 } 593 }
585 594
586 // if we have a transient_for window and it isn't created yet... 595 // if we have a transient_for window and it isn't created yet...
587 // postpone creation of this window and find transient_for window 596 // postpone creation of this window until after all others
588 // in the list and swap place with it so we can create transient_for window
589 // first
590 if (XGetTransientForHint(disp, children[i], &transient_for) && 597 if (XGetTransientForHint(disp, children[i], &transient_for) &&
591 fluxbox->searchWindow(transient_for) == 0) { 598 fluxbox->searchWindow(transient_for) == 0 && !safety_flag) {
592 // search forward for transient_for 599 // add this window back to the beginning of the list of children
593 // and swap place with it so it gets created first 600 children[num_transients] = children[i];
594 unsigned int j = i + 1; 601 num_transients++;
595 for (; j < nchild; ++j) {
596 if (children[j] == transient_for) {
597 swap(children[i], children[j]);
598 break;
599 }
600 }
601 // reevaluate window
602 if (!fluxbox->validateWindow(children[i]))
603 continue;
604 602
605#ifdef DEBUG 603#ifdef DEBUG
606 cerr<<"BScreen::initWindows(): j = "<<j<<" i = "<<i<<" nchild = "<<nchild<<endl; 604 cerr<<"BScreen::initWindows(): postpone creation of 0x"<<hex<<children[i]<<dec<<endl;
607
608 if (j < nchild)
609 cerr<<"BScreen::initWindows(): postpone creation of 0x"<<hex<<children[j]<<dec<<endl;
610 else
611 cerr<<"BScreen::initWindows(): postpone creation of 0x"<<hex<<children[i]<<dec<<endl;
612 cerr<<"BScreen::initWindows(): transient_for = 0x"<<hex<<transient_for<<dec<<endl; 605 cerr<<"BScreen::initWindows(): transient_for = 0x"<<hex<<transient_for<<dec<<endl;
613#endif // DEBUG 606#endif // DEBUG
607 continue;
614 } 608 }
615 609
616 610