MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / nextInitialChildPosition

Method nextInitialChildPosition

Telegram/SourceFiles/window/main_window.cpp:688–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

686}
687
688WindowPosition 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
727QRect MainWindow::countInitialGeometry(WindowPosition position) {
728 const auto primaryScreen = QGuiApplication::primaryScreen();

Callers 1

initialPositionMethod · 0.80

Calls 8

AppClass · 0.85
ChildSkipFunction · 0.85
cScaleFunction · 0.85
settingsMethod · 0.80
primaryMethod · 0.80
hasChatsListMethod · 0.80
valueMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected