[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev (patch2) simplify ifdefing with new USE_MOUSE symbol
From: |
Leonid Pauzner |
Subject: |
lynx-dev (patch2) simplify ifdefing with new USE_MOUSE symbol |
Date: |
Mon, 3 Apr 2000 15:57:35 +0400 (MSD) |
2-Apr-2000 16:26 Leonid Pauzner wrote:
>> not really. send a patch - but bear in mind that it can lead to the same
>> sort of problems as did my cleanup of getbkgd().
>> --
>> Thomas E. Dickey
> Well, I made a patch
Here a resync for pre.2 (windows makefiles now changed safely):
* Add USE_MOUSE simbol: cleanup/simplify ifdefing of mouse code,
replace USE_SLANG_MOUSE / NCURSES_MOUSE_VERSION / PDCURSES_MOUSE_VERSION
with USE_MOUSE (and modifier when neccessary).
* windows makefiles: add new symbols SOURCE_CACHE and USE_PRETTYSRC,
remove obsolete EXP_CHARTRANS and unused EXP_CHARTRANS_AUTOSWITCH
diff -u -r LYNX2-8-.P2/makefile.bcb LYNX2-8-/makefile.bcb
--- LYNX2-8-.P2/makefile.bcb Sun Apr 2 19:44:00 2000
+++ LYNX2-8-/makefile.bcb Mon Apr 3 15:46:16 2000
@@ -47,7 +47,6 @@
-DNOSIGHUP \
-DDOSPATH \
-DNOUSERS \
--DEXP_CHARTRANS \
-DNCURSES \
-DFANCY_CURSES \
-DCOLOR_CURSES \
@@ -66,7 +65,7 @@
-DNO_CONFIG_INFO \
-DEXP_ALT_BINDINGS \
-DSOURCE_CACHE \
--DUSE_PSRC \
+-DUSE_PRETTYSRC \
### Add by Hiroyuki
-DLY_MAXPATH=1024 \
-D_WIN_CC=1 \
diff -u -r LYNX2-8-.P2/makefile.msc LYNX2-8-/makefile.msc
--- LYNX2-8-.P2/makefile.msc Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/makefile.msc Mon Apr 3 15:45:16 2000
@@ -34,7 +34,6 @@
/D "DISP_PARTIAL" \
/D "DOSPATH" \
/D "EXP_ALT_BINDINGS" \
- /D "EXP_CHARTRANS" \
/D "EXP_PERSISTENT_COOKIES" \
/D "FANCY_CURSES" \
/D "HAVE_KEYPAD" \
@@ -51,11 +50,13 @@
/D "NOSIGHUP" \
/D "NOUSERS" \
/D "PDCURSES" \
+ /D "SOURCE_CACHE" \
/D "SH_EX" \
/D "SUPPORT_MULTIBYTE_EDIT" \
/D "USE_COLOR_TABLE" \
/D "USE_EXTERNALS" \
/D "USE_MULTIBYTE_CURSES" \
+ /D "USE_PRETTYSRC" \
/D "USE_ZLIB" \
/D "WIN_EX" \
/D "WIN32" \
@@ -139,6 +140,7 @@
"LYMap.obj" \
"LYNews.obj" \
"LYOptions.obj" \
+ "LYPrettySrc.obj" \
"LYPrint.obj" \
"LYrcFile.obj" \
"LYReadCFG.obj" \
@@ -264,6 +266,9 @@
LYOptions.obj : $(SRC_DIR)\LYOptions.c
$(COMPILE) $(SRC_DIR)\LYOptions.c
+
+LYPrettySrc.obj : $(SRC_DIR)\LYPrettySrc.c
+ $(COMPILE) $(SRC_DIR)\LYPrettySrc.c
LYPrint.obj : $(SRC_DIR)\LYPrint.c
$(COMPILE) $(SRC_DIR)\LYPrint.c
diff -u -r LYNX2-8-.P2/makelynx.bat LYNX2-8-/makelynx.bat
--- LYNX2-8-.P2/makelynx.bat Mon Apr 3 13:47:22 2000
+++ LYNX2-8-/makelynx.bat Mon Apr 3 15:42:26 2000
@@ -25,7 +25,6 @@
SET DEFINES=%DEFINES% -D_WINDOWS
SET DEFINES=%DEFINES% -DDOSPATH
SET DEFINES=%DEFINES% -DEXP_ALT_BINDINGS
-SET DEFINES=%DEFINES% -DEXP_CHARTRANS_AUTOSWITCH
SET DEFINES=%DEFINES% -DEXP_PERSISTENT_COOKIES
SET DEFINES=%DEFINES% -DHAVE_DIRENT_H
SET DEFINES=%DEFINES% -DHAVE_KEYPAD
@@ -40,6 +39,8 @@
SET DEFINES=%DEFINES% -DNOUSERS
SET DEFINES=%DEFINES% -DLONG_LIST
SET DEFINES=%DEFINES% -DDISP_PARTIAL
+SET DEFINES=%DEFINES% -DSOURCE_CACHE
+SET DEFINES=%DEFINES% -DUSE_PRETTYSRC
SET DEFINES=%DEFINES% -DVC="2.14FM"
if "%LIBRARY%" == "PDCURSES" goto else1
SET DEFINES=%DEFINES% -DUSE_SLANG
diff -u -r LYNX2-8-.P2/src/lycurses.c LYNX2-8-/src/lycurses.c
--- LYNX2-8-.P2/src/lycurses.c Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/src/lycurses.c Mon Apr 3 15:30:38 2000
@@ -920,6 +920,8 @@
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 +941,20 @@
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 +986,20 @@
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 -u -r LYNX2-8-.P2/src/lycurses.h LYNX2-8-/src/lycurses.h
--- LYNX2-8-.P2/src/lycurses.h Sun Apr 2 19:44:00 2000
+++ LYNX2-8-/src/lycurses.h Mon Apr 3 15:30:38 2000
@@ -125,7 +125,14 @@
* PDCurses' mouse code does nothing in the DJGPP configuration.
*/
#if defined(PDCURSES) && !defined(__DJGPP__)
-#define PDCURSES_MOUSE_VERSION 1
+#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 +239,7 @@
#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 -u -r LYNX2-8-.P2/src/lyforms.c LYNX2-8-/src/lyforms.c
--- LYNX2-8-.P2/src/lyforms.c Sun Apr 2 19:44:00 2000
+++ LYNX2-8-/src/lyforms.c Mon Apr 3 15:30:38 2000
@@ -460,11 +460,13 @@
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 @@
} 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 @@
}
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;
diff -u -r LYNX2-8-.P2/src/lymain.c LYNX2-8-/src/lymain.c
--- LYNX2-8-.P2/src/lymain.c Sun Apr 2 19:44:00 2000
+++ LYNX2-8-/src/lymain.c Mon Apr 3 15:30:38 2000
@@ -3626,7 +3626,7 @@
"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 -u -r LYNX2-8-.P2/src/lymainlo.c LYNX2-8-/src/lymainlo.c
--- LYNX2-8-.P2/src/lymainlo.c Sun Mar 26 19:14:00 2000
+++ LYNX2-8-/src/lymainlo.c Mon Apr 3 15:30:40 2000
@@ -452,6 +452,7 @@
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 @@
}
set_curdoc_link(mouse_tmp);
}
+#endif /* USE_MOUSE */
return(0); /* indicates OK */
}
diff -u -r LYNX2-8-.P2/src/lyoption.c LYNX2-8-/src/lyoption.c
--- LYNX2-8-.P2/src/lyoption.c Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/src/lyoption.c Mon Apr 3 15:30:40 2000
@@ -28,7 +28,7 @@
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 @@
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 @@
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."));
diff -u -r LYNX2-8-.P2/src/lyreadcf.c LYNX2-8-/src/lyreadcf.c
--- LYNX2-8-.P2/src/lyreadcf.c Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/src/lyreadcf.c Mon Apr 3 15:30:40 2000
@@ -1563,7 +1563,7 @@
#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 -u -r LYNX2-8-.P2/src/lystring.c LYNX2-8-/src/lystring.c
--- LYNX2-8-.P2/src/lystring.c Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/src/lystring.c Mon Apr 3 15:30:40 2000
@@ -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 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 @@
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 @@
cmd = LYK_QUIT;
}
#else
-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(NCURSES)
MEVENT event;
getmouse(&event);
@@ -252,11 +255,15 @@
} 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,
@@ -661,7 +668,8 @@
}
#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 @@
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 @@
#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 @@
}
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 @@
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 @@
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 @@
#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 @@
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);
@@ -1954,13 +1968,17 @@
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 +1986,7 @@
}
#endif
else {
-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(NCURSES)
MEVENT event;
int err;
int lac = LYK_UNKNOWN;
@@ -2150,7 +2168,11 @@
return(c);
}
break;
-#endif /* NCURSES_MOUSE_VERSION */
+#endif /* NCURSES || PDCURSES */
+
+/********************************************************************/
+#endif /* USE_MOUSE */
+
}
#endif /* HAVE_KEYPAD */
#ifdef DJGPP_KEYHANDLER
@@ -2269,7 +2291,9 @@
}
}
+/************************************************************************/
#endif /* NOT defined(USE_KEYMAPS) && defined(USE_SLANG) */
+
PUBLIC int LYgetch NOARGS
{
- Re: lynx-dev lynx2.8.3pre.1, (continued)
- Re: lynx-dev lynx2.8.3pre.1, Leonid Pauzner, 2000/04/01
- Re: lynx-dev lynx2.8.3pre.1, T.E.Dickey, 2000/04/01
- Re: lynx-dev lynx2.8.3pre.1, T.E.Dickey, 2000/04/01
- Re: lynx-dev lynx2.8.3pre.1, T.E.Dickey, 2000/04/01
- Re: lynx-dev lynx2.8.3pre.1, T.E.Dickey, 2000/04/01
- Re: lynx-dev lynx2.8.3pre.1, T.E.Dickey, 2000/04/02