mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
move runSketch() init code into ShimAWT
This commit is contained in:
@@ -3,6 +3,8 @@ package processing.awt;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.FileDialog;
|
||||
import java.awt.Frame;
|
||||
import java.awt.HeadlessException;
|
||||
import java.awt.Toolkit;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
@@ -31,6 +33,26 @@ public class ShimAWT {
|
||||
*/
|
||||
|
||||
|
||||
static public void initRun() {
|
||||
// Supposed to help with flicker, but no effect on OS X.
|
||||
// TODO IIRC this helped on Windows, but need to double check.
|
||||
System.setProperty("sun.awt.noerasebackground", "true");
|
||||
|
||||
// Remove 60fps limit on the JavaFX "pulse" timer
|
||||
System.setProperty("javafx.animation.fullspeed", "true");
|
||||
|
||||
// Catch any HeadlessException to provide more useful feedback
|
||||
try {
|
||||
// Call validate() while resize events are in progress
|
||||
Toolkit.getDefaultToolkit().setDynamicLayout(true);
|
||||
} catch (HeadlessException e) {
|
||||
System.err.println("Cannot run sketch without a display. Read this for possible solutions:");
|
||||
System.err.println("https://github.com/processing/processing/wiki/Running-without-a-Display");
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public int displayDensity() {
|
||||
if (sketch.display != PConstants.SPAN && (sketch.fullScreen || sketch.present)) {
|
||||
|
||||
@@ -35,10 +35,6 @@ import java.awt.GraphicsDevice;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.geom.AffineTransform;
|
||||
|
||||
// inside runSketch() to warn users about headless
|
||||
import java.awt.HeadlessException;
|
||||
import java.awt.Toolkit;
|
||||
|
||||
// used by loadImage()
|
||||
import java.awt.Image;
|
||||
import java.awt.color.ColorSpace;
|
||||
@@ -72,6 +68,9 @@ import java.util.concurrent.ThreadFactory;
|
||||
import java.util.regex.*;
|
||||
import java.util.zip.*;
|
||||
|
||||
// TODO have this removed by 4.0 final
|
||||
import processing.awt.ShimAWT;
|
||||
|
||||
import processing.data.*;
|
||||
import processing.event.*;
|
||||
import processing.opengl.*;
|
||||
@@ -10618,22 +10617,7 @@ public class PApplet implements PConstants {
|
||||
}
|
||||
|
||||
if (!disableAWT) {
|
||||
// Supposed to help with flicker, but no effect on OS X.
|
||||
// TODO IIRC this helped on Windows, but need to double check.
|
||||
System.setProperty("sun.awt.noerasebackground", "true");
|
||||
|
||||
// Remove 60fps limit on the JavaFX "pulse" timer
|
||||
System.setProperty("javafx.animation.fullspeed", "true");
|
||||
|
||||
// Catch any HeadlessException to provide more useful feedback
|
||||
try {
|
||||
// Call validate() while resize events are in progress
|
||||
Toolkit.getDefaultToolkit().setDynamicLayout(true);
|
||||
} catch (HeadlessException e) {
|
||||
System.err.println("Cannot run sketch without a display. Read this for possible solutions:");
|
||||
System.err.println("https://github.com/processing/processing/wiki/Running-without-a-Display");
|
||||
System.exit(1);
|
||||
}
|
||||
ShimAWT.initRun();
|
||||
}
|
||||
|
||||
final PApplet sketch;
|
||||
|
||||
Reference in New Issue
Block a user