Manage fullscreen window corners for Windows 11
build / build (push) Has been cancelled
build / publish (push) Has been cancelled

This commit is contained in:
ema
2026-05-07 18:48:55 +08:00
parent d6caea5264
commit ff5b1e7e17
2 changed files with 17 additions and 0 deletions
+10
View File
@@ -304,6 +304,16 @@ public static class WindowHelper
Dwmapi.DwmSetWindowAttribute(hwnd, dwAttribute, ref val, Marshal.SizeOf(typeof(int)));
}
public static void SetWindowCorner(Window window, Dwmapi.WindowCornerStyle style)
{
if (Environment.OSVersion.Version < new Version(10, 0, 22000))
return;
var hwnd = new WindowInteropHelper(window).EnsureHandleSafe();
int cornerPreference = (int)style;
Dwmapi.DwmSetWindowAttribute(hwnd, (uint)Dwmapi.WindowAttribute.WindowCornerPreference, ref cornerPreference, Marshal.SizeOf(typeof(int)));
}
public static void EnableMicaBlur(Window window, bool isDarkTheme)
{
EnableDwmBlur(window, isDarkTheme, (uint)Dwmapi.WindowAttribute.MicaEffect, 1);
+7
View File
@@ -16,6 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using QuickLook.Common.Helpers;
using QuickLook.Common.NativeMethods;
using QuickLook.Common.Plugin;
using QuickLook.Common.Plugin.MoreMenu;
using QuickLook.Helpers;
@@ -83,6 +84,9 @@ public partial class ViewerWindow
// Restore window state last to avoid flicker
WindowState = _preFullscreenWindowState;
// Restore rounded corners on Windows 11
WindowHelper.SetWindowCorner(this, Dwmapi.WindowCornerStyle.Round);
}
else
{
@@ -125,6 +129,9 @@ public partial class ViewerWindow
// Use MoveWindow to set position and size with proper DPI handling
this.MoveWindow(screenBounds.Left, screenBounds.Top, dipWidth, dipHeight);
// Remove rounded corners on Windows 11 for true fullscreen
WindowHelper.SetWindowCorner(this, Dwmapi.WindowCornerStyle.DoNotRound);
}
}