mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Fix dark titlebar for Windows 10 20H1
This commit is contained in:
parent
7ba3a297a5
commit
44051b7064
2 changed files with 9 additions and 9 deletions
|
@ -2084,7 +2084,9 @@ public enum DwmWindowAttribute : uint
|
|||
/// </summary>
|
||||
DWMWA_LAST,
|
||||
// Undocumented, available since October 2018 update (build 17763)
|
||||
DWMWA_USE_IMMERSIVE_DARK_MODE = 19
|
||||
DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19,
|
||||
// Windows 10 20H1 changed the value of the constant
|
||||
DWMWA_USE_IMMERSIVE_DARK_MODE = 20
|
||||
}
|
||||
|
||||
public enum InputType : int
|
||||
|
|
|
@ -235,16 +235,14 @@ public static bool UseImmersiveDarkMode(IntPtr handle, bool enabled)
|
|||
{
|
||||
if (Helpers.IsWindows10OrGreater(17763))
|
||||
{
|
||||
try
|
||||
var attribute = DwmWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1;
|
||||
if (Helpers.IsWindows10OrGreater(18985))
|
||||
{
|
||||
int useImmersiveDarkMode = enabled ? 1 : 0;
|
||||
int result = DwmSetWindowAttribute(handle, (int)DwmWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE, ref useImmersiveDarkMode, sizeof(int));
|
||||
return result == 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e);
|
||||
attribute = DwmWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE;
|
||||
}
|
||||
|
||||
int useImmersiveDarkMode = enabled ? 1 : 0;
|
||||
return DwmSetWindowAttribute(handle, (int)attribute, ref useImmersiveDarkMode, sizeof(int)) == 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue