Using smart pointers for global objects
This commit is contained in:
parent
7868a0dee9
commit
4517038521
|
@ -122,7 +122,7 @@ class Calc final : public finalcut::FDialog
|
|||
|
||||
private:
|
||||
// Typedef and Enumeration
|
||||
typedef std::function<void(lDouble&)> keyFunction; // Member function
|
||||
using keyFunction = std::function<void(lDouble&)>; // Member function
|
||||
|
||||
enum button
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ class EventDialog final : public finalcut::FDialog
|
|||
EventDialog (const EventDialog&) = delete;
|
||||
|
||||
// Destructor
|
||||
~EventDialog() override;
|
||||
~EventDialog() noexcept override;
|
||||
|
||||
// Disable copy assignment operator (=)
|
||||
EventDialog& operator = (const EventDialog&) = delete;
|
||||
|
@ -99,8 +99,7 @@ EventDialog::EventDialog (finalcut::FWidget* parent)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
EventDialog::~EventDialog() // destructor
|
||||
{ }
|
||||
EventDialog::~EventDialog() noexcept = default; // destructor
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
finalcut::FString EventDialog::getMouseButtonName (int btn_state) const
|
||||
|
@ -245,7 +244,7 @@ class EventLog final : public finalcut::FDialog, public std::ostringstream
|
|||
EventLog (const EventLog&) = delete;
|
||||
|
||||
// Destructor
|
||||
~EventLog() override;
|
||||
~EventLog() noexcept override;
|
||||
|
||||
// Disable copy assignment operator (=)
|
||||
EventLog& operator = (const EventLog&) = delete;
|
||||
|
@ -282,8 +281,7 @@ EventLog::EventLog (finalcut::FWidget* parent)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
EventLog::~EventLog() // destructor
|
||||
{ }
|
||||
EventLog::~EventLog() noexcept = default; // destructor
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void EventLog::onTimer (finalcut::FTimerEvent*)
|
||||
|
|
|
@ -50,7 +50,7 @@ void doubleToItem ( FListBoxItem& item
|
|||
, FDataAccess* container
|
||||
, std::size_t index )
|
||||
{
|
||||
typedef std::list<double> DblList;
|
||||
using DblList = std::list<double>;
|
||||
DblList& dbl_list = flistboxhelper::getContainer<DblList>(container);
|
||||
std::list<double>::iterator iter = dbl_list.begin();
|
||||
std::advance (iter, index);
|
||||
|
|
|
@ -136,10 +136,10 @@ class DirectLogger final : public finalcut::FLog
|
|||
{
|
||||
public:
|
||||
// Constructor
|
||||
DirectLogger();
|
||||
DirectLogger() = default;
|
||||
|
||||
// Destructor
|
||||
~DirectLogger() override;
|
||||
~DirectLogger() noexcept override;
|
||||
|
||||
void info (const std::string& entry) override
|
||||
{
|
||||
|
@ -194,12 +194,7 @@ class DirectLogger final : public finalcut::FLog
|
|||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
DirectLogger::DirectLogger() // constructor
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
DirectLogger::~DirectLogger() // destructor
|
||||
{ }
|
||||
DirectLogger::~DirectLogger() noexcept = default; // destructor
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -212,22 +212,22 @@ void tcapString (const std::string& name, const char cap_str[])
|
|||
void debug (const finalcut::FApplication& TermApp)
|
||||
{
|
||||
const auto& fterm = TermApp.getFTerm();
|
||||
auto& debug_data = fterm.getFTermDebugData();
|
||||
const finalcut::FString& ab_s = debug_data.getAnswerbackString();
|
||||
const finalcut::FString& sec_da = debug_data.getSecDAString();
|
||||
const auto& debug_data = fterm.getFTermDebugData();
|
||||
const finalcut::FString& ab_s = debug_data->getAnswerbackString();
|
||||
const finalcut::FString& sec_da = debug_data->getSecDAString();
|
||||
std::cout << "\n.------------------- debug -------------------\r\n";
|
||||
|
||||
#if defined(__linux__)
|
||||
std::cout << "| Framebuffer bpp: "
|
||||
<< debug_data.getFramebufferBpp() << "\r\n";
|
||||
<< debug_data->getFramebufferBpp() << "\r\n";
|
||||
#endif
|
||||
|
||||
std::cout << "| after init_256colorTerminal(): "
|
||||
<< debug_data.getTermType_256color() << "\r\n";
|
||||
<< debug_data->getTermType_256color() << "\r\n";
|
||||
std::cout << "| after parseAnswerbackMsg(): "
|
||||
<< debug_data.getTermType_Answerback() << "\r\n";
|
||||
<< debug_data->getTermType_Answerback() << "\r\n";
|
||||
std::cout << "| after parseSecDA(): "
|
||||
<< debug_data.getTermType_SecDA() << "\r\n";
|
||||
<< debug_data->getTermType_SecDA() << "\r\n";
|
||||
|
||||
if ( ! ab_s.isEmpty() )
|
||||
tcapString ("| The answerback String", ab_s.c_str());
|
||||
|
|
|
@ -161,12 +161,12 @@ class Treeview final : public finalcut::FDialog
|
|||
struct TreeItem; // forward declaration
|
||||
|
||||
// Methods
|
||||
auto initAfrica() -> std::initializer_list<TreeItem>;
|
||||
auto initAsia() -> std::initializer_list<TreeItem>;
|
||||
auto initEurope() -> std::initializer_list<TreeItem>;
|
||||
auto initNorthAmerica() -> std::initializer_list<TreeItem>;
|
||||
auto initSouthAmerica() -> std::initializer_list<TreeItem>;
|
||||
auto initOceania() -> std::initializer_list<TreeItem>;
|
||||
auto initAfrica() -> std::initializer_list<TreeItem> const;
|
||||
auto initAsia() -> std::initializer_list<TreeItem> const;
|
||||
auto initEurope() -> std::initializer_list<TreeItem> const;
|
||||
auto initNorthAmerica() -> std::initializer_list<TreeItem> const;
|
||||
auto initSouthAmerica() -> std::initializer_list<TreeItem> const;
|
||||
auto initOceania() -> std::initializer_list<TreeItem> const;
|
||||
void adjustSize() override;
|
||||
|
||||
// Event handler
|
||||
|
@ -275,7 +275,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
auto Treeview::initAfrica() -> std::initializer_list<Treeview::TreeItem>
|
||||
auto Treeview::initAfrica() -> std::initializer_list<Treeview::TreeItem> const
|
||||
{
|
||||
static const auto list = std::initializer_list<Treeview::TreeItem>
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ auto Treeview::initAfrica() -> std::initializer_list<Treeview::TreeItem>
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
auto Treeview::initAsia() -> std::initializer_list<Treeview::TreeItem>
|
||||
auto Treeview::initAsia() -> std::initializer_list<Treeview::TreeItem> const
|
||||
{
|
||||
static const auto list = std::initializer_list<Treeview::TreeItem>
|
||||
{
|
||||
|
@ -334,7 +334,7 @@ auto Treeview::initAsia() -> std::initializer_list<Treeview::TreeItem>
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
auto Treeview::initEurope() -> std::initializer_list<Treeview::TreeItem>
|
||||
auto Treeview::initEurope() -> std::initializer_list<Treeview::TreeItem> const
|
||||
{
|
||||
static const auto list = std::initializer_list<Treeview::TreeItem>
|
||||
{
|
||||
|
@ -362,7 +362,7 @@ auto Treeview::initEurope() -> std::initializer_list<Treeview::TreeItem>
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
auto Treeview::initNorthAmerica() -> std::initializer_list<Treeview::TreeItem>
|
||||
auto Treeview::initNorthAmerica() -> std::initializer_list<Treeview::TreeItem> const
|
||||
{
|
||||
static const auto list = std::initializer_list<Treeview::TreeItem>
|
||||
{
|
||||
|
@ -379,7 +379,7 @@ auto Treeview::initNorthAmerica() -> std::initializer_list<Treeview::TreeItem>
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
auto Treeview::initSouthAmerica() -> std::initializer_list<Treeview::TreeItem>
|
||||
auto Treeview::initSouthAmerica() -> std::initializer_list<Treeview::TreeItem> const
|
||||
{
|
||||
static const auto list = std::initializer_list<Treeview::TreeItem>
|
||||
{
|
||||
|
@ -398,7 +398,7 @@ auto Treeview::initSouthAmerica() -> std::initializer_list<Treeview::TreeItem>
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
auto Treeview::initOceania() -> std::initializer_list<Treeview::TreeItem>
|
||||
auto Treeview::initOceania() -> std::initializer_list<Treeview::TreeItem> const
|
||||
{
|
||||
static const auto list = std::initializer_list<Treeview::TreeItem>
|
||||
{
|
||||
|
|
|
@ -68,8 +68,6 @@ FWidget* FWidget::clicked_widget {nullptr}; // is focused by click
|
|||
FWidget* FWidget::open_menu {nullptr}; // currently open menu
|
||||
FWidget* FWidget::move_size_widget {nullptr}; // move/size by keyboard
|
||||
FWidget* FApplication::keyboard_widget {nullptr}; // has the keyboard focus
|
||||
FKeyboard* FApplication::keyboard {nullptr}; // keyboard access
|
||||
FMouseControl* FApplication::mouse {nullptr}; // mouse control
|
||||
int FApplication::loop_level {0}; // event loop level
|
||||
int FApplication::quit_code {EXIT_SUCCESS};
|
||||
bool FApplication::quit_now {false};
|
||||
|
@ -93,8 +91,8 @@ FApplication::FApplication (const int& _argc, char* _argv[])
|
|||
|
||||
if ( internal::var::app_object )
|
||||
{
|
||||
auto ftermdata = FTerm::getFTermData();
|
||||
ftermdata->setExitMessage("FApplication: There should be "
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
fterm_data->setExitMessage("FApplication: There should be "
|
||||
"only one application object");
|
||||
FApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
|
@ -105,7 +103,7 @@ FApplication::FApplication (const int& _argc, char* _argv[])
|
|||
|
||||
if ( ! (_argc && _argv) )
|
||||
{
|
||||
typedef char* CString;
|
||||
using CString = char*;
|
||||
static std::array<CString, 1> empty{{CString("")}};
|
||||
app_argc = 0;
|
||||
app_argv = empty.data();
|
||||
|
@ -350,8 +348,8 @@ void FApplication::setLogFile (const FString& filename)
|
|||
}
|
||||
else
|
||||
{
|
||||
auto ftermdata = FTerm::getFTermData();
|
||||
ftermdata->setExitMessage ( "Could not open log file \""
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
fterm_data->setExitMessage ( "Could not open log file \""
|
||||
+ filename + "\"" );
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -405,11 +403,7 @@ void FApplication::init()
|
|||
time_last_event.tv_usec = 0;
|
||||
|
||||
// Initialize keyboard
|
||||
keyboard = FTerm::getFKeyboard();
|
||||
|
||||
|
||||
if ( keyboard )
|
||||
{
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
auto cmd1 = std::bind(&FApplication::keyPressed, this);
|
||||
auto cmd2 = std::bind(&FApplication::keyReleased, this);
|
||||
auto cmd3 = std::bind(&FApplication::escapeKeyPressed, this);
|
||||
|
@ -424,13 +418,9 @@ void FApplication::init()
|
|||
keyboard->setMouseTrackingCommand (key_cmd4);
|
||||
// Set the keyboard keypress timeout
|
||||
keyboard->setKeypressTimeout (key_timeout);
|
||||
}
|
||||
|
||||
// Initialize mouse control
|
||||
mouse = FTerm::getFMouseControl();
|
||||
|
||||
if ( mouse )
|
||||
{
|
||||
const auto& mouse = FTerm::getFMouseControl();
|
||||
using namespace std::placeholders;
|
||||
auto cmd = std::bind(&FApplication::mouseEvent, this, _1);
|
||||
FMouseCommand mouse_cmd (cmd);
|
||||
|
@ -439,7 +429,6 @@ void FApplication::init()
|
|||
mouse->setStdinNo (FTermios::getStdIn());
|
||||
// Set the default double click interval
|
||||
mouse->setDblclickInterval (dblclick_interval);
|
||||
}
|
||||
|
||||
// Initialize logging
|
||||
if ( ! getStartOptions().logfile_stream.is_open() )
|
||||
|
@ -463,8 +452,8 @@ void FApplication::setTerminalEncoding (const FString& enc_str)
|
|||
showParameterUsage();
|
||||
else
|
||||
{
|
||||
auto ftermdata = FTerm::getFTermData();
|
||||
ftermdata->setExitMessage ( "Unknown encoding \"" + enc_str
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
fterm_data->setExitMessage ( "Unknown encoding \"" + enc_str
|
||||
+ "\"\n(Valid encodings are utf8, "
|
||||
+ "vt100, pc and ascii)" );
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -665,7 +654,10 @@ inline void FApplication::findKeyboardWidget() const
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FApplication::isKeyPressed() const
|
||||
{
|
||||
if ( mouse && mouse->isGpmMouseEnabled() )
|
||||
const auto& mouse = FTerm::getFMouseControl();
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
|
||||
if ( mouse->isGpmMouseEnabled() )
|
||||
return mouse->getGpmKeyPressed(keyboard->hasUnprocessedInput());
|
||||
|
||||
return (keyboard->isKeyPressed() || keyboard->hasPendingInput());
|
||||
|
@ -698,6 +690,8 @@ void FApplication::mouseTracking() const
|
|||
//----------------------------------------------------------------------
|
||||
inline void FApplication::performKeyboardAction()
|
||||
{
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
|
||||
if ( keyboard->getKey() == fc::Fckey_l ) // Ctrl-L (redraw the screen)
|
||||
{
|
||||
redraw();
|
||||
|
@ -715,9 +709,8 @@ inline void FApplication::performKeyboardAction()
|
|||
//----------------------------------------------------------------------
|
||||
inline void FApplication::performMouseAction() const
|
||||
{
|
||||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
const auto& mouse = FTerm::getFMouseControl();
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
auto& buffer = keyboard->getKeyBuffer();
|
||||
|
||||
switch ( keyboard->getKey() )
|
||||
|
@ -768,6 +761,7 @@ inline void FApplication::sendEscapeKeyPressEvent() const
|
|||
inline bool FApplication::sendKeyDownEvent (FWidget* widget) const
|
||||
{
|
||||
// Send key down event
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
FKeyEvent k_down_ev (fc::KeyDown_Event, keyboard->getKey());
|
||||
sendEvent (widget, &k_down_ev);
|
||||
return k_down_ev.isAccepted();
|
||||
|
@ -777,6 +771,7 @@ inline bool FApplication::sendKeyDownEvent (FWidget* widget) const
|
|||
inline bool FApplication::sendKeyPressEvent (FWidget* widget) const
|
||||
{
|
||||
// Send key press event
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
FKeyEvent k_press_ev (fc::KeyPress_Event, keyboard->getKey());
|
||||
sendEvent (widget, &k_press_ev);
|
||||
return k_press_ev.isAccepted();
|
||||
|
@ -786,6 +781,7 @@ inline bool FApplication::sendKeyPressEvent (FWidget* widget) const
|
|||
inline bool FApplication::sendKeyUpEvent (FWidget* widget) const
|
||||
{
|
||||
// Send key up event
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
FKeyEvent k_up_ev (fc::KeyUp_Event, keyboard->getKey());
|
||||
sendEvent (widget, &k_up_ev);
|
||||
return k_up_ev.isAccepted();
|
||||
|
@ -822,9 +818,12 @@ inline void FApplication::sendKeyboardAccelerator()
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FApplication::hasDataInQueue() const
|
||||
{
|
||||
if ( keyboard && keyboard->hasDataInQueue() )
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
const auto& mouse = FTerm::getFMouseControl();
|
||||
|
||||
if ( keyboard->hasDataInQueue() )
|
||||
return true;
|
||||
else if ( mouse && mouse->hasDataInQueue() )
|
||||
else if ( mouse->hasDataInQueue() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -833,10 +832,11 @@ inline bool FApplication::hasDataInQueue() const
|
|||
//----------------------------------------------------------------------
|
||||
void FApplication::queuingKeyboardInput() const
|
||||
{
|
||||
if ( quit_now || internal::var::exit_loop || ! keyboard )
|
||||
if ( quit_now || internal::var::exit_loop )
|
||||
return;
|
||||
|
||||
findKeyboardWidget();
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
keyboard->escapeKeyHandling(); // special case: Esc key
|
||||
keyboard->clearKeyBufferOnTimeout();
|
||||
|
||||
|
@ -847,10 +847,12 @@ void FApplication::queuingKeyboardInput() const
|
|||
//----------------------------------------------------------------------
|
||||
void FApplication::queuingMouseInput() const
|
||||
{
|
||||
if ( quit_now || internal::var::exit_loop
|
||||
|| ! mouse || ! mouse->hasData() )
|
||||
const auto& mouse = FTerm::getFMouseControl();
|
||||
|
||||
if ( quit_now || internal::var::exit_loop || ! mouse->hasData() )
|
||||
return;
|
||||
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
struct timeval* time_keypressed = keyboard->getKeyPressedTime();
|
||||
mouse->processEvent (time_keypressed);
|
||||
keyboard->hasUnprocessedInput() = mouse->hasUnprocessedInput();
|
||||
|
@ -860,24 +862,27 @@ void FApplication::queuingMouseInput() const
|
|||
//----------------------------------------------------------------------
|
||||
void FApplication::processKeyboardEvent() const
|
||||
{
|
||||
if ( quit_now || internal::var::exit_loop || ! keyboard )
|
||||
if ( quit_now || internal::var::exit_loop )
|
||||
return;
|
||||
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
keyboard->processQueuedInput();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FApplication::processMouseEvent() const
|
||||
{
|
||||
if ( quit_now || internal::var::exit_loop || ! mouse )
|
||||
if ( quit_now || internal::var::exit_loop )
|
||||
return;
|
||||
|
||||
mouse->processQueuedInput();
|
||||
FTerm::getFMouseControl()->processQueuedInput();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FApplication::processDialogSwitchAccelerator() const
|
||||
{
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
|
||||
if ( keyboard->getKey() >= fc::Fmkey_1
|
||||
&& keyboard->getKey() <= fc::Fmkey_9 )
|
||||
{
|
||||
|
@ -914,7 +919,7 @@ bool FApplication::processAccelerator (const FWidget& widget) const
|
|||
|
||||
for (auto&& item : widget.getAcceleratorList())
|
||||
{
|
||||
if ( item.key == keyboard->getKey() )
|
||||
if ( item.key == FTerm::getFKeyboard()->getKey() )
|
||||
{
|
||||
// unset the move/size mode
|
||||
auto move_size = getMoveSizeWidget();
|
||||
|
@ -1244,12 +1249,9 @@ void FApplication::processResizeEvent() const
|
|||
if ( ! FTerm::hasChangedTermSize() )
|
||||
return;
|
||||
|
||||
if ( mouse )
|
||||
{
|
||||
const auto& mouse = FTerm::getFMouseControl();
|
||||
mouse->setMaxWidth (uInt16(getDesktopWidth()));
|
||||
mouse->setMaxHeight (uInt16(getDesktopHeight()));
|
||||
}
|
||||
|
||||
FResizeEvent r_ev(fc::Resize_Event);
|
||||
sendEvent(internal::var::app_object, &r_ev);
|
||||
|
||||
|
|
|
@ -39,8 +39,7 @@ FBusyIndicator::FBusyIndicator (FWidget* parent)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FBusyIndicator::~FBusyIndicator() // destructor
|
||||
{ }
|
||||
FBusyIndicator::~FBusyIndicator() noexcept = default; // destructor
|
||||
|
||||
|
||||
// public methods of FBusyIndicator
|
||||
|
|
|
@ -374,7 +374,7 @@ void FButtonGroup::drawLabel()
|
|||
else
|
||||
FWidget::setPrintPos (FPoint{0, 1});
|
||||
|
||||
drawText (std::move(label_text), hotkeypos);
|
||||
drawText (label_text, hotkeypos);
|
||||
setViewportPrint();
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ void FButtonGroup::init()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::drawText ( FString&& label_text
|
||||
void FButtonGroup::drawText ( const FString& label_text
|
||||
, std::size_t hotkeypos )
|
||||
{
|
||||
const auto& wc = getColorTheme();
|
||||
|
|
|
@ -29,16 +29,6 @@ namespace finalcut
|
|||
// class FCallback
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FCallback::FCallback()
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FCallback::~FCallback() // destructor
|
||||
{ }
|
||||
|
||||
|
||||
// public methods of FCallback
|
||||
//----------------------------------------------------------------------
|
||||
void FCallback::delCallback (const FString& cb_signal)
|
||||
|
|
|
@ -36,8 +36,7 @@ FColorPalette::FColorPalette (const FSetPalette& f)
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FColorPalette::~FColorPalette() // destructor
|
||||
{ }
|
||||
FColorPalette::~FColorPalette() noexcept = default; // destructor
|
||||
|
||||
|
||||
// protected methods of FColorPalette
|
||||
|
@ -79,8 +78,8 @@ default8ColorPalette::default8ColorPalette (const FSetPalette& f)
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
default8ColorPalette::~default8ColorPalette()
|
||||
{ }
|
||||
default8ColorPalette::~default8ColorPalette() noexcept = default; // destructor
|
||||
|
||||
|
||||
// public methods of default8ColorPalette
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -123,8 +122,8 @@ default16ColorPalette::default16ColorPalette (const FSetPalette& f)
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
default16ColorPalette::~default16ColorPalette()
|
||||
{ }
|
||||
default16ColorPalette::~default16ColorPalette() noexcept = default; // destructor
|
||||
|
||||
|
||||
// public methods of default16ColorPalette
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -166,8 +165,8 @@ default16DarkColorPalette::default16DarkColorPalette (const FSetPalette& f)
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
default16DarkColorPalette::~default16DarkColorPalette()
|
||||
{ }
|
||||
default16DarkColorPalette::~default16DarkColorPalette() noexcept = default; // destructor
|
||||
|
||||
|
||||
// public methods of default16DarkColorPalette
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -31,12 +31,7 @@ namespace finalcut
|
|||
|
||||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FDataAccess::FDataAccess()
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FDataAccess::~FDataAccess() // destructor
|
||||
{ }
|
||||
FDataAccess::~FDataAccess() noexcept = default; // destructor
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
|
|
|
@ -623,7 +623,7 @@ void FDialog::onMouseMove (FMouseEvent* ev)
|
|||
|
||||
// Mouse event handover to the menu
|
||||
if ( ms.mouse_over_menu )
|
||||
passEventToSubMenu (ms, std::move(*ev));
|
||||
passEventToSubMenu (ms, *ev);
|
||||
|
||||
leaveZoomButton(ms); // Check zoom button pressed
|
||||
resizeMouseUpMove(ms); // Resize the dialog
|
||||
|
@ -1361,7 +1361,7 @@ inline bool FDialog::isMouseOverMenu (const FPoint& termpos) const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FDialog::passEventToSubMenu ( const MouseStates& ms
|
||||
, const FMouseEvent&& ev )
|
||||
, const FMouseEvent& ev )
|
||||
{
|
||||
// Mouse event handover to the dialog menu
|
||||
if ( ! ms.mouse_over_menu
|
||||
|
|
|
@ -89,9 +89,6 @@ FString fileChooser ( FWidget* parent
|
|||
return ret;
|
||||
}
|
||||
|
||||
// static class attributes
|
||||
FSystem* FFileDialog::fsystem{nullptr};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FFileDialog
|
||||
|
@ -202,7 +199,9 @@ void FFileDialog::setPath (const FString& dir)
|
|||
return;
|
||||
}
|
||||
|
||||
if ( fsystem && fsystem->realpath(dir.c_str(), resolved_path.data()) != nullptr )
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( fsystem->realpath(dir.c_str(), resolved_path.data()) != nullptr )
|
||||
r_dir.setString(resolved_path.data());
|
||||
else
|
||||
r_dir.setString(dir);
|
||||
|
@ -324,9 +323,6 @@ void FFileDialog::init()
|
|||
int x{};
|
||||
int y{};
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
setGeometry(FPoint{1, 1}, FSize{w, h}, false);
|
||||
const auto& parent_widget = getParentWidget();
|
||||
|
||||
|
@ -600,9 +596,7 @@ void FFileDialog::followSymLink (const char* const dir, FDirEntry& entry) const
|
|||
std::array<char, MAXPATHLEN> symLink{};
|
||||
struct stat sb{};
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
std::strncpy (symLink.data(), dir, symLink.size() - 1);
|
||||
symLink[symLink.size() - 1] = '\0';
|
||||
std::strncat ( symLink.data()
|
||||
|
@ -666,9 +660,6 @@ int FFileDialog::changeDir (const FString& dirname)
|
|||
FString lastdir{directory};
|
||||
FString newdir{dirname};
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( newdir.includes('~') )
|
||||
newdir = newdir.replace('~', getHomeDir());
|
||||
|
||||
|
@ -743,9 +734,7 @@ FString FFileDialog::getHomeDir()
|
|||
struct passwd* pwd_ptr{};
|
||||
std::array<char, 1024> buf{};
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
const uid_t euid = fsystem->geteuid();
|
||||
|
||||
if ( fsystem->getpwuid_r(euid, &pwd, buf.data(), buf.size(), &pwd_ptr) )
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#if defined(__sun) && defined(__SVR4)
|
||||
#include <sys/filio.h> // need for FIONREAD
|
||||
#elif defined(__CYGWIN__)
|
||||
#if defined(__CYGWIN__)
|
||||
#include <sys/select.h> // need for FD_ZERO, FD_SET, FD_CLR, ...
|
||||
#endif
|
||||
|
||||
|
@ -55,10 +53,6 @@ uInt64 FKeyboard::read_blocking_time_short{5000}; // 5 ms (200 Hz)
|
|||
bool FKeyboard::non_blocking_input_support{true};
|
||||
struct timeval FKeyboard::time_keypressed{};
|
||||
|
||||
#if defined(__linux__)
|
||||
FTermLinux* FKeyboard::linux{nullptr};
|
||||
#endif
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FKeyboard
|
||||
|
@ -77,8 +71,6 @@ FKeyboard::FKeyboard()
|
|||
|
||||
if ( stdin_status_flags == -1 )
|
||||
std::abort();
|
||||
|
||||
term_detection = FTerm::getFTermDetection();
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,14 +128,6 @@ bool FKeyboard::setNonBlockingInput (bool enable)
|
|||
return non_blocking_stdin;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FKeyboard::init()
|
||||
{
|
||||
#if defined(__linux__)
|
||||
linux = FTerm::getFTermLinux();
|
||||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool& FKeyboard::hasUnprocessedInput()
|
||||
{
|
||||
|
@ -465,13 +449,6 @@ FKey FKeyboard::UTF8decode (const char utf8[]) const
|
|||
//----------------------------------------------------------------------
|
||||
inline ssize_t FKeyboard::readKey()
|
||||
{
|
||||
#if !defined(__CYGWIN__)
|
||||
int len{0};
|
||||
|
||||
if ( ioctl(FTermios::getStdIn(), FIONREAD, &len) < 0 || len == 0 )
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
setNonBlockingInput();
|
||||
const ssize_t bytes = read(FTermios::getStdIn(), &read_character, 1);
|
||||
unsetNonBlockingInput();
|
||||
|
@ -562,8 +539,11 @@ FKey FKeyboard::keyCorrection (const FKey& keycode) const
|
|||
FKey key_correction;
|
||||
|
||||
#if defined(__linux__)
|
||||
if ( linux && FTerm::isLinuxTerm() )
|
||||
key_correction = linux->modifierKeyCorrection(keycode);
|
||||
if ( FTerm::isLinuxTerm() )
|
||||
{
|
||||
const auto& linux_console = FTerm::getFTermLinux();
|
||||
key_correction = linux_console->modifierKeyCorrection(keycode);
|
||||
}
|
||||
else
|
||||
key_correction = keycode;
|
||||
#else
|
||||
|
|
|
@ -30,10 +30,6 @@ namespace finalcut
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FLog::FLog()
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FLog::~FLog() // destructor
|
||||
{
|
||||
|
|
|
@ -34,12 +34,7 @@ namespace finalcut
|
|||
|
||||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FLogger::FLogger()
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FLogger::~FLogger() // destructor
|
||||
{ }
|
||||
FLogger::~FLogger() noexcept = default; // destructor
|
||||
|
||||
|
||||
// private methods of FLogger
|
||||
|
|
|
@ -279,19 +279,19 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
|||
|
||||
if ( ms.mouse_over_submenu )
|
||||
{
|
||||
passEventToSubMenu(std::move(*ev)); // Event handover to sub-menu
|
||||
passEventToSubMenu(*ev); // Event handover to sub-menu
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! ms.mouse_over_menu && ms.mouse_over_supermenu )
|
||||
{
|
||||
passEventToSuperMenu(std::move(*ev)); // Event handover to super-menu
|
||||
passEventToSuperMenu(*ev); // Event handover to super-menu
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ms.mouse_over_menubar )
|
||||
{
|
||||
passEventToMenuBar(std::move(*ev)); // Event handover to the menu bar
|
||||
passEventToMenuBar(*ev); // Event handover to the menu bar
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -908,7 +908,7 @@ void FMenu::mouseMoveOverBorder (MouseStates& ms) const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenu::passEventToSubMenu (const FMouseEvent&& ev)
|
||||
void FMenu::passEventToSubMenu (const FMouseEvent& ev)
|
||||
{
|
||||
// Mouse event handover to sub-menu
|
||||
|
||||
|
@ -931,7 +931,7 @@ void FMenu::passEventToSubMenu (const FMouseEvent&& ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenu::passEventToSuperMenu (const FMouseEvent&& ev)
|
||||
void FMenu::passEventToSuperMenu (const FMouseEvent& ev)
|
||||
{
|
||||
// Mouse event handover to super-menu
|
||||
|
||||
|
@ -955,7 +955,7 @@ void FMenu::passEventToSuperMenu (const FMouseEvent&& ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenu::passEventToMenuBar (const FMouseEvent&& ev) const
|
||||
void FMenu::passEventToMenuBar (const FMouseEvent& ev) const
|
||||
{
|
||||
// Mouse event handover to the menu bar
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
|
|||
|
||||
// Handle menu entries
|
||||
if ( mouse_down )
|
||||
mouseMoveOverList(std::move(*ev));
|
||||
mouseMoveOverList(*ev);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -868,7 +868,7 @@ void FMenuBar::mouseUpOverList (const FMouseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuBar::mouseMoveOverList (const FMouseEvent&& ev)
|
||||
void FMenuBar::mouseMoveOverList (const FMouseEvent& ev)
|
||||
{
|
||||
auto list = getItemList();
|
||||
|
||||
|
|
|
@ -44,14 +44,10 @@ namespace finalcut
|
|||
// class FMouseData
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// constructors and destructor
|
||||
// constructor and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FMouseData::FMouseData()
|
||||
{ }
|
||||
FMouseData::~FMouseData() noexcept = default; // destructor
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FMouseData::~FMouseData()
|
||||
{ }
|
||||
|
||||
// public methods of FMouseData
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -182,10 +178,6 @@ FMouse::FMouse()
|
|||
clearButtonState();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FMouse::~FMouse() // destructor
|
||||
{ }
|
||||
|
||||
|
||||
// public methods of FMouse
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1282,7 +1274,7 @@ void FMouseControl::setMaxHeight (uInt16 y_max)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMouseControl::setDblclickInterval (const uInt64 timeout)
|
||||
void FMouseControl::setDblclickInterval (const uInt64 timeout) const
|
||||
{
|
||||
for (auto&& m : mouse_protocol)
|
||||
if ( m.second )
|
||||
|
@ -1580,7 +1572,7 @@ void FMouseControl::processEvent (struct timeval* time)
|
|||
{
|
||||
mouse_object->processEvent(time);
|
||||
auto& md = static_cast<FMouseData&>(*mouse_object);
|
||||
fmousedata_queue.emplace(new FMouseData(std::move(md)));
|
||||
fmousedata_queue.emplace(make_unique<FMouseData>(std::move(md)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "final/emptyfstring.h"
|
||||
#include "final/fevent.h"
|
||||
#include "final/fc.h"
|
||||
#include "final/fobject.h"
|
||||
|
@ -32,7 +31,6 @@ namespace finalcut
|
|||
|
||||
// static class attributes
|
||||
bool FObject::timer_modify_lock;
|
||||
const FString* fc::emptyFString::empty_string{nullptr};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -55,9 +53,6 @@ FObject::~FObject() // destructor
|
|||
{
|
||||
delOwnTimers(); // Delete all timers of this object
|
||||
|
||||
if ( ! has_parent && ! fc::emptyFString::isNull() )
|
||||
fc::emptyFString::clear();
|
||||
|
||||
// Delete children objects
|
||||
if ( hasChildren() )
|
||||
{
|
||||
|
@ -425,7 +420,7 @@ void FObject::performTimerAction (FObject*, FEvent*)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FObject::FTimerListPtr& FObject::globalTimerList()
|
||||
auto FObject::globalTimerList() -> const FTimerListUniquePtr&
|
||||
{
|
||||
static const auto& timer_list = make_unique<FTimerList>();
|
||||
return timer_list;
|
||||
|
|
|
@ -76,10 +76,10 @@ FString::FString (const FString& s) // copy constructor
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FString::FString (FString&& s) noexcept // move constructor
|
||||
: string{std::move(s.string)}
|
||||
: string{s.string}
|
||||
, length{s.length}
|
||||
, bufsize{s.bufsize}
|
||||
, c_string{std::move(s.c_string)}
|
||||
, c_string{s.c_string}
|
||||
{
|
||||
s.string = nullptr;
|
||||
s.length = 0;
|
||||
|
@ -185,10 +185,10 @@ FString& FString::operator = (FString&& s) noexcept
|
|||
if ( c_string )
|
||||
delete[](c_string);
|
||||
|
||||
string = std::move(s.string);
|
||||
string = s.string;
|
||||
length = s.length;
|
||||
bufsize = s.bufsize;
|
||||
c_string = std::move(s.c_string);
|
||||
c_string = s.c_string;
|
||||
|
||||
s.string = nullptr;
|
||||
s.length = 0;
|
||||
|
@ -1456,6 +1456,9 @@ inline const wchar_t* FString::_to_wcstring (const char s[]) const
|
|||
auto state = std::mbstate_t();
|
||||
auto size = std::mbsrtowcs(nullptr, &src, 0, &state) + 1;
|
||||
|
||||
if ( size == 0 ) // ...malformed UTF-8 string
|
||||
return nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
dest = new wchar_t[size];
|
||||
|
|
|
@ -54,8 +54,8 @@ FStringStream::FStringStream (FStringStream&& sstream) noexcept
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FStringStream::~FStringStream() // destructor
|
||||
{ }
|
||||
FStringStream::~FStringStream() noexcept = default;
|
||||
|
||||
|
||||
// public methods of FStringStream
|
||||
//----------------------------------------------------------------------
|
||||
|
|
641
src/fterm.cpp
641
src/fterm.cpp
File diff suppressed because it is too large
Load Diff
|
@ -66,13 +66,12 @@ int FTermBuffer::write (const FString& string)
|
|||
|
||||
for (auto&& c : string)
|
||||
{
|
||||
FChar nc; // next character
|
||||
nc = FVTerm::getAttribute();
|
||||
FChar nc{FVTerm::getAttribute()}; // next character
|
||||
nc.ch[0] = c;
|
||||
nc.attr.byte[2] = 0;
|
||||
nc.attr.byte[3] = 0;
|
||||
getColumnWidth(nc); // add column width
|
||||
data.emplace_back(std::move(nc));
|
||||
data.emplace_back(nc);
|
||||
}
|
||||
|
||||
return len;
|
||||
|
@ -81,12 +80,12 @@ int FTermBuffer::write (const FString& string)
|
|||
//----------------------------------------------------------------------
|
||||
int FTermBuffer::write (wchar_t ch)
|
||||
{
|
||||
FChar nc = FVTerm::getAttribute(); // next character
|
||||
FChar nc{FVTerm::getAttribute()}; // next character
|
||||
nc.ch[0] = ch;
|
||||
getColumnWidth(nc); // add column width
|
||||
nc.attr.bit.no_changes = false;
|
||||
nc.attr.bit.printed = false;
|
||||
data.emplace_back(std::move(nc));
|
||||
data.emplace_back(nc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace finalcut
|
|||
{
|
||||
|
||||
// static class attributes
|
||||
bool FTermcap::initialized {false};
|
||||
bool FTermcap::background_color_erase {false};
|
||||
bool FTermcap::can_change_color_palette {false};
|
||||
bool FTermcap::automatic_left_margin {false};
|
||||
|
@ -50,9 +51,6 @@ bool FTermcap::no_utf8_acs_chars {false};
|
|||
int FTermcap::max_color {1};
|
||||
int FTermcap::tabstop {8};
|
||||
int FTermcap::attr_without_color {0};
|
||||
FSystem* FTermcap::fsystem {nullptr};
|
||||
FTermData* FTermcap::fterm_data {nullptr};
|
||||
FTermDetection* FTermcap::term_detection {nullptr};
|
||||
char FTermcap::string_buf[2048] {};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -72,9 +70,6 @@ char FTermcap::string_buf[2048] {};
|
|||
//----------------------------------------------------------------------
|
||||
void FTermcap::init()
|
||||
{
|
||||
fsystem = FTerm::getFSystem();
|
||||
fterm_data = FTerm::getFTermData();
|
||||
term_detection = FTerm::getFTermDetection();
|
||||
termcap();
|
||||
}
|
||||
|
||||
|
@ -82,11 +77,13 @@ void FTermcap::init()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermcap::termcap()
|
||||
{
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
std::vector<std::string> terminals{};
|
||||
static constexpr int success = 1;
|
||||
static constexpr int uninitialized = -2;
|
||||
static char term_buffer[BUF_SIZE]{};
|
||||
int status = uninitialized;
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
const bool color256 = term_detection->canDisplay256Colors();
|
||||
|
||||
// Open termcap file
|
||||
|
@ -112,6 +109,9 @@ void FTermcap::termcap()
|
|||
// Open the termcap file + load entry for termtype
|
||||
status = tgetent(term_buffer, termtype);
|
||||
|
||||
if ( status == success )
|
||||
initialized = true;
|
||||
|
||||
if ( status == success || ! term_detection->hasTerminalDetection() )
|
||||
break;
|
||||
|
||||
|
@ -131,6 +131,7 @@ void FTermcap::termcapError (int status)
|
|||
|
||||
if ( status == no_entry || status == uninitialized )
|
||||
{
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
const char* termtype = fterm_data->getTermType();
|
||||
std::clog << FLog::Error
|
||||
<< "Unknown terminal: \"" << termtype << "\". "
|
||||
|
@ -200,6 +201,8 @@ void FTermcap::termcapNumerics()
|
|||
{
|
||||
// Get termcap numerics
|
||||
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
|
||||
// Maximum number of colors on screen
|
||||
max_color = std::max(max_color, getNumber("Co"));
|
||||
|
||||
|
@ -252,9 +255,7 @@ void FTermcap::termcapKeys()
|
|||
//----------------------------------------------------------------------
|
||||
int FTermcap::_tputs (const char* str, int affcnt, fn_putc putc)
|
||||
{
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
return fsystem->tputs (str, affcnt, putc);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,11 +34,6 @@
|
|||
namespace finalcut
|
||||
{
|
||||
|
||||
// static class attributes
|
||||
FTermData* FTermcapQuirks::fterm_data {nullptr};
|
||||
FTermDetection* FTermcapQuirks::term_detection {nullptr};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FTermcapQuirks
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -47,9 +42,7 @@ FTermDetection* FTermcapQuirks::term_detection {nullptr};
|
|||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirks::terminalFixup()
|
||||
{
|
||||
fterm_data = FTerm::getFTermData();
|
||||
term_detection = FTerm::getFTermDetection();
|
||||
const auto& td = term_detection;
|
||||
const auto& td = FTerm::getFTermDetection();
|
||||
|
||||
if ( td->isCygwinTerminal() )
|
||||
{
|
||||
|
@ -231,7 +224,9 @@ void FTermcapQuirks::xterm()
|
|||
void FTermcapQuirks::rxvt()
|
||||
{
|
||||
// Set enter/exit alternative charset mode for rxvt terminal
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
const char* termtype = fterm_data->getTermType();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( std::strncmp(termtype, "rxvt-16color", 12) == 0 )
|
||||
{
|
||||
|
@ -252,12 +247,13 @@ void FTermcapQuirks::rxvt()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirks::vte()
|
||||
{
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
// gnome-terminal has NC=16 however, it can use the dim attribute
|
||||
FTermcap::attr_without_color = 0;
|
||||
|
||||
// set exit underline for gnome terminal
|
||||
TCAP(fc::t_exit_underline_mode) = \
|
||||
CSI "24m";
|
||||
TCAP(fc::t_exit_underline_mode) = CSI "24m";
|
||||
|
||||
if ( term_detection->getGnomeTerminalID() >= 5300 ) // vte >= 0.53.0
|
||||
{
|
||||
|
@ -266,8 +262,7 @@ void FTermcapQuirks::vte()
|
|||
{
|
||||
// Save the cursor position, enter alternate screen buffer
|
||||
// and save xterm icon and window title on stack
|
||||
TCAP(fc::t_enter_ca_mode) = \
|
||||
CSI "?1049h" CSI "22;0;0t";
|
||||
TCAP(fc::t_enter_ca_mode) = CSI "?1049h" CSI "22;0;0t";
|
||||
}
|
||||
|
||||
if ( TCAP(fc::t_exit_ca_mode)
|
||||
|
@ -275,8 +270,7 @@ void FTermcapQuirks::vte()
|
|||
{
|
||||
// Use normal screen buffer, restore the cursor position
|
||||
// and restore xterm icon and window title from stack
|
||||
TCAP(fc::t_exit_ca_mode) = \
|
||||
CSI "?1049l" CSI "23;0;0t";
|
||||
TCAP(fc::t_exit_ca_mode) = CSI "?1049l" CSI "23;0;0t";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -457,6 +451,8 @@ void FTermcapQuirks::sunConsole()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirks::screen()
|
||||
{
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
// Fallback if "Ic" is not found
|
||||
if ( ! TCAP(fc::t_initialize_color) )
|
||||
{
|
||||
|
|
|
@ -30,49 +30,44 @@ namespace finalcut
|
|||
{
|
||||
|
||||
#if DEBUG
|
||||
// static class attributes
|
||||
FTermData* FTermDebugData::data {nullptr};
|
||||
FTermDetection* FTermDebugData::term_detection {nullptr};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FTermDebugData
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// public methods of FTermDebugData
|
||||
//----------------------------------------------------------------------
|
||||
void FTermDebugData::init()
|
||||
{
|
||||
data = FTerm::getFTermData();
|
||||
term_detection = FTerm::getFTermDetection();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const FString& FTermDebugData::getAnswerbackString()
|
||||
{
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
return term_detection->getAnswerbackString();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const FString& FTermDebugData::getSecDAString()
|
||||
{
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
return term_detection->getSecDAString();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const char* FTermDebugData::getTermType_256color()
|
||||
{
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
return term_detection->getTermType_256color();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const char* FTermDebugData::getTermType_Answerback()
|
||||
{
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
return term_detection->getTermType_Answerback();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const char* FTermDebugData::getTermType_SecDA()
|
||||
{
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
return term_detection->getTermType_SecDA();
|
||||
}
|
||||
|
||||
|
@ -80,7 +75,8 @@ const char* FTermDebugData::getTermType_SecDA()
|
|||
#if defined(__linux__)
|
||||
int FTermDebugData::getFramebufferBpp()
|
||||
{
|
||||
return data->getFramebufferBpp();
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
return fterm_data->getFramebufferBpp();
|
||||
}
|
||||
#endif // defined(__linux__)
|
||||
|
||||
|
|
|
@ -54,9 +54,6 @@ namespace finalcut
|
|||
FTermDetection::FTerminalType FTermDetection::terminal_type{};
|
||||
FTermDetection::colorEnv FTermDetection::color_env{};
|
||||
FTermDetection::secondaryDA FTermDetection::secondary_da{};
|
||||
FTermData* FTermDetection::fterm_data{nullptr};
|
||||
FSystem* FTermDetection::fsystem{nullptr};
|
||||
FKeyboard* FTermDetection::keyboard{nullptr};
|
||||
char FTermDetection::termtype[256]{};
|
||||
char FTermDetection::ttytypename[256]{};
|
||||
bool FTermDetection::decscusr_support{};
|
||||
|
@ -133,9 +130,6 @@ void FTermDetection::setTtyTypeFileName (const char ttytype_filename[])
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetection::detect()
|
||||
{
|
||||
fterm_data = FTerm::getFTermData();
|
||||
fsystem = FTerm::getFSystem();
|
||||
keyboard = FTerm::getFKeyboard();
|
||||
deallocation();
|
||||
|
||||
// Set the variable 'termtype' to the predefined type of the terminal
|
||||
|
@ -165,6 +159,7 @@ void FTermDetection::getSystemTermType()
|
|||
{
|
||||
// Import the untrusted environment variable TERM
|
||||
const auto& term_env = std::getenv("TERM");
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
const auto& termfilename = fterm_data->getTermFileName();
|
||||
|
||||
if ( term_env )
|
||||
|
@ -203,6 +198,7 @@ bool FTermDetection::getTTYtype()
|
|||
// vt100 ttys0
|
||||
|
||||
// Get term basename
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
const char* termfilename = fterm_data->getTermFileName();
|
||||
const char* term_basename = std::strrchr(termfilename, '/');
|
||||
|
||||
|
@ -213,9 +209,7 @@ bool FTermDetection::getTTYtype()
|
|||
|
||||
std::FILE* fp{};
|
||||
std::array<char, BUFSIZ> str{};
|
||||
|
||||
if ( ! fsystem )
|
||||
return false;
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( (fp = fsystem->fopen(ttytypename, "r")) == nullptr )
|
||||
return false;
|
||||
|
@ -260,6 +254,7 @@ bool FTermDetection::getTTYSFileEntry()
|
|||
// Analyse /etc/ttys and get the term name
|
||||
|
||||
// get term basename
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
const char* termfilename = fterm_data->getTermFileName();
|
||||
const char* term_basename = std::strrchr(termfilename, '/');
|
||||
|
||||
|
@ -364,6 +359,7 @@ void FTermDetection::detectTerminal()
|
|||
if ( terminal_detection )
|
||||
{
|
||||
FTermios::setCaptureSendCharacters();
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
keyboard->setNonBlockingInput();
|
||||
|
||||
// Initialize 256 colors terminals
|
||||
|
@ -408,6 +404,7 @@ void FTermDetection::detectTerminal()
|
|||
}
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
const auto& termfilename = fterm_data->getTermFileName();
|
||||
|
||||
// Fixes problem with mouse input
|
||||
|
@ -541,6 +538,7 @@ const char* FTermDetection::determineMaxColor (const char current_termtype[])
|
|||
// Determine xterm maximum number of colors via OSC 4
|
||||
|
||||
const char* new_termtype = current_termtype;
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
keyboard->setNonBlockingInput();
|
||||
|
||||
if ( ! color256
|
||||
|
@ -632,6 +630,7 @@ FString FTermDetection::getXTermColorName (FColor color)
|
|||
const char* FTermDetection::parseAnswerbackMsg (const char current_termtype[])
|
||||
{
|
||||
const char* new_termtype = current_termtype;
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
keyboard->setNonBlockingInput();
|
||||
// send ENQ and read the answerback message
|
||||
const auto& ans = getAnswerbackMsg();
|
||||
|
|
|
@ -30,28 +30,15 @@
|
|||
#include "final/ftypes.h"
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
|
||||
#define initCheck(ret_value) \
|
||||
if ( ! isInitialized() ) \
|
||||
{ \
|
||||
if ( ! FApplication::isQuit() ) \
|
||||
warnNotInitialized(); \
|
||||
\
|
||||
return ret_value; \
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
// static class attributes
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
|
||||
uInt FTermFreeBSD::bsd_alt_keymap{0};
|
||||
FTermFreeBSD::CursorStyle FTermFreeBSD::cursor_style{fc::normal_cursor};
|
||||
bool FTermFreeBSD::change_cursorstyle{true};
|
||||
bool FTermFreeBSD::meta_sends_escape{true};
|
||||
FSystem* FTermFreeBSD::fsystem{nullptr};
|
||||
FTermData* FTermFreeBSD::fterm_data{nullptr};
|
||||
#endif
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -60,7 +47,6 @@ namespace finalcut
|
|||
|
||||
// public methods of FTermFreeBSD
|
||||
//----------------------------------------------------------------------
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
|
||||
FTermFreeBSD::CursorStyle FTermFreeBSD::getCursorStyle()
|
||||
{
|
||||
return cursor_style;
|
||||
|
@ -71,15 +57,11 @@ bool FTermFreeBSD::setCursorStyle (CursorStyle style)
|
|||
{
|
||||
// Set cursor style in a BSD console
|
||||
|
||||
if ( ! fterm_data )
|
||||
fterm_data = FTerm::getFTermData();
|
||||
|
||||
initCheck(false);
|
||||
|
||||
if ( ! fsystem || ! isFreeBSDConsole() || ! change_cursorstyle )
|
||||
if ( ! isFreeBSDConsole() || ! change_cursorstyle )
|
||||
return false;
|
||||
|
||||
cursor_style = style;
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
|
||||
if ( fterm_data->isCursorHidden() )
|
||||
return false;
|
||||
|
@ -93,11 +75,9 @@ bool FTermFreeBSD::isFreeBSDConsole()
|
|||
// Check if it's a FreeBSD console
|
||||
|
||||
keymap_t keymap{};
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( fsystem && fsystem->ioctl(0, GIO_KEYMAP, &keymap) == 0 )
|
||||
if ( fsystem->ioctl(0, GIO_KEYMAP, &keymap) == 0 )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -141,9 +121,6 @@ void FTermFreeBSD::init()
|
|||
{
|
||||
// Initialize BSD console
|
||||
|
||||
fsystem = FTerm::getFSystem();
|
||||
fterm_data = FTerm::getFTermData();
|
||||
|
||||
if ( ! isFreeBSDConsole() )
|
||||
return;
|
||||
|
||||
|
@ -210,7 +187,7 @@ bool FTermFreeBSD::saveFreeBSDAltKey()
|
|||
static constexpr int left_alt = 0x38;
|
||||
int ret{-1};
|
||||
keymap_t keymap{};
|
||||
initCheck(false);
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
ret = fsystem->ioctl (0, GIO_KEYMAP, &keymap);
|
||||
|
||||
if ( ret < 0 )
|
||||
|
@ -229,7 +206,7 @@ bool FTermFreeBSD::setFreeBSDAltKey (uInt key)
|
|||
static constexpr int left_alt = 0x38;
|
||||
int ret{-1};
|
||||
keymap_t keymap{};
|
||||
initCheck(false);
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
ret = fsystem->ioctl (0, GIO_KEYMAP, &keymap);
|
||||
|
||||
if ( ret < 0 )
|
||||
|
@ -239,7 +216,7 @@ bool FTermFreeBSD::setFreeBSDAltKey (uInt key)
|
|||
keymap.key[left_alt].map[0] = int(key);
|
||||
|
||||
if ( (keymap.n_keys > 0)
|
||||
&& fsystem && (fsystem->ioctl(0, PIO_KEYMAP, &keymap) < 0) )
|
||||
&& (fsystem->ioctl(0, PIO_KEYMAP, &keymap) < 0) )
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
@ -264,13 +241,14 @@ bool FTermFreeBSD::resetFreeBSDAlt2Meta()
|
|||
//----------------------------------------------------------------------
|
||||
bool FTermFreeBSD::setFreeBSDCursorStyle (CursorStyle style)
|
||||
{
|
||||
initCheck(false);
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( fsystem->ioctl(0, CONS_CURSORTYPE, &style) == 0 )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
#endif // defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
|
||||
|
|
|
@ -35,11 +35,12 @@
|
|||
#include "final/ftypes.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
|
||||
#include <linux/keyboard.h> // need keyboard modifiers
|
||||
#include "../fonts/newfont.h"
|
||||
#include "../fonts/unicodemap.h"
|
||||
#include "../fonts/vgafont.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
@ -52,18 +53,15 @@ namespace finalcut
|
|||
//----------------------------------------------------------------------
|
||||
FTermLinux::~FTermLinux() // destructor
|
||||
{
|
||||
#if defined(__linux__)
|
||||
if ( screen_font.data )
|
||||
delete[] screen_font.data;
|
||||
|
||||
if ( screen_unicode_map.entries )
|
||||
delete[] screen_unicode_map.entries;
|
||||
#endif // defined(__linux__)
|
||||
}
|
||||
|
||||
// public methods of FTermLinux
|
||||
//----------------------------------------------------------------------
|
||||
#if defined(__linux__)
|
||||
fc::linuxConsoleCursorStyle FTermLinux::getCursorStyle() const
|
||||
{
|
||||
// Get the current set cursor style
|
||||
|
@ -87,8 +85,7 @@ bool FTermLinux::setCursorStyle (fc::linuxConsoleCursorStyle style)
|
|||
{
|
||||
// Set cursor style in linux console
|
||||
|
||||
if ( ! fterm_data )
|
||||
fterm_data = FTerm::getFTermData();
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
|
||||
if ( ! FTerm::isLinuxTerm() )
|
||||
return false;
|
||||
|
@ -137,11 +134,9 @@ bool FTermLinux::isLinuxConsole()
|
|||
{
|
||||
// Check if it's a Linux console
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
char arg{0};
|
||||
const int fd_tty = FTerm::getTTYFileDescriptor();
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
// Get keyboard type an compare
|
||||
return ( fsystem->isTTY(fd_tty)
|
||||
|
@ -154,14 +149,8 @@ void FTermLinux::init()
|
|||
{
|
||||
// Initialize Linux console
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( ! fterm_data )
|
||||
fterm_data = FTerm::getFTermData();
|
||||
|
||||
fsystem = FTerm::getFSystem();
|
||||
term_detection = FTerm::getFTermDetection();
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
screen_unicode_map.entries = nullptr;
|
||||
screen_font.data = nullptr;
|
||||
fterm_data->supportShadowCharacter (true);
|
||||
|
@ -292,9 +281,7 @@ bool FTermLinux::loadVGAFont()
|
|||
|
||||
if ( vga_font )
|
||||
{
|
||||
if ( ! fterm_data )
|
||||
fterm_data = FTerm::getFTermData();
|
||||
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
fterm_data->supportShadowCharacter (true);
|
||||
fterm_data->supportHalfBlockCharacter (true);
|
||||
}
|
||||
|
@ -342,9 +329,7 @@ bool FTermLinux::loadNewFont()
|
|||
|
||||
if ( new_font )
|
||||
{
|
||||
if ( ! fterm_data )
|
||||
fterm_data = FTerm::getFTermData();
|
||||
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
fterm_data->supportShadowCharacter (true);
|
||||
fterm_data->supportHalfBlockCharacter (true);
|
||||
}
|
||||
|
@ -458,9 +443,6 @@ FKey FTermLinux::modifierKeyCorrection (const FKey& key_id)
|
|||
{
|
||||
// Get the current modifier key state
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
const ModifierKey& m = getModifierKey();
|
||||
|
||||
if ( ! (m.shift || m.ctrl || m.alt) )
|
||||
|
@ -508,9 +490,7 @@ int FTermLinux::getFramebuffer_bpp()
|
|||
const char* fb = "/dev/fb/0";
|
||||
struct fb_var_screeninfo fb_var{};
|
||||
struct fb_fix_screeninfo fb_fix{};
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( (fd = fsystem->open(fb, O_RDWR)) < 0 )
|
||||
{
|
||||
|
@ -569,7 +549,7 @@ bool FTermLinux::getScreenFont()
|
|||
}
|
||||
|
||||
// Font operation
|
||||
if ( fsystem )
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
ret = fsystem->ioctl (fd_tty, KDFONTOP, &font);
|
||||
|
||||
if ( ret != 0 )
|
||||
|
@ -600,7 +580,7 @@ bool FTermLinux::getUnicodeMap()
|
|||
screen_unicode_map.entries = nullptr;
|
||||
|
||||
// Get count
|
||||
if ( fsystem )
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
ret = fsystem->ioctl (fd_tty, GIO_UNIMAP, &screen_unicode_map);
|
||||
|
||||
if ( ret != 0 )
|
||||
|
@ -621,7 +601,6 @@ bool FTermLinux::getUnicodeMap()
|
|||
}
|
||||
|
||||
// Get unicode-to-font mapping from kernel
|
||||
if ( fsystem )
|
||||
ret = fsystem->ioctl (fd_tty, GIO_UNIMAP, &screen_unicode_map);
|
||||
|
||||
if ( ret != 0 )
|
||||
|
@ -641,8 +620,10 @@ FTermLinux::ModifierKey& FTermLinux::getModifierKey()
|
|||
// Fill bit field with 0
|
||||
std::memset (&mod_key, 0x00, sizeof(mod_key));
|
||||
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
// TIOCLINUX, subcode = 6 (TIOCL_GETSHIFTSTATE)
|
||||
if ( fsystem && fsystem->ioctl(0, TIOCLINUX, &subcode) >= 0 )
|
||||
if ( fsystem->ioctl(0, TIOCLINUX, &subcode) >= 0 )
|
||||
{
|
||||
if ( subcode & (1 << KG_SHIFT) )
|
||||
mod_key.shift = true;
|
||||
|
@ -705,7 +686,7 @@ int FTermLinux::setScreenFont ( const uChar fontdata[], uInt count
|
|||
}
|
||||
|
||||
// Font operation
|
||||
if ( fsystem )
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
ret = fsystem->ioctl (fd_tty, KDFONTOP, &font);
|
||||
|
||||
if ( ret != 0 && errno != ENOSYS && errno != EINVAL )
|
||||
|
@ -742,14 +723,13 @@ int FTermLinux::setUnicodeMap (struct unimapdesc* unimap)
|
|||
do
|
||||
{
|
||||
// Clear the unicode-to-font table
|
||||
if ( fsystem )
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
ret = fsystem->ioctl (fd_tty, PIO_UNIMAPCLR, &advice);
|
||||
|
||||
if ( ret != 0 )
|
||||
return -1;
|
||||
|
||||
// Put the new unicode-to-font mapping in kernel
|
||||
if ( fsystem )
|
||||
ret = fsystem->ioctl (fd_tty, PIO_UNIMAP, unimap);
|
||||
|
||||
if ( ret != 0 )
|
||||
|
@ -775,8 +755,7 @@ inline uInt16 FTermLinux::getInputStatusRegisterOne()
|
|||
{
|
||||
// Gets the VGA input-status-register-1
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
// Miscellaneous output (read port)
|
||||
static constexpr uInt16 misc_read = 0x3cc;
|
||||
|
@ -792,8 +771,7 @@ uChar FTermLinux::readAttributeController (uChar index)
|
|||
{
|
||||
// Reads a byte from the attribute controller from a given index
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
// Attribute controller (write port)
|
||||
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
||||
|
@ -819,8 +797,7 @@ void FTermLinux::writeAttributeController (uChar index, uChar data)
|
|||
{
|
||||
// Writes a byte from the attribute controller from a given index
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
// Attribute controller (write port)
|
||||
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
||||
|
@ -859,8 +836,7 @@ int FTermLinux::setBlinkAsIntensity (bool enable)
|
|||
// Uses blink-bit as background intensity.
|
||||
// That permits 16 colors for background
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
const int fd_tty = FTerm::getTTYFileDescriptor();
|
||||
|
||||
|
@ -899,9 +875,7 @@ bool FTermLinux::has9BitCharacters()
|
|||
// 0xc0...0xdf - copying the eighth pixel into the ninth pixel
|
||||
// The rest - the ninth pixel has the background color
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
const int fd_tty = FTerm::getTTYFileDescriptor();
|
||||
|
||||
if ( fsystem->getuid() != 0 ) // Direct hardware access requires root privileges
|
||||
|
@ -926,7 +900,9 @@ bool FTermLinux::has9BitCharacters()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermLinux::getVGAPalette()
|
||||
{
|
||||
if ( fsystem && fsystem->ioctl(0, GIO_CMAP, &cmap) != 0 )
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( fsystem->ioctl(0, GIO_CMAP, &cmap) != 0 )
|
||||
setVGADefaultPalette(); // Fallback, if GIO_CMAP does not work
|
||||
}
|
||||
|
||||
|
@ -967,7 +943,9 @@ bool FTermLinux::setVGAPalette (FColor index, int r, int g, int b)
|
|||
cmap.color[index].blue = uChar(b);
|
||||
}
|
||||
|
||||
if ( fsystem && fsystem->ioctl(0, PIO_CMAP, &cmap) == 0 )
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( fsystem->ioctl(0, PIO_CMAP, &cmap) == 0 )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -978,7 +956,9 @@ bool FTermLinux::saveVGAPalette()
|
|||
{
|
||||
// Save the current vga color map
|
||||
|
||||
if ( fsystem && fsystem->ioctl(0, GIO_CMAP, &saved_color_map) == 0 )
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( fsystem->ioctl(0, GIO_CMAP, &saved_color_map) == 0 )
|
||||
has_saved_palette = true;
|
||||
else
|
||||
has_saved_palette = false;
|
||||
|
@ -991,16 +971,18 @@ bool FTermLinux::resetVGAPalette()
|
|||
{
|
||||
// Reset the vga color map
|
||||
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( has_saved_palette )
|
||||
{
|
||||
if ( fsystem && fsystem->ioctl (0, PIO_CMAP, &saved_color_map) )
|
||||
if ( fsystem->ioctl (0, PIO_CMAP, &saved_color_map) )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
setVGADefaultPalette();
|
||||
|
||||
if ( fsystem && fsystem->ioctl(0, PIO_CMAP, &cmap) != 0 )
|
||||
if ( fsystem->ioctl(0, PIO_CMAP, &cmap) != 0 )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1291,13 +1273,11 @@ FKey FTermLinux::shiftCtrlAltKeyCorrection (const FKey& key_id) const
|
|||
//----------------------------------------------------------------------
|
||||
inline void FTermLinux::initSpecialCharacter()
|
||||
{
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
const wchar_t c1 = fc::UpperHalfBlock;
|
||||
const wchar_t c2 = fc::LowerHalfBlock;
|
||||
const wchar_t c3 = fc::FullBlock;
|
||||
|
||||
if ( ! fterm_data )
|
||||
fterm_data = FTerm::getFTermData();
|
||||
|
||||
if ( FTerm::charEncode(c1, fc::PC) == FTerm::charEncode(c1, fc::ASCII)
|
||||
|| FTerm::charEncode(c2, fc::PC) == FTerm::charEncode(c2, fc::ASCII)
|
||||
|| FTerm::charEncode(c3, fc::PC) == FTerm::charEncode(c3, fc::ASCII) )
|
||||
|
@ -1334,10 +1314,7 @@ void FTermLinux::characterFallback ( wchar_t ucs
|
|||
, std::vector<wchar_t> fallback )
|
||||
{
|
||||
constexpr sInt16 NOT_FOUND = -1;
|
||||
|
||||
if ( ! fterm_data )
|
||||
fterm_data = FTerm::getFTermData();
|
||||
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
charSubstitution& sub_map = fterm_data->getCharSubstitutionMap();
|
||||
|
||||
if ( fallback.size() < 2 || ucs != fallback[0] )
|
||||
|
@ -1355,6 +1332,6 @@ void FTermLinux::characterFallback ( wchar_t ucs
|
|||
}
|
||||
}
|
||||
|
||||
#endif // defined(__linux__)
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // defined(__linux__)
|
||||
|
|
|
@ -27,25 +27,13 @@
|
|||
#include "final/ftermopenbsd.h"
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
|
||||
#define initCheck(ret_value) \
|
||||
if ( ! isInitialized() ) \
|
||||
{ \
|
||||
if ( ! FApplication::isQuit() ) \
|
||||
warnNotInitialized(); \
|
||||
\
|
||||
return ret_value; \
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
// static class attributes
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
|
||||
kbd_t FTermOpenBSD::bsd_keyboard_encoding{0};
|
||||
bool FTermOpenBSD::meta_sends_escape{true};
|
||||
FSystem* FTermOpenBSD::fsystem{nullptr};
|
||||
#endif
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -54,18 +42,14 @@ namespace finalcut
|
|||
|
||||
// public methods of FTermOpenBSD
|
||||
//----------------------------------------------------------------------
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
|
||||
bool FTermOpenBSD::isBSDConsole()
|
||||
{
|
||||
// Check if it's a NetBSD/OpenBSD workstation console
|
||||
|
||||
static kbd_t kbdencoding{};
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( fsystem
|
||||
&& fsystem->ioctl(0, WSKBDIO_GETENCODING, &kbdencoding) == 0 )
|
||||
if ( fsystem->ioctl(0, WSKBDIO_GETENCODING, &kbdencoding) == 0 )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -76,8 +60,6 @@ void FTermOpenBSD::init()
|
|||
{
|
||||
// Initialize BSD workstation console
|
||||
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( ! isBSDConsole() )
|
||||
return;
|
||||
|
||||
|
@ -94,8 +76,6 @@ void FTermOpenBSD::init()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermOpenBSD::finish()
|
||||
{
|
||||
initCheck();
|
||||
|
||||
if ( ! isBSDConsole() )
|
||||
return;
|
||||
|
||||
|
@ -106,8 +86,6 @@ void FTermOpenBSD::finish()
|
|||
//----------------------------------------------------------------------
|
||||
bool FTermOpenBSD::setBeep (int Hz, int ms)
|
||||
{
|
||||
initCheck(false);
|
||||
|
||||
if ( ! isBSDConsole() )
|
||||
return false;
|
||||
|
||||
|
@ -124,8 +102,9 @@ bool FTermOpenBSD::setBeep (int Hz, int ms)
|
|||
bell.pitch = uInt(Hz);
|
||||
bell.period = uInt(ms);
|
||||
bell.volume = 50; // 50% volume
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( fsystem && fsystem->ioctl(0, WSKBDIO_SETBELL, &bell) < 0 )
|
||||
if ( fsystem->ioctl(0, WSKBDIO_SETBELL, &bell) < 0 )
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
@ -134,19 +113,17 @@ bool FTermOpenBSD::setBeep (int Hz, int ms)
|
|||
//----------------------------------------------------------------------
|
||||
bool FTermOpenBSD::resetBeep()
|
||||
{
|
||||
initCheck(false);
|
||||
wskbd_bell_data default_bell;
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
// Gets the default setting for the bell
|
||||
if ( fsystem
|
||||
&& fsystem->ioctl(0, WSKBDIO_GETDEFAULTBELL, &default_bell) < 0 )
|
||||
if ( fsystem->ioctl(0, WSKBDIO_GETDEFAULTBELL, &default_bell) < 0 )
|
||||
return false;
|
||||
|
||||
default_bell.which = WSKBD_BELL_DOALL;
|
||||
|
||||
// Sets the bell settings
|
||||
if ( fsystem
|
||||
&& fsystem->ioctl(0, WSKBDIO_SETBELL, &default_bell) < 0 )
|
||||
if ( fsystem->ioctl(0, WSKBDIO_SETBELL, &default_bell) < 0 )
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
@ -170,7 +147,7 @@ bool FTermOpenBSD::saveBSDConsoleEncoding()
|
|||
static kbd_t k_encoding{};
|
||||
int ret{-1};
|
||||
|
||||
if ( fsystem )
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
ret = fsystem->ioctl (0, WSKBDIO_GETENCODING, &k_encoding);
|
||||
|
||||
if ( ret < 0 )
|
||||
|
@ -184,8 +161,9 @@ bool FTermOpenBSD::saveBSDConsoleEncoding()
|
|||
//----------------------------------------------------------------------
|
||||
bool FTermOpenBSD::setBSDConsoleEncoding (kbd_t k_encoding)
|
||||
{
|
||||
if ( fsystem
|
||||
&& fsystem->ioctl(0, WSKBDIO_SETENCODING, &k_encoding) < 0 )
|
||||
const auto& fsystem = FTerm::getFSystem();
|
||||
|
||||
if ( fsystem->ioctl(0, WSKBDIO_SETENCODING, &k_encoding) < 0 )
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
@ -204,6 +182,7 @@ bool FTermOpenBSD::resetBSDConsoleEncoding()
|
|||
{
|
||||
return setBSDConsoleEncoding (bsd_keyboard_encoding);
|
||||
}
|
||||
#endif // defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
|
||||
|
|
|
@ -39,38 +39,17 @@
|
|||
#include "final/ftermxterminal.h"
|
||||
#include "final/fsize.h"
|
||||
|
||||
#define initCheck(ret_value) \
|
||||
if ( ! isInitialized() ) \
|
||||
{ \
|
||||
if ( ! FApplication::isQuit() ) \
|
||||
warnNotInitialized(); \
|
||||
\
|
||||
return ret_value; \
|
||||
}
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
// static class attributes
|
||||
bool FTermXTerminal::mouse_support{false};
|
||||
FSystem* FTermXTerminal::fsystem{nullptr};
|
||||
FKeyboard* FTermXTerminal::keyboard{nullptr};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FTermXTerminal
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FTermXTerminal::FTermXTerminal()
|
||||
{
|
||||
// Get FSystem object
|
||||
fsystem = FTerm::getFSystem();
|
||||
keyboard = FTerm::getFKeyboard();
|
||||
}
|
||||
|
||||
|
||||
// public methods of FTermXTerminal
|
||||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::setCursorStyle (fc::xtermCursorStyle style)
|
||||
|
@ -185,12 +164,6 @@ void FTermXTerminal::metaSendsESC (bool enable)
|
|||
disableXTermMetaSendsESC();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::init()
|
||||
{
|
||||
term_detection = FTerm::getFTermDetection();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::setDefaults()
|
||||
{
|
||||
|
@ -268,7 +241,7 @@ void FTermXTerminal::resetHighlightBackground()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::resetDefaults()
|
||||
{
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isPuttyTerminal() )
|
||||
return;
|
||||
|
@ -301,13 +274,14 @@ void FTermXTerminal::resetTitle()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::captureFontAndTitle()
|
||||
{
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( ( term_detection->isXTerminal()
|
||||
|| term_detection->isUrxvtTerminal() )
|
||||
&& ! term_detection->isRxvtTerminal() )
|
||||
{
|
||||
FTermios::setCaptureSendCharacters();
|
||||
const auto& keyboard = FTerm::getFKeyboard();
|
||||
keyboard->setNonBlockingInput();
|
||||
xterm_font = captureXTermFont();
|
||||
xterm_title = captureXTermTitle();
|
||||
|
@ -338,7 +312,7 @@ void FTermXTerminal::setXTermCursorStyle()
|
|||
return;
|
||||
#endif
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isGnomeTerminal()
|
||||
&& ! term_detection->hasSetCursorStyleSupport() )
|
||||
|
@ -362,7 +336,7 @@ void FTermXTerminal::setXTermCursorStyle()
|
|||
void FTermXTerminal::setXTermTitle()
|
||||
{
|
||||
// Set the xterm title
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isXTerminal()
|
||||
|| term_detection->isScreenTerm()
|
||||
|
@ -387,7 +361,7 @@ void FTermXTerminal::setXTermTitle()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::setXTermSize() const
|
||||
{
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isXTerminal() )
|
||||
{
|
||||
|
@ -403,7 +377,7 @@ void FTermXTerminal::setXTermFont()
|
|||
{
|
||||
// Change the XTerm font (needs the allowFontOps resource)
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isXTerminal()
|
||||
|| term_detection->isScreenTerm()
|
||||
|
@ -421,7 +395,7 @@ void FTermXTerminal::setXTermForeground()
|
|||
{
|
||||
// Set the XTerm text foreground color
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isXTerminal()
|
||||
|| term_detection->isScreenTerm()
|
||||
|
@ -441,7 +415,7 @@ void FTermXTerminal::setXTermBackground()
|
|||
{
|
||||
// Set the XTerm text background color
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isXTerminal()
|
||||
|| term_detection->isScreenTerm()
|
||||
|
@ -461,7 +435,7 @@ void FTermXTerminal::setXTermCursorColor()
|
|||
{
|
||||
// Set the text cursor color
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isXTerminal()
|
||||
|| term_detection->isScreenTerm()
|
||||
|
@ -481,7 +455,7 @@ void FTermXTerminal::setXTermMouseForeground()
|
|||
{
|
||||
// Set the mouse foreground color
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isXTerminal()
|
||||
|| term_detection->isScreenTerm()
|
||||
|
@ -500,7 +474,7 @@ void FTermXTerminal::setXTermMouseBackground()
|
|||
{
|
||||
// Set the mouse background color
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isXTerminal()
|
||||
|| term_detection->isScreenTerm()
|
||||
|
@ -518,7 +492,7 @@ void FTermXTerminal::setXTermHighlightBackground()
|
|||
{
|
||||
// Set the highlight background color
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isXTerminal()
|
||||
|| term_detection->isScreenTerm()
|
||||
|
@ -538,7 +512,7 @@ void FTermXTerminal::setXTerm8ColorDefaults()
|
|||
// Redefinition of the XTerm default colors
|
||||
// for the final cut 8 color theme
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isPuttyTerminal() )
|
||||
return;
|
||||
|
@ -560,7 +534,7 @@ void FTermXTerminal::setXTerm16ColorDefaults()
|
|||
// Redefinition of the XTerm default colors
|
||||
// for the final cut 16 color theme
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isPuttyTerminal() )
|
||||
return;
|
||||
|
@ -582,7 +556,7 @@ inline void FTermXTerminal::setXTermDefaultsMouseCursor()
|
|||
setMouseBackground("rgb:ffff/ffff/ffff"); // white
|
||||
setMouseForeground ("rgb:0000/0000/0000"); // black
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( ! term_detection->isGnomeTerminal() )
|
||||
setCursorColor("rgb:ffff/ffff/ffff"); // white
|
||||
|
@ -591,7 +565,7 @@ inline void FTermXTerminal::setXTermDefaultsMouseCursor()
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FTermXTerminal::canSetXTermBackground() const
|
||||
{
|
||||
initCheck(false);
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( xterm_default_colors
|
||||
&& ! (term_detection->isMinttyTerm()
|
||||
|
@ -608,7 +582,7 @@ void FTermXTerminal::resetXTermColorMap() const
|
|||
{
|
||||
// Reset the entire color table
|
||||
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isMinttyTerm() )
|
||||
{
|
||||
|
@ -710,7 +684,7 @@ void FTermXTerminal::resetXTermHighlightBackground() const
|
|||
//----------------------------------------------------------------------
|
||||
bool FTermXTerminal::canResetColor() const
|
||||
{
|
||||
initCheck(false);
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isGnomeTerminal()
|
||||
&& term_detection->getGnomeTerminalID() < 3502 )
|
||||
|
@ -731,7 +705,7 @@ bool FTermXTerminal::canResetColor() const
|
|||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::oscPrefix() const
|
||||
{
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isTmuxTerm() )
|
||||
{
|
||||
|
@ -748,7 +722,7 @@ void FTermXTerminal::oscPrefix() const
|
|||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::oscPostfix() const
|
||||
{
|
||||
initCheck();
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isScreenTerm()
|
||||
|| term_detection->isTmuxTerm() )
|
||||
|
@ -761,7 +735,7 @@ void FTermXTerminal::oscPostfix() const
|
|||
//----------------------------------------------------------------------
|
||||
FString FTermXTerminal::captureXTermFont() const
|
||||
{
|
||||
initCheck(FString{});
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( ! term_detection->isXTerminal()
|
||||
&& ! term_detection->isScreenTerm()
|
||||
|
@ -823,7 +797,7 @@ FString FTermXTerminal::captureXTermFont() const
|
|||
//----------------------------------------------------------------------
|
||||
FString FTermXTerminal::captureXTermTitle() const
|
||||
{
|
||||
initCheck(FString{});
|
||||
const auto& term_detection = FTerm::getFTermDetection();
|
||||
|
||||
if ( term_detection->isKdeTerminal() )
|
||||
return FString{};
|
||||
|
@ -887,9 +861,6 @@ void FTermXTerminal::enableXTermMouse()
|
|||
if ( mouse_support )
|
||||
return; // The mouse is already activated
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
FTerm::putstring (CSI "?1001s" // save old highlight mouse tracking
|
||||
CSI "?1000;" // enable x11 mouse tracking
|
||||
"1002;" // enable cell motion mouse tracking
|
||||
|
|
|
@ -402,7 +402,7 @@ void FToggleButton::drawLabel()
|
|||
FString label_text{};
|
||||
auto hotkeypos = finalcut::getHotkeyPos(txt, label_text);
|
||||
print() << FPoint{1 + int(label_offset_pos), 1};
|
||||
drawText (std::move(label_text), hotkeypos);
|
||||
drawText (label_text, hotkeypos);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -485,7 +485,7 @@ void FToggleButton::init()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FToggleButton::drawText (FString&& label_text, std::size_t hotkeypos)
|
||||
void FToggleButton::drawText (const FString& label_text, std::size_t hotkeypos)
|
||||
{
|
||||
if ( FTerm::isMonochron() )
|
||||
setReverse(true);
|
||||
|
|
|
@ -68,12 +68,10 @@ struct timeval FVTerm::last_term_size_check{};
|
|||
std::vector<int>* FVTerm::output_buffer{nullptr};
|
||||
FPoint* FVTerm::term_pos{nullptr};
|
||||
const FVTerm* FVTerm::init_object{nullptr};
|
||||
FSystem* FVTerm::fsystem{nullptr};
|
||||
FTerm* FVTerm::fterm{nullptr};
|
||||
FVTerm::FTermArea* FVTerm::vterm{nullptr};
|
||||
FVTerm::FTermArea* FVTerm::vdesktop{nullptr};
|
||||
FVTerm::FTermArea* FVTerm::active_area{nullptr};
|
||||
FMouseControl* FVTerm::mouse{nullptr};
|
||||
FChar FVTerm::term_attribute{};
|
||||
FChar FVTerm::next_attribute{};
|
||||
FChar FVTerm::s_ch{};
|
||||
|
@ -276,6 +274,7 @@ bool FVTerm::updateTerminal() const
|
|||
// Check if terminal updates were stopped, application is stopping,
|
||||
// VTerm has no changes, or the drawing is not completed
|
||||
if ( no_terminal_updates || FApplication::isQuit()
|
||||
|| ! isFlushTimeout()
|
||||
|| ! (hasPendingUpdates(vterm) && draw_completed) )
|
||||
{
|
||||
return false;
|
||||
|
@ -308,7 +307,7 @@ void FVTerm::addPreprocessingHandler ( const FVTerm* instance
|
|||
{
|
||||
FVTermPreprocessing obj{ instance, function };
|
||||
delPreprocessingHandler (instance);
|
||||
print_area->preproc_list.push_back(obj);
|
||||
print_area->preproc_list.emplace_back(std::move(obj));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,8 +324,8 @@ void FVTerm::delPreprocessingHandler (const FVTerm* instance)
|
|||
|
||||
while ( iter != print_area->preproc_list.end() )
|
||||
{
|
||||
if ( iter->instance == instance )
|
||||
iter = print_area->preproc_list.erase(iter);
|
||||
if ( iter->instance.get() == instance )
|
||||
iter = std::move(print_area->preproc_list.erase(iter));
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
|
@ -590,6 +589,7 @@ void FVTerm::flush()
|
|||
|
||||
output_buffer->clear();
|
||||
std::fflush(stdout);
|
||||
const auto& mouse = FTerm::getFMouseControl();
|
||||
mouse->drawPointer();
|
||||
FObject::getCurrentTime (&time_last_flush);
|
||||
}
|
||||
|
@ -1278,15 +1278,12 @@ void FVTerm::initTerminal()
|
|||
if ( fterm )
|
||||
fterm->initTerminal();
|
||||
|
||||
// Get the global FMouseControl object
|
||||
mouse = FTerm::getFMouseControl();
|
||||
|
||||
// Hide the input cursor
|
||||
cursor_hideable = FTerm::isCursorHideable();
|
||||
hideCursor();
|
||||
|
||||
// Initialize character lengths
|
||||
init_characterLengths(FTerm::getFOptiMove());
|
||||
init_characterLengths();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1812,7 +1809,6 @@ void FVTerm::init()
|
|||
init_object = this;
|
||||
vterm = nullptr;
|
||||
vdesktop = nullptr;
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1863,25 +1859,30 @@ void FVTerm::init()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::init_characterLengths (const FOptiMove* optimove)
|
||||
{
|
||||
if ( optimove )
|
||||
{
|
||||
cursor_address_length = optimove->getCursorAddressLength();
|
||||
erase_char_length = optimove->getEraseCharsLength();
|
||||
repeat_char_length = optimove->getRepeatCharLength();
|
||||
clr_bol_length = optimove->getClrBolLength();
|
||||
clr_eol_length = optimove->getClrEolLength();
|
||||
}
|
||||
else
|
||||
void FVTerm::init_characterLengths()
|
||||
{
|
||||
const auto& opti_move = FTerm::getFOptiMove();
|
||||
cursor_address_length = opti_move->getCursorAddressLength();
|
||||
erase_char_length = opti_move->getEraseCharsLength();
|
||||
repeat_char_length = opti_move->getRepeatCharLength();
|
||||
clr_bol_length = opti_move->getClrBolLength();
|
||||
clr_eol_length = opti_move->getClrEolLength();
|
||||
|
||||
if ( cursor_address_length == 0 )
|
||||
cursor_address_length = INT_MAX;
|
||||
|
||||
if ( erase_char_length == 0 )
|
||||
erase_char_length = INT_MAX;
|
||||
|
||||
if ( repeat_char_length == 0 )
|
||||
repeat_char_length = INT_MAX;
|
||||
|
||||
if ( clr_bol_length == 0 )
|
||||
clr_bol_length = INT_MAX;
|
||||
|
||||
if ( clr_eol_length == 0 )
|
||||
clr_eol_length = INT_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::finish()
|
||||
|
|
|
@ -85,8 +85,8 @@ FWidget::FWidget (FWidget* parent)
|
|||
{
|
||||
if ( internal::var::root_widget )
|
||||
{
|
||||
auto ftermdata = FTerm::getFTermData();
|
||||
ftermdata->setExitMessage("FWidget: No parent defined! "
|
||||
const auto& fterm_data = FTerm::getFTermData();
|
||||
fterm_data->setExitMessage("FWidget: No parent defined! "
|
||||
"There should be only one root object");
|
||||
FApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
|
|
|
@ -33,12 +33,7 @@ namespace finalcut
|
|||
|
||||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FWidgetColors::FWidgetColors()
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FWidgetColors::~FWidgetColors()
|
||||
{ }
|
||||
FWidgetColors::~FWidgetColors() noexcept = default;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -53,8 +48,8 @@ default8ColorTheme::default8ColorTheme()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
default8ColorTheme::~default8ColorTheme()
|
||||
{ }
|
||||
default8ColorTheme::~default8ColorTheme() noexcept = default;
|
||||
|
||||
|
||||
// public methods of default8ColorTheme
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -161,8 +156,8 @@ default16ColorTheme::default16ColorTheme()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
default16ColorTheme::~default16ColorTheme()
|
||||
{ }
|
||||
default16ColorTheme::~default16ColorTheme() noexcept = default;
|
||||
|
||||
|
||||
// public methods of default16ColorTheme
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -271,8 +266,8 @@ default8ColorDarkTheme::default8ColorDarkTheme()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
default8ColorDarkTheme::~default8ColorDarkTheme()
|
||||
{ }
|
||||
default8ColorDarkTheme::~default8ColorDarkTheme() noexcept = default;
|
||||
|
||||
|
||||
// public methods of default8ColorDarkTheme
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -379,8 +374,8 @@ default16ColorDarkTheme::default16ColorDarkTheme()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
default16ColorDarkTheme::~default16ColorDarkTheme()
|
||||
{ }
|
||||
default16ColorDarkTheme::~default16ColorDarkTheme() noexcept = default;
|
||||
|
||||
|
||||
// public methods of default16ColorDarkTheme
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -62,52 +62,18 @@ public:
|
|||
// Disable copy assignment operator (=)
|
||||
emptyFString& operator = (const emptyFString&) = delete;
|
||||
|
||||
static FString getClassName();
|
||||
static bool isNull();
|
||||
static const FString& get();
|
||||
static void clear();
|
||||
static FString getClassName()
|
||||
{
|
||||
return "emptyFString";
|
||||
}
|
||||
|
||||
private:
|
||||
// Data member
|
||||
static const FString* empty_string;
|
||||
static const FString& get()
|
||||
{
|
||||
static const auto& empty_string = make_unique<FString>("");
|
||||
return *empty_string.get();
|
||||
}
|
||||
};
|
||||
|
||||
// emptyFString inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline FString emptyFString::getClassName()
|
||||
{ return "emptyFString"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool emptyFString::isNull()
|
||||
{
|
||||
return ( empty_string ) ? false : true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const FString& emptyFString::get()
|
||||
{
|
||||
if ( ! empty_string )
|
||||
{
|
||||
try
|
||||
{
|
||||
empty_string = new FString("");
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
badAllocOutput ("FString");
|
||||
}
|
||||
}
|
||||
|
||||
return *empty_string;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void emptyFString::clear()
|
||||
{
|
||||
delete empty_string;
|
||||
empty_string = nullptr;
|
||||
}
|
||||
|
||||
} // namespace fc
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -86,7 +86,6 @@ class FStartOptions;
|
|||
class FTimerEvent;
|
||||
class FWheelEvent;
|
||||
class FMouseControl;
|
||||
class FKeyboard;
|
||||
class FPoint;
|
||||
class FObject;
|
||||
|
||||
|
@ -98,7 +97,7 @@ class FApplication : public FWidget
|
|||
{
|
||||
public:
|
||||
// Typedef
|
||||
typedef std::shared_ptr<FLog> FLogPtr;
|
||||
using FLogPtr = std::shared_ptr<FLog>;
|
||||
|
||||
// Constructor
|
||||
FApplication (const int&, char*[]);
|
||||
|
@ -164,9 +163,9 @@ class FApplication : public FWidget
|
|||
#endif
|
||||
|
||||
// Typedefs
|
||||
typedef std::pair<FObject*, FEvent*> EventPair;
|
||||
typedef std::deque<EventPair> FEventQueue;
|
||||
typedef std::unordered_map<int, std::function<void(char*)>> CmdMap;
|
||||
using EventPair = std::pair<FObject*, FEvent*>;
|
||||
using FEventQueue = std::deque<EventPair>;
|
||||
using CmdMap = std::unordered_map<int, std::function<void(char*)>>;
|
||||
|
||||
// Methods
|
||||
void init();
|
||||
|
@ -244,8 +243,6 @@ class FApplication : public FWidget
|
|||
static int loop_level;
|
||||
static int quit_code;
|
||||
static bool quit_now;
|
||||
static FMouseControl* mouse;
|
||||
static FKeyboard* keyboard;
|
||||
static FWidget* keyboard_widget;
|
||||
};
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class FBusyIndicator : public FToolTip
|
|||
FBusyIndicator (const FBusyIndicator&) = delete;
|
||||
|
||||
// Destructor
|
||||
~FBusyIndicator() override;
|
||||
~FBusyIndicator() noexcept override;
|
||||
|
||||
// Disable copy assignment operator (=)
|
||||
FBusyIndicator& operator = (const FBusyIndicator&) = delete;
|
||||
|
|
|
@ -126,7 +126,7 @@ class FButtonGroup : public FScrollView
|
|||
|
||||
// Methods
|
||||
void init();
|
||||
void drawText (FString&&, std::size_t);
|
||||
void drawText (const FString&, std::size_t);
|
||||
bool directFocusCheckedRadioButton (FToggleButton*) const;
|
||||
bool directFocusRadioButton() const;
|
||||
void directFocus();
|
||||
|
|
|
@ -135,13 +135,13 @@ class FCallback
|
|||
, std::nullptr_t >;
|
||||
|
||||
// Constructors
|
||||
FCallback();
|
||||
FCallback() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
FCallback (const FCallback&) = delete;
|
||||
|
||||
// Destructor
|
||||
~FCallback();
|
||||
~FCallback() noexcept = default;
|
||||
|
||||
// Disable copy assignment operator (=)
|
||||
FCallback& operator = (const FCallback&) = delete;
|
||||
|
|
|
@ -56,7 +56,7 @@ class FColorPalette
|
|||
explicit FColorPalette (const FSetPalette&);
|
||||
|
||||
// Destructor
|
||||
virtual ~FColorPalette();
|
||||
virtual ~FColorPalette() noexcept;
|
||||
|
||||
// Accessor
|
||||
virtual FString getClassName() const;
|
||||
|
@ -104,7 +104,7 @@ class default8ColorPalette final : public FColorPalette
|
|||
explicit default8ColorPalette (const FSetPalette&);
|
||||
|
||||
// Destructor
|
||||
~default8ColorPalette() override;
|
||||
~default8ColorPalette() noexcept override;
|
||||
|
||||
// Accessor
|
||||
FString getClassName() const override;
|
||||
|
@ -144,7 +144,7 @@ class default16ColorPalette final : public FColorPalette
|
|||
explicit default16ColorPalette (const FSetPalette&);
|
||||
|
||||
// Destructor
|
||||
~default16ColorPalette() override;
|
||||
~default16ColorPalette() noexcept override;
|
||||
|
||||
// Accessor
|
||||
FString getClassName() const override;
|
||||
|
@ -183,7 +183,7 @@ class default16DarkColorPalette final : public FColorPalette
|
|||
explicit default16DarkColorPalette (const FSetPalette&);
|
||||
|
||||
// Destructor
|
||||
~default16DarkColorPalette() override;
|
||||
~default16DarkColorPalette() noexcept override;
|
||||
|
||||
// Accessor
|
||||
FString getClassName() const override;
|
||||
|
|
|
@ -118,10 +118,10 @@ class FDataAccess
|
|||
{
|
||||
public:
|
||||
// Constructor
|
||||
FDataAccess();
|
||||
FDataAccess() = default;
|
||||
|
||||
// Destructor
|
||||
virtual ~FDataAccess();
|
||||
virtual ~FDataAccess() noexcept;
|
||||
|
||||
// Accessors
|
||||
virtual FString getClassName() const
|
||||
|
@ -166,8 +166,7 @@ class FData : public FDataAccess
|
|||
{ }
|
||||
|
||||
// Destructor
|
||||
~FData() override
|
||||
{ }
|
||||
~FData() noexcept override = default;
|
||||
|
||||
FData (const FData& d) // Copy constructor
|
||||
: value{d.value}
|
||||
|
|
|
@ -195,7 +195,7 @@ class FDialog : public FWindow
|
|||
void pressZoomButton (const MouseStates&);
|
||||
bool isMouseOverMenu (const FPoint&) const;
|
||||
void passEventToSubMenu ( const MouseStates&
|
||||
, const FMouseEvent&& );
|
||||
, const FMouseEvent& );
|
||||
void moveSizeKey (FKeyEvent*);
|
||||
void raiseActivateDialog();
|
||||
void lowerActivateDialog();
|
||||
|
|
|
@ -80,9 +80,6 @@
|
|||
namespace finalcut
|
||||
{
|
||||
|
||||
// class forward declaration
|
||||
class FSystem;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FFileDialog
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -214,7 +211,6 @@ class FFileDialog : public FDialog
|
|||
void cb_processShowHidden();
|
||||
|
||||
// Data members
|
||||
static FSystem* fsystem;
|
||||
DIR* directory_stream{nullptr};
|
||||
DirEntries dir_entries{};
|
||||
FString directory{};
|
||||
|
|
|
@ -52,8 +52,6 @@ namespace finalcut
|
|||
// class forward declaration
|
||||
class FApplication;
|
||||
class FString;
|
||||
class FTermDetection;
|
||||
class FTermLinux;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FKeyboardCommand
|
||||
|
@ -137,7 +135,6 @@ class FKeyboard final
|
|||
bool hasDataInQueue() const;
|
||||
|
||||
// Methods
|
||||
static void init();
|
||||
bool& hasUnprocessedInput();
|
||||
bool isKeyPressed (uInt64 = read_blocking_time);
|
||||
void clearKeyBuffer();
|
||||
|
@ -182,12 +179,6 @@ class FKeyboard final
|
|||
FKeyboardCommand escape_key_cmd{};
|
||||
FKeyboardCommand mouse_tracking_cmd{};
|
||||
|
||||
#if defined(__linux__)
|
||||
#undef linux
|
||||
static FTermLinux* linux;
|
||||
#endif
|
||||
|
||||
FTermDetection* term_detection{nullptr};
|
||||
static timeval time_keypressed;
|
||||
static uInt64 read_blocking_time;
|
||||
static uInt64 read_blocking_time_short;
|
||||
|
|
|
@ -221,8 +221,13 @@ class FListViewIterator
|
|||
// Constructor
|
||||
FListViewIterator () = default;
|
||||
FListViewIterator (iterator);
|
||||
|
||||
FListViewIterator (const FListViewIterator&) = default;
|
||||
FListViewIterator (FListViewIterator&& )
|
||||
noexcept (std::is_nothrow_move_constructible<FListViewIterator>::value)
|
||||
= default;
|
||||
// Overloaded operators
|
||||
FListViewIterator& operator = (const FListViewIterator&) = default;
|
||||
FListViewIterator& operator = (FListViewIterator&&) noexcept = default;
|
||||
FListViewIterator& operator ++ (); // prefix
|
||||
FListViewIterator operator ++ (int); // postfix
|
||||
FListViewIterator& operator -- (); // prefix
|
||||
|
|
|
@ -75,7 +75,7 @@ class FLog : public std::stringbuf
|
|||
};
|
||||
|
||||
// Constructor
|
||||
FLog();
|
||||
FLog() = default;
|
||||
|
||||
// Destructor
|
||||
~FLog() override;
|
||||
|
|
|
@ -66,10 +66,10 @@ class FLogger : public FLog
|
|||
{
|
||||
public:
|
||||
// Constructor
|
||||
FLogger();
|
||||
FLogger() = default;
|
||||
|
||||
// Destructor
|
||||
~FLogger() override;
|
||||
~FLogger() noexcept override;
|
||||
|
||||
// Methods
|
||||
FString getClassName() const override;
|
||||
|
|
|
@ -192,9 +192,9 @@ class FMenu : public FWindow, public FMenuList
|
|||
void mouseMoveDeselection (FMenuItem*, MouseStates&);
|
||||
void mouseUpOverBorder();
|
||||
void mouseMoveOverBorder (MouseStates&) const;
|
||||
void passEventToSubMenu (const FMouseEvent&&);
|
||||
void passEventToSuperMenu (const FMouseEvent&&);
|
||||
void passEventToMenuBar (const FMouseEvent&&) const;
|
||||
void passEventToSubMenu (const FMouseEvent&);
|
||||
void passEventToSuperMenu (const FMouseEvent&);
|
||||
void passEventToMenuBar (const FMouseEvent&) const;
|
||||
bool containsMenuStructure (const FPoint&);
|
||||
bool containsMenuStructure (int, int);
|
||||
FMenu* superMenuAt (const FPoint&);
|
||||
|
|
|
@ -138,7 +138,7 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
void selectMenuItem (FMenuItem*);
|
||||
void mouseDownOverList (const FMouseEvent*);
|
||||
void mouseUpOverList (const FMouseEvent*);
|
||||
void mouseMoveOverList (const FMouseEvent&&);
|
||||
void mouseMoveOverList (const FMouseEvent&);
|
||||
void passEventToMenu (const FMouseEvent&&) const;
|
||||
void leaveMenuBar();
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class FMessageBox : public FDialog
|
|||
, ButtonType, ButtonType, ButtonType
|
||||
, FWidget* = nullptr );
|
||||
// Destructor
|
||||
virtual ~FMessageBox() noexcept override;
|
||||
~FMessageBox() noexcept override;
|
||||
|
||||
// copy assignment operator (=)
|
||||
FMessageBox& operator = (const FMessageBox&);
|
||||
|
|
|
@ -90,25 +90,19 @@ namespace finalcut
|
|||
class FMouseData
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
FMouseData() = default;
|
||||
|
||||
// Copy constructor
|
||||
FMouseData (const FMouseData&) = default;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMouseData() noexcept;
|
||||
|
||||
// Accessors
|
||||
virtual FString getClassName() const;
|
||||
const FPoint& getPos() const;
|
||||
|
||||
// Constructor
|
||||
FMouseData();
|
||||
|
||||
// Default copy constructor
|
||||
FMouseData (const FMouseData&) = default;
|
||||
// Default move constructor
|
||||
FMouseData (FMouseData&&) = default;
|
||||
// Default copy assignment operator (=)
|
||||
FMouseData& operator = (const FMouseData&) = default;
|
||||
// Default move assignment operator (=)
|
||||
FMouseData& operator = (FMouseData&&) = default;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMouseData();
|
||||
|
||||
// Inquiries
|
||||
bool isLeftButtonPressed() const;
|
||||
bool isLeftButtonReleased() const;
|
||||
|
@ -185,9 +179,6 @@ class FMouse : public FMouseData
|
|||
// Constructor
|
||||
FMouse();
|
||||
|
||||
// Destructor
|
||||
~FMouse() override;
|
||||
|
||||
// Accessors
|
||||
FString getClassName() const override;
|
||||
void clearEvent();
|
||||
|
@ -256,9 +247,6 @@ class FMouseGPM final : public FMouse
|
|||
// Constructor
|
||||
FMouseGPM();
|
||||
|
||||
// Destructor
|
||||
~FMouseGPM() override = default;
|
||||
|
||||
// Accessors
|
||||
FString getClassName() const override;
|
||||
|
||||
|
@ -321,12 +309,6 @@ inline bool FMouseGPM::isGpmMouseEnabled() const
|
|||
class FMouseX11 final : public FMouse
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
FMouseX11() = default;
|
||||
|
||||
// Destructor
|
||||
~FMouseX11() override = default;
|
||||
|
||||
// Accessors
|
||||
FString getClassName() const override;
|
||||
|
||||
|
@ -380,12 +362,6 @@ class FMouseX11 final : public FMouse
|
|||
class FMouseSGR final : public FMouse
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
FMouseSGR() = default;
|
||||
|
||||
// Destructor
|
||||
~FMouseSGR() override = default;
|
||||
|
||||
// Accessors
|
||||
FString getClassName() const override;
|
||||
|
||||
|
@ -439,12 +415,6 @@ class FMouseSGR final : public FMouse
|
|||
class FMouseUrxvt final : public FMouse
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
FMouseUrxvt() = default;
|
||||
|
||||
// Destructor
|
||||
~FMouseUrxvt() override = default;
|
||||
|
||||
// Accessors
|
||||
FString getClassName() const override;
|
||||
|
||||
|
@ -527,15 +497,9 @@ class FMouseControl
|
|||
// Constructor
|
||||
FMouseControl();
|
||||
|
||||
// Disable copy constructor
|
||||
FMouseControl (const FMouseControl&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMouseControl();
|
||||
|
||||
// Disable copy assignment operator (=)
|
||||
FMouseControl& operator = (const FMouseControl&) = delete;
|
||||
|
||||
// Accessors
|
||||
virtual FString getClassName() const;
|
||||
const FPoint& getPos();
|
||||
|
@ -545,7 +509,7 @@ class FMouseControl
|
|||
void setStdinNo (int);
|
||||
void setMaxWidth (uInt16);
|
||||
void setMaxHeight (uInt16);
|
||||
void setDblclickInterval (const uInt64);
|
||||
void setDblclickInterval (const uInt64) const;
|
||||
void setEventCommand (const FMouseCommand&);
|
||||
void useGpmMouse (bool = true);
|
||||
void useXtermMouse (bool = true);
|
||||
|
|
|
@ -152,7 +152,7 @@ class FObject
|
|||
|
||||
// Using-declaration
|
||||
using FTimerList = std::vector<FTimerData>;
|
||||
using FTimerListPtr = const std::unique_ptr<FTimerList>;
|
||||
using FTimerListUniquePtr = std::unique_ptr<FTimerList>;
|
||||
|
||||
// Accessor
|
||||
FTimerList* getTimerList() const;
|
||||
|
@ -170,7 +170,7 @@ class FObject
|
|||
private:
|
||||
// Method
|
||||
virtual void performTimerAction (FObject*, FEvent*);
|
||||
static FTimerListPtr& globalTimerList();
|
||||
static auto globalTimerList() -> const FTimerListUniquePtr&;
|
||||
|
||||
// Data members
|
||||
FObject* parent_obj{nullptr};
|
||||
|
|
|
@ -59,7 +59,7 @@ class FPoint
|
|||
FPoint& operator -= (const FPoint&);
|
||||
|
||||
// Accessors
|
||||
FString getClassName();
|
||||
FString getClassName() const;
|
||||
int getX() const;
|
||||
int getY() const;
|
||||
void setX (int);
|
||||
|
@ -102,7 +102,7 @@ inline FPoint::FPoint (int x, int y)
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FString FPoint::getClassName()
|
||||
inline FString FPoint::getClassName() const
|
||||
{ return "FPoint"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -65,7 +65,7 @@ class FRect
|
|||
FRect (const FPoint&, const FPoint&);
|
||||
|
||||
// Accessors
|
||||
FString getClassName();
|
||||
FString getClassName() const;
|
||||
int getX1() const;
|
||||
int getY1() const;
|
||||
int getX2() const;
|
||||
|
@ -147,7 +147,7 @@ inline FRect::FRect (int x, int y, std::size_t width, std::size_t height)
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FString FRect::getClassName()
|
||||
inline FString FRect::getClassName() const
|
||||
{ return "FRect"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -64,7 +64,7 @@ class FSize
|
|||
FSize& operator -= (const FSize&);
|
||||
|
||||
// Accessors
|
||||
FString getClassName();
|
||||
FString getClassName() const;
|
||||
std::size_t getWidth() const;
|
||||
std::size_t getHeight() const;
|
||||
std::size_t getArea() const;
|
||||
|
@ -111,7 +111,7 @@ inline FSize::FSize (std::size_t w, std::size_t h)
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FString FSize::getClassName()
|
||||
inline FString FSize::getClassName() const
|
||||
{ return "FSize"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -72,13 +72,13 @@ class FStringStream : public std::wiostream
|
|||
FStringStream (FStringStream&&) noexcept;
|
||||
|
||||
// Destructor
|
||||
~FStringStream();
|
||||
~FStringStream() noexcept;
|
||||
|
||||
// Disable copy assignment operator (=)
|
||||
FStringStream& operator = (const FStringStream&) = delete;
|
||||
|
||||
// Move assignment operator (=)
|
||||
FStringStream& operator = (FStringStream&& sstream) noexcept;
|
||||
FStringStream& operator = (FStringStream&&) noexcept;
|
||||
|
||||
virtual FString getClassName() const;
|
||||
void swap (FStringStream&) noexcept;
|
||||
|
|
|
@ -142,15 +142,15 @@ class FTermDebugData;
|
|||
class FTermDetection;
|
||||
class FTermXTerminal;
|
||||
|
||||
#if defined(UNIT_TEST)
|
||||
#if defined(__linux__) || defined(UNIT_TEST)
|
||||
class FTermLinux;
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
|
||||
class FTermFreeBSD;
|
||||
class FTermOpenBSD;
|
||||
#elif defined(__linux__)
|
||||
class FTermLinux;
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
class FTermFreeBSD;
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
|
||||
class FTermOpenBSD;
|
||||
#endif
|
||||
|
||||
|
@ -163,7 +163,6 @@ class FTerm final
|
|||
public:
|
||||
// Using-declarations
|
||||
using defaultPutChar = std::function<int(int)>;
|
||||
using FColorPalettePtr = std::shared_ptr<FColorPalette>;
|
||||
using FSetPalette = FColorPalette::FSetPalette;
|
||||
|
||||
// Constructor
|
||||
|
@ -183,36 +182,36 @@ class FTerm final
|
|||
static std::size_t getLineNumber();
|
||||
static std::size_t getColumnNumber();
|
||||
static FString getKeyName (FKey);
|
||||
charSubstitution& getCharSubstitutionMap();
|
||||
static int getTTYFileDescriptor();
|
||||
static const char* getTermType();
|
||||
static const char* getTermFileName();
|
||||
static int getTabstop();
|
||||
static int getMaxColor();
|
||||
static FColorPalettePtr& getColorPaletteTheme();
|
||||
charSubstitution& getCharSubstitutionMap();
|
||||
static FTermData* getFTermData();
|
||||
static FSystem* getFSystem();
|
||||
static FOptiMove* getFOptiMove();
|
||||
static FOptiAttr* getFOptiAttr();
|
||||
static FTermDetection* getFTermDetection();
|
||||
static FTermXTerminal* getFTermXTerminal();
|
||||
static FKeyboard* getFKeyboard();
|
||||
static FMouseControl* getFMouseControl();
|
||||
static auto getColorPaletteTheme() -> std::shared_ptr<FColorPalette>&;
|
||||
static auto getFTermData() -> const std::unique_ptr<FTermData>&;
|
||||
static auto getFSystem() -> std::unique_ptr<FSystem>&;
|
||||
static auto getFOptiMove() -> const std::unique_ptr<FOptiMove>&;
|
||||
static auto getFOptiAttr() -> const std::unique_ptr<FOptiAttr>&;
|
||||
static auto getFTermDetection() -> const std::unique_ptr<FTermDetection>&;
|
||||
static auto getFTermXTerminal() -> const std::unique_ptr<FTermXTerminal>&;
|
||||
static auto getFKeyboard() -> const std::unique_ptr<FKeyboard>&;
|
||||
static auto getFMouseControl() -> const std::unique_ptr<FMouseControl>&;
|
||||
|
||||
#if defined(UNIT_TEST)
|
||||
static FTermLinux* getFTermLinux();
|
||||
static FTermFreeBSD* getFTermFreeBSD();
|
||||
static FTermOpenBSD* getFTermOpenBSD();
|
||||
#elif defined(__linux__)
|
||||
static FTermLinux* getFTermLinux();
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
static FTermFreeBSD* getFTermFreeBSD();
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
static FTermOpenBSD* getFTermOpenBSD();
|
||||
#if defined(__linux__) || defined(UNIT_TEST)
|
||||
static auto getFTermLinux() -> const std::unique_ptr<FTermLinux>&;
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
|
||||
static auto getFTermFreeBSD() -> const std::unique_ptr<FTermFreeBSD>&;
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
|
||||
static auto getFTermOpenBSD() -> const std::unique_ptr<FTermOpenBSD>&;
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
static FTermDebugData& getFTermDebugData();
|
||||
static auto getFTermDebugData() -> const std::unique_ptr<FTermDebugData>&;
|
||||
#endif
|
||||
|
||||
// Inquiries
|
||||
|
@ -252,7 +251,7 @@ class FTerm final
|
|||
static bool canChangeColorPalette();
|
||||
|
||||
// Mutators
|
||||
static void setFSystem (FSystem*);
|
||||
static void setFSystem (std::unique_ptr<FSystem>&&);
|
||||
static void setTermType (const char[]);
|
||||
static void setInsertCursor (bool);
|
||||
static void setInsertCursor();
|
||||
|
@ -319,7 +318,6 @@ class FTerm final
|
|||
static void init_cygwin_charmap();
|
||||
static void init_teraterm_charmap();
|
||||
static void init_fixed_max_color();
|
||||
static void init_keyboard();
|
||||
static void init_termcap();
|
||||
static void init_quirks();
|
||||
static void init_optiMove();
|
||||
|
@ -351,8 +349,6 @@ class FTerm final
|
|||
static void enableAlternateCharset();
|
||||
static void useAlternateScreenBuffer();
|
||||
static void useNormalScreenBuffer();
|
||||
void allocationValues() const;
|
||||
void deallocationValues();
|
||||
void init();
|
||||
bool init_terminal() const;
|
||||
void initOSspecifics() const;
|
||||
|
@ -361,41 +357,12 @@ class FTerm final
|
|||
void finish() const;
|
||||
void finishOSspecifics() const;
|
||||
void finish_encoding() const;
|
||||
void destroyColorPaletteTheme();
|
||||
static void printExitMessage();
|
||||
static void terminalSizeChange();
|
||||
[[noreturn]] static void processTermination (int);
|
||||
static void setSignalHandler();
|
||||
static void resetSignalHandler();
|
||||
static void signal_handler (int);
|
||||
|
||||
// Data members
|
||||
static FTermData* data;
|
||||
static FSystem* fsys;
|
||||
static FOptiMove* opti_move;
|
||||
static FOptiAttr* opti_attr;
|
||||
static FTermDetection* term_detection;
|
||||
static FTermXTerminal* xterm;
|
||||
static FKeyboard* keyboard;
|
||||
static FMouseControl* mouse;
|
||||
|
||||
#if defined(UNIT_TEST)
|
||||
#undef linux
|
||||
static FTermLinux* linux;
|
||||
static FTermFreeBSD* freebsd;
|
||||
static FTermOpenBSD* openbsd;
|
||||
#elif defined(__linux__)
|
||||
#undef linux
|
||||
static FTermLinux* linux;
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
static FTermFreeBSD* freebsd;
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
static FTermOpenBSD* openbsd;
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
static FTermDebugData* debug_data;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -424,8 +391,10 @@ inline FString FTerm::getClassName()
|
|||
{ return "FTerm"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTerm::setFSystem (FSystem* fsystem)
|
||||
{ fsys = fsystem; }
|
||||
inline void FTerm::setFSystem (std::unique_ptr<FSystem>&& fsystem)
|
||||
{
|
||||
getFSystem().swap(fsystem);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTerm::setInsertCursor()
|
||||
|
@ -460,14 +429,10 @@ inline void FTerm::putstringf (const char format[], Args&&... args)
|
|||
if ( size == -1 )
|
||||
return;
|
||||
|
||||
if ( ! fsys )
|
||||
getFSystem(); // Trying to set fsys
|
||||
|
||||
const auto count = std::size_t(size);
|
||||
std::vector<char> buf(count);
|
||||
std::snprintf (&buf[0], count, format, std::forward<Args>(args)...);
|
||||
|
||||
if ( fsys )
|
||||
const auto& fsys = FTerm::getFSystem();
|
||||
fsys->tputs (&buf[0], 1, FTerm::putchar_ASCII);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,17 +60,14 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "final/ftermcap.h"
|
||||
|
||||
// FTermcap string macro
|
||||
#define TCAP(...) FTermcap::strings[__VA_ARGS__].string
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
// class forward declaration
|
||||
class FSystem;
|
||||
class FTermData;
|
||||
class FTermDetection;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FTermcap
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -148,10 +145,8 @@ class FTermcap final
|
|||
static int _tputs (const char*, int, fn_putc);
|
||||
|
||||
// Data member
|
||||
static FSystem* fsystem;
|
||||
static FTermData* fterm_data;
|
||||
static FTermDetection* term_detection;
|
||||
static char string_buf[BUF_SIZE];
|
||||
static bool initialized;
|
||||
};
|
||||
|
||||
|
||||
|
@ -206,7 +201,7 @@ int FTermcap::paddingPrint (const CharT& str, int affcnt, fn_putc putc)
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FTermcap::isInitialized()
|
||||
{
|
||||
return bool(fsystem && fterm_data && term_detection);
|
||||
return initialized;
|
||||
}
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -38,10 +38,6 @@
|
|||
namespace finalcut
|
||||
{
|
||||
|
||||
// class forward declaration
|
||||
class FTermData;
|
||||
class FTermDetection;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FTermcapsQuirks
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -77,10 +73,6 @@ class FTermcapQuirks final
|
|||
static void screen();
|
||||
static void general();
|
||||
static void ecma48();
|
||||
|
||||
// Data members
|
||||
static FTermData* fterm_data;
|
||||
static FTermDetection* term_detection;
|
||||
};
|
||||
|
||||
// FTermcapQuirks inline functions
|
||||
|
|
|
@ -40,8 +40,6 @@ namespace finalcut
|
|||
|
||||
// class forward declaration
|
||||
class FTerm;
|
||||
class FTermData;
|
||||
class FTermDetection;
|
||||
|
||||
#if DEBUG
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -72,14 +70,6 @@ class FTermDebugData final
|
|||
#if defined(__linux__)
|
||||
int getFramebufferBpp();
|
||||
#endif
|
||||
|
||||
// Methods
|
||||
static void init();
|
||||
|
||||
private:
|
||||
// Data members
|
||||
static FTermData* data;
|
||||
static FTermDetection* term_detection;
|
||||
};
|
||||
#endif // DEBUG
|
||||
|
||||
|
|
|
@ -207,9 +207,6 @@ class FTermDetection final
|
|||
static int gnome_terminal_id;
|
||||
static const FString* answer_back;
|
||||
static const FString* sec_da;
|
||||
static FTermData* fterm_data;
|
||||
static FSystem* fsystem;
|
||||
static FKeyboard* keyboard;
|
||||
static FTerminalType terminal_type;
|
||||
static colorEnv color_env;
|
||||
static secondaryDA secondary_da;
|
||||
|
|
|
@ -69,7 +69,6 @@ namespace finalcut
|
|||
{
|
||||
|
||||
// class forward declaration
|
||||
class FSystem;
|
||||
class FTermData;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -123,15 +122,12 @@ class FTermFreeBSD final
|
|||
static bool setFreeBSDAlt2Meta();
|
||||
static bool resetFreeBSDAlt2Meta();
|
||||
static bool setFreeBSDCursorStyle (CursorStyle);
|
||||
static bool isInitialized();
|
||||
|
||||
// Data members
|
||||
static uInt bsd_alt_keymap;
|
||||
static CursorStyle cursor_style;
|
||||
static bool change_cursorstyle;
|
||||
static bool meta_sends_escape;
|
||||
static FSystem* fsystem;
|
||||
static FTermData* fterm_data;
|
||||
};
|
||||
|
||||
|
||||
|
@ -157,9 +153,6 @@ inline void FTermFreeBSD::enableMetaSendsEscape()
|
|||
inline void FTermFreeBSD::disableMetaSendsEscape()
|
||||
{ meta_sends_escape = false; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTermFreeBSD::isInitialized()
|
||||
{ return bool(fsystem && fterm_data); }
|
||||
#endif // defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -65,11 +65,6 @@
|
|||
namespace finalcut
|
||||
{
|
||||
|
||||
// class forward declaration
|
||||
class FSystem;
|
||||
class FTermData;
|
||||
class FTermDetection;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FTermLinux
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -187,9 +182,6 @@ class FTermLinux final
|
|||
bool vga_font{};
|
||||
bool new_font{};
|
||||
bool has_saved_palette{};
|
||||
FTermData* fterm_data{nullptr};
|
||||
FSystem* fsystem{nullptr};
|
||||
FTermDetection* term_detection{nullptr};
|
||||
CursorStyle linux_console_cursor_style{};
|
||||
console_font_op screen_font{};
|
||||
unimapdesc screen_unicode_map{};
|
||||
|
|
|
@ -64,9 +64,6 @@
|
|||
namespace finalcut
|
||||
{
|
||||
|
||||
// class forward declaration
|
||||
class FSystem;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FTermOpenBSD
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -110,12 +107,10 @@ class FTermOpenBSD final
|
|||
static bool setBSDConsoleEncoding (kbd_t);
|
||||
static bool setBSDConsoleMetaEsc();
|
||||
static bool resetBSDConsoleEncoding();
|
||||
static bool isInitialized();
|
||||
|
||||
// Data members
|
||||
static kbd_t bsd_keyboard_encoding;
|
||||
static bool meta_sends_escape;
|
||||
static FSystem* fsystem;
|
||||
#endif // defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
|
||||
};
|
||||
|
||||
|
@ -134,9 +129,6 @@ inline void FTermOpenBSD::enableMetaSendsEscape()
|
|||
inline void FTermOpenBSD::disableMetaSendsEscape()
|
||||
{ meta_sends_escape = false; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTermOpenBSD::isInitialized()
|
||||
{ return bool(fsystem); }
|
||||
#endif // defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -40,9 +40,6 @@ namespace finalcut
|
|||
|
||||
// class forward declaration
|
||||
class FString;
|
||||
class FSystem;
|
||||
class FKeyboard;
|
||||
class FTermDetection;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FTermXTerminal
|
||||
|
@ -52,7 +49,7 @@ class FTermXTerminal final
|
|||
{
|
||||
public:
|
||||
// Constructors
|
||||
FTermXTerminal();
|
||||
FTermXTerminal() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
FTermXTerminal (const FTermXTerminal&) = delete;
|
||||
|
@ -97,7 +94,6 @@ class FTermXTerminal final
|
|||
bool hasTitle() const;
|
||||
|
||||
// Methods
|
||||
void init();
|
||||
void setDefaults();
|
||||
void resetColorMap() const;
|
||||
void resetForeground();
|
||||
|
@ -134,7 +130,6 @@ class FTermXTerminal final
|
|||
void resetXTermMouseForeground() const;
|
||||
void resetXTermMouseBackground() const;
|
||||
void resetXTermHighlightBackground() const;
|
||||
bool isInitialized() const;
|
||||
bool canResetColor() const;
|
||||
void oscPrefix() const;
|
||||
void oscPostfix() const;
|
||||
|
@ -160,9 +155,6 @@ class FTermXTerminal final
|
|||
FString mouse_foreground_color{};
|
||||
FString mouse_background_color{};
|
||||
FString highlight_background_color{};
|
||||
static FSystem* fsystem;
|
||||
static FKeyboard* keyboard;
|
||||
FTermDetection* term_detection{nullptr};
|
||||
fc::xtermCursorStyle cursor_style{fc::unknown_cursor_style};
|
||||
};
|
||||
|
||||
|
@ -228,10 +220,6 @@ inline void FTermXTerminal::setMouseSupport()
|
|||
inline void FTermXTerminal::unsetMouseSupport()
|
||||
{ setMouseSupport (false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTermXTerminal::isInitialized() const
|
||||
{ return bool(fsystem && term_detection); }
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // FTERMXTERMINAL_H
|
||||
|
|
|
@ -148,7 +148,7 @@ class FToggleButton : public FWidget
|
|||
|
||||
// Methods
|
||||
void init();
|
||||
void drawText (FString&&, std::size_t);
|
||||
void drawText (const FString&, std::size_t);
|
||||
void correctSize (FSize&) const;
|
||||
|
||||
// Data members
|
||||
|
|
|
@ -68,12 +68,10 @@ namespace finalcut
|
|||
|
||||
// class forward declaration
|
||||
class FColorPair;
|
||||
class FMouseControl;
|
||||
class FPoint;
|
||||
class FRect;
|
||||
class FSize;
|
||||
class FString;
|
||||
class FSystem;
|
||||
class FTerm;
|
||||
class FTermBuffer;
|
||||
class FTermDebugData;
|
||||
|
@ -370,7 +368,7 @@ class FVTerm
|
|||
static FChar getCoveredCharacter (const FPoint&, const FTermArea*);
|
||||
static FChar getOverlappedCharacter (const FPoint&, const FTermArea*);
|
||||
void init();
|
||||
static void init_characterLengths (const FOptiMove*);
|
||||
static void init_characterLengths();
|
||||
void finish();
|
||||
static void putAreaLine (const FChar&, FChar&, std::size_t);
|
||||
static void putAreaCharacter ( const FPoint&, const FTermArea*
|
||||
|
@ -426,7 +424,6 @@ class FVTerm
|
|||
FTermArea* child_print_area{nullptr}; // print area for children
|
||||
FTermArea* vwin{nullptr}; // virtual window
|
||||
static const FVTerm* init_object; // Global FVTerm object
|
||||
static FSystem* fsystem;
|
||||
static FTerm* fterm;
|
||||
static FTermArea* vterm; // virtual terminal
|
||||
static FTermArea* vdesktop; // virtual desktop
|
||||
|
@ -437,7 +434,6 @@ class FVTerm
|
|||
static FChar s_ch; // shadow character
|
||||
static FChar i_ch; // inherit background character
|
||||
static FPoint* term_pos; // terminal cursor position
|
||||
static FMouseControl* mouse;
|
||||
static timeval time_last_flush;
|
||||
static timeval last_term_size_check;
|
||||
static bool draw_completed;
|
||||
|
@ -492,6 +488,11 @@ struct FVTerm::FTermArea // define virtual terminal character properties
|
|||
bool visible{false};
|
||||
};
|
||||
|
||||
struct D
|
||||
{
|
||||
void operator () (const FVTerm*) const
|
||||
{ }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// struct FVTerm::FVTermPreprocessing
|
||||
|
@ -500,16 +501,19 @@ struct FVTerm::FTermArea // define virtual terminal character properties
|
|||
struct FVTerm::FVTermPreprocessing
|
||||
{
|
||||
// Constructor
|
||||
FVTermPreprocessing() = default;
|
||||
|
||||
FVTermPreprocessing (const FVTerm* i, const FPreprocessingFunction& f)
|
||||
: instance(i)
|
||||
: instance(std::unique_ptr<const FVTerm, D>(i))
|
||||
, function(f)
|
||||
{ }
|
||||
|
||||
FVTermPreprocessing (const FVTermPreprocessing&) = delete;
|
||||
FVTermPreprocessing (FVTermPreprocessing&&) = default;
|
||||
FVTermPreprocessing& operator = (const FVTermPreprocessing&) = delete;
|
||||
FVTermPreprocessing& operator = (FVTermPreprocessing&&) noexcept = default;
|
||||
|
||||
// Data members
|
||||
const FVTerm* instance{nullptr};
|
||||
FPreprocessingFunction function{nullptr};
|
||||
std::unique_ptr<const FVTerm, D> instance{};
|
||||
FPreprocessingFunction function{};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -48,10 +48,10 @@ class FWidgetColors
|
|||
{
|
||||
public:
|
||||
// Constructor
|
||||
FWidgetColors();
|
||||
FWidgetColors() = default;
|
||||
|
||||
// Destructor
|
||||
virtual ~FWidgetColors();
|
||||
virtual ~FWidgetColors() noexcept;
|
||||
|
||||
// Method
|
||||
virtual FString getClassName() const;
|
||||
|
@ -176,7 +176,7 @@ class default8ColorTheme final : public FWidgetColors
|
|||
default8ColorTheme();
|
||||
|
||||
// Destructor
|
||||
~default8ColorTheme() override;
|
||||
~default8ColorTheme() noexcept override;
|
||||
|
||||
// Method
|
||||
FString getClassName() const override;
|
||||
|
@ -213,7 +213,7 @@ class default16ColorTheme final : public FWidgetColors
|
|||
default16ColorTheme();
|
||||
|
||||
// Destructor
|
||||
~default16ColorTheme() override;
|
||||
~default16ColorTheme() noexcept override;
|
||||
|
||||
// Method
|
||||
FString getClassName() const override;
|
||||
|
@ -250,7 +250,7 @@ class default8ColorDarkTheme final : public FWidgetColors
|
|||
default8ColorDarkTheme();
|
||||
|
||||
// Destructor
|
||||
~default8ColorDarkTheme() override;
|
||||
~default8ColorDarkTheme() noexcept override;
|
||||
|
||||
// Method
|
||||
FString getClassName() const override;
|
||||
|
@ -287,7 +287,7 @@ class default16ColorDarkTheme final : public FWidgetColors
|
|||
default16ColorDarkTheme();
|
||||
|
||||
// Destructor
|
||||
~default16ColorDarkTheme() override;
|
||||
~default16ColorDarkTheme() noexcept override;
|
||||
|
||||
// Method
|
||||
FString getClassName() const override;
|
||||
|
|
|
@ -531,7 +531,7 @@ inline pid_t ConEmu::forkConEmu()
|
|||
|
||||
#ifdef TIOCSWINSZ
|
||||
// Set slave tty window size
|
||||
struct winsize size;
|
||||
struct winsize size{};
|
||||
size.ws_row = 25;
|
||||
size.ws_col = 80;
|
||||
|
||||
|
|
|
@ -573,7 +573,6 @@ struct keymap_t& FSystemTest::getTerminalKeymap()
|
|||
return terminal_keymap;
|
||||
}
|
||||
|
||||
|
||||
} // namespace test
|
||||
|
||||
|
||||
|
@ -624,11 +623,10 @@ void ftermfreebsdTest::freebsdConsoleTest()
|
|||
setenv ("COLUMNS", "80", 1);
|
||||
setenv ("LINES", "25", 1);
|
||||
|
||||
finalcut::FSystem* fsys = new test::FSystemTest();
|
||||
finalcut::FTermDetection* term_detection{};
|
||||
finalcut::FTerm::setFSystem(fsys);
|
||||
auto fsys = finalcut::make_unique<test::FSystemTest>();
|
||||
finalcut::FTerm::setFSystem(std::move(fsys));
|
||||
std::cout << "\n";
|
||||
finalcut::FTermData* data = finalcut::FTerm::getFTermData();
|
||||
const auto& data = finalcut::FTerm::getFTermData();
|
||||
|
||||
auto& encoding_list = data->getEncodingList();
|
||||
encoding_list["UTF-8"] = finalcut::fc::UTF8;
|
||||
|
@ -655,10 +653,9 @@ void ftermfreebsdTest::freebsdConsoleTest()
|
|||
data->setVGAFont (false);
|
||||
data->setMonochron (false);
|
||||
data->setTermResized (false);
|
||||
|
||||
// setupterm is needed for tputs in ncurses >= 6.1
|
||||
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
|
||||
term_detection = finalcut::FTerm::getFTermDetection();
|
||||
const auto& term_detection = finalcut::FTerm::getFTermDetection();
|
||||
term_detection->setTerminalDetection(true);
|
||||
pid_t pid = forkConEmu();
|
||||
|
||||
|
@ -666,7 +663,8 @@ void ftermfreebsdTest::freebsdConsoleTest()
|
|||
{
|
||||
static constexpr int left_alt = 0x38;
|
||||
finalcut::FTermFreeBSD freebsd;
|
||||
test::FSystemTest* fsystest = static_cast<test::FSystemTest*>(fsys);
|
||||
const auto& fsystem = finalcut::FTerm::getFSystem();
|
||||
auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());
|
||||
struct keymap_t& keymap = fsystest->getTerminalKeymap();
|
||||
|
||||
setenv ("TERM", "xterm", 1);
|
||||
|
@ -760,7 +758,7 @@ void ftermfreebsdTest::freebsdConsoleTest()
|
|||
|
||||
#if DEBUG
|
||||
const finalcut::FString& sec_da = \
|
||||
finalcut::FTerm::getFTermDebugData().getSecDAString();
|
||||
finalcut::FTerm::getFTermDebugData()->getSecDAString();
|
||||
CPPUNIT_ASSERT ( sec_da == "\033[>0;10;0c" );
|
||||
#endif
|
||||
|
||||
|
@ -773,6 +771,7 @@ void ftermfreebsdTest::freebsdConsoleTest()
|
|||
|
||||
data->setCursorHidden (false);
|
||||
freebsd.setCursorStyle (finalcut::fc::normal_cursor);
|
||||
|
||||
CPPUNIT_ASSERT ( fsystest->getCursorType() == finalcut::fc::normal_cursor );
|
||||
|
||||
freebsd.setCursorStyle (finalcut::fc::blink_cursor);
|
||||
|
@ -812,8 +811,6 @@ void ftermfreebsdTest::freebsdConsoleTest()
|
|||
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
||||
std::cerr << "waitpid error" << std::endl;
|
||||
}
|
||||
|
||||
delete fsys;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -994,10 +994,16 @@ FSystemTest::FSystemTest() // constructor
|
|||
FSystemTest::~FSystemTest() // destructor
|
||||
{
|
||||
if ( terminal_font.data )
|
||||
{
|
||||
delete[] terminal_font.data;
|
||||
terminal_font.data = nullptr;
|
||||
}
|
||||
|
||||
if ( terminal_unicode_map.entries )
|
||||
{
|
||||
delete[] terminal_unicode_map.entries;
|
||||
terminal_unicode_map.entries = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1091,8 +1097,16 @@ int FSystemTest::ioctl (int fd, uLong request, ...)
|
|||
constexpr std::size_t font_data_size = 4 * 32 * 512;
|
||||
struct console_font_op* fn = static_cast<console_font_op*>(argp);
|
||||
|
||||
if ( fn->op == KD_FONT_OP_GET )
|
||||
{
|
||||
// If data is empty
|
||||
if ( ! terminal_font.data )
|
||||
{
|
||||
terminal_font.data = new uChar[font_data_size]{ };
|
||||
}
|
||||
|
||||
// Set Default
|
||||
if ( terminal_font.data && terminal_font.data[219 * 32] == 0 )
|
||||
if ( terminal_font.data[219 * 32] == 0 )
|
||||
{
|
||||
terminal_font.width = 8;
|
||||
terminal_font.height = 16;
|
||||
|
@ -1102,8 +1116,6 @@ int FSystemTest::ioctl (int fd, uLong request, ...)
|
|||
std::memcpy (terminal_font.data, &vga8x16, sizeof(vga8x16));
|
||||
}
|
||||
|
||||
if ( fn->op == KD_FONT_OP_GET )
|
||||
{
|
||||
fn->flags = terminal_font.flags;
|
||||
fn->width = terminal_font.width;
|
||||
fn->height = terminal_font.height;
|
||||
|
@ -1121,7 +1133,13 @@ int FSystemTest::ioctl (int fd, uLong request, ...)
|
|||
terminal_font.width = fn->width;
|
||||
terminal_font.height = fn->height;
|
||||
terminal_font.charcount = fn->charcount;
|
||||
auto size = fn->width / 8 * fn->height * fn->charcount;
|
||||
constexpr int fix_height = 32; // This value is identical for all fonts
|
||||
auto size = fn->width / 8 * fix_height * fn->charcount;
|
||||
|
||||
if ( ! terminal_font.data ) // If data is empty on a second run
|
||||
{
|
||||
terminal_font.data = new uChar[font_data_size]{ };
|
||||
}
|
||||
|
||||
if ( fn->data && terminal_font.data )
|
||||
std::memcpy (terminal_font.data, fn->data, size);
|
||||
|
@ -1194,7 +1212,7 @@ int FSystemTest::ioctl (int fd, uLong request, ...)
|
|||
std::size_t pairs_size = pairs * sizeof(unipair);
|
||||
|
||||
// Sets the default unicode map of the terminal on the first call
|
||||
if ( terminal_unicode_map.entries == 0 )
|
||||
if ( ! terminal_unicode_map.entries )
|
||||
{
|
||||
terminal_unicode_map.entry_ct = pairs;
|
||||
terminal_unicode_map.entries = new unipair[pairs]();
|
||||
|
@ -1222,8 +1240,30 @@ int FSystemTest::ioctl (int fd, uLong request, ...)
|
|||
{
|
||||
req_string = "PIO_UNIMAP";
|
||||
unimapdesc* umap = static_cast<unimapdesc*>(argp);
|
||||
std::memcpy (&terminal_unicode_map, umap, sizeof(*umap));
|
||||
std::size_t pairs = umap->entry_ct;
|
||||
std::size_t pairs_size = pairs * sizeof(unipair);
|
||||
terminal_unicode_map.entry_ct = umap->entry_ct;
|
||||
|
||||
if ( terminal_unicode_map.entries )
|
||||
{
|
||||
delete[] terminal_unicode_map.entries;
|
||||
terminal_unicode_map.entries = nullptr;
|
||||
}
|
||||
|
||||
terminal_unicode_map.entries = new unipair[pairs]();
|
||||
|
||||
if ( umap->entries && terminal_unicode_map.entries )
|
||||
{
|
||||
std::memcpy (terminal_unicode_map.entries, umap->entries, pairs_size);
|
||||
errno = 0;
|
||||
ret_val = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
errno = ENOMEM;
|
||||
ret_val = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1519,11 +1559,10 @@ void FTermLinuxTest::classNameTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermLinuxTest::linuxConsoleTest()
|
||||
{
|
||||
finalcut::FSystem* fsys = new test::FSystemTest();
|
||||
finalcut::FTerm::setFSystem(fsys);
|
||||
finalcut::FTermDetection* term_detection{};
|
||||
auto fsys = finalcut::make_unique<test::FSystemTest>();
|
||||
finalcut::FTerm::setFSystem(std::move(fsys));
|
||||
std::cout << "\n";
|
||||
finalcut::FTermData* data = finalcut::FTerm::getFTermData();
|
||||
const auto& data = finalcut::FTerm::getFTermData();
|
||||
|
||||
auto& encoding_list = data->getEncodingList();
|
||||
encoding_list["UTF-8"] = finalcut::fc::UTF8;
|
||||
|
@ -1555,7 +1594,7 @@ void FTermLinuxTest::linuxConsoleTest()
|
|||
data->setMonochron (false);
|
||||
data->setTermResized (false);
|
||||
|
||||
term_detection = finalcut::FTerm::getFTermDetection();
|
||||
const auto& term_detection = finalcut::FTerm::getFTermDetection();
|
||||
finalcut::FTermLinux linux;
|
||||
|
||||
// setupterm is needed for tputs in ncurses >= 6.1
|
||||
|
@ -1590,7 +1629,8 @@ void FTermLinuxTest::linuxConsoleTest()
|
|||
CPPUNIT_ASSERT ( data->hasHalfBlockCharacter() );
|
||||
CPPUNIT_ASSERT ( linux.getFramebufferBpp() == 32 );
|
||||
|
||||
test::FSystemTest* fsystest = static_cast<test::FSystemTest*>(fsys);
|
||||
const auto& fsystem = finalcut::FTerm::getFSystem();
|
||||
auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());
|
||||
std::string& characters = fsystest->getCharacters();
|
||||
linux.setUTF8 (false);
|
||||
CPPUNIT_ASSERT ( characters == ESC "%@" );
|
||||
|
@ -1636,18 +1676,15 @@ void FTermLinuxTest::linuxConsoleTest()
|
|||
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
||||
std::cerr << "waitpid error" << std::endl;
|
||||
}
|
||||
|
||||
delete fsys;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermLinuxTest::linuxCursorStyleTest()
|
||||
{
|
||||
finalcut::FSystem* fsys = new test::FSystemTest();
|
||||
finalcut::FTerm::setFSystem(fsys);
|
||||
finalcut::FTermDetection* term_detection{};
|
||||
auto fsys = finalcut::make_unique<test::FSystemTest>();
|
||||
finalcut::FTerm::setFSystem(std::move(fsys));
|
||||
std::cout << "\n";
|
||||
finalcut::FTermData* data = finalcut::FTerm::getFTermData();
|
||||
const auto& data = finalcut::FTerm::getFTermData();
|
||||
|
||||
auto& encoding_list = data->getEncodingList();
|
||||
encoding_list["UTF-8"] = finalcut::fc::UTF8;
|
||||
|
@ -1681,7 +1718,7 @@ void FTermLinuxTest::linuxCursorStyleTest()
|
|||
|
||||
// setupterm is needed for tputs in ncurses >= 6.1
|
||||
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
|
||||
term_detection = finalcut::FTerm::getFTermDetection();
|
||||
const auto& term_detection = finalcut::FTerm::getFTermDetection();
|
||||
finalcut::FTermLinux linux;
|
||||
|
||||
pid_t pid = forkConEmu();
|
||||
|
@ -1704,7 +1741,8 @@ void FTermLinuxTest::linuxCursorStyleTest()
|
|||
term_detection->detect();
|
||||
linux.init();
|
||||
|
||||
test::FSystemTest* fsystest = static_cast<test::FSystemTest*>(fsys);
|
||||
const auto& fsystem = finalcut::FTerm::getFSystem();
|
||||
auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());
|
||||
std::string& characters = fsystest->getCharacters();
|
||||
characters.clear();
|
||||
linux.setCursorStyle (finalcut::fc::default_cursor);
|
||||
|
@ -1827,18 +1865,15 @@ void FTermLinuxTest::linuxCursorStyleTest()
|
|||
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
||||
std::cerr << "waitpid error" << std::endl;
|
||||
}
|
||||
|
||||
delete fsys;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermLinuxTest::linuxColorPaletteTest()
|
||||
{
|
||||
finalcut::FSystem* fsys = new test::FSystemTest();
|
||||
finalcut::FTerm::setFSystem(fsys);
|
||||
finalcut::FTermDetection* term_detection{};
|
||||
auto fsys = finalcut::make_unique<test::FSystemTest>();
|
||||
finalcut::FTerm::setFSystem(std::move(fsys));
|
||||
std::cout << "\n";
|
||||
finalcut::FTermData* data = finalcut::FTerm::getFTermData();
|
||||
const auto& data = finalcut::FTerm::getFTermData();
|
||||
|
||||
auto& encoding_list = data->getEncodingList();
|
||||
encoding_list["UTF-8"] = finalcut::fc::UTF8;
|
||||
|
@ -1872,7 +1907,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
|||
|
||||
// setupterm is needed for tputs in ncurses >= 6.1
|
||||
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
|
||||
term_detection = finalcut::FTerm::getFTermDetection();
|
||||
const auto& term_detection = finalcut::FTerm::getFTermDetection();
|
||||
finalcut::FTermLinux linux;
|
||||
term_detection->setLinuxTerm(true);
|
||||
|
||||
|
@ -1895,7 +1930,8 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
|||
|
||||
term_detection->detect();
|
||||
linux.init();
|
||||
test::FSystemTest* fsystest = static_cast<test::FSystemTest*>(fsys);
|
||||
const auto& fsystem = finalcut::FTerm::getFSystem();
|
||||
auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());
|
||||
|
||||
CPPUNIT_ASSERT ( linux.resetColorMap() == true );
|
||||
CPPUNIT_ASSERT ( linux.saveColorMap() == true );
|
||||
|
@ -2104,18 +2140,15 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
|||
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
||||
std::cerr << "waitpid error" << std::endl;
|
||||
}
|
||||
|
||||
delete fsys;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermLinuxTest::linuxFontTest()
|
||||
{
|
||||
finalcut::FSystem* fsys = new test::FSystemTest();
|
||||
finalcut::FTerm::setFSystem(fsys);
|
||||
finalcut::FTermDetection* term_detection{};
|
||||
auto fsys = finalcut::make_unique<test::FSystemTest>();
|
||||
finalcut::FTerm::setFSystem(std::move(fsys));
|
||||
std::cout << "\n";
|
||||
finalcut::FTermData* data = finalcut::FTerm::getFTermData();
|
||||
const auto& data = finalcut::FTerm::getFTermData();
|
||||
|
||||
auto& encoding_list = data->getEncodingList();
|
||||
encoding_list["UTF-8"] = finalcut::fc::UTF8;
|
||||
|
@ -2149,7 +2182,7 @@ void FTermLinuxTest::linuxFontTest()
|
|||
|
||||
// setupterm is needed for tputs in ncurses >= 6.1
|
||||
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
|
||||
term_detection = finalcut::FTerm::getFTermDetection();
|
||||
const auto& term_detection = finalcut::FTerm::getFTermDetection();
|
||||
finalcut::FTermLinux linux;
|
||||
|
||||
pid_t pid = forkConEmu();
|
||||
|
@ -2171,18 +2204,19 @@ void FTermLinuxTest::linuxFontTest()
|
|||
|
||||
term_detection->detect();
|
||||
linux.init();
|
||||
test::FSystemTest* fsystest = static_cast<test::FSystemTest*>(fsys);
|
||||
const auto& fsystem = finalcut::FTerm::getFSystem();
|
||||
auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());
|
||||
console_font_op& font = fsystest->getConsoleFont();
|
||||
CPPUNIT_ASSERT ( font.op == KD_FONT_OP_GET );
|
||||
CPPUNIT_ASSERT ( ! linux.isVGAFontUsed() );
|
||||
CPPUNIT_ASSERT ( ! linux.isNewFontUsed() );
|
||||
|
||||
linux.loadVGAFont();
|
||||
/* CPPUNIT_ASSERT ( data->hasShadowCharacter() );
|
||||
CPPUNIT_ASSERT ( data->hasShadowCharacter() );
|
||||
CPPUNIT_ASSERT ( data->hasHalfBlockCharacter() );
|
||||
CPPUNIT_ASSERT ( font.op == KD_FONT_OP_SET );
|
||||
CPPUNIT_ASSERT ( linux.isVGAFontUsed() );
|
||||
CPPUNIT_ASSERT ( ! linux.isNewFontUsed() );
|
||||
CPPUNIT_ASSERT ( font.data );
|
||||
|
||||
// Full block character test
|
||||
for (std::size_t i = 0; i < 16 ; i++)
|
||||
|
@ -2235,7 +2269,7 @@ void FTermLinuxTest::linuxFontTest()
|
|||
CPPUNIT_ASSERT ( font.data[249 * 32 + 13] == 0x00 );
|
||||
CPPUNIT_ASSERT ( font.data[249 * 32 + 14] == 0x00 );
|
||||
CPPUNIT_ASSERT ( font.data[249 * 32 + 15] == 0x00 );
|
||||
*/
|
||||
|
||||
linux.finish();
|
||||
|
||||
closeConEmuStdStreams();
|
||||
|
@ -2249,19 +2283,20 @@ void FTermLinuxTest::linuxFontTest()
|
|||
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
||||
std::cerr << "waitpid error" << std::endl;
|
||||
}
|
||||
|
||||
delete fsys;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermLinuxTest::modifierKeyTest()
|
||||
{
|
||||
auto fsys = finalcut::make_unique<test::FSystemTest>();
|
||||
finalcut::FTerm::setFSystem(std::move(fsys));
|
||||
|
||||
const auto& fsystem = finalcut::FTerm::getFSystem();
|
||||
auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());
|
||||
test::FSystemTest::ShiftState& mod_key = fsystest->getShiftState();
|
||||
finalcut::FTermLinux linux{};
|
||||
FKey keycode{};
|
||||
FKey mod_keycode{};
|
||||
finalcut::FTermLinux linux{};
|
||||
finalcut::FSystem* fsys(new test::FSystemTest());
|
||||
test::FSystemTest* fsystest = static_cast<test::FSystemTest*>(fsys);
|
||||
test::FSystemTest::ShiftState& mod_key = fsystest->getShiftState();
|
||||
|
||||
// Up key
|
||||
keycode = finalcut::fc::Fkey_up;
|
||||
|
@ -2721,7 +2756,6 @@ void FTermLinuxTest::modifierKeyTest()
|
|||
mod_key.shift = 1;
|
||||
mod_keycode = linux.modifierKeyCorrection(keycode);
|
||||
CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_space );
|
||||
delete fsys;
|
||||
}
|
||||
|
||||
// Put the test suite in the registry
|
||||
|
|
|
@ -345,11 +345,10 @@ void ftermopenbsdTest::classNameTest()
|
|||
//----------------------------------------------------------------------
|
||||
void ftermopenbsdTest::netbsdConsoleTest()
|
||||
{
|
||||
finalcut::FSystem* fsys = new test::FSystemTest();
|
||||
finalcut::FTerm::setFSystem(fsys);
|
||||
finalcut::FTermDetection* term_detection{};
|
||||
auto fsys = finalcut::make_unique<test::FSystemTest>();
|
||||
finalcut::FTerm::setFSystem(std::move(fsys));
|
||||
std::cout << "\n";
|
||||
finalcut::FTermData* data = finalcut::FTerm::getFTermData();
|
||||
const auto& data = finalcut::FTerm::getFTermData();
|
||||
|
||||
auto& encoding_list = data->getEncodingList();
|
||||
encoding_list["UTF-8"] = finalcut::fc::UTF8;
|
||||
|
@ -379,7 +378,7 @@ void ftermopenbsdTest::netbsdConsoleTest()
|
|||
|
||||
// setupterm is needed for tputs in ncurses >= 6.1
|
||||
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
|
||||
term_detection = finalcut::FTerm::getFTermDetection();
|
||||
const auto& term_detection = finalcut::FTerm::getFTermDetection();
|
||||
term_detection->setTerminalDetection(true);
|
||||
pid_t pid = forkConEmu();
|
||||
|
||||
|
@ -407,7 +406,7 @@ void ftermopenbsdTest::netbsdConsoleTest()
|
|||
|
||||
#if DEBUG
|
||||
const finalcut::FString& sec_da = \
|
||||
finalcut::FTerm::getFTermDebugData().getSecDAString();
|
||||
finalcut::FTerm::getFTermDebugData()->getSecDAString();
|
||||
CPPUNIT_ASSERT ( sec_da == "\033[>24;20;0c" );
|
||||
#endif
|
||||
|
||||
|
@ -445,18 +444,15 @@ void ftermopenbsdTest::netbsdConsoleTest()
|
|||
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
||||
std::cerr << "waitpid error" << std::endl;
|
||||
}
|
||||
|
||||
delete fsys;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void ftermopenbsdTest::openbsdConsoleTest()
|
||||
{
|
||||
finalcut::FSystem* fsys = new test::FSystemTest();
|
||||
finalcut::FTerm::setFSystem(fsys);
|
||||
finalcut::FTermDetection* term_detection{};
|
||||
auto fsys = finalcut::make_unique<test::FSystemTest>();
|
||||
finalcut::FTerm::setFSystem(std::move(fsys));
|
||||
std::cout << "\n";
|
||||
finalcut::FTermData* data = finalcut::FTerm::getFTermData();
|
||||
const auto& data = finalcut::FTerm::getFTermData();
|
||||
|
||||
auto& encoding_list = data->getEncodingList();
|
||||
encoding_list["UTF-8"] = finalcut::fc::UTF8;
|
||||
|
@ -486,7 +482,7 @@ void ftermopenbsdTest::openbsdConsoleTest()
|
|||
|
||||
// setupterm is needed for tputs in ncurses >= 6.1
|
||||
setupterm (static_cast<char*>(0), 1, static_cast<int*>(0));
|
||||
term_detection = finalcut::FTerm::getFTermDetection();
|
||||
const auto& term_detection = finalcut::FTerm::getFTermDetection();
|
||||
term_detection->setTerminalDetection(true);
|
||||
pid_t pid = forkConEmu();
|
||||
|
||||
|
@ -507,7 +503,8 @@ void ftermopenbsdTest::openbsdConsoleTest()
|
|||
unsetenv("KONSOLE_DCOP");
|
||||
unsetenv("TMUX");
|
||||
|
||||
test::FSystemTest* fsystest = static_cast<test::FSystemTest*>(fsys);
|
||||
const auto& fsystem = finalcut::FTerm::getFSystem();
|
||||
auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());
|
||||
wskbd_bell_data& speaker = fsystest->getBell();
|
||||
openbsd.disableMetaSendsEscape();
|
||||
openbsd.init();
|
||||
|
@ -516,7 +513,7 @@ void ftermopenbsdTest::openbsdConsoleTest()
|
|||
|
||||
#if DEBUG
|
||||
const finalcut::FString& sec_da = \
|
||||
finalcut::FTerm::getFTermDebugData().getSecDAString();
|
||||
finalcut::FTerm::getFTermDebugData()->getSecDAString();
|
||||
CPPUNIT_ASSERT ( sec_da == "\033[>24;20;0c" );
|
||||
#endif
|
||||
|
||||
|
@ -583,8 +580,6 @@ void ftermopenbsdTest::openbsdConsoleTest()
|
|||
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
||||
std::cerr << "waitpid error" << std::endl;
|
||||
}
|
||||
|
||||
delete fsys;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue