mirror of https://github.com/xzeldon/htop.git
netbsd: Support curses libraries without ncurses mouse support
This adds a configure check for the ncurses getmouse() function and disables mouse-related code paths when mouse support is not present in the curses library. This is necessary for stable versions of NetBSD's libcurses, the development version has stub mouse functions for compatibility with ncurses. Signed-off-by: Nia Alarie <nia@NetBSD.org>
This commit is contained in:
parent
d45b4f4a43
commit
2ab8fb83ba
4
CRT.c
4
CRT.c
|
@ -836,7 +836,9 @@ void CRT_init(const Settings* settings, bool allowUnicode) {
|
||||||
nonl();
|
nonl();
|
||||||
intrflush(stdscr, false);
|
intrflush(stdscr, false);
|
||||||
keypad(stdscr, true);
|
keypad(stdscr, true);
|
||||||
|
#ifdef HAVE_GETMOUSE
|
||||||
mouseinterval(0);
|
mouseinterval(0);
|
||||||
|
#endif
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
|
|
||||||
if (has_colors()) {
|
if (has_colors()) {
|
||||||
|
@ -910,10 +912,12 @@ void CRT_init(const Settings* settings, bool allowUnicode) {
|
||||||
#endif
|
#endif
|
||||||
CRT_treeStrAscii;
|
CRT_treeStrAscii;
|
||||||
|
|
||||||
|
#ifdef HAVE_GETMOUSE
|
||||||
#if NCURSES_MOUSE_VERSION > 1
|
#if NCURSES_MOUSE_VERSION > 1
|
||||||
mousemask(BUTTON1_RELEASED | BUTTON4_PRESSED | BUTTON5_PRESSED, NULL);
|
mousemask(BUTTON1_RELEASED | BUTTON4_PRESSED | BUTTON5_PRESSED, NULL);
|
||||||
#else
|
#else
|
||||||
mousemask(BUTTON1_RELEASED, NULL);
|
mousemask(BUTTON1_RELEASED, NULL);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CRT_degreeSign = initDegreeSign();
|
CRT_degreeSign = initDegreeSign();
|
||||||
|
|
|
@ -106,6 +106,7 @@ void InfoScreen_run(InfoScreen* this) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GETMOUSE
|
||||||
if (ch == KEY_MOUSE) {
|
if (ch == KEY_MOUSE) {
|
||||||
MEVENT mevent;
|
MEVENT mevent;
|
||||||
int ok = getmouse(&mevent);
|
int ok = getmouse(&mevent);
|
||||||
|
@ -127,6 +128,7 @@ void InfoScreen_run(InfoScreen* this) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (this->inc->active) {
|
if (this->inc->active) {
|
||||||
IncSet_handleKey(this->inc, ch, panel, IncSet_getListItemValue, this->lines);
|
IncSet_handleKey(this->inc, ch, panel, IncSet_getListItemValue, this->lines);
|
||||||
|
|
|
@ -172,6 +172,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
|
||||||
ch = getch();
|
ch = getch();
|
||||||
|
|
||||||
HandlerResult result = IGNORED;
|
HandlerResult result = IGNORED;
|
||||||
|
#ifdef HAVE_GETMOUSE
|
||||||
if (ch == KEY_MOUSE && this->settings->enableMouse) {
|
if (ch == KEY_MOUSE && this->settings->enableMouse) {
|
||||||
ch = ERR;
|
ch = ERR;
|
||||||
MEVENT mevent;
|
MEVENT mevent;
|
||||||
|
@ -212,6 +213,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (ch == ERR) {
|
if (ch == ERR) {
|
||||||
if (sortTimeout > 0)
|
if (sortTimeout > 0)
|
||||||
sortTimeout--;
|
sortTimeout--;
|
||||||
|
|
|
@ -352,6 +352,7 @@ if test "$my_htop_platform" = "solaris"; then
|
||||||
AC_DEFINE([ERR], [(-1)], [Predefine ncurses macro.])
|
AC_DEFINE([ERR], [(-1)], [Predefine ncurses macro.])
|
||||||
fi
|
fi
|
||||||
AC_CHECK_FUNCS( [set_escdelay] )
|
AC_CHECK_FUNCS( [set_escdelay] )
|
||||||
|
AC_CHECK_FUNCS( [getmouse] )
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([hwloc],
|
AC_ARG_ENABLE([hwloc],
|
||||||
|
|
Loading…
Reference in New Issue