Optimize the terminal output speed

This commit is contained in:
Markus Gans 2020-10-19 23:38:12 +02:00
parent 6a8459c52b
commit 3c467c9c07
32 changed files with 70 additions and 212 deletions

View File

@ -1,3 +1,6 @@
2020-10-19 Markus Gans <guru.mail@muenster.de>
* Optimize the terminal output speed
2020-10-17 Markus Gans <guru.mail@muenster.de> 2020-10-17 Markus Gans <guru.mail@muenster.de>
* Fixes unit test segfault * Fixes unit test segfault

View File

@ -183,7 +183,6 @@ void Background::cb_changed()
, int(green.getValue()) , int(green.getValue())
, int(blue.getValue()) ); , int(blue.getValue()) );
redraw(); redraw();
updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -205,7 +204,6 @@ void Background::cb_choice()
, int(green.getValue()) , int(green.getValue())
, int(blue.getValue()) ); , int(blue.getValue()) );
redraw(); redraw();
updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -335,7 +335,6 @@ void Calc::onKeyPress (finalcut::FKeyEvent* ev)
} }
drawDispay(); drawDispay();
updateTerminal();
} }
ev->accept(); ev->accept();
@ -394,7 +393,6 @@ void Calc::cb_buttonClicked (Calc::button key)
} }
drawDispay(); drawDispay();
updateTerminal();
if ( infix_operator && ! isDataEntryKey(key) ) if ( infix_operator && ! isDataEntryKey(key) )
input = ""; input = "";

View File

@ -294,7 +294,6 @@ void EventLog::onTimer (finalcut::FTimerEvent*)
str(""); str("");
scrolltext.scrollToEnd(); scrolltext.scrollToEnd();
redraw(); redraw();
updateTerminal();
} }
} }

View File

@ -225,7 +225,7 @@ void RotoZoomer::onShow (finalcut::FShowEvent*)
for (path = 1; path < loops; path++) for (path = 1; path < loops; path++)
{ {
redraw(); redraw();
updateTerminal(); processTerminalUpdate();
} }
end = system_clock::now(); end = system_clock::now();
@ -244,8 +244,6 @@ void RotoZoomer::onTimer (finalcut::FTimerEvent*)
path++; path++;
redraw(); redraw();
updateTerminal();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -237,8 +237,6 @@ void MainWindow::draw()
if ( finalcut::FTerm::isMonochron() ) if ( finalcut::FTerm::isMonochron() )
setReverse(false); setReverse(false);
updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -159,9 +159,6 @@ void ProgressDialog::onTimer (finalcut::FTimerEvent*)
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -153,7 +153,6 @@ void SmallWindow::onTimer (finalcut::FTimerEvent*)
top_right_label.redraw(); top_right_label.redraw();
bottom_label.unsetEmphasis(); bottom_label.unsetEmphasis();
bottom_label.redraw(); bottom_label.redraw();
updateTerminal();
delOwnTimers(); delOwnTimers();
} }
@ -344,8 +343,6 @@ void Window::activateWindow (finalcut::FDialog* win) const
if ( has_raised ) if ( has_raised )
win->redraw(); win->redraw();
updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -971,9 +971,6 @@ void FApplication::unselectMenubarItems() const
if ( FWidget::getStatusBar() ) if ( FWidget::getStatusBar() )
FWidget::getStatusBar()->drawMessage(); FWidget::getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
} }
@ -1290,13 +1287,13 @@ bool FApplication::processNextEvent()
if ( is_timeout ) if ( is_timeout )
{ {
FObject::getCurrentTime (&time_last_event); FObject::getCurrentTime (&time_last_event);
processTerminalUpdate(); // before user input
processKeyboardEvent(); processKeyboardEvent();
processMouseEvent(); processMouseEvent();
processResizeEvent(); processResizeEvent();
processTerminalUpdate(); processTerminalUpdate(); // after user input
processCloseWidget(); processCloseWidget();
processLogger(); processLogger();
updateTerminal();
} }
processExternalUserEvent(); processExternalUserEvent();

View File

