diff options
Diffstat (limited to 'src/curses/window.h')
-rw-r--r-- | src/curses/window.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/curses/window.h b/src/curses/window.h index 413e563a..686961fd 100644 --- a/src/curses/window.h +++ b/src/curses/window.h @@ -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 |