diff options
| author | Niraj Modi | 2015-04-29 05:54:10 +0000 |
|---|---|---|
| committer | Arun Thondapu | 2015-05-07 18:51:38 +0000 |
| commit | c84205ca5d69149c76901442667dd91c7dbb3f53 (patch) | |
| tree | b42308fe12b6ced75bc54d852a9f9d723aa17588 | |
| parent | e9c3a090eabf8087140a57b5f981d27dfab570a1 (diff) | |
| download | eclipse.platform.swt-c84205ca5d69149c76901442667dd91c7dbb3f53.tar.gz eclipse.platform.swt-c84205ca5d69149c76901442667dd91c7dbb3f53.tar.xz eclipse.platform.swt-c84205ca5d69149c76901442667dd91c7dbb3f53.zip | |
Bug 464816 - [Gtk3] Adding SWT.EraseItem listener and drawing background
makes the TreeItem/TableItem text dissapear
- Updated Code for Table as well
The code change is related to setting the correct clipping during the EraseItem event.
This has been tested on Fedora 19 with GTK+ 3.8.8 and Ubuntu 14.04 with GTK+ 3.10.
Testing is done using the snippet provided and modified snippet for table as well. Ran the SWT junit test suite.
For regression testing, used a self hosted eclipse and tested on multiple views like Call hierarchy, Type hierarchy, etc. Verified that they are working fine.
Change-Id: I8bdb7f219ccbfec467b85c88a1e72c5fdc3dcf3e
Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
| -rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java | 26 | ||||
| -rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java | 6 |
2 files changed, 22 insertions, 10 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java index 6bfbfa9fda..cd9cb94e22 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java @@ -2649,7 +2649,9 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo if (control != null) { if (cr != 0) { Cairo.cairo_save (cr); - Cairo.cairo_reset_clip (cr); + if (!OS.GTK3){ + Cairo.cairo_reset_clip (cr); + } } drawBackground (control, window, cr, 0, rect.x, rect.y, rect.width, rect.height); if (cr != 0) { @@ -2669,13 +2671,15 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo if (wasSelected) { Control control = findBackgroundControl (); if (control == null) control = this; - if (cr != 0) { - Cairo.cairo_save (cr); - Cairo.cairo_reset_clip (cr); - } - drawBackground (control, window, cr, 0, rect.x, rect.y, rect.width, rect.height); - if (cr != 0) { - Cairo.cairo_restore (cr); + if (!OS.GTK3){ + if (cr != 0) { + Cairo.cairo_save (cr); + Cairo.cairo_reset_clip (cr); + } + drawBackground (control, window, cr, 0, rect.x, rect.y, rect.width, rect.height); + if (cr != 0) { + Cairo.cairo_restore (cr); + } } } GC gc = getGC(cr); @@ -2688,7 +2692,11 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo } gc.setFont (item.getFont (columnIndex)); if ((style & SWT.MIRRORED) != 0) rect.x = getClientWidth () - rect.width - rect.x; - if (!OS.GTK3) { + if (OS.GTK_VERSION >= OS.VERSION(3, 9, 0) && cr != 0) { + GdkRectangle r = new GdkRectangle(); + OS.gdk_cairo_get_clip_rectangle(cr, r); + gc.setClipping(rect.x, r.y, r.width, r.height); + } else { gc.setClipping (rect.x, rect.y, rect.width, rect.height); } Event event = new Event (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java index cba55c32c7..7b88efe482 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java @@ -2703,7 +2703,11 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo gc.setFont (item.getFont (columnIndex)); if ((style & SWT.MIRRORED) != 0) rect.x = getClientWidth () - rect.width - rect.x; - if (!OS.GTK3) { + if (OS.GTK_VERSION >= OS.VERSION(3, 9, 0) && cr != 0) { + GdkRectangle r = new GdkRectangle(); + OS.gdk_cairo_get_clip_rectangle(cr, r); + gc.setClipping(rect.x, r.y, r.width, r.height); + } else { gc.setClipping (rect.x, rect.y, rect.width, rect.height); } Event event = new Event (); |
