-- Eric Pouech
Name: wc_wsz ChangeLog: - win32 console's window cannot be larger than curses' stdscr - correctly manage backspace - various cleanup License: X11 GenDate: 2003/09/21 16:20:26 UTC ModifiedFiles: programs/wineconsole/curses.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/curses.c,v retrieving revision 1.14 diff -u -u -r1.14 curses.c --- programs/wineconsole/curses.c 7 Sep 2003 05:08:14 -0000 1.14 +++ programs/wineconsole/curses.c 21 Sep 2003 15:06:30 -0000 @@ -112,11 +112,6 @@ /**********************************************************************/ -typedef struct { - LPVOID lpCallback; - LPVOID lpContext; -} DirectDrawEnumerateProcData; - static BOOL WCCURSES_bind_libcurses(void) { #ifdef HAVE_NCURSES_H @@ -240,8 +235,6 @@ int scr_width; int scr_height; - getmaxyx(stdscr, scr_height, scr_width); - if (data->curcfg.cursor_visible && data->cursor.Y >= data->curcfg.win_pos.Y && data->cursor.Y < data->curcfg.win_pos.Y + data->curcfg.win_height && @@ -255,10 +248,12 @@ { curs_set(0); } - + getmaxyx(stdscr, scr_height, scr_width); prefresh(PRIVATE(data)->pad, data->curcfg.win_pos.Y, data->curcfg.win_pos.X, - 0, 0, scr_height, scr_width); + 0, 0, + min(scr_height, data->curcfg.win_height) - 1, + min(scr_width, data->curcfg.win_width) - 1); } /****************************************************************** @@ -281,6 +276,21 @@ */ void WCCURSES_ComputePositions(struct inner_data* data) { + int x, y; + + getmaxyx(stdscr, y, x); + if ((data->curcfg.win_height && y < data->curcfg.win_height) || + (data->curcfg.win_width && x < data->curcfg.win_width)) + { + SMALL_RECT pos; + + WINE_WARN("Window too large (%dx%d), adjusting to curses' size (%dx%d)\n", + data->curcfg.win_width, data->curcfg.win_height, x, y); + pos.Left = pos.Top = 0; + pos.Right = x - 1; pos.Bottom = y - 1; + SetConsoleWindowInfo(data->hConOut, FALSE, &pos); + return; /* we'll get called again upon event for new window size */ + } if (PRIVATE(data)->pad) WCCURSES_PosCursor(data); } @@ -611,7 +621,7 @@ numEvent = WCCURSES_FillComplexChar(ir, 0x47, 0x24, 0); break; case KEY_BACKSPACE: - numEvent = WCCURSES_FillSimpleChar(ir, '\b'); + numEvent = WCCURSES_FillSimpleChar(ir, 127); break; case KEY_F0: /* up to F63 */ @@ -898,7 +908,7 @@ * For the time being, setting this to 1 will allow scrolling up/down * on buffer with F11/F12. */ - /* data->allow_scroll = 1; */ + /* PRIVATE(data)->allow_scroll = 1; */ initscr();