aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor2012-11-19 12:52:58 (EST)
committerAlexander Kurtakov2012-11-20 12:06:35 (EST)
commit89b5f4500222e33648e01e47d68897bffeb1aa77 (patch)
tree64e8d3abbcda5b7538188a27b3465714eb301740
parentd88d5429072d65fb6f367fc61ae2a374d8d48af2 (diff)
downloadeclipse.platform.swt-89b5f4500222e33648e01e47d68897bffeb1aa77.zip
eclipse.platform.swt-89b5f4500222e33648e01e47d68897bffeb1aa77.tar.gz
eclipse.platform.swt-89b5f4500222e33648e01e47d68897bffeb1aa77.tar.bz2
Use Requisition to computeSize of Text in GTK+ 3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java12
1 files changed, 10 insertions, 2 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 7373e65..502305d 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
@@ -556,8 +556,16 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
OS.g_object_unref (layout);
width = Math.max (width, w [0]);
}
- if (width == 0) width = DEFAULT_WIDTH;
- if (height == 0) height = DEFAULT_HEIGHT;
+ if (OS.GTK3) {
+ OS.gtk_widget_set_size_request(handle, wHint, hHint);
+ GtkRequisition requsition = new GtkRequisition();
+ OS.gtk_widget_get_preferred_size(handle, requsition, null);
+ if (width == 0) width = requsition.width;
+ if (height == 0) height = requsition.height;
+ } else {
+ if (width == 0) width = DEFAULT_WIDTH;
+ if (height == 0) height = DEFAULT_HEIGHT;
+ }
width = wHint == SWT.DEFAULT ? width : wHint;
height = hHint == SWT.DEFAULT ? height : hHint;
Rectangle trim = computeTrim (0, 0, width, height);