173 AWTAccessor.getToolkitAccessor().setPlatformResources(platformResources); 174 175 if (!GraphicsEnvironment.isHeadless()) { 176 initIDs(); 177 } 178 inAWT = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { 179 @Override 180 public Boolean run() { 181 return !Boolean.parseBoolean(System.getProperty("javafx.embed.singleThread", "false")); 182 } 183 }); 184 } 185 186 /* 187 * If true we operate in normal mode and nested runloop is executed in JavaRunLoopMode 188 * If false we operate in singleThreaded FX/AWT interop mode and nested loop uses NSDefaultRunLoopMode 189 */ 190 private static final boolean inAWT; 191 192 public LWCToolkit() { 193 areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true")); 194 //set system property if not yet assigned 195 System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled); 196 initAppkit(ThreadGroupUtils.getRootThreadGroup(), GraphicsEnvironment.isHeadless()); 197 } 198 199 /* 200 * System colors with default initial values, overwritten by toolkit if system values differ and are available. 201 */ 202 private static final int NUM_APPLE_COLORS = 3; 203 public static final int KEYBOARD_FOCUS_COLOR = 0; 204 public static final int INACTIVE_SELECTION_BACKGROUND_COLOR = 1; 205 public static final int INACTIVE_SELECTION_FOREGROUND_COLOR = 2; 206 private static int[] appleColors = { 207 0xFF808080, // keyboardFocusColor = Color.gray; 208 0xFFC0C0C0, // secondarySelectedControlColor 209 0xFF303030, // controlDarkShadowColor 210 }; 211 212 private native void loadNativeColors(final int[] systemColors, final int[] appleColors); 213 214 @Override 215 protected void loadSystemColors(final int[] systemColors) { 216 if (systemColors == null) return; | 173 AWTAccessor.getToolkitAccessor().setPlatformResources(platformResources); 174 175 if (!GraphicsEnvironment.isHeadless()) { 176 initIDs(); 177 } 178 inAWT = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { 179 @Override 180 public Boolean run() { 181 return !Boolean.parseBoolean(System.getProperty("javafx.embed.singleThread", "false")); 182 } 183 }); 184 } 185 186 /* 187 * If true we operate in normal mode and nested runloop is executed in JavaRunLoopMode 188 * If false we operate in singleThreaded FX/AWT interop mode and nested loop uses NSDefaultRunLoopMode 189 */ 190 private static final boolean inAWT; 191 192 public LWCToolkit() { 193 final String extraButtons = "sun.awt.enableExtraMouseButtons"; 194 AccessController.doPrivileged((PrivilegedAction<Void>) () -> { 195 areExtraMouseButtonsEnabled = 196 Boolean.parseBoolean(System.getProperty(extraButtons, "true")); 197 //set system property if not yet assigned 198 System.setProperty(extraButtons, ""+areExtraMouseButtonsEnabled); 199 initAppkit(ThreadGroupUtils.getRootThreadGroup(), 200 GraphicsEnvironment.isHeadless()); 201 return null; 202 }); 203 } 204 205 /* 206 * System colors with default initial values, overwritten by toolkit if system values differ and are available. 207 */ 208 private static final int NUM_APPLE_COLORS = 3; 209 public static final int KEYBOARD_FOCUS_COLOR = 0; 210 public static final int INACTIVE_SELECTION_BACKGROUND_COLOR = 1; 211 public static final int INACTIVE_SELECTION_FOREGROUND_COLOR = 2; 212 private static int[] appleColors = { 213 0xFF808080, // keyboardFocusColor = Color.gray; 214 0xFFC0C0C0, // secondarySelectedControlColor 215 0xFF303030, // controlDarkShadowColor 216 }; 217 218 private native void loadNativeColors(final int[] systemColors, final int[] appleColors); 219 220 @Override 221 protected void loadSystemColors(final int[] systemColors) { 222 if (systemColors == null) return; |