about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/LYCurses.c33
-rw-r--r--src/LYCurses.h40
-rw-r--r--src/LYForms.c14
-rw-r--r--src/LYMain.c2
-rw-r--r--src/LYMainLoop.c2
-rw-r--r--src/LYOptions.c8
-rw-r--r--src/LYReadCFG.c2
-rw-r--r--src/LYStrings.c62
-rw-r--r--src/LYUtils.c4
9 files changed, 116 insertions, 51 deletions
diff --git a/src/LYCurses.c b/src/LYCurses.c
index f74b38b3..5fbd864e 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -37,6 +37,10 @@ extern int _NOSHARE(COLS);
 int lynx_has_color = FALSE;
 #endif
 
+#ifdef HAVE_XCURSES
+char *XCursesProgramName = "Lynx";
+#endif
+
 #if defined(USE_COLOR_STYLE) && !USE_COLOR_TABLE
 #define COLOR_BKGD ((s_normal != NOSTYLE) ? hashStyles[s_normal].color : A_NORMAL)
 #else
@@ -522,15 +526,6 @@ PRIVATE void LYsetWAttr ARGS1(WINDOW *, win)
 	int code = 0;
 	int attr = A_NORMAL;
 	int offs = 1;
-	static int NoColorVideo = -1;
-
-#if defined(UNIX) && !defined(PDCURSES)
-	if (NoColorVideo < 0) {
-		NoColorVideo = tigetnum("ncv");
-	}
-	if (NoColorVideo < 0)
-		NoColorVideo = 0;
-#endif /* UNIX */
 
 	if (Current_Attr & A_BOLD)
 		code |= 1;
@@ -920,6 +915,8 @@ PUBLIC void start_curses NOARGS
 
 PUBLIC void lynx_enable_mouse ARGS1(int,state)
 {
+#ifdef USE_MOUSE
+/***********************************************************************/
 
 #if defined(WIN_EX)
 /* modify lynx_enable_mouse() for pdcurses configuration so that mouse support
@@ -939,19 +936,20 @@ PUBLIC void lynx_enable_mouse ARGS1(int,state)
     if (LYUseMouse == 0)
 	return;
 
-#ifdef USE_SLANG_MOUSE
+
+#if defined(USE_SLANG)
     SLtt_set_mouse_mode (state, 0);
     SLtt_flush_output ();
 #else
 
-#if defined(WIN_EX) && defined(PDCURSES_MOUSE_VERSION)
+#if defined(WIN_EX) && defined(PDCURSES)
     if (state)
     {
 	SetConsoleMode(hConIn, ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT);
 	FlushConsoleInputBuffer(hConIn);
     }
 #else
-#ifdef NCURSES_MOUSE_VERSION
+#if defined(NCURSES)
     if (state) {
 	/* Compensate for small value of maxclick in ncurses.  */
 	static int was = 0;
@@ -983,17 +981,20 @@ PUBLIC void lynx_enable_mouse ARGS1(int,state)
 		  NULL);
     } else
 	mousemask(0, NULL);
-#endif /* NCURSES_MOUSE_VERSION */
-#endif /* WIN_EX and PDCURSES_MOUSE_VERSION */
+#endif /* NCURSES */
+#endif /* WIN_EX and PDCURSES */
 
-#if defined(PDCURSES_MOUSE_VERSION)
+#if defined(PDCURSES)
     if (state)
 	mouse_set(
 	    	BUTTON1_CLICKED | BUTTON1_PRESSED | BUTTON1_RELEASED |
 		BUTTON2_CLICKED | BUTTON2_PRESSED | BUTTON2_RELEASED |
 		BUTTON3_CLICKED | BUTTON3_PRESSED | BUTTON3_RELEASED);
 #endif
-#endif				/* NOT USE_SLANG_MOUSE */
+#endif      /* NOT USE_SLANG */
+
+/***********************************************************************/
+#endif /* USE_MOUSE */
 }
 
 PUBLIC void stop_curses NOARGS
