X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Ftinfo_driver.c;h=ac4f5ad9457935946219adccd97ee845b2bba943;hp=e97eff6fc8dfb2cc1a3b3ab1246e0176ada4772f;hb=173dd870810c8b85baa31f9a272d15f96a8f9ff4;hpb=03f728e5bb3630a54fffc4a2ff2f8dbfcce9088e diff --git a/ncurses/tinfo/tinfo_driver.c b/ncurses/tinfo/tinfo_driver.c index e97eff6f..ac4f5ad9 100644 --- a/ncurses/tinfo/tinfo_driver.c +++ b/ncurses/tinfo/tinfo_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2008-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 2008-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -50,7 +50,7 @@ # endif #endif -MODULE_ID("$Id: tinfo_driver.c,v 1.16 2011/10/22 17:50:33 tom Exp $") +MODULE_ID("$Id: tinfo_driver.c,v 1.23 2012/07/22 00:45:34 tom Exp $") /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, @@ -93,7 +93,7 @@ NCURSES_EXPORT_VAR(int) COLORS = 0; #define TCBMAGIC NCDRV_MAGIC(NCDRV_TINFO) #define AssertTCB() assert(TCB!=0 && TCB->magic==TCBMAGIC) -#define SetSP() assert(TCB->csp!=0); sp = TCB->csp +#define SetSP() assert(TCB->csp!=0); sp = TCB->csp; (void) sp /* * This routine needs to do all the work to make curscr look @@ -342,14 +342,18 @@ drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *linep, int *colp) { SCREEN *sp; bool useEnv = TRUE; + bool useTioctl = TRUE; AssertTCB(); sp = TCB->csp; /* can be null here */ if (sp) { useEnv = sp->_use_env; - } else + useTioctl = sp->_use_tioctl; + } else { useEnv = _nc_prescreen.use_env; + useTioctl = _nc_prescreen.use_tioctl; + } /* figure out the size of the screen */ T(("screen size: terminfo lines = %d columns = %d", lines, columns)); @@ -357,7 +361,7 @@ drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *linep, int *colp) *linep = (int) lines; *colp = (int) columns; - if (useEnv) { + if (useEnv || useTioctl) { int value; #ifdef __EMX__ @@ -365,7 +369,9 @@ drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *linep, int *colp) int screendata[2]; _scrsize(screendata); *colp = screendata[0]; - *linep = screendata[1]; + *linep = ((sp != 0 && sp->_filtered) + ? 1 + : screendata[1]); T(("EMX screen size: environment LINES = %d COLUMNS = %d", *linep, *colp)); } @@ -394,19 +400,33 @@ drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *linep, int *colp) } #endif /* HAVE_SIZECHANGE */ - /* - * Finally, look for environment variables. - * - * Solaris lets users override either dimension with an environment - * variable. - */ - if ((value = _nc_getenv_num("LINES")) > 0) { - *linep = value; - T(("screen size: environment LINES = %d", *linep)); - } - if ((value = _nc_getenv_num("COLUMNS")) > 0) { - *colp = value; - T(("screen size: environment COLUMNS = %d", *colp)); + if (useEnv) { + if (useTioctl) { + /* + * If environment variables are used, update them. + */ + if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) { + _nc_setenv_num("LINES", *linep); + } + if (_nc_getenv_num("COLUMNS") > 0) { + _nc_setenv_num("COLUMNS", *colp); + } + } + + /* + * Finally, look for environment variables. + * + * Solaris lets users override either dimension with an environment + * variable. + */ + if ((value = _nc_getenv_num("LINES")) > 0) { + *linep = value; + T(("screen size: environment LINES = %d", *linep)); + } + if ((value = _nc_getenv_num("COLUMNS")) > 0) { + *colp = value; + T(("screen size: environment COLUMNS = %d", *colp)); + } } /* if we can't get dynamic info about the size, use static */ @@ -753,7 +773,7 @@ drv_do_color(TERMINAL_CONTROL_BLOCK * TCB, if (old_pair >= 0 && sp != 0 && NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx - old_pair, + (short) old_pair, &old_fg, &old_bg) !=ERR) { if ((isDefaultColor(fg) && !isDefaultColor(old_fg)) @@ -839,7 +859,9 @@ drv_initmouse(TERMINAL_CONTROL_BLOCK * TCB) } static int -drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB, int delay) +drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB, + int delay + EVENTLIST_2nd(_nc_eventlist * evl)) { int rc = 0; SCREEN *sp;