Skip to content

Commit

Permalink
Fix white border appearing around maximized window (#4190)
Browse files Browse the repository at this point in the history
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
fixes #2205
  • Loading branch information
kornes authored Nov 25, 2022
1 parent fe2a9cc commit f2b35fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 10 additions & 11 deletions src/widgets/BaseWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand All @@ -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<NCCALCSIZE_PARAMS *>(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<NCCALCSIZE_PARAMS *>(msg->lParam);
if (ncp)
{
ncp->lppos->flags |= SWP_NOREDRAW;
ncp->rgrc[0].top -= 1;
}
}

*result = 0;
Expand Down

0 comments on commit f2b35fb

Please sign in to comment.