Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2013-07-01 14:12:42 +0000
committerAlexander Kurtakov2013-07-23 07:04:21 +0000
commitc7907f96191641b1b0c373205c20d6cc221d8499 (patch)
treee4cec8a10903f5147ad0eab50fdc8078b7e8519f
parent322015848b046d4282d3fd691971ee6b693a3820 (diff)
downloadeclipse.platform.swt-c7907f96191641b1b0c373205c20d6cc221d8499.tar.gz
eclipse.platform.swt-c7907f96191641b1b0c373205c20d6cc221d8499.tar.xz
eclipse.platform.swt-c7907f96191641b1b0c373205c20d6cc221d8499.zip
Bug 408505 - Widget's size cannot be allocated before it is shown
Problem appears on GTK 3.8 so the show/hide is done only for it or newer Gtk version.
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 17087836a8..bb18f04eed 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -987,7 +987,17 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
allocation.width = width;
allocation.height = height;
}
- OS.gtk_widget_size_allocate (topHandle, allocation);
+ /*
+ * The widget needs to be shown before its size is allocated
+ * in GTK 3.8 otherwise its allocation return 0
+ */
+ if (OS.GTK_VERSION >= OS.VERSION (3, 8, 0) && !OS.gtk_widget_get_visible(handle)) {
+ OS.gtk_widget_show(handle);
+ OS.gtk_widget_size_allocate (topHandle, allocation);
+ OS.gtk_widget_hide(handle);
+ } else {
+ OS.gtk_widget_size_allocate (topHandle, allocation);
+ }
}
/*
* Bug in GTK. Widgets cannot be sized smaller than 1x1.

Back to the top