static int tm_init( int install ) /*******************************/ { const char *term; MouseInstalled = false; MouseType = M_NONE; if( install == 0 ) return( false ); term = GetTermType(); if( strcmp( term, "xterm" ) == 0 ) { DoMouseInit( M_XT, XT_INIT, ANSI_HDR "M" ); return( true ); } if( strstr( term, "qnx" ) != 0 ) { uiwritec( QNX_HDR QW_TEST ); TrieAdd( EV_MOUSE_PRESS, QNX_HDR QW_TEST_RESPONSE ); return( true ); } uiwritec( ANSI_HDR QW_TEST ); TrieAdd( EV_MOUSE_PRESS, ANSI_HDR QW_TEST_RESPONSE ); return( true ); }
static void tix_error( const char *str ) /**************************************/ { const char *term; term = GetTermType(); uiwritec( "\nError in " ); uiwrite( term ); uiwritec( ": " ); uiwrite( str ); uiwritec( "\n" ); }
static int tm_fini( void ) /************************/ { switch( MouseType ) { case M_QW: uiwritec( QNX_HDR QW_FINI ); break; case M_AW: uiwritec( ANSI_HDR QW_FINI ); break; case M_XT: uiwritec( XT_FINI ); break; } return( 0 ); }
static int tm_fini( void ) /************************/ { switch( MouseType ) { case M_XT: uiwritec( XT_FINI ); break; #ifdef __LINUX__ case M_GPM: close( UIMouseHandle ); break; #endif default : break; } return 0; }
int ti_read_tix( const char *termname ) /*************************************/ { int i; int ret; const char *s; int utf8_mode = 0; memset( _ti_alt_map, 0, sizeof( _ti_alt_map ) ); for( i = 0; i < sizeof( ti_char_map ) / sizeof( ti_char_map[0] ); i++ ) ti_char_map[i][0] = i; if( !init_tix_scanner( termname ) ) { ret = do_default(); } else { ret = do_parse(); close_tix_scanner(); } if( ( (s = getenv( "LC_ALL" )) != NULL && *s != '\0' ) || ( (s = getenv( "LC_CTYPE" )) != NULL && *s != '\0' ) || ( (s = getenv( "LANG" )) != NULL && *s != '\0' ) ) { if( strstr( s, "UTF" ) || strstr( s, "utf" ) ) { utf8_mode = 1; } } if( utf8_mode ) { /* handle at least iso-8859-1 for now */ for( i = 0xa0; i < 0x100; i++ ) { wctomb( ti_char_map[i], i ); } } #if 0 /* do not play woth utf8 mode setting: all VT are already configured as needed. With this code on there is a problem with line drawing on the linux console (framebuffer mode) */ if( strncmp( termname, "linux", 5 ) == 0 ) { /* force UTF-8 mode if the locale is set that way; * * we may be on a new VT on the Linux console */ if ( utf8_mode ) { uiwritec( "\033%G" ); /* use UTF-8 characters instead of ACS */ for( i = 0; i < sizeof( default_tix ) / sizeof( default_tix[0] ); i++ ) { wctomb( ti_char_map[i], default_tix[i].unicode ); } } else { uiwritec( "\033%@" ); } } #endif if( strncmp( termname, "xterm", 5 ) == 0 ) { /* special xterm keys available in recent xterms */ TrieAdd( EV_CTRL_CURSOR_UP, "\033[1;5A" ); TrieAdd( EV_CTRL_CURSOR_DOWN, "\033[1;5B" ); TrieAdd( EV_CTRL_CURSOR_RIGHT, "\033[1;5C" ); TrieAdd( EV_CTRL_CURSOR_LEFT, "\033[1;5D" ); TrieAdd( EV_CTRL_HOME, "\033[1;5H" ); TrieAdd( EV_CTRL_END, "\033[1;5F" ); TrieAdd( EV_CTRL_PAGE_UP, "\033[5;5~" ); TrieAdd( EV_CTRL_PAGE_DOWN, "\033[6;5~" ); /* slightly older xterms report these sequences... */ TrieAdd( EV_CTRL_CURSOR_UP, "\033[O5A" ); TrieAdd( EV_CTRL_CURSOR_DOWN, "\033[O5B" ); TrieAdd( EV_CTRL_CURSOR_RIGHT, "\033[O5C" ); TrieAdd( EV_CTRL_CURSOR_LEFT, "\033[O5D" ); TrieAdd( EV_CTRL_HOME, "\033[O5H" ); TrieAdd( EV_CTRL_END, "\033[O5F" ); /* Red Hat 8 xterm has yet different sequences. Does * not differentiate between Home/End and Ctrl + Home/End, * but does for PgUp/PgDn (same codes as newer xterms above) */ TrieAdd( EV_CTRL_CURSOR_UP, "\033O5A" ); TrieAdd( EV_CTRL_CURSOR_DOWN, "\033O5B" ); TrieAdd( EV_CTRL_CURSOR_RIGHT, "\033O5C" ); TrieAdd( EV_CTRL_CURSOR_LEFT, "\033O5D" ); } return( ret ); }