diff options
| author | Anatoly Spektor | 2012-11-19 17:52:58 +0000 |
|---|---|---|
| committer | Alexander Kurtakov | 2012-11-20 17:06:35 +0000 |
| commit | 89b5f4500222e33648e01e47d68897bffeb1aa77 (patch) | |
| tree | 64e8d3abbcda5b7538188a27b3465714eb301740 | |
| parent | d88d5429072d65fb6f367fc61ae2a374d8d48af2 (diff) | |
| download | eclipse.platform.swt-89b5f4500222e33648e01e47d68897bffeb1aa77.tar.gz eclipse.platform.swt-89b5f4500222e33648e01e47d68897bffeb1aa77.tar.xz eclipse.platform.swt-89b5f4500222e33648e01e47d68897bffeb1aa77.zip | |
Use Requisition to computeSize of Text in GTK+ 3
| -rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java | 12 |
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 7373e65d5b..502305d94e 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); |
