modules/graphics/src/main/java/com/sun/glass/ui/win/WinApplication.java

Print this page




  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package com.sun.glass.ui.win;
  26 
  27 import com.sun.glass.ui.*;
  28 import com.sun.glass.ui.CommonDialogs.ExtensionFilter;
  29 import com.sun.glass.ui.CommonDialogs.FileChooserResult;
  30 import com.sun.glass.utils.NativeLibLoader;


  31 
  32 import java.io.File;
  33 import java.nio.ByteBuffer;
  34 import java.nio.IntBuffer;
  35 import java.security.AccessController;
  36 import java.security.PrivilegedAction;
  37 import java.util.List;
  38 
  39 import javafx.scene.accessibility.Accessible;
  40 
  41 final class WinApplication extends Application implements InvokeLaterDispatcher.InvokeLaterSubmitter {
  42 
  43     private static native void initIDs();
  44     static {
  45         // This loading of msvcr100.dll (VS2010) is required when run with Java 6
  46         // since it was build with VS2003 and doesn't include msvcr100.dll in it's JRE.
  47         // Note: See README-builds.html on MSVC requirement: VS2010 is required.
  48         AccessController.doPrivileged(new PrivilegedAction<Void>() {
  49             public Void run() {
  50                 verbose = Boolean.getBoolean("javafx.verbose");


 240     @Override protected int staticView_getMultiClickMaxY() {
 241         return WinView.getMultiClickMaxY_impl();
 242     }
 243     
 244     @Override native protected void _invokeAndWait(Runnable runnable);
 245 
 246     native private void _submitForLaterInvocation(Runnable r);
 247     // InvokeLaterDispatcher.InvokeLaterSubmitter
 248     @Override public void submitForLaterInvocation(Runnable r) {
 249         _submitForLaterInvocation(r);
 250     }
 251 
 252     @Override protected void _invokeLater(Runnable runnable) {
 253         if (invokeLaterDispatcher != null) {
 254             invokeLaterDispatcher.invokeLater(runnable);
 255         } else {
 256             submitForLaterInvocation(runnable);
 257         }
 258     }
 259 









 260     @Override
 261     protected boolean _supportsInputMethods() {
 262         return true;
 263     }
 264 
 265     @Override
 266     protected boolean _supportsTransparentWindows() {
 267         return true;
 268     }
 269 
 270     @Override native protected boolean _supportsUnifiedWindows();
 271     
 272     public String getDataDirectory() {
 273         checkEventThread();
 274         String baseDirectory = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getenv("APPDATA"));
 275         if (baseDirectory == null || baseDirectory.length() == 0) {
 276             return super.getDataDirectory();
 277         }
 278         return baseDirectory + File.separator + name + File.separator;
 279     }


  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package com.sun.glass.ui.win;
  26 
  27 import com.sun.glass.ui.*;
  28 import com.sun.glass.ui.CommonDialogs.ExtensionFilter;
  29 import com.sun.glass.ui.CommonDialogs.FileChooserResult;
  30 import com.sun.glass.utils.NativeLibLoader;
  31 import com.sun.javafx.application.PlatformImpl;
  32 import com.sun.javafx.tk.Toolkit;
  33 
  34 import java.io.File;
  35 import java.nio.ByteBuffer;
  36 import java.nio.IntBuffer;
  37 import java.security.AccessController;
  38 import java.security.PrivilegedAction;
  39 import java.util.List;
  40 
  41 import javafx.scene.accessibility.Accessible;
  42 
  43 final class WinApplication extends Application implements InvokeLaterDispatcher.InvokeLaterSubmitter {
  44 
  45     private static native void initIDs();
  46     static {
  47         // This loading of msvcr100.dll (VS2010) is required when run with Java 6
  48         // since it was build with VS2003 and doesn't include msvcr100.dll in it's JRE.
  49         // Note: See README-builds.html on MSVC requirement: VS2010 is required.
  50         AccessController.doPrivileged(new PrivilegedAction<Void>() {
  51             public Void run() {
  52                 verbose = Boolean.getBoolean("javafx.verbose");


 242     @Override protected int staticView_getMultiClickMaxY() {
 243         return WinView.getMultiClickMaxY_impl();
 244     }
 245     
 246     @Override native protected void _invokeAndWait(Runnable runnable);
 247 
 248     native private void _submitForLaterInvocation(Runnable r);
 249     // InvokeLaterDispatcher.InvokeLaterSubmitter
 250     @Override public void submitForLaterInvocation(Runnable r) {
 251         _submitForLaterInvocation(r);
 252     }
 253 
 254     @Override protected void _invokeLater(Runnable runnable) {
 255         if (invokeLaterDispatcher != null) {
 256             invokeLaterDispatcher.invokeLater(runnable);
 257         } else {
 258             submitForLaterInvocation(runnable);
 259         }
 260     }
 261 
 262     protected boolean notifyThemeChanged(String themeName) {
 263         return PlatformImpl.setAccessibilityTheme(themeName);
 264     }
 265 
 266     private native String _getHighContrastTheme();
 267     @Override public String getHighContrastTheme() {
 268         return _getHighContrastTheme();
 269     }
 270  
 271     @Override
 272     protected boolean _supportsInputMethods() {
 273         return true;
 274     }
 275 
 276     @Override
 277     protected boolean _supportsTransparentWindows() {
 278         return true;
 279     }
 280 
 281     @Override native protected boolean _supportsUnifiedWindows();
 282     
 283     public String getDataDirectory() {
 284         checkEventThread();
 285         String baseDirectory = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getenv("APPDATA"));
 286         if (baseDirectory == null || baseDirectory.length() == 0) {
 287             return super.getDataDirectory();
 288         }
 289         return baseDirectory + File.separator + name + File.separator;
 290     }