Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Ufimtsev2018-05-03 15:27:12 +0000
committerLeo Ufimtsev2018-05-03 15:29:04 +0000
commit00318764ff85d3caa5dcb215a7fcc568e70f47ad (patch)
tree4567525be53754eb87fd1699e9302bd2a89a5a49
parent3b871dbaca01b0bfa4dade0a4713684d07f25402 (diff)
downloadeclipse.platform.swt-00318764ff85d3caa5dcb215a7fcc568e70f47ad.tar.gz
eclipse.platform.swt-00318764ff85d3caa5dcb215a7fcc568e70f47ad.tar.xz
eclipse.platform.swt-00318764ff85d3caa5dcb215a7fcc568e70f47ad.zip
Bug 534089 – [GTK3] Tabfolder setControl(..) breaks with a table that
has composite controls. Temporarily make use of the deprecated gtk_widget_reparent(..) as alternative fix would require deep investigation and we need something functional for photon. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=5340893 Change-Id: I351518383ce77343ccd10e1f1a45750e5663d5c8 Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java23
2 files changed, 19 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
index f361fc1325..ef0023c904 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
@@ -9085,7 +9085,6 @@ public class GTK extends OS {
public static final native void _gtk_widget_reparent(long /*int*/ widget, long /*int*/ new_parent);
/** deprecated as of 3.14 */
public static final void gtk_widget_reparent(long /*int*/ widget, long /*int*/ new_parent) {
- assert !GTK3; // On Gtk3, use Control.gtk_widget_reparent(..);
lock.lock();
try {
_gtk_widget_reparent(widget, new_parent);
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 239c99b77f..f2a8c61ff6 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
@@ -2729,10 +2729,25 @@ static void gtk_widget_reparent (Control control, long /*int*/ newParentHandle)
long /*int*/ parentContainer = GTK.gtk_widget_get_parent (widget);
assert parentContainer != 0 : "Improper use of Control.gtk_widget_reparent. Widget currently has no parent.";
if (parentContainer != 0) {
- OS.g_object_ref (widget); //so that it won't get destroyed due to lack of references.
- GTK.gtk_container_remove (parentContainer, widget);
- GTK.gtk_container_add (newParentHandle, widget);
- OS.g_object_unref (widget);
+
+ // gtk_widget_reparent (..) is deprecated as of Gtk 3.14 and removed in Gtk4.
+ // However, the current alternative of removing/adding widget from/to a container causes errors. (see note below).
+ // TODO - research a better way to reparent. See 534089.
+ GTK.gtk_widget_reparent(widget, newParentHandle);
+
+ // Removing/Adding containers doesn't seem to reparent sub-gdkWindows properly and throws errors.
+ // Steps to reproduce:
+ // - From bug 534089, download the first attachment plugin: "Plug-in to reproduce the problem with"
+ // - Import it into your eclipse. Launch a child eclipse with this plugin. Ensure child workspace is cleaned upon launch so that you see welcome screen.
+ // - Upon closing the welcome screen, you will see an eclipse error message: "org.eclipse.swt.SWTError: No more handles"
+ // - The following is printed into the console: 'gdk_window_new(): parent is destroyed'
+ // After some research, I found that gtk_widget_repartent(..) also reparents sub-windows, but moving widget between containers doesn't do this,
+ // This seems to leave some gdkWindows with incorrect parents.
+// OS.g_object_ref (widget);
+// GTK.gtk_container_remove (parentContainer, widget);
+// GTK.gtk_container_add (newParentHandle, widget);
+// OS.g_object_unref (widget);
+
control.fixParentGdkWindow();
}
} else { // Gtk2.

Back to the top