mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Added Windows 10 check code
This commit is contained in:
parent
b8748d642e
commit
c63bb21554
1 changed files with 30 additions and 20 deletions
|
|
@ -140,6 +140,12 @@ namespace Flow.Launcher.Core.Resource
|
||||||
if (mainWindowSrc == null)
|
if (mainWindowSrc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Check Windows version and disable BlurEnabled if Mica is not supported
|
||||||
|
bool isWindows11OrHigher = Environment.OSVersion.Version.Build >= 22000;
|
||||||
|
if (!isWindows11OrHigher)
|
||||||
|
{
|
||||||
|
BlurEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
ParameterTypes.MARGINS margins = new ParameterTypes.MARGINS();
|
ParameterTypes.MARGINS margins = new ParameterTypes.MARGINS();
|
||||||
margins.cxLeftWidth = -1;
|
margins.cxLeftWidth = -1;
|
||||||
|
|
@ -149,10 +155,10 @@ namespace Flow.Launcher.Core.Resource
|
||||||
Methods.ExtendFrame(mainWindowSrc.Handle, margins);
|
Methods.ExtendFrame(mainWindowSrc.Handle, margins);
|
||||||
|
|
||||||
// Remove OS minimizing/maximizing animation
|
// Remove OS minimizing/maximizing animation
|
||||||
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_TRANSITIONS_FORCEDISABLED, 3);
|
// Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_TRANSITIONS_FORCEDISABLED, 3);
|
||||||
|
|
||||||
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000);
|
// Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000);
|
||||||
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
|
// Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
|
||||||
|
|
||||||
// The timing of adding the shadow effect should vary depending on whether the theme is transparent.
|
// The timing of adding the shadow effect should vary depending on whether the theme is transparent.
|
||||||
if (BlurEnabled)
|
if (BlurEnabled)
|
||||||
|
|
@ -165,9 +171,9 @@ namespace Flow.Launcher.Core.Resource
|
||||||
{
|
{
|
||||||
AutoDropShadow();
|
AutoDropShadow();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void AutoDropShadow()
|
public void AutoDropShadow()
|
||||||
{
|
{
|
||||||
if (_settings.UseDropShadowEffect)
|
if (_settings.UseDropShadowEffect)
|
||||||
|
|
@ -241,8 +247,15 @@ namespace Flow.Launcher.Core.Resource
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetBlurForWindow()
|
public void SetBlurForWindow()
|
||||||
{
|
{
|
||||||
|
// Check Windows version (Windows 11 or higher)
|
||||||
|
bool isWindows11OrHigher = Environment.OSVersion.Version.Build >= 22000;
|
||||||
|
|
||||||
|
// If Mica is not supported, force disable BlurEnabled
|
||||||
|
if (!isWindows11OrHigher)
|
||||||
|
{
|
||||||
|
BlurEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
//SetWindowAccent();
|
|
||||||
var dict = GetThemeResourceDictionary(_settings.Theme);
|
var dict = GetThemeResourceDictionary(_settings.Theme);
|
||||||
if (dict == null)
|
if (dict == null)
|
||||||
return;
|
return;
|
||||||
|
|
@ -251,32 +264,29 @@ namespace Flow.Launcher.Core.Resource
|
||||||
if (windowBorderStyle == null)
|
if (windowBorderStyle == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
|
// Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
|
||||||
if (BlurEnabled)
|
if (BlurEnabled)
|
||||||
{
|
{
|
||||||
//mainWindow.WindowStyle = WindowStyle.SingleBorderWindow;
|
// mainWindow.WindowStyle = WindowStyle.SingleBorderWindow;
|
||||||
//BlurColor(BlurMode());
|
// BlurColor(BlurMode());
|
||||||
Debug.WriteLine("~~~~~~~~~~~~~~~~~~~~");
|
Debug.WriteLine("~~~~~~~~~~~~~~~~~~~~");
|
||||||
Debug.WriteLine(BlurMode());
|
Debug.WriteLine(BlurMode());
|
||||||
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
|
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
|
||||||
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
|
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
|
||||||
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent)));
|
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent)));
|
||||||
//SetWindowCornerPreference("Round");
|
// SetWindowCornerPreference("Round");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//mainWindow.WindowStyle = WindowStyle.None;
|
// mainWindow.WindowStyle = WindowStyle.None;
|
||||||
//if (windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background") != null)
|
// if (windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background") != null)
|
||||||
//{
|
// {
|
||||||
// windowBorderStyle.Setters.Add(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
|
// windowBorderStyle.Setters.Add(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
|
||||||
//}
|
// }
|
||||||
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 1);
|
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 1);
|
||||||
}
|
}
|
||||||
ThemeModeColor(BlurMode());
|
ThemeModeColor(BlurMode());
|
||||||
UpdateResourceDictionary(dict);
|
UpdateResourceDictionary(dict);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Background Color from WindowBorderStyle when there not color for BG.
|
// Get Background Color from WindowBorderStyle when there not color for BG.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue