optimize redraw a little

git-svn-id: file:///home/lennart/svn/public/pavucontrol/trunk@42 c17c95f2-f111-0410-90bf-f30a9569010c
This commit is contained in:
Lennart Poettering 2006-08-07 16:45:30 +00:00
parent e634d7a918
commit 1af6b39a9a
1 changed files with 12 additions and 5 deletions

View File

@ -302,9 +302,10 @@ void StreamWidget::setVolume(const pa_cvolume &v, bool force = false) {
volume = v; volume = v;
if (timeoutConnection.empty() || force) /* do not update the volume when a volume change is still in flux */ if (timeoutConnection.empty() || force) { /* do not update the volume when a volume change is still in flux */
for (int i = 0; i < volume.channels; i++) for (int i = 0; i < volume.channels; i++)
channelWidgets[i]->setVolume(volume.values[i]); channelWidgets[i]->setVolume(volume.values[i]);
}
} }
void StreamWidget::updateChannelVolume(int channel, pa_volume_t v) { void StreamWidget::updateChannelVolume(int channel, pa_volume_t v) {
@ -321,7 +322,7 @@ void StreamWidget::updateChannelVolume(int channel, pa_volume_t v) {
setVolume(n, true); setVolume(n, true);
if (timeoutConnection.empty()) if (timeoutConnection.empty())
timeoutConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &StreamWidget::timeoutEvent), 50); timeoutConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &StreamWidget::timeoutEvent), 100);
} }
void StreamWidget::onMuteToggleButton() { void StreamWidget::onMuteToggleButton() {
@ -541,6 +542,7 @@ MainWindow::~MainWindow() {
void MainWindow::updateSink(const pa_sink_info &info) { void MainWindow::updateSink(const pa_sink_info &info) {
SinkWidget *w; SinkWidget *w;
bool is_new = false;
if (sinkWidgets.count(info.index)) if (sinkWidgets.count(info.index))
w = sinkWidgets[info.index]; w = sinkWidgets[info.index];
@ -549,6 +551,7 @@ void MainWindow::updateSink(const pa_sink_info &info) {
w->setChannelMap(info.channel_map); w->setChannelMap(info.channel_map);
sinksVBox->pack_start(*w, false, false, 0); sinksVBox->pack_start(*w, false, false, 0);
w->index = info.index; w->index = info.index;
is_new = true;
} }
w->type = info.flags & PA_SINK_HARDWARE ? SINK_HARDWARE : SINK_VIRTUAL; w->type = info.flags & PA_SINK_HARDWARE ? SINK_HARDWARE : SINK_VIRTUAL;
@ -563,11 +566,13 @@ void MainWindow::updateSink(const pa_sink_info &info) {
w->setVolume(info.volume); w->setVolume(info.volume);
w->muteToggleButton->set_active(info.mute); w->muteToggleButton->set_active(info.mute);
updateDeviceVisibility(); if (is_new)
updateDeviceVisibility();
} }
void MainWindow::updateSource(const pa_source_info &info) { void MainWindow::updateSource(const pa_source_info &info) {
SourceWidget *w; SourceWidget *w;
bool is_new = false;
if (sourceWidgets.count(info.index)) if (sourceWidgets.count(info.index))
w = sourceWidgets[info.index]; w = sourceWidgets[info.index];
@ -576,6 +581,7 @@ void MainWindow::updateSource(const pa_source_info &info) {
w->setChannelMap(info.channel_map); w->setChannelMap(info.channel_map);
sourcesVBox->pack_start(*w, false, false, 0); sourcesVBox->pack_start(*w, false, false, 0);
w->index = info.index; w->index = info.index;
is_new = true;
} }
w->type = info.monitor_of_sink != PA_INVALID_INDEX ? SOURCE_MONITOR : (info.flags & PA_SOURCE_HARDWARE ? SOURCE_HARDWARE : SOURCE_VIRTUAL); w->type = info.monitor_of_sink != PA_INVALID_INDEX ? SOURCE_MONITOR : (info.flags & PA_SOURCE_HARDWARE ? SOURCE_HARDWARE : SOURCE_VIRTUAL);
@ -589,7 +595,8 @@ void MainWindow::updateSource(const pa_source_info &info) {
w->setVolume(info.volume); w->setVolume(info.volume);
w->muteToggleButton->set_active(info.mute); w->muteToggleButton->set_active(info.mute);
updateDeviceVisibility(); if (is_new)
updateDeviceVisibility();
} }
void MainWindow::updateSinkInput(const pa_sink_input_info &info) { void MainWindow::updateSinkInput(const pa_sink_input_info &info) {