diff --git a/NEWS b/NEWS index 8ac831db..8a735b4d 100644 --- a/NEWS +++ b/NEWS @@ -19,7 +19,7 @@ ncmpcpp-0.7 (????-??-??) * Support for the Perl regular expression syntax was added. * BOOST_LIB_SUFFIX configure variable is now empty by default. * Shuffle function now shuffles only selected range if selection in playlist is active. -* Do not use ncurses terminal sequence escaping by default as it doesn't have enough support for mouse events. +* NCurses terminal sequence escaping is no longer used as it's not accurate enough. ncmpcpp-0.6.4 (2015-05-02) diff --git a/configure.ac b/configure.ac index 4200d021..492f95b5 100644 --- a/configure.ac +++ b/configure.ac @@ -14,7 +14,6 @@ AC_ARG_ENABLE(visualizer, AS_HELP_STRING([--enable-visualizer], [Enable music vi AC_ARG_ENABLE(clock, AS_HELP_STRING([--enable-clock], [Enable clock screen @<:@default=no@:>@]), [clock=$enableval], [clock=no]) AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode], [Enable utf8 support @<:@default=yes@:>@]), [unicode=$enableval], [unicode=yes]) -AC_ARG_WITH(ncurses-sequence-escaping, AS_HELP_STRING([--with-ncurses-sequence-escaping], [Use built-in ncurses terminal sequence escaping @<:@default=no@:>@]), [ncurses_sequence_escaping=$withval], [ncurses_sequence_escaping=no]) AC_ARG_WITH(curl, AS_HELP_STRING([--with-curl], [Enable fetching lyrics from the Internet @<:@default=auto@:>@]), [curl=$withval], [curl=auto]) AC_ARG_WITH(fftw, AS_HELP_STRING([--with-fftw], [Enable fftw support (required for frequency spectrum vizualization) @<:@default=auto@:>@]), [fftw=$withval], [fftw=auto]) AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto]) @@ -27,13 +26,6 @@ if test "$clock" = "yes"; then AC_DEFINE([ENABLE_CLOCK], [1], [enables clock screen]) fi -AH_TEMPLATE([NCURSES_SEQUENCE_ESCAPING], [Use built-in ncurses terminal sequence escaping]) -if test "$ncurses_sequence_escaping" = "yes"; then - AC_DEFINE([NCURSES_SEQUENCE_ESCAPING], [1]) -else - AC_DEFINE([NCURSES_SEQUENCE_ESCAPING], [0]) -fi - dnl ================================ dnl = checking for -std=c++0x flag = dnl ================================ diff --git a/src/actions.cpp b/src/actions.cpp index e7ab6017..75810e50 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -308,17 +308,6 @@ void MouseEvent::run() m_old_mouse_event = m_mouse_event; m_mouse_event = wFooter->getMouseEvent(); -# if NCURSES_SEQUENCE_ESCAPING && NCURSES_MOUSE_VERSION == 1 - // workaround shitty ncurses behavior introduced in >=5.8, when we mysteriously get - // a few times after ncmpcpp startup 2^27 code instead of BUTTON{1,3}_RELEASED. since that - // 2^27 thing shows constantly instead of BUTTON2_PRESSED, it was redefined to be recognized - // as BUTTON5_PRESSED. but clearly we don't want to trigger behavior bound to BUTTON5 - // after BUTTON{1,3} was pressed. so, here is the workaround: if last event was BUTTON{1,3}_PRESSED, - // we MUST get BUTTON{1,3}_RELEASED afterwards. if we get BUTTON5_PRESSED, erroneus behavior - // is about to occur and we need to prevent that. - if (m_old_mouse_event.bstate & (BUTTON1_PRESSED | BUTTON3_PRESSED) && m_mouse_event.bstate & BUTTON5_PRESSED) - return; -# endif // NCURSES_SEQUENCE_ESCAPING && NCURSES_MOUSE_VERSION == 1 //Statusbar::printf("(%1%, %2%, %3%)", m_mouse_event.bstate, m_mouse_event.x, m_mouse_event.y); diff --git a/src/scrollpad.cpp b/src/scrollpad.cpp index 82b8d8dc..6900dc24 100644 --- a/src/scrollpad.cpp +++ b/src/scrollpad.cpp @@ -131,9 +131,6 @@ void Scrollpad::clear() m_window = newpad(m_height, m_width); setTimeout(m_window_timeout); setColor(m_color); -# if NCURSES_SEQUENCE_ESCAPING - keypad(m_window, 1); -# endif // NCURSES_SEQUENCE_ESCAPING } const std::string &Scrollpad::buffer() diff --git a/src/window.cpp b/src/window.cpp index a85bba16..e88981e4 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -318,16 +318,12 @@ void enable() { if (mouseEnabled) return; -# if NCURSES_SEQUENCE_ESCAPING - mousemask(ALL_MOUSE_EVENTS, nullptr); -# else // save old highlight mouse tracking printf("\e[?1001s"); // enable mouse tracking printf("\e[?1000h"); // try to enable extended (urxvt) mouse tracking printf("\e[?1015h"); -# endif // NCURSES_SEQUENCE_ESCAPING mouseEnabled = true; } @@ -335,16 +331,12 @@ void disable() { if (!mouseEnabled) return; -# if NCURSES_SEQUENCE_ESCAPING - mousemask(0, nullptr); -# else // disable extended (urxvt) mouse tracking printf("\e[?1015l"); // disable mouse tracking printf("\e[?1000l"); // restore old highlight mouse tracking printf("\e[?1001r"); -# endif // NCURSES_SEQUENCE_ESCAPING mouseEnabled = false; } @@ -370,9 +362,6 @@ void initScreen(bool enable_colors, bool enable_mouse) curs_set(0); // setup mouse -# if NCURSES_SEQUENCE_ESCAPING - mouseinterval(0); -# endif // NCURSES_SEQUENCE_ESCAPING if (enable_mouse) Mouse::enable(); @@ -457,9 +446,6 @@ Window::Window(size_t startx, m_window = newpad(m_height, m_width); setColor(m_color); -# if NCURSES_SEQUENCE_ESCAPING - keypad(m_window, 1); -# endif // NCURSES_SEQUENCE_ESCAPING } Window::Window(const Window &rhs) @@ -602,9 +588,6 @@ void Window::recreate(size_t width, size_t height) m_window = newpad(height, width); setTimeout(m_window_timeout); setColor(m_color); -# if NCURSES_SEQUENCE_ESCAPING - keypad(m_window, 1); -# endif // NCURSES_SEQUENCE_ESCAPING } void Window::moveTo(size_t new_x, size_t new_y) @@ -742,9 +725,6 @@ bool Window::FDCallbacksListEmpty() const int Window::getInputChar() { -# if NCURSES_SEQUENCE_ESCAPING - return wgetch(m_window); -# else int key = wgetch(m_window); if (!m_escape_terminal_sequences || key != KEY_ESCAPE) return key; @@ -950,7 +930,6 @@ int Window::getInputChar() m_input_queue.push(key); return KEY_ESCAPE; } -# endif // NCURSES_SEQUENCE_ESCAPING } int Window::readKey() @@ -1008,17 +987,11 @@ std::string Window::prompt(const std::string &base, size_t width, bool encrypted rl::base = base.c_str(); curs_set(1); -# if NCURSES_SEQUENCE_ESCAPING - keypad(m_window, 0); -# endif // NCURSES_SEQUENCE_ESCAPING Mouse::disable(); m_escape_terminal_sequences = false; char *input = readline(nullptr); m_escape_terminal_sequences = true; Mouse::enable(); -# if NCURSES_SEQUENCE_ESCAPING - keypad(m_window, 1); -# endif // NCURSES_SEQUENCE_ESCAPING curs_set(0); if (input != nullptr) { @@ -1125,9 +1098,6 @@ int Window::getTimeout() const const MEVENT &Window::getMouseEvent() { -# if NCURSES_SEQUENCE_ESCAPING - getmouse(&m_mouse_event); -# endif // NCURSES_SEQUENCE_ESCAPING return m_mouse_event; } diff --git a/src/window.h b/src/window.h index 7b57de0f..f207f338 100644 --- a/src/window.h +++ b/src/window.h @@ -96,14 +96,7 @@ const int KEY_BACKSPACE_2 = 127; const int KEY_ENTER = 13; #if NCURSES_MOUSE_VERSION == 1 -# if NCURSES_SEQUENCE_ESCAPING -// NOTICE: define BUTTON5_PRESSED to be BUTTON2_PRESSED with additional mask -// (I noticed that it sometimes returns 134217728 (2^27) instead of expected -// mask, so the modified define does it right. -# define BUTTON5_PRESSED (BUTTON2_PRESSED | (1U << 27)) -# else -# define BUTTON5_PRESSED (1U << 27) -# endif // NCURSES_SEQUENCE_ESCAPING +# define BUTTON5_PRESSED (1U << 27) #endif // NCURSES_MOUSE_VERSION == 1 // undefine macros with colliding names