@ -50,8 +50,6 @@ void FBusyIndicator::start()
running = true; running = true;
createIndicatorText(); createIndicatorText();
show(); show();
updateTerminal();
flush();
addTimer(TIMER); addTimer(TIMER);
} }
@ -61,8 +59,6 @@ void FBusyIndicator::stop()
delOwnTimers(); delOwnTimers();
running = false; running = false;
hide(); hide();
updateTerminal();
flush();
} }
@ -119,8 +115,6 @@ void FBusyIndicator::onTimer (finalcut::FTimerEvent*)
// Redraw the rotated pattern // Redraw the rotated pattern
createIndicatorText(); createIndicatorText();
redraw(); redraw();
updateTerminal();
flush();
} }
} // namespace finalcut } // namespace finalcut

View File

@ -331,8 +331,6 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
if ( getStatusBar() ) if ( getStatusBar() )
{ {
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
} }
@ -507,8 +505,6 @@ void FButtonGroup::directFocus()
if ( getStatusBar() ) if ( getStatusBar() )
{ {
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
} }

View File

@ -102,8 +102,6 @@ void FDropDownListBox::hide()
setOpenMenu(nullptr); setOpenMenu(nullptr);
const auto& t_geometry = getTermGeometryWithShadow(); const auto& t_geometry = getTermGeometryWithShadow();
restoreVTerm (t_geometry); restoreVTerm (t_geometry);
updateTerminal();
flush();
} }
@ -428,8 +426,6 @@ void FComboBox::onMouseDown (FMouseEvent* ev)
else else
list_window.hide(); list_window.hide();
} }
updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -447,8 +447,6 @@ void FDialog::activateDialog()
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -530,8 +528,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
else // ev->getButton() != fc::LeftButton else // ev->getButton() != fc::LeftButton
{ {
// Click on titlebar menu button // Click on titlebar menu button
if ( ms.mouse_x < 4 && ms.mouse_y == 1 if ( ms.mouse_x < 4 && ms.mouse_y == 1 && dialog_menu->isShown() )
&& dialog_menu->isShown() )
leaveMenu(); // close menu leaveMenu(); // close menu
cancelMouseResize(); // Cancel resize cancelMouseResize(); // Cancel resize
@ -690,8 +687,6 @@ void FDialog::onAccel (FAccelEvent*)
if ( has_raised ) if ( has_raised )
redraw(); redraw();
updateTerminal();
} }
} }
@ -717,8 +712,6 @@ void FDialog::onWindowActive (FEvent*)
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1227,9 +1220,6 @@ void FDialog::leaveMenu()
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1273,9 +1263,6 @@ void FDialog::selectFirstMenuItem()
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1480,12 +1467,10 @@ inline void FDialog::raiseActivateDialog()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FDialog::lowerActivateDialog() inline void FDialog::lowerActivateDialog()
{ {
const bool has_lowered = lowerWindow(); lowerWindow();
if ( ! isWindowActive() ) if ( ! isWindowActive() )
activateDialog(); activateDialog();
else if ( has_lowered )
updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1624,7 +1609,6 @@ void FDialog::cancelMouseResize()
resize_click_pos.setPoint (0, 0); resize_click_pos.setPoint (0, 0);
drawBorder(); drawBorder();
updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -205,11 +205,7 @@ void FLabel::onMouseDown (FMouseEvent* ev)
accel_widget->redraw(); accel_widget->redraw();
if ( getStatusBar() ) if ( getStatusBar() )
{
accel_widget->getStatusBar()->drawMessage(); accel_widget->getStatusBar()->drawMessage();
updateTerminal();
flush();
}
} }
} }
@ -232,11 +228,7 @@ void FLabel::onAccel (FAccelEvent* ev)
FApplication::sendEvent(accel_widget, &in); FApplication::sendEvent(accel_widget, &in);
if ( getStatusBar() ) if ( getStatusBar() )
{
accel_widget->getStatusBar()->drawMessage(); accel_widget->getStatusBar()->drawMessage();
updateTerminal();
flush();
}
} }
} }

View File

