# HG changeset patch # User Matti Hamalainen # Date 1288297351 -10800 # Node ID 4bc63a535acbacbe24162aa4ad77ea94c725431f # Parent 9e7f528787256a8b45876e8b2e0bc3c8075c74b9 Fix some PDCurses incompatibilities and remove some Win32/PDCurses specific hacks. diff -r 9e7f52878725 -r 4bc63a535acb Makefile.w32 --- a/Makefile.w32 Mon Oct 25 01:35:12 2010 +0300 +++ b/Makefile.w32 Thu Oct 28 23:22:31 2010 +0300 @@ -6,7 +6,13 @@ # C-compiler, flags and linker flags CC=gcc CFLAGS=-DHAVE_STRING_H -Ipdcurses -LDFLAGS=-L/usr/local/i386-mingw32/lib/ -lmingw32 pdcurses/libpdcurses.a -liberty -lws2_32 -s +LDFLAGS=-L/usr/local/i386-mingw32/lib/ -lmingw32 -liberty -lws2_32 -s + +ifeq ($(SDL),y) +LDFLAGS+=pdcurses/libpdcurses-sdl.a -lSDL +else +LDFLAGS+=pdcurses/libpdcurses.a +endif # Miscellaneous EXEEXT=.exe diff -r 9e7f52878725 -r 4bc63a535acb nnchat.c --- a/nnchat.c Mon Oct 25 01:35:12 2010 +0300 +++ b/nnchat.c Thu Oct 28 23:22:31 2010 +0300 @@ -18,7 +18,7 @@ #define SET_MAX_BACKBUF (1024) #define SET_MAX_HISTORY (16) #define SET_DELAY (15) -#define SET_DELAY_USEC (SET_DELAY * 250) +#define SET_DELAY_USEC (SET_DELAY * 150) #define SET_KEEPALIVE (15*60) /* Ping/keepalive period in seconds */ char *ignoreList[] = { @@ -176,19 +176,13 @@ strftime(tmpStr, sizeof(tmpStr), "%H:%M:%S", tmpTime); } -#ifdef __WIN32 - /* PDCurses does not like the hack used for ncurses to get a specific - * colour background .. so we just use something else, but uglier. :| - */ - wbkgdset(statusWin, A_REVERSE | COLOR_PAIR(13)); -#else - wbkgdset(statusWin, 0x0d00); -#endif + wbkgdset(statusWin, COLOR_PAIR(10)); werase(statusWin); - wattrset(statusWin, A_BOLD); + wattrset(statusWin, A_BOLD | COLOR_PAIR(11)); mvwaddstr(statusWin, 0, 1, tmpStr); + wattrset(statusWin, A_BOLD | COLOR_PAIR(13)); waddstr(statusWin, " | "); wattrset(statusWin, A_BOLD | COLOR_PAIR(16)); waddstr(statusWin, optUserName); @@ -955,7 +949,6 @@ /* Handle several buffered keypresses at once */ do { c = wgetch(stdscr); - if (c == 0x1b) { c = wgetch(stdscr); if (c == 'O') { @@ -973,13 +966,21 @@ } } + switch (c) { #ifdef KEY_RESIZE case KEY_RESIZE: +#ifdef PDCURSES + resize_term(0, 0); + erase(); + timeout(SET_DELAY); +#endif + if (!initializeWindows()) { - errorMsg("Error resizing ncurses windows\n"); + errorMsg("Error resizing curses windows\n"); isError = TRUE; } + update = TRUE; break; #endif