Wait longer after first paint, then show window.
This commit is contained in:
parent
0db88bdec1
commit
564e354c1d
1 changed files with 15 additions and 17 deletions
|
|
@ -497,27 +497,25 @@ void WindowHelper::init() {
|
||||||
window()->shownValue() | rpl::filter([=](bool shown) {
|
window()->shownValue() | rpl::filter([=](bool shown) {
|
||||||
return !shown;
|
return !shown;
|
||||||
}) | rpl::start_with_next([=] {
|
}) | rpl::start_with_next([=] {
|
||||||
BOOL cloak = TRUE;
|
const auto toggleCloak = [=](bool enabled) {
|
||||||
DwmSetWindowAttribute(_handle, DWMWA_CLOAK, &cloak, sizeof(cloak));
|
const auto flag = BOOL(enabled ? TRUE : FALSE);
|
||||||
|
DwmSetWindowAttribute(_handle, DWMWA_CLOAK, &flag, sizeof(flag));
|
||||||
|
};
|
||||||
|
toggleCloak(true);
|
||||||
|
|
||||||
const auto firstPaintEventFilter = std::make_shared<QObject*>(nullptr);
|
const auto qwindow = window()->windowHandle();
|
||||||
|
const auto firstPaintEventFilter = std::make_shared<QObject*>();
|
||||||
*firstPaintEventFilter = base::install_event_filter(
|
*firstPaintEventFilter = base::install_event_filter(
|
||||||
window()->windowHandle(),
|
qwindow,
|
||||||
[=](not_null<QEvent*> e) {
|
[=](not_null<QEvent*> e) {
|
||||||
if (!*firstPaintEventFilter
|
if (e->type() == QEvent::Expose && qwindow->isExposed()) {
|
||||||
|| e->type() != QEvent::Expose
|
InvokeQueued(qwindow, [=] {
|
||||||
|| !window()->windowHandle()->isExposed()) {
|
InvokeQueued(qwindow, [=] {
|
||||||
return base::EventFilterResult::Continue;
|
toggleCloak(false);
|
||||||
}
|
});
|
||||||
InvokeQueued(*firstPaintEventFilter, [=] {
|
});
|
||||||
BOOL cloak = FALSE;
|
|
||||||
DwmSetWindowAttribute(
|
|
||||||
_handle,
|
|
||||||
DWMWA_CLOAK,
|
|
||||||
&cloak,
|
|
||||||
sizeof(cloak));
|
|
||||||
delete base::take(*firstPaintEventFilter);
|
delete base::take(*firstPaintEventFilter);
|
||||||
});
|
}
|
||||||
return base::EventFilterResult::Continue;
|
return base::EventFilterResult::Continue;
|
||||||
});
|
});
|
||||||
}, window()->lifetime());
|
}, window()->lifetime());
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue