On OS X restore from both dock and tray
authorA. V. Lukyanov <dukzcry@users.noreply.github.com>
Wed, 3 Aug 2016 18:47:26 +0000 (21:47 +0300)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 14 Sep 2016 21:01:01 +0000 (23:01 +0200)
src/uisupport/graphicalui.cpp
src/uisupport/graphicalui.h

index 1bdf047..3d3c3b6 100644 (file)
@@ -35,9 +35,6 @@
 #  include <KWindowInfo>
 #  include <KWindowSystem>
 #endif
-#ifdef Q_OS_MAC
-#include <Carbon/Carbon.h>
-#endif
 
 GraphicalUi *GraphicalUi::_instance = 0;
 QWidget *GraphicalUi::_mainWidget = 0;
@@ -55,6 +52,9 @@ GraphicalUi::GraphicalUi(QObject *parent) : AbstractUi(parent)
 #ifdef Q_OS_WIN
     _dwTickCount = 0;
 #endif
+#ifdef Q_OS_MAC
+    GetFrontProcess(&_procNum);
+#endif
 }
 
 
@@ -302,9 +302,13 @@ void GraphicalUi::activateMainWidget()
 
     // this does not actually work on all platforms... and causes more evil than good
     // mainWidget()->move(mainWidget()->frameGeometry().topLeft()); // avoid placement policies
+#ifdef Q_OS_MAC
+    SetFrontProcess(&instance()->_procNum);
+#else
     mainWidget()->show();
     mainWidget()->raise();
     mainWidget()->activateWindow();
+#endif
 
 #endif /* HAVE_KDE4 */
 }
@@ -316,18 +320,13 @@ void GraphicalUi::hideMainWidget()
     KWindowInfo info = KWindowSystem::windowInfo(mainWidget()->winId(), NET::WMDesktop | NET::WMFrameExtents);
     _onAllDesktops = info.onAllDesktops();
 #endif
-#ifdef Q_OS_MAC
-    ProcessSerialNumber pn;
-#endif
 
-    if (instance()->isHidingMainWidgetAllowed()) {
+    if (instance()->isHidingMainWidgetAllowed())
 #ifdef Q_OS_MAC
-        GetFrontProcess(&pn);
-        ShowHideProcess(&pn, false);
+        ShowHideProcess(&instance()->_procNum, false);
 #else
         mainWidget()->hide();
 #endif
-    }
 }
 
 
index 0fbf96b..f6a4cf6 100644 (file)
@@ -31,6 +31,9 @@ class UiStyle;
 #ifdef Q_OS_WIN
 #  include <windows.h>
 #endif
+#ifdef Q_OS_MAC
+#include <Carbon/Carbon.h>
+#endif
 
 class GraphicalUi : public AbstractUi
 {
@@ -119,6 +122,9 @@ private:
 #ifdef Q_OS_WIN
     DWORD _dwTickCount;
 #endif
+#ifdef Q_OS_MAC
+    ProcessSerialNumber _procNum;
+#endif
 };