Browse Source

macOS: Move set dock icon to juce_core

v7.0.9
Anthony Nicholls 2 years ago
parent
commit
3f91c8782b
4 changed files with 38 additions and 10 deletions
  1. +1
    -0
      modules/juce_core/juce_core.cpp
  2. +36
    -0
      modules/juce_core/native/juce_Process_mac.mm
  3. +1
    -1
      modules/juce_core/threads/juce_Process.h
  4. +0
    -9
      modules/juce_gui_basics/native/juce_Windowing_mac.mm

+ 1
- 0
modules/juce_core/juce_core.cpp View File

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


+ 36
- 0
modules/juce_core/native/juce_Process_mac.mm 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

+ 1
- 1
modules/juce_core/threads/juce_Process.h View File

@@ -134,7 +134,7 @@ public:
#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. */
static void setDockIconVisible (bool isVisible);
#endif


+ 0
- 9
modules/juce_gui_basics/native/juce_Windowing_mac.mm View File

@@ -585,13 +585,4 @@ String SystemClipboard::getTextFromClipboard()
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

Loading…
Cancel
Save