summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-08-01 11:14:15 -0400
committerArun Thondapu <arunkumar.thondapu@in.ibm.com>2012-08-03 22:58:20 +0530
commit195c35fb4aaf6777b97d64fa53ba79208d6d54ee (patch)
tree632df079706f08fc234f5b8c8926b6e352e30723 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
parent165a14baa4f28638048d0b616f73e1b86413e4a2 (diff)
downloadeclipse.platform.swt-195c35fb4aaf6777b97d64fa53ba79208d6d54ee.tar.gz
eclipse.platform.swt-195c35fb4aaf6777b97d64fa53ba79208d6d54ee.tar.xz
eclipse.platform.swt-195c35fb4aaf6777b97d64fa53ba79208d6d54ee.zip
Use gtk_widget_get_allocation in newer GTK+
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.java22
1 files changed, 17 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 0be15510e2..bc11b73d58 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
@@ -752,8 +752,17 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
* resized so that it will draw wrapped.
*/
if (wrap) {
- int boxWidth = OS.GTK_WIDGET_WIDTH (boxHandle);
- int boxHeight = OS.GTK_WIDGET_HEIGHT (boxHandle);
+ int boxWidth = 0;
+ int boxHeight = 0;
+ GtkAllocation allocation = new GtkAllocation();
+ if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
+ OS.gtk_widget_get_allocation(boxHandle, allocation);
+ boxWidth = allocation.width;
+ boxHeight = allocation.height;
+ } else {
+ boxWidth = OS.GTK_WIDGET_WIDTH (boxHandle);
+ boxHeight = OS.GTK_WIDGET_HEIGHT (boxHandle);
+ }
int /*long*/ labelLayout = OS.gtk_label_get_layout (labelHandle);
int pangoWidth = OS.pango_layout_get_width (labelLayout);
OS.pango_layout_set_width (labelLayout, -1);
@@ -776,9 +785,12 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
*/
GtkRequisition requisition = new GtkRequisition ();
OS.gtk_widget_size_request (boxHandle, requisition);
- GtkAllocation allocation = new GtkAllocation ();
- allocation.x = OS.GTK_WIDGET_X (boxHandle);
- allocation.y = OS.GTK_WIDGET_Y (boxHandle);
+ if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
+ OS.gtk_widget_get_allocation(boxHandle, allocation);
+ } else {
+ allocation.x = OS.GTK_WIDGET_X (boxHandle);
+ allocation.y = OS.GTK_WIDGET_Y (boxHandle);
+ }
allocation.width = boxWidth;
allocation.height = boxHeight;
OS.gtk_widget_size_allocate (boxHandle, allocation);