@ -357,7 +357,7 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
&& key != fc::Fkey_enter ) && key != fc::Fkey_enter )
{ {
drawInputField(); drawInputField();
updateTerminal(); processTerminalUpdate();
} }
} }
@ -397,7 +397,7 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
adjustTextOffset(); adjustTextOffset();
drawInputField(); drawInputField();
updateTerminal(); processTerminalUpdate();
} }
} }
@ -431,7 +431,7 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
adjustTextOffset(); adjustTextOffset();
drawInputField(); drawInputField();
updateTerminal(); processTerminalUpdate();
} }
// auto-scrolling when dragging mouse outside the widget // auto-scrolling when dragging mouse outside the widget
@ -534,7 +534,7 @@ void FLineEdit::onTimer (FTimerEvent*)
adjustTextOffset(); adjustTextOffset();
drawInputField(); drawInputField();
updateTerminal(); processTerminalUpdate();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -554,11 +554,7 @@ void FLineEdit::onAccel (FAccelEvent* ev)
redraw(); redraw();
if ( getStatusBar() ) if ( getStatusBar() )
{
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
}
} }
} }
@ -584,11 +580,7 @@ void FLineEdit::onFocusIn (FFocusEvent*)
} }
if ( getStatusBar() ) if ( getStatusBar() )
{
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -352,8 +352,7 @@ void FListBox::onMouseDown (FMouseEvent* ev)
if ( yoffset_before != yoffset ) if ( yoffset_before != yoffset )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
} }
@ -426,8 +425,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
if ( yoffset_before != yoffset ) if ( yoffset_before != yoffset )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
// Auto-scrolling when dragging mouse outside the widget // Auto-scrolling when dragging mouse outside the widget
@ -504,8 +502,7 @@ void FListBox::onTimer (FTimerEvent*)
if ( yoffset_before != yoffset ) if ( yoffset_before != yoffset )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -547,8 +544,7 @@ void FListBox::onWheel (FWheelEvent* ev)
if ( yoffset_before != yoffset ) if ( yoffset_before != yoffset )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1082,8 +1078,7 @@ inline void FListBox::updateDrawing (bool draw_vbar, bool draw_hbar)
if ( draw_hbar ) if ( draw_hbar )
hbar->drawBar(); hbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1803,8 +1798,7 @@ void FListBox::cb_vbarChange (const FWidget*)
if ( yoffset_before != yoffset ) if ( yoffset_before != yoffset )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
} }
@ -1862,11 +1856,8 @@ void FListBox::cb_hbarChange (const FWidget*)
inc_search.clear(); inc_search.clear();
if ( isShown() ) if ( isShown() )
{
drawList(); drawList();
updateTerminal();
flush();
}
if ( scrollType >= FScrollbar::scrollStepBackward ) if ( scrollType >= FScrollbar::scrollStepBackward )
{ {
@ -1875,8 +1866,7 @@ void FListBox::cb_hbarChange (const FWidget*)
if ( xoffset_before != xoffset ) if ( xoffset_before != xoffset )
hbar->drawBar(); hbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
} }

View File

@ -1116,8 +1116,7 @@ void FListView::onMouseDown (FMouseEvent* ev)
if ( first_line_position_before != first_visible_line.getPosition() ) if ( first_line_position_before != first_visible_line.getPosition() )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
} }
} }
@ -1221,8 +1220,7 @@ void FListView::onMouseMove (FMouseEvent* ev)
if ( first_line_position_before != first_visible_line.getPosition() ) if ( first_line_position_before != first_visible_line.getPosition() )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
// auto-scrolling when dragging mouse outside the widget // auto-scrolling when dragging mouse outside the widget
@ -1308,8 +1306,7 @@ void FListView::onTimer (FTimerEvent*)
if ( first_line_position_before != first_visible_line.getPosition() ) if ( first_line_position_before != first_visible_line.getPosition() )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1347,8 +1344,7 @@ void FListView::onWheel (FWheelEvent* ev)
if ( first_line_position_before != first_visible_line.getPosition() ) if ( first_line_position_before != first_visible_line.getPosition() )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2152,8 +2148,7 @@ void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
if ( draw_hbar ) if ( draw_hbar )
hbar->drawBar(); hbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2872,8 +2867,7 @@ void FListView::cb_vbarChange (const FWidget*)
if ( first_line_position_before != first_visible_line.getPosition() ) if ( first_line_position_before != first_visible_line.getPosition() )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
} }
@ -2929,8 +2923,6 @@ void FListView::cb_hbarChange (const FWidget*)
{ {
drawHeadlines(); drawHeadlines();
drawList(); drawList();
updateTerminal();
flush();
} }
if ( scrollType >= FScrollbar::scrollStepBackward ) if ( scrollType >= FScrollbar::scrollStepBackward )
@ -2940,8 +2932,7 @@ void FListView::cb_hbarChange (const FWidget*)
if ( xoffset_before != xoffset ) if ( xoffset_before != xoffset )
hbar->drawBar(); hbar->drawBar();
updateTerminal(); processTerminalUpdate();
flush();
} }
} }

View File

@ -110,8 +110,6 @@ void FMenu::hide()
FWindow::hide(); FWindow::hide();
const auto& t_geometry = getTermGeometryWithShadow(); const auto& t_geometry = getTermGeometryWithShadow();
restoreVTerm (t_geometry); restoreVTerm (t_geometry);
updateTerminal();
flush();
if ( ! isSubMenu() ) if ( ! isSubMenu() )
{ {
@ -206,9 +204,6 @@ void FMenu::onMouseDown (FMouseEvent* ev)
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
return; return;
@ -316,8 +311,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
else if ( ms.hide_sub_menu ) else if ( ms.hide_sub_menu )
{ {
closeOpenedSubMenu(); closeOpenedSubMenu();
updateTerminal(); processTerminalUpdate();
flush();
} }
} }
@ -615,9 +609,6 @@ void FMenu::openSubMenu (FMenu* sub_menu, bool select)
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -728,9 +719,6 @@ void FMenu::mouseDownSubmenu (const FMenuItem* m_item)
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
} }
@ -798,9 +786,6 @@ bool FMenu::mouseUpOverList (const FPoint& mouse_pos)
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
return true; return true;
@ -1073,8 +1058,6 @@ bool FMenu::selectNextItem()
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
redraw(); redraw();
updateTerminal();
flush();
break; break;
} }
@ -1123,8 +1106,6 @@ bool FMenu::selectPrevItem()
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
redraw(); redraw();
updateTerminal();
flush();
break; break;
} }
} }
@ -1186,8 +1167,6 @@ bool FMenu::hotkeyMenu (FKeyEvent* ev)
hideSubMenus(); hideSubMenus();
hide(); hide();
hideSuperMenus(); hideSuperMenus();
updateTerminal();
flush();
ev->accept(); ev->accept();
item->processClicked(); item->processClicked();
} }
@ -1527,9 +1506,6 @@ inline void FMenu::selectPrevMenu (FKeyEvent* ev)
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
else else
keypressMenuBar(ev); // select previous menu keypressMenuBar(ev); // select previous menu
@ -1600,9 +1576,6 @@ inline void FMenu::closeMenu()
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -79,7 +79,6 @@ void FMenuBar::hide()
FColor bg = wc->term_bg; FColor bg = wc->term_bg;
setColor (fg, bg); setColor (fg, bg);
print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '}; print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '};
updateTerminal();
FWindow::hide(); FWindow::hide();
} }
@ -825,10 +824,7 @@ void FMenuBar::mouseDownOverList (const FMouseEvent* ev)
} }
if ( focus_changed ) if ( focus_changed )
{
redraw(); redraw();
updateTerminal();
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -920,10 +916,7 @@ void FMenuBar::mouseMoveOverList (const FMouseEvent* ev)
} }
if ( focus_changed ) if ( focus_changed )
{
redraw(); redraw();
updateTerminal();
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -972,8 +965,6 @@ void FMenuBar::leaveMenuBar()
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
mouse_down = false; mouse_down = false;
} }

View File

@ -250,8 +250,6 @@ void FMenuItem::openMenu() const
dd_menu->show(); dd_menu->show();
dd_menu->raiseWindow(); dd_menu->raiseWindow();
dd_menu->redraw(); dd_menu->redraw();
updateTerminal();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -64,8 +64,6 @@ void FProgressbar::setPercentage (std::size_t percentage_value)
drawProgressLabel(); drawProgressLabel();
drawProgressBar(); drawProgressBar();
} }
updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -126,8 +124,6 @@ void FProgressbar::reset()
drawProgressLabel(); drawProgressLabel();
drawProgressBar(); drawProgressBar();
} }
updateTerminal();
} }
@ -182,9 +178,6 @@ void FProgressbar::drawProgressBar()
if ( FTerm::isMonochron() ) if ( FTerm::isMonochron() )
setReverse(false); setReverse(false);
updateTerminal();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -352,7 +352,7 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
{ {
setValue(new_val); setValue(new_val);
drawBar(); drawBar();
updateTerminal(); processTerminalUpdate();
processScroll(); processScroll();
} }
} }
@ -757,7 +757,7 @@ void FScrollbar::jumpToClickPos (int x, int y)
{ {
setValue(new_val); setValue(new_val);
drawBar(); drawBar();
updateTerminal(); processTerminalUpdate();
scroll_type = FScrollbar::scrollJump; scroll_type = FScrollbar::scrollJump;
processScroll(); processScroll();
} }

View File

@ -411,7 +411,7 @@ void FScrollView::scrollTo (int x, int y)
viewport->has_changes = true; viewport->has_changes = true;
copy2area(); copy2area();
updateTerminal(); processTerminalUpdate();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -371,7 +371,6 @@ inline void FSpinBox::updateInputField()
input_field << pfix << value << sfix; input_field << pfix << value << sfix;
input_field.redraw(); input_field.redraw();
redraw(); redraw();
updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -189,7 +189,6 @@ void FStatusBar::hide()
const FColor bg = wc->term_bg; const FColor bg = wc->term_bg;
setColor (fg, bg); setColor (fg, bg);
print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '}; print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '};
updateTerminal();
FWindow::hide(); FWindow::hide();
} }

View File

@ -123,8 +123,6 @@ void FSwitch::draw()
drawLabel(); drawLabel();
drawCheckButton(); drawCheckButton();
FToggleButton::draw(); FToggleButton::draw();
updateTerminal();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -184,7 +184,7 @@ void FTextView::scrollTo (int x, int y)
} }
drawText(); drawText();
updateTerminal(); processTerminalUpdate();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -328,7 +328,6 @@ void FTextView::clear()
<< FString{size, L' '}; << FString{size, L' '};
} }
updateTerminal();
processChanged(); processChanged();
} }
@ -476,7 +475,7 @@ void FTextView::onWheel (FWheelEvent* ev)
if ( isShown() ) if ( isShown() )
drawText(); drawText();
updateTerminal(); processTerminalUpdate();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -621,8 +620,6 @@ void FTextView::draw()
} }
setCursorPos ({int(getWidth()), int(getHeight())}); setCursorPos ({int(getWidth()), int(getHeight())});
updateTerminal();
flush();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -222,11 +222,7 @@ void FToggleButton::onMouseDown (FMouseEvent* ev)
redraw(); redraw();
if ( getStatusBar() ) if ( getStatusBar() )
{
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -299,11 +295,7 @@ void FToggleButton::onAccel (FAccelEvent* ev)
redraw(); redraw();
if ( getStatusBar() ) if ( getStatusBar() )
{
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateTerminal();
flush();
}
processClick(); processClick();
ev->accept(); ev->accept();
@ -474,10 +466,7 @@ void FToggleButton::onKeyPress (FKeyEvent* ev)
} }
if ( ev->isAccepted() ) if ( ev->isAccepted() )
{
draw(); draw();
updateTerminal();
}
} }

View File

