Update JackServerSettingsDialog.tsx

only clear the ALSA device fields when you uncheck the box,

still refresh the device list (via requestAlsaInfo()) but

preserve the checkbox state (so it doesn’t get recalculated back to true)
This commit is contained in:
Extremesecrecy
2025-07-24 12:25:09 -07:00
parent de7b905ca2
commit 53282d11c9
+18 -17
View File
@@ -300,8 +300,7 @@ const JackServerSettingsDialog = withStyles(
alsaDevices: devices,
jackServerSettings: settings,
latencyText: getLatencyText(settings),
okEnabled: isOkEnabled(settings,devices),
useSameDevice: settings.alsaInputDevice === settings.alsaOutputDevice
okEnabled: isOkEnabled(settings,devices)
});
} else {
this.setState({ alsaDevices: devices });
@@ -504,25 +503,27 @@ const JackServerSettingsDialog = withStyles(
okEnabled: isOkEnabled(settings, this.state.alsaDevices)
});
}
handleUseSameDeviceChanged(e: any, checked: boolean) {
let s = this.state.jackServerSettings.clone();
const useSame = checked;
// release previous selection
handleUseSameDeviceChanged(e: any, checked: boolean) {
let s = this.state.jackServerSettings.clone();
const useSame = checked;
if (!useSame) {
// clear selections when switching to separate devices
s.alsaInputDevice = INVALID_DEVICE_ID;
s.alsaOutputDevice = INVALID_DEVICE_ID;
s.valid = false;
let settings = this.applyAlsaDevices(s, this.state.alsaDevices, useSame);
this.setState({
useSameDevice: useSame,
jackServerSettings: settings,
latencyText: getLatencyText(settings),
okEnabled: isOkEnabled(settings, this.state.alsaDevices)
}, () => {
this.requestAlsaInfo();
});
}
let settings = this.applyAlsaDevices(s, this.state.alsaDevices, useSame);
this.setState({
useSameDevice: useSame,
jackServerSettings: settings,
latencyText: getLatencyText(settings),
okEnabled: isOkEnabled(settings, this.state.alsaDevices)
}, () => {
this.requestAlsaInfo();
});
}
render() {
const classes = withStyles.getClasses(this.props);