mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Schedule adding transforms on tablet changes
Fixes `InvalidThreadForMutationException`s that pop up when disconnecting/reconnecting tablets during the game's operation. In those cases the value change callback executes from an OpenTabletDriver thread.
This commit is contained in:
@ -196,19 +196,13 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
tablet.BindTo(tabletHandler.Tablet);
|
||||
tablet.BindValueChanged(val =>
|
||||
{
|
||||
Scheduler.AddOnce(toggleVisibility);
|
||||
|
||||
var tab = val.NewValue;
|
||||
|
||||
bool tabletFound = tab != null;
|
||||
|
||||
if (!tabletFound)
|
||||
{
|
||||
mainSettings.Hide();
|
||||
noTabletMessage.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
mainSettings.Show();
|
||||
noTabletMessage.Hide();
|
||||
|
||||
offsetX.MaxValue = tab.Size.X;
|
||||
offsetX.Default = tab.Size.X / 2;
|
||||
@ -222,6 +216,21 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
}, true);
|
||||
}
|
||||
|
||||
private void toggleVisibility()
|
||||
{
|
||||
bool tabletFound = tablet.Value != null;
|
||||
|
||||
if (!tabletFound)
|
||||
{
|
||||
mainSettings.Hide();
|
||||
noTabletMessage.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
mainSettings.Show();
|
||||
noTabletMessage.Hide();
|
||||
}
|
||||
|
||||
private void applyAspectRatio(BindableNumber<float> sizeChanged)
|
||||
{
|
||||
try
|
||||
|
Reference in New Issue
Block a user