remove support for ncurses terminal sequence escaping
This commit is contained in:
2
NEWS
2
NEWS
@@ -19,7 +19,7 @@ ncmpcpp-0.7 (????-??-??)
|
|||||||
* Support for the Perl regular expression syntax was added.
|
* Support for the Perl regular expression syntax was added.
|
||||||
* BOOST_LIB_SUFFIX configure variable is now empty by default.
|
* BOOST_LIB_SUFFIX configure variable is now empty by default.
|
||||||
* Shuffle function now shuffles only selected range if selection in playlist is active.
|
* 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)
|
ncmpcpp-0.6.4 (2015-05-02)
|
||||||
|
|
||||||
|
|||||||
@@ -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(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_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(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(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])
|
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])
|
AC_DEFINE([ENABLE_CLOCK], [1], [enables clock screen])
|
||||||
fi
|
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 ================================
|
||||||
dnl = checking for -std=c++0x flag =
|
dnl = checking for -std=c++0x flag =
|
||||||
dnl ================================
|
dnl ================================
|
||||||
|
|||||||
@@ -308,17 +308,6 @@ void MouseEvent::run()
|
|||||||
|
|
||||||
m_old_mouse_event = m_mouse_event;
|
m_old_mouse_event = m_mouse_event;
|
||||||
m_mouse_event = wFooter->getMouseEvent();
|
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);
|
//Statusbar::printf("(%1%, %2%, %3%)", m_mouse_event.bstate, m_mouse_event.x, m_mouse_event.y);
|
||||||
|
|
||||||
|
|||||||
@@ -131,9 +131,6 @@ void Scrollpad::clear()
|
|||||||
m_window = newpad(m_height, m_width);
|
m_window = newpad(m_height, m_width);
|
||||||
setTimeout(m_window_timeout);
|
setTimeout(m_window_timeout);
|
||||||
setColor(m_color);
|
setColor(m_color);
|
||||||
# if NCURSES_SEQUENCE_ESCAPING
|
|
||||||
keypad(m_window, 1);
|
|
||||||
# endif // NCURSES_SEQUENCE_ESCAPING
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &Scrollpad::buffer()
|
const std::string &Scrollpad::buffer()
|
||||||
|
|||||||
@@ -318,16 +318,12 @@ void enable()
|
|||||||
{
|
{
|
||||||
if (mouseEnabled)
|
if (mouseEnabled)
|
||||||
return;
|
return;
|
||||||
# if NCURSES_SEQUENCE_ESCAPING
|
|
||||||
mousemask(ALL_MOUSE_EVENTS, nullptr);
|
|
||||||
# else
|
|
||||||
// save old highlight mouse tracking
|
// save old highlight mouse tracking
|
||||||
printf("\e[?1001s");
|
printf("\e[?1001s");
|
||||||
// enable mouse tracking
|
// enable mouse tracking
|
||||||
printf("\e[?1000h");
|
printf("\e[?1000h");
|
||||||
// try to enable extended (urxvt) mouse tracking
|
// try to enable extended (urxvt) mouse tracking
|
||||||
printf("\e[?1015h");
|
printf("\e[?1015h");
|
||||||
# endif // NCURSES_SEQUENCE_ESCAPING
|
|
||||||
mouseEnabled = true;
|
mouseEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,16 +331,12 @@ void disable()
|
|||||||
{
|
{
|
||||||
if (!mouseEnabled)
|
if (!mouseEnabled)
|
||||||
return;
|
return;
|
||||||
# if NCURSES_SEQUENCE_ESCAPING
|
|
||||||
mousemask(0, nullptr);
|
|
||||||
# else
|
|
||||||
// disable extended (urxvt) mouse tracking
|
// disable extended (urxvt) mouse tracking
|
||||||
printf("\e[?1015l");
|
printf("\e[?1015l");
|
||||||
// disable mouse tracking
|
// disable mouse tracking
|
||||||
printf("\e[?1000l");
|
printf("\e[?1000l");
|
||||||
// restore old highlight mouse tracking
|
// restore old highlight mouse tracking
|
||||||
printf("\e[?1001r");
|
printf("\e[?1001r");
|
||||||
# endif // NCURSES_SEQUENCE_ESCAPING
|
|
||||||
mouseEnabled = false;
|
mouseEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,9 +362,6 @@ void initScreen(bool enable_colors, bool enable_mouse)
|
|||||||
curs_set(0);
|
curs_set(0);
|
||||||
|
|
||||||
// setup mouse
|
// setup mouse
|
||||||
# if NCURSES_SEQUENCE_ESCAPING
|
|
||||||
mouseinterval(0);
|
|
||||||
# endif // NCURSES_SEQUENCE_ESCAPING
|
|
||||||
if (enable_mouse)
|
if (enable_mouse)
|
||||||
Mouse::enable();
|
Mouse::enable();
|
||||||
|
|
||||||
@@ -457,9 +446,6 @@ Window::Window(size_t startx,
|
|||||||
m_window = newpad(m_height, m_width);
|
m_window = newpad(m_height, m_width);
|
||||||
|
|
||||||
setColor(m_color);
|
setColor(m_color);
|
||||||
# if NCURSES_SEQUENCE_ESCAPING
|
|
||||||
keypad(m_window, 1);
|
|
||||||
# endif // NCURSES_SEQUENCE_ESCAPING
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::Window(const Window &rhs)
|
Window::Window(const Window &rhs)
|
||||||
@@ -602,9 +588,6 @@ void Window::recreate(size_t width, size_t height)
|
|||||||
m_window = newpad(height, width);
|
m_window = newpad(height, width);
|
||||||
setTimeout(m_window_timeout);
|
setTimeout(m_window_timeout);
|
||||||
setColor(m_color);
|
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)
|
void Window::moveTo(size_t new_x, size_t new_y)
|
||||||
@@ -742,9 +725,6 @@ bool Window::FDCallbacksListEmpty() const
|
|||||||
|
|
||||||
int Window::getInputChar()
|
int Window::getInputChar()
|
||||||
{
|
{
|
||||||
# if NCURSES_SEQUENCE_ESCAPING
|
|
||||||
return wgetch(m_window);
|
|
||||||
# else
|
|
||||||
int key = wgetch(m_window);
|
int key = wgetch(m_window);
|
||||||
if (!m_escape_terminal_sequences || key != KEY_ESCAPE)
|
if (!m_escape_terminal_sequences || key != KEY_ESCAPE)
|
||||||
return key;
|
return key;
|
||||||
@@ -950,7 +930,6 @@ int Window::getInputChar()
|
|||||||
m_input_queue.push(key);
|
m_input_queue.push(key);
|
||||||
return KEY_ESCAPE;
|
return KEY_ESCAPE;
|
||||||
}
|
}
|
||||||
# endif // NCURSES_SEQUENCE_ESCAPING
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Window::readKey()
|
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();
|
rl::base = base.c_str();
|
||||||
|
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
# if NCURSES_SEQUENCE_ESCAPING
|
|
||||||
keypad(m_window, 0);
|
|
||||||
# endif // NCURSES_SEQUENCE_ESCAPING
|
|
||||||
Mouse::disable();
|
Mouse::disable();
|
||||||
m_escape_terminal_sequences = false;
|
m_escape_terminal_sequences = false;
|
||||||
char *input = readline(nullptr);
|
char *input = readline(nullptr);
|
||||||
m_escape_terminal_sequences = true;
|
m_escape_terminal_sequences = true;
|
||||||
Mouse::enable();
|
Mouse::enable();
|
||||||
# if NCURSES_SEQUENCE_ESCAPING
|
|
||||||
keypad(m_window, 1);
|
|
||||||
# endif // NCURSES_SEQUENCE_ESCAPING
|
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
if (input != nullptr)
|
if (input != nullptr)
|
||||||
{
|
{
|
||||||
@@ -1125,9 +1098,6 @@ int Window::getTimeout() const
|
|||||||
|
|
||||||
const MEVENT &Window::getMouseEvent()
|
const MEVENT &Window::getMouseEvent()
|
||||||
{
|
{
|
||||||
# if NCURSES_SEQUENCE_ESCAPING
|
|
||||||
getmouse(&m_mouse_event);
|
|
||||||
# endif // NCURSES_SEQUENCE_ESCAPING
|
|
||||||
return m_mouse_event;
|
return m_mouse_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,14 +96,7 @@ const int KEY_BACKSPACE_2 = 127;
|
|||||||
const int KEY_ENTER = 13;
|
const int KEY_ENTER = 13;
|
||||||
|
|
||||||
#if NCURSES_MOUSE_VERSION == 1
|
#if NCURSES_MOUSE_VERSION == 1
|
||||||
# if NCURSES_SEQUENCE_ESCAPING
|
# define BUTTON5_PRESSED (1U << 27)
|
||||||
// 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
|
|
||||||
#endif // NCURSES_MOUSE_VERSION == 1
|
#endif // NCURSES_MOUSE_VERSION == 1
|
||||||
|
|
||||||
// undefine macros with colliding names
|
// undefine macros with colliding names
|
||||||
|
|||||||
Reference in New Issue
Block a user