remove support for PDCurses

This commit is contained in:
Andrzej Rybczak
2014-11-15 20:00:33 +01:00
parent 5d75becca9
commit 1a1105793d
8 changed files with 15 additions and 78 deletions

1
NEWS
View File

@@ -10,6 +10,7 @@ ncmpcpp-0.7 (????-??-??)
* Find backward/forward function is now incremental.
* Support for 256 colors and customization of background colors has been added.
* Multiple configuration files via command line arguments are now accepted. In addition, by default ncmpcpp attempts to read both $HOME/.ncmpcpp/config and $XDG_CONFIG_HOME/ncmpcpp/config (in this order).
* Support for PDCurses has been removed due to the library being unmaintained and buggy.
ncmpcpp-0.6.2 (????-??-??)

View File

@@ -15,7 +15,6 @@ AC_ARG_ENABLE(clock, AS_HELP_STRING([--enable-clock], [Enable clock screen @<:@d
AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode], [Enable utf8 support @<:@default=yes@:>@]), [unicode=$enableval], [unicode=yes])
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(pdcurses, AS_HELP_STRING([--with-pdcurses[=LIBNAME]], [Link against pdcurses instead of ncurses @<:@default=XCurses@:>@]), [pdcurses=$withval], [pdcurses=no])
AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto])
if test "$outputs" = "yes"; then
@@ -226,35 +225,23 @@ AC_CHECK_HEADERS([pthread.h],
dnl ========================
dnl = checking for ncurses =
dnl ========================
if test "$pdcurses" = "no" ; then
if test "$unicode" = "yes" ; then
curses_config_bin="ncursesw6-config ncursesw5-config"
AC_DEFINE([NCMPCPP_UNICODE], [1], [enables unicode support])
else
curses_config_bin="ncurses6-config ncurses5-config"
fi
if test "$unicode" = "yes" ; then
curses_config_bin="ncursesw6-config ncursesw5-config"
AC_DEFINE([NCMPCPP_UNICODE], [1], [enables unicode support])
else
if test "$pdcurses" = "yes" ; then
pdcurses_lib=XCurses
curses_config_bin=xcurses-config
else
pdcurses_lib=$pdcurses
fi
AC_DEFINE([USE_PDCURSES], [1], [enables pdcurses support])
curses_config_bin="ncurses6-config ncurses5-config"
fi
AC_PATH_PROGS(CURSES_CONFIG, $curses_config_bin)
if test "$CURSES_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
LDFLAGS="$LDFLAGS `$CURSES_CONFIG --libs`"
fi
if test "$pdcurses" = "no" ; then
AC_CHECK_LIB(ncursesw, initscr,
curses_lib=ncursesw,
curses_lib=ncurses
)
else
curses_lib=$pdcurses_lib
fi
AC_CHECK_LIB(ncursesw, initscr,
curses_lib=ncursesw,
curses_lib=ncurses
)
AC_CHECK_LIB($curses_lib, initscr,
if test "$CURSES_CONFIG" = "" ; then
LDFLAGS="$LDFLAGS -l$curses_lib"
@@ -262,9 +249,6 @@ AC_CHECK_LIB($curses_lib, initscr,
,
AC_MSG_ERROR([$curses_lib library is required])
)
if test "$pdcurses" != "no" ; then
AC_CHECK_LIB($curses_lib, Xinitscr, AC_DEFINE([XCURSES], [1], [x11 pdcurses available]), )
fi
AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing curses.h header]))
dnl ======================

View File

@@ -184,9 +184,6 @@ void resizeScreen(bool reload_main_window)
using Global::wHeader;
using Global::wFooter;
# if defined(USE_PDCURSES)
resize_term(0, 0);
# else
// update internal screen dimensions
if (reload_main_window)
{
@@ -194,7 +191,6 @@ void resizeScreen(bool reload_main_window)
endwin();
refresh();
}
# endif
MainHeight = LINES-(Config.design == Design::Alternative ? 7 : 4);

View File

