diff options
author | Ken Moore <ken@ixsystems.com> | 2016-12-08 09:32:29 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-12-08 09:32:29 -0500 |
commit | 0d3db8715c8668a0d5297ff8dc695ffd6dc3df62 (patch) | |
tree | e3991e22820c66b8f871563f5458e7ce46ea8e19 | |
parent | Disable the auto-hide on activation event - something weird is going on (prob... (diff) | |
download | lumina-0d3db8715c8668a0d5297ff8dc695ffd6dc3df62.tar.gz lumina-0d3db8715c8668a0d5297ff8dc695ffd6dc3df62.tar.bz2 lumina-0d3db8715c8668a0d5297ff8dc695ffd6dc3df62.zip |
Fix up the auto-hide functionality within the terminal when the term window loses focus.
-rw-r--r-- | src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp | 13 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-terminal/TermWindow.h | 1 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp b/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp index 8ff3ecd1..15cfe047 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp @@ -36,6 +36,11 @@ TermWindow::TermWindow(QSettings *set) : QWidget(0, Qt::Window | Qt::BypassWindo ANIM = new QPropertyAnimation(this, "geometry", this); ANIM->setDuration(300); //1/3 second animation connect(ANIM, SIGNAL(finished()), this, SLOT(AnimFinished()) ); + activeTimer = new QTimer(this); + activeTimer->setInterval(50); + activeTimer->setSingleShot(true); + connect(activeTimer, SIGNAL(timeout()), this, SLOT(activeStatusChanged()) ); + connect(QApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), activeTimer, SLOT(start()) ); //Create the keyboard shortcuts //hideS = new QShortcut(QKeySequence(Qt::Key_Escape),this); closeS = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q),this); @@ -57,7 +62,6 @@ 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 @@ -283,12 +287,9 @@ void TermWindow::AnimFinished(){ } 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(); } - //ReShowWindow(); + QWidget *active = QApplication::activeWindow(); + if(active==0 && this->isVisible()){ HideWindow(); } } // =================== diff --git a/src-qt5/desktop-utils/lumina-terminal/TermWindow.h b/src-qt5/desktop-utils/lumina-terminal/TermWindow.h index d21fe502..5f583126 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TermWindow.h +++ b/src-qt5/desktop-utils/lumina-terminal/TermWindow.h @@ -41,6 +41,7 @@ private: bool onTop, CLOSING; QPropertyAnimation *ANIM; int animRunning; //internal flag for what animation is currently running + QTimer *activeTimer; //Calculate the window geometry necessary based on screen/location void CalculateGeom(); |