mirror of
https://github.com/QL-Win/QuickLook.git
synced 2026-05-09 02:07:50 +08:00
Manage fullscreen window corners for Windows 11
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user