Use new cloaking workaround for non-fullscreen only.
This commit is contained in:
parent
cb1a041ca3
commit
30b22ace0b
2 changed files with 11 additions and 6 deletions
|
|
@ -367,6 +367,7 @@ void WindowHelper::showFullScreen() {
|
||||||
_isFullScreen = true;
|
_isFullScreen = true;
|
||||||
updateMargins();
|
updateMargins();
|
||||||
updateCornersRounding();
|
updateCornersRounding();
|
||||||
|
updateCloaking();
|
||||||
}
|
}
|
||||||
window()->showFullScreen();
|
window()->showFullScreen();
|
||||||
}
|
}
|
||||||
|
|
@ -377,6 +378,7 @@ void WindowHelper::showNormal() {
|
||||||
_isFullScreen = false;
|
_isFullScreen = false;
|
||||||
updateMargins();
|
updateMargins();
|
||||||
updateCornersRounding();
|
updateCornersRounding();
|
||||||
|
updateCloaking();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -497,11 +499,7 @@ 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([=] {
|
||||||
const auto toggleCloak = [=](bool enabled) {
|
updateCloaking();
|
||||||
const auto flag = BOOL(enabled ? TRUE : FALSE);
|
|
||||||
DwmSetWindowAttribute(_handle, DWMWA_CLOAK, &flag, sizeof(flag));
|
|
||||||
};
|
|
||||||
toggleCloak(true);
|
|
||||||
|
|
||||||
const auto qwindow = window()->windowHandle();
|
const auto qwindow = window()->windowHandle();
|
||||||
const auto firstPaintEventFilter = std::make_shared<QObject*>();
|
const auto firstPaintEventFilter = std::make_shared<QObject*>();
|
||||||
|
|
@ -511,7 +509,7 @@ void WindowHelper::init() {
|
||||||
if (e->type() == QEvent::Expose && qwindow->isExposed()) {
|
if (e->type() == QEvent::Expose && qwindow->isExposed()) {
|
||||||
InvokeQueued(qwindow, [=] {
|
InvokeQueued(qwindow, [=] {
|
||||||
InvokeQueued(qwindow, [=] {
|
InvokeQueued(qwindow, [=] {
|
||||||
toggleCloak(false);
|
updateCloaking();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
delete base::take(*firstPaintEventFilter);
|
delete base::take(*firstPaintEventFilter);
|
||||||
|
|
@ -910,6 +908,12 @@ void WindowHelper::updateWindowFrameColors(bool active) {
|
||||||
sizeof(COLORREF));
|
sizeof(COLORREF));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowHelper::updateCloaking() {
|
||||||
|
const auto enabled = window()->isHidden() && !_isFullScreen;
|
||||||
|
const auto flag = BOOL(enabled ? TRUE : FALSE);
|
||||||
|
DwmSetWindowAttribute(_handle, DWMWA_CLOAK, &flag, sizeof(flag));
|
||||||
|
}
|
||||||
|
|
||||||
void WindowHelper::updateMargins() {
|
void WindowHelper::updateMargins() {
|
||||||
if (_updatingMargins) return;
|
if (_updatingMargins) return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ private:
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void updateMargins();
|
void updateMargins();
|
||||||
|
void updateCloaking();
|
||||||
void updateWindowFrameColors();
|
void updateWindowFrameColors();
|
||||||
void updateWindowFrameColors(bool active);
|
void updateWindowFrameColors(bool active);
|
||||||
void initialShadowUpdate();
|
void initialShadowUpdate();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue