FWidget::show() optimized

This commit is contained in:
Markus Gans 2020-10-20 16:52:25 +02:00
parent 3c467c9c07
commit b69f3fc5d8
4 changed files with 17 additions and 16 deletions

View File

@ -157,7 +157,6 @@ int main (int argc, char* argv[])
}
} // Hide and destroy the dialog object
// Create and show tooltip for two seconds
finalcut::FToolTip tooltip{&app};
tooltip.setText ("You have chosen " + label_text);

View File

@ -54,7 +54,7 @@ namespace finalcut
static FVTerm* init_object{nullptr};
// static class attributes
bool FVTerm::terminal_update_complete{false};
bool FVTerm::draw_completed{false};
bool FVTerm::terminal_update_pending{false};
bool FVTerm::force_terminal_update{false};
bool FVTerm::no_terminal_updates{false};
@ -277,7 +277,7 @@ void FVTerm::updateTerminal() const
if ( ! force_terminal_update )
{
if ( ! terminal_update_complete )
if ( ! draw_completed )
return;
if ( keyboard->isInputDataPending() )
@ -1310,17 +1310,17 @@ void FVTerm::processTerminalUpdate() const
}
//----------------------------------------------------------------------
void FVTerm::startTerminalUpdate()
void FVTerm::startDrawing()
{
// Pauses the terminal updates for the printing phase
terminal_update_complete = false;
draw_completed = false;
}
//----------------------------------------------------------------------
void FVTerm::finishTerminalUpdate()
void FVTerm::finishDrawing()
{
// After the printing phase is completed, the terminal will be updated
terminal_update_complete = true;
draw_completed = true;
}
//----------------------------------------------------------------------
@ -2947,7 +2947,7 @@ inline bool FVTerm::isTermSizeCheckTimeout()
}
//----------------------------------------------------------------------
inline bool FVTerm::hasPendingUpdates (FTermArea* area)
inline bool FVTerm::hasPendingUpdates (const FTermArea* area)
{
return ( area && area->has_changes ) ? true : false;
}

View File

@ -885,7 +885,7 @@ void FWidget::redraw()
if ( isRootWidget() )
{
startTerminalUpdate();
startDrawing();
// clean desktop
auto color_theme = getColorTheme();
setColor (color_theme->term_fg, color_theme->term_bg);
@ -902,7 +902,7 @@ void FWidget::redraw()
drawChildren();
if ( isRootWidget() )
finishTerminalUpdate();
finishDrawing();
if ( redraw_root_widget == this )
redraw_root_widget = nullptr;
@ -949,7 +949,7 @@ void FWidget::show()
if ( ! show_root_widget )
{
startTerminalUpdate();
startDrawing();
show_root_widget = this;
}
@ -971,7 +971,9 @@ void FWidget::show()
if ( show_root_widget && show_root_widget == this )
{
finishTerminalUpdate();
finishDrawing();
processTerminalUpdate();
flush();
show_root_widget = nullptr;
}

View File

@ -319,8 +319,8 @@ class FVTerm
void scrollAreaReverse (FTermArea*) const;
void clearArea (FTermArea*, int = ' ') const;
void processTerminalUpdate() const;
static void startTerminalUpdate();
static void finishTerminalUpdate();
static void startDrawing();
static void finishDrawing();
virtual void initTerminal();
private:
@ -417,7 +417,7 @@ class FVTerm
bool isInsideTerminal (const FPoint&) const;
bool isTermSizeChanged() const;
static bool isTermSizeCheckTimeout();
static bool hasPendingUpdates (FTermArea*);
static bool hasPendingUpdates (const FTermArea*);
static void markAsPrinted (uInt, uInt);
static void markAsPrinted (uInt, uInt, uInt);
static void newFontChanges (FChar*&);
@ -448,7 +448,7 @@ class FVTerm
static FPoint* term_pos; // terminal cursor position
static FKeyboard* keyboard;
static timeval last_term_size_check;
static bool terminal_update_complete;
static bool draw_completed;
static bool terminal_update_pending;
static bool force_terminal_update;
static bool no_terminal_updates;