Skip to content

Commit 6f6d5fc

Browse files
committed
Extend DWM frame into client area for backdrop rendering
1 parent e10d4f7 commit 6f6d5fc

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

Flow.Launcher.Infrastructure/NativeMethods.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ VIRTUAL_KEY
1414
EnumWindows
1515

1616
DwmSetWindowAttribute
17+
DwmExtendFrameIntoClientArea
1718
DWM_SYSTEMBACKDROP_TYPE
1819
DWM_WINDOW_CORNER_PREFERENCE
1920

Flow.Launcher.Infrastructure/Win32Helper.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using Windows.Win32.Graphics.Dwm;
2222
using Windows.Win32.System.Power;
2323
using Windows.Win32.System.Threading;
24+
using Windows.Win32.UI.Controls;
2425
using Windows.Win32.UI.Input.KeyboardAndMouse;
2526
using Windows.Win32.UI.Shell.Common;
2627
using Windows.Win32.UI.WindowsAndMessaging;
@@ -61,6 +62,15 @@ public static unsafe bool DWMSetBackdropForWindow(Window window, BackdropTypes b
6162
_ => DWM_SYSTEMBACKDROP_TYPE.DWMSBT_AUTO
6263
};
6364

65+
// The backdrop renders in the non-client frame area. WindowStyle=None
66+
// removes that area, so we extend it across the entire client area.
67+
// https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmextendframeintoclientarea
68+
if (backdrop is not BackdropTypes.None)
69+
{
70+
var margins = new MARGINS { cxLeftWidth = -1, cxRightWidth = -1, cyTopHeight = -1, cyBottomHeight = -1 };
71+
PInvoke.DwmExtendFrameIntoClientArea(GetWindowHandle(window), in margins);
72+
}
73+
6474
return PInvoke.DwmSetWindowAttribute(
6575
GetWindowHandle(window),
6676
DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE,

0 commit comments

Comments
 (0)