Removed curses fullscreen mode in the text client, in preparation for something even...
authorArt Cancro <ajc@citadel.org>
Thu, 2 Sep 2010 00:38:35 +0000 (20:38 -0400)
committerArt Cancro <ajc@citadel.org>
Thu, 2 Sep 2010 00:38:35 +0000 (20:38 -0400)
on next.

citadel/citadel.rc
citadel/textclient/citadel.c
citadel/textclient/commands.c
citadel/textclient/routines.c
citadel/textclient/screen.c

index 75284cac426984bc1194118713439cd10260aceb..6ca24feb801c831f73f76c754b63bac60ff874f7 100644 (file)
 # systems on the same machine as the client.
 encrypt=default
 
-# Set FULLSCREEN to yes to (attempt to) use full-screen curses mode.
-# This mode presents a status line and a few other niceties.  Some
-# people might not like this, so you can turn it off here or with the
-# -s command line option.  The default is to use full screen if the
-# terminal supports it.
-fullscreen=no
-
 # Set EDITOR to the name of an external editor to be used for entering
 # messages.  If you want the external editor to be used by default, be sure
 # to reflect this in the command set below.
index 3ea33eea143ad49c93c2aa502a0ca36cf0d52d83..406617eb126eba30e1d2297867da761ced5775af 100644 (file)
@@ -534,8 +534,6 @@ void dotgoto(CtdlIPC *ipc, char *towhere, int display_name, int fromungoto)
                        rv = system(rc_gotmail_cmd);
                }
        }
-       status_line(ipc->ServInfo.humannode, ipc->ServInfo.site_location,
-                       room_name, secure, newmailcount);
        free(room);
 }
 
@@ -1085,7 +1083,7 @@ void check_screen_dims(void)
        if (have_xterm) {       /* dynamically size screen if on an xterm */
                if (ioctl(0, TIOCGWINSZ, &xwinsz) == 0) {
                        if (xwinsz.height)
-                               screenheight = is_curses_enabled() ? (int)xwinsz.height - 1 : (int) xwinsz.height;
+                               screenheight = (int) xwinsz.height;
                        if (xwinsz.width)
                                screenwidth = (int) xwinsz.width;
                }
@@ -1627,9 +1625,6 @@ int main(int argc, char **argv)
                   ipc->ServInfo.site_location);
        scr_flush();
 
-       status_line(ipc->ServInfo.humannode, ipc->ServInfo.site_location, NULL,
-                   secure, -1);
-
        screenwidth = 80;       /* default screen dimensions */
        screenheight = 24;
        
index 7999c62533c7cb1409a96d73324e96811a042bfd..0465db3cda427f53d275501b0de02f6f046648a4 100644 (file)
@@ -331,18 +331,7 @@ void print_instant(void)
                fmout(screenwidth, NULL, listing, NULL, 1, screenheight, -1, 0);
                free(listing);
 
-               /* when running in curses mode, the scroll bar in most
-                  xterm-style programs becomes useless, so it makes sense to
-                  pause after a screenful of pages if the user has been idle
-                  for a while. However, this is annoying to some of the users
-                  who aren't in curses mode and tend to leave their clients
-                  idle. keepalives become disabled, resulting in getting booted
-                  when coming back to the idle session. but they probably have
-                  a working scrollback in their terminal, so disable it in this
-                  case:
-                */
-               if (!is_curses_enabled())
-                       lines_printed = 0;
+               lines_printed = 0;
        }
        scr_printf("\n---\n");
        color(BRIGHT_WHITE);
