Skip to content

Commit 9b5603b

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

2 files changed

Lines changed: 9 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: 8 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,13 @@ public static unsafe bool DWMSetBackdropForWindow(Window window, BackdropTypes b
6162
_ => DWM_SYSTEMBACKDROP_TYPE.DWMSBT_AUTO
6263
};
6364

65+
// Extend the non-client frame into the entire client area so the
66+
// backdrop (Mica/Acrylic) has a surface to render on. Without this,
67+
// WindowStyle="None" removes the non-client area and the backdrop
68+
// has nothing to paint.
69+
var margins = new MARGINS { cxLeftWidth = -1, cxRightWidth = -1, cyTopHeight = -1, cyBottomHeight = -1 };
70+
PInvoke.DwmExtendFrameIntoClientArea(GetWindowHandle(window), in margins);
71+
6472
return PInvoke.DwmSetWindowAttribute(
6573
GetWindowHandle(window),
6674
DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE,

0 commit comments

Comments
 (0)