From eba184151123c18e9cca5e07c8b341635da8dd04 Mon Sep 17 00:00:00 2001 From: Anatoly Spektor Date: Mon, 1 Jul 2013 10:12:42 -0400 Subject: [GTK 3.8] Widget's size cannot be allocated before it is shown --- .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 0bd3b6e410..525fd0ed58 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_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. -- cgit