Bug 469277: [GTK3] Tree cuts wide icons on the right

This patch addresses the bug where in certain cases, images in TreeItems
would be cut off. This happened when images were wider than 16px,
resulting in text rendering over the right side of image. This was seen
mainly in the Outline view when enabling styled label providers (Window
-> Preferences -> General -> Appearance -> Use Mixed Fonts for Labels
and Icons).

The getTextBounds() method in TreeItem.java was causing the issue, as
the geometric area for text renderers was not taking the image size into
consideration, causing the width to be set at 16px. This resulted in
text rendering occurring after 16px, when the image could be wider than
16px. There is now a check in place that re-adjusts the bounds of the
text renderer if the width of the image is larger than the default
offset.

Tested on Gtk3.16, 3.14, 3.12, 3.10, 3.8, and 2.24. AllNonBrowswer JUnit
tests pass on Gtk3 and Gtk2.

Change-Id: I98afa0d369960313ad35636840489bd796276c23
Signed-off-by: Eric Williams <ericwill@redhat.com>
1 file changed
tree: 4b135d15a6332536ae8892289aa9023e29da1243
  1. bundles/
  2. examples/
  3. features/
  4. local-build/
  5. tests/
  6. .gitignore
  7. pom.xml
  8. README.md
README.md

Contributing to SWT

Thanks for your interest in this project.

Developer resources:

Information regarding source code management, builds, coding standards, and more.

Contributor License Agreement:

Before your contribution can be accepted by the project, you need to create and electronically sign the Eclipse Foundation Contributor License Agreement (CLA).

Contact:

Contact the project developers via the project's “dev” list.

Search for bugs:

This project uses Bugzilla to track ongoing development and issues.

Create a new bug:

Be sure to search for existing bugs before you create another one. Remember that contributions are always welcome!