Bug 531667 - GTK drawing and clipping issues after Control.print(GC) fix

With the fix for bug 531667, at least the following regressions were
introduced:

1. and 2. CTabFolder with SWT.RIGHT_TO_LEFT flag is not drawn and code
using GC.setTransform()/GC.getTransform() was broken in some cases. E.g.
caused drawing artifacts in tools based on GEF, such as figures drawn
with wrong coordinates and starting with 0,0 in a global window space.
We observe these regressions, since the Cairo transformation matrix is
overwritten on some occasions, causing Cairo to lose the current (x,y)
translation relative to the widget parents.

3. Further drawing artifacts are seen when scrolling in a GEF editor, or
when resizing neighboring part stacks so that they land over specific
GEF editor elements (e.g. LED). Namely, some elements are painted over
neighboring composites (e.g. ports of a LED). This is caused by bad
clipping set by client code and GC.setClipping(0) removing current Cairo
clipping. Since GC is able to to draw at any point in the shell after
the fix for bug 531667 (as the Cairo handle is shared by all
composites), this results in client code being able to draw over other
unrelated composites.

4. Bug 478618 was re-introduced on GTK > 3.20, i.e. ControlDecoration of
e.g. text fields would paint its error decoration at a wrong location.
In result, two decorations per ControlDecoration are painted; one of
which is misplaced while the other will not be repainted on correcting
input. On GTK 3.14 the ControlDecorations aren't drawn at all
independently from bug 531667 or this patch, see bug 533241.

We resolve the first two issues by remembering the original Cairo
transformation matrix in GC and applying this matrix on every transform
set by the client code.

The third regression is fixed by remembering the original Cairo clipping
and intersecting the client clipping with it.

The last regression in ControlDecoration is fixed by applying the patch
for bug 478618 also for GTK 3.20 and above. For GTK 3.14 see bug 533241,
because this is not a regression from the Control.print(GC) fix.

Manual bug snippets are provided for all of the regressions.

Change-Id: I1bcc3c72d14fc37b05c51ff6f0845667a95d160c
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
7 files changed
tree: 9bcac037e565f993c35890507e0797588f2a4600
  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:

See the following description for how to contribute a feature or a bug fix to SWT.

Information regarding source code management, builds, coding standards, and more and be found under the following link.

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!