Use scoped window timeout
This commit is contained in:
@@ -2895,8 +2895,7 @@ void seek(SearchDirection sd)
|
||||
unsigned songpos = Status::State::elapsedTime();
|
||||
auto t = Timer;
|
||||
|
||||
int old_timeout = wFooter->getTimeout();
|
||||
wFooter->setTimeout(BaseScreen::defaultWindowTimeout);
|
||||
NC::Window::ScopedTimeout stimeout{*wFooter, BaseScreen::defaultWindowTimeout};
|
||||
|
||||
// Accept single action of a given type or action chain for which all actions
|
||||
// can be run and one of them is of the given type. This will still not work
|
||||
@@ -3007,8 +3006,6 @@ void seek(SearchDirection sd)
|
||||
}
|
||||
SeekingInProgress = false;
|
||||
Mpd.Seek(Status::State::currentSongPosition(), songpos);
|
||||
|
||||
wFooter->setTimeout(old_timeout);
|
||||
}
|
||||
|
||||
void findItem(const SearchDirection direction)
|
||||
|
||||
@@ -254,6 +254,25 @@ struct Window
|
||||
PromptHook m_hook;
|
||||
};
|
||||
|
||||
struct ScopedTimeout
|
||||
{
|
||||
ScopedTimeout(Window &w, int new_timeout)
|
||||
: m_w(w)
|
||||
{
|
||||
m_timeout = w.getTimeout();
|
||||
w.setTimeout(new_timeout);
|
||||
}
|
||||
|
||||
~ScopedTimeout()
|
||||
{
|
||||
m_w.setTimeout(m_timeout);
|
||||
}
|
||||
|
||||
private:
|
||||
Window &m_w;
|
||||
int m_timeout;
|
||||
};
|
||||
|
||||
Window() : m_window(nullptr) { }
|
||||
|
||||
/// Constructs an empty window with given parameters
|
||||
|
||||
Reference in New Issue
Block a user