SWT ScrolledComposite not working under Mac Mountain Lion

classic Classic list List threaded Threaded
10 messages Options
sam
Reply | Threaded
Open this post in threaded view
|

SWT ScrolledComposite not working under Mac Mountain Lion

sam
hey all,

I have an RCP eclipse application, where I wrap the GLCanvas (either using AWT-SWT bridge or com.jogamp.opengl.swt.GLCanvas) with a scrolled composite. The idea is that if the user shrinks the window the scrollbars should automatically appear and let you navigate within the canvas.

This works perfectly fine for Win7 64-Bit and Ubuntu 64-Bit but not under Mac Mountain Lion?

Under Mac I can move the scrollbars arbitrary but the canvas doesn't move with it.

tested with: 2.0-rc11

any ideas?
Reply | Threaded
Open this post in threaded view
|

Re: SWT ScrolledComposite not working under Mac Mountain Lion

gouessej
Administrator
Hi

I think that's a bug of SWT under Mac. Please try to do something similar with an AWT canvas just to confirm I'm right.
Julien Gouesse | Personal blog | Website
sam
Reply | Threaded
Open this post in threaded view
|

Re: SWT ScrolledComposite not working under Mac Mountain Lion

sam
I created a little test project(s) under:

ssh://git@bitbucket.org/sgratzl/jogltest.git

there are several eclipse projects in it:
 * jogl - libraries of 2.0-rc11
 * testjogl1 - scrolling using swing
 * testjogl2 - scrolling using swt (under mac change the swt library in build path)
 * testjogl3 -> for another thread of mine: http://forum.jogamp.org/NEWT-blocks-SWT-Thread-td4027270.html

btw the reshape problem is concerned in http://forum.jogamp.org/Reshape-Problem-using-swt-GLCanvas-td4027272.html

scrolling using swing works in win64 and mac
but swt only in win64
Reply | Threaded
Open this post in threaded view
|

Re: SWT ScrolledComposite not working under Mac Mountain Lion

gouessej
Administrator
The problem is that I have no Mac :s Do you reproduce your scrolling problem under Mac with this canvas or with org.eclipse.swt.widgets.Canvas? I try to know whether the problem comes from AWT (not Swing), SWT or NEWT.
Julien Gouesse | Personal blog | Website
sam
Reply | Threaded
Open this post in threaded view
|

Re: SWT ScrolledComposite not working under Mac Mountain Lion

sam
gouessej wrote
Do you reproduce your scrolling problem under Mac with this canvas or with org.eclipse.swt.widgets.Canvas? I try to know whether the problem comes from AWT (not Swing), SWT or NEWT.
it is somehow related, how JOGL gets the current window position of an SWT widget to render the GLCanvas.

relevant code piece
final Composite composite = new Composite( shell, SWT.NONE );
composite.setLayout( new FillLayout() );

ScrolledComposite scrolledComposite = new org.eclipse.swt.custom.ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scrolledComposite.setExpandVertical(true);
scrolledComposite.setExpandHorizontal(true);

GLProfile glprofile = GLProfile.getDefault();
GLCapabilities glcapabilities = new GLCapabilities(glprofile);
final GLCanvas glcanvas = new com.jogamp.opengl.swt.GLCanvas(scrolledComposite, SWT.NO_BACKGROUND, glcapabilities, null, null);

scrolledComposite.setContent(glcanvas);
glcanvas.setSize(800, 600);
scrolledComposite.setMinSize(800, 600);

glcanvas.addGLEventListener(new GLEventListener() {
	...
});

shell.setSize( 640, 480 );
shell.open();
...

I create a GLCanvas and wrap it with a SWT ScrolledComposite. Furthermore I set that the size of the GLCanvas is larger than the actual shell size, from which the scrolled composite creates scrollbars around the GLCanvas.

Under Windows if I now move the Scrollbars also the GLCanvas content / OpenGL surface moves anround. Under Mac the GLCanvas content / OpenGL surface doesn't change at all.

I hope that clarifies my problem.
Reply | Threaded
Open this post in threaded view
|

Re: SWT ScrolledComposite not working under Mac Mountain Lion

