From e5902a6ee6a403fec1d8e835b57f2cfa612bd7c0 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Tue, 25 Feb 2020 23:42:31 +0100 Subject: [PATCH] New command line switch "--no-terminal-data-request" --- ChangeLog | 4 ++ src/fapplication.cpp | 82 +++++++++++++++++-------------- src/fstartoptions.cpp | 1 + src/fterm.cpp | 3 ++ src/include/final/fstartoptions.h | 26 +++++----- 5 files changed, 65 insertions(+), 51 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d8e8499..7919ed7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2020-02-25 Markus Gans + * New command line switch "--no-terminal-data-request" to disable + font and title determination + 2020-02-19 Markus Gans * Some small code improvements * SGRoptimizer improved diff --git a/src/fapplication.cpp b/src/fapplication.cpp index 3eabbbeb..0765114e 100644 --- a/src/fapplication.cpp +++ b/src/fapplication.cpp @@ -306,41 +306,43 @@ void FApplication::showParameterUsage() { std::cout \ << "Generic options:\n" - << " -h, --help " - << " Display this help and exit\n" + << " -h, --help " + << " Display this help and exit\n" << "\n" << "The Final Cut options:\n" - << " --encoding " - << " Sets the character encoding mode\n" - << " " - << " {utf8, vt100, pc, ascii}\n" - << " --no-mouse " - << " Disable mouse support\n" - << " --no-optimized-cursor " - << " Disable cursor optimization\n" - << " --no-terminal-detection" - << " Disable terminal detection\n" - << " --no-color-change " - << " Do not redefine the color palette\n" - << " --no-sgr-optimizer " - << " Do not optimize SGR sequences\n" - << " --vgafont " - << " Set the standard vga 8x16 font\n" - << " --newfont " - << " Enables the graphical font\n" + << " --encoding " + << " Sets the character encoding mode\n" + << " " + << " {utf8, vt100, pc, ascii}\n" + << " --no-mouse " + << " Disable mouse support\n" + << " --no-optimized-cursor " + << " Disable cursor optimization\n" + << " --no-terminal-detection " + << " Disable terminal detection\n" + << " --no-terminal-data-request" + << " Do not determine terminal font and title\n" + << " --no-color-change " + << " Do not redefine the color palette\n" + << " --no-sgr-optimizer " + << " Do not optimize SGR sequences\n" + << " --vgafont " + << " Set the standard vga 8x16 font\n" + << " --newfont " + << " Enables the graphical font\n" #if defined(__FreeBSD__) || defined(__DragonFly__) << "\n" << "FreeBSD console options:\n" - << " --no-esc-for-alt-meta " - << " Do not send a ESC prefix for the alt/meta key\n" - << " --no-cursorstyle-change" - << " Do not change the current cursor style\n" + << " --no-esc-for-alt-meta " + << " Do not send a ESC prefix for the alt/meta key\n" + << " --no-cursorstyle-change " + << " Do not change the current cursor style\n" #elif defined(__NetBSD__) || defined(__OpenBSD__) << "\n" << "NetBSD/OpenBSD console options:\n" - << " --no-esc-for-alt-meta " - << " Do not send a ESC prefix for the alt/meta key\n" + << " --no-esc-for-alt-meta " + << " Do not send a ESC prefix for the alt/meta key\n" #endif << std::endl; // newline character + flushes the output stream @@ -414,23 +416,24 @@ void FApplication::cmd_options (const int& argc, char* argv[]) { static struct option long_options[] = { - {C_STR("encoding"), required_argument, nullptr, 0 }, - {C_STR("no-mouse"), no_argument, nullptr, 0 }, - {C_STR("no-optimized-cursor"), no_argument, nullptr, 0 }, - {C_STR("no-terminal-detection"), no_argument, nullptr, 0 }, - {C_STR("no-color-change"), no_argument, nullptr, 0 }, - {C_STR("no-sgr-optimizer"), no_argument, nullptr, 0 }, - {C_STR("vgafont"), no_argument, nullptr, 0 }, - {C_STR("newfont"), no_argument, nullptr, 0 }, + {C_STR("encoding"), required_argument, nullptr, 0 }, + {C_STR("no-mouse"), no_argument, nullptr, 0 }, + {C_STR("no-optimized-cursor"), no_argument, nullptr, 0 }, + {C_STR("no-terminal-detection"), no_argument, nullptr, 0 }, + {C_STR("no-terminal-data-request"), no_argument, nullptr, 0 }, + {C_STR("no-color-change"), no_argument, nullptr, 0 }, + {C_STR("no-sgr-optimizer"), no_argument, nullptr, 0 }, + {C_STR("vgafont"), no_argument, nullptr, 0 }, + {C_STR("newfont"), no_argument, nullptr, 0 }, #if defined(__FreeBSD__) || defined(__DragonFly__) - {C_STR("no-esc-for-alt-meta"), no_argument, nullptr, 0 }, - {C_STR("no-cursorstyle-change"), no_argument, nullptr, 0 }, + {C_STR("no-esc-for-alt-meta"), no_argument, nullptr, 0 }, + {C_STR("no-cursorstyle-change"), no_argument, nullptr, 0 }, #elif defined(__NetBSD__) || defined(__OpenBSD__) - {C_STR("no-esc-for-alt-meta"), no_argument, nullptr, 0 }, + {C_STR("no-esc-for-alt-meta"), no_argument, nullptr, 0 }, #endif - {nullptr, 0, nullptr, 0 } + {nullptr, 0, nullptr, 0 } }; opterr = 0; @@ -471,6 +474,9 @@ void FApplication::cmd_options (const int& argc, char* argv[]) if ( std::strcmp(long_options[idx].name, "no-terminal-detection") == 0 ) getStartOptions().terminal_detection = false; + if ( std::strcmp(long_options[idx].name, "no-terminal-data-request") == 0 ) + getStartOptions().terminal_data_request = false; + if ( std::strcmp(long_options[idx].name, "no-color-change") == 0 ) getStartOptions().color_change = false; diff --git a/src/fstartoptions.cpp b/src/fstartoptions.cpp index b2d910ee..8034f1c2 100644 --- a/src/fstartoptions.cpp +++ b/src/fstartoptions.cpp @@ -38,6 +38,7 @@ FStartOptions::FStartOptions() : cursor_optimisation{true} , mouse_support{true} , terminal_detection{true} + , terminal_data_request{true} , color_change{true} , sgr_optimizer{true} , vgafont{false} diff --git a/src/fterm.cpp b/src/fterm.cpp index aa738bbf..4882eb36 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -1846,6 +1846,9 @@ void FTerm::init_captureFontAndTitle() { // Save the used xterm font and window title + if ( ! FStartOptions::getFStartOptions().terminal_data_request ) + return; + xterm->captureFontAndTitle(); const auto& font = xterm->getFont(); const auto& title = xterm->getTitle(); diff --git a/src/include/final/fstartoptions.h b/src/include/final/fstartoptions.h index 06bcf7d7..6647c75c 100644 --- a/src/include/final/fstartoptions.h +++ b/src/include/final/fstartoptions.h @@ -74,23 +74,23 @@ class FStartOptions final static void destroyObject(); // Data members - uInt8 cursor_optimisation : 1; - uInt8 mouse_support : 1; - uInt8 terminal_detection : 1; - uInt8 color_change : 1; - uInt8 sgr_optimizer : 1; - uInt8 vgafont : 1; - uInt8 newfont : 1; - uInt8 : 1; // padding bits + uInt8 cursor_optimisation : 1; + uInt8 mouse_support : 1; + uInt8 terminal_detection : 1; + uInt8 terminal_data_request : 1; + uInt8 color_change : 1; + uInt8 sgr_optimizer : 1; + uInt8 vgafont : 1; + uInt8 newfont : 1; fc::encoding encoding; #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST) - uInt8 meta_sends_escape : 1; - uInt8 change_cursorstyle : 1; - uInt8 : 6; // padding bits + uInt8 meta_sends_escape : 1; + uInt8 change_cursorstyle : 1; + uInt8 : 6; // padding bits #elif defined(__NetBSD__) || defined(__OpenBSD__) - uInt8 meta_sends_escape : 1; - uInt8 : 7; // padding bits + uInt8 meta_sends_escape : 1; + uInt8 : 7; // padding bits #endif static FStartOptions* start_options;