Community
Participate
Working Groups
Created attachment 277336 [details] screenshot showing the issue I'm not sure whether this is a bug or expected behavior. Take a look at the snippet below. It has two ToolBars, both created with the style SWT.FLAT | SWT.RIGHT, and each toolbar has three PUSH items. In the first toolbar, all items have an image, and none have any text. In all items the image is centered in the item. In the second toolbar, all items have an image, and only one of them has text. The other items in this toolbar (which don't have any text) are wider that those on the first toolbar and the image is aligned left (looks like there's some extra space right after the image). I would expect all items without text to look equal, and with the image centered, regardless of the presence of items with text in the same toolbar. import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; public class ToolItemsExtraSpace { public static void main(String[] args) { Display d = new Display(); Shell s = new Shell(d); s.setLayout(new GridLayout()); Image img = new Image(d, "/home/andreu/Downloads/save.png"); ToolBar bar_1 = new ToolBar(s, SWT.FLAT | SWT.RIGHT); ToolItem ti_1_1 = new ToolItem(bar_1, SWT.PUSH); ti_1_1.setImage(img); ToolItem ti_1_2 = new ToolItem(bar_1, SWT.PUSH); ti_1_2.setImage(img); ToolItem ti_1_3 = new ToolItem(bar_1, SWT.PUSH); ti_1_3.setImage(img); new Label(s, SWT.SEPARATOR | SWT.HORIZONTAL); ToolBar bar_2 = new ToolBar(s, SWT.FLAT | SWT.RIGHT); ToolItem ti_2_1 = new ToolItem(bar_2, SWT.PUSH); ti_2_1.setImage(img); ToolItem ti_2_2 = new ToolItem(bar_2, SWT.PUSH); ti_2_2.setImage(img); ToolItem ti_2_3 = new ToolItem(bar_2, SWT.PUSH); ti_2_3.setImage(img); ti_2_3.setText("foo"); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) { d.sleep(); } } d.dispose(); } }
Can you please attach the "save.png" file used to reproduce the issue?
Created attachment 277341 [details] Sample image
Sure, just attached the image. It's a simple 16x16 icon from Fatcow (https://www.fatcow.com/free-icons)
(In reply to Andreu B from comment #3) > Sure, just attached the image. It's a simple 16x16 icon from Fatcow > (https://www.fatcow.com/free-icons) Okay, I can reproduce the issue on Fedora 29, GTK3.24.3, SWT from master as of today. Do you think this bug is related to bug 395296?
On the surface, it doesn't look like the same bug to me. However I can't say if it has the same root cause or not; I'm not familiar enough with the internals of SWT.
I also experience this issue using a 2019-06 target platform. It is sufficient to populate a view toolbar with a mixture of icons and text buttons to see this behavior. Remove the text buttons and the icons do not show the extra space anymore.
Please try with 4.13 M1, I believe this bug is fixed.
(In reply to Eric Williams from comment #7) > Please try with 4.13 M1, I believe this bug is fixed. Ping, any update?
I will check with the 2019-09 release
I still see this issue with a 2019-09 target platform
New Gerrit change created: https://git.eclipse.org/r/150203
Gerrit change https://git.eclipse.org/r/150203 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=512c60182d2ecd4943eec96919606ab7de737c56
(In reply to Eclipse Genie from comment #12) > Gerrit change https://git.eclipse.org/r/150203 was merged to [master]. > Commit: > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/ > ?id=512c60182d2ecd4943eec96919606ab7de737c56 In master now.
Verified in I20191008-0600.