File tree Expand file tree Collapse file tree 5 files changed +41
-0
lines changed Expand file tree Collapse file tree 5 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -1421,11 +1421,13 @@ macx {
14211421
14221422 HEADERS += \
14231423 AutoStart /AutoStart -MacOS . h \
1424+ qt /macutils . h \
14241425
14251426 SOURCES += \
14261427 dependencies /hueplusplus -1 .0 .0 /src /LinHttpHandler . cpp \
14271428 serial_port /find_usb_serial_port_linux . cpp \
14281429 AutoStart /AutoStart -MacOS . cpp \
1430+ qt /macutils . mm \
14291431
14301432 # Use mbedtls v2 instead of latest
14311433 MBEDTLS_PREFIX = $$system(brew --prefix mbedtls @2 )
Original file line number Diff line number Diff line change 2121
2222#include " OpenRGBDialog2.h"
2323
24+ #ifdef __APPLE__
25+ #include " macutils.h"
26+ #endif
27+
2428using namespace std ::chrono_literals;
2529
2630/* -------------------------------------------------------------*\
@@ -339,6 +343,9 @@ int main(int argc, char* argv[])
339343
340344 if (ret_flags & RET_FLAG_START_MINIMIZED)
341345 {
346+ #ifdef __APPLE__
347+ MacUtils::ToggleApplicationDocklessState (false );
348+ #endif
342349 dlg.hide ();
343350 }
344351 else
Original file line number Diff line number Diff line change 1818#include < QCloseEvent>
1919#include < QStyleFactory>
2020
21+ #ifdef __APPLE__
22+ #include " macutils.h"
23+ #endif
24+
2125using namespace Ui ;
2226
2327static QString GetIconString (device_type type, bool dark)
@@ -486,6 +490,9 @@ void OpenRGBDialog2::closeEvent(QCloseEvent *event)
486490
487491 if (IsMinimizeOnClose () && !this ->isHidden ())
488492 {
493+ #ifdef __APPLE__
494+ MacUtils::ToggleApplicationDocklessState (false );
495+ #endif
489496 hide ();
490497 event->ignore ();
491498 }
@@ -1382,10 +1389,16 @@ void OpenRGBDialog2::on_ShowHide()
13821389{
13831390 if (isHidden ())
13841391 {
1392+ #ifdef __APPLE__
1393+ MacUtils::ToggleApplicationDocklessState (true );
1394+ #endif
13851395 show ();
13861396 }
13871397 else
13881398 {
1399+ #ifdef __APPLE__
1400+ MacUtils::ToggleApplicationDocklessState (false );
1401+ #endif
13891402 hide ();
13901403 }
13911404}
Original file line number Diff line number Diff line change 1+ #ifndef MACUTILS_H
2+ #define MACUTILS_H
3+
4+ class MacUtils
5+ {
6+ public:
7+ static void ToggleApplicationDocklessState (bool showDock);
8+ };
9+
10+ #endif // MACUTILS_H
Original file line number Diff line number Diff line change 1+ #import < Cocoa/Cocoa.h>
2+ #include " macutils.h"
3+
4+ void MacUtils::ToggleApplicationDocklessState (bool showDock)
5+ {
6+ ProcessApplicationTransformState transformState = showDock ? ProcessApplicationTransformState (kProcessTransformToForegroundApplication ) : ProcessApplicationTransformState (kProcessTransformToUIElementApplication );
7+ ProcessSerialNumber psn = { 0 , kCurrentProcess };
8+ TransformProcessType (&psn, transformState);
9+ }
You can’t perform that action at this time.
0 commit comments