index 1c0675d408deb4dee76bd42e0991fc330425e6cb..8dff0a5f947d5a03ce4b4aa1497a2e1db25c3d2c 100644 (file)
@@ -440,8 +440,6 @@ void progress(CtdlIPC* ipc, unsigned long curr, unsigned long cmax)
 
        if (curr >= cmax) {
                sln_printf("\r%79s\r","");
-               status_line(ipc->ServInfo.humannode, ipc->ServInfo.site_location,
-                       room_name, secure, 0);
        } else {
                /* a will be range 0-50 rather than 0-100 */
                a=(curr * 50) / cmax;
index 3299b0506c6a1e399b756157de13f9a1b3bd6910..dc925c12e3c035664addb2f5e78ecd9a726fabe0 100644 (file)
@@ -1,6 +1,5 @@
-
 /*
- * Handle full-screen curses stuff
+ * Screen output handling
  */
 
 #include <stdlib.h>
 #include <stdarg.h>
 #include <sys/types.h>
 #include "sysdep.h"
-#ifdef HAVE_VW_PRINTW
-#define _vwprintw vw_printw
-#else
-/* SYSV style curses (Solaris, etc.) */
-#define _vwprintw vwprintw
-#endif
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
 #endif
 #include "commands.h"
 #include "screen.h"
 
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-static SCREEN *myscreen = NULL;
-static WINDOW *mainwindow = NULL;
-static WINDOW *statuswindow = NULL;
-
-char rc_screen;
-#endif
 char arg_screen;
 
 extern int screenheight;
@@ -44,116 +30,15 @@ extern void check_screen_dims(void);
 void do_keepalive(void);
 
 
-int is_curses_enabled(void) {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       return mainwindow != NULL;
-#else
-       return 0;
-#endif
-}
-
-/*
- * status_line() is a convenience function for writing a "typical"
- * status line to the window.
- */
-void status_line(const char *humannode, const char *site_location,
-                const char *room_name, int secure, int newmailcount)
-{
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (statuswindow) {
-               if (secure) {
-                       sln_printf("Encrypted ");
-                       waddch(statuswindow, ACS_VLINE);
-                       waddch(statuswindow, ' ');
-               }
-               if (room_name)
-                       sln_printf("%s on ", room_name);
-               if (humannode)
-                       sln_printf("%s ", humannode);
-               if (newmailcount > 0) {
-                       waddch(statuswindow, ACS_VLINE);
-                       sln_printf(" %d new mail ", newmailcount);
-               }
-               sln_printf("\n");
-       }
-#endif /* HAVE_CURSES_H */
-}
-
-
-/*
- * Display a 3270-style "wait" indicator at the bottom of the screen
- */
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-void wait_indicator(int state) {
-
-       if (statuswindow && !isendwin()) {
-
-               mvwinch(statuswindow, 0, screenwidth - 2);
-               switch (state) {
-               default:
-               case 0:         /* Idle */
-                       waddch(statuswindow, ' ');
-                       break;
-               case 1:         /* Waiting */
-                       waddch(statuswindow, 'X');
-                       break;
-               case 2:         /* Receiving */
-                       waddch(statuswindow, '<');
-                       break;
-               case 3:         /* Sending */
-                       waddch(statuswindow, '>');
-                       break;
-               }
-               waddch(statuswindow, '\r');
-               wrefresh(statuswindow);
-               wrefresh(mainwindow);   /* this puts the cursor back */
-       }
-}
-#else
-void wait_indicator(int state) {}
-#endif
-
-
 /*
- * Initialize the screen.  If newterm() fails, myscreen will be NULL and
- * further handlers will assume we should be in line mode.
+ * Initialize the screen
  */
 void screen_new(void)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (arg_screen != RC_NO && rc_screen != RC_NO)
-               myscreen = newterm(NULL, stdout, stdin);
-       if (myscreen) {
-               cbreak();
-               noecho();
-               nonl();
-               intrflush(stdscr, FALSE);
-               keypad(stdscr, TRUE);
-               /* Setup all our colors */
-               start_color();
-               if (rc_ansi_color)
-                       enable_color = 1;
-               /*init_pair(DIM_BLACK, COLOR_BLACK, COLOR_BLACK);*/
-               init_pair(DIM_RED, COLOR_RED, COLOR_BLACK);
-               init_pair(DIM_GREEN, COLOR_GREEN, COLOR_BLACK);
-               init_pair(DIM_YELLOW, COLOR_YELLOW, COLOR_BLACK);
-               init_pair(DIM_BLUE, COLOR_BLUE, COLOR_BLACK);
-               init_pair(DIM_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
-               init_pair(DIM_CYAN, COLOR_CYAN, COLOR_BLACK);
-               init_pair(DIM_WHITE, COLOR_WHITE, COLOR_BLACK);
-
-               if (COLOR_PAIRS > 8)
-                       init_pair(8, COLOR_WHITE, COLOR_BLUE);
-       } else
-#endif /* HAVE_CURSES_H */
-       {
-               send_ansi_detect();
-               look_for_ansi();
-               cls(0);
-               color(DIM_WHITE);
-       }
-       screen_set();
-       windows_new();
+       send_ansi_detect();
+       look_for_ansi();
+       cls(0);
+       color(DIM_WHITE);
 }
 
 
@@ -165,23 +50,12 @@ void screen_delete(void)
 {
        windows_delete();
        screen_reset();
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (myscreen) {
-               delscreen(myscreen);
-       }
-       myscreen = NULL;
-#endif
 }
 
 /*
  * Beep.
  */
 void ctdl_beep(void) {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (myscreen)
-               beep();
-       else
-#endif
        putc(7, stdout);
 }
        
@@ -193,13 +67,6 @@ void ctdl_beep(void) {
  */
 int screen_set(void)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (myscreen) {
-               set_term(myscreen);
-               wrefresh(curscr);
-               return 1;
-       }
-#endif /* HAVE_CURSES_H */
        return 0;
 }
 
@@ -209,18 +76,12 @@ int screen_set(void)
  */
 int screen_reset(void)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (myscreen) {
-               if (!isendwin()) endwin();
-               return 1;
-       }
-#endif /* HAVE_CURSES_H */
        return 0;
 }
 
 
 /*
- * scr_printf() outputs to the main window (or screen if not in curses)
+ * scr_printf() outputs to the terminal
  */
 int scr_printf(char *fmt, ...)
 {
@@ -228,12 +89,7 @@ int scr_printf(char *fmt, ...)
        register int retval;
 
        va_start(ap, fmt);
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (mainwindow) {
-               retval = _vwprintw(mainwindow, fmt, ap);
-       } else
-#endif
-               retval = vprintf(fmt, ap);
+       retval = vprintf(fmt, ap);
        va_end(ap);
        return retval;
 }
