Changeset View
Changeset View
Standalone View
Standalone View
layers.cpp
Show First 20 Lines • Show All 522 Lines • ▼ Show 20 Line(s) | 522 | for (Layer lay = FirstLayer; | |||
---|---|---|---|---|---|
523 | lay < NumLayers; | 523 | lay < NumLayers; | ||
524 | ++lay) | 524 | ++lay) | ||
525 | stacking += layer[ lay ]; | 525 | stacking += layer[ lay ]; | ||
526 | // now keep transients above their mainwindows | 526 | // now keep transients above their mainwindows | ||
527 | // TODO this could(?) use some optimization | 527 | // TODO this could(?) use some optimization | ||
528 | for (int i = stacking.size() - 1; | 528 | for (int i = stacking.size() - 1; | ||
529 | i >= 0; | 529 | i >= 0; | ||
530 | ) { | 530 | ) { | ||
531 | AbstractClient *current = qobject_cast<AbstractClient*>(stacking[i]); | | |||
532 | if (!current || !current->isTransient()) { | | |||
533 | --i; | | |||
534 | continue; | | |||
535 | } | | |||
536 | int i2 = -1; | 531 | int i2 = -1; | ||
532 | bool hasTransients = false; | ||||
533 | | ||||
534 | if (auto *current = qobject_cast<AbstractClient *>(stacking[i])) { | ||||
535 | if (current->isTransient()) { | ||||
537 | Client *ccurrent = qobject_cast<Client*>(current); | 536 | Client *ccurrent = qobject_cast<Client*>(current); | ||
538 | if (ccurrent && ccurrent->groupTransient()) { | 537 | if (ccurrent && ccurrent->groupTransient()) { | ||
539 | if (ccurrent->group()->members().count() > 0) { | 538 | if (ccurrent->group()->members().count() > 0) { | ||
540 | // find topmost client this one is transient for | 539 | // find topmost client this one is transient for | ||
541 | for (i2 = stacking.size() - 1; | 540 | for (i2 = stacking.size() - 1; | ||
542 | i2 >= 0; | 541 | i2 >= 0; | ||
543 | --i2) { | 542 | --i2) { | ||
544 | if (stacking[ i2 ] == stacking[ i ]) { | 543 | if (stacking[ i2 ] == stacking[ i ]) { | ||
Show All 21 Lines | 564 | if (c2 == current) { | |||
566 | i2 = -1; // don't reorder, already on top of its mainwindow | 565 | i2 = -1; // don't reorder, already on top of its mainwindow | ||
567 | break; | 566 | break; | ||
568 | } | 567 | } | ||
569 | if (c2 == current->transientFor() | 568 | if (c2 == current->transientFor() | ||
570 | && keepTransientAbove(c2, current)) | 569 | && keepTransientAbove(c2, current)) | ||
571 | break; | 570 | break; | ||
572 | } | 571 | } | ||
573 | } | 572 | } | ||
573 | hasTransients = !current->transients().isEmpty(); | ||||
574 | } | ||||
575 | } else if (auto *deleted = qobject_cast<Deleted *>(stacking[i])) { | ||||
576 | if (deleted->wasTransient()) { | ||||
577 | for (i2 = stacking.size() - 1; i2 >= 0; --i2) { | ||||
578 | const Toplevel *toplevel = stacking[i2]; | ||||
579 | | ||||
580 | if (toplevel == deleted) { | ||||
581 | i2 = -1; | ||||
582 | break; | ||||
583 | } | ||||
584 | | ||||
585 | // TODO: Check whether we have to keep the transient above? | ||||
586 | if (toplevel == deleted->wasTransientFor()) { | ||||
587 | break; | ||||
588 | } | ||||
589 | } | ||||
590 | | ||||
591 | hasTransients = !deleted->transients().isEmpty(); | ||||
592 | } | ||||
593 | } | ||||
574 | if (i2 == -1) { | 594 | if (i2 == -1) { | ||
575 | --i; | 595 | --i; | ||
576 | continue; | 596 | continue; | ||
577 | } | 597 | } | ||
598 | Toplevel *current = stacking[i]; | ||||
578 | stacking.removeAt(i); | 599 | stacking.removeAt(i); | ||
579 | --i; // move onto the next item (for next for () iteration) | 600 | --i; // move onto the next item (for next for () iteration) | ||
580 | --i2; // adjust index of the mainwindow after the remove above | 601 | --i2; // adjust index of the mainwindow after the remove above | ||
581 | if (!current->transients().isEmpty()) // this one now can be possibly above its transients, | 602 | if (hasTransients) // this one now can be possibly above its transients, | ||
582 | i = i2; // so go again higher in the stack order and possibly move those transients again | 603 | i = i2; // so go again higher in the stack order and possibly move those transients again | ||
583 | ++i2; // insert after (on top of) the mainwindow, it's ok if it2 is now stacking.end() | 604 | ++i2; // insert after (on top of) the mainwindow, it's ok if it2 is now stacking.end() | ||
584 | stacking.insert(i2, current); | 605 | stacking.insert(i2, current); | ||
585 | } | 606 | } | ||
586 | return stacking; | 607 | return stacking; | ||
587 | } | 608 | } | ||
588 | 609 | | |||
589 | void Workspace::blockStackingUpdates(bool block) | 610 | void Workspace::blockStackingUpdates(bool block) | ||
▲ Show 20 Lines • Show All 233 Lines • Show Last 20 Lines |