Repair terminal update skipping
This commit is contained in:
parent
531eb22182
commit
a4a3d93203
|
@ -1,3 +1,6 @@
|
||||||
|
2020-10-22 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Repair terminal update skipping
|
||||||
|
|
||||||
2020-10-20 Markus Gans <guru.mail@muenster.de>
|
2020-10-20 Markus Gans <guru.mail@muenster.de>
|
||||||
* For fast mouse movements the keyboard interval was increased
|
* For fast mouse movements the keyboard interval was increased
|
||||||
from 13.3 to 30 Hz
|
from 13.3 to 30 Hz
|
||||||
|
|
|
@ -18,6 +18,7 @@ EXTRA_DIST = \
|
||||||
faq.md \
|
faq.md \
|
||||||
fileopen-dialog.png \
|
fileopen-dialog.png \
|
||||||
final-cut-application-structure.svg \
|
final-cut-application-structure.svg \
|
||||||
|
final-cut-widget-tree.svg \
|
||||||
first-steps.md \
|
first-steps.md \
|
||||||
first-steps_callback-function.cpp.png \
|
first-steps_callback-function.cpp.png \
|
||||||
first-steps_callback-lambda.cpp.png \
|
first-steps_callback-lambda.cpp.png \
|
||||||
|
@ -74,6 +75,7 @@ doc_DATA = \
|
||||||
faq.md \
|
faq.md \
|
||||||
fileopen-dialog.png \
|
fileopen-dialog.png \
|
||||||
final-cut-application-structure.svg \
|
final-cut-application-structure.svg \
|
||||||
|
final-cut-widget-tree.svg \
|
||||||
first-steps.md \
|
first-steps.md \
|
||||||
first-steps_callback-function.cpp.png \
|
first-steps_callback-function.cpp.png \
|
||||||
first-steps_callback-lambda.cpp.png \
|
first-steps_callback-lambda.cpp.png \
|
||||||
|
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
|
@ -89,7 +89,7 @@ unique and can not have a parent widget. The class `FApplication` manages
|
||||||
all settings and assigns keyboard and mouse input to the different widgets.
|
all settings and assigns keyboard and mouse input to the different widgets.
|
||||||
|
|
||||||
<figure class="image">
|
<figure class="image">
|
||||||
<img src="final-cut-widget tree.svg" alt="widget tree">
|
<img src="final-cut-widget-tree.svg" alt="widget tree">
|
||||||
<figcaption>Figure 2. Widget tree of a FINAL CUT application</figcaption>
|
<figcaption>Figure 2. Widget tree of a FINAL CUT application</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
|
@ -55,11 +55,9 @@ static FVTerm* init_object{nullptr};
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
bool FVTerm::draw_completed{false};
|
bool FVTerm::draw_completed{false};
|
||||||
bool FVTerm::terminal_update_pending{false};
|
|
||||||
bool FVTerm::force_terminal_update{false};
|
|
||||||
bool FVTerm::no_terminal_updates{false};
|
bool FVTerm::no_terminal_updates{false};
|
||||||
bool FVTerm::cursor_hideable{false};
|
bool FVTerm::cursor_hideable{false};
|
||||||
int FVTerm::skipped_terminal_update{};
|
int FVTerm::skipped_terminal_update{0};
|
||||||
uInt64 FVTerm::term_size_check_timeout{500000}; // 500 ms
|
uInt64 FVTerm::term_size_check_timeout{500000}; // 500 ms
|
||||||
uInt FVTerm::erase_char_length{};
|
uInt FVTerm::erase_char_length{};
|
||||||
uInt FVTerm::repeat_char_length{};
|
uInt FVTerm::repeat_char_length{};
|
||||||
|
@ -271,24 +269,23 @@ void FVTerm::updateTerminal() const
|
||||||
{
|
{
|
||||||
// Updates pending changes to the terminal
|
// Updates pending changes to the terminal
|
||||||
|
|
||||||
if ( no_terminal_updates || FApplication::isQuit() )
|
// Check if terminal updates were stopped, application is stopping,
|
||||||
return;
|
// VTerm has changes or the drawing is not completed
|
||||||
|
if ( no_terminal_updates || FApplication::isQuit()
|
||||||
if ( ! force_terminal_update )
|
|| ! (hasPendingUpdates(vterm) && draw_completed) )
|
||||||
{
|
{
|
||||||
if ( ! draw_completed )
|
return;
|
||||||
return;
|
|
||||||
|
|
||||||
if ( keyboard->isInputDataPending() )
|
|
||||||
{
|
|
||||||
terminal_update_pending = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if VTerm has changes
|
if ( (keyboard->isInputDataPending() || keyboard->isKeyPressed())
|
||||||
if ( ! hasPendingUpdates(vterm) )
|
&& skipped_terminal_update <= max_skip )
|
||||||
|
{
|
||||||
|
// Skipping terminal updates if there is unprocessed inputs
|
||||||
|
skipped_terminal_update++;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
skipped_terminal_update = 0;
|
||||||
|
|
||||||
for (uInt y{0}; y < uInt(vterm->height); y++)
|
for (uInt y{0}; y < uInt(vterm->height); y++)
|
||||||
updateTerminalLine (y);
|
updateTerminalLine (y);
|
||||||
|
@ -1268,9 +1265,6 @@ void FVTerm::clearArea (FTermArea* area, int fillchar) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FVTerm::processTerminalUpdate() const
|
void FVTerm::processTerminalUpdate() const
|
||||||
{
|
{
|
||||||
// Retains terminal updates if there are unprocessed inputs
|
|
||||||
static constexpr int max_skip = 8;
|
|
||||||
|
|
||||||
const auto& data = FTerm::getFTermData();
|
const auto& data = FTerm::getFTermData();
|
||||||
|
|
||||||
// Checks if the resizing of the terminal is not finished
|
// Checks if the resizing of the terminal is not finished
|
||||||
|
@ -1287,25 +1281,8 @@ void FVTerm::processTerminalUpdate() const
|
||||||
// Update data on VTerm
|
// Update data on VTerm
|
||||||
updateVTerm();
|
updateVTerm();
|
||||||
|
|
||||||
if ( ! terminal_update_pending && ! hasPendingUpdates(vterm) )
|
// Update the visible terminal
|
||||||
return;
|
updateTerminal();
|
||||||
|
|
||||||
if ( ! keyboard->isInputDataPending() )
|
|
||||||
{
|
|
||||||
updateTerminal();
|
|
||||||
terminal_update_pending = false;
|
|
||||||
skipped_terminal_update = 0;
|
|
||||||
}
|
|
||||||
else if ( skipped_terminal_update > max_skip )
|
|
||||||
{
|
|
||||||
force_terminal_update = true;
|
|
||||||
updateTerminal();
|
|
||||||
force_terminal_update = false;
|
|
||||||
terminal_update_pending = false;
|
|
||||||
skipped_terminal_update = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
skipped_terminal_update++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1693,7 +1670,7 @@ void FVTerm::callPreprocessingHandler (const FTermArea* area)
|
||||||
{
|
{
|
||||||
// Call preprocessing handler
|
// Call preprocessing handler
|
||||||
|
|
||||||
if ( area->preproc_list.empty() )
|
if ( ! area || area->preproc_list.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto&& pcall : area->preproc_list)
|
for (auto&& pcall : area->preproc_list)
|
||||||
|
@ -1707,7 +1684,7 @@ void FVTerm::callPreprocessingHandler (const FTermArea* area)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FVTerm::hasChildAreaChanges (FTermArea* area) const
|
bool FVTerm::hasChildAreaChanges (FTermArea* area) const
|
||||||
{
|
{
|
||||||
if ( ! area )
|
if ( ! area || area->preproc_list.empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return std::any_of ( area->preproc_list.begin()
|
return std::any_of ( area->preproc_list.begin()
|
||||||
|
@ -1724,13 +1701,12 @@ bool FVTerm::hasChildAreaChanges (FTermArea* area) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FVTerm::clearChildAreaChanges (const FTermArea* area) const
|
void FVTerm::clearChildAreaChanges (const FTermArea* area) const
|
||||||
{
|
{
|
||||||
if ( ! area )
|
if ( ! area || area->preproc_list.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto&& pcall : area->preproc_list)
|
for (auto&& pcall : area->preproc_list)
|
||||||
{
|
{
|
||||||
if ( pcall.instance
|
if ( pcall.instance && pcall.instance->child_print_area )
|
||||||
&& pcall.instance->child_print_area )
|
|
||||||
pcall.instance->child_print_area->has_changes = false;
|
pcall.instance->child_print_area->has_changes = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,6 +341,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 = 131072;
|
static constexpr uInt TERMINAL_OUTPUT_BUFFER_SIZE = 131072;
|
||||||
|
static constexpr int max_skip = 20;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void resetTextAreaToDefault ( const FTermArea*
|
void resetTextAreaToDefault ( const FTermArea*
|
||||||
|
@ -449,8 +450,6 @@ class FVTerm
|
||||||
static FKeyboard* keyboard;
|
static FKeyboard* keyboard;
|
||||||
static timeval last_term_size_check;
|
static timeval last_term_size_check;
|
||||||
static bool draw_completed;
|
static bool draw_completed;
|
||||||
static bool terminal_update_pending;
|
|
||||||
static bool force_terminal_update;
|
|
||||||
static bool no_terminal_updates;
|
static bool no_terminal_updates;
|
||||||
static uInt64 term_size_check_timeout;
|
static uInt64 term_size_check_timeout;
|
||||||
static int skipped_terminal_update;
|
static int skipped_terminal_update;
|
||||||
|
|
Loading…
Reference in New Issue