lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev [patch to dev2] TRY_USING_XTERM_WINDOW_TITLE functionality


From: Vlad Harchev
Subject: lynx-dev [patch to dev2] TRY_USING_XTERM_WINDOW_TITLE functionality
Date: Fri, 26 May 2000 21:42:52 +0500 (SAMST)

 Here is a 1st verion of this patch.
 I propose not to create new 'configure' option, since users can disable this
functionality in lynx.cfg. I tested with slang and curses and it works fine.

 Changelog entry:
* Implemented support for setting xterm-like terminal's window title to
  current document window title. 

 Best regards,
  -Vlad

diff -ru lynx2.8.4dev.2-was/lynx.cfg lynx2.8.4dev.2/lynx.cfg
--- lynx2.8.4dev.2-was/lynx.cfg Fri May 26 19:40:33 2000
+++ lynx2.8.4dev.2/lynx.cfg     Fri May 26 21:24:54 2000
@@ -3005,6 +3005,17 @@
 #
 #JUSTIFY_MAX_VOID_PERCENT:35
 
+.h2 TRY_USING_XTERM_WINDOW_TITLE
+# TRY_USING_XTERM_WINDOW_TITLE - Appearance
+# Lynx can use terminal's window title for displaying title of the current 
+# document .
+# If set to TRUE, lynx will check whether the terminal it runs on supports
+# xterm escape sequences to set window title, and if yes will utilize window
+# title.
+# If set to FALSE, lynx won't try to check and utilize window title.
+# Default value is TRUE.
+#TRY_USING_XTERM_WINDOW_TITLE:TRUE
+
 
 .h1 Interaction
 
@@ -3051,3 +3062,4 @@
 # Set FTP_PASSIVE to TRUE if you want to use passive mode ftp transfers.
 # You might have to do this if you're behind a restrictive firewall.
 #FTP_PASSIVE:FALSE
+
diff -ru lynx2.8.4dev.2-was/lynx.hlp lynx2.8.4dev.2/lynx.hlp
--- lynx2.8.4dev.2-was/lynx.hlp Fri May 26 19:40:33 2000
+++ lynx2.8.4dev.2/lynx.hlp     Fri May 26 21:20:02 2000
@@ -614,6 +614,14 @@
               emit  backspaces in output if -dumping or -crawling
               (like 'man' does)
 
+       -xterm_title
+             use xterm-like terminal's window title.  The  title
+             of the current document will be shown in the window
+             title of the terminal emulator for X lynx runs  in.
+             If  heuristsicts  used  tells that terminal doesn't
+             support setting window title, no  attempt  will  be
+             made to use it.
+
 2 COMMANDS
        o Use Up arrow and Down arrow to scroll through  hypertext
        links.
diff -ru lynx2.8.4dev.2-was/lynx.man lynx2.8.4dev.2/lynx.man
--- lynx2.8.4dev.2-was/lynx.man Fri May 26 19:40:33 2000
+++ lynx2.8.4dev.2/lynx.man     Fri May 26 21:14:24 2000
@@ -644,6 +644,12 @@
 .TP
 .B -with_backspaces
 emit backspaces in output if -dumping or -crawling (like 'man' does)
+.TP
+.B -xterm_title
+use xterm-like terminal's window title. The title of the current document
+will be shown in the window title of the terminal emulator for X lynx runs in.
+If heuristsicts used tells that terminal doesn't support setting window title,
+no attempt will be made to use it.
 .SH COMMANDS
 o Use \fBUp arrow\fR and \fBDown arrow\fR to scroll through hypertext links.
 .br
diff -ru lynx2.8.4dev.2-was/src/LYCurses.c lynx2.8.4dev.2/src/LYCurses.c
--- lynx2.8.4dev.2-was/src/LYCurses.c   Sun May  7 11:49:41 2000
+++ lynx2.8.4dev.2/src/LYCurses.c       Fri May 26 21:07:39 2000
@@ -1050,6 +1050,18 @@
 #endif /* !VMS */
 }
 
+#ifdef USE_XTERM_WINDOW_TITLE
+PRIVATE void check_have_xterm_window_title ARGS1(char*, terminal)
+{
+    /*seems this is a reasonable approach to test for these xterm feature - 
VH*/
+    xterm_window_title_available =
+        !strncmp(terminal,"xterm",5) || !strncmp(terminal,"dtterm",6) || 
+           !strncmp(terminal,"kterm",5);
+    if (dump_output_immediately)
+       xterm_window_title_available = FALSE;
+};
+#endif
+
 #ifdef VMS
 /*
  *  Check terminal type, start curses & setup terminal.
@@ -1123,7 +1135,9 @@
        LYlines = 24;
     if (LYcols <= 0)
        LYcols = 80;
-
+#ifdef USE_XTERM_WINDOW_TITLE    
+    check_have_xterm_window_title(term);
+#endif
     return(TRUE);
 }
 
@@ -1258,7 +1272,9 @@
        LYlines = 24;
     if (LYcols <= 0)
        LYcols = 80;
--with-screen=-
+#ifdef USE_XTERM_WINDOW_TITLE
+    check_have_xterm_window_title(getenv("TERM"));
+#endif
     return(1);
 }
 
@@ -2035,3 +2051,15 @@
    stop_reverse ();
    stop_bold ();
 }
+
+#ifdef USE_XTERM_WINDOW_TITLE
+PUBLIC void set_xterm_title PARAMS((char* text))
+{
+    /*may be it would be wise to truncate the string*/
+    if (!(xterm_window_title_available && use_xterm_window_title))
+       return;
+    fflush(stdout);
+    fprintf(stdout,"\033]2;%s\a",text);
+    fflush(stdout);    
+};
+#endif
diff -ru lynx2.8.4dev.2-was/src/LYCurses.h lynx2.8.4dev.2/src/LYCurses.h
--- lynx2.8.4dev.2-was/src/LYCurses.h   Sun May  7 11:49:40 2000
+++ lynx2.8.4dev.2/src/LYCurses.h       Fri May 26 21:00:49 2000
@@ -523,4 +523,8 @@
 #define LYHideCursor() move((LYlines - 1), (LYcols - 2))
 #endif
 
