Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2018-11-06 14:29:58 +0000
committerAndrey Loskutov2018-11-06 14:29:58 +0000
commit96ab2fe4d68170062b2505323e75255cbc4d4252 (patch)
tree41d2ea672e933001df4c05f2e812822a086671a4
parent9c0b8f793f58b36f018e36b66ed3a4b9e0f63a69 (diff)
downloadeclipse.platform.swt-96ab2fe4d68170062b2505323e75255cbc4d4252.tar.gz
eclipse.platform.swt-96ab2fe4d68170062b2505323e75255cbc4d4252.tar.xz
eclipse.platform.swt-96ab2fe4d68170062b2505323e75255cbc4d4252.zip
Revert "Bug 540298 - adressing initial widget size/visibility issues"
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java8
2 files changed, 10 insertions, 27 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 cb0994c2ff..3d4863717c 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
@@ -3449,7 +3449,15 @@ long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
if ((state & OBSCURED) != 0) return 0;
GdkRectangle rect = new GdkRectangle ();
GDK.gdk_cairo_get_clip_rectangle (cairo, rect);
-
+ /*
+ * On GTK3.19+, widget are are shown with the default minimum size regardless of the
+ * size of the fixed container. This causes 0x0 widgets to be visible but cannot be used.
+ * The fix is to make the widget invisible to the user. Resizing widget later on to a larger size
+ * makes the widget visible again in setBounds. See Bug 533469, Bug 531120.
+ */
+ if (GTK.GTK_VERSION > OS.VERSION (3, 18, 0) && (state & ZERO_WIDTH) != 0 && (state & ZERO_HEIGHT) != 0) {
+ if (GTK.gtk_widget_get_visible(widget)) GTK.gtk_widget_hide(widget);
+ }
/*
* Modify the drawing of the widget with cairo_clip.
* Doesn't modify input handling at this time.
@@ -4952,19 +4960,13 @@ void setForegroundGdkRGBA (long /*int*/ handle, GdkRGBA rgba) {
void setInitialBounds () {
if ((state & ZERO_WIDTH) != 0 && (state & ZERO_HEIGHT) != 0) {
- long /*int*/ topHandle = topHandle ();
- if(GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
- if(mustBeVisibleOnInitBounds()) {
- GTK.gtk_widget_set_visible(topHandle, true);
- }
- return;
- }
/*
* Feature in GTK. On creation, each widget's allocation is
* initialized to a position of (-1, -1) until the widget is
* first sized. The fix is to set the value to (0, 0) as
* expected by SWT.
*/
+ long /*int*/ topHandle = topHandle ();
GtkAllocation allocation = new GtkAllocation();
if ((parent.style & SWT.MIRRORED) != 0) {
allocation.x = parent.getClientWidth ();
@@ -4980,17 +4982,6 @@ void setInitialBounds () {
}
}
-/**
- * Widgets with unusual bounds calculation behavior can override this method
- * to return {@code true} if the widged must be visible during call to
- * {@link #setInitialBounds()}.
- *
- * @return {@code false} by default on modern GTK 3 versions (3.20+).
- */
-boolean mustBeVisibleOnInitBounds() {
- return GTK.GTK_VERSION < OS.VERSION(3, 20, 0);
-}
-
/*
* Sets the receivers Drag Gestures in order to do drag detection correctly for
* X11/Wayland window managers after GTK3.14.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
index 8c3ab21fdc..b70fa33752 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
@@ -108,14 +108,6 @@ long /*int*/ clientHandle () {
}
@Override
-boolean mustBeVisibleOnInitBounds() {
- // Bug 540298: if we return false, we will be invisible if the size is
- // not set, but our layout will not properly work, so that not all children
- // will be shown properly
- return true;
-}
-
-@Override
Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
Point size = super.computeSizeInPixels(wHint, hHint, changed);
int width = computeNativeSize (handle, SWT.DEFAULT, SWT.DEFAULT, false).x;

Back to the top