diff --git a/src/LYCurses.h b/src/LYCurses.h
index 90dceb70..98ad35cb 100644
--- a/src/LYCurses.h
+++ b/src/LYCurses.h
@@ -6,6 +6,27 @@
 #endif
 
 /*
+ * Because we have to configure PDCURSES last, we may get bogus definitions
+ * from the system curses library - cancel these now.
+ */
+#ifdef HAVE_XCURSES
+
+#undef ASSUME_DEFAULT_COLORS
+#undef COLOR_CURSES
+#undef FANCY_CURSES
+#undef HAVE_CBREAK
+#undef HAVE_RESIZETERM
+#undef HAVE_USE_DEFAULT_COLORS
+#undef NCURSES
+#undef USE_DEFAULT_COLORS
+
+#define HAVE_CBREAK 1
+#define COLOR_CURSES 1
+#define FANCY_CURSES 1
+
+#endif
+
+/*
  * The simple color scheme maps the 8 combinations of bold/underline/reverse
  * to the standard 8 ANSI colors (with some variations based on context).
  */
@@ -90,7 +111,11 @@
 #    ifdef PDCURSES
 #     include <pdcurses.h>	/* for PDCurses */
 #    else
-#     include <curses.h>	/* default */
+#     ifdef HAVE_XCURSES
+#      include <xcurses.h>	/* PDCurses' UNIX port */
+#     else
+#      include <curses.h>	/* default */
+#     endif
 #    endif
 #   endif
 #  endif
@@ -124,8 +149,15 @@ extern void LYsubwindow PARAMS((WINDOW * param));
 /*
  * PDCurses' mouse code does nothing in the DJGPP configuration.
  */
-#if defined(PDCURSES) && !defined(__DJGPP__)
-#define PDCURSES_MOUSE_VERSION 1
+#if defined(PDCURSES) && !defined(__DJGPP__) && !defined(HAVE_XCURSES)
+#define USE_MOUSE 1
+#endif
+
+/*
+ * Pick up the native ncurses name:
+ */
+#if defined(NCURSES_MOUSE_VERSION)
+#define USE_MOUSE 1
 #endif
 
 #ifdef VMS
@@ -232,7 +264,7 @@ extern unsigned int Lynx_Color_Flags;
 #define SHOW_WHEREIS_TARGETS 1
 
 #if !defined(VMS) && !defined(DJGPP)
-#define USE_SLANG_MOUSE		1
+#define USE_MOUSE              1
 #endif
 
 #if !defined(__DJGPP__) && !defined(__CYGWIN__)
diff --git a/src/LYForms.c b/src/LYForms.c
index cbb080bd..3f2538f0 100644
--- a/src/LYForms.c
+++ b/src/LYForms.c
@@ -460,11 +460,13 @@ again:
 	    ch = 7;
 	}
 #endif /* VMS */
-#  if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION)
+
+#ifdef USE_MOUSE
+#  if defined(NCURSES) || defined(PDCURSES)
 	if (ch != -1 && (ch & LKC_ISLAC) && !(ch & LKC_ISLECLAC)) /* already lynxactioncode? */
 	    break;	/* @@@ maybe move these 2 lines outside ifdef -kw */
 	if (ch == MOUSE_KEY) {		/* Need to process ourselves */
-#if defined(PDCURSES_MOUSE_VERSION)
+#if defined(PDCURSES)
 	    int curx, cury;
 
 	    request_mouse_pos();
@@ -491,7 +493,7 @@ again:
 		} else
 		    ch = RTARROW;
 	    }
-#endif /* PDCURSES_MOUSE_VERSION */
+#endif /* PDCURSES */
 	    else {
 		/*  Mouse event passed to us as MOUSE_KEY, and apparently
 		 *  not on this field's line?  Something is not as it
@@ -504,7 +506,9 @@ again:
 	    }
 	    last_xlkc = -1;
 	} else
-#  endif	/* defined NCURSES_MOUSE_VERSION || PDCURSES_MOUSE_VERSION */
+#  endif     /* NCURSES || PDCURSES */
+#endif /* USE_MOUSE */
+
 	{
 	    if (!(ch & LKC_ISLECLAC))
 		ch |= MyEdit.current_modifiers;
@@ -1851,7 +1855,7 @@ restore_popup_statusline:
     }
 #ifndef USE_SLANG
     delwin(form_window);
-#if defined(NCURSES)
+#if defined(NCURSES) || defined(PDCURSES)
     LYsubwindow(0);
 #endif
 #endif /* !USE_SLANG */
diff --git a/src/LYMain.c b/src/LYMain.c
index c0f1fd20..0d82d8cc 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -3626,7 +3626,7 @@ treated '>' as a co-terminator for double-quotes and tags"
       "underscore",	TOGGLE_ARG,		&use_underscore,
       "toggles use of _underline_ format in dumps"
    ),
