Made the display update sooner when launching steam deck software

This commit is contained in:
dlprows 2023-09-10 22:16:16 -06:00
parent 2e44a27b2b
commit 1fea2a2e11

View File

@ -70,6 +70,7 @@ public class DialAction : EncoderBase
_thread.Start();
_currentAudioSession = settings.FallbackBehavior == FallbackBehavior.SystemSounds ? _audioHelper.GetSystemSounds() : _audioHelper.GetSystemVolume();
_ = UpdateStateIfNeeded();
}
public override async void DialDown(DialPayload payload)
@ -174,26 +175,34 @@ public class DialAction : EncoderBase
private async Task UpdateStateIfNeeded()
{
if (_currentAudioSession != null)
try
{
var uiState = new UIState(_currentAudioSession);
if (_previousState != null && uiState != null &&
uiState.Title == _previousState.Title &&
uiState.Value.Value == _previousState.Value.Value &&
uiState.Value.Opacity == _previousState.Value.Opacity &&
uiState.Indicator.Value == _previousState.Indicator.Value &&
uiState.Indicator.Opacity == _previousState.Indicator.Opacity &&
uiState.icon.Value == _previousState.icon.Value &&
uiState.icon.Opacity == _previousState.icon.Opacity
)
if (_currentAudioSession != null)
{
return;
}
await Connection.SetFeedbackAsync(uiState);
_previousState = uiState;
var uiState = new UIState(_currentAudioSession);
if (_previousState != null && uiState != null &&
uiState.Title == _previousState.Title &&
uiState.Value.Value == _previousState.Value.Value &&
uiState.Value.Opacity == _previousState.Value.Opacity &&
uiState.Indicator.Value == _previousState.Indicator.Value &&
uiState.Indicator.Opacity == _previousState.Indicator.Opacity &&
uiState.icon.Value == _previousState.icon.Value &&
uiState.icon.Opacity == _previousState.icon.Opacity
)
{
return;
}
await Connection.SetFeedbackAsync(uiState);
_previousState = uiState;
}
}
catch (Exception ex )
{
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Failed to update screen\n {ex}");
}
}