diff options
| author | Sravan Kumar Lakkimsetti | 2015-05-13 09:52:27 +0000 |
|---|---|---|
| committer | Sravan Kumar Lakkimsetti | 2015-05-13 09:52:56 +0000 |
| commit | 6930fdd35d9cdffd6d05c778fb4b82a2018d7fcb (patch) | |
| tree | d6d8ff0ea3755c73f497add57e23289466fc33a8 | |
| parent | f8b6f09f184d883d47a01f62db17c592685ee5cd (diff) | |
| download | eclipse.platform.swt-6930fdd35d9cdffd6d05c778fb4b82a2018d7fcb.tar.gz eclipse.platform.swt-6930fdd35d9cdffd6d05c778fb4b82a2018d7fcb.tar.xz eclipse.platform.swt-6930fdd35d9cdffd6d05c778fb4b82a2018d7fcb.zip | |
Bug 465309 - [GTK3] No icon showing in open type dialog
Adjusted the clip rectangle to consider the icon size as well
Change-Id: I326a3f84068ec804d6c2c0cac166cd8fbebb6c7e
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 | 6 | ||||
| -rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java | 21 |
2 files changed, 26 insertions, 1 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 7f6f1edabe..1c58e9a5e6 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 @@ -2792,6 +2792,12 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo Rectangle bounds = image.getBounds (); imageWidth = bounds.width; } + // On gtk >3.9 and <3.14.8 the clip rectangle does not have image area into clip rectangle + // need to adjust clip rectangle with image width + if (cr != 0 && OS.GTK_VERSION > OS.VERSION(3, 9, 0) && OS.GTK_VERSION <= OS.VERSION(3, 14, 8)) { + rect.x -= imageWidth; + rect.width +=imageWidth; + } contentX [0] -= imageWidth; contentWidth [0] += imageWidth; GC gc = getGC(cr); 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 871e8e049c..3c14d8cd85 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 @@ -2661,7 +2661,13 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, iter); OS.gtk_tree_view_get_background_area (handle, path, columnHandle, rect); OS.gtk_tree_path_free (path); - + // A workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=459117 + if (cr != 0 && OS.GTK_VERSION > OS.VERSION(3, 9, 0) && OS.GTK_VERSION <= OS.VERSION(3, 14, 8)) { + GdkRectangle r2 = new GdkRectangle (); + OS.gdk_cairo_get_clip_rectangle (cr, r2); + rect.x = r2.x; + rect.width = r2.width; + } if ((drawState & SWT.SELECTED) == 0) { if ((state & PARENT_BACKGROUND) != 0 || backgroundImage != null) { Control control = findBackgroundControl (); @@ -2781,6 +2787,13 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo OS.gtk_tree_view_get_cell_area (handle, path, columnHandle, rect); OS.gtk_tree_view_get_background_area (handle, path, columnHandle, clipRect); OS.gtk_tree_path_free (path); + // A workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=459117 + if (cr != 0 && OS.GTK_VERSION > OS.VERSION(3, 9, 0) && OS.GTK_VERSION <= OS.VERSION(3, 14, 8)) { + GdkRectangle r2 = new GdkRectangle (); + OS.gdk_cairo_get_clip_rectangle (cr, r2); + rect.x = r2.x; + rect.width = r2.width; + } ignoreSize = true; int [] contentX = new int [1], contentWidth = new int [1]; gtk_cell_renderer_get_preferred_size (cell, handle, contentWidth, null); @@ -2792,6 +2805,12 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo Rectangle bounds = image.getBounds (); imageWidth = bounds.width; } + // On gtk >3.9 and <3.14.8 the clip rectangle does not have image area into clip rectangle + // need to adjust clip rectangle with image width + if (cr != 0 && OS.GTK_VERSION > OS.VERSION(3, 9, 0) && OS.GTK_VERSION <= OS.VERSION(3, 14, 8)) { + rect.x -= imageWidth; + rect.width +=imageWidth; + } contentX [0] -= imageWidth; contentWidth [0] += imageWidth; GC gc = getGC(cr); |
