Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrushforth committed Dec 3, 2020
1 parent 3078e21 commit e7de442
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit e7de442

Please sign in to comment.