Skip to content

Commit 37c35e2

Browse files
committed
CQ: Fix
1 parent 46cff34 commit 37c35e2

File tree

6 files changed

+10
-23
lines changed

6 files changed

+10
-23
lines changed

src/Files.App/UserControls/TabBar/TabBar.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228
<Grid.ColumnDefinitions>
229229
<ColumnDefinition Width="Auto" />
230230
<ColumnDefinition Width="*" />
231-
<ColumnDefinition x:Name="RightPaddingColumn" Width="0" />
231+
<ColumnDefinition x:Name="RightPaddingColumn" Width="{x:Bind PaddingColumnWidth, Mode=OneWay}" />
232232
</Grid.ColumnDefinitions>
233233

234234
<!-- Height is not divisble by four in order to properly align the button -->
@@ -237,6 +237,7 @@
237237
Grid.Column="0"
238238
Width="30"
239239
Height="30"
240+
Margin="0,0,6,0"
240241
Padding="8"
241242
HorizontalAlignment="Left"
242243
VerticalAlignment="Center"

src/Files.App/UserControls/TabBar/TabBar.xaml.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public sealed partial class TabBar : BaseTabBar, INotifyPropertyChanged
1919
private readonly ICommandManager Commands = Ioc.Default.GetRequiredService<ICommandManager>();
2020
private readonly IAppearanceSettingsService AppearanceSettingsService = Ioc.Default.GetRequiredService<IAppearanceSettingsService>();
2121
private readonly IWindowContext WindowContext = Ioc.Default.GetRequiredService<IWindowContext>();
22+
private readonly IRealTimeLayoutService RealTimeLayoutService = Ioc.Default.GetRequiredService<IRealTimeLayoutService>();
2223

2324
// Fields
2425

@@ -51,6 +52,8 @@ public bool AllowTabsDrag
5152
public Rectangle DragArea
5253
=> DragAreaRectangle;
5354

55+
public GridLength PaddingColumnWidth { get; set; }
56+
5457
// Events
5558

5659
public static event EventHandler<TabBarItem?>? SelectedTabItemChanged;
@@ -66,12 +69,10 @@ public TabBar()
6669

6770
var appWindow = MainWindow.Instance.AppWindow;
6871

69-
double rightPaddingColumnWidth =
70-
FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft
72+
PaddingColumnWidth =
73+
new(RealTimeLayoutService.FlowDirection is FlowDirection.RightToLeft
7174
? appWindow.TitleBar.LeftInset
72-
: appWindow.TitleBar.RightInset;
73-
74-
RightPaddingColumn.Width = new(rightPaddingColumnWidth >= 0 ? rightPaddingColumnWidth : 0);
75+
: appWindow.TitleBar.RightInset);
7576

7677
AppearanceSettingsService.PropertyChanged += (s, e) =>
7778
{

src/Files.App/Utils/Storage/Helpers/FilePropertiesHelpers.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ public static class FilePropertiesHelpers
2323

2424
private static IRealTimeLayoutService RealTimeLayoutService { get; } = Ioc.Default.GetRequiredService<IRealTimeLayoutService>();
2525

26-
/// <summary>
27-
/// Whether LayoutDirection (FlowDirection) is set to right-to-left (RTL)
28-
/// </summary>
29-
public static readonly bool FlowDirectionSettingIsRightToLeft =
30-
new ResourceManager().CreateResourceContext().QualifierValues["LayoutDirection"] == "RTL";
31-
3226
/// <summary>
3327
/// Get window handle (hWnd) of the given properties window instance
3428
/// </summary>

src/Files.App/Views/MainPage.xaml.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public sealed partial class MainPage : Page
2626
private IGeneralSettingsService generalSettingsService { get; } = Ioc.Default.GetRequiredService<IGeneralSettingsService>();
2727
public IUserSettingsService UserSettingsService { get; }
2828
private readonly IWindowContext WindowContext = Ioc.Default.GetRequiredService<IWindowContext>();
29+
private readonly IRealTimeLayoutService RealTimeLayoutService = Ioc.Default.GetRequiredService<IRealTimeLayoutService>();
2930
public ICommandManager Commands { get; }
3031
public SidebarViewModel SidebarAdaptiveViewModel { get; }
3132
public MainPageViewModel ViewModel { get; }
@@ -47,9 +48,6 @@ public MainPage()
4748
ViewModel = Ioc.Default.GetRequiredService<MainPageViewModel>();
4849
OngoingTasksViewModel = Ioc.Default.GetRequiredService<StatusCenterViewModel>();
4950

50-
if (FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft)
51-
FlowDirection = FlowDirection.RightToLeft;
52-
5351
ViewModel.PropertyChanged += ViewModel_PropertyChanged;
5452
UserSettingsService.OnSettingChangedEvent += UserSettingsService_OnSettingChangedEvent;
5553

@@ -137,9 +135,8 @@ private void HorizontalMultitaskingControl_Loaded(object sender, RoutedEventArgs
137135

138136
private int SetTitleBarDragRegion(InputNonClientPointerSource source, SizeInt32 size, double scaleFactor, Func<UIElement, RectInt32?, RectInt32> getScaledRect)
139137
{
140-
var rtls = Ioc.Default.GetRequiredService<IRealTimeLayoutService>();
141138
var height = (int)TabControl.ActualHeight;
142-
var x = rtls.FlowDirection == FlowDirection.LeftToRight ? 0 : (int)TabControl.ActualWidth;
139+
var x = RealTimeLayoutService.FlowDirection == FlowDirection.LeftToRight ? 0 : (int)TabControl.ActualWidth;
143140
var width = (int)(TabControl.ActualWidth + TabControl.Margin.Left - TabControl.DragArea.ActualWidth);
144141

145142
source.SetRegionRects(NonClientRegionKind.Passthrough, [getScaledRect(this, new RectInt32(x, 0, width, height))]);

src/Files.App/Views/Properties/MainPropertiesPage.xaml.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ public MainPropertiesPage()
2929
{
3030
InitializeComponent();
3131
InitializeContentLayout();
32-
33-
if (FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft)
34-
FlowDirection = FlowDirection.RightToLeft;
3532
}
3633

3734

src/Files.App/Views/Shells/BaseShellPage.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ public BaseShellPage(CurrentInstanceViewModel instanceViewModel)
176176

177177
DisplayFilesystemConsentDialogAsync();
178178

179-
if (FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft)
180-
FlowDirection = FlowDirection.RightToLeft;
181-
182179
ToolbarViewModel.ToolbarPathItemInvoked += ShellPage_NavigationRequested;
183180
ToolbarViewModel.ToolbarFlyoutOpened += ShellPage_ToolbarFlyoutOpened;
184181
ToolbarViewModel.ToolbarPathItemLoaded += ShellPage_ToolbarPathItemLoaded;

0 commit comments

Comments
 (0)