From f2b35fb7dc0b69ce60e740f2305f6ae510adbee3 Mon Sep 17 00:00:00 2001 From: kornes <28986062+kornes@users.noreply.github.com> Date: Fri, 25 Nov 2022 20:32:45 +0000 Subject: [PATCH] Fix white border appearing around maximized window (#4190) Co-authored-by: pajlada fixes https://github.com/Chatterino/chatterino2/issues/2205 --- CHANGELOG.md | 1 + src/widgets/BaseWindow.cpp | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b803e1dc..81d0f6857 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Bugfix: Fixed messages where Right-to-Left order is mixed in multiple lines. (#4173) - Bugfix: Fixed the wrong right-click menu showing in the chat input box. (#4177) - Bugfix: Fixed popup windows not appearing/minimizing correctly on the Windows taskbar. (#4181) +- Bugfix: Fixed white border appearing around maximized window on Windows. (#4190) ## 2.4.0-beta diff --git a/src/widgets/BaseWindow.cpp b/src/widgets/BaseWindow.cpp index 06fa9c07d..ef0ca8412 100644 --- a/src/widgets/BaseWindow.cpp +++ b/src/widgets/BaseWindow.cpp @@ -793,8 +793,9 @@ bool BaseWindow::handleSHOWWINDOW(MSG *msg) { this->shown_ = true; - const MARGINS shadow = {8, 8, 8, 8}; - DwmExtendFrameIntoClientArea(HWND(this->winId()), &shadow); + // disable OS window border + const MARGINS margins = {-1}; + DwmExtendFrameIntoClientArea(HWND(this->winId()), &margins); } if (!this->initalBounds_.isNull()) { @@ -819,17 +820,15 @@ bool BaseWindow::handleNCCALCSIZE(MSG *msg, long *result) #ifdef USEWINSDK if (this->hasCustomWindowFrame()) { - // int cx = GetSystemMetrics(SM_CXSIZEFRAME); - // int cy = GetSystemMetrics(SM_CYSIZEFRAME); - if (msg->wParam == TRUE) { - NCCALCSIZE_PARAMS *ncp = - (reinterpret_cast(msg->lParam)); - ncp->lppos->flags |= SWP_NOREDRAW; - RECT *clientRect = &ncp->rgrc[0]; - - clientRect->top -= 1; + // remove 1 extra pixel on top of custom frame + auto *ncp = reinterpret_cast(msg->lParam); + if (ncp) + { + ncp->lppos->flags |= SWP_NOREDRAW; + ncp->rgrc[0].top -= 1; + } } *result = 0;