Also check for term.h and handle its presence

Gbp-Pq: Name 013_xterm_mouse_support_000
This commit is contained in:
Axel Beckert 2022-05-13 23:47:09 +08:00 committed by openKylinBot
parent 196f3f434b
commit 2a2bc494d2
2 changed files with 25 additions and 3 deletions

View File

@ -67,7 +67,7 @@ else
fi
# Header-checks
AC_CHECK_HEADERS(syslog.h linux/input.h linux/joystick.h ncurses.h ncurses/curses.h curses.h)
AC_CHECK_HEADERS(syslog.h linux/input.h linux/joystick.h ncurses.h ncurses/curses.h curses.h term.h)
AC_CHECK_HEADERS(sys/sysmacros.h linux/major.h linux/tty.h)
# Required headers
@ -130,7 +130,7 @@ No|no|N|n) SHARED_LIBS=-lc ;;
else :; fi
done
SHARED_LIBS="$LIBS $TERMLIBS -lc"
LIBS=$SAVELIBS ;;
LIBS="$LIBS $SAVELIBS" ;;
esac
GPMXTERM=

View File

@ -46,6 +46,12 @@
#include <sys/kd.h> /* KDGETMODE */
#include <termios.h> /* winsize */
#ifdef HAVE_TERM_H
#include <curses.h>
#include <term.h>
#undef buttons
#endif /* HAVE_TERM_H */
#include "headers/gpmInt.h"
#include "headers/message.h"
@ -190,24 +196,40 @@ static void gpm_suspend_hook (int signum)
int Gpm_Open(Gpm_Connect *conn, int flag)
{
char *tty = NULL;
char *term = NULL;
int i;
struct sockaddr_un addr;
struct winsize win;
Gpm_Stst *new = NULL;
char* sock_name = 0;
#ifdef HAVE_TERM_H
char *mousecap;
int terror;
#else /* ! HAVE_TERM_H */
char *term;
#endif /* HAVE_TERM_H */
static char *consolename = NULL;
int gpm_is_disabled = 0;
/*....................................... First of all, check xterm */
#ifdef HAVE_TERM_H
if (setupterm((char *) 0, 1, &terror) == 0 && terror == 1
&& (mousecap=tigetstr("kmous")) && mousecap != (char *)-1
&& mousecap[0]) {
del_curterm(cur_term);
#else /* ! HAVE_TERM_H */
if ((term=(char *)getenv("TERM")) && !strncmp(term,"xterm",5)) {
#endif
if(gpm_tried) return gpm_fd; /* no stack */
gpm_fd=-2;
GPM_XTERM_ON;
gpm_flag=1;
return gpm_fd;
}
#ifdef HAVE_TERM_H
if (cur_term)
del_curterm(cur_term);
#endif /* HAVE_TERM_H */
/*....................................... No xterm, go on */
/* check whether we know what name the console is: what's with the lib??? */