More commenting, better debugging of color problems, and support for
the new TerminalType option in wine.ini. This allows us to select
which terminal type we are really using so that we can, for example,
use its color capabilities.
diff --git a/console/ncurses.c b/console/ncurses.c
index 15191c7..7cdfd33 100644
--- a/console/ncurses.c
+++ b/console/ncurses.c
@@ -3,7 +3,7 @@
#include <stdio.h>
#include "config.h"
-#include "console.h"
+#include "console.h" /* Must define WINE_NCURSES */
#ifdef WINE_NCURSES
@@ -22,6 +22,8 @@
*/
#include "debug.h"
+#include "options.h"
+
#undef ERR /* Use ncurses's err() */
#ifdef HAVE_NCURSES_H
# include <ncurses.h>
@@ -35,6 +37,11 @@
static int get_color_pair(int fg_color, int bg_color);
+const char *color_names[] = {"null", "black", "blue", "green",
+ "cyan", "magenta", "brown", "red", "light gray", "dark gray",
+ "light blue", "light green", "light red", "light magenta",
+ "light cyan", "yellow", "white"};
+
void NCURSES_Start()
{
/* This should be the root driver so we can ignore anything
@@ -53,7 +60,7 @@
driver.setBackgroundColor = NCURSES_SetBackgroundColor;
#ifdef HAVE_RESIZETERM
driver.notifyResizeScreen = NCURSES_NotifyResizeScreen;
-#endif
+#endif /* HAVE_RESIZETERM */
driver.checkForKeystroke = NCURSES_CheckForKeystroke;
driver.getKeystroke = NCURSES_GetKeystroke;
@@ -63,14 +70,19 @@
void NCURSES_Init()
{
- ncurses_screen = newterm("xterm", driver.console_out,
+ char terminal_type[80];
+
+ PROFILE_GetWineIniString("console", "TerminalType",
+ "xterm", terminal_type, 79);
+
+ ncurses_screen = newterm(terminal_type, driver.console_out,
driver.console_in);
set_term(ncurses_screen);
start_color();
raw();
noecho();
nonl();
-/* intrflush(stdscr, FALSE); */
+ intrflush(stdscr, FALSE);
keypad(stdscr, TRUE);
nodelay(stdscr, TRUE);
}
@@ -185,7 +197,8 @@
case WINE_CYAN: return COLOR_CYAN;
}
- FIXME(console, "Unable to allocate color %d\n", color);
+ FIXME(console, "Unable to allocate color %d (%s)\n", color,
+ color_names[color]);
/* Don't allocate a color... yet */
return 0;
@@ -208,6 +221,8 @@
calls ResizeScreen(). It is meant to resize the ncurses internal
data structures to know about the new window dimensions. */
+ TRACE(console, "Terminal resized to y: %d, x: %d\n", y, x);
+
resizeterm(y, x);
}