From 56502090ba5c2e0c266666a4ba3ddd501e9ad95f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 9 Oct 2013 02:10:19 +0200 Subject: NEWT Display: Issue EDTUtil.start() at runOnEDTIfAvail(..) even if on EDT, which is to be stopped. This case appears on e.g. OSX/CALayer (offscreen) reparenting using recreation (onscreen <-> offscreen), i.e. display destroy/create is performed on EDT. Misc Cleanup: - Rename EDTUtil: restart() -> start() - Rename Display: validateEDT() -> validateEDTStopped() - Simplify Display.setEDTUtil(..): Remove need for redundant 'newEDTUtil' local var. - Simplify Display.runOnEDTIfAvail(..): edtUtil is never null --- src/newt/classes/com/jogamp/newt/Display.java | 2 +- src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java | 2 +- src/newt/classes/com/jogamp/newt/util/EDTUtil.java | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/newt/classes/com') diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java index c618405c2..382a5d583 100644 --- a/src/newt/classes/com/jogamp/newt/Display.java +++ b/src/newt/classes/com/jogamp/newt/Display.java @@ -78,7 +78,7 @@ public abstract class Display { * Stop the running EDT in case this display is destroyed already.
* @return true if EDT has been stopped (destroyed but running), otherwise false. */ - public abstract boolean validateEDT(); + public abstract boolean validateEDTStopped(); /** * @return true if the native display handle is valid and ready to operate, diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java index 47dfca0f3..2fa83e0e2 100644 --- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java +++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java @@ -346,7 +346,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { { final Display newtDisplay = newtChild.getScreen().getDisplay(); final EDTUtil edtUtil = new SWTEDTUtil(newtDisplay, getDisplay()); - edtUtil.restart(); + edtUtil.start(); newtDisplay.setEDTUtil( edtUtil ); } diff --git a/src/newt/classes/com/jogamp/newt/util/EDTUtil.java b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java index e86df2084..52ca95682 100644 --- a/src/newt/classes/com/jogamp/newt/util/EDTUtil.java +++ b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java @@ -65,10 +65,10 @@ public interface EDTUtil { public void setPollPeriod(long ms); /** - * Starts or restarts the EDT. + * Starts the EDT after it's creation or after {@link #invokeStop(boolean, Runnable) stopping}. *

- * If the EDT is running, it must be stopped first via {@link #invokeStop(boolean, Runnable)} - * and the caller should wait until it's stopped via {@link #waitUntilStopped()}. + * If the EDT is running, it must be {@link #invokeStop(boolean, Runnable) stopped} first + * and the caller should wait {@link #waitUntilStopped() until it's stopped}. *

* * @return true if EDT has been successfully restarted, otherwise false @@ -77,7 +77,7 @@ public interface EDTUtil { * @see #invokeStop(boolean, java.lang.Runnable) * @see #waitUntilStopped() */ - public boolean restart() throws IllegalStateException; + public boolean start() throws IllegalStateException; /** * Returns true if the current thread is the event dispatch thread (EDT). @@ -130,7 +130,7 @@ public interface EDTUtil { *
  • All previous queued tasks will be finished.
  • *
  • No new tasks are allowed, an Exception is thrown.
  • *
  • Can be issued from within EDT, ie from within an enqueued task.
  • - *
  • {@link #restart()} may follow immediately, ie creating a new EDT
  • + *
  • {@link #start()} may follow immediately, ie creating a new EDT
  • * *

    * @return true if task has been executed or queued for later execution, otherwise false -- cgit v1.2.3