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/TabItem.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/TabItem.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java index 59aea1bb6d..ed57668988 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java @@ -150,10 +150,23 @@ void destroyWidget () { */ public Rectangle getBounds () { checkWidget(); - int x = OS.GTK_WIDGET_X (handle); - int y = OS.GTK_WIDGET_Y (handle); - int width = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (handle); - int height = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (handle); + int x = 0; + int y = 0; + int width = 0; + int height = 0; + GtkAllocation allocation = new GtkAllocation (); + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + OS.gtk_widget_get_allocation(handle, allocation); + x = allocation.x; + y = allocation.y; + width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width; + height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height; + } else { + x = OS.GTK_WIDGET_X (handle); + y = OS.GTK_WIDGET_Y (handle); + width = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (handle); + height = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (handle); + } if ((parent.style & SWT.MIRRORED) != 0) x = parent.getClientWidth () - width - x; return new Rectangle (x, y, width, height); } |