Full screen mode with an audio plugin

Hello,

I'm wondering how you can make a plugin show it self in full screen mode like FabFilter ProQ. If you move the main component from your AudioProcessorEditor to the Desktop with addToDesktop() and getPeer()->setFullScreen(true) it seems to work. However, the key strokes do not reach the host, so if you press Spacebar to play/stop it doesn't have effect while the main component have the focus. And your editor component is not linked to the host window.

Is there any way to do this?

This is something that is not entirely in JUCE's control. The problem is that the flag ComponentPeer::windowIgnoresKeyPresses (when calling addToDesktop) will solve your problem, i.e. the DAW will correctly receive key presses as the editor window ignores them. However, as the window cannot become key (aka ComponentPeer::windowIgnoresKeyPresses is set), some hosts (Cubase, REAPER) will not allow the window to come all the way to the front. Unsetting ComponentPeer::windowIgnoresKeyPresses makes the window come to the front, but it will then steal all the keys.

In the end, I found the following to do the trick for me. Does this work for you?

fullscreenEditor = new JuceDemoPluginAudioProcessorEditor (*this, true);
fullscreenEditor->setVisible (true);
fullscreenEditor->addToDesktop(ComponentPeer::windowHasTitleBar 
                             | ComponentPeer::windowIgnoresKeyPresses
                             | ComponentPeer::windowIsResizable
                             | ComponentPeer::windowHasMinimiseButton
                             | ComponentPeer::windowHasMaximiseButton);

if (fullscreenEditor->getPeer() != nullptr)
{
    Desktop::getInstance().setKioskModeComponent (fullscreenEditor);
}

I tested this on Mac OS X.

It seems it's not working here. There is few reasons for this:

- Once the hosts loses the keyboard focus (maybe because you switched to another window or because your plugin wants the keyboard focus), they key shortcuts stop reaching the hosts.

- When you switch to another application with Alt+Tab and then you go back to the host, the desktop component is still in the background (it's not linked to the host).

- My plugin needs some keyboards shortcuts, so if this would work, it still won't be valid for me.

 

There should be a way to:

1. Link the desktop component to the host application, so when you switch applications the desktop component would be visible or invisible.

2 At least space bar should reach the host does not have the focus but the desktop component has it.

- My plugin needs some keyboards shortcuts, so if this would work, it still won't be valid for me.

 

I ended up doing a nasty trick to get this to work. As the "real" plug-in editor is still open behind the kiosk-mode window and the "real" editor still has keyboard focus, you can grab any input going to the "real" plug-in editor window and re-route them to the kiosk-mode window. I did this by adding a new method to the kiosk-mode window called "processKeys" which the "real" editor calls.

My plugin needs some keyboards shortcuts, so if this would work, it still won't be valid for me.

One way to avoid the Alt+Tab problem is to close the full screen window when you detect that the host application has gone to the background. What does Fab Filter do when you use Alt+Tab?

 

Generally, it's really not a good idea to open your own windows in a host though. This is because lastly the host is responsible for event processing and juce has no way of knowing how the host handles events and windows internally. The editor window is no exception: the host will always open the editor window and only ask juce to paint inside the host provided window. Even resizing a window is (mostly) not always done by juce: juce will ask the host to resize the editor window instead. If you create your own window, you have no idea how different hosts will handle this.

Is this still a relevant way to add full screen mode to an audio plugin in 2017? I need this for my audio visualizer plugin.

I couldn’t find much on that topic except for this thread, so here is my solution for those wondering:

> void fullscreen() {
>   nonFullscreenParent = getParentComponent();
>   lastNonFulscreenBounds = getBounds();
>   addToDesktop(0);
> 	if (getPeer() != nullptr)
> 	{
> 		Desktop::getInstance().setKioskModeComponent(this);
> 	};
> 	auto screen = Desktop::getInstance().getDisplays().getPrimaryDisplay();
> 	if (screen != nullptr)
> 	{
> 		setSize(screen->totalArea.getWidth(), screen->totalArea.getHeight());
> 	};
> }
> void unfullscreen() {
> 	if (getPeer() != nullptr)
> 	{
> 		Desktop::getInstance().setKioskModeComponent(nullptr);
> 	};
> 	nonFullscreenParent->addChildComponent(this);
> 	setSize(lastNonFulscreenBounds.getWidth(), lastNonFulscreenBounds.getHeight());
> 	setBounds(lastNonFulscreenBounds);
> 	resized();
> }

Couple of notes:

  • this is the solution specifically for fullscreen stuff like FabFilter does it: no title bar, no taskbar etc;
  • using ‘setFullscreen’ doesn’t make sense since it does nothing. Also it shows some weird behavior regarding Windows taskbar. So I found that setting sizes in ‘setSize’ works better;
  • not using ‘setBounds’ during return from fullscreen mode leads to wrong positioning;
  • not calling ‘resized()’ manually leads to problems with inner components layout.
2 Likes

Exit full screen mode, the plugin window cannot return to its original parent window.