summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-06-01 09:05:56 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-06-01 09:05:56 (GMT)
commit8b167ce7302d973460cc8ee0790616283114d4c3 (patch)
tree62c9463709b60c6cc93a89fdc1339acabaab3136 /Swift/QtUI
parent193cb8e6e119e05468ca2ee1573b458aa3aab4d4 (diff)
downloadswift-8b167ce7302d973460cc8ee0790616283114d4c3.zip
swift-8b167ce7302d973460cc8ee0790616283114d4c3.tar.bz2
Avoid whoosh down, whooosh up on Mac when opening chat windows.
This changes so that the chat window will appear without focus if being shown without the user requesting it, but it will no longer appear minimised. Resolves: #1022
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatTabs.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index 9921754..90be786 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -25,6 +25,8 @@ namespace Swift {
QtChatTabs::QtChatTabs() : QWidget() {
#ifndef Q_WS_MAC
setWindowIcon(QIcon(":/logo-chat-16.png"));
+#else
+ setAttribute(Qt::WA_ShowWithoutActivating);
#endif
tabs_ = new QtTabWidget(this);
@@ -270,7 +272,20 @@ void QtChatTabs::moveEvent(QMoveEvent*) {
void QtChatTabs::checkForFirstShow() {
if (!isVisible()) {
+#ifndef Q_WS_MAC
showMinimized();
+#else
+ /* https://bugreports.qt-project.org/browse/QTBUG-19194
+ * ^ When the above is fixed we can swap the below for just show();
+ * WA_ShowWithoutActivating seems to helpfully not work, so... */
+
+ QWidget* currentWindow = QApplication::activeWindow(); /* Remember who had focus if we're the current application*/
+ show();
+ QCoreApplication::processEvents(); /* Run through the eventloop to clear the show() */
+ if (currentWindow) {
+ currentWindow->activateWindow(); /* Set focus back */
+ }
+#endif
}
}