mirror of
https://github.com/ppy/osu
synced 2024-12-28 09:52:56 +00:00
Merge pull request #23573 from Susko3/use-atomic-ReplaceRange
Prevent feedback with display resolution bindable by using atomic `.ReplaceRange()`
This commit is contained in:
commit
3df0eea92d
@ -11,7 +11,7 @@
|
||||
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.513.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.521.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidManifestOverlay Include="$(MSBuildThisFileDirectory)osu.Android\Properties\AndroidManifestOverlay.xml" />
|
||||
|
@ -193,25 +193,17 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
|
||||
currentDisplay.BindValueChanged(display => Schedule(() =>
|
||||
{
|
||||
// there is no easy way to perform an atomic swap on the `resolutions` list, which is bound to the dropdown via `ItemSource`.
|
||||
// this means, if the old resolution isn't saved, the `RemoveRange()` call below will cause `resolutionDropdown.Current` to reset value,
|
||||
// therefore making it impossible to select any dropdown value other than "Default".
|
||||
// to circumvent this locally, store the old value here, so that we can attempt to restore it later.
|
||||
var oldResolution = resolutionDropdown.Current.Value;
|
||||
|
||||
resolutions.RemoveRange(1, resolutions.Count - 1);
|
||||
|
||||
if (display.NewValue != null)
|
||||
if (display.NewValue == null)
|
||||
{
|
||||
resolutions.AddRange(display.NewValue.DisplayModes
|
||||
.Where(m => m.Size.Width >= 800 && m.Size.Height >= 600)
|
||||
.OrderByDescending(m => Math.Max(m.Size.Height, m.Size.Width))
|
||||
.Select(m => m.Size)
|
||||
.Distinct());
|
||||
resolutions.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (resolutions.Contains(oldResolution))
|
||||
resolutionDropdown.Current.Value = oldResolution;
|
||||
resolutions.ReplaceRange(1, resolutions.Count - 1, display.NewValue.DisplayModes
|
||||
.Where(m => m.Size.Width >= 800 && m.Size.Height >= 600)
|
||||
.OrderByDescending(m => Math.Max(m.Size.Height, m.Size.Width))
|
||||
.Select(m => m.Size)
|
||||
.Distinct());
|
||||
|
||||
updateDisplaySettingsVisibility();
|
||||
}), true);
|
||||
|
@ -30,13 +30,13 @@
|
||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Toolkit.HighPerformance" Version="7.1.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="ppy.LocalisationAnalyser" Version="2022.809.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="10.20.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2023.513.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2023.521.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.510.0" />
|
||||
<PackageReference Include="Sentry" Version="3.28.1" />
|
||||
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
||||
|
@ -16,6 +16,6 @@
|
||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.513.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.521.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user