@@ -128,11 +128,7 @@ bool configure(int argc, char **argv)
# ifdef HAVE_FFTW3_H
<< " fftw"
# endif
# ifdef USE_PDCURSES
<< " pdcurses"
# else
<< " ncurses"
# endif
# ifdef HAVE_TAGLIB_H
<< " taglib"
# endif

View File

@@ -75,9 +75,7 @@ namespace
std::cerr.rdbuf(cerr_buffer);
errorlog.close();
Mpd.Disconnect();
# ifndef USE_PDCURSES // destroying screen somehow crashes pdcurses
NC::destroyScreen();
# endif // USE_PDCURSES
windowTitle("");
}
}

View File

@@ -26,15 +26,11 @@
#include "title.h"
#include "utility/wide_string.h"
#ifdef USE_PDCURSES
void windowTitle(const std::string &) { }
#else
void windowTitle(const std::string &status)
{
if (strcmp(getenv("TERM"), "linux") && Config.set_window_title)
std::cout << "\033]0;" << status << "\7" << std::flush;
}
#endif // USE_PDCURSES
void drawHeader()
{

View File

@@ -672,30 +672,19 @@ bool Window::FDCallbacksListEmpty() const
int Window::readKey()
{
int result;
// if there are characters in input queue, get them and
// return immediately.
// if there are characters in input queue,
// get them and return immediately.
if (!m_input_queue.empty())
{
result = m_input_queue.front();
m_input_queue.pop();
return result;
}
// in pdcurses polling stdin doesn't work, so we can't poll
// both stdin and other file descriptors in one select. the
// workaround is to set the timeout of select to 0, poll
// other file descriptors and then wait for stdin input with
// the given timeout. unfortunately, this results in delays
// since ncmpcpp doesn't see that data arrived while waiting
// for input from stdin, but it seems there is no better option.
fd_set fdset;
FD_ZERO(&fdset);
# if !defined(USE_PDCURSES)
FD_SET(STDIN_FILENO, &fdset);
timeval timeout = { m_window_timeout/1000, (m_window_timeout%1000)*1000 };
# else
timeval timeout = { 0, 0 };
# endif
int fd_max = STDIN_FILENO;
for (FDCallbacks::const_iterator it = m_fds.begin(); it != m_fds.end(); ++it)
@@ -707,19 +696,13 @@ int Window::readKey()
if (select(fd_max+1, &fdset, 0, 0, m_window_timeout < 0 ? 0 : &timeout) > 0)
{
# if !defined(USE_PDCURSES)
result = FD_ISSET(STDIN_FILENO, &fdset) ? wgetch(m_window) : ERR;
# endif // !USE_PDCURSES
for (FDCallbacks::const_iterator it = m_fds.begin(); it != m_fds.end(); ++it)
if (FD_ISSET(it->first, &fdset))
it->second();
}
# if !defined(USE_PDCURSES)
else
result = ERR;
# else
result = wgetch(m_window);
# endif
return result;
}
@@ -778,20 +761,7 @@ int Window::getY()
bool Window::hasCoords(int &x, int &y)
{
# ifndef USE_PDCURSES
return wmouse_trafo(m_window, &y, &x, 0);
# else
// wmouse_trafo is broken in pdcurses, use our own implementation
size_t u_x = x, u_y = y;
if (u_x >= m_start_x && u_x < m_start_x+m_width
&& u_y >= m_start_y && u_y < m_start_y+m_height)
{
x -= m_start_x;
y -= m_start_y;
return true;
}
return false;
# endif
}
bool Window::runPromptHook(const char *arg, bool *done) const

View File

@@ -23,10 +23,6 @@
#include "config.h"
#ifdef USE_PDCURSES
# define NCURSES_MOUSE_VERSION 1
#endif
#include "curses.h"
#include "gcc.h"
@@ -94,12 +90,12 @@
#undef KEY_ENTER
#define KEY_ENTER 13
#if !defined(USE_PDCURSES) && NCURSES_MOUSE_VERSION == 1
#if NCURSES_MOUSE_VERSION == 1
// 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))
#endif // !defined(USE_PDCURSES) && NCURSES_MOUSE_VERSION == 1
#endif // NCURSES_MOUSE_VERSION == 1
// undefine macros with colliding names
#undef border