diff --git a/src/actions.cpp b/src/actions.cpp index 03a7bade..d96ff1ed 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -199,6 +199,8 @@ void resizeScreen(bool reload_main_window) rl_resize_terminal(); endwin(); refresh(); + // Remove KEY_RESIZE from input queue, I'm not sure how these make it in. + getch(); } MainHeight = LINES-(Config.design == Design::Alternative ? 7 : 4); diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index b18fa333..2d5245ac 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -103,12 +103,8 @@ int main(int argc, char **argv) cerr_buffer = std::cerr.rdbuf(); std::cerr.rdbuf(errorlog.rdbuf()); -# ifndef WIN32 - signal(SIGPIPE, sighandler); + sigignore(SIGPIPE); signal(SIGWINCH, sighandler); - // ignore Ctrl-C - sigignore(SIGINT); -# endif // !WIN32 NC::initScreen(Config.colors_enabled, Config.mouse_support); diff --git a/src/window.cpp b/src/window.cpp index fc910458..aead6e75 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -33,21 +33,6 @@ namespace { -struct ScopedWindowTimeout -{ - ScopedWindowTimeout(WINDOW *w, int init_timeout, int term_timeout) - : m_w(w), m_term_timeout(term_timeout) { - wtimeout(w, init_timeout); - } - ~ScopedWindowTimeout() { - wtimeout(m_w, m_term_timeout); - } - -private: - WINDOW *m_w; - int m_term_timeout; -}; - namespace rl { bool aborted; @@ -359,6 +344,7 @@ void initScreen(bool enable_colors, bool enable_mouse) raw(); nonl(); noecho(); + timeout(0); curs_set(0); // setup mouse @@ -387,6 +373,7 @@ void initScreen(bool enable_colors, bool enable_mouse) rl_deprep_term_function = nullptr; // do not catch signals rl_catch_signals = 0; + rl_catch_sigwinch = 0; // overwrite readline callbacks rl_getc_function = rl::read_key; rl_redisplay_function = rl::display_string; @@ -586,7 +573,7 @@ void Window::recreate(size_t width, size_t height) { delwin(m_window); m_window = newpad(height, width); - setTimeout(m_window_timeout); + wtimeout(m_window, 0); setColor(m_color); } @@ -701,11 +688,7 @@ void Window::altCharset(bool altcharset_state) const void Window::setTimeout(int timeout) { - if (timeout != m_window_timeout) - { - m_window_timeout = timeout; - wtimeout(m_window, timeout); - } + m_window_timeout = timeout; } void Window::addFDCallback(int fd, void (*callback)()) @@ -800,7 +783,6 @@ Key::Type Window::getInputChar(int key) result = result*10 + x - '0'; } }; - ScopedWindowTimeout swt(m_window, 0, m_window_timeout); key = wgetch(m_window); switch (key) {