Update VTerm information only in case of changes

This commit is contained in:
Markus Gans 2019-08-18 21:35:36 +02:00
parent ad2766e706
commit 248cf8a0ba
9 changed files with 65 additions and 21 deletions

View File

@ -838,7 +838,7 @@ void Calc::tangent (lDouble& x)
void Calc::draw() void Calc::draw()
{ {
setBold(); setBold();
setColor (fc::Blue, fc::Cyan); setColor (fc::LightBlue, fc::Cyan);
clearArea (vdesktop, fc::MediumShade); clearArea (vdesktop, fc::MediumShade);
unsetBold(); unsetBold();
finalcut::FDialog::draw(); finalcut::FDialog::draw();

View File

@ -35,9 +35,6 @@
namespace finalcut namespace finalcut
{ {
// static class attributes
FSystem* FFileDialog::fsystem = nullptr;
// non-member functions // non-member functions
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool sortByName ( const FFileDialog::dir_entry& lhs bool sortByName ( const FFileDialog::dir_entry& lhs
@ -92,6 +89,8 @@ const FString fileChooser ( FWidget* parent
return ret; return ret;
} }
// static class attributes
FSystem* FFileDialog::fsystem = nullptr;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FFileDialog // class FFileDialog

View File

@ -262,18 +262,31 @@ void FVTerm::updateTerminal()
} }
} }
// Check terminal size has changed
auto data = getFTerm().getFTermData(); auto data = getFTerm().getFTermData();
if ( data->hasTermResized() ) // Checks if the resizing of the terminal is not finished
if ( data && data->hasTermResized() )
return; return;
// Monitor whether the terminal size has changed
if ( isTermSizeChanged() )
{
raise (SIGWINCH); // Send SIGWINCH
return;
}
// Update data on VTerm // Update data on VTerm
updateVTerm(); updateVTerm();
// Checks if VTerm has changes
if ( ! vterm->has_changes )
return;
for (uInt y = 0; y < uInt(vterm->height); y++) for (uInt y = 0; y < uInt(vterm->height); y++)
updateTerminalLine (y); updateTerminalLine (y);
vterm->has_changes = false;
// sets the new input cursor position // sets the new input cursor position
updateTerminalCursor(); updateTerminalCursor();
} }
@ -852,6 +865,8 @@ void FVTerm::restoreVTerm (const FRect& box)
if ( int(vterm->changes[ypos].xmax) < x + w - 1 ) if ( int(vterm->changes[ypos].xmax) < x + w - 1 )
vterm->changes[ypos].xmax = uInt(x + w - 1); vterm->changes[ypos].xmax = uInt(x + w - 1);
} }
vterm->has_changes = true;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1251,6 +1266,7 @@ void FVTerm::updateVTerm (term_area* area)
area->changes[y].xmax = 0; area->changes[y].xmax = 0;
} }
vterm->has_changes = true;
updateVTermCursor(area); updateVTermCursor(area);
} }
@ -1286,6 +1302,7 @@ bool FVTerm::updateVTermCursor (term_area* area)
vterm->input_cursor_x = x; vterm->input_cursor_x = x;
vterm->input_cursor_y = y; vterm->input_cursor_y = y;
vterm->input_cursor_visible = true; vterm->input_cursor_visible = true;
vterm->has_changes = true;
return true; return true;
} }
} }
@ -1472,6 +1489,8 @@ void FVTerm::putArea (const FPoint& pos, term_area* area)
if ( ax + length - 1 > int(vterm->changes[ay + y].xmax) ) if ( ax + length - 1 > int(vterm->changes[ay + y].xmax) )
vterm->changes[ay + y].xmax = uInt(ax + length - 1); vterm->changes[ay + y].xmax = uInt(ax + length - 1);
} }
vterm->has_changes = true;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2609,6 +2628,25 @@ bool FVTerm::isInsideTerminal (const FPoint& pos)
return false; return false;
} }
//----------------------------------------------------------------------
inline bool FVTerm::isTermSizeChanged()
{
auto data = getFTerm().getFTermData();
if ( ! data )
return false;
auto old_term_geometry = data->getTermGeometry();
getFTerm().detectTermSize();
auto term_geometry = data->getTermGeometry();
term_geometry.move (-1, -1);
if ( old_term_geometry.getSize() != term_geometry.getSize() )
return true;
return false;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::markAsPrinted (uInt pos, uInt line) inline void FVTerm::markAsPrinted (uInt pos, uInt line)
{ {

View File

@ -70,8 +70,8 @@ class FSystem
virtual int tputs (const char*, int, int (*)(int)) = 0; virtual int tputs (const char*, int, int (*)(int)) = 0;
virtual uid_t getuid() = 0; virtual uid_t getuid() = 0;
virtual uid_t geteuid() = 0; virtual uid_t geteuid() = 0;
virtual int getpwuid_r ( uid_t, struct passwd*, char*, size_t , virtual int getpwuid_r ( uid_t, struct passwd*, char*
struct passwd**) = 0; , size_t, struct passwd**) = 0;
virtual char* realpath (const char*, char*) = 0; virtual char* realpath (const char*, char*) = 0;
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -454,6 +454,7 @@ class FVTerm
void updateTerminalLine (uInt); void updateTerminalLine (uInt);
bool updateTerminalCursor(); bool updateTerminalCursor();
bool isInsideTerminal (const FPoint&); bool isInsideTerminal (const FPoint&);
bool isTermSizeChanged();
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 (charData*&); static void newFontChanges (charData*&);

View File

@ -333,7 +333,7 @@ class FWidget : public FVTerm, public FObject
virtual bool focusLastChild(); virtual bool focusLastChild();
FPoint termToWidgetPos (const FPoint&); FPoint termToWidgetPos (const FPoint&);
void detectTermSize(); void detectTermSize();
void print (const FPoint& p) override; void print (const FPoint&) override;
virtual void move (const FPoint&); virtual void move (const FPoint&);
void drawShadow(); void drawShadow();
void clearShadow(); void clearShadow();

View File

@ -67,6 +67,8 @@ class FSystemTest : public finalcut::FSystem
int tputs (const char*, int, int (*)(int)) override; int tputs (const char*, int, int (*)(int)) override;
uid_t getuid() override; uid_t getuid() override;
uid_t geteuid() override; uid_t geteuid() override;
int getpwuid_r (uid_t, struct passwd*, char*
, size_t, struct passwd** ) override;
char* realpath (const char*, char*) override; char* realpath (const char*, char*) override;
std::string& getCharacters(); std::string& getCharacters();
int& getCursorType(); int& getCursorType();
@ -543,16 +545,16 @@ uid_t FSystemTest::geteuid()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FSystemTest::getpwuid_r ( uid_t, struct passwd*, char*, size_t int FSystemTest::getpwuid_r ( uid_t, struct passwd*, char*
, struct passwd** ) , size_t, struct passwd** )
{ {
return 0; return 0;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
char* FSystemTest::realpath (const char*, char*); char* FSystemTest::realpath (const char*, char*)
{ {
return ""; return const_cast<char*>("");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -117,6 +117,8 @@ class FSystemTest : public finalcut::FSystem
int tputs (const char*, int, int (*)(int)) override; int tputs (const char*, int, int (*)(int)) override;
uid_t getuid() override; uid_t getuid() override;
uid_t geteuid() override; uid_t geteuid() override;
int getpwuid_r (uid_t, struct passwd*, char*
, size_t, struct passwd** ) override;
char* realpath (const char*, char*) override; char* realpath (const char*, char*) override;
rgb& getRGB (std::size_t); rgb& getRGB (std::size_t);
console_font_op& getConsoleFont(); console_font_op& getConsoleFont();
@ -1357,16 +1359,16 @@ uid_t FSystemTest::geteuid()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FSystemTest::getpwuid_r ( uid_t, struct passwd*, char*, size_t int FSystemTest::getpwuid_r ( uid_t, struct passwd*, char*
, struct passwd** ) , size_t, struct passwd** )
{ {
return 0; return 0;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
char* FSystemTest::realpath (const char*, char*); char* FSystemTest::realpath (const char*, char*)
{ {
return ""; return const_cast<char*>("");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -85,6 +85,8 @@ class FSystemTest : public finalcut::FSystem
int tputs (const char*, int, int (*)(int)) override; int tputs (const char*, int, int (*)(int)) override;
uid_t getuid() override; uid_t getuid() override;
uid_t geteuid() override; uid_t geteuid() override;
int getpwuid_r (uid_t, struct passwd*, char*
, size_t, struct passwd** ) override;
char* realpath (const char*, char*) override; char* realpath (const char*, char*) override;
wskbd_bell_data& getBell(); wskbd_bell_data& getBell();
@ -283,16 +285,16 @@ uid_t FSystemTest::geteuid()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FSystemTest::getpwuid_r ( uid_t, struct passwd*, char*, size_t int FSystemTest::getpwuid_r ( uid_t, struct passwd*, char*
, struct passwd** ) , size_t, struct passwd** )
{ {
return 0; return 0;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
char* FSystemTest::realpath (const char*, char*); char* FSystemTest::realpath (const char*, char*)
{ {
return ""; return const_cast<char*>("");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------