1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

macOS: Move set dock icon to juce_core

This commit is contained in:
Anthony Nicholls 2023-04-17 12:45:17 +01:00
parent c9c2ca0aab
commit 3f91c8782b
4 changed files with 38 additions and 10 deletions

View file

@ -209,6 +209,7 @@
#include "native/juce_SystemStats_mac.mm" #include "native/juce_SystemStats_mac.mm"
#include "native/juce_Threads_mac.mm" #include "native/juce_Threads_mac.mm"
#include "native/juce_PlatformTimer_generic.cpp" #include "native/juce_PlatformTimer_generic.cpp"
#include "native/juce_Process_mac.mm"
//============================================================================== //==============================================================================
#elif JUCE_WINDOWS #elif JUCE_WINDOWS

View file

@ -0,0 +1,36 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
#if JUCE_MAC
void Process::setDockIconVisible (bool isVisible)
{
ProcessSerialNumber psn { 0, kCurrentProcess };
[[maybe_unused]] OSStatus err = TransformProcessType (&psn, isVisible ? kProcessTransformToForegroundApplication
: kProcessTransformToUIElementApplication);
jassert (err == 0);
}
#endif
} // namespace juce

View file

@ -134,7 +134,7 @@ public:
#endif #endif
//============================================================================== //==============================================================================
#if (JUCE_MAC && JUCE_MODULE_AVAILABLE_juce_gui_basics) || DOXYGEN #if JUCE_MAC || DOXYGEN
/** OSX ONLY - Shows or hides the OSX dock icon for this app. */ /** OSX ONLY - Shows or hides the OSX dock icon for this app. */
static void setDockIconVisible (bool isVisible); static void setDockIconVisible (bool isVisible);
#endif #endif

View file

@ -585,13 +585,4 @@ String SystemClipboard::getTextFromClipboard()
return nsStringToJuce ([[NSPasteboard generalPasteboard] stringForType: NSPasteboardTypeString]); return nsStringToJuce ([[NSPasteboard generalPasteboard] stringForType: NSPasteboardTypeString]);
} }
void Process::setDockIconVisible (bool isVisible)
{
ProcessSerialNumber psn { 0, kCurrentProcess };
[[maybe_unused]] OSStatus err = TransformProcessType (&psn, isVisible ? kProcessTransformToForegroundApplication
: kProcessTransformToUIElementApplication);
jassert (err == 0);
}
} // namespace juce } // namespace juce