gouessej
Administrator
Yes it clarifies the problem but I would like to know what happens if you replace SWT GLCanvas by org.eclipse.swt.widgets.Canvas to be absolutely sure that the bug comes from the SWT GLCanvas and not from org.eclipse.swt.widgets.Canvas. com.jogamp.opengl.swt.GLCanvas extends org.eclipse.swt.widgets.Canvas, that's why I wonder whether the bug doesn't come from SWT.
Julien Gouesse | Personal blog | Website
sam
Reply | Threaded
Open this post in threaded view
|

Re: SWT ScrolledComposite not working under Mac Mountain Lion

sam
gouessej wrote
Yes it clarifies the problem but I would like to know what happens if you replace SWT GLCanvas by org.eclipse.swt.widgets.Canvas to be absolutely sure that the bug comes from the SWT GLCanvas and not from org.eclipse.swt.widgets.Canvas. com.jogamp.opengl.swt.GLCanvas extends org.eclipse.swt.widgets.Canvas, that's why I wonder whether the bug doesn't come from SWT.
ok

I tested to replace the glcanvas code from above with
Canvas canvas = new Canvas(scrolledComposite, SWT.None);
canvas.addPaintListener(new PaintListener() {
	@Override
	public void paintControl(PaintEvent arg0) {
		GC gc = arg0.gc;
		gc.setBackground(arg0.display.getSystemColor(SWT.COLOR_RED));
		gc.fillRectangle(100, 100, 50, 50);
	}
});

and it worked as expected.

So it has to do something with the way how JOGL determines the window position and size. As internally the ScrolledComposite calls the "setLocation" method of the Widget to move it around within the ScrolledComposite.
Reply | Threaded
Open this post in threaded view
|

Re: SWT ScrolledComposite not working under Mac Mountain Lion

Sven Gothel
Administrator
On 11/29/2012 02:14 PM, samg [via jogamp] wrote:

>     gouessej wrote
>     Yes it clarifies the problem but I would like to know what happens if you
>     replace SWT GLCanvas by org.eclipse.swt.widgets.Canvas to be absolutely
>     sure that the bug comes from the SWT GLCanvas and not from
>     org.eclipse.swt.widgets.Canvas. com.jogamp.opengl.swt.GLCanvas extends
>     org.eclipse.swt.widgets.Canvas, that's why I wonder whether the bug
>     doesn't come from SWT.
>
> ok
>
> I tested to replace the glcanvas code from above with
>
> Canvas canvas = new Canvas(scrolledComposite, SWT.None);
> canvas.addPaintListener(new PaintListener() {
> @Override
> public void paintControl(PaintEvent arg0) {
> GC gc = arg0.gc;
> gc.setBackground(arg0.display.getSystemColor(SWT.COLOR_RED));
> gc.fillRectangle(100, 100, 50, 50);
> }
> });
>
>
> and it worked as expected.
>
> So it has to do something with the way how JOGL determines the window position
> and size. As internally the ScrolledComposite calls the "setLocation" method
> of the Widget to move it around within the ScrolledComposite.
+++

Will you be so kind and create a bug report for this,
while adding all your information to it (as already discussed here)?
Pls also add the 2 _complete_ [unit] test cases, so I have a bit less work.

Will discuss it in bug report then, to avoid noise and to make discussion
persistent.

Thank you.




signature.asc (909 bytes) Download Attachment
sam
Reply | Threaded
Open this post in threaded view
|

Re: SWT ScrolledComposite not working under Mac Mountain Lion

sam
Sven Gothel wrote
Will you be so kind and create a bug report for this,
while adding all your information to it (as already discussed here)?
Pls also add the 2 _complete_ [unit] test cases, so I have a bit less work.

Will discuss it in bug report then, to avoid noise and to make discussion
persistent.
see https://jogamp.org/bugzilla/show_bug.cgi?id=647
Reply | Threaded
Open this post in threaded view
|

Re: SWT ScrolledComposite not working under Mac Mountain Lion

Sven Gothel
Administrator
On 12/01/2012 02:32 PM, samg [via jogamp] wrote:

>     Sven Gothel wrote
>     Will you be so kind and create a bug report for this,
>     while adding all your information to it (as already discussed here)?
>     Pls also add the 2 _complete_ [unit] test cases, so I have a bit less work.
>
>     Will discuss it in bug report then, to avoid noise and to make discussion
>     persistent.
>
> see https://jogamp.org/bugzilla/show_bug.cgi?id=647
>
Thank you, I hope I have time tonight or tomorrow to finish the SWT nightmare :)

At least the asyncExec bug is understood well now.

~Sven



signature.asc (909 bytes) Download Attachment