Java Code Examples for processing.core.PConstants#MACOSX

The following examples show how to use processing.core.PConstants#MACOSX . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SketchRunner.java    From Processing.R with GNU General Public License v3.0 6 votes vote down vote up
public SketchRunner(final String id, final ModeService modeService) {
  this.id = id;
  this.modeService = modeService;
  if (PApplet.platform == PConstants.MACOSX) {
    try {
      OSXAdapter.setQuitHandler(this, this.getClass().getMethod("preventUserQuit"));
    } catch (final Throwable e) {
      System.err.println(e.getMessage());
    }
  }
  // new Thread(new Runnable() {
  // @Override
  // public void run() {
  // Runner.warmup();
  // }
  // }, "SketchRunner Warmup Thread").start();
}
 
Example 2
Source File: RLangPApplet.java    From Processing.R with GNU General Public License v3.0 4 votes vote down vote up
public void runBlock(final String[] arguments) throws RSketchError {
  log("runBlock");
  PApplet.runSketch(arguments, this);
  try {
    finishedLatch.await();
    log("RunSketch done.");
  } catch (final InterruptedException interrupted) {
    // Treat an interruption as a request to the applet to terminate.
    exit();
    try {
      finishedLatch.await();
      log("RunSketch interrupted.");
    } catch (final InterruptedException exception) {
      log(exception.toString());
    }
  } finally {
    Thread.setDefaultUncaughtExceptionHandler(null);
    if (PApplet.platform == PConstants.MACOSX
        && Arrays.asList(arguments).contains("fullScreen")) {
      // Frame should be OS-X fullscreen, and it won't stop being that unless the jvm
      // exits or we explicitly tell it to minimize.
      // (If it's disposed, it'll leave a gray blank window behind it.)
      log("Disabling fullscreen.");
      macosxFullScreenToggle(frame);
    }
    if (surface instanceof PSurfaceFX) {
      // Sadly, JavaFX is an abomination, and there's no way to run an FX sketch more than once,
      // so we must actually exit.
      log("JavaFX requires SketchRunner to terminate. Farewell!");
      System.exit(0);
    }
    final Object nativeWindow = surface.getNative();
    if (nativeWindow instanceof com.jogamp.newt.Window) {
      ((com.jogamp.newt.Window) nativeWindow).destroy();
    } else {
      surface.setVisible(false);
    }
  }
  // log(terminalException.toString());
  if (terminalException != null) {
    log("Throw the exception to PDE.");
    throw terminalException;
  }
}