1*81d8c4e1Snicm /* $OpenBSD: tty_display.h,v 1.4 2010/01/12 23:22:07 nicm Exp $ */ 292dd1ec0Smillert 392dd1ec0Smillert /**************************************************************************** 4*81d8c4e1Snicm * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * 592dd1ec0Smillert * * 692dd1ec0Smillert * Permission is hereby granted, free of charge, to any person obtaining a * 792dd1ec0Smillert * copy of this software and associated documentation files (the * 892dd1ec0Smillert * "Software"), to deal in the Software without restriction, including * 992dd1ec0Smillert * without limitation the rights to use, copy, modify, merge, publish, * 1092dd1ec0Smillert * distribute, distribute with modifications, sublicense, and/or sell * 1192dd1ec0Smillert * copies of the Software, and to permit persons to whom the Software is * 1292dd1ec0Smillert * furnished to do so, subject to the following conditions: * 1392dd1ec0Smillert * * 1492dd1ec0Smillert * The above copyright notice and this permission notice shall be included * 1592dd1ec0Smillert * in all copies or substantial portions of the Software. * 1692dd1ec0Smillert * * 1792dd1ec0Smillert * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 1892dd1ec0Smillert * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 1992dd1ec0Smillert * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 2092dd1ec0Smillert * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 2192dd1ec0Smillert * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 2292dd1ec0Smillert * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 2392dd1ec0Smillert * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 2492dd1ec0Smillert * * 2592dd1ec0Smillert * Except as contained in this notice, the name(s) of the above copyright * 2692dd1ec0Smillert * holders shall not be used in advertising or otherwise to promote the * 2792dd1ec0Smillert * sale, use or other dealings in this Software without prior written * 2892dd1ec0Smillert * authorization. * 2992dd1ec0Smillert ************************************************************************** */ 3092dd1ec0Smillert 3192dd1ec0Smillert #ifndef TTY_DISPLAY_H 3292dd1ec0Smillert #define TTY_DISPLAY_H 1 3392dd1ec0Smillert 34*81d8c4e1Snicm /* 35*81d8c4e1Snicm * $Id: tty_display.h,v 1.4 2010/01/12 23:22:07 nicm Exp $ 36*81d8c4e1Snicm */ 3784af20ceSmillert extern NCURSES_EXPORT(bool) _nc_tty_beep (void); 3884af20ceSmillert extern NCURSES_EXPORT(bool) _nc_tty_check_resize (void); 3984af20ceSmillert extern NCURSES_EXPORT(bool) _nc_tty_cursor (int); 4084af20ceSmillert extern NCURSES_EXPORT(bool) _nc_tty_flash (void); 4184af20ceSmillert extern NCURSES_EXPORT(bool) _nc_tty_init_color (int,int,int,int); 4284af20ceSmillert extern NCURSES_EXPORT(bool) _nc_tty_init_pair (int,int,int); 4384af20ceSmillert extern NCURSES_EXPORT(bool) _nc_tty_slk_hide (bool); 4484af20ceSmillert extern NCURSES_EXPORT(bool) _nc_tty_slk_update (int,const char *); 4584af20ceSmillert extern NCURSES_EXPORT(bool) _nc_tty_start_color (void); 4684af20ceSmillert extern NCURSES_EXPORT(void) _nc_tty_display_resume (void); 4784af20ceSmillert extern NCURSES_EXPORT(void) _nc_tty_display_suspend (void); 4884af20ceSmillert extern NCURSES_EXPORT(void) _nc_tty_dispose (void); /* frees SP->_term */ 4984af20ceSmillert extern NCURSES_EXPORT(void) _nc_tty_switch_to (void); 5084af20ceSmillert extern NCURSES_EXPORT(void) _nc_tty_update (void); 5192dd1ec0Smillert 5292dd1ec0Smillert struct tty_display_data { 5392dd1ec0Smillert int _fifohold; /* set if breakout marked */ 5492dd1ec0Smillert unsigned long _current_attr; /* terminal attribute current set */ 5592dd1ec0Smillert int _cursrow; /* physical cursor row (-1=unknown) */ 5692dd1ec0Smillert int _curscol; /* physical cursor column */ 5792dd1ec0Smillert 5892dd1ec0Smillert /* cursor movement costs; units are 10ths of milliseconds */ 5992dd1ec0Smillert int _char_padding; /* cost of character put */ 6092dd1ec0Smillert int _cr_cost; /* cost of (carriage_return) */ 6192dd1ec0Smillert int _cup_cost; /* cost of (cursor_address) */ 6292dd1ec0Smillert int _home_cost; /* cost of (cursor_home) */ 6392dd1ec0Smillert int _ll_cost; /* cost of (cursor_to_ll) */ 6492dd1ec0Smillert #if USE_HARD_TABS 6592dd1ec0Smillert int _ht_cost; /* cost of (tab) */ 6692dd1ec0Smillert int _cbt_cost; /* cost of (backtab) */ 6792dd1ec0Smillert #endif /* USE_HARD_TABS */ 6892dd1ec0Smillert int _cub1_cost; /* cost of (cursor_left) */ 6992dd1ec0Smillert int _cuf1_cost; /* cost of (cursor_right) */ 7092dd1ec0Smillert int _cud1_cost; /* cost of (cursor_down) */ 7192dd1ec0Smillert int _cuu1_cost; /* cost of (cursor_up) */ 7292dd1ec0Smillert int _cub_cost; /* cost of (parm_cursor_left) */ 7392dd1ec0Smillert int _cuf_cost; /* cost of (parm_cursor_right) */ 7492dd1ec0Smillert int _cud_cost; /* cost of (parm_cursor_down) */ 7592dd1ec0Smillert int _cuu_cost; /* cost of (parm_cursor_up) */ 7692dd1ec0Smillert int _hpa_cost; /* cost of (column_address) */ 7792dd1ec0Smillert int _vpa_cost; /* cost of (row_address) */ 7892dd1ec0Smillert /* used in lib_doupdate.c, must be chars */ 7992dd1ec0Smillert int _ed_cost; /* cost of (clr_eos) */ 8092dd1ec0Smillert int _el_cost; /* cost of (clr_eol) */ 8192dd1ec0Smillert int _el1_cost; /* cost of (clr_bol) */ 8292dd1ec0Smillert int _dch1_cost; /* cost of (delete_character) */ 8392dd1ec0Smillert int _ich1_cost; /* cost of (insert_character) */ 8492dd1ec0Smillert int _dch_cost; /* cost of (parm_dch) */ 8592dd1ec0Smillert int _ich_cost; /* cost of (parm_ich) */ 8692dd1ec0Smillert int _ech_cost; /* cost of (erase_chars) */ 8792dd1ec0Smillert int _rep_cost; /* cost of (repeat_char) */ 8892dd1ec0Smillert int _hpa_ch_cost; /* cost of (column_address) */ 8992dd1ec0Smillert int _cup_ch_cost; /* cost of (cursor_address) */ 9092dd1ec0Smillert int _smir_cost; /* cost of (enter_insert_mode) */ 9192dd1ec0Smillert int _rmir_cost; /* cost of (exit_insert_mode) */ 9292dd1ec0Smillert int _ip_cost; /* cost of (insert_padding) */ 9392dd1ec0Smillert /* used in lib_mvcur.c */ 9492dd1ec0Smillert char * _address_cursor; 9592dd1ec0Smillert int _carriage_return_length; 9692dd1ec0Smillert int _cursor_home_length; 9792dd1ec0Smillert int _cursor_to_ll_length; 9892dd1ec0Smillert 9992dd1ec0Smillert chtype _xmc_suppress; /* attributes to suppress if xmc */ 10092dd1ec0Smillert chtype _xmc_triggers; /* attributes to process if xmc */ 10192dd1ec0Smillert 10292dd1ec0Smillert bool _sig_winch; 10392dd1ec0Smillert }; 10492dd1ec0Smillert 10592dd1ec0Smillert 10692dd1ec0Smillert #define DelCharCost(count) \ 10792dd1ec0Smillert ((parm_dch != 0) \ 10892dd1ec0Smillert ? D->_dch_cost \ 10992dd1ec0Smillert : ((delete_character != 0) \ 11092dd1ec0Smillert ? (D->_dch1_cost * count) \ 11192dd1ec0Smillert : INFINITY)) 11292dd1ec0Smillert 11392dd1ec0Smillert #define InsCharCost(count) \ 11492dd1ec0Smillert ((parm_ich != 0) \ 11592dd1ec0Smillert ? D->_ich_cost \ 11692dd1ec0Smillert : ((enter_insert_mode && exit_insert_mode) \ 11792dd1ec0Smillert ? D->_smir_cost + D->_rmir_cost + (D->_ip_cost * count) \ 11892dd1ec0Smillert : ((insert_character != 0) \ 119*81d8c4e1Snicm ? ((D->_ich1_cost + D->_ip_cost) * count) \ 12092dd1ec0Smillert : INFINITY))) 12192dd1ec0Smillert 12292dd1ec0Smillert #if USE_XMC_SUPPORT 123*81d8c4e1Snicm #define UpdateAttrs(c) if (!SameAttrOf(D->_current_attr, AttrOf(c))) { \ 12492dd1ec0Smillert attr_t chg = D->_current_attr; \ 12592dd1ec0Smillert vidattr(AttrOf(c)); \ 12692dd1ec0Smillert if (magic_cookie_glitch > 0 \ 12792dd1ec0Smillert && XMC_CHANGES((chg ^ D->_current_attr))) { \ 12892dd1ec0Smillert T(("%s @%d before glitch %d,%d", \ 12992dd1ec0Smillert __FILE__, __LINE__, \ 13092dd1ec0Smillert D->_cursrow, \ 13192dd1ec0Smillert D->_curscol)); \ 13292dd1ec0Smillert _nc_do_xmc_glitch(chg); \ 13392dd1ec0Smillert } \ 13492dd1ec0Smillert } 13592dd1ec0Smillert #else 136*81d8c4e1Snicm #define UpdateAttrs(c) if (!SameAttrOf(D->_current_attr, AttrOf(c))) \ 13792dd1ec0Smillert vidattr(AttrOf(c)); 13892dd1ec0Smillert #endif 13992dd1ec0Smillert 14092dd1ec0Smillert #define XMC_CHANGES(c) ((c) & D->_xmc_suppress) 14192dd1ec0Smillert 14292dd1ec0Smillert #endif /* TTY_DISPLAY_H */ 143