Re: SWT ScrolledComposite not working under Mac Mountain Lion
Posted by
sam on
Nov 29, 2012; 12:05pm
URL: https://forum.jogamp.org/SWT-ScrolledComposite-not-working-under-Mac-Mountain-Lion-tp4027271p4027292.html
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.