aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp13
-rw-r--r--src-qt5/desktop-utils/lumina-terminal/TermWindow.h1
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();
bgstack15