2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fix window activations handling without event loop nesting.

This was causing an assertion violation in Ui::PostponeCall.

- Add a generic Core::QtSignalProducer to convert Qt signals to rpl::producer.
- Track event loop nesting inside QtSignalProducer.
- Use QtSignalProducer for QWindow::activeChanged tracking.
This commit is contained in:
John Preston
2019-04-05 14:13:54 +04:00
parent 41b2e7c9c7
commit 2bdce7dce6
20 changed files with 136 additions and 140 deletions

View File

@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_controller.h"
#include "mainwindow.h"
#include "core/application.h"
#include "core/qt_signal_producer.h"
#include "styles/style_chat_helpers.h"
namespace ChatHelpers {
@@ -90,11 +91,13 @@ TabbedPanel::TabbedPanel(
});
}, lifetime());
if (cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
connect(App::wnd()->windowHandle(), &QWindow::activeChanged, this, [=] {
windowActiveChanged();
});
}
macWindowDeactivateEvents(
) | rpl::filter([=] {
return !isHidden() && !preventAutoHide();
}) | rpl::start_with_next([=] {
hideAnimated();
}, lifetime());
setAttribute(Qt::WA_OpaquePaintEvent, false);
hideChildren();
@@ -146,12 +149,6 @@ void TabbedPanel::updateContentHeight() {
update();
}
void TabbedPanel::windowActiveChanged() {
if (!App::wnd()->windowHandle()->isActive() && !isHidden() && !preventAutoHide()) {
hideAnimated();
}
}
void TabbedPanel::paintEvent(QPaintEvent *e) {
Painter p(this);

View File

@@ -68,7 +68,6 @@ private:
return !_selector;
}
void showFromSelector();
void windowActiveChanged();
style::margins innerPadding() const;