fix: selected color of ListBoxItem not work on Debain 12 Wayland

This commit is contained in:
leo 2024-06-25 16:08:27 +08:00
parent 432f5a98da
commit b5393c5ace
No known key found for this signature in database
2 changed files with 74 additions and 63 deletions

View file

@ -652,18 +652,6 @@
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border0}"/> <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border0}"/>
</Style> </Style>
<Style Selector="ListBox.page_switcher ListBoxItem">
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border2}"/>
</Style>
<Style Selector="ListBox.page_switcher ListBoxItem:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="ListBox.page_switcher ListBoxItem:selected /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}"/>
</Style>
<Style Selector="ContextMenu"> <Style Selector="ContextMenu">
<Setter Property="HorizontalOffset" Value="-4"/> <Setter Property="HorizontalOffset" Value="-4"/>
<Setter Property="VerticalOffset" Value="-4"/> <Setter Property="VerticalOffset" Value="-4"/>

View file

@ -93,60 +93,83 @@
<!-- Left Panel --> <!-- Left Panel -->
<Grid Grid.Column="0" Classes="repository_leftpanel" RowDefinitions="Auto,Auto,*"> <Grid Grid.Column="0" Classes="repository_leftpanel" RowDefinitions="Auto,Auto,*">
<!-- Page Switcher for Right Panel --> <!-- Page Switcher for Right Panel -->
<ListBox Grid.Row="0" Margin="8,4,4,0" Classes="page_switcher" Background="Transparent" SelectedIndex="{Binding SelectedViewIndex, Mode=TwoWay}"> <Border Grid.Row="0" Margin="8,4,4,0" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}" CornerRadius="6">
<ListBox.ItemsPanel> <Border CornerRadius="6" ClipToBounds="True">
<ItemsPanelTemplate> <ListBox Background="Transparent" SelectedIndex="{Binding SelectedViewIndex, Mode=TwoWay}">
<StackPanel Orientation="Vertical"/> <ListBox.Styles>
</ItemsPanelTemplate> <Style Selector="ListBoxItem">
</ListBox.ItemsPanel> <Setter Property="Height" Value="28"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border2}"/>
</Style>
<Style Selector="ListBoxItem:nth-last-child(1)">
<Setter Property="BorderThickness" Value="0"/>
</Style>
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter#PART_ContentPresenter, ListBoxItem:selected /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="ListBoxItem:selected Grid.view_mode">
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}"/>
</Style>
</ListBox.Styles>
<ListBoxItem Height="28" BorderThickness="1,1,1,1" CornerRadius="6,6,0,0"> <ListBox.ItemsPanel>
<Grid Height="28" ColumnDefinitions="32,*,Auto,Auto"> <ItemsPanelTemplate>
<Path Grid.Column="0" Width="12" Height="12" Data="{StaticResource Icons.Histories}"/> <StackPanel Orientation="Vertical"/>
<TextBlock Grid.Column="1" Classes="monospace" Text="{DynamicResource Text.Histories}"/> </ItemsPanelTemplate>
<ToggleButton Grid.Column="2" </ListBox.ItemsPanel>
Classes="layout_direction"
Width="32" Height="26"
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=UseTwoColumnsLayoutInHistories, Mode=TwoWay}"
ToolTip.Tip="{DynamicResource Text.Histories.DisplayMode}"/>
<Button Grid.Column="3" Classes="icon_button" Width="32" Command="{Binding NavigateToCurrentHead}" ToolTip.Tip="{DynamicResource Text.Repository.NavigateToCurrentHead}">
<Path Width="14" Height="14" Data="{StaticResource Icons.Target}" Fill="{DynamicResource Brush.FG1}"/>
</Button>
</Grid>
</ListBoxItem>
<ListBoxItem Height="26" BorderThickness="1,0,1,0"> <ListBoxItem>
<Grid Height="28" ColumnDefinitions="32,*,Auto"> <Grid Classes="view_mode" ColumnDefinitions="32,*,Auto,Auto">
<Path Grid.Column="0" Width="12" Height="12" Data="{StaticResource Icons.Send}"/> <Path Grid.Column="0" Width="12" Height="12" Data="{StaticResource Icons.Histories}"/>
<TextBlock Grid.Column="1" Classes="monospace" Text="{DynamicResource Text.WorkingCopy}"/> <TextBlock Grid.Column="1" Classes="monospace" Text="{DynamicResource Text.Histories}"/>
<Border Grid.Column="2" <ToggleButton Grid.Column="2"
Margin="6,0" Classes="layout_direction"
Height="18" Width="32" Height="26"
CornerRadius="9" IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=UseTwoColumnsLayoutInHistories, Mode=TwoWay}"
VerticalAlignment="Center" ToolTip.Tip="{DynamicResource Text.Histories.DisplayMode}"/>
Background="{DynamicResource Brush.Badge}" <Button Grid.Column="3" Classes="icon_button" Width="32" Command="{Binding NavigateToCurrentHead}" ToolTip.Tip="{DynamicResource Text.Repository.NavigateToCurrentHead}">
IsVisible="{Binding WorkingCopyChangesCount, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"> <Path Width="14" Height="14" Data="{StaticResource Icons.Target}" Fill="{DynamicResource Brush.FG1}"/>
<TextBlock Classes="monospace" FontSize="10" HorizontalAlignment="Center" Margin="9,0" Text="{Binding WorkingCopyChangesCount}"/> </Button>
</Border> </Grid>
</Grid> </ListBoxItem>
</ListBoxItem>
<ListBoxItem Height="28" BorderThickness="1,1,1,1" CornerRadius="0,0,6,6"> <ListBoxItem>
<Grid Height="28" ColumnDefinitions="32,*,Auto"> <Grid Classes="view_mode" ColumnDefinitions="32,*,Auto">
<Path Grid.Column="0" Width="12" Height="12" Data="{StaticResource Icons.Stashes}"/> <Path Grid.Column="0" Width="12" Height="12" Data="{StaticResource Icons.Send}"/>
<TextBlock Grid.Column="1" Classes="monospace" Text="{DynamicResource Text.Stashes}"/> <TextBlock Grid.Column="1" Classes="monospace" Text="{DynamicResource Text.WorkingCopy}"/>
<Border Grid.Column="2" <Border Grid.Column="2"
Margin="6,0" Margin="6,0"
Height="18" Height="18"
CornerRadius="9" CornerRadius="9"
VerticalAlignment="Center" VerticalAlignment="Center"
Background="{DynamicResource Brush.Badge}" Background="{DynamicResource Brush.Badge}"
IsVisible="{Binding StashesCount, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"> IsVisible="{Binding WorkingCopyChangesCount, Converter={x:Static c:IntConverters.IsGreaterThanZero}}">
<TextBlock Classes="monospace" FontSize="10" HorizontalAlignment="Center" Margin="9,0" Text="{Binding StashesCount}"/> <TextBlock Classes="monospace" FontSize="10" HorizontalAlignment="Center" Margin="9,0" Text="{Binding WorkingCopyChangesCount}"/>
</Border> </Border>
</Grid> </Grid>
</ListBoxItem> </ListBoxItem>
</ListBox>
<ListBoxItem>
<Grid Classes="view_mode" ColumnDefinitions="32,*,Auto">
<Path Grid.Column="0" Width="12" Height="12" Data="{StaticResource Icons.Stashes}"/>
<TextBlock Grid.Column="1" Classes="monospace" Text="{DynamicResource Text.Stashes}"/>
<Border Grid.Column="2"
Margin="6,0"
Height="18"
CornerRadius="9"
VerticalAlignment="Center"
Background="{DynamicResource Brush.Badge}"
IsVisible="{Binding StashesCount, Converter={x:Static c:IntConverters.IsGreaterThanZero}}">
<TextBlock Classes="monospace" FontSize="10" HorizontalAlignment="Center" Margin="9,0" Text="{Binding StashesCount}"/>
</Border>
</Grid>
</ListBoxItem>
</ListBox>
</Border>
</Border>
<!-- Page Switcher for Left Contents (Dashboard or CommitSearch) --> <!-- Page Switcher for Left Contents (Dashboard or CommitSearch) -->
<Grid Grid.Row="1" Height="24" Margin="0,6" HorizontalAlignment="Center" ColumnDefinitions="48,1,48"> <Grid Grid.Row="1" Height="24" Margin="0,6" HorizontalAlignment="Center" ColumnDefinitions="48,1,48">