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> 2021-05-04 Markus Gans <guru.mail@muenster.de>
* Prevent flickering when resizing terminals or redrawing * Prevent flickering when resizing terminals or redrawing
the screen via ctrl-l the screen via ctrl-l

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * 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 * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * 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; std::cout << "\r" << line << std::flush;
// Generation of a logger in a shared_ptr via a pointer // Generation of a logger in a shared_ptr via a pointer
finalcut::FApplication::setLog(std::make_shared<DirectLogger>()); 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); finalcut::printDurations(opti_move);
// Waiting for keypress // 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) void debug (const finalcut::FApplication& TermApp)
{ {
const auto& fterm = TermApp.getFTerm(); const auto& fterm = TermApp.getFTerm();
const auto& debug_data = fterm.getFTermDebugData(); auto& debug_data = fterm.getFTermDebugData();
const finalcut::FString& ab_s = debug_data->getAnswerbackString(); const auto& ab_s = debug_data.getAnswerbackString();
const finalcut::FString& sec_da = debug_data->getSecDAString(); const auto& sec_da = debug_data.getSecDAString();
std::cout << "\n.------------------- debug -------------------\r\n"; std::cout << "\n.------------------- debug -------------------\r\n";
#if defined(__linux__) #if defined(__linux__)
std::cout << "| Framebuffer bpp: " std::cout << "| Framebuffer bpp: "
<< debug_data->getFramebufferBpp() << "\r\n"; << debug_data.getFramebufferBpp() << "\r\n";
#endif #endif
std::cout << "| after init_256colorTerminal(): " std::cout << "| after init_256colorTerminal(): "
<< debug_data->getTermType_256color() << "\r\n"; << debug_data.getTermType_256color() << "\r\n";
std::cout << "| after parseAnswerbackMsg(): " std::cout << "| after parseAnswerbackMsg(): "
<< debug_data->getTermType_Answerback() << "\r\n"; << debug_data.getTermType_Answerback() << "\r\n";
std::cout << "| after parseSecDA(): " std::cout << "| after parseSecDA(): "
<< debug_data->getTermType_SecDA() << "\r\n"; << debug_data.getTermType_SecDA() << "\r\n";
if ( ! ab_s.isEmpty() ) if ( ! ab_s.isEmpty() )
tcapString ("| The answerback String", ab_s.c_str()); tcapString ("| The answerback String", ab_s.c_str());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * 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 * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -61,9 +61,9 @@ bool FTermFreeBSD::setCursorStyle (CursorStyle style)
return false; return false;
cursor_style = style; 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 false;
return setFreeBSDCursorStyle(style); return setFreeBSDCursorStyle(style);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -122,46 +122,46 @@ void FTermcapTest::classNameTest()
void FTermcapTest::initTest() void FTermcapTest::initTest()
{ {
// Without a terminal type // Without a terminal type
const auto& fterm_data = finalcut::FTerm::getFTermData(); auto& fterm_data = finalcut::FTerm::getFTermData();
CPPUNIT_ASSERT ( fterm_data->getTermType().empty() ); CPPUNIT_ASSERT ( fterm_data.getTermType().empty() );
finalcut::FTermcap tcap; finalcut::FTermcap tcap;
CPPUNIT_ASSERT ( ! tcap.isInitialized() ); CPPUNIT_ASSERT ( ! tcap.isInitialized() );
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() ); CPPUNIT_ASSERT ( tcap.isInitialized() );
CPPUNIT_ASSERT ( ! fterm_data->getTermType().empty() ); CPPUNIT_ASSERT ( ! fterm_data.getTermType().empty() );
CPPUNIT_ASSERT ( fterm_data->getTermType() == "xterm" ); CPPUNIT_ASSERT ( fterm_data.getTermType() == "xterm" );
// With terminal type ansi // With terminal type ansi
fterm_data->setTermType("ansi"); fterm_data.setTermType("ansi");
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( fterm_data->getTermType() == "ansi" ); CPPUNIT_ASSERT ( fterm_data.getTermType() == "ansi" );
// With a non-existent terminal type // With a non-existent terminal type
fterm_data->setTermType("bang!"); fterm_data.setTermType("bang!");
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( fterm_data->getTermType() == "xterm" ); CPPUNIT_ASSERT ( fterm_data.getTermType() == "xterm" );
setenv ("TERM", "xterm-256color", 1); // 256 color terminal setenv ("TERM", "xterm-256color", 1); // 256 color terminal
const auto& term_detection = finalcut::FTerm::getFTermDetection(); auto& term_detection = finalcut::FTerm::getFTermDetection();
CPPUNIT_ASSERT ( ! term_detection->canDisplay256Colors() ); CPPUNIT_ASSERT ( ! term_detection.canDisplay256Colors() );
term_detection->detect(); term_detection.detect();
CPPUNIT_ASSERT ( term_detection->canDisplay256Colors() ); CPPUNIT_ASSERT ( term_detection.canDisplay256Colors() );
fterm_data->setTermType("bang!"); fterm_data.setTermType("bang!");
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( fterm_data->getTermType() == "xterm-256color" ); CPPUNIT_ASSERT ( fterm_data.getTermType() == "xterm-256color" );
fterm_data->setTermType("dumb"); fterm_data.setTermType("dumb");
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( fterm_data->getTermType() == "dumb" ); CPPUNIT_ASSERT ( fterm_data.getTermType() == "dumb" );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapTest::getFlagTest() void FTermcapTest::getFlagTest()
{ {
const auto& fterm_data = finalcut::FTerm::getFTermData(); auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("ansi"); fterm_data.setTermType("ansi");
finalcut::FTermcap tcap; finalcut::FTermcap tcap;
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() ); 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("am") ); // Automatic right margin
CPPUNIT_ASSERT ( ! tcap.getFlag("cc") ); // Can change color palette CPPUNIT_ASSERT ( ! tcap.getFlag("cc") ); // Can change color palette
@ -171,12 +171,12 @@ void FTermcapTest::getFlagTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapTest::getNumberTest() void FTermcapTest::getNumberTest()
{ {
const auto& fterm_data = finalcut::FTerm::getFTermData(); auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("xterm"); fterm_data.setTermType("xterm");
finalcut::FTermcap tcap; finalcut::FTermcap tcap;
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() ); 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("Co") == 8 ); // Colors
CPPUNIT_ASSERT ( tcap.getNumber("it") == 8 ); // Tab stop CPPUNIT_ASSERT ( tcap.getNumber("it") == 8 ); // Tab stop
@ -188,12 +188,12 @@ void FTermcapTest::getNumberTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapTest::getStringTest() void FTermcapTest::getStringTest()
{ {
const auto& fterm_data = finalcut::FTerm::getFTermData(); auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("ansi"); fterm_data.setTermType("ansi");
finalcut::FTermcap tcap; finalcut::FTermcap tcap;
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() ); 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("me"), CSI "0m" ); // Exit attribute mode
CPPUNIT_ASSERT_CSTRING ( tcap.getString("mr"), CSI "7m" ); // Enter reverse mode CPPUNIT_ASSERT_CSTRING ( tcap.getString("mr"), CSI "7m" ); // Enter reverse mode
@ -206,12 +206,12 @@ void FTermcapTest::getStringTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapTest::encodeMotionParameterTest() void FTermcapTest::encodeMotionParameterTest()
{ {
const auto& fterm_data = finalcut::FTerm::getFTermData(); auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("ansi"); fterm_data.setTermType("ansi");
finalcut::FTermcap tcap; finalcut::FTermcap tcap;
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() ); CPPUNIT_ASSERT ( tcap.isInitialized() );
CPPUNIT_ASSERT ( fterm_data->getTermType() == "ansi" ); CPPUNIT_ASSERT ( fterm_data.getTermType() == "ansi" );
const auto& cursor_address = tcap.getString("cm"); const auto& cursor_address = tcap.getString("cm");
CPPUNIT_ASSERT ( tcap.encodeMotionParameter(cursor_address, 10, 15) == CSI "16;11H" ); CPPUNIT_ASSERT ( tcap.encodeMotionParameter(cursor_address, 10, 15) == CSI "16;11H" );
CPPUNIT_ASSERT ( tcap.encodeMotionParameter(cursor_address, 25, 1) == CSI "2;26H" ); CPPUNIT_ASSERT ( tcap.encodeMotionParameter(cursor_address, 25, 1) == CSI "2;26H" );
@ -222,12 +222,12 @@ void FTermcapTest::encodeMotionParameterTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapTest::encodeParameterTest() void FTermcapTest::encodeParameterTest()
{ {
const auto& fterm_data = finalcut::FTerm::getFTermData(); auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("ansi"); fterm_data.setTermType("ansi");
finalcut::FTermcap tcap; finalcut::FTermcap tcap;
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() ); CPPUNIT_ASSERT ( tcap.isInitialized() );
CPPUNIT_ASSERT ( fterm_data->getTermType() == "ansi" ); CPPUNIT_ASSERT ( fterm_data.getTermType() == "ansi" );
const auto& parm_insert_line = tcap.getString("AL"); const auto& parm_insert_line = tcap.getString("AL");
CPPUNIT_ASSERT ( tcap.encodeParameter(parm_insert_line, 7) == CSI "7L" ); CPPUNIT_ASSERT ( tcap.encodeParameter(parm_insert_line, 7) == CSI "7L" );
const auto& parm_left_cursor = tcap.getString("LE"); const auto& parm_left_cursor = tcap.getString("LE");
@ -249,7 +249,7 @@ void FTermcapTest::paddingPrintTest()
setenv ("TERM", "xterm", 1); // xterm has no padding character setenv ("TERM", "xterm", 1); // xterm has no padding character
unsetenv("TERMCAP"); unsetenv("TERMCAP");
auto& fterm_data = finalcut::FTerm::getFTermData(); auto& fterm_data = finalcut::FTerm::getFTermData();
fterm_data->setTermType("xterm"); fterm_data.setTermType("xterm");
CPPUNIT_ASSERT ( ! tcap.xon_xoff_flow_control ); CPPUNIT_ASSERT ( ! tcap.xon_xoff_flow_control );
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( tcap.isInitialized() ); CPPUNIT_ASSERT ( tcap.isInitialized() );
@ -347,7 +347,7 @@ void FTermcapTest::paddingPrintTest()
// With 5 ms prints 21 padding chars ('\0') // With 5 ms prints 21 padding chars ('\0')
setenv ("TERM", "ansi", 1); // ansi terminals used for delay padding character setenv ("TERM", "ansi", 1); // ansi terminals used for delay padding character
fterm_data->setTermType("ansi"); fterm_data.setTermType("ansi");
tcap.init(); tcap.init();
CPPUNIT_ASSERT ( ! tcap.no_padding_char ); CPPUNIT_ASSERT ( ! tcap.no_padding_char );
CPPUNIT_ASSERT ( ! tcap.xon_xoff_flow_control ); 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++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection(); auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermcap::can_change_color_palette = false; finalcut::FTermcap::can_change_color_palette = false;
detect.setXTerminal (true); detect.setXTerminal (true);
@ -324,8 +324,8 @@ void FTermcapQuirksTest::freebsdTest()
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection(); auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::attr_without_color = -1; finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
detect.setFreeBSDTerm (true); detect.setFreeBSDTerm (true);
@ -363,8 +363,8 @@ void FTermcapQuirksTest::cygwinTest()
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection(); auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::background_color_erase = false; finalcut::FTermcap::background_color_erase = false;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
detect.setCygwinTerminal (true); detect.setCygwinTerminal (true);
@ -388,8 +388,8 @@ void FTermcapQuirksTest::linuxTest()
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection(); auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::max_color = 8; finalcut::FTermcap::max_color = 8;
finalcut::FTermcap::attr_without_color = -1; finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
@ -460,8 +460,8 @@ void FTermcapQuirksTest::rxvtTest()
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection(); auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
detect.setRxvtTerminal (true); detect.setRxvtTerminal (true);
data.setTermType ("rxvt"); data.setTermType ("rxvt");
@ -501,8 +501,8 @@ void FTermcapQuirksTest::vteTest()
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection(); auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::attr_without_color = -1; finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
detect.setGnomeTerminal (true); detect.setGnomeTerminal (true);
@ -515,6 +515,7 @@ void FTermcapQuirksTest::vteTest()
detect.setGnomeTerminal (false); detect.setGnomeTerminal (false);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::kittyTest() 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_enter_ca_mode)].string = CSI "?1049h";
caps[int(finalcut::Termcap::t_exit_ca_mode)].string = CSI "?1049l"; caps[int(finalcut::Termcap::t_exit_ca_mode)].string = CSI "?1049l";
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection(); auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
detect.setKittyTerminal (true); detect.setKittyTerminal (true);
data.setTermType ("xterm-kitty"); data.setTermType ("xterm-kitty");
@ -550,8 +551,8 @@ void FTermcapQuirksTest::puttyTest()
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection(); auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::background_color_erase = false; finalcut::FTermcap::background_color_erase = false;
finalcut::FTermcap::can_change_color_palette = false; finalcut::FTermcap::can_change_color_palette = false;
finalcut::FTermcap::osc_support = false; finalcut::FTermcap::osc_support = false;
@ -640,8 +641,8 @@ void FTermcapQuirksTest::teratermTest()
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection(); auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::eat_nl_glitch = false; finalcut::FTermcap::eat_nl_glitch = false;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
detect.setTeraTerm (true); detect.setTeraTerm (true);
@ -670,8 +671,8 @@ void FTermcapQuirksTest::sunTest()
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection(); auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::eat_nl_glitch = false; finalcut::FTermcap::eat_nl_glitch = false;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
detect.setSunTerminal (true); detect.setSunTerminal (true);
@ -788,8 +789,8 @@ void FTermcapQuirksTest::screenTest()
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); auto& data = finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection(); auto& detect = finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermcap::can_change_color_palette = false; finalcut::FTermcap::can_change_color_palette = false;
detect.setScreenTerm (true); detect.setScreenTerm (true);

View File

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

View File

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

View File

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

View File

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