Bug 399547 - [GTK3] Widget.getStyle() does not report a set SWT.BORDER value
Summary: [GTK3] Widget.getStyle() does not report a set SWT.BORDER value
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.3   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 4.3 M6   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 340067
  Show dependency tree
 
Reported: 2013-01-30 15:08 EST by Grant Gayed CLA
Modified: 2013-05-24 09:26 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Grant Gayed CLA 2013-01-30 15:08:16 EST
- 4.3M5 test build, observed on Ubuntu 12.04LTS

I noticed in ControlExample that controls would draw a border when their SWT.BORDER style was set, but their SWT.BORDER checkbox would never become selected.  The following snippet shows the problem, the last line should print 2048, not 0 (ControlExample can be used to visually confirm that Tables do support showing a border):

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Table table = new Table(shell, SWT.BORDER);
    System.out.println(table.getStyle() & SWT.BORDER); // <---
}
Comment 1 Alexander Kurtakov CLA 2013-02-15 15:34:27 EST
analysis:
the problem lies in Scroolable.getBorderWidth which depends on Control.getThickness which has GTK3 version which just returns Point(0,0). Scrollable.getBorderWidth is used in Control.checkBorder to decide whether to set the BORDER in the style.
Comment 2 Silenio Quarti CLA 2013-03-21 12:06:30 EDT
Fixed

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=a41e15e7547760b92fd60ae3e7e3c9081f82f745

We need to include the context border and padding in the calculation. Note that the patch is adding GTK_STYLE_CLASS_FRAME to the context. This is the appropriate class for Scrollable, but I am not sure it is the right one for other senders of getThickness().   I performed some testing and could not find any problems.