Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » ViewPart gets screwy on closing
ViewPart gets screwy on closing [message #652380] Thu, 03 February 2011 12:12 Go to next message
Carlo Salinari is currently offline Carlo Salinari
Messages: 66
Registered: October 2010
Member
Hi,

I have a basic rcp application showing a ViewPart.
The ViewPart contains a GLCanvas displaying a rotating cube.

If I resize the app window and then close it, I get an ugly effect
showing swt controls artifacts (similar to what you would see by setting
the SWT.NO_REDRAW_RESIZE flag, but this is not the case).

Please see this image:
http://goo.gl/84xND

and this gif animation:
http://goo.gl/jMjlZ

to get an idea.

This only happens on closing time IFF the window has been resized.
Otherwise the window closes correctly (i.e. without showing artifacts).

The same GLCanvas app closes correctly under bare SWT.
The canvas and the parent composite have SWT.NO_BACKGROUND set.

Do you know what could be causing this effect and how I could get rid of it?

Regards,
Carlo
Re: ViewPart gets screwy on closing [message #652416 is a reply to message #652380] Thu, 03 February 2011 13:58 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 02/03/2011 12:12 PM, Carlo Salinari wrote:
> If I resize the app window and then close it, I get an ugly effect
> showing swt controls artifacts (similar to what you would see by setting
> the SWT.NO_REDRAW_RESIZE flag, but this is not the case).

Are you unhooking/disposing the GLCanvas in the ViewPart dispose()? Or
in a dispose listener off of an SWT composite you've created?

> Do you know what could be causing this effect and how I could get rid of it?

I would guess it's the underlying SWT composite not being re-painted (as
the GLCanvas was on top).

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: ViewPart gets screwy on closing [message #652568 is a reply to message #652416] Fri, 04 February 2011 09:48 Go to previous messageGo to next message
Carlo Salinari is currently offline Carlo Salinari
Messages: 66
Registered: October 2010
Member
On 2/3/2011 7:58 PM, Paul Webster wrote:
> On 02/03/2011 12:12 PM, Carlo Salinari wrote:
>> If I resize the app window and then close it, I get an ugly effect
>> showing swt controls artifacts (similar to what you would see by setting
>> the SWT.NO_REDRAW_RESIZE flag, but this is not the case).
>
> Are you unhooking/disposing the GLCanvas in the ViewPart dispose()? Or
> in a dispose listener off of an SWT composite you've created?

No, I'm not doing anything in Viewpart.dispose().

The GLCanvas constructor registers a listener to the SWT.Dispose event.
This is the relevant code from org.eclipse.swt.opengl.GLCanvas:

Listener listener = new Listener () {
public void handleEvent (Event event) {
switch (event.type) {
case SWT.Dispose:
WGL.wglDeleteContext (context);
break;
}
}
};
addListener (SWT.Dispose, listener);

How could this be related to my issue?

>> Do you know what could be causing this effect and how I could get rid of it?
>
> I would guess it's the underlying SWT composite not being re-painted (as
> the GLCanvas was on top).

Yes, you are right, and that is intentional. I have to set the
SWT.NO_BACKGROUND flag otherwise the Canvas underlying the GLCanvas
would try to repaint its background when resizing the window, causing an
atrocious flickering effect.

Maybe I should to repaint the
ViewPart's client area in black just before the GLCanvas gets closed, so
to clear the cluttered background. But I don't know how to do that.

Btw, I now realize this is more an swt issue that an rcp one, so excuse
me for the off-topic. So, if I'm not getting an answer here, I'm moving
the thread on e.swt.

Thanks for your reply, Paul.
Re: ViewPart gets screwy on closing [message #652577 is a reply to message #652568] Fri, 04 February 2011 10:07 Go to previous messageGo to next message
Carlo Salinari is currently offline Carlo Salinari
Messages: 66
Registered: October 2010
Member
On 2/4/2011 3:48 PM, Carlo Salinari wrote:
> Btw, I now realize this is more an swt issue that an rcp one, so excuse
> me for the off-topic. So, if I'm not getting an answer here, I'm moving
> the thread on e.swt.

Well, I have to contradict myself.

I verified that the same example works perfectly under swt.
So this does look like an rcp issue.

Please see:
http://goo.gl/4ZSWG

You can see all the samples here:
https://sites.google.com/site/carlosalinari/pageone

(click on the gifs to watch the animations).

Any idea?
Re: ViewPart gets screwy on closing [message #652592 is a reply to message #652577] Fri, 04 February 2011 11:07 Go to previous messageGo to next message
Carlo Salinari is currently offline Carlo Salinari
Messages: 66
Registered: October 2010
Member
On 2/4/2011 4:07 PM, Carlo Salinari wrote:
> On 2/4/2011 3:48 PM, Carlo Salinari wrote:
>> Btw, I now realize this is more an swt issue that an rcp one, so excuse
>> me for the off-topic. So, if I'm not getting an answer here, I'm moving
>> the thread on e.swt.
>
> Well, I have to contradict myself.
>
> I verified that the same example works perfectly under swt.
> So this does look like an rcp issue.
>
> Please see:
> http://goo.gl/4ZSWG
>
> You can see all the samples here:
> https://sites.google.com/site/carlosalinari/pageone
>
> (click on the gifs to watch the animations).
>
> Any idea?

Another update: the problem doesn't show under linux.
Maybe I should prepare a basic test case and file a bug report.
Re: ViewPart gets screwy on closing [message #652870 is a reply to message #652568] Mon, 07 February 2011 07:38 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 02/04/2011 09:48 AM, Carlo Salinari wrote:
> No, I'm not doing anything in Viewpart.dispose().
>
> The GLCanvas constructor registers a listener to the SWT.Dispose event.
> This is the relevant code from org.eclipse.swt.opengl.GLCanvas:
>
> Listener listener = new Listener () {
> public void handleEvent (Event event) {
> switch (event.type) {
> case SWT.Dispose:
> WGL.wglDeleteContext (context);
> break;
> }
> }
> };
> addListener (SWT.Dispose, listener);
>
> How could this be related to my issue?

Just covering the cleanup base: Your pattern is fine, most people
either consume the SWT.Dispose event for their composite or the
viewPart.dispose().

>
> Btw, I now realize this is more an swt issue that an rcp one, so excuse
> me for the off-topic. So, if I'm not getting an answer here, I'm moving
> the thread on e.swt.

That's acceptable as well :-)

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: ViewPart gets screwy on closing [message #652871 is a reply to message #652592] Mon, 07 February 2011 07:39 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 02/04/2011 11:07 AM, Carlo Salinari wrote:
>
> Another update: the problem doesn't show under linux.
> Maybe I should prepare a basic test case and file a bug report.

Yes please, you can try http://bugs.eclipse.org/bugs/ Eclipse Platform

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:Help : RCP Preference page
Next Topic:DS service injection & multiple applications & headless
Goto Forum:
  


Current Time: Thu Jul 31 09:30:39 EDT 2014

Powered by FUDForum. Page generated in 0.02321 seconds