Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 286469 Details for
Bug 573782
[BigSur] GLCanvas does not update after PaintListener.paintControl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Snippet that reproduces the bug
SWTSnippet.java (text/plain), 1.90 KB, created by
Mario Marinato
on 2021-05-28 07:17:45 EDT
(
hide
)
Description:
Snippet that reproduces the bug
Filename:
MIME Type:
Creator:
Mario Marinato
Created:
2021-05-28 07:17:45 EDT
Size:
1.90 KB
patch
obsolete
>package swtSnippet; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.opengl.GLCanvas; >import org.eclipse.swt.opengl.GLData; >import org.eclipse.swt.widgets.Canvas; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Event; >import org.eclipse.swt.widgets.Shell; > >/** > * This snippet serves two purposes:<p> > * > * Demonstrate Eclipse Bug #573782 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=573782<br> > * On Eclipse 4.14, using a GLCanvas, it is not redrawn after paintControl runs.<p> > * > * Demonstrate Eclipse Bug #570649 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=570649<br> > * On Eclipse 4.19, using a GLCanvas, it throws an error on the readAndDispatch call.<p> > * > * When it runs correctly, it opens a Shell with a red line that moves around when you move your mouse over > * the canvas. > */ >public class SWTSnippet { > > public static void main( String[] args ) { > Display display = new Display(); > Shell shell = new Shell( display ); > shell.setLayout( new FillLayout() ); > shell.setBounds( 100, 100, 400, 400 ); > > // This does not work. > Canvas canvas = new GLCanvas( shell, SWT.NONE, new GLData() ); > > // This works. > // Canvas canvas = new Canvas( shell, SWT.NONE ); > > canvas.addListener( SWT.Paint, event -> handlePaint( event ) ); > canvas.addListener( SWT.MouseMove, event -> canvas.redraw() ); > > shell.open(); > while ( !shell.isDisposed() ) { > if ( !display.readAndDispatch() ) { > display.sleep(); > } > } > display.dispose(); > } > > private static void handlePaint( Event event ) { > int xBegin = 10 + (int) ( Math.random() * 10 ); > int xEnd = 390 - (int) ( Math.random() * 10 ); > int yBegin = 10 + (int) ( Math.random() * 10 ); > int yEnd = 350 - (int) ( Math.random() * 10 ); > > event.gc.setLineWidth( 3 ); > event.gc.setForeground( Display.getDefault().getSystemColor( SWT.COLOR_RED ) ); > event.gc.drawLine( xBegin, yBegin, xEnd, yEnd ); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 573782
: 286469