formatting cleanups and notes

This commit is contained in:
Ben Fry
2019-10-08 15:34:55 -04:00
parent 359012338b
commit 2a8ed1ee8a

View File

@@ -22,11 +22,13 @@
package processing.core;
import java.awt.*;
import java.awt.Desktop;
import java.awt.Image;
import java.awt.Taskbar;
/**
* Deal with issues related to Mac OS window behavior.
* Deal with issues related to macOS application behavior.
*
* We have to register a quit handler to safely shut down the sketch,
* otherwise OS X will just kill the sketch when a user hits Cmd-Q.
@@ -37,15 +39,15 @@ import java.awt.*;
* <a href="https://github.com/processing/processing/issues/3301">3301</a>.
*/
public class ThinkDifferent {
private static Desktop desktop;
private static Taskbar taskbar;
static private Desktop desktop;
static private Taskbar taskbar;
// True if user has tried to quit once. Prevents us from canceling the quit
// call if the sketch is held up for some reason, like an exception that's
// managed to put the sketch in a bad state.
static boolean attemptedQuit;
/**
* Initialize the sketch with the quit handler.
*
@@ -70,6 +72,7 @@ public class ThinkDifferent {
});
}
/**
* Remove the quit handler.
*/
@@ -77,44 +80,36 @@ public class ThinkDifferent {
getDesktop().setQuitHandler(null);
}
/**
* Called via reflection from PSurfaceAWT and others, set the dock icon image.
*
* @param image The image to provide for Processing icon.
*/
static public void setIconImage(Image image) {
getTaskbar().setIconImage(image);
}
/**
* Get the taskbar where OS visual settings can be provided.
*
* @return Cached taskbar singleton instance.
*/
static private Taskbar getTaskbar() {
if (taskbar == null) {
taskbar = Taskbar.getTaskbar();
}
return taskbar;
}
/**
* Get the desktop where OS behavior can be provided.
*
* @return Cached desktop singleton instance.
*/
static private Desktop getDesktop() {
if (desktop == null) {
desktop = Desktop.getDesktop();
}
return desktop;
}
// Instead, just use Application.getApplication() inside your app
// static public Application getApplication() {
// return desktop;
// }
}