Fixes the detection of the terminal size after a SIGWINCH signal

This commit is contained in:
Markus Gans 2021-04-21 23:46:45 +02:00
parent 4c3b5b6737
commit 38df8e2db2
9 changed files with 18 additions and 18 deletions

View File

@ -1,3 +1,6 @@
2021-04-21 Markus Gans <guru.mail@muenster.de>
* Fixes the detection of the terminal size after a SIGWINCH signal
2021-04-18 Markus Gans <guru.mail@muenster.de> 2021-04-18 Markus Gans <guru.mail@muenster.de>
* Decoupling the FWidget and FWindow classes from FVTerm * Decoupling the FWidget and FWindow classes from FVTerm
* Avoid redrawing widgets when show() is called multiple times * Avoid redrawing widgets when show() is called multiple times

View File

@ -2,7 +2,7 @@
# Makefile.am - FINAL CUT library # Makefile.am - FINAL CUT library
#---------------------------------------------------------------------- #----------------------------------------------------------------------
AM_CPPFLAGS = -Iinclude -Wall -Werror -DCOMPILE_FINAL_CUT -std=c++11 AM_CPPFLAGS = -I$(top_srcdir)/src/include -Wall -Werror -DCOMPILE_FINAL_CUT -std=c++11
SUBDIRS = . SUBDIRS = .
@ -79,7 +79,7 @@ libfinal_la_SOURCES = \
fwidget_functions.cpp \ fwidget_functions.cpp \
fobject.cpp fobject.cpp
libfinal_la_LDFLAGS = -version-info @SO_VERSION@ libfinal_la_LDFLAGS = -no-undefined -version-info @SO_VERSION@
finalcutincludedir = $(includedir)/final finalcutincludedir = $(includedir)/final

View File

@ -1247,9 +1247,10 @@ FWidget* FApplication::processParameters (const Args& args)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FApplication::processResizeEvent() const void FApplication::processResizeEvent() const
{ {
if ( ! FTerm::hasChangedTermSize() ) if ( ! FTerm::hasChangedTermSize() ) // A SIGWINCH signal was received
return; return;
FTerm::detectTermSize(); // Detect and save the current terminal size
const auto& mouse = FTerm::getFMouseControl(); const auto& mouse = FTerm::getFMouseControl();
mouse->setMaxWidth (uInt16(getDesktopWidth())); mouse->setMaxWidth (uInt16(getDesktopWidth()));
mouse->setMaxHeight (uInt16(getDesktopHeight())); mouse->setMaxHeight (uInt16(getDesktopHeight()));

View File

@ -471,9 +471,7 @@ void FKeyboard::parseKeyBuffer()
} }
// Read the rest from the fifo buffer // Read the rest from the fifo buffer
while ( ! isKeypressTimeout() while ( fifo_offset > 0 && fkey != FKey::Incomplete )
&& fifo_offset > 0
&& fkey != FKey::Incomplete )
{ {
fkey = parseKeyString(); fkey = parseKeyString();
fkey = keyCorrection(fkey); fkey = keyCorrection(fkey);

View File

@ -290,7 +290,6 @@ bool FVTerm::updateTerminal() const
std::size_t changedlines = 0; std::size_t changedlines = 0;
for (uInt y{0}; y < uInt(vterm->height); y++) for (uInt y{0}; y < uInt(vterm->height); y++)
{ {
if ( updateTerminalLine(y) ) if ( updateTerminalLine(y) )
@ -1082,7 +1081,7 @@ void FVTerm::putArea (const FPoint& pos, const FTermArea* area)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FVTerm::getLayer (FVTerm* obj) int FVTerm::getLayer (const FVTerm* obj)
{ {
// returns the layer from the FVTerm object // returns the layer from the FVTerm object
@ -2895,7 +2894,6 @@ inline bool FVTerm::isTermSizeChanged() const
return false; return false;
FObject::getCurrentTime (&last_term_size_check); FObject::getCurrentTime (&last_term_size_check);
const auto& data = FTerm::getFTermData(); const auto& data = FTerm::getFTermData();
if ( ! data ) if ( ! data )

View File

@ -666,14 +666,14 @@ bool FWidget::setCursorPos (const FPoint& pos)
if ( area->hasOwner() ) if ( area->hasOwner() )
{ {
const auto object = area->getOwner<FWidget*>(); const auto area_owner = area->getOwner<FWidget*>();
int woffsetX = getTermX() - object->getTermX(); int woffsetX = getTermX() - area_owner->getTermX();
int woffsetY = getTermY() - object->getTermY(); int woffsetY = getTermY() - area_owner->getTermY();
if ( isChildPrintArea() ) if ( isChildPrintArea() )
{ {
woffsetX += (1 - object->getLeftPadding()); woffsetX += (1 - area_owner->getLeftPadding());
woffsetY += (1 - object->getTopPadding()); woffsetY += (1 - area_owner->getTopPadding());
} }
bool visible = ! isCursorHideable() || flags.visible_cursor; bool visible = ! isCursorHideable() || flags.visible_cursor;
@ -1941,7 +1941,7 @@ void FWidget::setWindowFocus (bool enable)
if ( ! window->isWindowActive() ) if ( ! window->isWindowActive() )
{ {
bool has_raised = window->raiseWindow(); bool has_raised = window->raiseWindow();
window->setActiveWindow(window); FWindow::setActiveWindow(window);
if ( has_raised && window->isVisible() && window->isShown() ) if ( has_raised && window->isVisible() && window->isShown() )
window->redraw(); window->redraw();

View File

@ -857,7 +857,7 @@ int FWindow::getWindowLayerImpl (FWidget* obj)
{ {
// returns the window layer from the widget obj // returns the window layer from the widget obj
FWidget* window; const FWidget* window;
if ( ! obj->isWindowWidget() ) if ( ! obj->isWindowWidget() )
{ {

View File

@ -103,7 +103,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <langinfo.h> #include <langinfo.h>
#if F_HAVE_GETTTYNAM && F_HAVE_TTYENT_H #if defined(F_HAVE_GETTTYNAM) && defined(F_HAVE_TTYENT_H)
#include <ttyent.h> #include <ttyent.h>
#endif #endif

View File

@ -281,7 +281,7 @@ class FVTerm
static void getArea (const FRect&, const FTermArea*); static void getArea (const FRect&, const FTermArea*);
void putArea (const FTermArea*) const; void putArea (const FTermArea*) const;
static void putArea (const FPoint&, const FTermArea*); static void putArea (const FPoint&, const FTermArea*);
static int getLayer (FVTerm*); static int getLayer (const FVTerm*);
void scrollAreaForward (FTermArea*) const; void scrollAreaForward (FTermArea*) const;
void scrollAreaReverse (FTermArea*) const; void scrollAreaReverse (FTermArea*) const;
void clearArea (FTermArea*, wchar_t = L' ') const; void clearArea (FTermArea*, wchar_t = L' ') const;