SWT GLCanvas: Fix dispose bug, check for isDisposed() and add DisposeListener; Run GL tasks on current thread w/o restrictions
Fix dispose bug, check for isDisposed() and add DisposeListener - Don't issue SWTAccessor.setRealized(..), since it's called implicit via super.dispose() - Check isDisposed() .. - add DisposeListener to act on parent's disposal (Shell, Composition, ..)
Run GL tasks on current thread w/o restrictions + * The current thread seems to be valid for all platforms, + * since no SWT lifecycle tasks are being performed w/ this call. + * Only GL task, which are independent from the SWT threading model.
The unit test shows, that while using JOGL's SWT GLCanvas Display's asyncExec(..) works properly, but w/ NewtCanvasSWT on Windows does not.
NewtCanvasSWT differs w/: - Using native parenting [Newt GLWindow to SWT Canvas] - Processing native events in own NEWT EDT, w/ own Windows dispatch hook [For the child GLWindow only]
NEWT WindowImpl: Don't issue native resize if invisible, simply use defineSize(..); Don't set persitent undecorated flag if child window at creation; Use local 'screen' directly.
- Don't issue native resize if invisible, simply use defineSize(..) Invisible windows may not promote size change natively, hence simply setting the size via defineSize(..) is appropriate. Latter setVisible(true) will take size into account.
- Don't set persitent undecorated flag if child window at creation Even if a window is a child at creation, it maybe reparented to top-level where the default behavior is to be expected. Undecorated top-level window shall require explicit setUndecorated(true).
- Use local 'screen' directly. No need to make code more complicate ..
- surfaceLockCount-- if native lock fails In case native lock fails, not only remove the windowLock but also decr. surfaceLockCount (proper roll back) - was a BUG!
- waitForVisible(.., fastFail:=false) Don't fail fast if visibility wasn't reached.
- waitForSize(..) @ setSize Wait for size change - otherwise an SWT child won't reach desired size.
- reparent definePosition(..); Position might not get updated by WM events (SWT parent apparently)
Fix Bug 643: SWT 'display.asyncExec(Runnable runnable)' runnable not executed on Windows
Turns out that the NEWT Windows impl. didn't properly validated the client region @ WM_PAINT and hence 'exhausted' the message pipeline, i.e. never reached an IDLE state.
The latter caused SWT to never reach a point where deferred asyncExec(..) Runnables got processed.
Besides this SWT effect, this also caused a NEWT window on Windows to always repaint itself (?).
SWT GLCanvas/NewtCanvasSWT: Check isVisible() @ validation; NewtCanvasSWT remove just introduced setVisible(false) and adapt to setEDTUtil() changes. ; Enhance Bug 643 unit test: Also test NEWT EDT and pre-visible GLWindow.