@@ -248,14 +104,7 @@ int err_printf(char *fmt, ...)
        register int retval;
 
        va_start(ap, fmt);
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (mainwindow) {               /* FIXME: direct to error window */
-               retval = _vwprintw(mainwindow, fmt, ap);
-               if (fmt[strlen(fmt) - 1] == '\n')
-                       wrefresh(mainwindow);
-       } else
-#endif
-               retval = vfprintf(stderr, fmt, ap);
+       retval = vfprintf(stderr, fmt, ap);
        va_end(ap);
        return retval;
 }
@@ -268,28 +117,8 @@ int sln_printf(char *fmt, ...)
 {
        va_list ap;
        register int retval;
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       static char buf[4096];
-#endif
-
        va_start(ap, fmt);
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (statuswindow) {
-               register char *i;
-               
-               retval = vsnprintf(buf, 4096, fmt, ap);
-               for (i = buf; *i; i++) {
-                       if (*i == '\r' || *i == '\n')
-                               wclrtoeol(statuswindow);
-                       sln_putc(*i);
-                       if (*i == '\r' || *i == '\n') {
-                               wrefresh(statuswindow);
-                               mvwinch(statuswindow, 0, 0);
-                       }
-               }
-       } else
-#endif
-               retval = vprintf(fmt, ap);
+       retval = vprintf(fmt, ap);
        va_end(ap);
        return retval;
 }
@@ -301,84 +130,24 @@ int sln_printf(char *fmt, ...)
 int sln_printf_if(char *fmt, ...)
 {
        register int retval = 1;
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       static char buf[4096];
-       va_list ap;
-
-       va_start(ap, fmt);
-       if (statuswindow) {
-               register char *i;
-               
-               retval = vsnprintf(buf, 4096, fmt, ap);
-               for (i = buf; *i; i++) {
-                       if (*i == '\r' || *i == '\n')
-                               wclrtoeol(statuswindow);
-                       sln_putc(*i);
-                       if (*i == '\r' || *i == '\n') {
-                               wrefresh(statuswindow);
-                               mvwinch(statuswindow, 0, 0);
-                       }
-               }
-       }
-       va_end(ap);
-#endif
        return retval;
 }
 
 
 int scr_getc(int delay)
 {
-  unsigned char buf;
-
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (mainwindow) {
-               wtimeout(mainwindow, delay);
-               return wgetch(mainwindow);
-       }
-#endif
-
+       unsigned char buf;
        buf = '\0';
        if (!read (0, &buf, 1))
                logoff(NULL, 3);
        return buf;
 }
 
-/* the following is unused and looks broken, but there may
-   be some input problems still lurking in curses mode, so
-   i'll leave it blocked out for now for informational
-   purposes. */
-#if 0
-int scr_blockread(void)
-  {
-    int a = 0;
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-    wtimeout(mainwindow, S_KEEPALIVE); 
-    while (1)
-      {
-        do_keepalive();
-        a = wgetch(mainwindow); /* will block for food */
-        if (a != ERR)
-          break;
-        /* a = scr_getc(); */
-      }
-#endif
-    return a;
-  }
-#endif /* 0 */
-
 /*
  * scr_putc() outputs a single character
  */
 int scr_putc(int c)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (mainwindow) {
-               if (c == 7) beep();
-               if (waddch(mainwindow, c) != OK)
-                       logoff(NULL, 3);
-               return c;
-       }
-#endif
        if (putc(c, stdout) == EOF)
                logoff(NULL, 3);
        return c;
