Skip to content

Commit

Permalink
(ckb OSX) Workaround for the window always appearing at login
Browse files Browse the repository at this point in the history
  • Loading branch information
ccMSC committed Apr 8, 2016
1 parent 21f3863 commit 5867121
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ckb/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 275,14 @@ void MainWindow::stateChange(Qt::ApplicationState state){
// On OSX it's possible for the app to be brought to the foreground without the window actually reappearing.
// We want to make sure it's shown when this happens.
#ifdef Q_OS_MAC
if(state == Qt::ApplicationActive)
showWindow();
static quint64 lastStateChange = 0;
quint64 now = QDateTime::currentMSecsSinceEpoch();
if(state == Qt::ApplicationActive){
// This happens once at startup so ignore it. Also don't allow it to be called more than once every 2s.
if(lastStateChange != 0 && now >= lastStateChange 2 * 1000)
showWindow();
lastStateChange = now;
}
#endif
}

Expand Down

0 comments on commit 5867121

Please sign in to comment.