Project: SWT
Bug 229776 SWT.TOGGLE style bit stops setRegion from working on linux
Reported: 2008-05-01 09:32:17 | Status: resolved fixed

swt.jar from the I20080429-0100 build setRegion still does not work on linux when you set the SWT.TOGGLE style bit on Canvas or Button import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Region; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class SwtToggleTest { public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setSize(300,400); shell.setText("Composite.setBackgroundMode()"); Image image = new Image(Display.getDefault(), 210, 100); GC gc = new GC(image); gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); gc.fillRectangle(image.getBounds()); gc.dispose(); Region region = new Region(); region.add(0, 0, 140, 50); region.add(70, 50, 140, 50); Canvas c1 = new Canvas(shell, SWT.TOGGLE); c1.setBounds(10, 50, 210, 100); c1.setBackgroundImage(image); c1.setRegion(region); Button b1 = new Button(shell, SWT.TOGGLE); b1.setBounds(10, 200, 210, 100); b1.setImage(image); b1.setRegion(region); shell.open(); while(!shell.isDisposed()) { if(!display.readAndDispatch()) display.sleep(); } display.dispose(); } }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java