diff options
author | Sven Gothel <[email protected]> | 2023-01-16 01:04:31 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2023-01-16 01:04:31 +0100 |
commit | 21a6171981fb6ca09d7b1dbdc1df0b44f0d33414 (patch) | |
tree | 28ae00785aea0e749811c80af031ec7d1735dbd7 | |
parent | a8bb3295b467d35d26bc33c11797b516ba775903 (diff) | |
parent | a85012696606080a474185fffc380e736a37eeaa (diff) |
Merge pull request #108 from PeterC-DLS/swt-420-fix
Add new class location of SWT's gtk_widget_get_window
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java index 1ddf14b82..c55e893db 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java @@ -95,6 +95,7 @@ public class SWTAccessor { 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 @@ public class SWTAccessor { 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_20 = 4944; + 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 @@ public class SWTAccessor { _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_20) { + 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); } |