We updated the target platform to 2021-09 for our Eclipse RCP application that uses JOGL (via Jzy3d) and found an issue.
When JOGL's SWTAccessor class is loaded (for a NewtCanvasSWT or GLCanvas), it initializes some field to point to methods in SWT's internal classes. The recent release of SWT 4.21 separated some gtk methods off to gtk3 and gtk4 specific bindings. This breaks the initialization code when looking for gtk_widget_get_window.
---8<---
--- SWTAccessor.java.orig 2022-02-16 10:22:07.702204475 +0000
+++ SWTAccessor.java 2022-02-16 10:25:38.589674850 +0000
@@ -95,6 +95,7 @@
private static final String str_OS_gtk_class = "org.eclipse.swt.internal.gtk.OS"; // used by earlier versions of SWT
private static final String str_GTK_gtk_class = "org.eclipse.swt.internal.gtk.GTK"; // used by later versions of SWT
+ private static final String str_GTK3_gtk_class = "org.eclipse.swt.internal.gtk3.GTK3"; // used by later versions of SWT (4.21+)
private static final String str_GDK_gtk_class = "org.eclipse.swt.internal.gtk.GDK"; // used by later versions of SWT
public static final Class<?> OS_gtk_class;
private static final String str_OS_gtk_version = "GTK_VERSION";
@@ -124,6 +125,8 @@
private static final String str_gdk_window_set_back_pixmap = "gdk_window_set_back_pixmap";
private static final String str_gdk_window_set_background_pattern = "gdk_window_set_background_pattern";
+ private static final int SWT_VERSION_4_21 = 4946;
+
private static final VersionNumber GTK_VERSION_2_14_0 = new VersionNumber(2, 14, 0);
private static final VersionNumber GTK_VERSION_2_24_0 = new VersionNumber(2, 24, 0);
private static final VersionNumber GTK_VERSION_2_90_0 = new VersionNumber(2, 90, 0);
@@ -261,7 +264,12 @@
_gtk_version = GTK_VERSION(field_OS_gtk_version.getInt(null));
m1 = cGTK.getDeclaredMethod(str_gtk_widget_realize, handleType);
if (_gtk_version.compareTo(GTK_VERSION_2_14_0) >= 0) {
- m4 = cGTK.getDeclaredMethod(str_gtk_widget_get_window, handleType);
+ if (SWT.getVersion() < SWT_VERSION_4_21) {
+ m4 = cGTK.getDeclaredMethod(str_gtk_widget_get_window, handleType);
+ } else {
+ Class<?> cGTK3 = ReflectionUtil.getClass(str_GTK3_gtk_class, false, cl);
+ m4 = cGTK3.getDeclaredMethod(str_gtk_widget_get_window, handleType);
+ }
} else {
m3 = cGTK.getDeclaredMethod(str_GTK_WIDGET_WINDOW, handleType);
}
---8<---
Initial report in JOGL forum :