JUCE_SUPPORT_CARBON=0 fails because of setKioskComponent


#1

juce_mac_NSViewComponentPeer.mm calls SetSystemUIMode, which is a function only available in Carbon. Mac OS Versions 10.6 and later have NSApplication’s presentation options API (https://developer.apple.com/library/mac/#technotes/tn2062/_index.html)

However, in the juce source, Desktop::setKioskComponent() calls juce_mac_NSViewComponentPeer.mm when OS versions before 10.6 are targeted, even when JUCE_SUPPORT_CARBON is set to 0.

Either Desktop::setKioskComponent API should be unavailable when the target sdk <10.6 and Carbon support is disabled (the preferred solution) or the function should do nothing in that case.


#2

This is how I fixed it in my DspFilters amalgamation. Now the project links without Carbon.framework, since I am setting JUCE_SUPPORT_CARBON = 0

void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars)
{
   #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
	if (enableOrDisable)
	{
		[NSApp setPresentationOptions: (allowMenusAndBars ? (NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)
														  : (NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar))];
		kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false));
	}
	else
	{
		[NSApp setPresentationOptions: NSApplicationPresentationDefault];
	}
   #elif JUCE_SUPPORT_CARBON
	if (enableOrDisable)
	{
		SetSystemUIMode (kUIModeAllSuppressed, allowMenusAndBars ? kUIOptionAutoShowMenuBar : 0);
		kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false));
	}
	else
	{
		SetSystemUIMode (kUIModeNormal, 0);
	}
   #else
    throw std::runtime_error ("setKioskComponent failed because Carbon is unavailable and the target operating system is below 10.6");
   #endif
}

#3

Jules can you please fix this? It will break anyone who uses my Dsp Filters after re-amalgamating…

Besides, I’m sure you will be happy with anything that further reduces the chances of someone linking with Carbon :slight_smile:


#4

Absolutely - yep, I’ll take a look at this right away, thanks!