| 686 | } |
| 687 | |
| 688 | WindowPosition MainWindow::nextInitialChildPosition(SeparateId childId) { |
| 689 | const auto rect = geometry().marginsRemoved(frameMargins()); |
| 690 | const auto position = rect.topLeft(); |
| 691 | const auto adjust = [&](int value) { |
| 692 | return (value * 3 / 4); |
| 693 | }; |
| 694 | const auto width = OptionNewWindowsSizeAsFirst.value() |
| 695 | ? Core::App().settings().windowPosition().w |
| 696 | : childId.primary() |
| 697 | ? st::windowDefaultWidth |
| 698 | : childId.hasChatsList() |
| 699 | ? (st::columnMinimalWidthLeft + adjust(st::windowDefaultWidth)) |
| 700 | : adjust(st::windowDefaultWidth); |
| 701 | const auto height = OptionNewWindowsSizeAsFirst.value() |
| 702 | ? Core::App().settings().windowPosition().h |
| 703 | : childId.primary() |
| 704 | ? st::windowDefaultHeight |
| 705 | : adjust(st::windowDefaultHeight); |
| 706 | const auto skip = ChildSkip(); |
| 707 | const auto delta = _lastChildIndex |
| 708 | ? (_lastMyChildCreatePosition - position) |
| 709 | : skip; |
| 710 | if (qAbs(delta.x()) >= skip.x() || qAbs(delta.y()) >= skip.y()) { |
| 711 | _lastChildIndex = 1; |
| 712 | } else { |
| 713 | ++_lastChildIndex; |
| 714 | } |
| 715 | |
| 716 | _lastMyChildCreatePosition = position; |
| 717 | const auto use = position + (skip * _lastChildIndex); |
| 718 | return withScreenInPosition({ |
| 719 | .scale = cScale(), |
| 720 | .x = use.x(), |
| 721 | .y = use.y(), |
| 722 | .w = width, |
| 723 | .h = height, |
| 724 | }); |
| 725 | } |
| 726 | |
| 727 | QRect MainWindow::countInitialGeometry(WindowPosition position) { |
| 728 | const auto primaryScreen = QGuiApplication::primaryScreen(); |
no test coverage detected