summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Rybczak <andrzej@rybczak.net>2020-12-21 16:55:19 +0100
committerAndrzej Rybczak <andrzej@rybczak.net>2020-12-21 16:55:19 +0100
commit88025e2e931ec305c5945b682053fc2af9c9c90c (patch)
tree8f11b7ddb8e6ee74e95100206d19ded4de8e30e0
parent679cc7a2cb1f8f434bd6d21b3b316fa1617252e9 (diff)
Better fix for showing visualiser immediately after startup
-rw-r--r--src/ncmpcpp.cpp3
-rw-r--r--src/status.cpp19
2 files changed, 10 insertions, 12 deletions
diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp
index 15991231..a186c6aa 100644
--- a/src/ncmpcpp.cpp
+++ b/src/ncmpcpp.cpp
@@ -189,9 +189,6 @@ int main(int argc, char **argv)
Mpd.Disconnect();
throw MPD::ClientError(MPD_ERROR_STATE, "MPD < 0.16.0 is not supported", false);
}
- // Once the connection is established, run full Status::trace to set a
- // proper window timeout, initialize status etc.
- Status::trace(true, true);
}
catch (MPD::ClientError &e)
{
diff --git a/src/status.cpp b/src/status.cpp
index 5ee50b4a..6af5e621 100644
--- a/src/status.cpp
+++ b/src/status.cpp
@@ -209,15 +209,6 @@ void Status::trace(bool update_timer, bool update_window_timeout)
{
if (update_timer)
Timer = boost::posix_time::microsec_clock::local_time();
- if (update_window_timeout)
- {
- // set appropriate window timeout
- int nc_wtimeout = std::numeric_limits<int>::max();
- applyToVisibleWindows([&nc_wtimeout](BaseScreen *s) {
- nc_wtimeout = std::min(nc_wtimeout, s->windowTimeout());
- });
- wFooter->setTimeout(nc_wtimeout);
- }
if (Mpd.Connected())
{
if (!m_status_initialized)
@@ -237,6 +228,16 @@ void Status::trace(bool update_timer, bool update_window_timeout)
Mpd.idle();
}
+ // Update timeout after MPD as it may depend on its status.
+ if (update_window_timeout)
+ {
+ // set appropriate window timeout
+ int nc_wtimeout = std::numeric_limits<int>::max();
+ applyToVisibleWindows([&nc_wtimeout](BaseScreen *s) {
+ nc_wtimeout = std::min(nc_wtimeout, s->windowTimeout());
+ });
+ wFooter->setTimeout(nc_wtimeout);
+ }
}
void Status::update(int event)