diff --git a/configure.ac b/configure.ac index 67769203..7956e8da 100644 --- a/configure.ac +++ b/configure.ac @@ -35,6 +35,7 @@ AC_ARG_ENABLE(werror, AC_SEARCH_LIBS(wbkgdset, ncurses curses,,echo "*** The ncurses library is required!";exit 1) +TORRENT_CHECK_EXECINFO() TORRENT_CHECK_CURL() TORRENT_OTFD() diff --git a/scripts/checks.m4 b/scripts/checks.m4 index 7ad76c2b..2630611c 100644 --- a/scripts/checks.m4 +++ b/scripts/checks.m4 @@ -114,3 +114,20 @@ AC_DEFUN([TORRENT_OTFD], [ AC_LANG_POP(C++) ]) + + +AC_DEFUN([TORRENT_CHECK_EXECINFO], [ + + AC_MSG_CHECKING(for execinfo.h) + + AC_COMPILE_IFELSE( + [[#include + int main() { backtrace((void**)0, 0); backtrace_symbols((char**)0, 0); return 0;} + ]], + [ + AC_MSG_RESULT(yes) + AC_DEFINE(USE_EXECINFO, 1, Use execinfo.h) + ], [ + AC_MSG_RESULT(no) + ]) +]) diff --git a/src/display/canvas.h b/src/display/canvas.h index 08f82114..1d2103af 100644 --- a/src/display/canvas.h +++ b/src/display/canvas.h @@ -12,25 +12,26 @@ public: m_window(newwin(height, width, y, x)) {} ~Canvas() { delwin(m_window); } - void refresh() { wnoutrefresh(m_window); } - void redraw() { redrawwin(m_window); } + void refresh() { wnoutrefresh(m_window); } + static void refresh_std() { wnoutrefresh(stdscr); } + void redraw() { redrawwin(m_window); } - void resize(int w, int h) { wresize(m_window, h, w); } - void resize(int x, int y, int w, int h); + void resize(int w, int h) { wresize(m_window, h, w); } + void resize(int x, int y, int w, int h); - int get_x() { int x, y; getyx(m_window, y, x); return x; } - int get_y() { int x, y; getyx(m_window, y, x); return y; } - int get_width() { int x, y; getmaxyx(m_window, y, x); return x; } - int get_height() { int x, y; getmaxyx(m_window, y, x); return y; } - chtype get_background() { return getbkgd(m_window); } - void set_background(chtype c) { return wbkgdset(m_window, c); } + int get_x() { int x, y; getyx(m_window, y, x); return x; } + int get_y() { int x, y; getyx(m_window, y, x); return y; } + int get_width() { int x, y; getmaxyx(m_window, y, x); return x; } + int get_height() { int x, y; getmaxyx(m_window, y, x); return y; } + chtype get_background() { return getbkgd(m_window); } + void set_background(chtype c) { return wbkgdset(m_window, c); } - void erase() { werase(m_window); } + void erase() { werase(m_window); } - void print_border(chtype ls, chtype rs, - chtype ts, chtype bs, - chtype tl, chtype tr, - chtype bl, chtype br) { wborder(m_window, ls, rs, ts, bs, tl, tr, bl, br); } + void print_border(chtype ls, chtype rs, + chtype ts, chtype bs, + chtype tl, chtype tr, + chtype bl, chtype br) { wborder(m_window, ls, rs, ts, bs, tl, tr, bl, br); } // Initialize stdscr. static void init(); @@ -41,28 +42,28 @@ public: static void do_update() { doupdate(); } - void print(int x, int y, const char* str) { mvwprintw(m_window, y, x, str); } + void print(int x, int y, const char* str) { mvwprintw(m_window, y, x, str); } template - void print(int x, int y, const char* str, A1 a1) { mvwprintw(m_window, y, x, str, a1); } + void print(int x, int y, const char* str, A1 a1) { mvwprintw(m_window, y, x, str, a1); } template - void print(int x, int y, const char* str, A1 a1, A2 a2) { mvwprintw(m_window, y, x, str, a1, a2); } + void print(int x, int y, const char* str, A1 a1, A2 a2) { mvwprintw(m_window, y, x, str, a1, a2); } template - void print(int x, int y, const char* str, + void print(int x, int y, const char* str, A1 a1, A2 a2, A3 a3) { mvwprintw(m_window, y, x, str, a1, a2, a3); } template - void print(int x, int y, const char* str, + void print(int x, int y, const char* str, A1 a1, A2 a2, A3 a3, A4 a4) { mvwprintw(m_window, y, x, str, a1, a2, a3, a4); } template - void print(int x, int y, const char* str, + void print(int x, int y, const char* str, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { mvwprintw(m_window, y, x, str, a1, a2, a3, a4, a5); } template - void print(int x, int y, const char* str, + void print(int x, int y, const char* str, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { mvwprintw(m_window, y, x, str, a1, a2, a3, a4, a5, a6); } private: diff --git a/src/display/manager.cc b/src/display/manager.cc index 377fa462..777f2dea 100644 --- a/src/display/manager.cc +++ b/src/display/manager.cc @@ -65,7 +65,7 @@ Manager::adjust_layout() { void Manager::do_update() { - wnoutrefresh(stdscr); + Canvas::refresh_std(); std::for_each(begin(), end(), std::mem_fun(&Window::redraw)); std::for_each(begin(), end(), std::mem_fun(&Window::refresh)); diff --git a/src/main.cc b/src/main.cc index 86b0400f..093d811f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -5,8 +5,6 @@ #include #include -#define USE_EXECINFO - #ifdef USE_EXECINFO #include #endif