Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/core/contexts/win32windowcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ namespace QWK {
effectBugWorkaround();
return true;
}

if (key == QStringLiteral("dwm-border-color")) {
if (!isWin11OrGreater()) {
return false;
Expand Down Expand Up @@ -2198,6 +2198,10 @@ namespace QWK {
DynamicApis::instance().pDwmFlush();
}
});

bool max;
bool full;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems you can initialize max and full with isMaximized() and isFullScreen() here? you didn't change their value in the following code block anyway, or am I missing something?


if (isSystemBorderEnabled()) {
// Store the original top margin before the default window procedure applies the
// default frame.
Expand All @@ -2215,6 +2219,7 @@ namespace QWK {
*result = originalResult;
return true;
}

// Re-apply the original top from before the size of the default frame was
// applied, and the whole top frame (the title bar and the top border) is gone
// now. For the top frame, we only has 2 choices: (1) remove the top frame
Expand All @@ -2224,10 +2229,27 @@ namespace QWK {
// set, so here we can only remove the top frame entirely and use some special
// technique to bring the top border back.
clientRect->top = originalTop;

max = isMaximized(hWnd);
full = isFullScreen(hWnd);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you won't need these two lines if you initialize them early


// On Windows 11, DWM draws a visible frame border at the top of every thick-frame
// window (DWMWA_VISIBLE_FRAME_BORDER_THICKNESS, typically 1 physical pixel). That
// border ends up painted on top of the client area, covering the top of the content.
// So we shift the clientRect accordingly. This only applies when the window is not
// maximized or full-screen.
if (isWin11OrGreater() && max == false && full == false) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (isWin11OrGreater() && max == false && full == false) {
if (isWin11OrGreater() && !max && !full) {

int size = getWindowFrameBorderThickness(hWnd);

clientRect->top += size;
clientRect->bottom += size;
}
}
else {
max = isMaximized(hWnd);
full = isFullScreen(hWnd);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you won't need these two lines if you initialize them early

}

const bool max = isMaximized(hWnd);
const bool full = isFullScreen(hWnd);
// We don't need this correction when we're fullscreen. We will
// have the WS_POPUP size, so we don't have to worry about
// borders, and the default frame will be fine.
Expand Down