diff options
Diffstat (limited to 'src-qt5/desktop-utils/lumina-terminal')
6 files changed, 33 insertions, 3 deletions
diff --git a/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp b/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp index b400ac6e..783fc482 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp @@ -57,7 +57,7 @@ TermWindow::TermWindow(QSettings *set) : QWidget(0, Qt::Window | Qt::BypassWindo connect(closeS, SIGNAL(activated()), this, SLOT(CloseWindow()) ); connect(prevTabS, SIGNAL(activated()), this, SLOT(Prev_Tab()) ); connect(nextTabS, SIGNAL(activated()), this, SLOT(Next_Tab()) ); - + connect(QApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(activeStatusChanged()) ); //Now set the defaults screennum = 0; //default value setTopOfScreen(true); //default value @@ -282,6 +282,14 @@ void TermWindow::AnimFinished(){ animRunning = -1; //done } +void TermWindow::activeStatusChanged(){ + //Note: Qt 5.6.1 returns the opposite value for isActiveWindow() (12/7/16) + //qDebug() << "active status changed:" << this->isActiveWindow() << (this == QApplication::activeWindow()); + if(animRunning>=0){ return; } //ignore this event - already changing + if(!this->isActiveWindow() && !this->isVisible()){ ShowWindow(); } + else if(this->isActiveWindow() && this->isVisible()){ HideWindow(); } +} + // =================== // PROTECTED // =================== diff --git a/src-qt5/desktop-utils/lumina-terminal/TermWindow.h b/src-qt5/desktop-utils/lumina-terminal/TermWindow.h index d68c5457..d21fe502 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TermWindow.h +++ b/src-qt5/desktop-utils/lumina-terminal/TermWindow.h @@ -56,7 +56,9 @@ private slots: void focusOnWidget(); //Animation finishing void AnimFinished(); - + //Window focus/active status changed + void activeStatusChanged(); + protected: void mouseMoveEvent(QMouseEvent*); diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp index d9099452..6342be59 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp @@ -471,6 +471,7 @@ void TerminalWidget::keyPressEvent(QKeyEvent *ev){ void TerminalWidget::mousePressEvent(QMouseEvent *ev){ this->setFocus(); + this->activateWindow(); if(ev->button()==Qt::RightButton){ QTextEdit::mousePressEvent(ev); }else if(ev->button()==Qt::MiddleButton){ diff --git a/src-qt5/desktop-utils/lumina-terminal/TrayIcon.cpp b/src-qt5/desktop-utils/lumina-terminal/TrayIcon.cpp index 52e15314..5198146e 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TrayIcon.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TrayIcon.cpp @@ -145,6 +145,7 @@ void TrayIcon::updateScreenMenu(){ } } ScreenMenu->setVisible(!ScreenMenu->isEmpty()); + ScreenMenu->setEnabled(!ScreenMenu->isEmpty()); } void TrayIcon::TrayActivated(QSystemTrayIcon::ActivationReason reason){ diff --git a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp index 24124348..a1ee0be7 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp @@ -2,11 +2,13 @@ #include <QDir> #include <QProcessEnvironment> +#include <QTimer> TTYProcess::TTYProcess(QObject *parent) : QObject(parent){ childProc = 0; sn = 0; ttyfd = 0; + starting = true; } TTYProcess::~TTYProcess(){ @@ -59,6 +61,12 @@ bool TTYProcess::startTTY(QString prog, QStringList args, QString workdir){ connect(sn, SIGNAL(activated(int)), this, SLOT(checkStatus(int)) ); ttyfd = FD; qDebug() << " - PTY:" << ptsname(FD); + //BUG BYPASS - 12/7/16 + //If the PTY gets input fairly soon after starting, the PTY will re-print the initial line(s) + // So send the "newline" signal now to get things started + starting = true; + //writeTTY("\n"); //newline + //writeTTY(QByteArray("\x1b[2J") ); //clear display return true; } } @@ -97,12 +105,21 @@ QByteArray TTYProcess::readTTY(){ } bool bad = true; BA = CleanANSI(BA, bad); - if(bad){ + if(bad){ //incomplete fragent - read some more first fragBA = BA; return readTTY(); }else{ //qDebug() << "Read Data:" << BA; + if(starting && !BA.contains("\n") ){ + //qDebug() << "Starting phase 1:" << BA; + writeTTY("\n\b"); //newline + backspace + BA.clear(); + }else if(starting){ + //qDebug() << "Starting phase 2:" << BA; + BA.remove(0, BA.indexOf("\n")+1); + starting = false; + } return BA; } } diff --git a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h index 9b3873b0..1603fe5e 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h @@ -60,6 +60,7 @@ private: int ttyfd; QSocketNotifier *sn; QByteArray fragBA; //fragment ByteArray + bool starting; //==================================== // C Library function for setting up the PTY |