aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp b/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp
index b400ac6e..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()) );
-
//Now set the defaults
screennum = 0; //default value
setTopOfScreen(true); //default value
@@ -282,6 +286,12 @@ void TermWindow::AnimFinished(){
animRunning = -1; //done
}
+void TermWindow::activeStatusChanged(){
+ if(animRunning>=0){ return; } //ignore this event - already changing
+ QWidget *active = QApplication::activeWindow();
+ if(active==0 && this->isVisible()){ HideWindow(); }
+}
+
// ===================
// PROTECTED
// ===================
bgstack15