From 9f10e0b629334a5dab5c70c72356f5725621573c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 12 Feb 2021 10:52:14 +0100 Subject: [PATCH] LyricsPage: update page title after loading has finished Schedule a full repaint. We need to do this because this is outside of ncmpc's usual repainting, because the EventLoop did not handle an input event or a MPD idle event. --- NEWS | 1 + src/LyricsPage.cxx | 9 +++++++++ src/screen.hxx | 6 +++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index c8767f15..447909d5 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ncmpc 0.45 - not yet released * make "tagtypes" errors non-fatal * check which tag types are supported by MPD (fixes MPD 0.21 support) +* lyrics: update page title after loading has finished * lyrics: fix path injection bug * lyrics: load cached lyrics without plugin * lyrics: use $XDG_CACHE_HOME/ncmpc/lyrics instead of ~/.lyrics diff --git a/src/LyricsPage.cxx b/src/LyricsPage.cxx index d0422d62..9045f15f 100644 --- a/src/LyricsPage.cxx +++ b/src/LyricsPage.cxx @@ -205,6 +205,9 @@ LyricsPage::OnPluginSuccess(const char *_plugin_name, plugin_timeout.Cancel(); StopPluginCycle(); + + /* schedule a full repaint so the page title gets updated */ + screen.SchedulePaint(); } void @@ -219,6 +222,9 @@ LyricsPage::OnPluginError(std::string error) noexcept plugin_timeout.Cancel(); StopPluginCycle(); + + /* schedule a full repaint so the page title gets updated */ + screen.SchedulePaint(); } void @@ -228,6 +234,9 @@ LyricsPage::OnTimeout() noexcept screen_status_printf(_("Lyrics timeout occurred after %d seconds"), (int)std::chrono::duration_cast(options.lyrics_timeout).count()); + + /* schedule a full repaint so the page title gets updated */ + screen.SchedulePaint(); } void diff --git a/src/screen.hxx b/src/screen.hxx index 3d672bdf..29e7d57b 100644 --- a/src/screen.hxx +++ b/src/screen.hxx @@ -146,13 +146,13 @@ public: Point p, mmask_t bstate); #endif -private: - void NextMode(struct mpdclient &c, int offset) noexcept; - void SchedulePaint() noexcept { paint_event.Schedule(); } +private: + void NextMode(struct mpdclient &c, int offset) noexcept; + void Paint() noexcept; };