mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-30 22:01:10 +08:00
@@ -67,7 +67,7 @@ namespace SourceGit.Native
|
||||
{
|
||||
window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
|
||||
window.ExtendClientAreaToDecorationsHint = true;
|
||||
window.Classes.Add("fix_maximized_padding");
|
||||
window.BorderThickness = new Thickness(1);
|
||||
|
||||
Win32Properties.AddWndProcHookCallback(window, (IntPtr hWnd, uint msg, IntPtr _, IntPtr lParam, ref bool handled) =>
|
||||
{
|
||||
|
||||
@@ -24,25 +24,38 @@
|
||||
</Style>
|
||||
|
||||
<Style Selector="Window">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Window}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border0}"/>
|
||||
<Setter Property="SystemDecorations" Value="Full"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
|
||||
<Style.Resources>
|
||||
<SolidColorBrush x:Key="SystemControlErrorTextForegroundBrush" Color="Red"/>
|
||||
<Color x:Key="SystemErrorTextColor">Red</Color>
|
||||
</Style.Resources>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Window[WindowState=Maximized]">
|
||||
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Window}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.WindowBorder}"/>
|
||||
<Setter Property="SystemDecorations" Value="Full"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Window[WindowState=Maximized].fix_maximized_padding">
|
||||
<Setter Property="Padding" Value="8,6,8,8"/>
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
ClipToBounds="True">
|
||||
<Border Margin="{TemplateBinding Padding}">
|
||||
<VisualLayerManager>
|
||||
<Border>
|
||||
<ContentPresenter Name="PART_ContentPresenter"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Content="{TemplateBinding Content}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
</VisualLayerManager>
|
||||
</Border>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Window.custom_window_frame">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<Color x:Key="Color.Window">#FFF0F5F9</Color>
|
||||
<Color x:Key="Color.WindowBorder">#00000000</Color>
|
||||
<Color x:Key="Color.WindowBorder">#FF999999</Color>
|
||||
<Color x:Key="Color.TitleBar">#FFCFDEEA</Color>
|
||||
<Color x:Key="Color.ToolBar">#FFF0F5F9</Color>
|
||||
<Color x:Key="Color.Popup">#FFF8F8F8</Color>
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
<Color x:Key="Color.Window">#FF252525</Color>
|
||||
<Color x:Key="Color.WindowBorder">#FF444444</Color>
|
||||
<Color x:Key="Color.WindowBorder">#FF606060</Color>
|
||||
<Color x:Key="Color.TitleBar">#FF1F1F1F</Color>
|
||||
<Color x:Key="Color.ToolBar">#FF2F2F2F</Color>
|
||||
<Color x:Key="Color.Popup">#FF2B2B2B</Color>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
@@ -74,6 +74,25 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||
{
|
||||
base.OnPropertyChanged(change);
|
||||
|
||||
if (change.Property == WindowStateProperty && OperatingSystem.IsWindows())
|
||||
{
|
||||
if (WindowState == WindowState.Maximized)
|
||||
{
|
||||
BorderThickness = new Thickness(0);
|
||||
Padding = new Thickness(8, 6, 8, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
BorderThickness = new Thickness(1);
|
||||
Padding = new Thickness(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
|
||||
Reference in New Issue
Block a user