diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-04-25 20:43:01 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-04-25 20:43:01 (GMT) |
commit | c9d0c35dfb20ccac038954a8ad51690eda919fba (patch) | |
tree | 7d1ec4bb942322663315f55c0cb1cc5e091a1c4b /Swift/QtUI/QtLoginWindow.cpp | |
parent | 67c0420a2798ddb2c64fec01c1d37f038ad39262 (diff) | |
download | swift-contrib-c9d0c35dfb20ccac038954a8ad51690eda919fba.zip swift-contrib-c9d0c35dfb20ccac038954a8ad51690eda919fba.tar.bz2 |
Clicking the OS X dock brings the app to the front.
Resolves: #501
Diffstat (limited to 'Swift/QtUI/QtLoginWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtLoginWindow.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index e7cabf2..53a3be3 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -217,6 +217,13 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream, SettingsProvider* set loginAutomatically_->setChecked(false); } +#ifdef SWIFTEN_PLATFORM_MACOSX + // Temporary workaround for case 501. Could be that this code is still + // needed when Qt provides a proper fix + qApp->installEventFilter(this); +#endif + + this->show(); } @@ -242,6 +249,15 @@ bool QtLoginWindow::eventFilter(QObject *obj, QEvent *event) { return true; } } +#ifdef SWIFTEN_PLATFORM_MACOSX + // Dock clicked + // Temporary workaround for case 501. Could be that this code is still + // needed when Qt provides a proper fix + if (obj == qApp && event->type() == QEvent::ApplicationActivate && !isVisible()) { + bringToFront(); + } +#endif + return QObject::eventFilter(obj, event); } @@ -459,11 +475,9 @@ void QtLoginWindow::setMessage(const std::string& message) { } } -void QtLoginWindow::bringToFront() { +void QtLoginWindow::toggleBringToFront() { if (!isVisible()) { - window()->showNormal(); - window()->raise(); - window()->activateWindow(); + bringToFront(); } else { #ifndef Q_WS_MAC @@ -473,6 +487,12 @@ void QtLoginWindow::bringToFront() { } } +void QtLoginWindow::bringToFront() { + window()->showNormal(); + window()->raise(); + window()->activateWindow(); +} + void QtLoginWindow::hide() { window()->hide(); } |