support color under Solaris curses
authorNathan Bryant <loanshark@uncensored.citadel.org>
Tue, 12 Mar 2002 21:08:03 +0000 (21:08 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Tue, 12 Mar 2002 21:08:03 +0000 (21:08 +0000)
citadel/ChangeLog
citadel/screen.c

index 37f89395453ec11de19b1142ecac3a3bfed1f054..66dbaca67f4995a7dca51937f3e9903f6d008fc6 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 590.146  2002/03/12 21:08:03  nbryant
+ support color under Solaris curses
+
  Revision 590.145  2002/03/12 19:59:40  ajc
  * Access control change: do not treat mailboxes as guessname rooms for Aides.
    Open up INVT/KICK commands to non-Aides for their mailboxes.
@@ -3461,3 +3464,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index 7e1d1e770da10317306082e931515f596c134f71..210895838f908bf938ae0d88f7ed562aa2ef7e0b 100644 (file)
@@ -16,7 +16,7 @@
 #ifdef HAVE_VW_PRINTW
 #define _vwprintw vw_printw
 #else
-/* Ancient curses implementations, this needs testing. Anybody got XENIX? */
+/* SYSV style curses (Solaris, etc.) */
 #define _vwprintw vwprintw
 #endif
 #ifndef HAVE_SNPRINTF
@@ -98,7 +98,9 @@ void screen_new(void)
                init_pair(1+DIM_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
                init_pair(1+DIM_CYAN, COLOR_CYAN, COLOR_BLACK);
                init_pair(1+DIM_WHITE, COLOR_WHITE, COLOR_BLACK);
-               init_pair(17, COLOR_WHITE, COLOR_BLUE);
+
+               if (COLOR_PAIRS > 8)
+                       init_pair(9, COLOR_WHITE, COLOR_BLUE);
        } else
 #endif /* HAVE_CURSES_H */
        {
@@ -338,6 +340,8 @@ int scr_color(int colornum)
        if (mainwindow) {
 #ifdef HAVE_WCOLOR_SET
                wcolor_set(mainwindow, 1 + (colornum & 7), NULL);
+#else
+               wattron(mainwindow, COLOR_PAIR(1 + (colornum & 7)));
 #endif
                if (colornum & 8) {
                        wattron(mainwindow, A_BOLD);
@@ -430,7 +434,10 @@ void windows_new(void)
                leaveok(mainwindow, FALSE);
                scrollok(mainwindow, TRUE);
                statuswindow = newwin(1, x, y - 1, 0);
-               wbkgdset(statuswindow, COLOR_PAIR(17));
+
+               if (COLOR_PAIRS > 8)
+                       wbkgdset(statuswindow, COLOR_PAIR(9));
+
                werase(statuswindow);
                immedok(statuswindow, FALSE);
                leaveok(statuswindow, FALSE);