Some pointers were replaced by references

This commit is contained in:
Markus Gans 2021-05-07 23:17:23 +02:00
parent 07f6bda1ba
commit d12875682d
27 changed files with 961 additions and 958 deletions

View File

@ -1,3 +1,6 @@
2021-05-07 Markus Gans <guru.mail@muenster.de>
* Some pointers were replaced by references
2021-05-04 Markus Gans <guru.mail@muenster.de>
* Prevent flickering when resizing terminals or redrawing
the screen via ctrl-l

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2016-2020 Markus Gans *
* Copyright 2016-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -265,7 +265,7 @@ int main (int argc, char* argv[])
std::cout << "\r" << line << std::flush;
// Generation of a logger in a shared_ptr via a pointer
finalcut::FApplication::setLog(std::make_shared<DirectLogger>());
const finalcut::FOptiMove& opti_move = *finalcut::FTerm::getFOptiMove();
const auto& opti_move = finalcut::FTerm::getFOptiMove();
finalcut::printDurations(opti_move);
// Waiting for keypress

View File

@ -214,22 +214,22 @@ void tcapString (const std::string& name, const char cap_str[])
void debug (const finalcut::FApplication& TermApp)
{
const auto& fterm = TermApp.getFTerm();
const auto& debug_data = fterm.getFTermDebugData();
const finalcut::FString& ab_s = debug_data->getAnswerbackString();
const finalcut::FString& sec_da = debug_data->getSecDAString();
auto& debug_data = fterm.getFTermDebugData();
const auto& ab_s = debug_data.getAnswerbackString();
const auto& sec_da = debug_data.getSecDAString();
std::cout << "\n.------------------- debug -------------------\r\n";
#if defined(__linux__)
std::cout << "| Framebuffer bpp: "
<< debug_data->getFramebufferBpp() << "\r\n";
<< debug_data.getFramebufferBpp() << "\r\n";
#endif
std::cout << "| after init_256colorTerminal(): "
<< debug_data->getTermType_256color() << "\r\n";
<< debug_data.getTermType_256color() << "\r\n";
std::cout << "| after parseAnswerbackMsg(): "
<< debug_data->getTermType_Answerback() << "\r\n";
<< debug_data.getTermType_Answerback() << "\r\n";
std::cout << "| after parseSecDA(): "
<< debug_data->getTermType_SecDA() << "\r\n";
<< debug_data.getTermType_SecDA() << "\r\n";
if ( ! ab_s.isEmpty() )
tcapString ("| The answerback String", ab_s.c_str());

View File

@ -90,9 +90,9 @@ FApplication::FApplication (const int& arg_c, char* arg_v[])
if ( internal::var::app_object )
{
const auto& fterm_data = FTerm::getFTermData();
fterm_data->setExitMessage("FApplication: There should be "
"only one application object");
auto& fterm_data = FTerm::getFTermData();
fterm_data.setExitMessage("FApplication: There should be "
"only one application object");
FApplication::exit(EXIT_FAILURE);
return;
}
@ -339,9 +339,9 @@ void FApplication::setLogFile (const FString& filename)
}
else
{
const auto& fterm_data = FTerm::getFTermData();
fterm_data->setExitMessage ( "Could not open log file \""
+ filename + "\"" );
auto& fterm_data = FTerm::getFTermData();
fterm_data.setExitMessage ( "Could not open log file \""
+ filename + "\"" );
exit(EXIT_FAILURE);
}
}
@ -396,7 +396,7 @@ void FApplication::init()
time_last_event.tv_usec = 0;
// Initialize keyboard
const auto& keyboard = FTerm::getFKeyboard();
auto& keyboard = FTerm::getFKeyboard();
auto cmd1 = [this] () { this->keyPressed(); };
auto cmd2 = [this] () { this->keyReleased(); };
auto cmd3 = [this] () { this->escapeKeyPressed(); };
@ -405,22 +405,22 @@ void FApplication::init()
FKeyboardCommand key_cmd2 (cmd2);
FKeyboardCommand key_cmd3 (cmd3);
FKeyboardCommand key_cmd4 (cmd4);
keyboard->setPressCommand (key_cmd1);
keyboard->setReleaseCommand (key_cmd2);
keyboard->setEscPressedCommand (key_cmd3);
keyboard->setMouseTrackingCommand (key_cmd4);
keyboard.setPressCommand (key_cmd1);
keyboard.setReleaseCommand (key_cmd2);
keyboard.setEscPressedCommand (key_cmd3);
keyboard.setMouseTrackingCommand (key_cmd4);
// Set the keyboard keypress timeout
keyboard->setKeypressTimeout (key_timeout);
keyboard.setKeypressTimeout (key_timeout);
// Initialize mouse control
const auto& mouse = FTerm::getFMouseControl();
auto& mouse = FTerm::getFMouseControl();
auto cmd = [this] (const FMouseData& md) { this->mouseEvent(md); };
FMouseCommand mouse_cmd (cmd);
mouse->setEventCommand (mouse_cmd);
mouse.setEventCommand (mouse_cmd);
// Set stdin number for a gpm-mouse
mouse->setStdinNo (FTermios::getStdIn());
mouse.setStdinNo (FTermios::getStdIn());
// Set the default double click interval
mouse->setDblclickInterval (dblclick_interval);
mouse.setDblclickInterval (dblclick_interval);
// Initialize logging
if ( ! getStartOptions().logfile_stream.is_open() )
@ -444,10 +444,10 @@ void FApplication::setTerminalEncoding (const FString& enc_str)
showParameterUsage();
else
{
const auto& fterm_data = FTerm::getFTermData();
fterm_data->setExitMessage ( "Unknown encoding \"" + enc_str
+ "\"\n(Valid encodings are utf8, "
+ "vt100, pc and ascii)" );
auto& fterm_data = FTerm::getFTermData();
fterm_data.setExitMessage ( "Unknown encoding \"" + enc_str
+ "\"\n(Valid encodings are utf8, "
+ "vt100, pc and ascii)" );
exit(EXIT_FAILURE);
}
}
@ -658,13 +658,13 @@ inline void FApplication::findKeyboardWidget() const
//----------------------------------------------------------------------
inline bool FApplication::isKeyPressed() const
{
const auto& mouse = FTerm::getFMouseControl();
const auto& keyboard = FTerm::getFKeyboard();
auto& mouse = FTerm::getFMouseControl();
auto& keyboard = FTerm::getFKeyboard();
if ( mouse->isGpmMouseEnabled() )
return mouse->getGpmKeyPressed(keyboard->hasUnprocessedInput());
if ( mouse.isGpmMouseEnabled() )
return mouse.getGpmKeyPressed(keyboard.hasUnprocessedInput());
return (keyboard->isKeyPressed() || keyboard->hasPendingInput());
return (keyboard.isKeyPressed() || keyboard.hasPendingInput());
}
//----------------------------------------------------------------------
@ -694,9 +694,9 @@ void FApplication::mouseTracking() const
//----------------------------------------------------------------------
inline void FApplication::performKeyboardAction()
{
const auto& keyboard = FTerm::getFKeyboard();
auto& keyboard = FTerm::getFKeyboard();
if ( keyboard->getKey() == FKey::Ctrl_l ) // Ctrl-L (redraw the screen)
if ( keyboard.getKey() == FKey::Ctrl_l ) // Ctrl-L (redraw the screen)
{
redraw();
}
@ -713,25 +713,25 @@ inline void FApplication::performKeyboardAction()
//----------------------------------------------------------------------
inline void FApplication::performMouseAction() const
{
const auto& mouse = FTerm::getFMouseControl();
const auto& keyboard = FTerm::getFKeyboard();
const auto key = keyboard->getKey();
auto& buffer = keyboard->getKeyBuffer();
auto& mouse = FTerm::getFMouseControl();
auto& keyboard = FTerm::getFKeyboard();
const auto key = keyboard.getKey();
auto& buffer = keyboard.getKeyBuffer();
if ( key == FKey::X11mouse )
{
mouse->setRawData (FMouse::MouseType::X11, buffer);
mouse.setRawData (FMouse::MouseType::X11, buffer);
}
else if ( key == FKey::Extended_mouse )
{
mouse->setRawData (FMouse::MouseType::Sgr, buffer);
mouse.setRawData (FMouse::MouseType::Sgr, buffer);
}
else if ( key == FKey::Urxvt_mouse )
{
mouse->setRawData (FMouse::MouseType::Urxvt, buffer);
mouse.setRawData (FMouse::MouseType::Urxvt, buffer);
}
keyboard->hasUnprocessedInput() = mouse->hasUnprocessedInput();
keyboard.hasUnprocessedInput() = mouse.hasUnprocessedInput();
queuingMouseInput();
}
@ -761,8 +761,8 @@ inline void FApplication::sendEscapeKeyPressEvent() const
inline bool FApplication::sendKeyDownEvent (FWidget* widget) const
{
// Send key down event
const auto& keyboard = FTerm::getFKeyboard();
FKeyEvent k_down_ev (Event::KeyDown, keyboard->getKey());
auto& keyboard = FTerm::getFKeyboard();
FKeyEvent k_down_ev (Event::KeyDown, keyboard.getKey());
sendEvent (widget, &k_down_ev);
return k_down_ev.isAccepted();
}
@ -771,8 +771,8 @@ inline bool FApplication::sendKeyDownEvent (FWidget* widget) const
inline bool FApplication::sendKeyPressEvent (FWidget* widget) const
{
// Send key press event
const auto& keyboard = FTerm::getFKeyboard();
FKeyEvent k_press_ev (Event::KeyPress, keyboard->getKey());
auto& keyboard = FTerm::getFKeyboard();
FKeyEvent k_press_ev (Event::KeyPress, keyboard.getKey());
sendEvent (widget, &k_press_ev);
return k_press_ev.isAccepted();
}
@ -781,8 +781,8 @@ inline bool FApplication::sendKeyPressEvent (FWidget* widget) const
inline bool FApplication::sendKeyUpEvent (FWidget* widget) const
{
// Send key up event
const auto& keyboard = FTerm::getFKeyboard();
FKeyEvent k_up_ev (Event::KeyUp, keyboard->getKey());
auto& keyboard = FTerm::getFKeyboard();
FKeyEvent k_up_ev (Event::KeyUp, keyboard.getKey());
sendEvent (widget, &k_up_ev);
return k_up_ev.isAccepted();
}
@ -818,11 +818,11 @@ inline void FApplication::sendKeyboardAccelerator()
//----------------------------------------------------------------------
inline bool FApplication::hasDataInQueue() const
{
const auto& keyboard = FTerm::getFKeyboard();
const auto& mouse = FTerm::getFMouseControl();
auto& keyboard = FTerm::getFKeyboard();
auto& mouse = FTerm::getFMouseControl();
if ( keyboard->hasDataInQueue()
|| mouse->hasDataInQueue()
if ( keyboard.hasDataInQueue()
|| mouse.hasDataInQueue()
|| FTerm::hasChangedTermSize() )
return true;
@ -838,30 +838,30 @@ void FApplication::queuingKeyboardInput() const
return;
findKeyboardWidget();
const auto& keyboard = FTerm::getFKeyboard();
keyboard->escapeKeyHandling(); // special case: Esc key
keyboard->clearKeyBufferOnTimeout();
auto& keyboard = FTerm::getFKeyboard();
keyboard.escapeKeyHandling(); // special case: Esc key
keyboard.clearKeyBufferOnTimeout();
if ( isKeyPressed() )
keyboard->fetchKeyCode();
keyboard.fetchKeyCode();
}
//----------------------------------------------------------------------
void FApplication::queuingMouseInput() const
{
const auto& mouse = FTerm::getFMouseControl();
auto& mouse = FTerm::getFMouseControl();
if ( quit_now
|| internal::var::exit_loop
|| ! mouse->hasData()
|| ! mouse.hasData()
|| FTerm::hasChangedTermSize() )
return;
const auto& keyboard = FTerm::getFKeyboard();
struct timeval* time_keypressed = keyboard->getKeyPressedTime();
mouse->processEvent (time_keypressed);
keyboard->hasUnprocessedInput() = mouse->hasUnprocessedInput();
mouse->clearEvent();
auto& keyboard = FTerm::getFKeyboard();
struct timeval* time_keypressed = keyboard.getKeyPressedTime();
mouse.processEvent (time_keypressed);
keyboard.hasUnprocessedInput() = mouse.hasUnprocessedInput();
mouse.clearEvent();
}
//----------------------------------------------------------------------
@ -872,8 +872,8 @@ void FApplication::processKeyboardEvent() const
|| FTerm::hasChangedTermSize() )
return;
const auto& keyboard = FTerm::getFKeyboard();
keyboard->processQueuedInput();
auto& keyboard = FTerm::getFKeyboard();
keyboard.processQueuedInput();
}
//----------------------------------------------------------------------
@ -884,18 +884,18 @@ void FApplication::processMouseEvent() const
|| FTerm::hasChangedTermSize() )
return;
FTerm::getFMouseControl()->processQueuedInput();
FTerm::getFMouseControl().processQueuedInput();
}
//----------------------------------------------------------------------
bool FApplication::processDialogSwitchAccelerator() const
{
const auto& keyboard = FTerm::getFKeyboard();
auto& keyboard = FTerm::getFKeyboard();
if ( keyboard->getKey() >= FKey::Meta_1
&& keyboard->getKey() <= FKey::Meta_9 )
if ( keyboard.getKey() >= FKey::Meta_1
&& keyboard.getKey() <= FKey::Meta_9 )
{
const FKey key = keyboard->getKey();
const FKey key = keyboard.getKey();
const auto n = std::size_t(key - FKey::Meta_0);
const std::size_t s = getDialogList()->size();
@ -928,7 +928,7 @@ bool FApplication::processAccelerator (const FWidget& widget) const
for (auto&& item : widget.getAcceleratorList())
{
if ( item.key == FTerm::getFKeyboard()->getKey() )
if ( item.key == FTerm::getFKeyboard().getKey() )
{
// unset the move/size mode
auto move_size = getMoveSizeWidget();
@ -1258,9 +1258,9 @@ void FApplication::processResizeEvent() const
return;
FTerm::detectTermSize(); // Detect and save the current terminal size
const auto& mouse = FTerm::getFMouseControl();
mouse->setMaxWidth (uInt16(getDesktopWidth()));
mouse->setMaxHeight (uInt16(getDesktopHeight()));
auto& mouse = FTerm::getFMouseControl();
mouse.setMaxWidth (uInt16(getDesktopWidth()));
mouse.setMaxHeight (uInt16(getDesktopHeight()));
FResizeEvent r_ev(Event::Resize);
sendEvent(internal::var::app_object, &r_ev);

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2019-2020 Markus Gans *
* Copyright 2019-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -611,9 +611,9 @@ void FComboBox::cb_closeComboBox()
//----------------------------------------------------------------------
void FComboBox::cb_inputFieldSwitch()
{
const auto& mouse = FTerm::getFMouseControl();
auto& mouse = FTerm::getFMouseControl();
if ( mouse && ! mouse->isLeftButtonPressed() )
if ( ! mouse.isLeftButtonPressed() )
return;
if ( list_window.isShown() )
@ -630,14 +630,14 @@ void FComboBox::cb_inputFieldSwitch()
//----------------------------------------------------------------------
void FComboBox::cb_inputFieldHandOver()
{
const auto& mouse = FTerm::getFMouseControl();
auto& mouse = FTerm::getFMouseControl();
if ( ! mouse || list_window.isHidden() )
if ( list_window.isHidden() )
return;
const auto& t = mouse->getPos();
const auto& t = mouse.getPos();
const auto& p = list_window.list.termToWidgetPos(t);
const auto b = ( mouse->isLeftButtonPressed() ) ? MouseButton::Left : MouseButton::None;
const auto b = ( mouse.isLeftButtonPressed() ) ? MouseButton::Left : MouseButton::None;
const auto& _ev = \
std::make_shared<FMouseEvent>(Event::MouseMove, p, t, b);
setClickedWidget(&list_window.list);

View File

@ -100,7 +100,7 @@ bool FDialog::setModal (bool enable)
if ( enable )
{
setModalDialogCounter()++;
FTerm::getFKeyboard()->clearKeyBuffer();
FTerm::getFKeyboard().clearKeyBuffer();
}
else
setModalDialogCounter()--;

View File

@ -537,8 +537,8 @@ FKey FKeyboard::keyCorrection (const FKey& keycode) const
#if defined(__linux__)
if ( FTerm::isLinuxTerm() )
{
const auto& linux_console = FTerm::getFTermLinux();
key_correction = linux_console->modifierKeyCorrection(keycode);
auto& linux_console = FTerm::getFTermLinux();
key_correction = linux_console.modifierKeyCorrection(keycode);
}
else
key_correction = keycode;

View File

@ -57,7 +57,7 @@ FStartOptions::FStartOptions()
FStartOptions& FStartOptions::getFStartOptions()
{
static const auto& start_options = make_unique<FStartOptions>();
return *start_options.get();
return *start_options;
}
//----------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -246,18 +246,18 @@ void FTermcap::init()
//----------------------------------------------------------------------
void FTermcap::termcap()
{
const auto& fterm_data = FTerm::getFTermData();
std::vector<std::string> terminals{};
static constexpr int success = 1;
static constexpr int uninitialized = -2;
static char term_buffer[BUF_SIZE]{};
std::vector<std::string> terminals{};
int status = uninitialized;
const auto& term_detection = FTerm::getFTermDetection();
const bool color256 = term_detection->canDisplay256Colors();
baudrate = int(FTerm::getFTermData()->getBaudrate());
auto& fterm_data = FTerm::getFTermData();
auto& term_detection = FTerm::getFTermDetection();
const bool color256 = term_detection.canDisplay256Colors();
baudrate = int(fterm_data.getBaudrate());
// Open termcap file
const auto& termtype = fterm_data->getTermType();
const auto& termtype = fterm_data.getTermType();
terminals.emplace_back(termtype); // available terminal type
if ( color256 ) // 1st fallback if not found
@ -270,7 +270,7 @@ void FTermcap::termcap()
while ( iter != terminals.end() )
{
fterm_data->setTermType(*iter);
fterm_data.setTermType(*iter);
// Open the termcap file + load entry for termtype
#if defined(__sun) && defined(__SVR4)
@ -282,7 +282,7 @@ void FTermcap::termcap()
if ( status == success )
initialized = true;
if ( status == success || ! term_detection->hasTerminalDetection() )
if ( status == success || ! term_detection.hasTerminalDetection() )
break;
++iter;
@ -301,8 +301,8 @@ void FTermcap::termcapError (int status)
if ( status == no_entry || status == uninitialized )
{
const auto& fterm_data = FTerm::getFTermData();
const auto& termtype = fterm_data->getTermType();
auto& fterm_data = FTerm::getFTermData();
const auto& termtype = fterm_data.getTermType();
std::clog << FLog::LogLevel::Error
<< "Unknown terminal: \"" << termtype << "\". "
<< "Check the TERM environment variable. "
@ -377,7 +377,7 @@ void FTermcap::termcapNumerics()
{
// Get termcap numerics
const auto& fterm_data = FTerm::getFTermData();
auto& fterm_data = FTerm::getFTermData();
// Maximum number of colors on screen
max_color = std::max(max_color, getNumber("Co"));
@ -386,9 +386,9 @@ void FTermcap::termcapNumerics()
max_color = 1;
if ( max_color < 8 )
fterm_data->setMonochron(true);
fterm_data.setMonochron(true);
else
fterm_data->setMonochron(false);
fterm_data.setMonochron(false);
// Get initial spacing for hardware tab stop
tabstop = getNumber("it");

View File

@ -42,53 +42,53 @@ namespace finalcut
//----------------------------------------------------------------------
void FTermcapQuirks::terminalFixup()
{
const auto& td = FTerm::getFTermDetection();
auto& td = FTerm::getFTermDetection();
if ( td->isCygwinTerminal() )
if ( td.isCygwinTerminal() )
{
cygwin();
}
else if ( td->isLinuxTerm() )
else if ( td.isLinuxTerm() )
{
linux();
}
else if ( td->isRxvtTerminal() )
else if ( td.isRxvtTerminal() )
{
rxvt();
}
else if ( td->isGnomeTerminal() )
else if ( td.isGnomeTerminal() )
{
vte();
}
else if ( td->isKittyTerminal() )
else if ( td.isKittyTerminal() )
{
kitty();
}
else if ( td->isTeraTerm() )
else if ( td.isTeraTerm() )
{
teraterm();
}
else if ( td->isSunTerminal() )
else if ( td.isSunTerminal() )
{
sunConsole();
}
else if ( td->isPuttyTerminal() )
else if ( td.isPuttyTerminal() )
{
putty();
}
else if ( td->isScreenTerm() )
else if ( td.isScreenTerm() )
{
screen();
}
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
else if ( td->isFreeBSDTerm() )
else if ( td.isFreeBSDTerm() )
{
freebsd();
}
#endif // defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
// xterm and compatible terminals
if ( td->isXTerminal() && ! td->isPuttyTerminal() )
if ( td.isXTerminal() && ! td.isPuttyTerminal() )
xterm();
// Fixes general quirks
@ -228,9 +228,9 @@ void FTermcapQuirks::xterm()
void FTermcapQuirks::rxvt()
{
// Set enter/exit alternative charset mode for rxvt terminal
const auto& fterm_data = FTerm::getFTermData();
const auto& termtype = fterm_data->getTermType();
const auto& term_detection = FTerm::getFTermDetection();
auto& fterm_data = FTerm::getFTermData();
const auto& termtype = fterm_data.getTermType();
auto& term_detection = FTerm::getFTermDetection();
if ( termtype.substr(0,12) == "rxvt-16color" )
{
@ -239,7 +239,7 @@ void FTermcapQuirks::rxvt()
}
// Set ansi foreground and background color
if ( ! term_detection->isUrxvtTerminal() )
if ( ! term_detection.isUrxvtTerminal() )
{
TCAP(t_set_a_foreground) = \
CSI "%?%p1%{8}%<%t%p1%{30}%+%e%p1%'R'%+%;%dm";
@ -251,7 +251,7 @@ void FTermcapQuirks::rxvt()
//----------------------------------------------------------------------
void FTermcapQuirks::vte()
{
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
// gnome-terminal has NC=16 however, it can use the dim attribute
FTermcap::attr_without_color = 0;
@ -259,7 +259,7 @@ void FTermcapQuirks::vte()
// set exit underline for gnome terminal
TCAP(t_exit_underline_mode) = CSI "24m";
if ( term_detection->getGnomeTerminalID() >= 5300 ) // vte >= 0.53.0
if ( term_detection.getGnomeTerminalID() >= 5300 ) // vte >= 0.53.0
caModeExtension();
}
@ -445,14 +445,14 @@ void FTermcapQuirks::sunConsole()
//----------------------------------------------------------------------
void FTermcapQuirks::screen()
{
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
// Fallback if "Ic" is not found
if ( ! TCAP(t_initialize_color) )
{
FTermcap::can_change_color_palette = true;
if ( term_detection->isTmuxTerm() )
if ( term_detection.isTmuxTerm() )
{
TCAP(t_initialize_color) = \
ESC "Ptmux;" ESC OSC "4;%p1%d;rgb:"

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2019-2020 Markus Gans *
* Copyright 2019-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -39,44 +39,44 @@ namespace finalcut
//----------------------------------------------------------------------
const FString& FTermDebugData::getAnswerbackString()
{
const auto& term_detection = FTerm::getFTermDetection();
return term_detection->getAnswerbackString();
auto& term_detection = FTerm::getFTermDetection();
return term_detection.getAnswerbackString();
}
//----------------------------------------------------------------------
const FString& FTermDebugData::getSecDAString()
{
const auto& term_detection = FTerm::getFTermDetection();
return term_detection->getSecDAString();
auto& term_detection = FTerm::getFTermDetection();
return term_detection.getSecDAString();
}
//----------------------------------------------------------------------
const char* FTermDebugData::getTermType_256color()
{
const auto& term_detection = FTerm::getFTermDetection();
return term_detection->getTermType_256color();
auto& term_detection = FTerm::getFTermDetection();
return term_detection.getTermType_256color();
}
//----------------------------------------------------------------------
const char* FTermDebugData::getTermType_Answerback()
{
const auto& term_detection = FTerm::getFTermDetection();
return term_detection->getTermType_Answerback();
auto& term_detection = FTerm::getFTermDetection();
return term_detection.getTermType_Answerback();
}
//----------------------------------------------------------------------
const char* FTermDebugData::getTermType_SecDA()
{
const auto& term_detection = FTerm::getFTermDetection();
return term_detection->getTermType_SecDA();
auto& term_detection = FTerm::getFTermDetection();
return term_detection.getTermType_SecDA();
}
//----------------------------------------------------------------------
#if defined(__linux__)
int FTermDebugData::getFramebufferBpp()
{
const auto& fterm_data = FTerm::getFTermData();
return fterm_data->getFramebufferBpp();
auto& fterm_data = FTerm::getFTermData();
return fterm_data.getFramebufferBpp();
}
#endif // defined(__linux__)

View File

@ -159,8 +159,8 @@ void FTermDetection::getSystemTermType()
{
// Import the untrusted environment variable TERM
const auto& term_env = std::getenv("TERM");
const auto& fterm_data = FTerm::getFTermData();
const auto& termfilename = fterm_data->getTermFileName();
auto& fterm_data = FTerm::getFTermData();
const auto& termfilename = fterm_data.getTermFileName();
if ( term_env )
{
@ -198,8 +198,8 @@ bool FTermDetection::getTTYtype()
// vt100 ttys0
// Get term basename
const auto& fterm_data = FTerm::getFTermData();
const auto& termfilename = fterm_data->getTermFileName();
auto& fterm_data = FTerm::getFTermData();
const auto& termfilename = fterm_data.getTermFileName();
const char* term_basename = std::strrchr(termfilename.data(), '/');
if ( term_basename == nullptr )
@ -254,8 +254,8 @@ bool FTermDetection::getTTYSFileEntry()
// Analyse /etc/ttys and get the term name
// get term basename
const auto& fterm_data = FTerm::getFTermData();
const auto& termfilename = fterm_data->getTermFileName();
auto& fterm_data = FTerm::getFTermData();
const auto& termfilename = fterm_data.getTermFileName();
const char* term_basename = std::strrchr(termfilename.data(), '/');
if ( term_basename == nullptr )
@ -363,8 +363,8 @@ void FTermDetection::detectTerminal()
if ( terminal_detection )
{
FTermios::setCaptureSendCharacters();
const auto& keyboard = FTerm::getFKeyboard();
keyboard->setNonBlockingInput();
auto& keyboard = FTerm::getFKeyboard();
keyboard.setNonBlockingInput();
// Initialize 256 colors terminals
new_termtype = init_256colorTerminal();
@ -378,7 +378,7 @@ void FTermDetection::detectTerminal()
// Determines the maximum number of colors
new_termtype = determineMaxColor(new_termtype);
keyboard->unsetNonBlockingInput();
keyboard.unsetNonBlockingInput();
FTermios::unsetCaptureSendCharacters();
}
@ -408,8 +408,8 @@ void FTermDetection::detectTerminal()
}
#if defined(__CYGWIN__)
const auto& fterm_data = FTerm::getFTermData();
const auto& termfilename = fterm_data->getTermFileName();
auto& fterm_data = FTerm::getFTermData();
const auto& termfilename = fterm_data.getTermFileName();
// Fixes problem with mouse input
if ( termfilename.substr(0, 9) == "/dev/cons" )
@ -532,8 +532,8 @@ const char* FTermDetection::determineMaxColor (const char current_termtype[])
// Determine xterm maximum number of colors via OSC 4
const char* new_termtype = current_termtype;
const auto& keyboard = FTerm::getFKeyboard();
keyboard->setNonBlockingInput();
auto& keyboard = FTerm::getFKeyboard();
keyboard.setNonBlockingInput();
if ( ! color256
&& ! isCygwinTerminal()
@ -561,7 +561,7 @@ const char* FTermDetection::determineMaxColor (const char current_termtype[])
}
}
keyboard->unsetNonBlockingInput();
keyboard.unsetNonBlockingInput();
return new_termtype;
}
@ -625,11 +625,11 @@ FString FTermDetection::getXTermColorName (FColor color)
const char* FTermDetection::parseAnswerbackMsg (const char current_termtype[])
{
const char* new_termtype = current_termtype;
const auto& keyboard = FTerm::getFKeyboard();
keyboard->setNonBlockingInput();
auto& keyboard = FTerm::getFKeyboard();
keyboard.setNonBlockingInput();
// send ENQ and read the answerback message
const auto& ans = getAnswerbackMsg();
keyboard->unsetNonBlockingInput();
keyboard.unsetNonBlockingInput();
try
{

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2018-2020 Markus Gans *
* Copyright 2018-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -61,9 +61,9 @@ bool FTermFreeBSD::setCursorStyle (CursorStyle style)
return false;
cursor_style = style;
const auto& fterm_data = FTerm::getFTermData();
auto& fterm_data = FTerm::getFTermData();
if ( fterm_data->isCursorHidden() )
if ( fterm_data.isCursorHidden() )
return false;
return setFreeBSDCursorStyle(style);

View File

@ -85,14 +85,14 @@ bool FTermLinux::setCursorStyle (CursorStyle style)
{
// Set cursor style in linux console
const auto& fterm_data = FTerm::getFTermData();
auto& fterm_data = FTerm::getFTermData();
if ( ! FTerm::isLinuxTerm() )
return false;
linux_console_cursor_style = style;
if ( fterm_data->isCursorHidden() )
if ( fterm_data.isCursorHidden() )
return false;
setLinuxCursorStyle(style);
@ -152,12 +152,12 @@ void FTermLinux::init()
{
// Initialize Linux console
const auto& fterm_data = FTerm::getFTermData();
const auto& term_detection = FTerm::getFTermDetection();
auto& fterm_data = FTerm::getFTermData();
auto& term_detection = FTerm::getFTermDetection();
screen_unicode_map.entries = nullptr;
screen_font.data = nullptr;
fterm_data->supportShadowCharacter (true);
fterm_data->supportHalfBlockCharacter (true);
fterm_data.supportShadowCharacter (true);
fterm_data.supportHalfBlockCharacter (true);
initKeyMap();
#if defined(ISA_SYSCTL_SUPPORT)
@ -166,7 +166,7 @@ void FTermLinux::init()
if ( FTerm::openConsole() == 0 )
{
term_detection->setLinuxTerm (isLinuxConsole());
term_detection.setLinuxTerm (isLinuxConsole());
if ( FTerm::isLinuxTerm() )
{
@ -285,9 +285,9 @@ bool FTermLinux::loadVGAFont()
if ( vga_font )
{
const auto& fterm_data = FTerm::getFTermData();
fterm_data->supportShadowCharacter (true);
fterm_data->supportHalfBlockCharacter (true);
auto& fterm_data = FTerm::getFTermData();
fterm_data.supportShadowCharacter (true);
fterm_data.supportHalfBlockCharacter (true);
}
return vga_font;
@ -333,9 +333,9 @@ bool FTermLinux::loadNewFont()
if ( new_font )
{
const auto& fterm_data = FTerm::getFTermData();
fterm_data->supportShadowCharacter (true);
fterm_data->supportHalfBlockCharacter (true);
auto& fterm_data = FTerm::getFTermData();
fterm_data.supportShadowCharacter (true);
fterm_data.supportHalfBlockCharacter (true);
}
return new_font;
@ -1131,7 +1131,7 @@ inline void FTermLinux::shiftCtrlAltKeyCorrection()
//----------------------------------------------------------------------
inline void FTermLinux::initSpecialCharacter() const
{
const auto& fterm_data = FTerm::getFTermData();
auto& fterm_data = FTerm::getFTermData();
const auto c1 = wchar_t(UniChar::UpperHalfBlock); // ▀
const auto c2 = wchar_t(UniChar::LowerHalfBlock); // ▄
const auto c3 = wchar_t(UniChar::FullBlock); // █
@ -1140,7 +1140,7 @@ inline void FTermLinux::initSpecialCharacter() const
|| FTerm::charEncode(c2, Encoding::PC) == FTerm::charEncode(c2, Encoding::ASCII)
|| FTerm::charEncode(c3, Encoding::PC) == FTerm::charEncode(c3, Encoding::ASCII) )
{
fterm_data->supportShadowCharacter (false); // disable support
fterm_data.supportShadowCharacter (false); // disable support
}
const auto c4 = wchar_t(UniChar::RightHalfBlock);
@ -1149,7 +1149,7 @@ inline void FTermLinux::initSpecialCharacter() const
if ( FTerm::charEncode(c4, Encoding::PC) == FTerm::charEncode(c4, Encoding::ASCII)
|| FTerm::charEncode(c5, Encoding::PC) == FTerm::charEncode(c5, Encoding::ASCII) )
{
fterm_data->supportHalfBlockCharacter (false); // disable support
fterm_data.supportHalfBlockCharacter (false); // disable support
}
}
@ -1172,8 +1172,8 @@ void FTermLinux::characterFallback ( wchar_t ucs
, const std::vector<wchar_t>& fallback ) const
{
constexpr sInt16 NOT_FOUND = -1;
const auto& fterm_data = FTerm::getFTermData();
charSubstitution& sub_map = fterm_data->getCharSubstitutionMap();
auto& fterm_data = FTerm::getFTermData();
charSubstitution& sub_map = fterm_data.getCharSubstitutionMap();
if ( fallback.size() < 2 || ucs != fallback[0] )
return;

View File

@ -241,9 +241,9 @@ void FTermXTerminal::resetHighlightBackground()
//----------------------------------------------------------------------
void FTermXTerminal::resetDefaults()
{
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isPuttyTerminal() )
if ( term_detection.isPuttyTerminal() )
return;
// Redefines the cursor color if resetCursorColor() doesn't work
@ -274,18 +274,18 @@ void FTermXTerminal::resetTitle()
//----------------------------------------------------------------------
void FTermXTerminal::captureFontAndTitle()
{
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( ( term_detection->isXTerminal()
|| term_detection->isUrxvtTerminal() )
&& ! term_detection->isRxvtTerminal() )
if ( ( term_detection.isXTerminal()
|| term_detection.isUrxvtTerminal() )
&& ! term_detection.isRxvtTerminal() )
{
FTermios::setCaptureSendCharacters();
const auto& keyboard = FTerm::getFKeyboard();
keyboard->setNonBlockingInput();
auto& keyboard = FTerm::getFKeyboard();
keyboard.setNonBlockingInput();
xterm_font = captureXTermFont();
xterm_title = captureXTermTitle();
keyboard->unsetNonBlockingInput();
keyboard.unsetNonBlockingInput();
FTermios::unsetCaptureSendCharacters();
}
}
@ -312,20 +312,20 @@ void FTermXTerminal::setXTermCursorStyle()
return;
#endif
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isGnomeTerminal()
&& ! term_detection->hasSetCursorStyleSupport() )
if ( term_detection.isGnomeTerminal()
&& ! term_detection.hasSetCursorStyleSupport() )
return;
if ( term_detection->isKdeTerminal() )
if ( term_detection.isKdeTerminal() )
return;
if ( TCAP(t_cursor_style)
|| term_detection->isXTerminal()
|| term_detection->isCygwinTerminal()
|| term_detection->isMinttyTerm()
|| term_detection->hasSetCursorStyleSupport() )
|| term_detection.isXTerminal()
|| term_detection.isCygwinTerminal()
|| term_detection.isMinttyTerm()
|| term_detection.hasSetCursorStyleSupport() )
{
FTerm::putstringf (CSI "%d q", cursor_style);
std::fflush(stdout);
@ -336,14 +336,14 @@ void FTermXTerminal::setXTermCursorStyle()
void FTermXTerminal::setXTermTitle()
{
// Set the xterm title
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isXTerminal()
|| term_detection->isScreenTerm()
|| term_detection->isUrxvtTerminal()
|| term_detection->isCygwinTerminal()
|| term_detection->isMinttyTerm()
|| term_detection->isPuttyTerminal()
if ( term_detection.isXTerminal()
|| term_detection.isScreenTerm()
|| term_detection.isUrxvtTerminal()
|| term_detection.isCygwinTerminal()
|| term_detection.isMinttyTerm()
|| term_detection.isPuttyTerminal()
|| FTermcap::osc_support )
{
oscPrefix();
@ -361,9 +361,9 @@ void FTermXTerminal::setXTermTitle()
//----------------------------------------------------------------------
void FTermXTerminal::setXTermSize() const
{
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isXTerminal() )
if ( term_detection.isXTerminal() )
{
FTerm::putstringf ( CSI "8;%lu;%lut"
, uLong(term_height)
@ -377,11 +377,11 @@ void FTermXTerminal::setXTermFont()
{
// Change the XTerm font (needs the allowFontOps resource)
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isXTerminal()
|| term_detection->isScreenTerm()
|| term_detection->isUrxvtTerminal()
if ( term_detection.isXTerminal()
|| term_detection.isScreenTerm()
|| term_detection.isUrxvtTerminal()
|| FTermcap::osc_support )
{
oscPrefix();
@ -395,12 +395,12 @@ void FTermXTerminal::setXTermForeground()
{
// Set the XTerm text foreground color
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isXTerminal()
|| term_detection->isScreenTerm()
|| term_detection->isMinttyTerm()
|| term_detection->isMltermTerminal()
if ( term_detection.isXTerminal()
|| term_detection.isScreenTerm()
|| term_detection.isMinttyTerm()
|| term_detection.isMltermTerminal()
|| FTermcap::osc_support )
{
oscPrefix();
@ -415,12 +415,12 @@ void FTermXTerminal::setXTermBackground()
{
// Set the XTerm text background color
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isXTerminal()
|| term_detection->isScreenTerm()
|| term_detection->isMinttyTerm()
|| term_detection->isMltermTerminal()
if ( term_detection.isXTerminal()
|| term_detection.isScreenTerm()
|| term_detection.isMinttyTerm()
|| term_detection.isMltermTerminal()
|| FTermcap::osc_support )
{
oscPrefix();
@ -435,12 +435,12 @@ void FTermXTerminal::setXTermCursorColor()
{
// Set the text cursor color
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isXTerminal()
|| term_detection->isScreenTerm()
|| term_detection->isMinttyTerm()
|| term_detection->isUrxvtTerminal()
if ( term_detection.isXTerminal()
|| term_detection.isScreenTerm()
|| term_detection.isMinttyTerm()
|| term_detection.isUrxvtTerminal()
|| FTermcap::osc_support )
{
oscPrefix();
@ -455,11 +455,11 @@ void FTermXTerminal::setXTermMouseForeground()
{
// Set the mouse foreground color
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isXTerminal()
|| term_detection->isScreenTerm()
|| term_detection->isUrxvtTerminal()
if ( term_detection.isXTerminal()
|| term_detection.isScreenTerm()
|| term_detection.isUrxvtTerminal()
|| FTermcap::osc_support )
{
oscPrefix();
@ -474,10 +474,10 @@ void FTermXTerminal::setXTermMouseBackground()
{
// Set the mouse background color
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isXTerminal()
|| term_detection->isScreenTerm()
if ( term_detection.isXTerminal()
|| term_detection.isScreenTerm()
|| FTermcap::osc_support )
{
oscPrefix();
@ -492,11 +492,11 @@ void FTermXTerminal::setXTermHighlightBackground()
{
// Set the highlight background color
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isXTerminal()
|| term_detection->isScreenTerm()
|| term_detection->isUrxvtTerminal()
if ( term_detection.isXTerminal()
|| term_detection.isScreenTerm()
|| term_detection.isUrxvtTerminal()
|| FTermcap::osc_support )
{
oscPrefix();
@ -512,9 +512,9 @@ void FTermXTerminal::setXTerm8ColorDefaults()
// Redefinition of the XTerm default colors
// for the final cut 8 color theme
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isPuttyTerminal() )
if ( term_detection.isPuttyTerminal() )
return;
setXTermDefaultsMouseCursor();
@ -534,9 +534,9 @@ void FTermXTerminal::setXTerm16ColorDefaults()
// Redefinition of the XTerm default colors
// for the final cut 16 color theme
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isPuttyTerminal() )
if ( term_detection.isPuttyTerminal() )
return;
setXTermDefaultsMouseCursor();
@ -556,22 +556,22 @@ inline void FTermXTerminal::setXTermDefaultsMouseCursor()
setMouseBackground("rgb:ffff/ffff/ffff"); // white
setMouseForeground ("rgb:0000/0000/0000"); // black
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( ! term_detection->isGnomeTerminal() )
if ( ! term_detection.isGnomeTerminal() )
setCursorColor("rgb:ffff/ffff/ffff"); // white
}
//----------------------------------------------------------------------
inline bool FTermXTerminal::canSetXTermBackground() const
{
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( xterm_default_colors
&& ! (term_detection->isMinttyTerm()
|| term_detection->isMltermTerminal()
|| term_detection->isRxvtTerminal()
|| term_detection->isScreenTerm()) )
&& ! (term_detection.isMinttyTerm()
|| term_detection.isMltermTerminal()
|| term_detection.isRxvtTerminal()
|| term_detection.isScreenTerm()) )
return true;
else
return false;
@ -582,9 +582,9 @@ void FTermXTerminal::resetXTermColorMap() const
{
// Reset the entire color table
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isMinttyTerm() )
if ( term_detection.isMinttyTerm() )
{
FTerm::putstring (ESC "c"); // Full Reset (RIS)
}
@ -684,18 +684,18 @@ void FTermXTerminal::resetXTermHighlightBackground() const
//----------------------------------------------------------------------
bool FTermXTerminal::canResetColor() const
{
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isGnomeTerminal()
&& term_detection->getGnomeTerminalID() < 3502 )
if ( term_detection.isGnomeTerminal()
&& term_detection.getGnomeTerminalID() < 3502 )
return false;
if ( term_detection->isPuttyTerminal()
|| term_detection->isMltermTerminal() )
if ( term_detection.isPuttyTerminal()
|| term_detection.isMltermTerminal() )
return false;
if ( term_detection->isXTerminal()
|| term_detection->isScreenTerm()
if ( term_detection.isXTerminal()
|| term_detection.isScreenTerm()
|| FTermcap::osc_support )
return true;
@ -705,14 +705,14 @@ bool FTermXTerminal::canResetColor() const
//----------------------------------------------------------------------
void FTermXTerminal::oscPrefix() const
{
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isTmuxTerm() )
if ( term_detection.isTmuxTerm() )
{
// tmux device control string
FTerm::putstring (ESC "Ptmux;" ESC);
}
else if ( term_detection->isScreenTerm() )
else if ( term_detection.isScreenTerm() )
{
// GNU Screen device control string
FTerm::putstring (ESC "P");
@ -722,10 +722,10 @@ void FTermXTerminal::oscPrefix() const
//----------------------------------------------------------------------
void FTermXTerminal::oscPostfix() const
{
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isScreenTerm()
|| term_detection->isTmuxTerm() )
if ( term_detection.isScreenTerm()
|| term_detection.isTmuxTerm() )
{
// GNU Screen/tmux string terminator
FTerm::putstring (ESC "\\");
@ -735,10 +735,10 @@ void FTermXTerminal::oscPostfix() const
//----------------------------------------------------------------------
FString FTermXTerminal::captureXTermFont() const
{
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( ! term_detection->isXTerminal()
&& ! term_detection->isScreenTerm()
if ( ! term_detection.isXTerminal()
&& ! term_detection.isScreenTerm()
&& ! FTermcap::osc_support )
{
return {};
@ -797,9 +797,9 @@ FString FTermXTerminal::captureXTermFont() const
//----------------------------------------------------------------------
FString FTermXTerminal::captureXTermTitle() const
{
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isKdeTerminal() )
if ( term_detection.isKdeTerminal() )
return {};
fd_set ifds{};

View File

@ -601,8 +601,8 @@ void FVTerm::flush() const
}
std::fflush(stdout);
const auto& mouse = FTerm::getFMouseControl();
mouse->drawPointer();
auto& mouse = FTerm::getFMouseControl();
mouse.drawPointer();
FObject::getCurrentTime (&time_last_flush);
}
@ -1886,12 +1886,12 @@ void FVTerm::init()
//----------------------------------------------------------------------
void FVTerm::init_characterLengths()
{
const auto& opti_move = FTerm::getFOptiMove();
cursor_address_length = opti_move->getCursorAddressLength();
erase_char_length = opti_move->getEraseCharsLength();
repeat_char_length = opti_move->getRepeatCharLength();
clr_bol_length = opti_move->getClrBolLength();
clr_eol_length = opti_move->getClrEolLength();
auto& opti_move = FTerm::getFOptiMove();
cursor_address_length = opti_move.getCursorAddressLength();
erase_char_length = opti_move.getEraseCharsLength();
repeat_char_length = opti_move.getRepeatCharLength();
clr_bol_length = opti_move.getClrBolLength();
clr_eol_length = opti_move.getClrEolLength();
if ( cursor_address_length == 0 )
cursor_address_length = INT_MAX;
@ -1920,15 +1920,15 @@ void FVTerm::init_combined_character()
if ( FTerm::getEncoding() != Encoding::UTF8 )
return;
const auto& term_detection = FTerm::getFTermDetection();
auto& term_detection = FTerm::getFTermDetection();
if ( term_detection->isCygwinTerminal() )
if ( term_detection.isCygwinTerminal() )
return;
if ( term_detection->isXTerminal()
|| term_detection->isUrxvtTerminal()
|| term_detection->isMinttyTerm()
|| term_detection->isPuttyTerminal() )
if ( term_detection.isXTerminal()
|| term_detection.isUrxvtTerminal()
|| term_detection.isMinttyTerm()
|| term_detection.isPuttyTerminal() )
{
combined_char_support = true;
}
@ -1944,7 +1944,7 @@ void FVTerm::finish() const
setNormal();
if ( FTerm::hasAlternateScreen()
&& FTerm::getFTermData()->isInAlternateScreen() )
&& FTerm::getFTermData().isInAlternateScreen() )
clearTerm();
forceTerminalUpdate();
@ -2886,14 +2886,10 @@ inline bool FVTerm::isTermSizeChanged() const
return false;
FObject::getCurrentTime (&last_term_size_check);
const auto& data = FTerm::getFTermData();
if ( ! data )
return false;
const auto& old_term_geometry = data->getTermGeometry();
auto& fterm_data = FTerm::getFTermData();
const auto& old_term_geometry = fterm_data.getTermGeometry();
FTerm::detectTermSize();
auto term_geometry = data->getTermGeometry();
auto term_geometry = fterm_data.getTermGeometry();
term_geometry.move (-1, -1);
if ( old_term_geometry.getSize() != term_geometry.getSize() )

View File

@ -84,9 +84,9 @@ FWidget::FWidget (FWidget* parent)
{
if ( internal::var::root_widget )
{
const auto& fterm_data = FTerm::getFTermData();
fterm_data->setExitMessage("FWidget: No parent defined! "
"There should be only one root object");
auto& fterm_data = FTerm::getFTermData();
fterm_data.setExitMessage("FWidget: No parent defined! "
"There should be only one root object");
FApplication::exit(EXIT_FAILURE);
return;
}

View File

@ -188,29 +188,29 @@ class FTerm final
static int getTabstop();
static int getMaxColor();
static auto getColorPaletteTheme() -> std::shared_ptr<FColorPalette>&;
static auto getFTermData() -> const std::unique_ptr<FTermData>&;
static auto getFSystem() -> std::unique_ptr<FSystem>&;
static auto getFOptiMove() -> const std::unique_ptr<FOptiMove>&;
static auto getFOptiAttr() -> const std::unique_ptr<FOptiAttr>&;
static auto getFTermDetection() -> const std::unique_ptr<FTermDetection>&;
static auto getFTermXTerminal() -> const std::unique_ptr<FTermXTerminal>&;
static auto getFKeyboard() -> const std::unique_ptr<FKeyboard>&;
static auto getFMouseControl() -> const std::unique_ptr<FMouseControl>&;
static auto getFTermData() -> FTermData&;
static auto getFOptiMove() -> FOptiMove&;
static auto getFOptiAttr() -> FOptiAttr&;
static auto getFTermDetection() -> FTermDetection&;
static auto getFTermXTerminal() -> FTermXTerminal&;
static auto getFKeyboard() -> FKeyboard&;
static auto getFMouseControl() -> FMouseControl&;
#if defined(__linux__) || defined(UNIT_TEST)
static auto getFTermLinux() -> const std::unique_ptr<FTermLinux>&;
static auto getFTermLinux() -> FTermLinux&;
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
static auto getFTermFreeBSD() -> const std::unique_ptr<FTermFreeBSD>&;
static auto getFTermFreeBSD() -> FTermFreeBSD&;
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
static auto getFTermOpenBSD() -> const std::unique_ptr<FTermOpenBSD>&;
static auto getFTermOpenBSD() -> FTermOpenBSD&;
#endif
#if DEBUG
static auto getFTermDebugData() -> const std::unique_ptr<FTermDebugData>&;
static auto getFTermDebugData() -> FTermDebugData&;
#endif
// Inquiries

View File

@ -488,8 +488,8 @@ void FTermFunctionsTest::FullWidthHalfWidthTest()
CPPUNIT_ASSERT ( finalcut::getHalfWidth(L"") == L"" );
// Column width (wchar_t)
const auto& data = finalcut::FTerm::getFTermData();
data->setTermEncoding (finalcut::Encoding::UTF8);
auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data.setTermEncoding (finalcut::Encoding::UTF8);
CPPUNIT_ASSERT ( finalcut::getColumnWidth(L"\t") == 0 );
CPPUNIT_ASSERT ( finalcut::getColumnWidth(L"\r") == 0 );
CPPUNIT_ASSERT ( finalcut::getColumnWidth(L"\n") == 0 );
@ -510,7 +510,7 @@ void FTermFunctionsTest::FullWidthHalfWidthTest()
// Column width (wchar_t) in latin-1
std::setlocale (LC_CTYPE, "C");
data->setTermEncoding (finalcut::Encoding::VT100);
fterm_data.setTermEncoding (finalcut::Encoding::VT100);
CPPUNIT_ASSERT ( finalcut::getColumnWidth(L'') == 1 ); // wcwidth(L'─') == -1 (for LC_CTYPE = C)
CPPUNIT_ASSERT ( finalcut::getColumnWidth(L'') == 1 ); // wcwidth(L'│') == -1 (for LC_CTYPE = C)
CPPUNIT_ASSERT ( finalcut::getColumnWidth(L'') == 1 ); // wcwidth(L'├') == -1 (for LC_CTYPE = C)
@ -526,7 +526,7 @@ void FTermFunctionsTest::FullWidthHalfWidthTest()
if ( ! ret )
ret = std::setlocale (LC_CTYPE, "C.UTF-8");
data->setTermEncoding (finalcut::Encoding::UTF8);
fterm_data.setTermEncoding (finalcut::Encoding::UTF8);
// Column width (FString)
CPPUNIT_ASSERT ( finalcut::getColumnWidth(L"\v\t 100") == 4 );
@ -815,11 +815,11 @@ void FTermFunctionsTest::FullWidthHalfWidthTest()
term_buf << L"";
CPPUNIT_ASSERT ( finalcut::getColumnWidth(term_buf) == 20 ); // UTF-8
term_buf.clear();
data->setTermEncoding (finalcut::Encoding::PC);
fterm_data.setTermEncoding (finalcut::Encoding::PC);
term_buf << L"";
CPPUNIT_ASSERT ( finalcut::getColumnWidth(term_buf) == 10 ); // CP-437
term_buf.clear();
data->setTermEncoding (finalcut::Encoding::UTF8);
fterm_data.setTermEncoding (finalcut::Encoding::UTF8);
CPPUNIT_ASSERT ( finalcut::getColumnWidth(term_buf) == 0 ); // after clear
term_buf << L"abc";
CPPUNIT_ASSERT ( finalcut::getColumnWidth(term_buf) == 3 );
@ -2551,9 +2551,9 @@ void FTermFunctionsTest::combiningCharacterTest()
//----------------------------------------------------------------------
void FTermFunctionsTest::readCursorPosTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& fterm_data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm");
fterm_data.setTermType("xterm");
detect.setTerminalDetection(true);
pid_t pid = forkConEmu();

View File

@ -42,10 +42,13 @@ class FTermBufferTest : public CPPUNIT_NS::TestFixture
public:
FTermBufferTest()
{
auto ret = std::setlocale (LC_CTYPE, "en_US.UTF-8");
auto ret = std::setlocale(LC_CTYPE, "en_US.UTF-8");
if ( ! ret )
ret = std::setlocale (LC_CTYPE, "C.UTF-8");
{
if ( ! std::setlocale(LC_CTYPE, "C.UTF-8") )
std::cerr << "No UTF-8 character set found!";
}
fwide(stdout, 1); // Makes stream wide-character oriented
}
@ -97,8 +100,8 @@ void FTermBufferTest::noArgumentTest()
//----------------------------------------------------------------------
void FTermBufferTest::writeTest()
{
const auto& data = finalcut::FTerm::getFTermData();
data->setTermEncoding (finalcut::Encoding::UTF8);
auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data.setTermEncoding (finalcut::Encoding::UTF8);
finalcut::FTermBuffer term_buf{};
// Write wchar_t
@ -358,8 +361,8 @@ void FTermBufferTest::writeTest()
void FTermBufferTest::streamTest()
{
auto multi_color_emojis = bool( wcswidth(L"🚧🚀🚴", 3) == 6 );
const auto& data = finalcut::FTerm::getFTermData();
data->setTermEncoding (finalcut::Encoding::UTF8);
auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data.setTermEncoding (finalcut::Encoding::UTF8);
finalcut::FTermBuffer::FCharVector fchar_vec = { finalcut::FChar{} };
CPPUNIT_ASSERT ( fchar_vec.size() == 1 );
fchar_vec.front().ch[0] = L'🚧';
@ -496,8 +499,8 @@ void FTermBufferTest::streamTest()
//----------------------------------------------------------------------
void FTermBufferTest::combiningCharacterTest()
{
const auto& data = finalcut::FTerm::getFTermData();
data->setTermEncoding (finalcut::Encoding::UTF8);
auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data.setTermEncoding (finalcut::Encoding::UTF8);
finalcut::FTermBuffer term_buf{};
// Skip leading zero-width characters
std::wstring combining = L"\U00000323\U00000300\U0000ff2f\n"; // [] [] [NL]

View File

@ -122,46 +122,46 @@ void FTermcapTest::classNameTest()
void FTermcapTest::initTest()
{
// Without a terminal type
const auto& fterm_data = finalcut::FTerm::getFTermData();
CPPUNIT_ASSERT ( fterm_data->getTermType().empty() );
auto& fterm_data = finalcut::FTerm::getFTermData();
CPPUNIT_ASSERT ( fterm_data.getTermType().empty() );
finalcut::FTermcap tcap;
CPPUNIT_ASSERT ( ! tcap.isInitialized() );
tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() );
CPPUNIT_ASSERT ( ! fterm_data->getTermType().empty() );
CPPUNIT_ASSERT ( fterm_data->getTermType() == "xterm" );
CPPUNIT_ASSERT ( ! fterm_data.getTermType().empty() );
CPPUNIT_ASSERT ( fterm_data.getTermType() == "xterm" );
// With terminal type ansi
fterm_data->setTermType("ansi");
fterm_data.setTermType("ansi");
tcap.init();
CPPUNIT_ASSERT ( fterm_data->getTermType() == "ansi" );
CPPUNIT_ASSERT ( fterm_data.getTermType() == "ansi" );
// With a non-existent terminal type
fterm_data->setTermType("bang!");
fterm_data.setTermType("bang!");
tcap.init();
CPPUNIT_ASSERT ( fterm_data->getTermType() == "xterm" );
CPPUNIT_ASSERT ( fterm_data.getTermType() == "xterm" );
setenv ("TERM", "xterm-256color", 1); // 256 color terminal
const auto& term_detection = finalcut::FTerm::getFTermDetection();
CPPUNIT_ASSERT ( ! term_detection->canDisplay256Colors() );
term_detection->detect();
CPPUNIT_ASSERT ( term_detection->canDisplay256Colors() );
fterm_data->setTermType("bang!");
auto& term_detection = finalcut::FTerm::getFTermDetection();
CPPUNIT_ASSERT ( ! term_detection.canDisplay256Colors() );
term_detection.detect();
CPPUNIT_ASSERT ( term_detection.canDisplay256Colors() );
fterm_data.setTermType("bang!");
tcap.init();
CPPUNIT_ASSERT ( fterm_data->getTermType() == "xterm-256color" );
fterm_data->setTermType("dumb");
CPPUNIT_ASSERT ( fterm_data.getTermType() == "xterm-256color" );
fterm_data.setTermType("dumb");
tcap.init();
CPPUNIT_ASSERT ( fterm_data->getTermType() == "dumb" );
CPPUNIT_ASSERT ( fterm_data.getTermType() == "dumb" );
}
//----------------------------------------------------------------------
void FTermcapTest::getFlagTest()
{
const auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("ansi");
auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data.setTermType("ansi");
finalcut::FTermcap tcap;
tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() );
CPPUNIT_ASSERT ( fterm_data->getTermType() == "ansi" );
CPPUNIT_ASSERT ( fterm_data.getTermType() == "ansi" );
CPPUNIT_ASSERT ( tcap.getFlag("am") ); // Automatic right margin
CPPUNIT_ASSERT ( ! tcap.getFlag("cc") ); // Can change color palette
@ -171,12 +171,12 @@ void FTermcapTest::getFlagTest()
//----------------------------------------------------------------------
void FTermcapTest::getNumberTest()
{
const auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("xterm");
auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data.setTermType("xterm");
finalcut::FTermcap tcap;
tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() );
CPPUNIT_ASSERT ( fterm_data->getTermType() == "xterm" );
CPPUNIT_ASSERT ( fterm_data.getTermType() == "xterm" );
CPPUNIT_ASSERT ( tcap.getNumber("Co") == 8 ); // Colors
CPPUNIT_ASSERT ( tcap.getNumber("it") == 8 ); // Tab stop
@ -188,12 +188,12 @@ void FTermcapTest::getNumberTest()
//----------------------------------------------------------------------
void FTermcapTest::getStringTest()
{
const auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("ansi");
auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data.setTermType("ansi");
finalcut::FTermcap tcap;
tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() );
CPPUNIT_ASSERT ( fterm_data->getTermType() == "ansi" );
CPPUNIT_ASSERT ( fterm_data.getTermType() == "ansi" );
CPPUNIT_ASSERT_CSTRING ( tcap.getString("me"), CSI "0m" ); // Exit attribute mode
CPPUNIT_ASSERT_CSTRING ( tcap.getString("mr"), CSI "7m" ); // Enter reverse mode
@ -206,12 +206,12 @@ void FTermcapTest::getStringTest()
//----------------------------------------------------------------------
void FTermcapTest::encodeMotionParameterTest()
{
const auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("ansi");
auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data.setTermType("ansi");
finalcut::FTermcap tcap;
tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() );
CPPUNIT_ASSERT ( fterm_data->getTermType() == "ansi" );
CPPUNIT_ASSERT ( fterm_data.getTermType() == "ansi" );
const auto& cursor_address = tcap.getString("cm");
CPPUNIT_ASSERT ( tcap.encodeMotionParameter(cursor_address, 10, 15) == CSI "16;11H" );
CPPUNIT_ASSERT ( tcap.encodeMotionParameter(cursor_address, 25, 1) == CSI "2;26H" );
@ -222,12 +222,12 @@ void FTermcapTest::encodeMotionParameterTest()
//----------------------------------------------------------------------
void FTermcapTest::encodeParameterTest()
{
const auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("ansi");
auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data.setTermType("ansi");
finalcut::FTermcap tcap;
tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() );
CPPUNIT_ASSERT ( fterm_data->getTermType() == "ansi" );
CPPUNIT_ASSERT ( fterm_data.getTermType() == "ansi" );
const auto& parm_insert_line = tcap.getString("AL");
CPPUNIT_ASSERT ( tcap.encodeParameter(parm_insert_line, 7) == CSI "7L" );
const auto& parm_left_cursor = tcap.getString("LE");
@ -249,7 +249,7 @@ void FTermcapTest::paddingPrintTest()
setenv ("TERM", "xterm", 1); // xterm has no padding character
unsetenv("TERMCAP");
auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("xterm");
fterm_data.setTermType("xterm");
CPPUNIT_ASSERT ( ! tcap.xon_xoff_flow_control );
tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() );
@ -347,7 +347,7 @@ void FTermcapTest::paddingPrintTest()
// With 5 ms prints 21 padding chars ('\0')
setenv ("TERM", "ansi", 1); // ansi terminals used for delay padding character
fterm_data->setTermType("ansi");
fterm_data.setTermType("ansi");
tcap.init();
CPPUNIT_ASSERT ( ! tcap.no_padding_char );
CPPUNIT_ASSERT ( ! tcap.xon_xoff_flow_control );

View File

@ -293,8 +293,8 @@ void FTermcapQuirksTest::xtermTest()
for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
auto& data = finalcut::FTerm::getFTermData();
auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks;
finalcut::FTermcap::can_change_color_palette = false;
detect.setXTerminal (true);
@ -324,8 +324,8 @@ void FTermcapQuirksTest::freebsdTest()
for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
auto& data = finalcut::FTerm::getFTermData();
auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcapQuirks quirks;
detect.setFreeBSDTerm (true);
@ -363,8 +363,8 @@ void FTermcapQuirksTest::cygwinTest()
for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
auto& data = finalcut::FTerm::getFTermData();
auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::background_color_erase = false;
finalcut::FTermcapQuirks quirks;
detect.setCygwinTerminal (true);
@ -388,8 +388,8 @@ void FTermcapQuirksTest::linuxTest()
for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
auto& data = finalcut::FTerm::getFTermData();
auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::max_color = 8;
finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcapQuirks quirks;
@ -460,8 +460,8 @@ void FTermcapQuirksTest::rxvtTest()
for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
auto& data = finalcut::FTerm::getFTermData();
auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks;
detect.setRxvtTerminal (true);
data.setTermType ("rxvt");
@ -501,8 +501,8 @@ void FTermcapQuirksTest::vteTest()
for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
auto& data = finalcut::FTerm::getFTermData();
auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcapQuirks quirks;
detect.setGnomeTerminal (true);
@ -515,6 +515,7 @@ void FTermcapQuirksTest::vteTest()
detect.setGnomeTerminal (false);
}
//----------------------------------------------------------------------
void FTermcapQuirksTest::kittyTest()
{
@ -526,8 +527,8 @@ void FTermcapQuirksTest::kittyTest()
caps[int(finalcut::Termcap::t_enter_ca_mode)].string = CSI "?1049h";
caps[int(finalcut::Termcap::t_exit_ca_mode)].string = CSI "?1049l";
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
auto& data = finalcut::FTerm::getFTermData();
auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks;
detect.setKittyTerminal (true);
data.setTermType ("xterm-kitty");
@ -550,8 +551,8 @@ void FTermcapQuirksTest::puttyTest()
for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
auto& data = finalcut::FTerm::getFTermData();
auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::background_color_erase = false;
finalcut::FTermcap::can_change_color_palette = false;
finalcut::FTermcap::osc_support = false;
@ -640,8 +641,8 @@ void FTermcapQuirksTest::teratermTest()
for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
auto& data = finalcut::FTerm::getFTermData();
auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::eat_nl_glitch = false;
finalcut::FTermcapQuirks quirks;
detect.setTeraTerm (true);
@ -670,8 +671,8 @@ void FTermcapQuirksTest::sunTest()
for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
auto& data = finalcut::FTerm::getFTermData();
auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::eat_nl_glitch = false;
finalcut::FTermcapQuirks quirks;
detect.setSunTerminal (true);
@ -788,8 +789,8 @@ void FTermcapQuirksTest::screenTest()
for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
auto& data = finalcut::FTerm::getFTermData();
auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks;
finalcut::FTermcap::can_change_color_palette = false;
detect.setScreenTerm (true);

View File

@ -141,7 +141,7 @@ void FTermDetectionTest::classNameTest()
//----------------------------------------------------------------------
void FTermDetectionTest::ansiTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
setenv ("TERM", "ansi", 1);
data.setTermType("ansi");
@ -213,7 +213,7 @@ void FTermDetectionTest::ansiTest()
//----------------------------------------------------------------------
void FTermDetectionTest::xtermTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm");
detect.setTerminalDetection(true);
@ -277,7 +277,7 @@ void FTermDetectionTest::xtermTest()
//----------------------------------------------------------------------
void FTermDetectionTest::rxvtTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("rxvt-cygwin-native");
detect.setTerminalDetection(true);
@ -342,7 +342,7 @@ void FTermDetectionTest::rxvtTest()
//----------------------------------------------------------------------
void FTermDetectionTest::urxvtTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("rxvt-unicode-256color");
detect.setTerminalDetection(true);
@ -406,7 +406,7 @@ void FTermDetectionTest::urxvtTest()
//----------------------------------------------------------------------
void FTermDetectionTest::kdeKonsoleTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm-256color");
detect.setTerminalDetection(true);
@ -470,7 +470,7 @@ void FTermDetectionTest::kdeKonsoleTest()
//----------------------------------------------------------------------
void FTermDetectionTest::gnomeTerminalTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm-256color");
detect.setTerminalDetection(true);
@ -534,7 +534,7 @@ void FTermDetectionTest::gnomeTerminalTest()
//----------------------------------------------------------------------
void FTermDetectionTest::newerVteTerminalTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm-256color");
detect.setTerminalDetection(true);
@ -598,7 +598,7 @@ void FTermDetectionTest::newerVteTerminalTest()
//----------------------------------------------------------------------
void FTermDetectionTest::puttyTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm");
detect.setTerminalDetection(true);
@ -663,7 +663,7 @@ void FTermDetectionTest::puttyTest()
//----------------------------------------------------------------------
void FTermDetectionTest::windowsTerminalTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm");
detect.setTerminalDetection(true);
@ -729,7 +729,7 @@ void FTermDetectionTest::windowsTerminalTest()
//----------------------------------------------------------------------
void FTermDetectionTest::teraTermTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm");
detect.setTerminalDetection(true);
@ -793,7 +793,7 @@ void FTermDetectionTest::teraTermTest()
//----------------------------------------------------------------------
void FTermDetectionTest::cygwinTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("cygwin");
detect.setTerminalDetection(true);
@ -857,7 +857,7 @@ void FTermDetectionTest::cygwinTest()
//----------------------------------------------------------------------
void FTermDetectionTest::minttyTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm-256color");
detect.setTerminalDetection(true);
@ -921,7 +921,7 @@ void FTermDetectionTest::minttyTest()
//----------------------------------------------------------------------
void FTermDetectionTest::linuxTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("linux");
detect.setTerminalDetection(true);
@ -992,7 +992,7 @@ void FTermDetectionTest::linuxTest()
//----------------------------------------------------------------------
void FTermDetectionTest::freebsdTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm");
detect.setTerminalDetection(true);
@ -1066,7 +1066,7 @@ void FTermDetectionTest::freebsdTest()
//----------------------------------------------------------------------
void FTermDetectionTest::netbsdTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("wsvt25");
detect.setTerminalDetection(true);
@ -1138,7 +1138,7 @@ void FTermDetectionTest::netbsdTest()
//----------------------------------------------------------------------
void FTermDetectionTest::openbsdTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("vt220");
detect.setTerminalDetection(true);
@ -1210,7 +1210,7 @@ void FTermDetectionTest::openbsdTest()
//----------------------------------------------------------------------
void FTermDetectionTest::sunTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("sun-color");
@ -1280,7 +1280,7 @@ void FTermDetectionTest::sunTest()
//----------------------------------------------------------------------
void FTermDetectionTest::screenTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("screen");
detect.setTerminalDetection(true);
@ -1350,7 +1350,7 @@ void FTermDetectionTest::screenTest()
//----------------------------------------------------------------------
void FTermDetectionTest::tmuxTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("screen");
detect.setTerminalDetection(true);
@ -1421,7 +1421,7 @@ void FTermDetectionTest::tmuxTest()
//----------------------------------------------------------------------
void FTermDetectionTest::ktermTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("kterm");
detect.setTerminalDetection(true);
@ -1492,7 +1492,7 @@ void FTermDetectionTest::ktermTest()
//----------------------------------------------------------------------
void FTermDetectionTest::mltermTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("mlterm");
detect.setTerminalDetection(true);
@ -1564,7 +1564,7 @@ void FTermDetectionTest::mltermTest()
//----------------------------------------------------------------------
void FTermDetectionTest::kittyTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm-kitty");
detect.setTerminalDetection(true);
@ -1686,7 +1686,7 @@ void FTermDetectionTest::ttytypeTest()
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
// Test /dev/tty3 with linux
data.setTermFileName("/dev/tty3");

View File

@ -622,37 +622,37 @@ void ftermfreebsdTest::freebsdConsoleTest()
std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(fsys);
std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
auto& encoding_list = data->getEncodingList();
auto& encoding_list = data.getEncodingList();
encoding_list["UTF-8"] = finalcut::Encoding::UTF8;
encoding_list["UTF8"] = finalcut::Encoding::UTF8;
encoding_list["VT100"] = finalcut::Encoding::VT100;
encoding_list["PC"] = finalcut::Encoding::PC;
encoding_list["ASCII"] = finalcut::Encoding::ASCII;
data->setTermEncoding(finalcut::Encoding::VT100);
data->setBaudrate(9600);
data->setTermType("xterm");
data->setTermFileName("/dev/ttyv0");
data->setTTYFileDescriptor(0);
data->supportShadowCharacter (false);
data->supportHalfBlockCharacter (false);
data->supportCursorOptimisation (true);
data->setCursorHidden (true);
data->useAlternateScreen (false);
data->setASCIIConsole (true);
data->setVT100Console (false);
data->setUTF8Console (false);
data->setUTF8 (false);
data->setNewFont (false);
data->setVGAFont (false);
data->setMonochron (false);
data->setTermResized (false);
data.setTermEncoding(finalcut::Encoding::VT100);
data.setBaudrate(9600);
data.setTermType("xterm");
data.setTermFileName("/dev/ttyv0");
data.setTTYFileDescriptor(0);
data.supportShadowCharacter (false);
data.supportHalfBlockCharacter (false);
data.supportCursorOptimisation (true);
data.setCursorHidden (true);
data.useAlternateScreen (false);
data.setASCIIConsole (true);
data.setVT100Console (false);
data.setUTF8Console (false);
data.setUTF8 (false);
data.setNewFont (false);
data.setVGAFont (false);
data.setMonochron (false);
data.setTermResized (false);
// setupterm is needed for tputs in ncurses >= 6.1
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
const auto& term_detection = finalcut::FTerm::getFTermDetection();
term_detection->setTerminalDetection(true);
auto& term_detection = finalcut::FTerm::getFTermDetection();
term_detection.setTerminalDetection(true);
pid_t pid = forkConEmu();
if ( isConEmuChildProcess(pid) )
@ -754,22 +754,22 @@ void ftermfreebsdTest::freebsdConsoleTest()
CPPUNIT_ASSERT ( charEncode(c16) == 62 ); // >
CPPUNIT_ASSERT ( charEncode(c17) == 60 ); // <
term_detection->detect();
term_detection.detect();
#if DEBUG
const finalcut::FString& sec_da = \
finalcut::FTerm::getFTermDebugData()->getSecDAString();
finalcut::FTerm::getFTermDebugData().getSecDAString();
CPPUNIT_ASSERT ( sec_da == "\033[>0;10;0c" );
#endif
CPPUNIT_ASSERT ( isatty(0) == 1 );
CPPUNIT_ASSERT ( term_detection->isFreeBSDTerm() );
CPPUNIT_ASSERT ( data->getTermGeometry().getWidth() == 80 );
CPPUNIT_ASSERT ( data->getTermGeometry().getHeight() == 25 );
CPPUNIT_ASSERT ( ! data->hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data->hasHalfBlockCharacter() );
CPPUNIT_ASSERT ( term_detection.isFreeBSDTerm() );
CPPUNIT_ASSERT ( data.getTermGeometry().getWidth() == 80 );
CPPUNIT_ASSERT ( data.getTermGeometry().getHeight() == 25 );
CPPUNIT_ASSERT ( ! data.hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data.hasHalfBlockCharacter() );
data->setCursorHidden (false);
data.setCursorHidden (false);
freebsd.setCursorStyle (finalcut::FreeBSDConsoleCursorStyle::Normal);
CPPUNIT_ASSERT ( fsystest->getCursorType()

View File

@ -2066,44 +2066,44 @@ void FTermLinuxTest::linuxConsoleTest()
std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(fsys);
std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
auto& encoding_list = data->getEncodingList();
auto& encoding_list = data.getEncodingList();
encoding_list["UTF-8"] = finalcut::Encoding::UTF8;
encoding_list["UTF8"] = finalcut::Encoding::UTF8;
encoding_list["VT100"] = finalcut::Encoding::VT100;
encoding_list["PC"] = finalcut::Encoding::PC;
encoding_list["ASCII"] = finalcut::Encoding::ASCII;
data->setTermEncoding(finalcut::Encoding::PC);
data->setBaudrate(38400);
data->setTermType("linux");
data->setTermFileName("/dev/tty2");
data.setTermEncoding(finalcut::Encoding::PC);
data.setBaudrate(38400);
data.setTermType("linux");
data.setTermFileName("/dev/tty2");
#if DEBUG
data->setFramebufferBpp(32);
data.setFramebufferBpp(32);
#endif
data->supportShadowCharacter (false);
data->supportHalfBlockCharacter (false);
data->supportCursorOptimisation (true);
data->setCursorHidden (true);
data->useAlternateScreen (false);
data->setASCIIConsole (true);
data->setVT100Console (false);
data->setUTF8Console (false);
data->setUTF8 (false);
data->setNewFont (false);
data->setVGAFont (false);
data->setMonochron (false);
data->setTermResized (false);
data.supportShadowCharacter (false);
data.supportHalfBlockCharacter (false);
data.supportCursorOptimisation (true);
data.setCursorHidden (true);
data.useAlternateScreen (false);
data.setASCIIConsole (true);
data.setVT100Console (false);
data.setUTF8Console (false);
data.setUTF8 (false);
data.setNewFont (false);
data.setVGAFont (false);
data.setMonochron (false);
data.setTermResized (false);
const auto& term_detection = finalcut::FTerm::getFTermDetection();
auto& term_detection = finalcut::FTerm::getFTermDetection();
finalcut::FTermLinux linux;
// setupterm is needed for tputs in ncurses >= 6.1
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
term_detection->setLinuxTerm(true);
term_detection.setLinuxTerm(true);
pid_t pid = forkConEmu();
@ -2122,15 +2122,15 @@ void FTermLinuxTest::linuxConsoleTest()
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
term_detection->detect();
term_detection.detect();
linux.init();
CPPUNIT_ASSERT ( isatty(3) == 0 );
CPPUNIT_ASSERT ( term_detection->isLinuxTerm() );
CPPUNIT_ASSERT ( data->getTermGeometry().getWidth() == 96 );
CPPUNIT_ASSERT ( data->getTermGeometry().getHeight() == 36 );
CPPUNIT_ASSERT ( data->hasShadowCharacter() );
CPPUNIT_ASSERT ( data->hasHalfBlockCharacter() );
CPPUNIT_ASSERT ( term_detection.isLinuxTerm() );
CPPUNIT_ASSERT ( data.getTermGeometry().getWidth() == 96 );
CPPUNIT_ASSERT ( data.getTermGeometry().getHeight() == 36 );
CPPUNIT_ASSERT ( data.hasShadowCharacter() );
CPPUNIT_ASSERT ( data.hasHalfBlockCharacter() );
CPPUNIT_ASSERT ( linux.getFramebufferBpp() == 32 );
const auto& fsystem = finalcut::FTerm::getFSystem();
@ -2161,7 +2161,7 @@ void FTermLinuxTest::linuxConsoleTest()
characters.clear();
linux.initCharMap();
auto& character_map = data->getCharSubstitutionMap();
auto& character_map = data.getCharSubstitutionMap();
CPPUNIT_ASSERT ( character_map.size() == 3 );
CPPUNIT_ASSERT ( character_map[wchar_t(finalcut::UniChar::BlackCircle)] == L'*' );
CPPUNIT_ASSERT ( character_map[wchar_t(finalcut::UniChar::Times)] == L'x' );
@ -2189,45 +2189,45 @@ void FTermLinuxTest::linuxConsoleLat15Test()
fsystest->setCodeset(test::FSystemTest::Codeset::lat15);
finalcut::FTerm::setFSystem(fsys);
std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
auto& encoding_list = data->getEncodingList();
auto& encoding_list = data.getEncodingList();
encoding_list["UTF-8"] = finalcut::Encoding::UTF8;
encoding_list["UTF8"] = finalcut::Encoding::UTF8;
encoding_list["VT100"] = finalcut::Encoding::VT100;
encoding_list["PC"] = finalcut::Encoding::PC;
encoding_list["ASCII"] = finalcut::Encoding::ASCII;
data->setTermEncoding(finalcut::Encoding::PC);
data->setBaudrate(38400);
data->setTermType("linux");
data->setTermFileName("/dev/tty3");
data->setTTYFileDescriptor(0);
data.setTermEncoding(finalcut::Encoding::PC);
data.setBaudrate(38400);
data.setTermType("linux");
data.setTermFileName("/dev/tty3");
data.setTTYFileDescriptor(0);
#if DEBUG
data->setFramebufferBpp(32);
data.setFramebufferBpp(32);
#endif
data->supportShadowCharacter (true);
data->supportHalfBlockCharacter (true);
data->supportCursorOptimisation (true);
data->setCursorHidden (true);
data->useAlternateScreen (false);
data->setASCIIConsole (true);
data->setVT100Console (false);
data->setUTF8Console (false);
data->setUTF8 (false);
data->setNewFont (false);
data->setVGAFont (false);
data->setMonochron (false);
data->setTermResized (false);
data.supportShadowCharacter (true);
data.supportHalfBlockCharacter (true);
data.supportCursorOptimisation (true);
data.setCursorHidden (true);
data.useAlternateScreen (false);
data.setASCIIConsole (true);
data.setVT100Console (false);
data.setUTF8Console (false);
data.setUTF8 (false);
data.setNewFont (false);
data.setVGAFont (false);
data.setMonochron (false);
data.setTermResized (false);
const auto& term_detection = finalcut::FTerm::getFTermDetection();
auto& term_detection = finalcut::FTerm::getFTermDetection();
finalcut::FTermLinux linux;
// setupterm is needed for tputs in ncurses >= 6.1
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
term_detection->setLinuxTerm(true);
term_detection.setLinuxTerm(true);
pid_t pid = forkConEmu();
@ -2246,14 +2246,14 @@ void FTermLinuxTest::linuxConsoleLat15Test()
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
term_detection->detect();
term_detection.detect();
linux.init();
linux.initCharMap();
CPPUNIT_ASSERT ( finalcut::FTerm::isLinuxTerm() );
CPPUNIT_ASSERT ( ! data->hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data->hasHalfBlockCharacter() );
auto& character_map = data->getCharSubstitutionMap();
CPPUNIT_ASSERT ( ! data.hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data.hasHalfBlockCharacter() );
auto& character_map = data.getCharSubstitutionMap();
CPPUNIT_ASSERT ( character_map.size() == 4 );
CPPUNIT_ASSERT ( character_map[wchar_t(finalcut::UniChar::SquareRoot)] == L'x' );
CPPUNIT_ASSERT ( character_map[wchar_t(finalcut::UniChar::BlackLeftPointingPointer)] == L'' );
@ -2280,37 +2280,37 @@ void FTermLinuxTest::linuxCursorStyleTest()
std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(fsys);
std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
auto& encoding_list = data->getEncodingList();
auto& encoding_list = data.getEncodingList();
encoding_list["UTF-8"] = finalcut::Encoding::UTF8;
encoding_list["UTF8"] = finalcut::Encoding::UTF8;
encoding_list["VT100"] = finalcut::Encoding::VT100;
encoding_list["PC"] = finalcut::Encoding::PC;
encoding_list["ASCII"] = finalcut::Encoding::ASCII;
data->setTermEncoding(finalcut::Encoding::PC);
data->setBaudrate(38400);
data->setTermType("linux");
data->setTermFileName("/dev/tty2");
data.setTermEncoding(finalcut::Encoding::PC);
data.setBaudrate(38400);
data.setTermType("linux");
data.setTermFileName("/dev/tty2");
#if DEBUG
data->setFramebufferBpp(32);
data.setFramebufferBpp(32);
#endif
data->supportShadowCharacter (false);
data->supportHalfBlockCharacter (false);
data->supportCursorOptimisation (true);
data->setCursorHidden (false);
data->useAlternateScreen (false);
data->setASCIIConsole (true);
data->setVT100Console (false);
data->setUTF8Console (false);
data->setUTF8 (false);
data->setNewFont (false);
data->setVGAFont (false);
data->setMonochron (false);
data->setTermResized (false);
data.supportShadowCharacter (false);
data.supportHalfBlockCharacter (false);
data.supportCursorOptimisation (true);
data.setCursorHidden (false);
data.useAlternateScreen (false);
data.setASCIIConsole (true);
data.setVT100Console (false);
data.setUTF8Console (false);
data.setUTF8 (false);
data.setNewFont (false);
data.setVGAFont (false);
data.setMonochron (false);
data.setTermResized (false);
// setupterm is needed for tputs in ncurses >= 6.1
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
@ -2334,7 +2334,7 @@ void FTermLinuxTest::linuxCursorStyleTest()
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
term_detection->detect();
term_detection.detect();
linux.init();
const auto& fsystem = finalcut::FTerm::getFSystem();
@ -2387,9 +2387,9 @@ void FTermLinuxTest::linuxCursorStyleTest()
CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?0c" );
CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::LinuxConsoleCursorStyle::Default );
characters.clear();
data->setCursorHidden (true);
data.setCursorHidden (true);
linux.setCursorStyle (finalcut::LinuxConsoleCursorStyle::Invisible);
data->setCursorHidden (false);
data.setCursorHidden (false);
CPPUNIT_ASSERT ( characters == "" );
CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::LinuxConsoleCursorStyle::Invisible );
characters.clear();
@ -2397,9 +2397,9 @@ void FTermLinuxTest::linuxCursorStyleTest()
CPPUNIT_ASSERT ( characters == CSI "?1c" );
CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?1c" );
characters.clear();
data->setCursorHidden (true);
data.setCursorHidden (true);
linux.setCursorStyle (finalcut::LinuxConsoleCursorStyle::Underscore);
data->setCursorHidden (false);
data.setCursorHidden (false);
CPPUNIT_ASSERT ( characters == "" );
CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::LinuxConsoleCursorStyle::Underscore );
characters.clear();
@ -2407,9 +2407,9 @@ void FTermLinuxTest::linuxCursorStyleTest()
CPPUNIT_ASSERT ( characters == CSI "?2c" );
CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?2c" );
characters.clear();
data->setCursorHidden (true);
data.setCursorHidden (true);
linux.setCursorStyle (finalcut::LinuxConsoleCursorStyle::LowerThird);
data->setCursorHidden (false);
data.setCursorHidden (false);
CPPUNIT_ASSERT ( characters == "" );
CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::LinuxConsoleCursorStyle::LowerThird );
characters.clear();
@ -2417,9 +2417,9 @@ void FTermLinuxTest::linuxCursorStyleTest()
CPPUNIT_ASSERT ( characters == CSI "?3c" );
CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?3c" );
characters.clear();
data->setCursorHidden (true);
data.setCursorHidden (true);
linux.setCursorStyle (finalcut::LinuxConsoleCursorStyle::LowerHalf);
data->setCursorHidden (false);
data.setCursorHidden (false);
CPPUNIT_ASSERT ( characters == "" );
CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::LinuxConsoleCursorStyle::LowerHalf );
characters.clear();
@ -2427,9 +2427,9 @@ void FTermLinuxTest::linuxCursorStyleTest()
CPPUNIT_ASSERT ( characters == CSI "?4c" );
CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?4c" );
characters.clear();
data->setCursorHidden (true);
data.setCursorHidden (true);
linux.setCursorStyle (finalcut::LinuxConsoleCursorStyle::TwoThirds);
data->setCursorHidden (false);
data.setCursorHidden (false);
CPPUNIT_ASSERT ( characters == "" );
CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::LinuxConsoleCursorStyle::TwoThirds );
characters.clear();
@ -2437,9 +2437,9 @@ void FTermLinuxTest::linuxCursorStyleTest()
CPPUNIT_ASSERT ( characters == CSI "?5c" );
CPPUNIT_ASSERT_CSTRING ( linux.getCursorStyleString(), CSI "?5c" );
characters.clear();
data->setCursorHidden (true);
data.setCursorHidden (true);
linux.setCursorStyle (finalcut::LinuxConsoleCursorStyle::FullBlock);
data->setCursorHidden (false);
data.setCursorHidden (false);
CPPUNIT_ASSERT ( characters == "" );
CPPUNIT_ASSERT ( linux.getCursorStyle() == finalcut::LinuxConsoleCursorStyle::FullBlock );
characters.clear();
@ -2469,43 +2469,43 @@ void FTermLinuxTest::linuxColorPaletteTest()
std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(fsys);
std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
auto& encoding_list = data->getEncodingList();
auto& encoding_list = data.getEncodingList();
encoding_list["UTF-8"] = finalcut::Encoding::UTF8;
encoding_list["UTF8"] = finalcut::Encoding::UTF8;
encoding_list["VT100"] = finalcut::Encoding::VT100;
encoding_list["PC"] = finalcut::Encoding::PC;
encoding_list["ASCII"] = finalcut::Encoding::ASCII;
data->setTermEncoding(finalcut::Encoding::PC);
data->setBaudrate(38400);
data->setTermType("linux");
data->setTermFileName("/dev/tty2");
data.setTermEncoding(finalcut::Encoding::PC);
data.setBaudrate(38400);
data.setTermType("linux");
data.setTermFileName("/dev/tty2");
#if DEBUG
data->setFramebufferBpp(32);
data.setFramebufferBpp(32);
#endif
data->supportShadowCharacter (false);
data->supportHalfBlockCharacter (false);
data->supportCursorOptimisation (true);
data->setCursorHidden (true);
data->useAlternateScreen (false);
data->setASCIIConsole (true);
data->setVT100Console (false);
data->setUTF8Console (false);
data->setUTF8 (false);
data->setNewFont (false);
data->setVGAFont (false);
data->setMonochron (false);
data->setTermResized (false);
data.supportShadowCharacter (false);
data.supportHalfBlockCharacter (false);
data.supportCursorOptimisation (true);
data.setCursorHidden (true);
data.useAlternateScreen (false);
data.setASCIIConsole (true);
data.setVT100Console (false);
data.setUTF8Console (false);
data.setUTF8 (false);
data.setNewFont (false);
data.setVGAFont (false);
data.setMonochron (false);
data.setTermResized (false);
// setupterm is needed for tputs in ncurses >= 6.1
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
const auto& term_detection = finalcut::FTerm::getFTermDetection();
auto& term_detection = finalcut::FTerm::getFTermDetection();
finalcut::FTermLinux linux;
term_detection->setLinuxTerm(true);
term_detection.setLinuxTerm(true);
pid_t pid = forkConEmu();
@ -2524,7 +2524,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
term_detection->detect();
term_detection.detect();
linux.init();
const auto& fsystem = finalcut::FTerm::getFSystem();
auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());
@ -2744,37 +2744,37 @@ void FTermLinuxTest::linuxFontTest()
std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(fsys);
std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
auto& encoding_list = data->getEncodingList();
auto& encoding_list = data.getEncodingList();
encoding_list["UTF-8"] = finalcut::Encoding::UTF8;
encoding_list["UTF8"] = finalcut::Encoding::UTF8;
encoding_list["VT100"] = finalcut::Encoding::VT100;
encoding_list["PC"] = finalcut::Encoding::PC;
encoding_list["ASCII"] = finalcut::Encoding::ASCII;
data->setTermEncoding(finalcut::Encoding::PC);
data->setBaudrate(38400);
data->setTermType("linux");
data->setTermFileName("/dev/tty2");
data.setTermEncoding(finalcut::Encoding::PC);
data.setBaudrate(38400);
data.setTermType("linux");
data.setTermFileName("/dev/tty2");
#if DEBUG
data->setFramebufferBpp(32);
data.setFramebufferBpp(32);
#endif
data->supportShadowCharacter (false);
data->supportHalfBlockCharacter (false);
data->supportCursorOptimisation (true);
data->setCursorHidden (true);
data->useAlternateScreen (false);
data->setASCIIConsole (true);
data->setVT100Console (false);
data->setUTF8Console (false);
data->setUTF8 (false);
data->setNewFont (false);
data->setVGAFont (false);
data->setMonochron (false);
data->setTermResized (false);
data.supportShadowCharacter (false);
data.supportHalfBlockCharacter (false);
data.supportCursorOptimisation (true);
data.setCursorHidden (true);
data.useAlternateScreen (false);
data.setASCIIConsole (true);
data.setVT100Console (false);
data.setUTF8Console (false);
data.setUTF8 (false);
data.setNewFont (false);
data.setVGAFont (false);
data.setMonochron (false);
data.setTermResized (false);
// setupterm is needed for tputs in ncurses >= 6.1
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
@ -2798,7 +2798,7 @@ void FTermLinuxTest::linuxFontTest()
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
term_detection->detect();
term_detection.detect();
linux.init();
const auto& fsystem = finalcut::FTerm::getFSystem();
auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());
@ -2807,8 +2807,8 @@ void FTermLinuxTest::linuxFontTest()
CPPUNIT_ASSERT ( ! linux.isVGAFontUsed() );
CPPUNIT_ASSERT ( ! linux.isNewFontUsed() );
linux.loadVGAFont();
CPPUNIT_ASSERT ( data->hasShadowCharacter() );
CPPUNIT_ASSERT ( data->hasHalfBlockCharacter() );
CPPUNIT_ASSERT ( data.hasShadowCharacter() );
CPPUNIT_ASSERT ( data.hasHalfBlockCharacter() );
CPPUNIT_ASSERT ( font.op == KD_FONT_OP_SET );
CPPUNIT_ASSERT ( linux.isVGAFontUsed() );
CPPUNIT_ASSERT ( ! linux.isNewFontUsed() );

View File

@ -344,38 +344,38 @@ void ftermopenbsdTest::netbsdConsoleTest()
std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(fsys);
std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
auto& encoding_list = data->getEncodingList();
auto& encoding_list = data.getEncodingList();
encoding_list["UTF-8"] = finalcut::Encoding::UTF8;
encoding_list["UTF8"] = finalcut::Encoding::UTF8;
encoding_list["VT100"] = finalcut::Encoding::VT100;
encoding_list["PC"] = finalcut::Encoding::PC;
encoding_list["ASCII"] = finalcut::Encoding::ASCII;
data->setTermEncoding(finalcut::Encoding::VT100);
data->setBaudrate(9600);
data->setTermType("wsvt25");
data->setTermFileName("/dev/ttyE1");
data->setTTYFileDescriptor(0);
data->supportShadowCharacter (false);
data->supportHalfBlockCharacter (false);
data->supportCursorOptimisation (true);
data->setCursorHidden (true);
data->useAlternateScreen (false);
data->setASCIIConsole (true);
data->setVT100Console (false);
data->setUTF8Console (false);
data->setUTF8 (false);
data->setNewFont (false);
data->setVGAFont (false);
data->setMonochron (false);
data->setTermResized (false);
data.setTermEncoding(finalcut::Encoding::VT100);
data.setBaudrate(9600);
data.setTermType("wsvt25");
data.setTermFileName("/dev/ttyE1");
data.setTTYFileDescriptor(0);
data.supportShadowCharacter (false);
data.supportHalfBlockCharacter (false);
data.supportCursorOptimisation (true);
data.setCursorHidden (true);
data.useAlternateScreen (false);
data.setASCIIConsole (true);
data.setVT100Console (false);
data.setUTF8Console (false);
data.setUTF8 (false);
data.setNewFont (false);
data.setVGAFont (false);
data.setMonochron (false);
data.setTermResized (false);
// setupterm is needed for tputs in ncurses >= 6.1
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
const auto& term_detection = finalcut::FTerm::getFTermDetection();
term_detection->setTerminalDetection(true);
auto& term_detection = finalcut::FTerm::getFTermDetection();
term_detection.setTerminalDetection(true);
pid_t pid = forkConEmu();
if ( isConEmuChildProcess(pid) )
@ -397,22 +397,22 @@ void ftermopenbsdTest::netbsdConsoleTest()
netbsd.disableMetaSendsEscape();
netbsd.init();
term_detection->detect();
term_detection.detect();
finalcut::FTerm::detectTermSize();
#if DEBUG
const finalcut::FString& sec_da = \
finalcut::FTerm::getFTermDebugData()->getSecDAString();
finalcut::FTerm::getFTermDebugData().getSecDAString();
CPPUNIT_ASSERT ( sec_da == "\033[>24;20;0c" );
#endif
CPPUNIT_ASSERT ( isatty(0) == 1 );
CPPUNIT_ASSERT ( ! term_detection->isOpenBSDTerm() );
CPPUNIT_ASSERT ( term_detection->isNetBSDTerm() );
CPPUNIT_ASSERT ( data->getTermGeometry().getWidth() == 80 );
CPPUNIT_ASSERT ( data->getTermGeometry().getHeight() == 25 );
CPPUNIT_ASSERT ( ! data->hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data->hasHalfBlockCharacter() );
CPPUNIT_ASSERT ( ! term_detection.isOpenBSDTerm() );
CPPUNIT_ASSERT ( term_detection.isNetBSDTerm() );
CPPUNIT_ASSERT ( data.getTermGeometry().getWidth() == 80 );
CPPUNIT_ASSERT ( data.getTermGeometry().getHeight() == 25 );
CPPUNIT_ASSERT ( ! data.hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data.hasHalfBlockCharacter() );
netbsd.finish();
@ -420,12 +420,12 @@ void ftermopenbsdTest::netbsdConsoleTest()
netbsd.init();
CPPUNIT_ASSERT ( isatty(0) == 1 );
CPPUNIT_ASSERT ( ! term_detection->isOpenBSDTerm() );
CPPUNIT_ASSERT ( term_detection->isNetBSDTerm() );
CPPUNIT_ASSERT ( data->getTermGeometry().getWidth() == 80 );
CPPUNIT_ASSERT ( data->getTermGeometry().getHeight() == 25 );
CPPUNIT_ASSERT ( ! data->hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data->hasHalfBlockCharacter() );
CPPUNIT_ASSERT ( ! term_detection.isOpenBSDTerm() );
CPPUNIT_ASSERT ( term_detection.isNetBSDTerm() );
CPPUNIT_ASSERT ( data.getTermGeometry().getWidth() == 80 );
CPPUNIT_ASSERT ( data.getTermGeometry().getHeight() == 25 );
CPPUNIT_ASSERT ( ! data.hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data.hasHalfBlockCharacter() );
netbsd.finish();
@ -448,38 +448,38 @@ void ftermopenbsdTest::openbsdConsoleTest()
std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(fsys);
std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData();
auto& data = finalcut::FTerm::getFTermData();
auto& encoding_list = data->getEncodingList();
auto& encoding_list = data.getEncodingList();
encoding_list["UTF-8"] = finalcut::Encoding::UTF8;
encoding_list["UTF8"] = finalcut::Encoding::UTF8;
encoding_list["VT100"] = finalcut::Encoding::VT100;
encoding_list["PC"] = finalcut::Encoding::PC;
encoding_list["ASCII"] = finalcut::Encoding::ASCII;
data->setTermEncoding(finalcut::Encoding::VT100);
data->setBaudrate(9600);
data->setTermType("vt220");
data->setTermFileName("/dev/ttyC0");
data->setTTYFileDescriptor(0);
data->supportShadowCharacter (false);
data->supportHalfBlockCharacter (false);
data->supportCursorOptimisation (true);
data->setCursorHidden (true);
data->useAlternateScreen (false);
data->setASCIIConsole (true);
data->setVT100Console (false);
data->setUTF8Console (false);
data->setUTF8 (false);
data->setNewFont (false);
data->setVGAFont (false);
data->setMonochron (false);
data->setTermResized (false);
data.setTermEncoding(finalcut::Encoding::VT100);
data.setBaudrate(9600);
data.setTermType("vt220");
data.setTermFileName("/dev/ttyC0");
data.setTTYFileDescriptor(0);
data.supportShadowCharacter (false);
data.supportHalfBlockCharacter (false);
data.supportCursorOptimisation (true);
data.setCursorHidden (true);
data.useAlternateScreen (false);
data.setASCIIConsole (true);
data.setVT100Console (false);
data.setUTF8Console (false);
data.setUTF8 (false);
data.setNewFont (false);
data.setVGAFont (false);
data.setMonochron (false);
data.setTermResized (false);
// setupterm is needed for tputs in ncurses >= 6.1
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
const auto& term_detection = finalcut::FTerm::getFTermDetection();
term_detection->setTerminalDetection(true);
auto& term_detection = finalcut::FTerm::getFTermDetection();
term_detection.setTerminalDetection(true);
pid_t pid = forkConEmu();
if ( isConEmuChildProcess(pid) )
@ -504,23 +504,23 @@ void ftermopenbsdTest::openbsdConsoleTest()
wskbd_bell_data& speaker = fsystest->getBell();
openbsd.disableMetaSendsEscape();
openbsd.init();
term_detection->detect();
term_detection.detect();
finalcut::FTerm::detectTermSize();
#if DEBUG
const finalcut::FString& sec_da = \
finalcut::FTerm::getFTermDebugData()->getSecDAString();
finalcut::FTerm::getFTermDebugData().getSecDAString();
CPPUNIT_ASSERT ( sec_da == "\033[>24;20;0c" );
#endif
CPPUNIT_ASSERT ( isatty(0) == 1 );
CPPUNIT_ASSERT ( term_detection->isOpenBSDTerm() );
CPPUNIT_ASSERT ( ! term_detection->isNetBSDTerm() );
CPPUNIT_ASSERT ( data->getTermGeometry().getWidth() == 80 );
CPPUNIT_ASSERT ( data->getTermGeometry().getHeight() == 25 );
CPPUNIT_ASSERT ( ! data->hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data->hasHalfBlockCharacter() );
CPPUNIT_ASSERT_CSTRING ( term_detection->getTermType(), "pccon" );
CPPUNIT_ASSERT ( term_detection.isOpenBSDTerm() );
CPPUNIT_ASSERT ( ! term_detection.isNetBSDTerm() );
CPPUNIT_ASSERT ( data.getTermGeometry().getWidth() == 80 );
CPPUNIT_ASSERT ( data.getTermGeometry().getHeight() == 25 );
CPPUNIT_ASSERT ( ! data.hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data.hasHalfBlockCharacter() );
CPPUNIT_ASSERT_CSTRING ( term_detection.getTermType(), "pccon" );
openbsd.finish();
@ -528,12 +528,12 @@ void ftermopenbsdTest::openbsdConsoleTest()
openbsd.init();
CPPUNIT_ASSERT ( isatty(0) == 1 );
CPPUNIT_ASSERT ( term_detection->isOpenBSDTerm() );
CPPUNIT_ASSERT ( ! term_detection->isNetBSDTerm() );
CPPUNIT_ASSERT ( data->getTermGeometry().getWidth() == 80 );
CPPUNIT_ASSERT ( data->getTermGeometry().getHeight() == 25 );
CPPUNIT_ASSERT ( ! data->hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data->hasHalfBlockCharacter() );
CPPUNIT_ASSERT ( term_detection.isOpenBSDTerm() );
CPPUNIT_ASSERT ( ! term_detection.isNetBSDTerm() );
CPPUNIT_ASSERT ( data.getTermGeometry().getWidth() == 80 );
CPPUNIT_ASSERT ( data.getTermGeometry().getHeight() == 25 );
CPPUNIT_ASSERT ( ! data.hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data.hasHalfBlockCharacter() );
CPPUNIT_ASSERT ( speaker.pitch == 1500 );
CPPUNIT_ASSERT ( speaker.period == 100 );