mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[PTRun]Disable titlebar accent workaround on Windows 10 (#33505)
After https://github.com/microsoft/PowerToys/pull/33458 , that fix crashes on Windows 10, where the caption color attribute is not supported. This PR disables the fix on Windows 10, since it's not even needed there actually.
This commit is contained in:
@@ -1016,6 +1016,8 @@ namespace PowerLauncher.ViewModel
|
|||||||
var window = Application.Current.MainWindow;
|
var window = Application.Current.MainWindow;
|
||||||
Wpf.Ui.Controls.WindowBackdrop.RemoveBackground(window);
|
Wpf.Ui.Controls.WindowBackdrop.RemoveBackground(window);
|
||||||
|
|
||||||
|
if (OSVersionHelper.IsWindows11())
|
||||||
|
{
|
||||||
// Taken from WPFUI's fix for the title bar issue. We should be able to remove this fix when WPF UI 4 is integrated.
|
// Taken from WPFUI's fix for the title bar issue. We should be able to remove this fix when WPF UI 4 is integrated.
|
||||||
// https://github.com/lepoco/wpfui/pull/1122/files#diff-196b404f4db09632665ef546da6c8e57302b2f3e3d082eb4b5c295ae3482d94a
|
// https://github.com/lepoco/wpfui/pull/1122/files#diff-196b404f4db09632665ef546da6c8e57302b2f3e3d082eb4b5c295ae3482d94a
|
||||||
IntPtr windowHandle = new WindowInteropHelper(window).Handle;
|
IntPtr windowHandle = new WindowInteropHelper(window).Handle;
|
||||||
@@ -1034,11 +1036,12 @@ namespace PowerLauncher.ViewModel
|
|||||||
uint titlebarPvAttribute = 0xFFFFFFFE;
|
uint titlebarPvAttribute = 0xFFFFFFFE;
|
||||||
_ = Wox.Plugin.Common.Win32.NativeMethods.DwmSetWindowAttribute(
|
_ = Wox.Plugin.Common.Win32.NativeMethods.DwmSetWindowAttribute(
|
||||||
windowSource.Handle,
|
windowSource.Handle,
|
||||||
(int)Wox.Plugin.Common.Win32.DwmWindowAttributes.CaptionColor,
|
(int)Wox.Plugin.Common.Win32.DwmWindowAttributes.CaptionColor, // CaptionColor attribute is only available on Windows 11.
|
||||||
ref titlebarPvAttribute,
|
ref titlebarPvAttribute,
|
||||||
Marshal.SizeOf(typeof(uint)));
|
Marshal.SizeOf(typeof(uint)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_settings.ClearInputOnLaunch)
|
if (_settings.ClearInputOnLaunch)
|
||||||
|
|||||||
Reference in New Issue
Block a user