Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 403887

Summary: [GTK3] SWT.FLAT for Toolbar buttons does not work
Product: [Eclipse Project] Platform Reporter: Anatoly Spektor <spektor.anatoly>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, ericwill, robert.roth.off, Silenio_Quarti
Version: 4.3Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 340067    

Description Anatoly Spektor CLA 2013-03-20 09:10:32 EDT
How to reproduce:

1. Run Eclipse + GTK3 
2. Hover to any Toolbar button

 You will see that buttons that suppose to be flat are not flat.

Also you can try this snippet (try passing SWT.NONE and SWT.FLAT when creating Toolbar): 

import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.*;


public class ToolBarTest {
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new GridLayout(1, false));

	Image image = display.getSystemImage(SWT.ICON_ERROR);
	
     
      // Try it with SWT.FLAT and without - no difference
	ToolBar bar = new ToolBar(shell, SWT.FLAT);

	bar.setBackground(display.getSystemColor(SWT.COLOR_GREEN));
	for (int i = 0; i < 4; i++) {
		int style = SWT.PUSH;
		ToolItem item = new ToolItem(bar, style);
		item.setImage(image);
	}
	
	Point size;

	shell.open();
	size = bar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	System.out.println("size=" + size);

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
}
Comment 1 Silenio Quarti CLA 2013-03-25 13:13:39 EDT
I think this is actually a problem on the GTK2 SWT build (on Fedora 18). The buttons should draw the border (relief) around them when the mouse hovers over it even when SWT.FLAT is specified.  The is the behavior on Fedora 17 for GTK2 and it got broken on Fedora 18.
Comment 2 Robert Roth CLA 2016-04-17 13:19:27 EDT
I can confirm that the buttons look the same with both SWT.NONE and SWT.FLAT, but in both cases they are flat (no borders, only on hover), and can be checked that in both cases they have the .flat CSS style class assigned to them, because they are toolbuttons.
Is this still an issue for you?
Comment 3 Alexander Kurtakov CLA 2016-04-18 02:17:09 EDT
Unless anyone says otherwise I'll close the bug as no further work is necessary IMHO.
Comment 4 Eric Williams CLA 2018-05-15 15:55:32 EDT
Closing as per comment 3.