diff -r 9bfc15277dcb glass/glass/src/com/sun/glass/ui/Application.java --- a/glass/glass/src/com/sun/glass/ui/Application.java Wed Feb 27 15:47:24 2013 -0500 +++ b/glass/glass/src/com/sun/glass/ui/Application.java Thu Feb 28 09:02:30 2013 -0500 @@ -145,7 +145,12 @@ // on Linux - TODO application.name = "java"; // default try { - application.runLoop(launchable); + application.runLoop(new Runnable () { + public void run() { + Screen.init(); + launchable.run(); + } + }); } catch (Throwable t) { t.printStackTrace(); } diff -r 9bfc15277dcb glass/glass/src/com/sun/glass/ui/Screen.java --- a/glass/glass/src/com/sun/glass/ui/Screen.java Wed Feb 27 15:47:24 2013 -0500 +++ b/glass/glass/src/com/sun/glass/ui/Screen.java Thu Feb 28 09:02:30 2013 -0500 @@ -24,10 +24,14 @@ */ package com.sun.glass.ui; +import java.util.Collections; import java.util.List; public final class Screen { + static List Screens; + static Screen MainScreen; + public static class EventHandler { public void handleSettingsChanged() { } @@ -38,30 +42,23 @@ return Application.GetApplication().staticScreen_getVideoRefreshPeriod(); } - public static Screen getDeepestScreen() { - Application.checkEventThread(); - return Application.GetApplication().staticScreen_getDeepestScreen(); - } - + // Can be called from any thread public static Screen getMainScreen() { - //Application.checkEventThread(); // Quantum - return Application.GetApplication().staticScreen_getMainScreen(); - } - - public static Screen getScreenForLocation(int x, int y) { - Application.checkEventThread(); - return Application.GetApplication().staticScreen_getScreenForLocation(x, y); + return MainScreen; } // used by Window.notifyMoveToAnotherScreen static Screen getScreenForPtr(long screenPtr) { Application.checkEventThread(); - return Application.GetApplication().staticScreen_getScreenForPtr(screenPtr); + for(Screen screen : Screens) { + if (screen.ptr == screenPtr) return screen; + } + return null; } + // Can be called by any thread public static List getScreens() { - //Application.checkEventThread(); // Quantum - return Application.GetApplication().staticScreen_getScreens(); + return Screens; } private static EventHandler eventHandler; @@ -86,7 +83,6 @@ private float scale; public Screen() { - //Application.checkEventThread(); // Quantum this.ptr = 0L; this.depth = 0; @@ -108,67 +104,54 @@ } public int getDepth() { - Application.checkEventThread(); return this.depth; } public int getX() { - Application.checkEventThread(); return this.x; } public int getY() { - Application.checkEventThread(); return this.y; } public int getWidth() { - Application.checkEventThread(); return this.width; } public int getHeight() { - Application.checkEventThread(); return this.height; } public int getVisibleX() { - Application.checkEventThread(); return this.visibleX; } public int getVisibleY() { - Application.checkEventThread(); return this.visibleY; } public int getVisibleWidth() { - Application.checkEventThread(); return this.visibleWidth; } public int getVisibleHeight() { - Application.checkEventThread(); return this.visibleHeight; } public int getResolutionX() { - Application.checkEventThread(); return this.resolutionX; } public int getResolutionY() { - Application.checkEventThread(); return this.resolutionY; } public float getScale() { - Application.checkEventThread(); return this.scale; } public long getNativeScreen() { - //Application.checkEventThread(); // Quantum return this.ptr; } @@ -182,7 +165,13 @@ eventHandler = eh; } + static void init() { + Screens = Collections.unmodifiableList(Application.GetApplication().staticScreen_getScreens()); + MainScreen = Application.GetApplication().staticScreen_getMainScreen(); + } + private static void notifySettingsChanged() { + init(); if (eventHandler != null) { eventHandler.handleSettingsChanged(); }