mainwindow: set the updating flag later for sinks and sources

The updating flag is used to determine whether a change in some UI
control state is due to a user action or an update from the server. The
flag was set to false too early when processing sink and source updates
from the server. This caused at least unnecessary "set port" commands,
because each update refreshes the port list, which generates change
events in the port list combo box, causing the portChanged callbacks to
be called.

The unnecessary "set port" commands could even confuse the automatic
port selection policies in the server. If the current port wasn't
originally explicitly chosen by the user, then the "set port" command
from pavucontrol will make the server think that the user explicitly
chose that port.
This commit is contained in:
Tanu Kaskinen 2019-09-19 11:37:11 +03:00
parent e6caa8b87a
commit 0dd27ba347
1 changed files with 4 additions and 4 deletions

View File

@ -535,13 +535,13 @@ bool MainWindow::updateSink(const pa_sink_info &info) {
w->setDigital(info.flags & PA_SINK_SET_FORMATS); w->setDigital(info.flags & PA_SINK_SET_FORMATS);
#endif #endif
w->updating = false;
w->prepareMenu(); w->prepareMenu();
if (is_new) if (is_new)
updateDeviceVisibility(); updateDeviceVisibility();
w->updating = false;
return is_new; return is_new;
} }
@ -698,12 +698,12 @@ void MainWindow::updateSource(const pa_source_info &info) {
if (cw != cardWidgets.end()) if (cw != cardWidgets.end())
updatePorts(w, cw->second->ports); updatePorts(w, cw->second->ports);
w->updating = false;
w->prepareMenu(); w->prepareMenu();
if (is_new) if (is_new)
updateDeviceVisibility(); updateDeviceVisibility();
w->updating = false;
} }
void MainWindow::setIconFromProplist(Gtk::Image *icon, pa_proplist *l, const char *def) { void MainWindow::setIconFromProplist(Gtk::Image *icon, pa_proplist *l, const char *def) {