diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/Screen.cc | 44 |
2 files changed, 24 insertions, 25 deletions
@@ -1,5 +1,10 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 1.0rc3: | 2 | Changes for 1.0rc3: |
3 | *06/07/27: | ||
4 | * Don't change the order of creating windows with transients on restart. | ||
5 | Rather, just move the transient to the end of the list. This preserves the | ||
6 | focused order and also reduces the complexity to O(n). (Mark) | ||
7 | Screen.cc | ||
3 | *06/07/26: | 8 | *06/07/26: |
4 | * Fixed torn menus so they don't close on exec items (Mark) | 9 | * Fixed torn menus so they don't close on exec items (Mark) |
5 | FbTk/Menu.cc | 10 | FbTk/Menu.cc |
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 | ||