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 {
1421
1421
1422
1422
HEADERS += \
1423
1423
AutoStart /AutoStart -MacOS . h \
1424
+ qt /macutils . h \
1424
1425
1425
1426
SOURCES += \
1426
1427
dependencies /hueplusplus -1 .0 .0 /src /LinHttpHandler . cpp \
1427
1428
serial_port /find_usb_serial_port_linux . cpp \
1428
1429
AutoStart /AutoStart -MacOS . cpp \
1430
+ qt /macutils . mm \
1429
1431
1430
1432
# Use mbedtls v2 instead of latest
1431
1433
MBEDTLS_PREFIX = $$system(brew --prefix mbedtls @2 )
Original file line number Diff line number Diff line change 21
21
22
22
#include " OpenRGBDialog2.h"
23
23
24
+ #ifdef __APPLE__
25
+ #include " macutils.h"
26
+ #endif
27
+
24
28
using namespace std ::chrono_literals;
25
29
26
30
/* -------------------------------------------------------------*\
@@ -339,6 +343,9 @@ int main(int argc, char* argv[])
339
343
340
344
if (ret_flags & RET_FLAG_START_MINIMIZED)
341
345
{
346
+ #ifdef __APPLE__
347
+ MacUtils::ToggleApplicationDocklessState (false );
348
+ #endif
342
349
dlg.hide ();
343
350
}
344
351
else
Original file line number Diff line number Diff line change 18
18
#include < QCloseEvent>
19
19
#include < QStyleFactory>
20
20
21
+ #ifdef __APPLE__
22
+ #include " macutils.h"
23
+ #endif
24
+
21
25
using namespace Ui ;
22
26
23
27
static QString GetIconString (device_type type, bool dark)
@@ -486,6 +490,9 @@ void OpenRGBDialog2::closeEvent(QCloseEvent *event)
486
490
487
491
if (IsMinimizeOnClose () && !this ->isHidden ())
488
492
{
493
+ #ifdef __APPLE__
494
+ MacUtils::ToggleApplicationDocklessState (false );
495
+ #endif
489
496
hide ();
490
497
event->ignore ();
491
498
}
@@ -1382,10 +1389,16 @@ void OpenRGBDialog2::on_ShowHide()
1382
1389
{
1383
1390
if (isHidden ())
1384
1391
{
1392
+ #ifdef __APPLE__
1393
+ MacUtils::ToggleApplicationDocklessState (true );
1394
+ #endif
1385
1395
show ();
1386
1396
}
1387
1397
else
1388
1398
{
1399
+ #ifdef __APPLE__
1400
+ MacUtils::ToggleApplicationDocklessState (false );
1401
+ #endif
1389
1402
hide ();
1390
1403
}
1391
1404
}
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