mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Don't activate main window in case of visible call window.
Fixes #27017.
This commit is contained in:
parent
42f96f3c43
commit
a8b959826c
7 changed files with 39 additions and 13 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
Panel(not_null<Call*> call);
|
||||
~Panel();
|
||||
|
||||
[[nodiscard]] bool isVisible() const;
|
||||
[[nodiscard]] bool isActive() const;
|
||||
void showAndActivate();
|
||||
void minimize();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "mainwindow.h"
|
||||
#include "mainwidget.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "core/sandbox.h"
|
||||
#include "core/application.h"
|
||||
#include "core/core_settings.h"
|
||||
|
@ -175,7 +176,11 @@ ApplicationDelegate *_sharedDelegate = nil;
|
|||
Core::App().handleAppActivated();
|
||||
if (const auto window = Core::App().activeWindow()) {
|
||||
if (window->widget()->isHidden()) {
|
||||
window->widget()->showFromTray();
|
||||
if (Core::App().calls().hasVisiblePanel()) {
|
||||
Core::App().calls().activateCurrentCall();
|
||||
} else {
|
||||
window->widget()->showFromTray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue