diff --git a/Telegram/SourceFiles/iv/iv_controller.cpp b/Telegram/SourceFiles/iv/iv_controller.cpp index d3f962641..1671c59ba 100644 --- a/Telegram/SourceFiles/iv/iv_controller.cpp +++ b/Telegram/SourceFiles/iv/iv_controller.cpp @@ -762,10 +762,18 @@ void Controller::destroyShareMenu() { setInnerFocus(); } if (_shareWrap) { - _shareWrap->windowHandle()->setParent(nullptr); + if (_shareContainer) { + _shareWrap->windowHandle()->setParent(nullptr); + } _shareWrap = nullptr; _shareContainer = nullptr; } + if (_shareHidesContent) { + _shareHidesContent = false; + if (const auto content = _webview ? _webview->widget() : nullptr) { + content->show(); + } + } } void Controller::showShareMenu() { @@ -773,22 +781,33 @@ void Controller::showShareMenu() { if (_shareWrap || index < 0 || index > _pages.size()) { return; } + _shareHidesContent = Platform::IsMac(); + if (_shareHidesContent) { + if (const auto content = _webview ? _webview->widget() : nullptr) { + content->hide(); + } + } - _shareWrap = std::make_unique(nullptr); + _shareWrap = std::make_unique(_shareHidesContent + ? _window->window() + : nullptr); const auto margins = QMargins(0, st::windowTitleHeight, 0, 0); - _shareWrap->setGeometry(_window->geometry().marginsRemoved(margins)); - _shareWrap->setWindowFlag(Qt::FramelessWindowHint); - _shareWrap->setAttribute(Qt::WA_TranslucentBackground); - _shareWrap->setAttribute(Qt::WA_NoSystemBackground); - _shareWrap->createWinId(); + if (!_shareHidesContent) { + _shareWrap->setWindowFlag(Qt::FramelessWindowHint); + _shareWrap->setAttribute(Qt::WA_TranslucentBackground); + _shareWrap->setAttribute(Qt::WA_NoSystemBackground); + _shareWrap->createWinId(); - _shareContainer.reset(QWidget::createWindowContainer( - _shareWrap->windowHandle(), - _window.get(), - Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint)); + _shareContainer.reset(QWidget::createWindowContainer( + _shareWrap->windowHandle(), + _window.get(), + Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint)); + } _window->sizeValue() | rpl::start_with_next([=](QSize size) { - _shareContainer->setGeometry(QRect(QPoint(), size).marginsRemoved( - margins)); + const auto widget = _shareHidesContent + ? _shareWrap.get() + : _shareContainer.get(); + widget->setGeometry(QRect(QPoint(), size).marginsRemoved(margins)); }, _shareWrap->lifetime()); auto result = _showShareBox({ @@ -803,7 +822,12 @@ void Controller::showShareMenu() { }, _shareWrap->lifetime()); Ui::ForceFullRepaintSync(_shareWrap.get()); - _shareContainer->show(); + + if (_shareHidesContent) { + _shareWrap->show(); + } else { + _shareContainer->show(); + } activate(); } diff --git a/Telegram/SourceFiles/iv/iv_controller.h b/Telegram/SourceFiles/iv/iv_controller.h index 76e53d6e5..f8352f0d3 100644 --- a/Telegram/SourceFiles/iv/iv_controller.h +++ b/Telegram/SourceFiles/iv/iv_controller.h @@ -142,6 +142,7 @@ private: std::unique_ptr _shareContainer; Fn _shareFocus; Fn _shareHide; + bool _shareHidesContent = false; std::vector _pages; base::flat_map _indices;