@ -183,9 +183,10 @@ void FVTerm::hideCursor (bool enable) const
const char* visibility_str = FTerm::cursorsVisibilityString (enable); const char* visibility_str = FTerm::cursorsVisibilityString (enable);
if ( visibility_str ) if ( ! visibility_str )
appendOutputBuffer(visibility_str); return;
appendOutputBuffer(visibility_str);
flush(); flush();
} }
@ -286,24 +287,8 @@ void FVTerm::updateTerminal() const
} }
} }
const auto& data = FTerm::getFTermData();
// Checks if the resizing of the terminal is not finished
if ( data && data->hasTermResized() )
return;
// Monitor whether the terminal size has changed
if ( isTermSizeChanged() )
{
raise (SIGWINCH); // Send SIGWINCH
return;
}
// Update data on VTerm
updateVTerm();
// Checks if VTerm has changes // Checks if VTerm has changes
if ( ! vterm->has_changes ) if ( ! hasPendingUpdates(vterm) )
return; return;
for (uInt y{0}; y < uInt(vterm->height); y++) for (uInt y{0}; y < uInt(vterm->height); y++)
@ -630,8 +615,12 @@ void FVTerm::flush()
while ( ! output_buffer->empty() ) while ( ! output_buffer->empty() )
{ {
static const FTerm::defaultPutChar& FTermPutchar = FTerm::putchar(); static const FTerm::defaultPutChar& FTermPutchar = FTerm::putchar();
FTermPutchar (output_buffer->front());
output_buffer->pop(); if ( FTermPutchar )
{
FTermPutchar (output_buffer->front());
output_buffer->pop();
}
} }
std::fflush(stdout); std::fflush(stdout);
@ -1283,7 +1272,23 @@ void FVTerm::processTerminalUpdate() const
// Retains terminal updates if there are unprocessed inputs // Retains terminal updates if there are unprocessed inputs
static constexpr int max_skip = 8; static constexpr int max_skip = 8;
if ( ! terminal_update_pending ) const auto& data = FTerm::getFTermData();
// Checks if the resizing of the terminal is not finished
if ( data && data->hasTermResized() )
return;
// Monitor whether the terminal size has changed
if ( isTermSizeChanged() )
{
raise (SIGWINCH); // Send SIGWINCH
return;
}
// Update data on VTerm
updateVTerm();
if ( ! terminal_update_pending && ! hasPendingUpdates(vterm) )
return; return;
if ( ! keyboard->isInputDataPending() ) if ( ! keyboard->isInputDataPending() )
@ -1652,7 +1657,7 @@ void FVTerm::updateVTerm() const
{ {
// Updates the character data from all areas to VTerm // Updates the character data from all areas to VTerm
if ( vdesktop && vdesktop->has_changes ) if ( hasPendingUpdates(vdesktop) )
{ {
putArea(vdesktop); putArea(vdesktop);
vdesktop->has_changes = false; vdesktop->has_changes = false;
@ -1671,7 +1676,7 @@ void FVTerm::updateVTerm() const
if ( ! (v_win && v_win->visible) ) if ( ! (v_win && v_win->visible) )
continue; continue;
if ( v_win->has_changes ) if ( hasPendingUpdates(v_win) )
{ {
putArea(v_win); putArea(v_win);
v_win->has_changes = false; v_win->has_changes = false;
@ -2941,6 +2946,12 @@ inline bool FVTerm::isTermSizeCheckTimeout()
return FObject::isTimeout (&last_term_size_check, term_size_check_timeout); return FObject::isTimeout (&last_term_size_check, term_size_check_timeout);
} }
//----------------------------------------------------------------------
inline bool FVTerm::hasPendingUpdates (FTermArea* area)
{
return ( area && area->has_changes ) ? true : false;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::markAsPrinted (uInt pos, uInt line) inline void FVTerm::markAsPrinted (uInt pos, uInt line)
{ {

View File

@ -905,11 +905,7 @@ void FWidget::redraw()
finishTerminalUpdate(); finishTerminalUpdate();
if ( redraw_root_widget == this ) if ( redraw_root_widget == this )
{
updateTerminal();
flush();
redraw_root_widget = nullptr; redraw_root_widget = nullptr;
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -976,8 +972,6 @@ void FWidget::show()
if ( show_root_widget && show_root_widget == this ) if ( show_root_widget && show_root_widget == this )
{ {
finishTerminalUpdate(); finishTerminalUpdate();
updateTerminal();
flush();
show_root_widget = nullptr; show_root_widget = nullptr;
} }
@ -1953,8 +1947,6 @@ bool FWidget::changeFocus ( FWidget* follower, FWidget* parent
{ {
redraw(); redraw();
follower->redraw(); follower->redraw();
updateTerminal();
flush();
} }
} }

View File

@ -929,9 +929,6 @@ void closeDropDown (const FWidget* widget, const FPoint& mouse_position)
if ( FWidget::getStatusBar() ) if ( FWidget::getStatusBar() )
FWidget::getStatusBar()->drawMessage(); FWidget::getStatusBar()->drawMessage();
widget->updateTerminal();
FVTerm::flush();
} }
} // namespace finalcut } // namespace finalcut

View File

@ -340,7 +340,7 @@ class FVTerm
// Constants // Constants
// Buffer size for character output on the terminal // Buffer size for character output on the terminal
static constexpr uInt TERMINAL_OUTPUT_BUFFER_SIZE = 32768; static constexpr uInt TERMINAL_OUTPUT_BUFFER_SIZE = 131072;
// Methods // Methods
void resetTextAreaToDefault ( const FTermArea* void resetTextAreaToDefault ( const FTermArea*
@ -417,6 +417,7 @@ class FVTerm
bool isInsideTerminal (const FPoint&) const; bool isInsideTerminal (const FPoint&) const;
bool isTermSizeChanged() const; bool isTermSizeChanged() const;
static bool isTermSizeCheckTimeout(); static bool isTermSizeCheckTimeout();
static bool hasPendingUpdates (FTermArea*);
static void markAsPrinted (uInt, uInt); static void markAsPrinted (uInt, uInt);
static void markAsPrinted (uInt, uInt, uInt); static void markAsPrinted (uInt, uInt, uInt);
static void newFontChanges (FChar*&); static void newFontChanges (FChar*&);