diff options
author | Alexander Kurtakov | 2013-07-01 14:12:42 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2013-07-23 07:04:21 +0000 |
commit | c7907f96191641b1b0c373205c20d6cc221d8499 (patch) | |
tree | e4cec8a10903f5147ad0eab50fdc8078b7e8519f | |
parent | 322015848b046d4282d3fd691971ee6b693a3820 (diff) | |
download | eclipse.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.java | 12 |
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. |