-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE)
+#if defined(USE_MOUSE)
    PARSE_SET(
       "use_mouse",	SET_ARG,		&LYUseMouse,
       "turn on mouse support"
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index a01be1db..040a705d 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -452,6 +452,7 @@ PRIVATE void set_curdoc_link ARGS1(
 
 PRIVATE int do_change_link NOARGS
 {
+#ifdef USE_MOUSE
     /* Is there a mouse-clicked link waiting? */
     int mouse_tmp = get_mouse_link();
     /* If yes, use it as the link */
@@ -467,6 +468,7 @@ PRIVATE int do_change_link NOARGS
 	}
 	set_curdoc_link(mouse_tmp);
     }
+#endif /* USE_MOUSE */
     return(0);			/* indicates OK */
 }
 
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 3f28736e..d1619fc5 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -28,7 +28,7 @@ BOOLEAN term_options;
 
 PRIVATE void terminate_options	PARAMS((int sig));
 
-#if !defined(NO_OPTION_MENU) || (defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION))
+#if !defined(NO_OPTION_MENU) || (defined(USE_MOUSE) && (defined(NCURSES) || defined(PDCURSES)))
 #define COL_OPTION_VALUES 36  /* display column where option values start */
 #endif
 
@@ -2138,7 +2138,7 @@ draw_bookmark_list:
     signal(SIGINT, cleanup_sig);
 }
 
-#if !defined(NO_OPTION_MENU) || (defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION))
+#if !defined(NO_OPTION_MENU) || (defined(USE_MOUSE) && (defined(NCURSES) || defined(PDCURSES)))
 /*
 **  This function prompts for a choice or page number.
 **  If a 'g' or 'p' suffix is included, that will be
@@ -2384,7 +2384,7 @@ PUBLIC int popup_choice ARGS7(
 	StrAllocCopy(popup_status_msg, CHOICE_LIST_UNM_MSG);
     } else if (!for_mouse) {
 	StrAllocCopy(popup_status_msg, CHOICE_LIST_MESSAGE);
-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION)
+#if defined(USE_MOUSE) && (defined(NCURSES) || defined(PDCURSES))
     } else {
 	StrAllocCopy(popup_status_msg, gettext(
 		"Left mouse button or return to select, arrow keys to scroll."));
@@ -3148,7 +3148,7 @@ restore_popup_statusline:
 #ifndef USE_SLANG
     touchwin(stdscr);
     delwin(form_window);
-#ifdef NCURSES
+#if defined(NCURSES) || defined(PDCURSES)
     LYsubwindow(0);
 #endif
 #endif /* !USE_SLANG */
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index a2e66a87..772bb7ee 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -1563,7 +1563,7 @@ static Config_Type Config_Table [] =
 #ifdef VMS
      PARSE_SET("use_fixed_records", CONF_BOOL, &UseFixedRecords),
 #endif
-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE)
+#if defined(USE_MOUSE)
      PARSE_SET("use_mouse", CONF_BOOL, &LYUseMouse),
 #endif
      PARSE_SET("use_select_popups", CONF_BOOL, &LYSelectPopups),
diff --git a/src/LYStrings.c b/src/LYStrings.c
index d617f921..65ecc5b6 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -15,7 +15,7 @@
 #include <HTString.h>
 #include <LYCharUtils.h>
 #include <HTParse.h>
-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE)
+#ifdef USE_MOUSE
 #include <LYMainLoop.h>
 #endif
 
@@ -74,14 +74,14 @@ static int mouse_link = -1;
 
 static int have_levent;
 
