diff --git a/CHANGELOG.md b/CHANGELOG.md index a4fae1414..374027115 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unversioned +- Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198) + ## 2.4.0 - Major: Added support for emotes, badges, and live emote updates from [7TV](https://7tv.app). [Wiki Page](https://wiki.chatterino.com/Third_party_services/#7tv) (#4002, #4062, #4090) diff --git a/src/widgets/BaseWindow.cpp b/src/widgets/BaseWindow.cpp index 61e9c2c58..a434849db 100644 --- a/src/widgets/BaseWindow.cpp +++ b/src/widgets/BaseWindow.cpp @@ -563,9 +563,9 @@ void BaseWindow::resizeEvent(QResizeEvent *) }); }); } -#endif this->calcButtonsSizes(); +#endif } void BaseWindow::moveEvent(QMoveEvent *event) @@ -726,6 +726,11 @@ void BaseWindow::calcButtonsSizes() return; } + if (this->frameless_) + { + return; + } + if ((this->width() / this->scale()) < 300) { if (this->ui_.minButton) @@ -784,6 +789,12 @@ bool BaseWindow::handleDPICHANGED(MSG *msg) bool BaseWindow::handleSHOWWINDOW(MSG *msg) { #ifdef USEWINSDK + // ignore window hide event + if (!msg->wParam) + { + return true; + } + if (auto dpi = getWindowDpi(msg->hwnd)) { float currentScale = (float)dpi.get() / 96.F; @@ -794,16 +805,17 @@ bool BaseWindow::handleSHOWWINDOW(MSG *msg) } } - if (!this->shown_ && this->isVisible()) + if (!this->shown_) { + this->shown_ = true; + if (this->hasCustomWindowFrame()) { - this->shown_ = true; - // disable OS window border const MARGINS margins = {-1}; DwmExtendFrameIntoClientArea(HWND(this->winId()), &margins); } + if (!this->initalBounds_.isNull()) { ::SetWindowPos(msg->hwnd, nullptr, this->initalBounds_.x(), @@ -812,9 +824,9 @@ bool BaseWindow::handleSHOWWINDOW(MSG *msg) SWP_NOZORDER | SWP_NOACTIVATE); this->currentBounds_ = this->initalBounds_; } - } - this->calcButtonsSizes(); + this->calcButtonsSizes(); + } return true; #else