Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
})">
<GridCell Column="0">
<StackPanel Orientation="UIOrientation.Horizontal"
HorizontalAlignment="UIHorizontalAlignment.Left">
HorizontalAlignment="UIHorizontalAlignment.Left"
MarginTop="-8">
<Button Appearance="ButtonAppearance.Stealth"
Class="nav-bar-button-icon"
Height="36"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,18 @@
<ControlTemplate TargetType="{x:Type controls:MicaWindowWithOverlay}">
<Border
x:Name="WindowBorder"
BorderThickness="2"
BorderThickness="5"
CornerRadius="0">
<Grid Margin="-1">
<AdornerDecorator>
<Grid Margin="{TemplateBinding MarginMaximized}">
<Border
x:Name="WindowTopBorder"
VerticalAlignment="Top"
Height="48"/>

<ContentPresenter />

<controls:OverlayControl
x:Name="TitleBar"
VerticalAlignment="Top"
Height="32">
Height="32"
Margin="-5,-5,-5,0">
<Grid
VerticalAlignment="Top"
Height="32">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using DevToys.Windows.Core;
using DevToys.Windows.Core.Helpers;
using DevToys.Windows.Native;
using Microsoft.Win32;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.Graphics.Dwm;
Expand All @@ -34,7 +33,6 @@ public abstract partial class MicaWindowWithOverlay : Window
private Button? _maximizeButton;
private Button? _minimizeButton;
private StackPanel? _windowStateButtonsStackPanel;
private Border? _windowTopBorder;
private bool _isMouseButtonDownOnDraggableTitleBarArea;
private Point _mouseDownPositionOnDraggableTitleBarArea;

Expand Down Expand Up @@ -125,7 +123,6 @@ public override void OnApplyTemplate()
_maximizeButton = (Button)Template.FindName("MaximizeButton", this);
var draggableTitleBarArea = (Border)Template.FindName("DraggableTitleBarArea", this);
var overlayControl = (OverlayControl)Template.FindName("TitleBar", this);
_windowTopBorder = (Border)Template.FindName("WindowTopBorder", this);

_windowStateButtonsStackPanel.SizeChanged += WindowStateButtonsStackPanel_SizeChanged;
closeButton.Click += CloseButton_Click;
Expand Down Expand Up @@ -485,16 +482,6 @@ private void UpdateTheme()
dictionaries.Remove(resourceDictionaryToRemove);
dictionaries.Add(resourceDictionary);
UpdateLayout();

Guard.IsNotNull(_windowTopBorder);
if (IsAccentColorOnTitleBarEnabled())
{
_windowTopBorder.Background = SystemParameters.WindowGlassBrush;
}
else
{
_windowTopBorder.Background = null;
}
}

private nint ShowSnapLayout(nint lParam, ref bool handled)
Expand Down Expand Up @@ -572,22 +559,4 @@ private static void OnForbidMinimizeAndMaximizePropertyChangedCallback(Dependenc
NativeMethods.EnableMinimizeAndMaximizeCapabilities(windowHandle);
}
}

public static bool IsAccentColorOnTitleBarEnabled()
{
const string key = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\DWM";
const string name = "ColorPrevalence";

object? value = Registry.GetValue(key, name, null);
if (value is null)
{
// Key doesn't exist, assume default (OFF)
return false;
}
else
{
// If the key value is 1, the setting is ON. Otherwise, it's OFF.
return ((int)value == 1);
}
}
}