@@ -1193,7 +1193,7 @@ namespace QWK {
11931193 effectBugWorkaround ();
11941194 return true ;
11951195 }
1196-
1196+
11971197 if (key == QStringLiteral (" dwm-border-color" )) {
11981198 if (!isWin11OrGreater ()) {
11991199 return false ;
@@ -2198,6 +2198,10 @@ namespace QWK {
21982198 DynamicApis::instance ().pDwmFlush ();
21992199 }
22002200 });
2201+
2202+ bool max = isMaximized (hWnd);
2203+ bool full = isFullScreen (hWnd);
2204+
22012205 if (isSystemBorderEnabled ()) {
22022206 // Store the original top margin before the default window procedure applies the
22032207 // default frame.
@@ -2215,6 +2219,7 @@ namespace QWK {
22152219 *result = originalResult;
22162220 return true ;
22172221 }
2222+
22182223 // Re-apply the original top from before the size of the default frame was
22192224 // applied, and the whole top frame (the title bar and the top border) is gone
22202225 // now. For the top frame, we only has 2 choices: (1) remove the top frame
@@ -2224,10 +2229,20 @@ namespace QWK {
22242229 // set, so here we can only remove the top frame entirely and use some special
22252230 // technique to bring the top border back.
22262231 clientRect->top = originalTop;
2232+
2233+ // On Windows 10+, DWM draws a visible frame border at the top of every thick-frame
2234+ // window (DWMWA_VISIBLE_FRAME_BORDER_THICKNESS, typically 1 physical pixel). That
2235+ // border ends up painted on top of the client area, covering the top of the content.
2236+ // So we shift the clientRect accordingly. This only applies when the window is not
2237+ // maximized or full-screen.
2238+ if (!max && !full) {
2239+ int size = getWindowFrameBorderThickness (hWnd);
2240+
2241+ clientRect->top += size;
2242+ clientRect->bottom += size;
2243+ }
22272244 }
22282245
2229- const bool max = isMaximized (hWnd);
2230- const bool full = isFullScreen (hWnd);
22312246 // We don't need this correction when we're fullscreen. We will
22322247 // have the WS_POPUP size, so we don't have to worry about
22332248 // borders, and the default frame will be fine.
0 commit comments