lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev Curses and Resize [PATCH reworked]


From: pg
Subject: Re: lynx-dev Curses and Resize [PATCH reworked]
Date: Sun, 20 Aug 2000 18:36:11 -0600 (MDT)

In a recent note, Thomas Dickey said:

> Date: Wed, 16 Aug 2000 06:23:53 -0400
> 
> ok - I had forgotten where this was done in the code.  (Lynx is doing
> about all that it can do).
>  
OK. I think I have the patch whipped into shape.  Suitably protected with
#ifdefs, with corresponding changes in configure.in and config.hin.
Editorial review and user tests invited, as always.

-- gil
-- 
StorageTek
INFORMATION made POWERFUL
########################################################################
%%% Created Sun Aug 20 17:51:01 MDT 2000 by target lynx.patch. %%%
diff -bru orig/lynx2-8-4/config.hin lynx2-8-4/config.hin
--- orig/lynx2-8-4/config.hin   Thu Aug  3 11:19:52 2000
+++ lynx2-8-4/config.hin        Sun Aug 20 17:32:27 2000
@@ -88,6 +88,7 @@
 #undef HAVE_MMAP               /* defined by AM_GNU_GETTEXT */
 #undef HAVE_MUNMAP             /* defined by AM_GNU_GETTEXT */
 #undef HAVE_NCURSES_H          /* defined if we include <ncurses.h> */
+#undef HAVE_NEWTERM
 #undef HAVE_NL_TYPES_H         /* defined by AM_GNU_GETTEXT */
 #undef HAVE_POPEN
 #undef HAVE_PUTENV
diff -bru orig/lynx2-8-4/configure.in lynx2-8-4/configure.in
--- orig/lynx2-8-4/configure.in Thu Aug  3 11:19:52 2000
+++ lynx2-8-4/configure.in      Sun Aug 20 17:33:18 2000
@@ -577,6 +577,7 @@
                getbegx \
                getbegy \
                keypad \
+               newterm \
                resizeterm \
                use_default_colors \
                wborder \
diff -bru orig/lynx2-8-4/src/LYCurses.c lynx2-8-4/src/LYCurses.c
--- orig/lynx2-8-4/src/LYCurses.c       Thu Aug  3 11:19:52 2000
+++ lynx2-8-4/src/LYCurses.c    Sun Aug 20 17:48:11 2000
@@ -657,6 +657,27 @@
 #endif
 }
 
+#if       !defined(VMS) && !defined(USE_SLANG)
+/*
+ * If newterm is not defined, assume a curses subset which
+ * supports only initscr.  --gil
+ */
+#ifdef    HAVE_NEWTERM
+static SCREEN *LYscreen = NULL;
+#define LYDELSCR(scr) { \
+    delscreen(scr);     \
+    scr = NULL; }
+/*
+ * Surrogates for newterm annd delscreen
+ */
+#else  /* HAVE_NEWTERM   */
+static WINDOW *LYscreen = NULL;
+#undef  newterm
+#define newterm(type, out, in) (initscr())
+#define LYDELSCR(scr)  /* nothing */
+#endif /* HAVE_NEWTERM   */
+#endif /* !defined(VMS) && !defined(USE_SLANG) */
+
 PUBLIC void start_curses NOARGS
 {
 #ifdef USE_SLANG
@@ -773,7 +794,7 @@
 
    lynx_enable_mouse (1);
 
-#else /* Using curses: */
+#else /* USE_SLANG; Now using curses: */
 
 
 #ifdef VMS
@@ -784,14 +805,25 @@
     initscr(); /* start curses */
 #else  /* Unix: */
 
-    static BOOLEAN first_time = TRUE;
-
-    if (first_time) {
+    if (!LYscreen) {
        /*
         *  If we're not VMS then only do initscr() one time,
         *  and one time only!
         */
-       if (initscr() == NULL) {  /* start curses */
+       {
+           static char lines_putenv[] = "LINES=abcde",
+                       cols_putenv[]  = "COLUMNS=abcde";
+           BOOLEAN savesize;
+
+           savesize = recent_sizechange;
+           size_change(0);
+           recent_sizechange = savesize;    /* avoid extra redraw */
+           sprintf(lines_putenv + 6, "%d", LYlines & 0xfff);
+           sprintf(cols_putenv  + 8, "%d", LYcols  & 0xfff);
+           putenv(lines_putenv);
+           putenv(cols_putenv);
+       }
+       if (!(LYscreen=newterm(NULL,stdout,stdin))) {  /* start curses */
            fprintf(tfp, "%s\n",
                gettext("Terminal initialisation failed - unknown terminal 
type?"));
            exit_immediately (-1);
@@ -864,7 +896,6 @@
 #ifdef USE_COLOR_STYLE
        parse_userstyles();
 #endif
-       first_time = FALSE;
 #if USE_COLOR_TABLE
        lynx_init_colors();
 #endif /* USE_COLOR_TABLE */
@@ -1020,7 +1051,12 @@
     if(LYCursesON == TRUE)     {
         lynx_enable_mouse (0);
 #if (!defined(WIN_EX) || defined(__CYGWIN__))  /* @@@ */
+        if(LYscreen) {
            endwin();   /* stop curses */
+           if (recent_sizechange) {
+               LYDELSCR(LYscreen);
+           }
+        }
 #endif
     }
 #ifdef SH_EX

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

reply via email to

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