Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimeon Andreev2018-04-19 14:26:45 +0000
committerSimeon Andreev2018-04-20 10:33:38 +0000
commitf705132b505acb5a99a954ce2a4d6a4e82245e41 (patch)
treea4317eb854d61d2c573cf4fed518282d70f7549b
parent8b51cbe64817820a7dde76d9fae127a66b76941c (diff)
downloadeclipse.platform.swt-f705132b505acb5a99a954ce2a4d6a4e82245e41.tar.gz
eclipse.platform.swt-f705132b505acb5a99a954ce2a4d6a4e82245e41.tar.xz
eclipse.platform.swt-f705132b505acb5a99a954ce2a4d6a4e82245e41.zip
Bug 533815 - starting Eclipse prints GTK warnings on standard error
On Eclipse start with GTK 3.22, 4 GTK warnings of 2 different types are printed on the standard error. First, StatusLine layout will resize its progress bar to have 0 width. This width is then set to 1 by Control.setBounds. Once this width is propagated to the GTK progress bar widget, warnings are emitted on the standard error since there isn't enough drawing width for the progress bar. Second, a shell resize causes GTK to warn of resize without knowing preferred natural size. This change ensures that the width which is propagated to the progress bar is at least 2, to avoid the negative content width warnings. Additionally, it asks the shell wrapping box about its natural size, avoiding the other warnings. Change-Id: Ia87c7786c78d20d0ed33dfe4b635c55f75653c5e Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java7
2 files changed, 9 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
index 391795ef80..8f01f049bd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
@@ -189,6 +189,10 @@ long /*int*/ gtk_realize (long /*int*/ widget) {
*/
@Override
Point resizeCalculationsGTK3 (long /*int*/ widget, int width, int height) {
+ if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ // avoid warnings in GTK caused by too narrow progress bars
+ width = Math.max(2, width);
+ }
return new Point (width, height);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index b88e25b8b8..c87befb12c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -995,7 +995,6 @@ void forceResize (int width, int height) {
if (GTK.GTK3) {
if ((style & SWT.MIRRORED) != 0) clientWidth = getClientWidth ();
}
- GtkRequisition requisition = new GtkRequisition ();
GtkAllocation allocation = new GtkAllocation ();
int border = GTK.gtk_container_get_border_width (shellHandle);
allocation.x = border;
@@ -1004,7 +1003,11 @@ void forceResize (int width, int height) {
allocation.height = height;
// Call gtk_widget_get_preferred_size() on GTK 3.20+ to prevent warnings.
// See bug 486068.
- if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) gtk_widget_get_preferred_size (vboxHandle, requisition);
+ if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ GtkRequisition minimumSize = new GtkRequisition ();
+ GtkRequisition naturalSize = new GtkRequisition ();
+ GTK.gtk_widget_get_preferred_size (vboxHandle, minimumSize, naturalSize);
+ }
GTK.gtk_widget_size_allocate (vboxHandle, allocation);
if (GTK.GTK3) {
if ((style & SWT.MIRRORED) != 0) moveChildren (clientWidth);

Back to the top