GLCanvas in full-screen exclusive mode loosing focus

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

GLCanvas in full-screen exclusive mode loosing focus

Tosken
Hi,

i am developing an application which uses a GLCanvas on an AWT frame in full-screen exclusive mode.
Everything works fine so far. The problem is that when a windows popup will be shown my application looses its focus / full-screen behavior and gets minimized to the task bar.
For example this happens when i plug an USB-Device an the windows dialog opens up.
I there a workaround or setting to avoid this behaviour?

Here my code for window and GLCanvas init:
Where frame is the awt frame


frame.setLocation(0, 0);
GraphicsDevice monitor = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
if (ApplicationConfig.getInstance().useFullscreenMode()) {
        frame.setUndecorated(true);
        frame.setResizable(false);

        if (monitor.isFullScreenSupported()) {
                monitor.setFullScreenWindow(frame);
                if (monitor.isDisplayChangeSupported()) {
                        DisplayMode defaultMode = new DisplayMode(
                                        (int) appDimension.getWidth(),
                                        (int) appDimension.getHeight(),
                                        32,
                                        DisplayMode.REFRESH_RATE_UNKNOWN);

                        monitor.setDisplayMode(defaultMode);
                        frame.setFulscreenDisplayMode(defaultMode);

                        DisplayMode selectedMode = monitor.getDisplayMode();
                        log.debug("Setting fullscreen display mode to " + selectedMode.getWidth() + "x" + selectedMode.getHeight() +
                                        " color depth: " + selectedMode.getBitDepth() + " refresh rate: " + selectedMode.getRefreshRate());
                } else {
                        log.error("Change display mode not supported");
                }
        } else {
                log.error("Full screen not supported");
        }
}



Thanks and best regards
Sebastian
Reply | Threaded
Open this post in threaded view
|

Re: GLCanvas in full-screen exclusive mode loosing focus

gouessej
Administrator
Hi

We're not responsible for AWT and using it for a game in full-screen exclusive mode is a bad idea because it's seriously broken on some platforms (Linux) and a bit buggy on others (Mac OS X and Windows).

You can try to call java.awt.Window.setAlwaysOnTop(true), maybe it will be enough.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLCanvas in full-screen exclusive mode loosing focus

Tosken
Hi,

i know that your are not responsible for AWT.
But i thought that maybe someone is facing the same issue when using JOGL.
What would you suggest? Using Newt as windowing system? Is it possible to supress the windows dialogs here?

I have already tried to set java.awt.Window.setAlwaysOnTop(true) but it does not change this behaviour.

Thank you
Sebastian
Reply | Threaded
Open this post in threaded view
|

Re: GLCanvas in full-screen exclusive mode loosing focus

jmaasing
I use NEWT, works very well for fullscreen mode. Something like this should do the trick:

final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL4));
...(set resolution and all that stuff on the caps)
GLWindow glWindow = GLWindow.create(caps);
glWindow.setVisible(true);
glWindow.setFullscreen(true);
Reply | Threaded
Open this post in threaded view
|

Re: GLCanvas in full-screen exclusive mode loosing focus

Tosken
I thin the newt fullscreen mode is not a real "exclusive" fullscreen mode.
It just removes the frame borders and scales it to the screen dimension. Is this correct?
A popup from windows (or even if you hit the windows key) will bring the popup (or the start menue) into front of the newt window.
Reply | Threaded
Open this post in threaded view
|

Re: GLCanvas in full-screen exclusive mode loosing focus

Sven Gothel
Administrator
On 06/06/2014 05:10 PM, Tosken [via jogamp] wrote:
> I thin the newt fullscreen mode is not a real "exclusive" fullscreen mode.
> It just removes the frame borders and scales it to the screen dimension. Is
> this correct?

It depends on the platform's implementation.

Today it is advised for most platforms to _not_ use exclusive mode,
i.e. at least OSX in general .. and usually X11 and Window
if spanning multiple monitors.

This will still allow one to use ALT-TAB (application switch).

On X11 (and Windows?) we toggle between an exclusive mode
in case ALT-TAB is pressed.

We don't want to 'steal' the screen.

> A popup from windows (or even if you hit the windows key) will bring the popup
> (or the start menue) into front of the newt window.

that is desired ..

~Sven


signature.asc (894 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GLCanvas in full-screen exclusive mode loosing focus

Sven Gothel
Administrator
In reply to this post by Tosken
On 06/06/2014 05:42 PM, Sven Gothel wrote:

> On 06/06/2014 05:10 PM, Tosken [via jogamp] wrote:
>> I thin the newt fullscreen mode is not a real "exclusive" fullscreen mode.
>> It just removes the frame borders and scales it to the screen dimension. Is
>> this correct?
>
> It depends on the platform's implementation.
>
> Today it is advised for most platforms to _not_ use exclusive mode,
> i.e. at least OSX in general .. and usually X11 and Window
> if spanning multiple monitors.
>
> This will still allow one to use ALT-TAB (application switch).
>
> On X11 (and Windows?) we toggle between an exclusive mode
> in case ALT-TAB is pressed.
>
> We don't want to 'steal' the screen.
>
>> A popup from windows (or even if you hit the windows key) will bring the popup
>> (or the start menue) into front of the newt window.
>
> that is desired ..
See Bug 914: <https://jogamp.org/bugzilla/show_bug.cgi?id=914>

~Sven


signature.asc (894 bytes) Download Attachment