Skip to content

Commit

Permalink
LyricsPage: update page title after loading has finished
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MaxKellermann committed Feb 12, 2021
1 parent 4b8165f commit 9f10e0b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/LyricsPage.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -228,6 +234,9 @@ LyricsPage::OnTimeout() noexcept

screen_status_printf(_("Lyrics timeout occurred after %d seconds"),
(int)std::chrono::duration_cast<std::chrono::seconds>(options.lyrics_timeout).count());

/* schedule a full repaint so the page title gets updated */
screen.SchedulePaint();
}

void
Expand Down
6 changes: 3 additions & 3 deletions src/screen.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down

0 comments on commit 9f10e0b

Please sign in to comment.