Apply window extents early to avoid window size changes

This commit is contained in:
Ilya Fedin 2022-08-14 07:02:06 +04:00 committed by John Preston
parent 6732aa70e9
commit 180b0bc517

View file

@ -192,12 +192,13 @@ DefaultWindowHelper::DefaultWindowHelper(not_null<RpWidget*> window)
} }
void DefaultWindowHelper::init() { void DefaultWindowHelper::init() {
_title->show();
if (WindowExtentsSupported()) { if (WindowExtentsSupported()) {
window()->setAttribute(Qt::WA_TranslucentBackground); window()->setAttribute(Qt::WA_TranslucentBackground);
} }
window()->createWinId();
_title->show();
rpl::combine( rpl::combine(
window()->widthValue(), window()->widthValue(),
_windowState.value(), _windowState.value(),
@ -260,12 +261,8 @@ void DefaultWindowHelper::init() {
bool shown, bool shown,
bool titleShown, bool titleShown,
Qt::WindowStates windowState) { Qt::WindowStates windowState) {
if (const auto handle = window()->windowHandle()) { window()->windowHandle()->setFlag(Qt::FramelessWindowHint, titleShown);
handle->setFlag(Qt::FramelessWindowHint, titleShown); updateWindowExtents();
updateWindowExtents();
} else {
window()->setWindowFlag(Qt::FramelessWindowHint, titleShown);
}
}, window()->lifetime()); }, window()->lifetime());
window()->events() | rpl::start_with_next([=](not_null<QEvent*> e) { window()->events() | rpl::start_with_next([=](not_null<QEvent*> e) {