/*     */ package com.sun.glass.ui.win;
/*     */ 
/*     */ import com.sun.glass.ui.Accessible;
/*     */ import com.sun.glass.ui.Application;
/*     */ import com.sun.glass.ui.CommonDialogs;
/*     */ import com.sun.glass.ui.Cursor;
/*     */ import com.sun.glass.ui.InvokeLaterDispatcher;
/*     */ import com.sun.glass.ui.Pixels;
/*     */ import com.sun.glass.ui.Robot;
/*     */ import com.sun.glass.ui.Screen;
/*     */ import com.sun.glass.ui.Size;
/*     */ import com.sun.glass.ui.Timer;
/*     */ import com.sun.glass.ui.View;
/*     */ import com.sun.glass.ui.Window;
/*     */ import com.sun.javafx.PlatformUtil;
/*     */ import com.sun.javafx.tk.Toolkit;
/*     */ import com.sun.prism.impl.PrismSettings;
/*     */ import java.io.File;
/*     */ import java.nio.ByteBuffer;
/*     */ import java.nio.IntBuffer;
/*     */ import java.security.AccessController;
/*     */ import java.security.PrivilegedAction;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ final class WinApplication
/*     */   extends Application
/*     */   implements InvokeLaterDispatcher.InvokeLaterSubmitter
/*     */ {
/*     */   static float overrideUIScale;
/*     */   static float overrideRenderScale;
/*     */   static float minDPIScale;
/*     */   static boolean forceIntegerRenderScale;
/*     */   private final InvokeLaterDispatcher invokeLaterDispatcher;
/*     */   private static boolean verbose;
/*     */   private static final int Process_DPI_Unaware = 0;
/*     */   private static final int Process_System_DPI_Aware = 1;
/*     */   private static final int Process_Per_Monitor_DPI_Aware = 2;
/*     */   
/*     */   private static boolean getBoolean(String paramString1, boolean paramBoolean, String paramString2) {
/*  48 */     String str = System.getProperty(paramString1);
/*  49 */     if (str == null) {
/*  50 */       str = System.getenv(paramString1);
/*     */     }
/*  52 */     if (str == null) {
/*  53 */       return paramBoolean;
/*     */     }
/*  55 */     Boolean bool = Boolean.valueOf(Boolean.parseBoolean(str));
/*  56 */     if (PrismSettings.verbose) {
/*  57 */       System.out.println((bool.booleanValue() ? "" : "not ") + paramString2);
/*     */     }
/*  59 */     return bool.booleanValue();
/*     */   }
/*     */   private static float getFloat(String paramString1, float paramFloat, String paramString2) {
/*     */     float f;
/*  63 */     String str = System.getProperty(paramString1);
/*  64 */     if (str == null) {
/*  65 */       str = System.getenv(paramString1);
/*     */     }
/*  67 */     if (str == null) {
/*  68 */       return paramFloat;
/*     */     }
/*  70 */     str = str.trim();
/*     */     
/*  72 */     if (str.endsWith("%")) {
/*  73 */       f = Integer.parseInt(str.substring(0, str.length() - 1)) / 100.0F;
/*  74 */     } else if (str.endsWith("DPI") || str.endsWith("dpi")) {
/*  75 */       f = Integer.parseInt(str.substring(0, str.length() - 3)) / 96.0F;
/*     */     } else {
/*  77 */       f = Float.parseFloat(str);
/*     */     } 
/*  79 */     if (PrismSettings.verbose) {
/*  80 */       System.out.println(paramString2 + f);
/*     */     }
/*  82 */     return f;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   static {
/*  91 */     AccessController.doPrivileged(new PrivilegedAction<Void>() {
/*     */           public Void run() {
/*  93 */             WinApplication.verbose = Boolean.getBoolean("javafx.verbose");
/*  94 */             if (PrismSettings.allowHiDPIScaling) {
/*  95 */               WinApplication.overrideUIScale = WinApplication.getFloat("glass.win.uiScale", -1.0F, "Forcing UI scaling factor: ");
/*  96 */               WinApplication.overrideRenderScale = WinApplication.getFloat("glass.win.renderScale", -1.0F, "Forcing Rendering scaling factor: ");
/*  97 */               WinApplication.minDPIScale = WinApplication.getFloat("glass.win.minHiDPI", 1.5F, "Threshold to enable UI scaling factor: ");
/*  98 */               WinApplication.forceIntegerRenderScale = WinApplication.getBoolean("glass.win.forceIntegerRenderScale", true, "forcing integer rendering scale");
/*     */             } else {
/* 100 */               WinApplication.overrideUIScale = WinApplication.overrideRenderScale = 1.0F;
/* 101 */               WinApplication.minDPIScale = Float.MAX_VALUE;
/* 102 */               WinApplication.forceIntegerRenderScale = false;
/*     */             } 
/* 104 */             Toolkit.loadMSWindowsLibraries();
/* 105 */             WinApplication.loadNativeLibrary();
/* 106 */             return null;
/*     */           }
/*     */         });
/* 109 */     initIDs(overrideUIScale, overrideRenderScale, minDPIScale, forceIntegerRenderScale);
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   WinApplication() {
/* 116 */     boolean bool = ((Boolean)AccessController.<Boolean>doPrivileged(() -> Boolean.valueOf(Boolean.getBoolean("javafx.embed.isEventThread")))).booleanValue();
/* 117 */     if (!bool) {
/* 118 */       this.invokeLaterDispatcher = new InvokeLaterDispatcher(this);
/* 119 */       this.invokeLaterDispatcher.start();
/*     */     } else {
/* 121 */       this.invokeLaterDispatcher = null;
/*     */     } 
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private static int getDesiredAwarenesslevel() {
/* 138 */     if (!PrismSettings.allowHiDPIScaling) {
/* 139 */       return 0;
/*     */     }
/*     */     
/* 142 */     String str = AccessController.<String>doPrivileged(() -> System.getProperty("javafx.glass.winDPIawareness"));
/*     */     
/* 144 */     if (str != null) {
/* 145 */       str = str.toLowerCase();
/* 146 */       if (str.equals("aware"))
/* 147 */         return 1; 
/* 148 */       if (str.equals("permonitor")) {
/* 149 */         return 2;
/*     */       }
/* 151 */       if (!str.equals("unaware")) {
/* 152 */         System.err.println("unrecognized DPI awareness request, defaulting to unaware: " + str);
/*     */       }
/* 154 */       return 0;
/*     */     } 
/*     */     
/* 157 */     return 2;
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   protected void runLoop(Runnable paramRunnable) {
/* 163 */     boolean bool = ((Boolean)AccessController.<Boolean>doPrivileged(() -> Boolean.valueOf(Boolean.getBoolean("javafx.embed.isEventThread")))).booleanValue();
/* 164 */     int i = getDesiredAwarenesslevel();
/*     */     
/* 166 */     ClassLoader classLoader = WinApplication.class.getClassLoader();
/* 167 */     _setClassLoader(classLoader);
/*     */     
/* 169 */     if (bool) {
/* 170 */       _init(i);
/* 171 */       setEventThread(Thread.currentThread());
/* 172 */       paramRunnable.run();
/*     */ 
/*     */       
/*     */       return;
/*     */     } 
/*     */     
/* 178 */     long l = ((Long)AccessController.<Long>doPrivileged(() -> Long.getLong("glass.win.stackSize", PlatformUtil.isWindows32Bit() ? 1048576L : 0L))).longValue();
/*     */ 
/*     */ 
/*     */     
/* 182 */     Thread thread = AccessController.<Thread>doPrivileged(() -> new Thread(null, (), "WindowsNativeRunloopThread", paramLong));
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */     
/* 190 */     setEventThread(thread);
/* 191 */     thread.start();
/*     */   }
/*     */   
/*     */   protected void finishTerminating() {
/* 195 */     Thread thread = getEventThread();
/* 196 */     if (thread != null) {
/* 197 */       _terminateLoop();
/* 198 */       setEventThread(null);
/*     */     } 
/* 200 */     super.finishTerminating();
/*     */   }
/*     */   
/*     */   public boolean shouldUpdateWindow() {
/* 204 */     return true;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   protected Object _enterNestedEventLoop() {
/* 211 */     if (this.invokeLaterDispatcher != null) {
/* 212 */       this.invokeLaterDispatcher.notifyEnteringNestedEventLoop();
/*     */     }
/*     */     try {
/* 215 */       return _enterNestedEventLoopImpl();
/*     */     } finally {
/* 217 */       if (this.invokeLaterDispatcher != null) {
/* 218 */         this.invokeLaterDispatcher.notifyLeftNestedEventLoop();
/*     */       }
/*     */     } 
/*     */   }
/*     */   
/*     */   protected void _leaveNestedEventLoop(Object paramObject) {
/* 224 */     if (this.invokeLaterDispatcher != null) {
/* 225 */       this.invokeLaterDispatcher.notifyLeavingNestedEventLoop();
/*     */     }
/* 227 */     _leaveNestedEventLoopImpl(paramObject);
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public Window createWindow(Window paramWindow, Screen paramScreen, int paramInt) {
/* 233 */     return new WinWindow(paramWindow, paramScreen, paramInt);
/*     */   }
/*     */   
/*     */   public Window createWindow(long paramLong) {
/* 237 */     return new WinChildWindow(paramLong);
/*     */   }
/*     */   
/*     */   public View createView() {
/* 241 */     return new WinView();
/*     */   }
/*     */   
/*     */   public Cursor createCursor(int paramInt) {
/* 245 */     return new WinCursor(paramInt);
/*     */   }
/*     */   
/*     */   public Cursor createCursor(int paramInt1, int paramInt2, Pixels paramPixels) {
/* 249 */     return new WinCursor(paramInt1, paramInt2, paramPixels);
/*     */   }
/*     */   
/*     */   protected void staticCursor_setVisible(boolean paramBoolean) {
/* 253 */     WinCursor.setVisible_impl(paramBoolean);
/*     */   }
/*     */   
/*     */   protected Size staticCursor_getBestSize(int paramInt1, int paramInt2) {
/* 257 */     return WinCursor.getBestSize_impl(paramInt1, paramInt2);
/*     */   }
/*     */   
/*     */   public Pixels createPixels(int paramInt1, int paramInt2, ByteBuffer paramByteBuffer) {
/* 261 */     return new WinPixels(paramInt1, paramInt2, paramByteBuffer);
/*     */   }
/*     */   
/*     */   public Pixels createPixels(int paramInt1, int paramInt2, IntBuffer paramIntBuffer) {
/* 265 */     return new WinPixels(paramInt1, paramInt2, paramIntBuffer);
/*     */   }
/*     */ 
/*     */   
/*     */   public Pixels createPixels(int paramInt1, int paramInt2, IntBuffer paramIntBuffer, float paramFloat) {
/* 270 */     return new WinPixels(paramInt1, paramInt2, paramIntBuffer, paramFloat);
/*     */   }
/*     */   
/*     */   protected int staticPixels_getNativeFormat() {
/* 274 */     return WinPixels.getNativeFormat_impl();
/*     */   }
/*     */   
/*     */   public Robot createRobot() {
/* 278 */     return new WinRobot();
/*     */   }
/*     */   
/*     */   protected double staticScreen_getVideoRefreshPeriod() {
/* 282 */     return 0.0D;
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public Timer createTimer(Runnable paramRunnable) {
/* 288 */     return new WinTimer(paramRunnable);
/*     */   }
/*     */   
/*     */   protected int staticTimer_getMinPeriod() {
/* 292 */     return WinTimer.getMinPeriod_impl();
/*     */   }
/*     */   
/*     */   protected int staticTimer_getMaxPeriod() {
/* 296 */     return WinTimer.getMaxPeriod_impl();
/*     */   }
/*     */   
/*     */   public Accessible createAccessible() {
/* 300 */     return new WinAccessible();
/*     */   }
/*     */ 
/*     */   
/*     */   protected CommonDialogs.FileChooserResult staticCommonDialogs_showFileChooser(Window paramWindow, String paramString1, String paramString2, String paramString3, int paramInt1, boolean paramBoolean, CommonDialogs.ExtensionFilter[] paramArrayOfExtensionFilter, int paramInt2) {
/* 305 */     if (this.invokeLaterDispatcher != null) {
/* 306 */       this.invokeLaterDispatcher.notifyEnteringNestedEventLoop();
/*     */     }
/* 308 */     return WinCommonDialogs.showFileChooser_impl(paramWindow, paramString1, paramString2, paramString3, paramInt1, paramBoolean, paramArrayOfExtensionFilter, paramInt2);
/*     */   }
/*     */   
/*     */   protected File staticCommonDialogs_showFolderChooser(Window paramWindow, String paramString1, String paramString2) {
/* 312 */     if (this.invokeLaterDispatcher != null) {
/* 313 */       this.invokeLaterDispatcher.notifyEnteringNestedEventLoop();
/*     */     }
/* 315 */     return WinCommonDialogs.showFolderChooser_impl(paramWindow, paramString1, paramString2);
/*     */   }
/*     */   
/*     */   protected long staticView_getMultiClickTime() {
/* 319 */     return WinView.getMultiClickTime_impl();
/*     */   }
/*     */   
/*     */   protected int staticView_getMultiClickMaxX() {
/* 323 */     return WinView.getMultiClickMaxX_impl();
/*     */   }
/*     */   
/*     */   protected int staticView_getMultiClickMaxY() {
/* 327 */     return WinView.getMultiClickMaxY_impl();
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public void submitForLaterInvocation(Runnable paramRunnable) {
/* 335 */     _submitForLaterInvocation(paramRunnable);
/*     */   }
/*     */   
/*     */   protected void _invokeLater(Runnable paramRunnable) {
/* 339 */     if (this.invokeLaterDispatcher != null) {
/* 340 */       this.invokeLaterDispatcher.invokeLater(paramRunnable);
/*     */     } else {
/* 342 */       submitForLaterInvocation(paramRunnable);
/*     */     } 
/*     */   }
/*     */ 
/*     */   
/*     */   public String getHighContrastTheme() {
/* 348 */     checkEventThread();
/* 349 */     return _getHighContrastTheme();
/*     */   }
/*     */ 
/*     */   
/*     */   protected boolean _supportsInputMethods() {
/* 354 */     return true;
/*     */   }
/*     */ 
/*     */   
/*     */   protected boolean _supportsTransparentWindows() {
/* 359 */     return true;
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public String getDataDirectory() {
/* 365 */     checkEventThread();
/* 366 */     String str = AccessController.<String>doPrivileged(() -> System.getenv("APPDATA"));
/* 367 */     if (str == null || str.length() == 0) {
/* 368 */       return super.getDataDirectory();
/*     */     }
/* 370 */     return str + File.separator + this.name + File.separator;
/*     */   }
/*     */   
/*     */   private static native void initIDs(float paramFloat1, float paramFloat2, float paramFloat3, boolean paramBoolean);
/*     */   
/*     */   private native long _init(int paramInt);
/*     */   
/*     */   private native void _setClassLoader(ClassLoader paramClassLoader);
/*     */   
/*     */   private native void _runLoop(Runnable paramRunnable);
/*     */   
/*     */   private native void _terminateLoop();
/*     */   
/*     */   private native Object _enterNestedEventLoopImpl();
/*     */   
/*     */   private native void _leaveNestedEventLoopImpl(Object paramObject);
/*     */   
/*     */   protected native Screen[] staticScreen_getScreens();
/*     */   
/*     */   protected native void _invokeAndWait(Runnable paramRunnable);
/*     */   
/*     */   private native void _submitForLaterInvocation(Runnable paramRunnable);
/*     */   
/*     */   private native String _getHighContrastTheme();
/*     */   
/*     */   protected native boolean _supportsUnifiedWindows();
/*     */   
/*     */   protected native int _getKeyCodeForChar(char paramChar);
/*     */ }
как исправить ошибки в  182 строке, 178, 163, 142, 116 и 366 строке