From e7de442cdba477eb903d495f2b91edb8d4a00b89 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Thu, 3 Dec 2020 09:33:55 -0800 Subject: [PATCH] Address review comments --- .../java/com/sun/glass/ui/mac/MacApplication.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java b/modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java index 1f403222ed6..c58c901efb9 100644 --- a/modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java +++ b/modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java @@ -28,6 +28,7 @@ import com.sun.glass.ui.*; import com.sun.glass.ui.CommonDialogs.ExtensionFilter; import com.sun.glass.ui.CommonDialogs.FileChooserResult; +import com.sun.javafx.util.Logging; import java.io.File; import java.nio.ByteBuffer; @@ -36,6 +37,7 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; final class MacApplication extends Application implements InvokeLaterDispatcher.InvokeLaterSubmitter { @@ -103,9 +105,11 @@ void waitForReactivation() { final EventLoop eventLoop = createEventLoop(); Thread thr = new Thread(() -> { try { - reactivationLatch.await(); + if (!reactivationLatch.await(5, TimeUnit.SECONDS)) { + Logging.getJavaFXLogger().warning("Timeout while waiting for app reactivation"); + } } catch (InterruptedException ex) { - ex.printStackTrace(); + Logging.getJavaFXLogger().warning("Exception while waiting for app reactivation: " + ex); } Application.invokeLater(() -> { eventLoop.leave(null); @@ -133,16 +137,16 @@ private void notifyApplicationDidTerminate() { @Override protected void notifyDidResignActive() { - super.notifyDidResignActive(); firstDidResignActive = true; + super.notifyDidResignActive(); } @Override protected void notifyDidBecomeActive() { - super.notifyDidBecomeActive(); if (firstDidResignActive) { reactivationLatch.countDown(); } + super.notifyDidBecomeActive(); } // Called from the native code @@ -363,6 +367,8 @@ protected boolean _supportsTransparentWindows() { @Override native protected boolean _supportsSystemMenu(); + // NOTE: this will not return a valid result unil the native _runloop + // method has been executed and called the Runnable passed to that method. native private boolean _isNormalTaskbarApp(); boolean isNormalTaskbarApp() { return _isNormalTaskbarApp();