fix: using DropShadowEffect in Launcher's popup container on Linux will get a wrong render result.

This commit is contained in:
leo 2024-03-08 15:52:40 +08:00
parent 2182d39e5f
commit 8c1fe66ee5
4 changed files with 99 additions and 72 deletions

View file

@ -251,21 +251,44 @@
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="Background" Value="{DynamicResource Brush.FlatButton.Background}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="2" OffsetX="0" OffsetY="0" Color="Black" Opacity=".65"/>
</Setter.Value>
<Setter Property="Template">
<ControlTemplate>
<Grid>
<Border x:Name="PART_Border"
Margin="2"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Effect="drop-shadow(0 0 2 #80000000)"/>
<ContentPresenter x:Name="PART_ContentPresenter"
Margin="2"
Background="Transparent"
Padding="{TemplateBinding Padding}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Button.flat:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Style Selector="Button.flat:pointerover /template/ Border#PART_Border">
<Setter Property="Background" Value="{DynamicResource Brush.FlatButton.BackgroundHovered}"/>
</Style>
<Style Selector="Button.flat:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="Button.flat.primary">
<Setter Property="Background" Value="{DynamicResource Brush.FlatButton.PrimaryBackground}"/>
</Style>
<Style Selector="Button.flat.primary:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Style Selector="Button.flat.primary:pointerover /template/ Border#PART_Border">
<Setter Property="Background" Value="{DynamicResource Brush.FlatButton.PrimaryBackgroundHovered}"/>
</Style>
<Style Selector="Button.flat.primary:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="Border.launcher_pagetab">
<Setter Property="Background" Value="Transparent"/>

View file

@ -61,10 +61,7 @@
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,20,32,0">
<StackPanel Height="48" Orientation="Horizontal">
<TextBlock Classes="bold" Text="SourceGit" FontSize="32" />
<Border Margin="12,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent1}">
<Border.Effect>
<DropShadowEffect OffsetX="0" OffsetY="0" BlurRadius="6" Color="Black" Opacity=".3"/>
</Border.Effect>
<Border Margin="12,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent1}" Effect="drop-shadow(0 0 6 #40000000)">
<TextBlock Classes="monospace" Margin="8,0" Text="{Binding Version}" FontSize="12" Foreground="White"/>
</Border>
</StackPanel>

View file

@ -239,22 +239,32 @@
<v:LauncherBody Grid.Row="1" Background="{DynamicResource Brush.ToolBar}" Data="{Binding ActivePage.Data}"/>
<!-- Popup container -->
<ContentControl Grid.Row="1" Margin="0,36,0,0" Content="{Binding ActivePage.Popup}" IsVisible="{Binding ActivePage.Popup, Converter={x:Static ObjectConverters.IsNotNull}}">
<ContentControl.DataTemplates>
<DataTemplate DataType="vm:Popup">
<Grid>
<Grid Grid.Row="1" Margin="0,36,0,0" IsVisible="{Binding ActivePage.Popup, Converter={x:Static ObjectConverters.IsNotNull}}">
<Border Background="Transparent" PointerPressed="OnPopupCancelByClickMask"/>
<Grid Width="500" HorizontalAlignment="Center" VerticalAlignment="Top">
<Border Background="{DynamicResource Brush.Popup}" CornerRadius="0,0,4,4">
<ContentControl Content="{Binding ActivePage.Popup}" ClipToBounds="True">
<ContentControl.DataTemplates>
<DataTemplate DataType="vm:Popup">
<Border Margin="8,0,8,8"
Background="{DynamicResource Brush.Popup}"
BorderThickness="1,0,1,1"
BorderBrush="{DynamicResource Brush.Border0}">
<Border.CornerRadius>
<OnPlatform Default="0,0,4,4" Linux="0"/>
</Border.CornerRadius>
<Border.Effect>
<DropShadowEffect BlurRadius="8" Color="Black" Opacity=".6" OffsetX="0" OffsetY="0"/>
<OnPlatform>
<On Options="Windows, macOS">
<DropShadowEffect BlurRadius="8" OffsetX="0" OffsetY="0" Color="Black" Opacity=".5"/>
</On>
</OnPlatform>
</Border.Effect>
</Border>
<StackPanel Margin="8" Orientation="Vertical">
<!-- Popup Widget -->
<ContentControl Margin="0,8"
<ContentPresenter Margin="0,8"
Content="{Binding View}"
IsHitTestVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}"/>
@ -294,11 +304,12 @@
Minimum="0" Maximum="100"/>
</StackPanel>
</StackPanel>
</Grid>
</Grid>
</Border>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</Grid>
</Grid>
<!-- Notification container -->
<Grid Grid.Row="1" Width="360" Margin="0,36,0,0" HorizontalAlignment="Right" VerticalAlignment="Top">
@ -307,11 +318,7 @@
<ItemsControl.ItemTemplate>
<DataTemplate DataType="m:Notification">
<Grid Width="320" Margin="8">
<Border Background="{DynamicResource Brush.Window}" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="1" CornerRadius="4">
<Border.Effect>
<DropShadowEffect OffsetX="0" OffsetY="0" BlurRadius="8" Color="Black" Opacity=".4"/>
</Border.Effect>
</Border>
<Border Background="{DynamicResource Brush.Window}" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="1" CornerRadius="4" Effect="drop-shadow(0 0 8 #40000000)"/>
<Grid Margin="8" RowDefinitions="26,Auto,Auto">
<StackPanel Grid.Row="0" Margin="8,0,0,0" Orientation="Horizontal" IsVisible="{Binding IsError}">
@ -334,7 +341,7 @@
Text="{Binding Message}"/>
<Button Grid.Row="3"
Classes="flat primary"
Height="25"
Height="30"
Margin="4,0"
Command="{Binding #me.DataContext.(vm:Launcher).ActivePage.DismissNotification}"
CommandParameter="{Binding}"

View file

@ -376,7 +376,7 @@
<Button Grid.Column="4"
Classes="flat primary"
Content="{DynamicResource Text.WorkingCopy.Commit}"
Height="24"
Height="28"
Margin="8,0,0,0"
Padding="8,0"
Click="Commit"/>
@ -384,7 +384,7 @@
<Button Grid.Column="5"
Classes="flat"
Content="{DynamicResource Text.WorkingCopy.CommitAndPush}"
Height="24"
Height="28"
Margin="8,0,0,0"
Padding="8,0"
Click="CommitWithPush">