mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Hide IV when sharing on macOS, fixes sharing.
This commit is contained in:
parent
73ca78215f
commit
461aebd7f3
2 changed files with 39 additions and 14 deletions
|
@ -762,10 +762,18 @@ void Controller::destroyShareMenu() {
|
||||||
setInnerFocus();
|
setInnerFocus();
|
||||||
}
|
}
|
||||||
if (_shareWrap) {
|
if (_shareWrap) {
|
||||||
_shareWrap->windowHandle()->setParent(nullptr);
|
if (_shareContainer) {
|
||||||
|
_shareWrap->windowHandle()->setParent(nullptr);
|
||||||
|
}
|
||||||
_shareWrap = nullptr;
|
_shareWrap = nullptr;
|
||||||
_shareContainer = nullptr;
|
_shareContainer = nullptr;
|
||||||
}
|
}
|
||||||
|
if (_shareHidesContent) {
|
||||||
|
_shareHidesContent = false;
|
||||||
|
if (const auto content = _webview ? _webview->widget() : nullptr) {
|
||||||
|
content->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::showShareMenu() {
|
void Controller::showShareMenu() {
|
||||||
|
@ -773,22 +781,33 @@ void Controller::showShareMenu() {
|
||||||
if (_shareWrap || index < 0 || index > _pages.size()) {
|
if (_shareWrap || index < 0 || index > _pages.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
_shareHidesContent = Platform::IsMac();
|
||||||
|
if (_shareHidesContent) {
|
||||||
|
if (const auto content = _webview ? _webview->widget() : nullptr) {
|
||||||
|
content->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_shareWrap = std::make_unique<Ui::RpWidget>(nullptr);
|
_shareWrap = std::make_unique<Ui::RpWidget>(_shareHidesContent
|
||||||
|
? _window->window()
|
||||||
|
: nullptr);
|
||||||
const auto margins = QMargins(0, st::windowTitleHeight, 0, 0);
|
const auto margins = QMargins(0, st::windowTitleHeight, 0, 0);
|
||||||
_shareWrap->setGeometry(_window->geometry().marginsRemoved(margins));
|
if (!_shareHidesContent) {
|
||||||
_shareWrap->setWindowFlag(Qt::FramelessWindowHint);
|
_shareWrap->setWindowFlag(Qt::FramelessWindowHint);
|
||||||
_shareWrap->setAttribute(Qt::WA_TranslucentBackground);
|
_shareWrap->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
_shareWrap->setAttribute(Qt::WA_NoSystemBackground);
|
_shareWrap->setAttribute(Qt::WA_NoSystemBackground);
|
||||||
_shareWrap->createWinId();
|
_shareWrap->createWinId();
|
||||||
|
|
||||||
_shareContainer.reset(QWidget::createWindowContainer(
|
_shareContainer.reset(QWidget::createWindowContainer(
|
||||||
_shareWrap->windowHandle(),
|
_shareWrap->windowHandle(),
|
||||||
_window.get(),
|
_window.get(),
|
||||||
Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint));
|
Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint));
|
||||||
|
}
|
||||||
_window->sizeValue() | rpl::start_with_next([=](QSize size) {
|
_window->sizeValue() | rpl::start_with_next([=](QSize size) {
|
||||||
_shareContainer->setGeometry(QRect(QPoint(), size).marginsRemoved(
|
const auto widget = _shareHidesContent
|
||||||
margins));
|
? _shareWrap.get()
|
||||||
|
: _shareContainer.get();
|
||||||
|
widget->setGeometry(QRect(QPoint(), size).marginsRemoved(margins));
|
||||||
}, _shareWrap->lifetime());
|
}, _shareWrap->lifetime());
|
||||||
|
|
||||||
auto result = _showShareBox({
|
auto result = _showShareBox({
|
||||||
|
@ -803,7 +822,12 @@ void Controller::showShareMenu() {
|
||||||
}, _shareWrap->lifetime());
|
}, _shareWrap->lifetime());
|
||||||
|
|
||||||
Ui::ForceFullRepaintSync(_shareWrap.get());
|
Ui::ForceFullRepaintSync(_shareWrap.get());
|
||||||
_shareContainer->show();
|
|
||||||
|
if (_shareHidesContent) {
|
||||||
|
_shareWrap->show();
|
||||||
|
} else {
|
||||||
|
_shareContainer->show();
|
||||||
|
}
|
||||||
activate();
|
activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,7 @@ private:
|
||||||
std::unique_ptr<QWidget> _shareContainer;
|
std::unique_ptr<QWidget> _shareContainer;
|
||||||
Fn<void()> _shareFocus;
|
Fn<void()> _shareFocus;
|
||||||
Fn<void()> _shareHide;
|
Fn<void()> _shareHide;
|
||||||
|
bool _shareHidesContent = false;
|
||||||
|
|
||||||
std::vector<Prepared> _pages;
|
std::vector<Prepared> _pages;
|
||||||
base::flat_map<QString, int> _indices;
|
base::flat_map<QString, int> _indices;
|
||||||
|
|
Loading…
Add table
Reference in a new issue