diff options
author | Alexander Kurtakov <akurtako@redhat.com> | 2012-11-14 11:44:06 +0200 |
---|---|---|
committer | Alexander Kurtakov <akurtako@redhat.com> | 2012-11-14 11:44:06 +0200 |
commit | 7d46d43cd21b835d179c72bde7bab59e61f13803 (patch) | |
tree | bde3cb0bec6bf2bc3d791cce062b69b8f96b1249 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java | |
parent | f0c3863919f76488edb06642c9a462968a147799 (diff) | |
download | eclipse.platform.swt-7d46d43cd21b835d179c72bde7bab59e61f13803.tar.gz eclipse.platform.swt-7d46d43cd21b835d179c72bde7bab59e61f13803.tar.xz eclipse.platform.swt-7d46d43cd21b835d179c72bde7bab59e61f13803.zip |
Bug 393856 - Consider using pango_layout_get_pixel_size
Binding for the function added and used where possible. This allows to
not convert them after fetching via OS.PANGO_PIXELS calls.
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java index 6ebf428819..8282c908b3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java @@ -231,11 +231,11 @@ public Point computeSize (int wHint, int hHint, boolean changed) { OS.pango_layout_set_width (labelLayout, -1); } int [] w = new int [1], h = new int [1]; - OS.pango_layout_get_size (labelLayout, w, h); + OS.pango_layout_get_pixel_size (labelLayout, w, h); OS.pango_layout_set_width (labelLayout, pangoWidth); size = new Point(0, 0); - size.x += wHint == SWT.DEFAULT ? OS.PANGO_PIXELS(w [0]) + imageWidth + trimWidth : wHint; - size.y += hHint == SWT.DEFAULT ? Math.max(Math.max(imageHeight, indicatorHeight), OS.PANGO_PIXELS(h [0])) + trimHeight : hHint; + size.x += wHint == SWT.DEFAULT ? w [0] + imageWidth + trimWidth : wHint; + size.y += hHint == SWT.DEFAULT ? Math.max(Math.max(imageHeight, indicatorHeight), h [0]) + trimHeight : hHint; } else { size = computeNativeSize (handle, wHint, hHint, changed); } @@ -776,7 +776,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize int pangoWidth = OS.pango_layout_get_width (labelLayout); OS.pango_layout_set_width (labelLayout, -1); int [] w = new int [1], h = new int [1]; - OS.pango_layout_get_size (labelLayout, w, h); + OS.pango_layout_get_pixel_size (labelLayout, w, h); OS.pango_layout_set_width (labelLayout, pangoWidth); int imageWidth = 0; if (gtk_widget_get_visible (imageHandle)) { @@ -787,7 +787,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize OS.g_object_get (boxHandle, OS.spacing, spacing, 0); imageWidth += spacing [0]; } - OS.gtk_widget_set_size_request (labelHandle, Math.min(OS.PANGO_PIXELS(w [0]), boxWidth - imageWidth), -1); + OS.gtk_widget_set_size_request (labelHandle, Math.min(w [0], boxWidth - imageWidth), -1); /* * Bug in GTK. Setting the size request should invalidate the label's * layout, but it does not. The fix is to resize the label directly. |