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;
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++)
channelWidgets[i]->setVolume(volume.values[i]);
}
}
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);
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() {
@ -541,6 +542,7 @@ MainWindow::~MainWindow() {
void MainWindow::updateSink(const pa_sink_info &info) {
SinkWidget *w;
bool is_new = false;
if (sinkWidgets.count(info.index))
w = sinkWidgets[info.index];
@ -549,6 +551,7 @@ void MainWindow::updateSink(const pa_sink_info &info) {
w->setChannelMap(info.channel_map);
sinksVBox->pack_start(*w, false, false, 0);
w->index = info.index;
is_new = true;
}
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->muteToggleButton->set_active(info.mute);
if (is_new)
updateDeviceVisibility();
}
void MainWindow::updateSource(const pa_source_info &info) {
SourceWidget *w;
bool is_new = false;
if (sourceWidgets.count(info.index))
w = sourceWidgets[info.index];
@ -576,6 +581,7 @@ void MainWindow::updateSource(const pa_source_info &info) {
w->setChannelMap(info.channel_map);
sourcesVBox->pack_start(*w, false, false, 0);
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);
@ -589,6 +595,7 @@ void MainWindow::updateSource(const pa_source_info &info) {
w->setVolume(info.volume);
w->muteToggleButton->set_active(info.mute);
if (is_new)
updateDeviceVisibility();
}