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>
* Decoupling the FWidget and FWindow classes from FVTerm
* Avoid redrawing widgets when show() is called multiple times

View File

@ -2,7 +2,7 @@
# 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 = .
@ -79,7 +79,7 @@ libfinal_la_SOURCES = \
fwidget_functions.cpp \
fobject.cpp
libfinal_la_LDFLAGS = -version-info @SO_VERSION@
libfinal_la_LDFLAGS = -no-undefined -version-info @SO_VERSION@
finalcutincludedir = $(includedir)/final

View File

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

View File

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

View File

@ -290,7 +290,6 @@ bool FVTerm::updateTerminal() const
std::size_t changedlines = 0;
for (uInt y{0}; y < uInt(vterm->height); 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
@ -2895,7 +2894,6 @@ inline bool FVTerm::isTermSizeChanged() const
return false;
FObject::getCurrentTime (&last_term_size_check);
const auto& data = FTerm::getFTermData();
if ( ! data )

View File

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

View File

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

View File

@ -103,7 +103,7 @@
#include <fcntl.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>
#endif

View File

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