@@ -387,20 +156,12 @@ int scr_putc(int c)
 
 int sln_putc(int c)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (statuswindow)
-               return ((waddch(statuswindow, c) == OK) ? c : EOF);
-#endif
        return putc(c, stdout);
 }
 
 
 int sln_putc_if(int c)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (statuswindow)
-               return ((waddch(statuswindow, c) == OK) ? c : EOF);
-#endif
        return 1;
 }
 
@@ -410,55 +171,25 @@ int sln_putc_if(int c)
  */
 int scr_color(int colornum)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (mainwindow) {
-#ifdef HAVE_WCOLOR_SET
-               wcolor_set(mainwindow, (colornum & 7), NULL);
-#else
-               wattron(mainwindow, COLOR_PAIR((colornum & 7)));
-#endif
-               if (colornum & 8) {
-                       wattron(mainwindow, A_BOLD);
-               } else {
-                       wattroff(mainwindow, A_BOLD);
-               }
-               return 1;
-       }
-#endif
        return 0;
 }
 
 
 void scr_flush(void)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (mainwindow)
-               wrefresh(mainwindow);
-       else
-#endif
-               fflush(stdout);
+       fflush(stdout);
 }
 
 
 void err_flush(void)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (mainwindow)         /* FIXME: error status window needed */
-               wrefresh(mainwindow);
-       else
-#endif
                fflush(stderr);
 }
 
 
 void sln_flush(void)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (statuswindow)
-               wrefresh(statuswindow);
-       else
-#endif
-               fflush(stdout);
+       fflush(stdout);
 }
 
 static volatile int caught_sigwinch = 0;
@@ -468,25 +199,6 @@ static volatile int caught_sigwinch = 0;
  */
 int scr_set_windowsize(CtdlIPC* ipc)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (mainwindow && caught_sigwinch) {
-               caught_sigwinch = 0;
-#ifdef HAVE_RESIZETERM
-               resizeterm(screenheight + 1, screenwidth);
-#endif
-#ifdef HAVE_WRESIZE
-               wresize(mainwindow, screenheight, screenwidth);
-               wresize(statuswindow, 1, screenwidth);
-#endif
-               mvwin(statuswindow, screenheight, 0);
-               status_line(ipc->ServInfo.humannode, ipc->ServInfo.site_location,
-                               room_name, secure, -1);
-               wnoutrefresh(mainwindow);
-               wnoutrefresh(statuswindow);
-               doupdate();
-               return 1;
-       }
-#endif /* HAVE_CURSES_H */
        return 0;
 }
 
@@ -497,7 +209,8 @@ int scr_set_windowsize(CtdlIPC* ipc)
 RETSIGTYPE scr_winch(int signum)
 {
        /* if we receive this signal, we must be running
-          in a terminal that supports resizing. */
+        * in a terminal that supports resizing.
+        */
        have_xterm = 1;
        caught_sigwinch = 1;
        check_screen_dims();
@@ -510,33 +223,6 @@ RETSIGTYPE scr_winch(int signum)
  */
 void windows_new(void)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       register int x, y;
-
-       if (myscreen) {
-               getmaxyx(stdscr, y, x);
-               mainwindow = newwin(y - 1, x, 0, 0);
-               screenwidth = x;
-               screenheight = y - 1;
-               immedok(mainwindow, FALSE);
-               leaveok(mainwindow, FALSE);
-               scrollok(mainwindow, TRUE);
-               statuswindow = newwin(1, x, y - 1, 0);
-
-               if (COLOR_PAIRS > 8)
-                       wbkgdset(statuswindow, ' ' | COLOR_PAIR(8));
-               else
-                       wbkgdset(statuswindow, ' ' | COLOR_PAIR(DIM_WHITE));
-
-               werase(statuswindow);
-               immedok(statuswindow, FALSE);
-               leaveok(statuswindow, FALSE);
-               scrollok(statuswindow, FALSE);
-               wrefresh(statuswindow);
-       }
-#else /* HAVE_CURSES_H */
-
-#endif /* HAVE_CURSES_H */
 }
 
 
@@ -545,14 +231,4 @@ void windows_new(void)
  */
 void windows_delete(void)
 {
-#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
-       if (mainwindow)
-               delwin(mainwindow);
-       mainwindow = NULL;
-       if (statuswindow)
-               delwin(statuswindow);
-       statuswindow = NULL;
-#else /* HAVE_CURSES_H */
-
-#endif /* HAVE_CURSES_H */
 }