[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev lynx2-8-1/Linux patch for new VTs
From: |
Tony Garnock-Jones |
Subject: |
lynx-dev lynx2-8-1/Linux patch for new VTs |
Date: |
Sun, 28 Mar 1999 23:54:21 +1200 (NZST) |
[[Sorry if this is a duplicate message. Something's a bit strange
with my sendmail and I'm having to use a different account to
reassure myself it's getting away okay.]]
Hi. I've been missing a feature that both Netscape and IE have - the
capability to open a new browser window to explore sublinks in. As I
run Lynx mostly on console on a Linux box, I decided to play with
implementing a "open new browser window" feature using the Linux
VT_??? ioctl()s.
It works, ish. Hitting control-O while Lynx is idling will first fork,
then find, open, and try to switch to a new VT. If Lynx is downloading
something, hitting control-O will fork, open the new VT as per normal,
and stop the download (as if 'z' had been pressed).
There's also the possibility that there's already a way of doing
something similar to what I want, without having to resort to the VT
ioctls (which are heavily festooned with warnings in the
manpages). <shrug>. It works for me :-)
It's a very naive implementation, obviously, and needs things like
proper autoconfing (or maybe a #define to control inclusion of the
feature). It is also deficient in that it is a patch against Lynx
version 2.8.1, rather than the latest developer release, or even
the latest stable version.
Other things to consider:
* it has no user documentation. If you don't know the
feature's there, you'll never find out :-)
* I'd like to see it check to make sure Lynx is _actually_
running on a Linux VT before it tries anything at all.
For instance, if you're running under X, or maybe over
a serial link or something, it will still fork() and try
to open an unused VT.
* A cool thing would be to extend the code so that it
opened a new X window if you're running under X!
* I run dual-headed console with an old MDA. I'd like to
somehow hack it so it opens on the *other* monitor from
the currently active one. Or maybe a separate key would
make it try that strategy as distinct from the 'first-
unused-VT-I-can-find' strategy.
* Is it possible/easy to make those URLs which automatically
open a new window with Netscape and IE work properly with
something similar to my patch under Lynx? I don't even
know how it's done with Netscape, so I'm not the right person
to answer that question :-)
Comments? Please feel free to email me directly, address@hidden,
or reply to the list (of course). This is my first post, and I'm a very
new reader, so if I seem ignorant of basic issues (is there a lynx-dev
FAQ?), please be patient with me, and let me know where I've gone wrong.
The patch follows my signature.
Cheers,
Tony
--
Anthony (Tony) James Garnock-Jones address@hidden
[ Lazarus on IRC ] - SPIRITUALIZED! - [ http://kcbbs.gen.nz/users/tonyg/ ]
Student - Computer person: Linux, Languages, OS, Scheme, Smalltalk - Guitarist
CUT HERE
----------------------------------------------------------------------
Index: lynx/src/LYKeymap.c
diff -u lynx/src/LYKeymap.c:1.1.1.1 lynx/src/LYKeymap.c:1.2
--- lynx/src/LYKeymap.c:1.1.1.1 Sun Mar 28 23:03:22 1999
+++ lynx/src/LYKeymap.c Sun Mar 28 23:05:45 1999
@@ -32,7 +32,7 @@
LYK_HISTORY, LYK_NEXT_LINK, LYK_ACTIVATE, LYK_COOKIE_JAR,
/* bs */ /* ht */ /* nl */ /* ^K */
-LYK_REFRESH, LYK_ACTIVATE, LYK_DOWN_TWO, 0,
+LYK_REFRESH, LYK_ACTIVATE, LYK_DOWN_TWO, LYK_NEW_BROWSER,
/* ^L */ /* cr */ /* ^N */ /* ^O */
LYK_UP_TWO, 0, LYK_RELOAD, 0,
@@ -583,6 +583,7 @@
{ "CLEAR_AUTH", "clear all authorization info for this session"
},
{ "SWITCH_DTD", "switch between two ways of parsing HTML" },
{ "ELGOTO", "edit the current link's URL or ACTION and go to it" },
+{ "NEW_BROWSER", "open a new browser in a new VT" },
#ifdef USE_EXTERNALS
{ "EXTERN", "run external program with url" },
#endif
Index: lynx/src/LYKeymap.h
diff -u lynx/src/LYKeymap.h:1.1.1.1 lynx/src/LYKeymap.h:1.2
--- lynx/src/LYKeymap.h:1.1.1.1 Sun Mar 28 23:03:22 1999
+++ lynx/src/LYKeymap.h Sun Mar 28 23:05:45 1999
@@ -96,15 +96,16 @@
#define LYK_CLEAR_AUTH 71
#define LYK_SWITCH_DTD 72
#define LYK_ELGOTO 73
+#define LYK_NEW_BROWSER 74
#ifdef USE_EXTERNALS
-#define LYK_EXTERN 74
+#define LYK_EXTERN 75
#if defined(VMS) || defined(DIRED_SUPPORT)
-#define LYK_DIRED_MENU 75
+#define LYK_DIRED_MENU 76
#endif /* VMS || DIRED_SUPPORT */
#else /* USE_EXTERNALS */
#if defined(VMS) || defined(DIRED_SUPPORT)
-#define LYK_DIRED_MENU 74
+#define LYK_DIRED_MENU 75
#endif /* VMS || DIRED_SUPPORT */
#endif /* !defined(USE_EXTERNALS) */
Index: lynx/src/LYMainLoop.c
diff -u lynx/src/LYMainLoop.c:1.1.1.1 lynx/src/LYMainLoop.c:1.2
--- lynx/src/LYMainLoop.c:1.1.1.1 Sun Mar 28 23:03:23 1999
+++ lynx/src/LYMainLoop.c Sun Mar 28 23:05:45 1999
@@ -2292,6 +2292,13 @@
}
break;
+ case LYK_NEW_BROWSER:
+ if (LYOpenNewBrowser() == 0) /* we are the parent, or failed
*/
+ break;
+
+ /* otherwise... */
+ /* FALL THROUGH */
+
case LYK_REFRESH:
refresh_screen = TRUE;
lynx_force_repaint();
Index: lynx/src/LYUtils.c
diff -u lynx/src/LYUtils.c:1.1.1.1 lynx/src/LYUtils.c:1.2
--- lynx/src/LYUtils.c:1.1.1.1 Sun Mar 28 23:03:26 1999
+++ lynx/src/LYUtils.c Sun Mar 28 23:05:46 1999
@@ -1952,6 +1952,41 @@
return;
}
+#ifdef LINUX
+#include <linux/vt.h>
+#endif
+
+PUBLIC int LYOpenNewBrowser NOARGS
+{
+#ifdef LINUX
+ int f, arg;
+ char buf[128];
+
+ if (fork())
+ return 0;
+
+ if ((f = open("/dev/console", O_RDONLY)) < 0) exit(1);
+ if (ioctl(f, VT_OPENQRY, &arg) < 0) exit(1);
+ sprintf(buf, "/dev/tty%d", arg);
+ if (ioctl(f, VT_ACTIVATE, arg) < 0)
+ /* do nothing */ ;
+ close(f);
+
+ fflush(NULL);
+ freopen(buf, "r", stdin);
+ freopen(buf, "w", stdout);
+ freopen(buf, "w", stderr);
+ start_curses();
+
+ size_change(0); /* I need this to support multi-head with a mono
+ monitor at different text resolution. */
+
+ return 1;
+#else
+ return 0;
+#endif
+}
+
PUBLIC void noviceline ARGS1(
int, more_flag GCC_UNUSED)
{
@@ -2126,6 +2161,12 @@
*/
if (TOUPPER(c) == 'Z' || c == 7 || c == 3)
return((int)TRUE);
+ else if (keymap[c+1] == LYK_NEW_BROWSER) {
+ if (LYOpenNewBrowser()) {
+ lynx_force_repaint();
+ return ((int)TRUE);
+ }
+ }
#ifdef DISP_PARTIAL
else if (display_partial && (NumOfLines_partial > 2))
/* OK, we got several lines from new document and want to scroll... */
Index: lynx/src/LYUtils.h
diff -u lynx/src/LYUtils.h:1.1.1.1 lynx/src/LYUtils.h:1.2
--- lynx/src/LYUtils.h:1.1.1.1 Sun Mar 28 23:03:22 1999
+++ lynx/src/LYUtils.h Sun Mar 28 23:05:47 1999
@@ -104,6 +104,7 @@
extern void size_change PARAMS((int sig));
extern void statusline PARAMS((CONST char *text));
extern void toggle_novice_line NOPARAMS;
+extern int LYOpenNewBrowser NOPARAMS;
#ifdef VMS
extern void Define_VMSLogical PARAMS((char *LogicalName, char *LogicalValue));
- Re: lynx-dev lynx2-8-1/Linux patch for new VTs, (continued)
- Re: lynx-dev lynx2-8-1/Linux patch for new VTs, Leonid Pauzner, 1999/03/28
- Re: lynx-dev lynx2-8-1/Linux patch for new VTs, Webmaster Jim, 1999/03/28
- Re: lynx-dev lynx2-8-1/Linux patch for new VTs, Philip Webb, 1999/03/28
- Re: lynx-dev lynx2-8-1/Linux patch for new VTs, Chuck Martin, 1999/03/28
- lynx-dev lynx2-8-1/Linux patch for new VTs,
Tony Garnock-Jones <=
- Re: lynx-dev lynx2-8-1/Linux patch for new VTs, Bela Lubkin, 1999/03/28
- Re: lynx-dev lynx2-8-1/Linux patch for new VTs, dickey, 1999/03/28
- Re: lynx-dev lynx2-8-1/Linux patch for new VTs, dickey, 1999/03/29