Displaying two fullscreen windows on two monitors in Adobe AIR on Mac OS X (Mavericks)

半世苍凉 提交于 2019-12-10 20:08:12

问题


I'm on Mac OS X (Mavericks). Using Adobe AIR, I want to display separate fullscreen windows on each of my two monitors (builtin laptop retina display and external hdmi monitor).

I'm able to get a fullscreen window on my main monitor and an almost fullscreen window on the secondary one. When I say 'almost', I mean that the window is fullscreen except for the space at the top where the menu bar would be (the desktop's background image is showing):

At first I thought it was a problem with AIR but I'm starting to think it may be an OS X limitation. If I interact with the primary screen, everything is normal. However, if I click on the secondary screen, the menu bars on both screens appear. It is as though only the first screen is really in "fullscreen mode". It seems the second one is treated as a maximized chromeless window.

Do you guys know what's going on ? Here is the code I'm using:

package {

    import flash.display.NativeWindow;
    import flash.display.NativeWindowInitOptions;
    import flash.display.NativeWindowSystemChrome;
    import flash.display.Screen;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageDisplayState;
    import flash.display.StageScaleMode;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.text.TextFormatAlign;

    public class TwoFullscreenNativeWindowsInTwoMonitors extends Sprite {

        public var secondWindow:NativeWindow;

        public function TwoFullscreenNativeWindowsInTwoMonitors() {

            // Make primary (default) window's stage go fullscreen
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
            stage.color = 0xC02A2A; // red

            // Create fullscreen window on second monitor (check if available first)
            if (Screen.screens[1]) {

                // Window
                var nwio:NativeWindowInitOptions = new NativeWindowInitOptions();
                nwio.systemChrome = NativeWindowSystemChrome.NONE;
                secondWindow = new NativeWindow(nwio);
                secondWindow.bounds = (Screen.screens[1] as Screen).bounds;
                secondWindow.activate();

                // Stage
                secondWindow.stage.align = StageAlign.TOP_LEFT;
                secondWindow.stage.scaleMode = StageScaleMode.NO_SCALE;
                secondWindow.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
                secondWindow.stage.color = 0x387D19; // green

            }

        }

    }

}

UPDATE 1:

I managed to fill the menu bar space by using an ugly hack... That is, by waiting a second and then re-setting the window height. However, the second window is still not acting "fullscreen". If I click on it, the menu bar appears...

One can achieve a similar result by ticking off the “Displays have separate Spaces” checkbox in OS X Mission Control preference pane

UPDATE 2:

It seems this is a long standing bug known by Adobe since 2011...

来源:https://stackoverflow.com/questions/22996607/displaying-two-fullscreen-windows-on-two-monitors-in-adobe-air-on-mac-os-x-mave

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!