AWT Frame in full-screen exclusive mode gets minim

2019-02-11 13:17发布

i am developing an application which uses an awt frame in full-screen exclusive mode. Everythings works fine until a windows popup gets visible. This will steal the focus and my application will be minimized.

Here is my init code of the frame:

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");
    }
}

Is there a workaround or setting to avoid this?

2条回答
手持菜刀,她持情操
2楼-- · 2019-02-11 13:53

the window manager usually doesn't enforce application window modality and for custom display mode application the wm is forced to either to drop you out of fullscreen or minimize as it cannot respect the dpi setting for the other window maintaining your own window resolution.

thee is a reason for that, explained here in the context of the Window O.S.

is this for some sort of kiosk system? then make your whole application the shell, as explained here: Keeping a Windows application on top of other windows and in focus - always

task manager will still pop in front of it, and alt tabbing should work as usual.

similar step for making a single app login in linux: http://www.instructables.com/id/Setting-Up-Ubuntu-as-a-Kiosk-Web-Appliance/?ALLSTEPS

to disable usb fixing, see the answer to this question: https://superuser.com/questions/33986/is-it-possible-to-disable-the-scan-and-fix-message-when-inserting-an-sd-card

note that the first answer entail fixing the disk, if you scroll below there are the step to disable that specific dialog.

查看更多
女痞
3楼-- · 2019-02-11 14:00

Setting the awt frame modality type fixed my problem. As Lorenzo mentioned, using APPLICATION_EXCLUDE let the frame always be on top. Thank you

查看更多
登录 后发表回答