2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Don't activate main window in case of visible call window.

Fixes #27017.
This commit is contained in:
John Preston
2023-11-01 22:23:41 +04:00
parent 42f96f3c43
commit a8b959826c
7 changed files with 39 additions and 13 deletions

View File

@@ -712,13 +712,24 @@ void Instance::destroyCurrentCall() {
}
}
bool Instance::hasActivePanel(not_null<Main::Session*> session) const {
bool Instance::hasVisiblePanel(Main::Session *session) const {
if (inCall()) {
return (&_currentCall->user()->session() == session)
&& _currentCallPanel->isActive();
return _currentCallPanel->isVisible()
&& (!session || (&_currentCall->user()->session() == session));
} else if (inGroupCall()) {
return (&_currentGroupCall->peer()->session() == session)
&& _currentGroupCallPanel->isActive();
return _currentGroupCallPanel->isVisible()
&& (!session || (&_currentGroupCall->peer()->session() == session));
}
return false;
}
bool Instance::hasActivePanel(Main::Session *session) const {
if (inCall()) {
return _currentCallPanel->isActive()
&& (!session || (&_currentCall->user()->session() == session));
} else if (inGroupCall()) {
return _currentGroupCallPanel->isActive()
&& (!session || (&_currentGroupCall->peer()->session() == session));
}
return false;
}

View File

@@ -89,8 +89,10 @@ public:
[[nodiscard]] rpl::producer<GroupCall*> currentGroupCallValue() const;
[[nodiscard]] bool inCall() const;
[[nodiscard]] bool inGroupCall() const;
[[nodiscard]] bool hasVisiblePanel(
Main::Session *session = nullptr) const;
[[nodiscard]] bool hasActivePanel(
not_null<Main::Session*> session) const;
Main::Session *session = nullptr) const;
bool activateCurrentCall(const QString &joinHash = QString());
bool minimizeCurrentActiveCall();
bool toggleFullScreenCurrentActiveCall();

View File

@@ -106,12 +106,15 @@ Panel::Panel(not_null<Call*> call)
Panel::~Panel() = default;
bool Panel::isActive() const {
return window()->isActiveWindow()
&& window()->isVisible()
bool Panel::isVisible() const {
return window()->isVisible()
&& !(window()->windowState() & Qt::WindowMinimized);
}
bool Panel::isActive() const {
return window()->isActiveWindow() && isVisible();
}
void Panel::showAndActivate() {
if (window()->isHidden()) {
window()->show();

View File

@@ -61,6 +61,7 @@ public:
Panel(not_null<Call*> call);
~Panel();
[[nodiscard]] bool isVisible() const;
[[nodiscard]] bool isActive() const;
void showAndActivate();
void minimize();

View File

@@ -258,12 +258,15 @@ not_null<GroupCall*> Panel::call() const {
return _call;
}
bool Panel::isActive() const {
return window()->isActiveWindow()
&& window()->isVisible()
bool Panel::isVisible() const {
return window()->isVisible()
&& !(window()->windowState() & Qt::WindowMinimized);
}
bool Panel::isActive() const {
return window()->isActiveWindow() && isVisible();
}
base::weak_ptr<Ui::Toast::Instance> Panel::showToast(
const QString &text,
crl::time duration) {

View File

@@ -91,6 +91,7 @@ public:
[[nodiscard]] not_null<Ui::RpWidget*> widget() const;
[[nodiscard]] not_null<GroupCall*> call() const;
[[nodiscard]] bool isVisible() const;
[[nodiscard]] bool isActive() const;
base::weak_ptr<Ui::Toast::Instance> showToast(