diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-01 11:14:15 -0400 |
---|---|---|
committer | Arun Thondapu <arunkumar.thondapu@in.ibm.com> | 2012-08-03 22:58:20 +0530 |
commit | 195c35fb4aaf6777b97d64fa53ba79208d6d54ee (patch) | |
tree | 632df079706f08fc234f5b8c8926b6e352e30723 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java | |
parent | 165a14baa4f28638048d0b616f73e1b86413e4a2 (diff) | |
download | eclipse.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/Label.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java index 1d11b629e9..66ffce244d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java @@ -465,8 +465,17 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize * resized so that it will draw wrapped. */ if (fixWrap) { - int labelWidth = OS.GTK_WIDGET_WIDTH (handle); - int labelHeight = OS.GTK_WIDGET_HEIGHT (handle); + int labelWidth = 0; + int labelHeight = 0; + GtkAllocation allocation = new GtkAllocation(); + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + OS.gtk_widget_get_allocation(handle, allocation); + labelWidth = allocation.width; + labelHeight = allocation.height; + } else { + labelWidth = OS.GTK_WIDGET_WIDTH (handle); + labelHeight = OS.GTK_WIDGET_HEIGHT (handle); + } OS.gtk_widget_set_size_request (labelHandle, labelWidth, labelHeight); /* * Bug in GTK. Setting the size request should invalidate the label's @@ -474,9 +483,12 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize */ GtkRequisition requisition = new GtkRequisition (); OS.gtk_widget_size_request (labelHandle, requisition); - GtkAllocation allocation = new GtkAllocation (); - allocation.x = OS.GTK_WIDGET_X (labelHandle); - allocation.y = OS.GTK_WIDGET_Y (labelHandle); + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + OS.gtk_widget_get_allocation(labelHandle, allocation); + } else { + allocation.x = OS.GTK_WIDGET_X (labelHandle); + allocation.y = OS.GTK_WIDGET_Y (labelHandle); + } allocation.width = labelWidth; allocation.height = labelHeight; OS.gtk_widget_size_allocate (labelHandle, allocation); |