mirror of
https://github.com/ppy/osu
synced 2024-12-28 18:02:53 +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>
|
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.513.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.521.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidManifestOverlay Include="$(MSBuildThisFileDirectory)osu.Android\Properties\AndroidManifestOverlay.xml" />
|
<AndroidManifestOverlay Include="$(MSBuildThisFileDirectory)osu.Android\Properties\AndroidManifestOverlay.xml" />
|
||||||
|
@ -193,25 +193,17 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
|
|
||||||
currentDisplay.BindValueChanged(display => Schedule(() =>
|
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`.
|
if (display.NewValue == null)
|
||||||
// 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)
|
|
||||||
{
|
{
|
||||||
resolutions.AddRange(display.NewValue.DisplayModes
|
resolutions.Clear();
|
||||||
.Where(m => m.Size.Width >= 800 && m.Size.Height >= 600)
|
return;
|
||||||
.OrderByDescending(m => Math.Max(m.Size.Height, m.Size.Width))
|
|
||||||
.Select(m => m.Size)
|
|
||||||
.Distinct());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolutions.Contains(oldResolution))
|
resolutions.ReplaceRange(1, resolutions.Count - 1, display.NewValue.DisplayModes
|
||||||
resolutionDropdown.Current.Value = oldResolution;
|
.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();
|
updateDisplaySettingsVisibility();
|
||||||
}), true);
|
}), true);
|
||||||
|
@ -30,13 +30,13 @@
|
|||||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.2" />
|
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.2" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Toolkit.HighPerformance" Version="7.1.2" />
|
<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">
|
<PackageReference Include="ppy.LocalisationAnalyser" Version="2022.809.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="10.20.0" />
|
<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="ppy.osu.Game.Resources" Version="2023.510.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.28.1" />
|
<PackageReference Include="Sentry" Version="3.28.1" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
||||||
|
@ -16,6 +16,6 @@
|
|||||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.513.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.521.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user