-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(USE_MOUSE) && defined(NCURSES)
 static MEVENT levent;
 #endif
 
 /* Return the value of mouse_link */
 PUBLIC int peek_mouse_levent NOARGS
 {
-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(USE_MOUSE) && defined(NCURSES)
     if (have_levent > 0) {
 	ungetmouse(&levent);
 	have_levent--;
@@ -108,14 +108,17 @@ PUBLIC int peek_mouse_link NOARGS
     return mouse_link;
 }
 
+
 PUBLIC int fancy_mouse ARGS3(
     WINDOW *,	win,
     int,	row,
     int *,	position)
 {
     int cmd = LYK_DO_NOTHING;
+#ifdef USE_MOUSE
+/*********************************************************************/
 
-#if defined(WIN_EX) && defined(PDCURSES_MOUSE_VERSION)
+#if defined(WIN_EX) && defined(PDCURSES)
 
     request_mouse_pos();
 
@@ -171,7 +174,7 @@ PUBLIC int fancy_mouse ARGS3(
 	cmd = LYK_QUIT;
     }
 #else
-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(NCURSES)
     MEVENT	event;
 
     getmouse(&event);
@@ -252,11 +255,15 @@ PUBLIC int fancy_mouse ARGS3(
     } else if (event.bstate & (BUTTON3_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED)) {
 	cmd = LYK_QUIT;
     }
-#endif	/* defined(NCURSES_MOUSE_VERSION) */
+#endif /* NCURSES */
 #endif	/* _WINDOWS */
+
+/************************************************************************/
+#endif  /* USE_MOUSE */
     return cmd;
 }
 
+
 PRIVATE int XYdist ARGS5(
     int,	x1,
     int,	y1,
@@ -642,7 +649,7 @@ PUBLIC int LYmbcsstrlen ARGS3(
 #endif /* HAVE_KEYPAD */
 #endif /* !defined(GetChar) */
 
-#if defined(NCURSES)
+#if defined(NCURSES) || defined(PDCURSES)
 /*
  * Workaround a bug in ncurses order-of-refresh by setting a pointer to
  * the topmost window that should be displayed.
@@ -661,7 +668,8 @@ PUBLIC void LYsubwindow ARGS1(WINDOW *, param)
 }
 #endif
 
-#ifdef USE_SLANG_MOUSE
+
+#if defined(USE_SLANG) && defined(USE_MOUSE)
 PRIVATE int sl_parse_mouse_event ARGS3(int *, x, int *, y, int *, button)
 {
     /* "ESC [ M" has already been processed.  There more characters are
@@ -719,7 +727,8 @@ PRIVATE int sl_read_mouse_event ARGS1(
    else
        return -1;
 }
-#endif
+#endif  /* USE_SLANG and USE_MOUSE */
+
 
 PRIVATE BOOLEAN csi_is_csi = TRUE;
 PUBLIC void ena_csi ARGS1(
@@ -1263,7 +1272,8 @@ PUBLIC int lynx_initialize_keymaps NOARGS
 
 #endif				       /* USE_KEYMAPS */
 
-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION)
+
+#if defined(USE_MOUSE) && (defined(NCURSES) || defined(PDCURSES))
 PRIVATE int LYmouse_menu ARGS4(int, x, int, y, int, atlink, int, code)
 {
     static char *choices[] = {
@@ -1395,9 +1405,11 @@ PRIVATE int LYmouse_menu ARGS4(int, x, int, y, int, atlink, int, code)
     }
     return retlac;
 }
-#endif /* NCURSES_MOUSE_VERSION */
+#endif /* USE_MOUSE && (NCURSES || PDCURSES) */
+
 
 #if defined(USE_KEYMAPS) && defined(USE_SLANG)
+/************************************************************************/
 
 PRIVATE int current_sl_modifier = 0;
 
@@ -1423,7 +1435,7 @@ PUBLIC int LYgetch_for ARGS1(
 
    keysym = key->f.keysym;
 
-#if defined (USE_SLANG_MOUSE)
+#if defined (USE_MOUSE)
    if (keysym == MOUSE_KEYSYM)
      return sl_read_mouse_event (code);
 #endif
@@ -1446,8 +1458,10 @@ PUBLIC int LYgetch_for ARGS1(
    return (keysym|current_sl_modifier);
 }
 
+/************************************************************************/
 #else	/* NOT  defined(USE_KEYMAPS) && defined(USE_SLANG) */
 
+
 /*
  *  LYgetch() translates some escape sequences and may fake noecho.
  */
@@ -1464,7 +1478,7 @@ PUBLIC int LYgetch_for ARGS1(
 
 #if defined(IGNORE_CTRL_C) || defined(USE_GETCHAR) || !defined(NCURSES) || \
     (HAVE_KEYPAD && defined(KEY_RESIZE)) || \
-    (defined(NCURSES_MOUSE_VERSION) && !defined(DOSPATH))
+    (defined(NCURSES) && defined(USE_MOUSE) && !defined(DOSPATH))
 re_read:
 #endif /* IGNORE_CTRL_C || USE_GETCHAR etc. */
 #if !defined(UCX) || !defined(VAXC) /* errno not modifiable ? */
@@ -1616,7 +1630,7 @@ re_read:
 	case 'w': c = HOME;    break;  /* keypad on pc ncsa telnet */
 	case 'q': c = END_KEY; break;  /* keypad on pc ncsa telnet */
 	case 'M':
-#ifdef USE_SLANG_MOUSE
+#if defined(USE_SLANG) && defined(USE_MOUSE)
 	   if (found_CSI(c,b))
 	     {
 		c = sl_read_mouse_event (code);
@@ -1813,6 +1827,7 @@ re_read:
 	case KEY_LL:		   /* home down or bottom (lower left) */
 	   c = END_KEY;
 	   break;
+#if defined(KEY_A1) && defined(KEY_C3)
 					/* The keypad is arranged like this:*/
 					/*    a1    up	  a3   */
 					/*   left   b2	right  */
@@ -1832,6 +1847,7 @@ re_read:
 	case KEY_C3:		   /* lower right of keypad */
 	   c = PGDOWN;
 	   break;
+#endif /* defined(KEY_A1) && defined(KEY_C3) */
 #ifdef KEY_ENTER
 	case KEY_ENTER:		   /* enter/return	*/
 	   c = '\n';
@@ -1954,13 +1970,17 @@ re_read:
 	   c = 0x218;
 	   break;
 #endif /* PDCurses */
-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION)
+
+#if defined(USE_MOUSE)
+/********************************************************************/
+
+#if defined(NCURSES) || defined(PDCURSES)
 	case KEY_MOUSE:
 	    CTRACE((tfp, "KEY_MOUSE\n"));
 	    if (code == FOR_CHOICE) {
 		c = MOUSE_KEY;		/* Will be processed by the caller */
 	    }
-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(NCURSES)
 	    else if (code == FOR_SINGLEKEY) {
 		MEVENT event;
 		getmouse(&event);	/* Completely ignore event - kw */
@@ -1968,7 +1988,7 @@ re_read:
 	    }
 #endif
 	    else {
-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(NCURSES)
 		MEVENT event;
 		int err;
 		int lac = LYK_UNKNOWN;
@@ -2150,7 +2170,11 @@ re_read:
 		    return(c);
 	    }
 	    break;
-#endif /* NCURSES_MOUSE_VERSION */
+#endif /* NCURSES || PDCURSES */
+
+/********************************************************************/
+#endif  /* USE_MOUSE */
+
 	}
 #endif /* HAVE_KEYPAD */
 #ifdef DJGPP_KEYHANDLER
@@ -2269,8 +2293,10 @@ re_read:
     }
 }
 
+/************************************************************************/
 #endif	/* NOT  defined(USE_KEYMAPS) && defined(USE_SLANG) */
 
+
 PUBLIC int LYgetch NOARGS
 {
     return LYgetch_for(FOR_PANEL);
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 7b652d1d..6dbf737f 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -2300,14 +2300,14 @@ PUBLIC int HTCheckForInterrupt NOARGS
 #endif /* USE_SLANG */
 #endif /* !_WINDOWS */
 
-#if defined (DOSPATH) && defined (NCURSES)
+#if defined(PDCURSES)
     nodelay(stdscr,TRUE);
 #endif /* DOSPATH */
     /*
      * 'c' contains whatever character we're able to read from keyboard
      */
     c = LYgetch();
-#if defined (DOSPATH) && defined (NCURSES)
+#if defined(PDCURSES)
     nodelay(stdscr,FALSE);
 #endif /* DOSPATH */