Bug 985 - NewtCanvasSWT disappears after detaching editor from the main EclipseRCP app window in OSX
Summary: NewtCanvasSWT disappears after detaching editor from the main EclipseRCP app ...
Status: RESOLVED FIXED
Alias: None
Product: Newt
Classification: JogAmp
Component: swt (show other bugs)
Version: 2
Hardware: pc_x86_64 macosx
: --- normal
Assignee: Petros Koutsolampros
URL:
Depends on:
Blocks: 969
  Show dependency treegraph
 
Reported: 2014-02-25 14:53 CET by Petros Koutsolampros
Modified: 2019-03-30 02:57 CET (History)
2 users (show)

See Also:
Type: DEFECT
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petros Koutsolampros 2014-02-25 14:53:24 CET
To replicate use same test case as Bug 956

When the editor is detached, the newt window is thrown behind the eclipseRCP editor, standing on its own in the desktop. If the editor is docked back again in the main window, the newt window returns to proper position and behaviour.

Native window handle remains the same:

20140210 12:51:04 <sgothel> SWTAccessor.getWindowHandle(this) <- do validate ..
20140210 12:51:25 <sgothel> iff changes, we need a new SWTNativeWindow
20140210 12:51:36 <sgothel> (pull-in, i.e. becomes valid again)
20140210 12:51:36 <hija> ok hold on
20140210 12:54:45 <hija> native Handle 140509586886384
20140210 12:54:45 <hija> SWTAccessor 140509586886384

Proposed solution: 

( discussion http://jogamp.org/log/irc/jogamp_20140210050544.html#l15 )

When detaching or reattaching the editor from the main app, SWT calls Widget.reskin() on all the objects of the hierarchy, and thus on NewtCanvasSWT.

We can use this to trigger a reparenting of the newt-window:

newtChild.reparentWindow(null, -1, -1, 0 /* hints */);
newtChild.setVisible(false);
newtChild.reparentWindow(nativeWindow, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE);
newtChild.setVisible(true);
newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED);

Reparenting to null window is a workaround to force newtChild to see the change. Otherwise, the change is blocked later:


20140210 14:39:20 <hija> reparenting the window has a: if(newParentWindow != getParent()) {
20140210 14:40:55 <hija> in WindowImpl.java
20140210 14:41:17 <hija> line 1301
.
.
.
20140210 15:24:28 <sgothel> the reparent shall happen when you pull-out (w/ null parent) and then you push-in (w/ valid parent handle)
20140210 15:24:43 <sgothel> IMHO .. then you will have a proper behavior
20140210 15:25:02 <sgothel> i.e. both resulting in ReparentOperation.ACTION_NATIVE_REPARENTING
20140210 15:25:41 <sgothel> pull-out:
20140210 15:25:43 <sgothel> newtChild.setVisible(false);
20140210 15:25:43 <sgothel> newtChild.reparentWindow(null, -1, -1, 0 /* hints */);
20140210 15:25:48 <sgothel> push-in:
20140210 15:25:57 <sgothel> newtChild.reparentWindow(nativeWindow, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE);
20140210 15:25:57 <sgothel> newtChild.setVisible(true);
20140210 15:26:16 <sgothel> newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout to listener
20140210 15:26:51 <sgothel> w/ SWTNativeWindow nativeWindow

Proposed solution triggers the disappearance of the whole eclipseRCP window:

20140210 15:39:10 <hija> if you have setVisible(false);
20140210 15:39:19 <hija> dragging the view out to a standalone window hides all of eclipse
Comment 1 Sven Gothel 2019-03-30 02:57:36 CET
Fixed via bug 969 I assume. Otherwise we need to reopen it.