mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Update online after the window active status.
I hope this fixes #26059.
This commit is contained in:
parent
f0a96d0aad
commit
58c5bb7247
4 changed files with 8 additions and 10 deletions
|
@ -115,16 +115,7 @@ MainWindow::MainWindow(not_null<Window::Controller*> controller)
|
|||
|
||||
void MainWindow::initHook() {
|
||||
Platform::MainWindow::initHook();
|
||||
|
||||
QCoreApplication::instance()->installEventFilter(this);
|
||||
|
||||
// Non-queued activeChanged handlers must use QtSignalProducer.
|
||||
connect(
|
||||
windowHandle(),
|
||||
&QWindow::activeChanged,
|
||||
this,
|
||||
[=] { checkActivation(); },
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void MainWindow::applyInitialWorkMode() {
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
MainWidget *sessionContent() const;
|
||||
|
||||
void checkActivation();
|
||||
void checkActivation() override;
|
||||
[[nodiscard]] bool markingAsRead() const;
|
||||
|
||||
bool takeThirdSectionFromLayer();
|
||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "window/main_window.h"
|
||||
|
||||
#include "api/api_updates.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "platform/platform_specific.h"
|
||||
#include "ui/platform/ui_platform_window.h"
|
||||
|
@ -512,9 +513,13 @@ void MainWindow::handleStateChanged(Qt::WindowState state) {
|
|||
}
|
||||
|
||||
void MainWindow::handleActiveChanged() {
|
||||
checkActivation();
|
||||
if (isActiveWindow()) {
|
||||
Core::App().windowActivated(&controller());
|
||||
}
|
||||
if (const auto controller = sessionController()) {
|
||||
controller->session().updates().updateOnline();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::handleVisibleChanged(bool visible) {
|
||||
|
|
|
@ -148,6 +148,8 @@ protected:
|
|||
void handleActiveChanged();
|
||||
void handleVisibleChanged(bool visible);
|
||||
|
||||
virtual void checkActivation() {
|
||||
}
|
||||
virtual void initHook() {
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue