On OS X restore from dock
authorA. V. Lukyanov <dukzcry@users.noreply.github.com>
Wed, 3 Aug 2016 02:16:29 +0000 (05:16 +0300)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 4 Apr 2018 21:14:03 +0000 (23:14 +0200)
(cherry picked from commit c67fec44128f48c1ac2ab7ef2b6f73a27fb67f66)

CMakeLists.txt
src/uisupport/graphicalui.cpp

index 1a05ed5..7bff2f1 100644 (file)
@@ -87,6 +87,9 @@ if (APPLE)
         option(WITH_NOTIFICATION_CENTER "OS X Notification Center support" ON)
         add_feature_info(WITH_NOTIFICATION_CENTER WITH_NOTIFICATION_CENTER "Use the OS X Notification Center")
     endif()
+    find_library(CARBON_LIBRARY Carbon)
+    mark_as_advanced(CARBON_LIBRARY)
+    link_libraries(${CARBON_LIBRARY})
 endif()
 
 # Always embed on Windows, OSX or for a static build; never embed when enabling KDE integration
index d1e106d..10f3790 100644 (file)
@@ -35,6 +35,9 @@
 #  include <KWindowInfo>
 #  include <KWindowSystem>
 #endif
+#ifdef Q_OS_MAC
+#include <Carbon/Carbon.h>
+#endif
 
 GraphicalUi *GraphicalUi::_instance = 0;
 QWidget *GraphicalUi::_mainWidget = 0;
@@ -313,9 +316,18 @@ 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);
+#else
         mainWidget()->hide();
+#endif
+    }
 }