Terminal detection for newer vte libraries (>= 0.53.0)
This commit is contained in:
parent
ef21076bbd
commit
b854224eb5
|
@ -1,3 +1,6 @@
|
||||||
|
2018-10-09 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Terminal detection for newer vte libraries (>= 0.53.0)
|
||||||
|
|
||||||
2018-10-08 Markus Gans <guru.mail@muenster.de>
|
2018-10-08 Markus Gans <guru.mail@muenster.de>
|
||||||
* Move all termcap code into FTermcap
|
* Move all termcap code into FTermcap
|
||||||
* Some small code splits
|
* Some small code splits
|
||||||
|
|
|
@ -750,7 +750,12 @@ char* FTermDetection::secDA_Analysis (char current_termtype[])
|
||||||
case 41: // DEC VT420
|
case 41: // DEC VT420
|
||||||
case 61: // DEC VT510
|
case 61: // DEC VT510
|
||||||
case 64: // DEC VT520
|
case 64: // DEC VT520
|
||||||
|
break;
|
||||||
|
|
||||||
case 65: // DEC VT525
|
case 65: // DEC VT525
|
||||||
|
new_termtype = secDA_Analysis_65(current_termtype);
|
||||||
|
break;
|
||||||
|
|
||||||
case 67: // Cygwin
|
case 67: // Cygwin
|
||||||
new_termtype = secDA_Analysis_67(current_termtype);
|
new_termtype = secDA_Analysis_67(current_termtype);
|
||||||
break;
|
break;
|
||||||
|
@ -780,7 +785,9 @@ char* FTermDetection::secDA_Analysis (char current_termtype[])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Correct false assumptions
|
// Correct false assumptions
|
||||||
if ( isGnomeTerminal() && secondary_da.terminal_id_type != 1 )
|
if ( isGnomeTerminal()
|
||||||
|
&& secondary_da.terminal_id_type != 1
|
||||||
|
&& secondary_da.terminal_id_type != 65 )
|
||||||
terminal_type.gnome_terminal = false;
|
terminal_type.gnome_terminal = false;
|
||||||
|
|
||||||
if ( isKdeTerminal() && secondary_da.terminal_id_type != 0 )
|
if ( isKdeTerminal() && secondary_da.terminal_id_type != 0 )
|
||||||
|
@ -815,20 +822,7 @@ inline char* FTermDetection::secDA_Analysis_1 (char current_termtype[])
|
||||||
// Terminal ID 1 - DEC VT220
|
// Terminal ID 1 - DEC VT220
|
||||||
|
|
||||||
char* new_termtype = current_termtype;
|
char* new_termtype = current_termtype;
|
||||||
|
new_termtype = secDA_Analysis_vte(new_termtype);
|
||||||
if ( secondary_da.terminal_id_version > 1000 )
|
|
||||||
{
|
|
||||||
terminal_type.gnome_terminal = true;
|
|
||||||
// Each gnome-terminal should be able to use 256 colors
|
|
||||||
color256 = true;
|
|
||||||
new_termtype = C_STR("gnome-256color");
|
|
||||||
gnome_terminal_id = secondary_da.terminal_id_version;
|
|
||||||
|
|
||||||
// VTE 0.40.0 or higher and gnome-terminal 3.16 or higher
|
|
||||||
if ( gnome_terminal_id >= 4000 )
|
|
||||||
decscusr_support = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new_termtype;
|
return new_termtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -870,6 +864,16 @@ inline char* FTermDetection::secDA_Analysis_32 (char[])
|
||||||
return new_termtype;
|
return new_termtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline char* FTermDetection::secDA_Analysis_65 (char current_termtype[])
|
||||||
|
{
|
||||||
|
// Terminal ID 65 - DEC VT525
|
||||||
|
|
||||||
|
char* new_termtype = current_termtype;
|
||||||
|
new_termtype = secDA_Analysis_vte(new_termtype);
|
||||||
|
return new_termtype;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline char* FTermDetection::secDA_Analysis_67 (char[])
|
inline char* FTermDetection::secDA_Analysis_67 (char[])
|
||||||
{
|
{
|
||||||
|
@ -955,4 +959,28 @@ inline char* FTermDetection::secDA_Analysis_85 (char current_termtype[])
|
||||||
return new_termtype;
|
return new_termtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline char* FTermDetection::secDA_Analysis_vte (char current_termtype[])
|
||||||
|
{
|
||||||
|
// VTE terminal library
|
||||||
|
// (Since VTE ) the terminal ID has changed from 1 to 65)
|
||||||
|
|
||||||
|
char* new_termtype = current_termtype;
|
||||||
|
|
||||||
|
if ( secondary_da.terminal_id_version > 1000 )
|
||||||
|
{
|
||||||
|
terminal_type.gnome_terminal = true;
|
||||||
|
// Each gnome-terminal should be able to use 256 colors
|
||||||
|
color256 = true;
|
||||||
|
new_termtype = C_STR("gnome-256color");
|
||||||
|
gnome_terminal_id = secondary_da.terminal_id_version;
|
||||||
|
|
||||||
|
// VTE 0.40.0 or higher and gnome-terminal 3.16 or higher
|
||||||
|
if ( gnome_terminal_id >= 4000 )
|
||||||
|
decscusr_support = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new_termtype;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -190,12 +190,14 @@ class FTermDetection
|
||||||
static char* secDA_Analysis_1 (char[]);
|
static char* secDA_Analysis_1 (char[]);
|
||||||
static char* secDA_Analysis_24 (char[]);
|
static char* secDA_Analysis_24 (char[]);
|
||||||
static char* secDA_Analysis_32 (char[]);
|
static char* secDA_Analysis_32 (char[]);
|
||||||
|
static char* secDA_Analysis_65 (char[]);
|
||||||
static char* secDA_Analysis_67 (char[]);
|
static char* secDA_Analysis_67 (char[]);
|
||||||
static char* secDA_Analysis_77 (char[]);
|
static char* secDA_Analysis_77 (char[]);
|
||||||
static char* secDA_Analysis_82 (char[]);
|
static char* secDA_Analysis_82 (char[]);
|
||||||
static char* secDA_Analysis_83 (char[]);
|
static char* secDA_Analysis_83 (char[]);
|
||||||
static char* secDA_Analysis_84 (char[]);
|
static char* secDA_Analysis_84 (char[]);
|
||||||
static char* secDA_Analysis_85 (char[]);
|
static char* secDA_Analysis_85 (char[]);
|
||||||
|
static char* secDA_Analysis_vte (char[]);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static char termtype[256];
|
static char termtype[256];
|
||||||
|
|
|
@ -332,6 +332,7 @@ class FTermDetectionTest : public CPPUNIT_NS::TestFixture
|
||||||
putty,
|
putty,
|
||||||
kde_konsole,
|
kde_konsole,
|
||||||
gnome_terminal,
|
gnome_terminal,
|
||||||
|
newer_vte_terminal,
|
||||||
kterm,
|
kterm,
|
||||||
tera_term,
|
tera_term,
|
||||||
cygwin,
|
cygwin,
|
||||||
|
@ -358,6 +359,7 @@ class FTermDetectionTest : public CPPUNIT_NS::TestFixture
|
||||||
void puttyTest();
|
void puttyTest();
|
||||||
void kdeKonsoleTest();
|
void kdeKonsoleTest();
|
||||||
void gnomeTerminalTest();
|
void gnomeTerminalTest();
|
||||||
|
void newerVteTerminalTest();
|
||||||
void ktermTest();
|
void ktermTest();
|
||||||
void teraTermTest();
|
void teraTermTest();
|
||||||
void cygwinTest();
|
void cygwinTest();
|
||||||
|
@ -402,6 +404,7 @@ class FTermDetectionTest : public CPPUNIT_NS::TestFixture
|
||||||
CPPUNIT_TEST (puttyTest);
|
CPPUNIT_TEST (puttyTest);
|
||||||
CPPUNIT_TEST (kdeKonsoleTest);
|
CPPUNIT_TEST (kdeKonsoleTest);
|
||||||
CPPUNIT_TEST (gnomeTerminalTest);
|
CPPUNIT_TEST (gnomeTerminalTest);
|
||||||
|
CPPUNIT_TEST (newerVteTerminalTest);
|
||||||
CPPUNIT_TEST (ktermTest);
|
CPPUNIT_TEST (ktermTest);
|
||||||
CPPUNIT_TEST (teraTermTest);
|
CPPUNIT_TEST (teraTermTest);
|
||||||
CPPUNIT_TEST (cygwinTest);
|
CPPUNIT_TEST (cygwinTest);
|
||||||
|
@ -987,6 +990,69 @@ void FTermDetectionTest::gnomeTerminalTest()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FTermDetectionTest::newerVteTerminalTest()
|
||||||
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
|
finalcut::FTermDetection detect;
|
||||||
|
data.setTermFileName(C_STR("xterm-256color"));
|
||||||
|
detect.setTermData(&data);
|
||||||
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
|
pid_t pid = forkProcess();
|
||||||
|
|
||||||
|
if ( isChildProcess(pid) )
|
||||||
|
{
|
||||||
|
setenv ("TERM", "xterm-256color", 1);
|
||||||
|
setenv ("COLORTERM", "truecolor", 1);
|
||||||
|
setenv ("VTE_VERSION", "5300", 1);
|
||||||
|
unsetenv("COLORFGBG");
|
||||||
|
unsetenv("TERMCAP");
|
||||||
|
unsetenv("XTERM_VERSION");
|
||||||
|
unsetenv("ROXTERM_ID");
|
||||||
|
unsetenv("KONSOLE_DBUS_SESSION");
|
||||||
|
unsetenv("KONSOLE_DCOP");
|
||||||
|
unsetenv("TMUX");
|
||||||
|
|
||||||
|
detect.detect();
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT ( detect.isXTerminal() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
|
||||||
|
CPPUNIT_ASSERT ( detect.isGnomeTerminal() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isLinuxTerm() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isNetBSDTerm() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isOpenBSDTerm() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
|
||||||
|
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
|
||||||
|
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
|
||||||
|
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
|
||||||
|
CPPUNIT_ASSERT ( detect.hasSetCursorStyleSupport() );
|
||||||
|
|
||||||
|
debugOutput();
|
||||||
|
closeStandardStreams();
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
else // Parent
|
||||||
|
{
|
||||||
|
// Start the terminal simulation
|
||||||
|
terminalSimulation (newer_vte_terminal);
|
||||||
|
|
||||||
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
||||||
|
std::cerr << "waitpid error" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::ktermTest()
|
void FTermDetectionTest::ktermTest()
|
||||||
{
|
{
|
||||||
|
@ -1846,6 +1912,7 @@ char* FTermDetectionTest::getAnswerback (console con)
|
||||||
C_STR("PuTTY"), // PuTTY
|
C_STR("PuTTY"), // PuTTY
|
||||||
0, // KDE Konsole
|
0, // KDE Konsole
|
||||||
0, // GNOME Terminal
|
0, // GNOME Terminal
|
||||||
|
0, // VTE Terminal >= 0.53.0
|
||||||
0, // kterm,
|
0, // kterm,
|
||||||
0, // Tera Term
|
0, // Tera Term
|
||||||
0, // Cygwin
|
0, // Cygwin
|
||||||
|
@ -1875,6 +1942,7 @@ char* FTermDetectionTest::getDSR (console con)
|
||||||
C_STR("\033[0n"), // PuTTY
|
C_STR("\033[0n"), // PuTTY
|
||||||
C_STR("\033[0n"), // KDE Konsole
|
C_STR("\033[0n"), // KDE Konsole
|
||||||
C_STR("\033[0n"), // GNOME Terminal
|
C_STR("\033[0n"), // GNOME Terminal
|
||||||
|
C_STR("\033[0n"), // VTE Terminal >= 0.53.0
|
||||||
C_STR("\033[0n"), // kterm,
|
C_STR("\033[0n"), // kterm,
|
||||||
C_STR("\033[0n"), // Tera Term
|
C_STR("\033[0n"), // Tera Term
|
||||||
0, // Cygwin
|
0, // Cygwin
|
||||||
|
@ -1904,6 +1972,7 @@ char* FTermDetectionTest::getDECID (console con)
|
||||||
C_STR("\033[?6c"), // PuTTY
|
C_STR("\033[?6c"), // PuTTY
|
||||||
C_STR("\033[?1;2c"), // KDE Konsole
|
C_STR("\033[?1;2c"), // KDE Konsole
|
||||||
C_STR("\033[?62;c"), // GNOME Terminal
|
C_STR("\033[?62;c"), // GNOME Terminal
|
||||||
|
C_STR("\033[?65;1;9c"), // VTE Terminal >= 0.53.0
|
||||||
C_STR("\033[?1;2c"), // kterm,
|
C_STR("\033[?1;2c"), // kterm,
|
||||||
C_STR("\033[?1;2c"), // Tera Term
|
C_STR("\033[?1;2c"), // Tera Term
|
||||||
0, // Cygwin
|
0, // Cygwin
|
||||||
|
@ -1933,6 +2002,7 @@ char* FTermDetectionTest::getDA (console con)
|
||||||
C_STR("\033[?6c"), // PuTTY
|
C_STR("\033[?6c"), // PuTTY
|
||||||
C_STR("\033[?1;2c"), // KDE Konsole
|
C_STR("\033[?1;2c"), // KDE Konsole
|
||||||
C_STR("\033[?62;c"), // GNOME Terminal
|
C_STR("\033[?62;c"), // GNOME Terminal
|
||||||
|
C_STR("\033[?65;1;9c"), // VTE Terminal >= 0.53.0
|
||||||
C_STR("\033[?1;2c"), // kterm,
|
C_STR("\033[?1;2c"), // kterm,
|
||||||
C_STR("\033[?1;2c"), // Tera Term
|
C_STR("\033[?1;2c"), // Tera Term
|
||||||
C_STR("\033[?6c"), // Cygwin
|
C_STR("\033[?6c"), // Cygwin
|
||||||
|
@ -1962,6 +2032,7 @@ char* FTermDetectionTest::getDA1 (console con)
|
||||||
C_STR("\033[?6c"), // PuTTY
|
C_STR("\033[?6c"), // PuTTY
|
||||||
C_STR("\033[?1;2c"), // KDE Konsole
|
C_STR("\033[?1;2c"), // KDE Konsole
|
||||||
C_STR("\033[?62;c"), // GNOME Terminal
|
C_STR("\033[?62;c"), // GNOME Terminal
|
||||||
|
C_STR("\033[?65;1;9c"), // VTE Terminal >= 0.53.0
|
||||||
0, // kterm,
|
0, // kterm,
|
||||||
C_STR("\033[?1;2c"), // Tera Term
|
C_STR("\033[?1;2c"), // Tera Term
|
||||||
C_STR("\033[?6c"), // Cygwin
|
C_STR("\033[?6c"), // Cygwin
|
||||||
|
@ -1991,6 +2062,7 @@ char* FTermDetectionTest::getSEC_DA (console con)
|
||||||
C_STR("\033[>0;136;0c"), // PuTTY
|
C_STR("\033[>0;136;0c"), // PuTTY
|
||||||
C_STR("\033[>0;115;0c"), // KDE Konsole
|
C_STR("\033[>0;115;0c"), // KDE Konsole
|
||||||
C_STR("\033[>1;5202;0c"), // GNOME Terminal
|
C_STR("\033[>1;5202;0c"), // GNOME Terminal
|
||||||
|
C_STR("\033[>65;5300;1c"), // VTE Terminal >= 0.53.0
|
||||||
C_STR("\033[?1;2c"), // kterm,
|
C_STR("\033[?1;2c"), // kterm,
|
||||||
C_STR("\033[>32;278;0c"), // Tera Term
|
C_STR("\033[>32;278;0c"), // Tera Term
|
||||||
C_STR("\033[>67;200502;0c"), // Cygwin
|
C_STR("\033[>67;200502;0c"), // Cygwin
|
||||||
|
|
Loading…
Reference in New Issue