-
Notifications
You must be signed in to change notification settings - Fork 199
windows: Fix top border overlap #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1193,7 +1193,7 @@ namespace QWK { | |||||
| effectBugWorkaround(); | ||||||
| return true; | ||||||
| } | ||||||
|
|
||||||
| if (key == QStringLiteral("dwm-border-color")) { | ||||||
| if (!isWin11OrGreater()) { | ||||||
| return false; | ||||||
|
|
@@ -2198,6 +2198,10 @@ namespace QWK { | |||||
| DynamicApis::instance().pDwmFlush(); | ||||||
| } | ||||||
| }); | ||||||
|
|
||||||
| bool max; | ||||||
| bool full; | ||||||
|
|
||||||
| if (isSystemBorderEnabled()) { | ||||||
| // Store the original top margin before the default window procedure applies the | ||||||
| // default frame. | ||||||
|
|
@@ -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 | ||||||
|
|
@@ -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); | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) { | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| int size = getWindowFrameBorderThickness(hWnd); | ||||||
|
|
||||||
| clientRect->top += size; | ||||||
| clientRect->bottom += size; | ||||||
| } | ||||||
| } | ||||||
| else { | ||||||
| max = isMaximized(hWnd); | ||||||
| full = isFullScreen(hWnd); | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||||||
|
|
||||||
There was a problem hiding this comment.
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?