aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-07-14 12:13:29 (GMT)
committerfluxgen <fluxgen>2004-07-14 12:13:29 (GMT)
commit9cee51bdf0bd48d50d90460b85321e54a4209b68 (patch)
tree12228893229677f7c441ea12eaf1da3b055dd895 /src/Screen.cc
parent18aab356ff8756bc9965b8071c8f431d8f5d7cc3 (diff)
downloadfluxbox-9cee51bdf0bd48d50d90460b85321e54a4209b68.zip
fluxbox-9cee51bdf0bd48d50d90460b85321e54a4209b68.tar.bz2
fixed bug in transient window creation at startup
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc90
1 files changed, 74 insertions, 16 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 14a701f..41f9ec5 100644
--- a/src/Screen.cc
+++ b/src/Screen.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: Screen.cc,v 1.283 2004/06/21 15:23:41 rathnor Exp $ 25// $Id: Screen.cc,v 1.284 2004/07/14 12:13:29 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -436,10 +436,26 @@ void BScreen::initWindows() {
436 Display *disp = FbTk::App::instance()->display(); 436 Display *disp = FbTk::App::instance()->display();
437 XQueryTree(disp, rootWindow().window(), &r, &p, &children, &nchild); 437 XQueryTree(disp, rootWindow().window(), &r, &p, &children, &nchild);
438 438
439 // Count number of windows created and when this counter reaches zero
440 // we've created all windows.
441 // We need to do this because sometimes the transient windows are
442 // before the transient_for windows in the list and we need to
443 // postpone the creation of transient windows until the transient_for
444 // is created (see: WinClient::updateTransientInfo())
445 //
446 // - Henrik
447 int created = nchild; // number of created/managed windows
448
449 Fluxbox *fluxbox = Fluxbox::instance();
450
439 // preen the window list of all icon windows... for better dockapp support 451 // preen the window list of all icon windows... for better dockapp support
440 for (int i = 0; i < (int) nchild; i++) { 452 for (int i = 0; i < (int) nchild; i++) {
441 453
442 if (children[i] == None) continue; 454 if (children[i] == None) {
455 // we dont use this window, decrease counter
456 created--;
457 continue;
458 }
443 459
444 XWMHints *wmhints = XGetWMHints(disp, children[i]); 460 XWMHints *wmhints = XGetWMHints(disp, children[i]);
445 461
@@ -454,29 +470,71 @@ void BScreen::initWindows() {
454 } 470 }
455 XFree(wmhints); 471 XFree(wmhints);
456 } 472 }
473
474 // we dont use this window, decrease counter
475 if (children[i] == None || (! fluxbox->validateWindow(children[i])))
476 created--;
457 } 477 }
458 478
459 // manage shown windows 479 // manage shown windows
460 Fluxbox *fluxbox = Fluxbox::instance(); 480 Window transient_for = 0;
461 for (int i = 0; i < (int) nchild; ++i) { 481 int safety_counter = nchild*nchild;
462 if (children[i] == None || (! fluxbox->validateWindow(children[i]))) 482 while (created > 0) {
463 continue; 483
484 if (--safety_counter < 0) {
485 cerr<<"BScreen::initWindows() Warning!!! Safety counter reached!"<<endl;
486 cerr<<"--------------"<<endl;
487 cerr<<"created = "<<created<<hex<<endl;
488 for (int i=0; i < nchild; ++i)
489 cerr<<"child("<<i<<") = 0x"<<children[i]<<endl;
490 cerr<<dec<<"--------------"<<endl;
491 cerr<<"Please report this to fluxbox development team."<<endl;
464 492
465 XWindowAttributes attrib; 493 break;
466 if (XGetWindowAttributes(disp, children[i], 494 }
467 &attrib)) { 495
468 if (attrib.override_redirect) 496 for (int i = 0; i < (int) nchild; ++i) {
497 if (children[i] == None || (! fluxbox->validateWindow(children[i]))) {
498#ifdef DEBUG
499 cerr<<"BScreen::initWindows(): created = "<<created<<endl;
500#endif // DEBUG
469 continue; 501 continue;
502 }
470 503
471 if (attrib.map_state != IsUnmapped) { 504 // if we have a transient_for window and it isn't created yet...
472 FluxboxWindow *win = createWindow(children[i]); 505 // postpone creation of this window until transient_for is created
506 // See comment at the begining
507 if (XGetTransientForHint(disp, children[i], &transient_for) &&
508 fluxbox->searchWindow(transient_for) == 0)
509 continue;
510
511
512 XWindowAttributes attrib;
513 if (XGetWindowAttributes(disp, children[i],
514 &attrib)) {
515 if (attrib.override_redirect) {
516 children[i] = None; // we dont need this anymore, since we already created a window for it
517 // we "created" a window...decrease creation counter
518 if (--created <= 0)
519 break; // end for-loop
520 continue;
521 }
522
523 if (attrib.map_state != IsUnmapped) {
524 FluxboxWindow *win = createWindow(children[i]);
473 525
474 if (win) { 526 if (win) {
475 XMapRequestEvent mre; 527 XMapRequestEvent mre;
476 mre.window = children[i]; 528 mre.window = children[i];
477 win->mapRequestEvent(mre); 529 win->mapRequestEvent(mre);
530 }
478 } 531 }
479 } 532 }
533 children[i] = None; // we dont need this anymore, since we already created a window for it
534 // we created a window...decrease creation counter
535 if (--created <= 0)
536 break; // end for-loop
537
480 } 538 }
481 } 539 }
482 540