From 0a22debf0e7724f8ad0dc1e1efae0a8171a26106 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 30 Aug 2009 06:53:15 +0200 Subject: [PATCH] block displaying elapsed time while seeking properly (alternative ui) --- src/global.h | 1 + src/ncmpcpp.cpp | 3 +++ src/status.cpp | 3 +-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/global.h b/src/global.h index 3e362c27..aca7f9b9 100644 --- a/src/global.h +++ b/src/global.h @@ -44,6 +44,7 @@ namespace Global extern bool UpdateStatusImmediately; extern bool MessagesAllowed; + extern bool SeekingInProgress; extern bool RedrawHeader; extern bool RedrawStatusbar; diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 05823289..e2a029ab 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -81,6 +81,7 @@ size_t Global::MainHeight; bool Global::BlockItemListUpdate = 0; bool Global::MessagesAllowed = 0; +bool Global::SeekingInProgress = 0; bool Global::RedrawHeader = 1; namespace @@ -1108,6 +1109,7 @@ int main(int argc, char *argv[]) songpos = Mpd.GetElapsedTime(); + SeekingInProgress = 1; while (Keypressed(input, Key.SeekForward) || Keypressed(input, Key.SeekBackward)) { TraceMpdStatus(); @@ -1172,6 +1174,7 @@ int main(int argc, char *argv[]) wFooter->Refresh(); } Mpd.Seek(songpos); + SeekingInProgress = 0; UpdateStatusImmediately = 1; UnlockProgressbar(); diff --git a/src/status.cpp b/src/status.cpp index e53a710f..2cae6917 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -447,8 +447,7 @@ void NcmpcppStatusChanged(Connection *, StatusChanges changed, void *) size_t second_margin = (std::max(player_state.length(), size_t(8))+1)*2; size_t second_start = second_len < COLS-second_margin ? (COLS-second_len)/2 : player_state.length()+1; - if (!block_progressbar_update // if blocked, seeking in progress - || lock_statusbar_delay >= 0) // do not block it if message is displayed + if (!SeekingInProgress) *wHeader << XY(0, 0) << wclrtoeol << tracklength; *wHeader << XY(first_start, 0); first.Write(*wHeader, first_line_scroll_begin, COLS-tracklength.length()-VolumeState.length()-1, U(" ** "));