From 186b8eaba7859c2c2b364dea3805401bf2bae197 Mon Sep 17 00:00:00 2001 From: Paulo Lieuthier Date: Fri, 6 Nov 2015 09:13:21 -0300 Subject: [PATCH] Sort out terminal resizing --- lib/Emulation.h | 12 ++++++++++++ lib/Session.cpp | 8 +++++--- lib/Session.h | 2 +- lib/Vt102Emulation.cpp | 4 +++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/Emulation.h b/lib/Emulation.h index 3037a04..cb680ef 100644 --- a/lib/Emulation.h +++ b/lib/Emulation.h @@ -379,6 +379,18 @@ signals: */ void imageSizeChanged(int lineCount , int columnCount); + /** + * Emitted when the setImageSize() is called on this emulation for + * the first time. + */ + void imageSizeInitialized(); + + /** + * Emitted after receiving the escape sequence which asks to change + * the terminal emulator's size + */ + void imageResizeRequest(const QSize& sizz); + /** * Emitted when the terminal program requests to change various properties * of the terminal display. diff --git a/lib/Session.cpp b/lib/Session.cpp index 1c1c31c..7d2a773 100644 --- a/lib/Session.cpp +++ b/lib/Session.cpp @@ -95,8 +95,10 @@ Session::Session(QObject* parent) : connect( _emulation, SIGNAL(profileChangeCommandReceived(const QString &)), this, SIGNAL( profileChangeCommandReceived(const QString &)) ); + connect(_emulation, SIGNAL(imageResizeRequest(QSize)), + this, SLOT(onEmulationSizeChange(QSize))); connect(_emulation, SIGNAL(imageSizeChanged(int, int)), - this, SLOT(onEmulationSizeChange(int, int))); + this, SLOT(onViewSizeChange(int, int))); //connect teletype to emulation backend _shellProcess->setUtf8Mode(_emulation->utf8()); @@ -517,9 +519,9 @@ void Session::onViewSizeChange(int /*height*/, int /*width*/) { updateTerminalSize(); } -void Session::onEmulationSizeChange(int lines , int columns) +void Session::onEmulationSizeChange(QSize size) { - setSize( QSize(lines,columns) ); + setSize(size); } void Session::updateTerminalSize() diff --git a/lib/Session.h b/lib/Session.h index 5cdae55..7d2e333 100644 --- a/lib/Session.h +++ b/lib/Session.h @@ -486,7 +486,7 @@ private slots: void monitorTimerDone(); void onViewSizeChange(int height, int width); - void onEmulationSizeChange(int lines , int columns); + void onEmulationSizeChange(QSize); void activityStateSet(int); diff --git a/lib/Vt102Emulation.cpp b/lib/Vt102Emulation.cpp index 7429c10..38c6bfd 100644 --- a/lib/Vt102Emulation.cpp +++ b/lib/Vt102Emulation.cpp @@ -532,7 +532,9 @@ void Vt102Emulation::processToken(int token, int p, int q) case TY_ESC_DE('8' ) : _currentScreen->helpAlign ( ); break; // resize = \e[8;;t - case TY_CSI_PS('t', 8) : setImageSize( q /* columns */, p /* lines */ ); break; + case TY_CSI_PS('t', 8) : setImageSize( q /* columns */, p /* lines */ ); + emit imageResizeRequest(QSize(q, p)); + break; // change tab text color : \e[28;t color: 0-16,777,215 case TY_CSI_PS('t', 28) : emit changeTabTextColorRequest ( p ); break;