Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Yan2018-11-26 12:16:42 -0500
committerEric Williams2018-11-26 15:15:19 -0500
commita8531a3bcd42ce3a5ebb0b797c646ca9487f3413 (patch)
treeefc2cd220e386aa3f034173c8668bfbced0d09f6
parentb824e103e113fb045c5148e349d48ef38fb7e694 (diff)
downloadeclipse.platform.swt-a8531a3bcd42ce3a5ebb0b797c646ca9487f3413.tar.gz
eclipse.platform.swt-a8531a3bcd42ce3a5ebb0b797c646ca9487f3413.tar.xz
eclipse.platform.swt-a8531a3bcd42ce3a5ebb0b797c646ca9487f3413.zip
Bug 518080 - Use GtkSearchEntry instead of gtkEntry + icon
Add padding for GtkSearchEntry Change-Id: Ic27f154bd505ac49df2451ffa67b94f513f868e6 Signed-off-by: Xi Yan <xixiyan@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index 502d912a8e..f14fa0882d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -606,6 +606,17 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
OS.g_object_unref (layout);
width = Math.max (width, w [0]);
}
+ if ((style & SWT.SEARCH) != 0) {
+ // GtkSearchEntry have more padding than GtkEntry
+ GtkBorder tmp = new GtkBorder();
+ long /*int*/ context = GTK.gtk_widget_get_style_context (handle);
+ if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
+ GTK.gtk_style_context_get_padding (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
+ } else {
+ GTK.gtk_style_context_get_padding (context, GTK.gtk_widget_get_state_flags(handle), tmp);
+ }
+ width += tmp.left + tmp.right;
+ }
if (width == 0) width = DEFAULT_WIDTH;
if (height == 0) height = DEFAULT_HEIGHT;
width = wHint == SWT.DEFAULT ? width : wHint;

Back to the top