X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Ftinfo_driver.c;h=84611c83b46be3440dae795af3a178a2b8e8fc7f;hp=05cba8eb65cd4d2fd198b74c08879ba889b77be5;hb=4e793faf6575b2297482f77b2bc3d18105c0fc76;hpb=a3173aa5edbdbc6d617800f81a88a304ac5e053c diff --git a/ncurses/tinfo/tinfo_driver.c b/ncurses/tinfo/tinfo_driver.c index 05cba8eb..84611c83 100644 --- a/ncurses/tinfo/tinfo_driver.c +++ b/ncurses/tinfo/tinfo_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2008-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 2008-2012,2013 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.18 2012/02/18 20:34:55 tom Exp $") +MODULE_ID("$Id: tinfo_driver.c,v 1.30 2013/05/25 20:16:46 tom Exp $") /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, @@ -119,7 +119,7 @@ drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, const char *tname, int *errret) sp = TCB->csp; TCB->magic = TCBMAGIC; -#if (USE_DATABASE || USE_TERMCAP) +#if (NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP) status = _nc_setup_tinfo(tname, &termp->type); #else status = TGETENT_NO; @@ -184,22 +184,18 @@ drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, int beepFlag) /* FIXME: should make sure that we are not in altchar mode */ if (beepFlag) { if (bell) { - res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "bell", bell); + res = NCURSES_PUTP2("bell", bell); NCURSES_SP_NAME(_nc_flush) (sp); } else if (flash_screen) { - res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx - "flash_screen", - flash_screen); + res = NCURSES_PUTP2("flash_screen", flash_screen); NCURSES_SP_NAME(_nc_flush) (sp); } } else { if (flash_screen) { - res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx - "flash_screen", - flash_screen); + res = NCURSES_PUTP2("flash_screen", flash_screen); NCURSES_SP_NAME(_nc_flush) (sp); } else if (bell) { - res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "bell", bell); + res = NCURSES_PUTP2("bell", bell); NCURSES_SP_NAME(_nc_flush) (sp); } } @@ -315,7 +311,7 @@ drv_rescol(TERMINAL_CONTROL_BLOCK * TCB) SetSP(); if (orig_pair != 0) { - NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "orig_pair", orig_pair); + NCURSES_PUTP2("orig_pair", orig_pair); result = TRUE; } return result; @@ -331,7 +327,7 @@ drv_rescolors(TERMINAL_CONTROL_BLOCK * TCB) SetSP(); if (orig_colors != 0) { - NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "orig_colors", orig_colors); + NCURSES_PUTP2("orig_colors", orig_colors); result = TRUE; } return result; @@ -342,14 +338,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 +357,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 +365,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 +396,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 */ @@ -614,13 +630,11 @@ drv_screen_init(SCREEN *sp) static void drv_init(TERMINAL_CONTROL_BLOCK * TCB) { - SCREEN *sp; TERMINAL *trm; AssertTCB(); trm = (TERMINAL *) TCB; - sp = TCB->csp; TCB->info.initcolor = VALID_STRING(initialize_color); TCB->info.canchange = can_change; @@ -675,12 +689,11 @@ drv_initpair(TERMINAL_CONTROL_BLOCK * TCB, int pair, int f, int b) tp[f].red, tp[f].green, tp[f].blue, tp[b].red, tp[b].green, tp[b].blue)); - NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx - "initialize_pair", - TPARM_7(initialize_pair, - pair, - tp[f].red, tp[f].green, tp[f].blue, - tp[b].red, tp[b].green, tp[b].blue)); + NCURSES_PUTP2("initialize_pair", + TPARM_7(initialize_pair, + pair, + tp[f].red, tp[f].green, tp[f].blue, + tp[b].red, tp[b].green, tp[b].blue)); } } @@ -712,9 +725,8 @@ drv_initcolor(TERMINAL_CONTROL_BLOCK * TCB, AssertTCB(); if (initialize_color != NULL) { - NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx - "initialize_color", - TPARM_4(initialize_color, color, r, g, b)); + NCURSES_PUTP2("initialize_color", + TPARM_4(initialize_color, color, r, g, b)); } } @@ -753,7 +765,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)) @@ -878,7 +890,7 @@ drv_mvcur(TERMINAL_CONTROL_BLOCK * TCB, int yold, int xold, int ynew, int xnew) { SCREEN *sp = TCB->csp; AssertTCB(); - return TINFO_MVCUR(sp, yold, xold, ynew, xnew); + return NCURSES_SP_NAME(_nc_mvcur) (sp, yold, xold, ynew, xnew); } static void @@ -888,9 +900,8 @@ drv_hwlabel(TERMINAL_CONTROL_BLOCK * TCB, int labnum, char *text) AssertTCB(); if (labnum > 0 && labnum <= num_labels) { - NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx - "plab_norm", - TPARM_2(plab_norm, labnum, text)); + NCURSES_PUTP2("plab_norm", + TPARM_2(plab_norm, labnum, text)); } } @@ -901,9 +912,9 @@ drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB, int OnFlag) AssertTCB(); if (OnFlag) { - NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "label_on", label_on); + NCURSES_PUTP2("label_on", label_on); } else { - NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "label_off", label_off); + NCURSES_PUTP2("label_off", label_off); } } @@ -968,7 +979,7 @@ drv_initacs(TERMINAL_CONTROL_BLOCK * TCB, chtype *real_map, chtype *fake_map) AssertTCB(); assert(sp != 0); if (ena_acs != NULL) { - NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "ena_acs", ena_acs); + NCURSES_PUTP2("ena_acs", ena_acs); } #if NCURSES_EXT_FUNCS /* @@ -1205,7 +1216,7 @@ __nc_putp(SCREEN *sp, const char *name GCC_UNUSED, const char *value) int rc = ERR; if (value) { - rc = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx name, value); + rc = NCURSES_PUTP2(name, value); } return rc; }