+#ifdef USE_XTERM_WINDOW_TITLE
+extern void set_xterm_title PARAMS((char* text));
+#endif
+
 #endif /* LYCURSES_H */
diff -ru lynx2.8.4dev.2-was/src/LYGlobalDefs.h lynx2.8.4dev.2/src/LYGlobalDefs.h
--- lynx2.8.4dev.2-was/src/LYGlobalDefs.h       Fri May 26 19:40:33 2000
+++ lynx2.8.4dev.2/src/LYGlobalDefs.h   Fri May 26 20:39:02 2000
@@ -505,4 +505,9 @@
 extern int LYsb_end;
 #endif
 
+#ifdef USE_XTERM_WINDOW_TITLE
+extern BOOL use_xterm_window_title;
+extern BOOL xterm_window_title_available;
+#endif
+
 #endif /* LYGLOBALDEFS_H */
diff -ru lynx2.8.4dev.2-was/src/LYMain.c lynx2.8.4dev.2/src/LYMain.c
--- lynx2.8.4dev.2-was/src/LYMain.c     Fri May 26 19:40:33 2000
+++ lynx2.8.4dev.2/src/LYMain.c Fri May 26 21:06:06 2000
@@ -461,6 +461,13 @@
 
 PUBLIC BOOLEAN textfield_prompt_at_left_edge = FALSE;
 
+#ifdef USE_XTERM_WINDOW_TITLE
+PUBLIC BOOL use_xterm_window_title = TRUE;
+
+/*it's important for this to be FALSE be default - we initialize it in setup()
+  and it won't be called if dumping or crawling*/
+PUBLIC BOOL xterm_window_title_available = FALSE;
+#endif
 
 #ifdef DISP_PARTIAL
 PUBLIC BOOLEAN display_partial_flag = TRUE; /* Display document during 
download */
@@ -3474,6 +3481,12 @@
       "emit backspaces in output if -dumping or -crawling (like 'man' does)"
    ),
 #endif
+#ifdef USE_XTERM_WINDOW_TITLE
+   PARSE_SET(
+      "xterm_title", 4|SET_ARG,                &use_xterm_window_title,
+      "use xterm-like terminal's window title"
+   ),
+#endif     
    {NULL, 0, 0, NULL}
 };
 
diff -ru lynx2.8.4dev.2-was/src/LYMainLoop.c lynx2.8.4dev.2/src/LYMainLoop.c
--- lynx2.8.4dev.2-was/src/LYMainLoop.c Sun May  7 11:49:41 2000
+++ lynx2.8.4dev.2/src/LYMainLoop.c     Fri May 26 21:06:03 2000
@@ -5952,7 +5952,9 @@
                display_lines = LYlines-2;
            }
        }
-
+#ifdef USE_XTERM_WINDOW_TITLE
+        set_xterm_title(curdoc.title);
+#endif
        if (www_search_result != -1) {
             /*
              *  This was a WWW search, set the line
diff -ru lynx2.8.4dev.2-was/src/LYReadCFG.c lynx2.8.4dev.2/src/LYReadCFG.c
--- lynx2.8.4dev.2-was/src/LYReadCFG.c  Fri May 26 19:40:33 2000
+++ lynx2.8.4dev.2/src/LYReadCFG.c      Fri May 26 20:47:28 2000
@@ -1555,6 +1555,9 @@
 #ifdef LYNXCGI_LINKS
      PARSE_DEF("trusted_lynxcgi", CONF_ADD_TRUSTED, CGI_PATH),
 #endif
+#ifdef USE_XTERM_WINDOW_TITLE
+    PARSE_SET("try_using_xterm_window_title", CONF_BOOL, 
&use_xterm_window_title),
+#endif
      PARSE_STR("url_domain_prefixes", CONF_STR, &URLDomainPrefixes),
      PARSE_STR("url_domain_suffixes", CONF_STR, &URLDomainSuffixes),
 #ifdef DIRED_SUPPORT
diff -ru lynx2.8.4dev.2-was/userdefs.h lynx2.8.4dev.2/userdefs.h
--- lynx2.8.4dev.2-was/userdefs.h       Fri May 26 19:40:33 2000
+++ lynx2.8.4dev.2/userdefs.h   Fri May 26 20:21:32 2000
@@ -1268,6 +1268,18 @@
 #define TEXTFIELDS_MAY_NEED_ACTIVATION
 
 /********************************
+ * If USE_XTERM_WINDOW_TITLE is defined, then lynx will attempt (if terminal
+ * permits) to show the title of the current page also in the xterm window
+ * title. User will be able to turn it off in lynx.cfg too.
+ */
+#define USE_XTERM_WINDOW_TITLE
+
+/* check whether supporting xterm window title makes sense*/
+#if defined(DOSPATH) || defined(__CYGWIN__)
+# undef USE_XTERM_WINDOW_TITLE
+#endif
+ 
+/********************************
  * The following three definitions control some aspects of extended
  * textarea handling.  TEXTAREA_EXPAND_SIZE is the number of new empty
  * lines that get appended at the end of a textarea by a GROWTEXTAREA


; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]