perf: ignore WM_SHOWWINDOW hide event (#4198)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
kornes 2022-12-03 10:20:31 +00:00 committed by GitHub
parent 4b267b9e9a
commit edd4789bf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View file

@ -2,6 +2,8 @@
## Unversioned ## Unversioned
- Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198)
## 2.4.0 ## 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) - 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)

View file

@ -563,9 +563,9 @@ void BaseWindow::resizeEvent(QResizeEvent *)
}); });
}); });
} }
#endif
this->calcButtonsSizes(); this->calcButtonsSizes();
#endif
} }
void BaseWindow::moveEvent(QMoveEvent *event) void BaseWindow::moveEvent(QMoveEvent *event)
@ -726,6 +726,11 @@ void BaseWindow::calcButtonsSizes()
return; return;
} }
if (this->frameless_)
{
return;
}
if ((this->width() / this->scale()) < 300) if ((this->width() / this->scale()) < 300)
{ {
if (this->ui_.minButton) if (this->ui_.minButton)
@ -784,6 +789,12 @@ bool BaseWindow::handleDPICHANGED(MSG *msg)
bool BaseWindow::handleSHOWWINDOW(MSG *msg) bool BaseWindow::handleSHOWWINDOW(MSG *msg)
{ {
#ifdef USEWINSDK #ifdef USEWINSDK
// ignore window hide event
if (!msg->wParam)
{
return true;
}
if (auto dpi = getWindowDpi(msg->hwnd)) if (auto dpi = getWindowDpi(msg->hwnd))
{ {
float currentScale = (float)dpi.get() / 96.F; float currentScale = (float)dpi.get() / 96.F;
@ -794,16 +805,17 @@ bool BaseWindow::handleSHOWWINDOW(MSG *msg)
} }
} }
if (!this->shown_ && this->isVisible()) if (!this->shown_)
{
if (this->hasCustomWindowFrame())
{ {
this->shown_ = true; this->shown_ = true;
if (this->hasCustomWindowFrame())
{
// disable OS window border // disable OS window border
const MARGINS margins = {-1}; const MARGINS margins = {-1};
DwmExtendFrameIntoClientArea(HWND(this->winId()), &margins); DwmExtendFrameIntoClientArea(HWND(this->winId()), &margins);
} }
if (!this->initalBounds_.isNull()) if (!this->initalBounds_.isNull())
{ {
::SetWindowPos(msg->hwnd, nullptr, this->initalBounds_.x(), ::SetWindowPos(msg->hwnd, nullptr, this->initalBounds_.x(),
@ -812,9 +824,9 @@ bool BaseWindow::handleSHOWWINDOW(MSG *msg)
SWP_NOZORDER | SWP_NOACTIVATE); SWP_NOZORDER | SWP_NOACTIVATE);
this->currentBounds_ = this->initalBounds_; this->currentBounds_ = this->initalBounds_;
} }
}
this->calcButtonsSizes(); this->calcButtonsSizes();
}
return true; return true;
#else #else