Bug 570533 - [GTK4] Make separate GTK3.java and GTK4.java native
wrappers - GtkImage/GtkSnapshot

- Moved GtkImage & GtkSnapshot functions
- Removed unused GTK4 gtk_image_set_from_icon_name
- Changed return value of GTK4 gtk_image_set_from_paintable from long to
void
- Removed #define guards for GTK3 event functions,
gtk_main_iteration_do, gtk_events_pending
- Add gtk4 flavor of gtk_image_new_from_icon_name

Change-Id: Ifb3ff18903112927e92136f472213efd8045a2bf
Signed-off-by: Paul D'Pong <sdamrong@redhat.com>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/180141
Tested-by: Platform Bot <platform-bot@eclipse.org>
Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c
index ae5e246..016c54e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c
@@ -916,6 +916,58 @@
 }
 #endif
 
+#ifndef NO_gtk_1image_1new_1from_1icon_1name
+JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1image_1new_1from_1icon_1name)
+	(JNIEnv *env, jclass that, jbyteArray arg0, jint arg1)
+{
+	jbyte *lparg0=NULL;
+	jlong rc = 0;
+	GTK3_NATIVE_ENTER(env, that, gtk_1image_1new_1from_1icon_1name_FUNC);
+	if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+	rc = (jlong)gtk_image_new_from_icon_name((const gchar *)lparg0, (GtkIconSize)arg1);
+fail:
+	if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+	GTK3_NATIVE_EXIT(env, that, gtk_1image_1new_1from_1icon_1name_FUNC);
+	return rc;
+}
+#endif
+
+#ifndef NO_gtk_1image_1new_1from_1surface
+JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1image_1new_1from_1surface)
+	(JNIEnv *env, jclass that, jlong arg0)
+{
+	jlong rc = 0;
+	GTK3_NATIVE_ENTER(env, that, gtk_1image_1new_1from_1surface_FUNC);
+	rc = (jlong)gtk_image_new_from_surface((cairo_surface_t *)arg0);
+	GTK3_NATIVE_EXIT(env, that, gtk_1image_1new_1from_1surface_FUNC);
+	return rc;
+}
+#endif
+
+#ifndef NO_gtk_1image_1set_1from_1icon_1name
+JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1image_1set_1from_1icon_1name)
+	(JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1, jint arg2)
+{
+	jbyte *lparg1=NULL;
+	GTK3_NATIVE_ENTER(env, that, gtk_1image_1set_1from_1icon_1name_FUNC);
+	if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+	gtk_image_set_from_icon_name((GtkImage *)arg0, (const gchar *)lparg1, (GtkIconSize)arg2);
+fail:
+	if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+	GTK3_NATIVE_EXIT(env, that, gtk_1image_1set_1from_1icon_1name_FUNC);
+}
+#endif
+
+#ifndef NO_gtk_1image_1set_1from_1surface
+JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1image_1set_1from_1surface)
+	(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
+{
+	GTK3_NATIVE_ENTER(env, that, gtk_1image_1set_1from_1surface_FUNC);
+	gtk_image_set_from_surface((GtkImage *)arg0, (cairo_surface_t *)arg1);
+	GTK3_NATIVE_EXIT(env, that, gtk_1image_1set_1from_1surface_FUNC);
+}
+#endif
+
 #ifndef NO_gtk_1init_1check
 JNIEXPORT jboolean JNICALL GTK3_NATIVE(gtk_1init_1check)
 	(JNIEnv *env, jclass that, jlongArray arg0, jlongArray arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.c
index 87c4035..5b25d30 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.c
@@ -98,6 +98,10 @@
 	"gtk_1icon_1theme_1load_1icon",
 	"gtk_1icon_1theme_1lookup_1by_1gicon",
 	"gtk_1im_1context_1filter_1keypress",
+	"gtk_1image_1new_1from_1icon_1name",
+	"gtk_1image_1new_1from_1surface",
+	"gtk_1image_1set_1from_1icon_1name",
+	"gtk_1image_1set_1from_1surface",
 	"gtk_1init_1check",
 	"gtk_1main_1do_1event",
 	"gtk_1main_1iteration_1do",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h
index 43e6d51..30b9f67 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h
@@ -108,6 +108,10 @@
 	gtk_1icon_1theme_1load_1icon_FUNC,
 	gtk_1icon_1theme_1lookup_1by_1gicon_FUNC,
 	gtk_1im_1context_1filter_1keypress_FUNC,
+	gtk_1image_1new_1from_1icon_1name_FUNC,
+	gtk_1image_1new_1from_1surface_FUNC,
+	gtk_1image_1set_1from_1icon_1name_FUNC,
+	gtk_1image_1set_1from_1surface_FUNC,
 	gtk_1init_1check_FUNC,
 	gtk_1main_1do_1event_FUNC,
 	gtk_1main_1iteration_1do_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c
index 141ab2b..753b85a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c
@@ -565,6 +565,42 @@
 }
 #endif
 
+#ifndef NO_gtk_1image_1clear
+JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1image_1clear)
+	(JNIEnv *env, jclass that, jlong arg0)
+{
+	GTK4_NATIVE_ENTER(env, that, gtk_1image_1clear_FUNC);
+	gtk_image_clear((GtkImage *)arg0);
+	GTK4_NATIVE_EXIT(env, that, gtk_1image_1clear_FUNC);
+}
+#endif
+
+#ifndef NO_gtk_1image_1new_1from_1icon_1name
+JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1image_1new_1from_1icon_1name)
+	(JNIEnv *env, jclass that, jbyteArray arg0)
+{
+	jbyte *lparg0=NULL;
+	jlong rc = 0;
+	GTK4_NATIVE_ENTER(env, that, gtk_1image_1new_1from_1icon_1name_FUNC);
+	if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+	rc = (jlong)gtk_image_new_from_icon_name((const char *)lparg0);
+fail:
+	if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+	GTK4_NATIVE_EXIT(env, that, gtk_1image_1new_1from_1icon_1name_FUNC);
+	return rc;
+}
+#endif
+
+#ifndef NO_gtk_1image_1set_1from_1paintable
+JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1image_1set_1from_1paintable)
+	(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
+{
+	GTK4_NATIVE_ENTER(env, that, gtk_1image_1set_1from_1paintable_FUNC);
+	gtk_image_set_from_paintable((GtkImage *)arg0, (GdkPaintable *)arg1);
+	GTK4_NATIVE_EXIT(env, that, gtk_1image_1set_1from_1paintable_FUNC);
+}
+#endif
+
 #ifndef NO_gtk_1init_1check
 JNIEXPORT jboolean JNICALL GTK4_NATIVE(gtk_1init_1check)
 	(JNIEnv *env, jclass that)
@@ -823,6 +859,18 @@
 }
 #endif
 
+#ifndef NO_gtk_1snapshot_1append_1cairo
+JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1snapshot_1append_1cairo)
+	(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
+{
+	jlong rc = 0;
+	GTK4_NATIVE_ENTER(env, that, gtk_1snapshot_1append_1cairo_FUNC);
+	rc = (jlong)gtk_snapshot_append_cairo((GtkSnapshot *)arg0, (const graphene_rect_t *)arg1);
+	GTK4_NATIVE_EXIT(env, that, gtk_1snapshot_1append_1cairo_FUNC);
+	return rc;
+}
+#endif
+
 #ifndef NO_gtk_1text_1get_1buffer
 JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1text_1get_1buffer)
 	(JNIEnv *env, jclass that, jlong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.c
index cff7f5e..ebb3b61 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.c
@@ -68,6 +68,9 @@
 	"gtk_1icon_1theme_1get_1for_1display",
 	"gtk_1icon_1theme_1lookup_1icon",
 	"gtk_1im_1context_1filter_1keypress",
+	"gtk_1image_1clear",
+	"gtk_1image_1new_1from_1icon_1name",
+	"gtk_1image_1set_1from_1paintable",
 	"gtk_1init_1check",
 	"gtk_1keyval_1trigger_1new",
 	"gtk_1named_1action_1new",
@@ -90,6 +93,7 @@
 	"gtk_1shortcut_1controller_1remove_1shortcut",
 	"gtk_1shortcut_1controller_1set_1scope",
 	"gtk_1shortcut_1new",
+	"gtk_1snapshot_1append_1cairo",
 	"gtk_1text_1get_1buffer",
 	"gtk_1widget_1action_1set_1enabled",
 	"gtk_1widget_1activate_1action",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h
index f320082..0fefd3d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h
@@ -78,6 +78,9 @@
 	gtk_1icon_1theme_1get_1for_1display_FUNC,
 	gtk_1icon_1theme_1lookup_1icon_FUNC,
 	gtk_1im_1context_1filter_1keypress_FUNC,
+	gtk_1image_1clear_FUNC,
+	gtk_1image_1new_1from_1icon_1name_FUNC,
+	gtk_1image_1set_1from_1paintable_FUNC,
 	gtk_1init_1check_FUNC,
 	gtk_1keyval_1trigger_1new_FUNC,
 	gtk_1named_1action_1new_FUNC,
@@ -100,6 +103,7 @@
 	gtk_1shortcut_1controller_1remove_1shortcut_FUNC,
 	gtk_1shortcut_1controller_1set_1scope_FUNC,
 	gtk_1shortcut_1new_FUNC,
+	gtk_1snapshot_1append_1cairo_FUNC,
 	gtk_1text_1get_1buffer_FUNC,
 	gtk_1widget_1action_1set_1enabled_FUNC,
 	gtk_1widget_1activate_1action_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 9989943..d01a139 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -5670,24 +5670,6 @@
 }
 #endif
 
-#ifndef NO_gtk_1image_1clear
-JNIEXPORT void JNICALL GTK_NATIVE(gtk_1image_1clear)
-	(JNIEnv *env, jclass that, jlong arg0)
-{
-	GTK_NATIVE_ENTER(env, that, gtk_1image_1clear_FUNC);
-/*
-	gtk_image_clear((GtkImage *)arg0);
-*/
-	{
-		GTK_LOAD_FUNCTION(fp, gtk_image_clear)
-		if (fp) {
-			((void (CALLING_CONVENTION*)(GtkImage *))fp)((GtkImage *)arg0);
-		}
-	}
-	GTK_NATIVE_EXIT(env, that, gtk_1image_1clear_FUNC);
-}
-#endif
-
 #ifndef NO_gtk_1image_1new
 JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1image_1new)
 	(JNIEnv *env, jclass that)
@@ -5700,134 +5682,6 @@
 }
 #endif
 
-#ifndef NO_gtk_1image_1new_1from_1icon_1name___3B
-JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1image_1new_1from_1icon_1name___3B)
-	(JNIEnv *env, jclass that, jbyteArray arg0)
-{
-	jbyte *lparg0=NULL;
-	jlong rc = 0;
-	GTK_NATIVE_ENTER(env, that, gtk_1image_1new_1from_1icon_1name___3B_FUNC);
-	if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
-/*
-	rc = (jlong)gtk_image_new_from_icon_name((const gchar *)lparg0);
-*/
-	{
-		GTK_LOAD_FUNCTION(fp, gtk_image_new_from_icon_name)
-		if (fp) {
-			rc = (jlong)((jlong (CALLING_CONVENTION*)(const gchar *))fp)((const gchar *)lparg0);
-		}
-	}
-fail:
-	if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-	GTK_NATIVE_EXIT(env, that, gtk_1image_1new_1from_1icon_1name___3B_FUNC);
-	return rc;
-}
-#endif
-
-#ifndef NO_gtk_1image_1new_1from_1icon_1name___3BI
-JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1image_1new_1from_1icon_1name___3BI)
-	(JNIEnv *env, jclass that, jbyteArray arg0, jint arg1)
-{
-	jbyte *lparg0=NULL;
-	jlong rc = 0;
-	GTK_NATIVE_ENTER(env, that, gtk_1image_1new_1from_1icon_1name___3BI_FUNC);
-	if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
-/*
-	rc = (jlong)gtk_image_new_from_icon_name((const gchar *)lparg0, (GtkIconSize)arg1);
-*/
-	{
-		GTK_LOAD_FUNCTION(fp, gtk_image_new_from_icon_name)
-		if (fp) {
-			rc = (jlong)((jlong (CALLING_CONVENTION*)(const gchar *, GtkIconSize))fp)((const gchar *)lparg0, (GtkIconSize)arg1);
-		}
-	}
-fail:
-	if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
-	GTK_NATIVE_EXIT(env, that, gtk_1image_1new_1from_1icon_1name___3BI_FUNC);
-	return rc;
-}
-#endif
-
-#ifndef NO_gtk_1image_1new_1from_1surface
-JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1image_1new_1from_1surface)
-	(JNIEnv *env, jclass that, jlong arg0)
-{
-	jlong rc = 0;
-	GTK_NATIVE_ENTER(env, that, gtk_1image_1new_1from_1surface_FUNC);
-/*
-	rc = (jlong)gtk_image_new_from_surface((cairo_surface_t *)arg0);
-*/
-	{
-		GTK_LOAD_FUNCTION(fp, gtk_image_new_from_surface)
-		if (fp) {
-			rc = (jlong)((jlong (CALLING_CONVENTION*)(cairo_surface_t *))fp)((cairo_surface_t *)arg0);
-		}
-	}
-	GTK_NATIVE_EXIT(env, that, gtk_1image_1new_1from_1surface_FUNC);
-	return rc;
-}
-#endif
-
-#ifndef NO_gtk_1image_1set_1from_1icon_1name
-JNIEXPORT void JNICALL GTK_NATIVE(gtk_1image_1set_1from_1icon_1name)
-	(JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1, jint arg2)
-{
-	jbyte *lparg1=NULL;
-	GTK_NATIVE_ENTER(env, that, gtk_1image_1set_1from_1icon_1name_FUNC);
-	if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
-/*
-	gtk_image_set_from_icon_name((GtkImage *)arg0, (const gchar *)lparg1, (GtkIconSize)arg2);
-*/
-	{
-		GTK_LOAD_FUNCTION(fp, gtk_image_set_from_icon_name)
-		if (fp) {
-			((void (CALLING_CONVENTION*)(GtkImage *, const gchar *, GtkIconSize))fp)((GtkImage *)arg0, (const gchar *)lparg1, (GtkIconSize)arg2);
-		}
-	}
-fail:
-	if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
-	GTK_NATIVE_EXIT(env, that, gtk_1image_1set_1from_1icon_1name_FUNC);
-}
-#endif
-
-#ifndef NO_gtk_1image_1set_1from_1paintable
-JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1image_1set_1from_1paintable)
-	(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
-{
-	jlong rc = 0;
-	GTK_NATIVE_ENTER(env, that, gtk_1image_1set_1from_1paintable_FUNC);
-/*
-	rc = (jlong)gtk_image_set_from_paintable((GtkImage *)arg0, (GdkPaintable *)arg1);
-*/
-	{
-		GTK_LOAD_FUNCTION(fp, gtk_image_set_from_paintable)
-		if (fp) {
-			rc = (jlong)((jlong (CALLING_CONVENTION*)(GtkImage *, GdkPaintable *))fp)((GtkImage *)arg0, (GdkPaintable *)arg1);
-		}
-	}
-	GTK_NATIVE_EXIT(env, that, gtk_1image_1set_1from_1paintable_FUNC);
-	return rc;
-}
-#endif
-
-#ifndef NO_gtk_1image_1set_1from_1surface
-JNIEXPORT void JNICALL GTK_NATIVE(gtk_1image_1set_1from_1surface)
-	(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
-{
-	GTK_NATIVE_ENTER(env, that, gtk_1image_1set_1from_1surface_FUNC);
-/*
-	gtk_image_set_from_surface((GtkImage *)arg0, (cairo_surface_t *)arg1);
-*/
-	{
-		GTK_LOAD_FUNCTION(fp, gtk_image_set_from_surface)
-		if (fp) {
-			((void (CALLING_CONVENTION*)(GtkImage *, cairo_surface_t *))fp)((GtkImage *)arg0, (cairo_surface_t *)arg1);
-		}
-	}
-	GTK_NATIVE_EXIT(env, that, gtk_1image_1set_1from_1surface_FUNC);
-}
-#endif
-
 #ifndef NO_gtk_1image_1set_1pixel_1size
 JNIEXPORT void JNICALL GTK_NATIVE(gtk_1image_1set_1pixel_1size)
 	(JNIEnv *env, jclass that, jlong arg0, jint arg1)
@@ -7636,18 +7490,6 @@
 }
 #endif
 
-#ifndef NO_gtk_1snapshot_1append_1cairo
-JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1snapshot_1append_1cairo)
-	(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
-{
-	jlong rc = 0;
-	GTK_NATIVE_ENTER(env, that, gtk_1snapshot_1append_1cairo_FUNC);
-	rc = (jlong)gtk_snapshot_append_cairo((GtkSnapshot *)arg0, (const graphene_rect_t *)arg1);
-	GTK_NATIVE_EXIT(env, that, gtk_1snapshot_1append_1cairo_FUNC);
-	return rc;
-}
-#endif
-
 #ifndef NO_gtk_1socket_1get_1id
 JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1socket_1get_1id)
 	(JNIEnv *env, jclass that, jlong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
index 7f62a44..d644bfb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
@@ -234,8 +234,6 @@
 #define NO_gdk_1screen_1is_1composited
 
 // No GDK lock
-#define NO_gtk_1events_1pending
-#define NO_gtk_1main_1iteration_1do
 #define NO_gdk_1threads_1add_1idle
 #define NO_gdk_1threads_1add_1timeout
 #define NO_gdk_1threads_1enter
@@ -391,9 +389,6 @@
 // No GdkClipboard on GTK3
 #define NO_gdk_1clipboard_1set_1content
 
-// No GtkSnapshot on GTK3
-#define NO_gtk_1snapshot_1append_1cairo
-
 // No Graphene library on GTK3
 #define NO_graphene_1rect_1alloc
 #define NO_graphene_1rect_1free
@@ -417,8 +412,6 @@
 #define NO_gdk_1texture_1new_1from_1file__J_3J
 #define NO_gdk_1texture_1new_1from_1file___3B_3J
 
-#define NO_gtk_1image_1set_1from_1paintable
-
 // GdkEvent functions which do not exist on GTK3
 #define NO_gdk_1focus_1event_1get_1in
 #define NO_gdk_1crossing_1event_1get_1mode
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index da18bd3..e19628b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -455,14 +455,7 @@
 	"gtk_1im_1context_1set_1client_1window",
 	"gtk_1im_1context_1set_1cursor_1location",
 	"gtk_1im_1multicontext_1new",
-	"gtk_1image_1clear",
 	"gtk_1image_1new",
-	"gtk_1image_1new_1from_1icon_1name___3B",
-	"gtk_1image_1new_1from_1icon_1name___3BI",
-	"gtk_1image_1new_1from_1surface",
-	"gtk_1image_1set_1from_1icon_1name",
-	"gtk_1image_1set_1from_1paintable",
-	"gtk_1image_1set_1from_1surface",
 	"gtk_1image_1set_1pixel_1size",
 	"gtk_1label_1get_1layout",
 	"gtk_1label_1get_1mnemonic_1keyval",
@@ -611,7 +604,6 @@
 	"gtk_1search_1entry_1new",
 	"gtk_1separator_1new",
 	"gtk_1settings_1get_1default",
-	"gtk_1snapshot_1append_1cairo",
 	"gtk_1socket_1get_1id",
 	"gtk_1socket_1new",
 	"gtk_1spin_1button_1configure",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index f5d36e1..3d25734 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -453,14 +453,7 @@
 	gtk_1im_1context_1set_1client_1window_FUNC,
 	gtk_1im_1context_1set_1cursor_1location_FUNC,
 	gtk_1im_1multicontext_1new_FUNC,
-	gtk_1image_1clear_FUNC,
 	gtk_1image_1new_FUNC,
-	gtk_1image_1new_1from_1icon_1name___3B_FUNC,
-	gtk_1image_1new_1from_1icon_1name___3BI_FUNC,
-	gtk_1image_1new_1from_1surface_FUNC,
-	gtk_1image_1set_1from_1icon_1name_FUNC,
-	gtk_1image_1set_1from_1paintable_FUNC,
-	gtk_1image_1set_1from_1surface_FUNC,
 	gtk_1image_1set_1pixel_1size_FUNC,
 	gtk_1label_1get_1layout_FUNC,
 	gtk_1label_1get_1mnemonic_1keyval_FUNC,
@@ -609,7 +602,6 @@
 	gtk_1search_1entry_1new_FUNC,
 	gtk_1separator_1new_FUNC,
 	gtk_1settings_1get_1default_FUNC,
-	gtk_1snapshot_1append_1cairo_FUNC,
 	gtk_1socket_1get_1id_FUNC,
 	gtk_1socket_1new_FUNC,
 	gtk_1spin_1button_1configure_FUNC,
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 d47244c..ce1f7f6 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
@@ -852,7 +852,6 @@
 	public static final native void gtk_im_context_set_cursor_location(long context, GdkRectangle area);
 	public static final native long gtk_im_multicontext_new();
 
-
 	/* GtkImage */
 	public static final native long gtk_image_new();
 	/**
@@ -861,50 +860,6 @@
 	 */
 	public static final native void gtk_image_set_pixel_size(long image, int pixel_size);
 
-	/* GtkImage [GTK3 only] */
-	/**
-	 * @method flags=dynamic
-	 * @param image cast=(GtkImage *)
-	 * @param surface cast=(cairo_surface_t *)
-	 */
-	public static final native void gtk_image_set_from_surface(long image, long surface);
-	/**
-	 * @method flags=dynamic
-	 * @param icon_name cast=(const gchar *)
-	 * @param size cast=(GtkIconSize)
-	 */
-	public static final native long gtk_image_new_from_icon_name(byte[] icon_name, int size);
-	/**
-	 * @method flags=dynamic
-	 * @param image cast=(GtkImage *)
-	 * @param icon_name cast=(const gchar *)
-	 * @param size cast=(GtkIconSize)
-	 */
-	public static final native void gtk_image_set_from_icon_name(long image, byte[] icon_name, int size);
-	/**
-	 * @method flags=dynamic
-	 * @param surface cast=(cairo_surface_t *)
-	 */
-	public static final native long gtk_image_new_from_surface(long surface);
-
-	/* GtkImage [GTK4 only] */
-	/**
-	 * @method flags=dynamic
-	 * @param icon_name cast=(const gchar *)
-	 */
-	public static final native long gtk_image_new_from_icon_name(byte[] icon_name);
-	/**
-	 * @method flags=dynamic
-	 * @param image cast=(GtkImage *)
-	 * @param paintable cast=(GdkPaintable *)
-	 */
-	public static final native long gtk_image_set_from_paintable(long image, long paintable);
-	/**
-	 * @method flags=dynamic
-	 * @param image cast=(GtkImage *)
-	 */
-	public static final native void gtk_image_clear(long image);
-
 	/* GtkLabel */
 	public static final native long gtk_label_get_type();
 	/** @param label cast=(const gchar *) */
@@ -1627,12 +1582,6 @@
 	/** @param spin_button cast=(GtkSpinButton*) */
 	public static final native void gtk_spin_button_update(long spin_button);
 	/**
-	 * @param snapshot cast=(GtkSnapshot *)
-	 * @param rect cast=(const graphene_rect_t *)
-	 */
-	/* [GTK4 only, if-def'd in os.h] */
-	public static final native long gtk_snapshot_append_cairo(long snapshot, long rect);
-	/**
 	 * @method flags=ignore_deprecations
 	 * @param handle cast=(GtkStatusIcon*)
 	 * @param screen cast=(GdkScreen**)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java
index 875cef8..80ebad0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java
@@ -186,7 +186,7 @@
 	/** @param event cast=(GdkEvent *) */
 	public static final native void gtk_main_do_event(long event);
 	public static final native boolean gtk_main_iteration_do(boolean blocking);
-	public static final native boolean gtk_events_pending ();
+	public static final native boolean gtk_events_pending();
 
 	/* GtkWindow */
 	/**
@@ -835,4 +835,24 @@
 
 	/* GtkEventBox */
 	public static final native long gtk_event_box_new();
+
+	/* GtkImage */
+	/**
+	 * @param image cast=(GtkImage *)
+	 * @param surface cast=(cairo_surface_t *)
+	 */
+	public static final native void gtk_image_set_from_surface(long image, long surface);
+	/**
+	 * @param icon_name cast=(const gchar *)
+	 * @param size cast=(GtkIconSize)
+	 */
+	public static final native long gtk_image_new_from_icon_name(byte[] icon_name, int size);
+	/**
+	 * @param image cast=(GtkImage *)
+	 * @param icon_name cast=(const gchar *)
+	 * @param size cast=(GtkIconSize)
+	 */
+	public static final native void gtk_image_set_from_icon_name(long image, byte[] icon_name, int size);
+	/** @param surface cast=(cairo_surface_t *) */
+	public static final native long gtk_image_new_from_surface(long surface);
 }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java
index 8acf945..e764d6e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java
@@ -411,4 +411,22 @@
 	/* GtkComboBox */
 	/** @param combo_box cast=(GtkComboBox *) */
 	public static final native long gtk_combo_box_get_child(long combo_box);
+
+	/* GtkSnapshot */
+	/**
+	 * @param snapshot cast=(GtkSnapshot *)
+	 * @param rect cast=(const graphene_rect_t *)
+	 */
+	public static final native long gtk_snapshot_append_cairo(long snapshot, long rect);
+
+	/* GtkImage */
+	/**
+	 * @param image cast=(GtkImage *)
+	 * @param paintable cast=(GdkPaintable *)
+	 */
+	public static final native void gtk_image_set_from_paintable(long image, long paintable);
+	/** @param icon_name cast=(const char *) */
+	public static final native long gtk_image_new_from_icon_name(byte[] icon_name);
+	/** @param image cast=(GtkImage *) */
+	public static final native void gtk_image_clear(long image);
 }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
index 76bdf46..96ef0ae 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -313,7 +313,7 @@
 				arrowHandle = GTK4.gtk_widget_get_first_child(handle);
 				if (arrowHandle == 0) error (SWT.ERROR_NO_HANDLES);
 			} else {
-				arrowHandle = GTK.gtk_image_new_from_icon_name(arrowType, GTK.GTK_ICON_SIZE_MENU);
+				arrowHandle = GTK3.gtk_image_new_from_icon_name(arrowType, GTK.GTK_ICON_SIZE_MENU);
 				if (arrowHandle == 0) error (SWT.ERROR_NO_HANDLES);
 				handle = GTK.gtk_button_new();
 				if (handle == 0) error (SWT.ERROR_NO_HANDLES);
@@ -834,7 +834,7 @@
 			case SWT.LEFT: arrowType = isRTL ? GTK.GTK_NAMED_ICON_GO_NEXT : GTK.GTK_NAMED_ICON_GO_PREVIOUS; break;
 			case SWT.RIGHT: arrowType = isRTL ? GTK.GTK_NAMED_ICON_GO_PREVIOUS : GTK.GTK_NAMED_ICON_GO_NEXT; break;
 		}
-		GTK.gtk_image_set_from_icon_name (arrowHandle, arrowType, GTK.GTK_ICON_SIZE_MENU);
+		GTK3.gtk_image_set_from_icon_name (arrowHandle, arrowType, GTK.GTK_ICON_SIZE_MENU);
 		return;
 	}
 	if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
@@ -1124,13 +1124,13 @@
 			OS.g_object_unref(pixbuf);
 			GTK4.gtk_picture_set_paintable(imageHandle, texture);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+			GTK3.gtk_image_set_from_surface(imageHandle, image.surface);
 		}
 	} else {
 		if (GTK.GTK4) {
 			GTK4.gtk_picture_set_paintable(imageHandle, 0);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, 0);
+			GTK3.gtk_image_set_from_surface(imageHandle, 0);
 		}
 	}
 	this.image = image;
@@ -1149,8 +1149,8 @@
 		if (arrowHandle != 0) {
 			byte arrowType [] = (style & SWT.RIGHT_TO_LEFT) != 0 ? GTK.GTK_NAMED_ICON_GO_NEXT : GTK.GTK_NAMED_ICON_GO_PREVIOUS;
 			switch (style & (SWT.LEFT | SWT.RIGHT)) {
-				case SWT.LEFT: GTK.gtk_image_set_from_icon_name (arrowHandle, arrowType, GTK.GTK_ICON_SIZE_MENU); break;
-				case SWT.RIGHT: GTK.gtk_image_set_from_icon_name (arrowHandle, arrowType, GTK.GTK_ICON_SIZE_MENU); break;
+				case SWT.LEFT: GTK3.gtk_image_set_from_icon_name (arrowHandle, arrowType, GTK.GTK_ICON_SIZE_MENU); break;
+				case SWT.RIGHT: GTK3.gtk_image_set_from_icon_name (arrowHandle, arrowType, GTK.GTK_ICON_SIZE_MENU); break;
 			}
 		}
 	}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
index 285f44c..c0b17d9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
@@ -530,7 +530,7 @@
 			OS.g_object_unref(pixbuf);
 			GTK4.gtk_picture_set_paintable(imageHandle, texture);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+			GTK3.gtk_image_set_from_surface(imageHandle, image.surface);
 		}
 		if (text.length () == 0) GTK.gtk_widget_hide (labelHandle);
 		GTK.gtk_widget_show(imageHandle);
@@ -538,7 +538,7 @@
 		if (GTK.GTK4) {
 			GTK4.gtk_picture_set_paintable(imageHandle, 0);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, 0);
+			GTK3.gtk_image_set_from_surface(imageHandle, 0);
 		}
 		GTK.gtk_widget_show(labelHandle);
 		GTK.gtk_widget_hide(imageHandle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index 81f82ac..d21ce2b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -652,7 +652,7 @@
 			OS.g_object_unref(pixbuf);
 			GTK4.gtk_picture_set_paintable(imageHandle, texture);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+			GTK3.gtk_image_set_from_surface(imageHandle, image.surface);
 		}
 		GTK.gtk_widget_hide (labelHandle);
 		GTK.gtk_widget_show (imageHandle);
@@ -660,7 +660,7 @@
 		if (GTK.GTK4) {
 			GTK4.gtk_picture_set_paintable(imageHandle, 0);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, 0);
+			GTK3.gtk_image_set_from_surface(imageHandle, 0);
 		}
 		GTK.gtk_widget_show (labelHandle);
 		GTK.gtk_widget_hide (imageHandle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
index 283d58b..64e7997 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
@@ -981,16 +981,16 @@
 
 		if (!GTK3.GTK_IS_MENU_ITEM (handle)) return;
 		if (OS.SWT_PADDED_MENU_ITEMS && imageHandle != 0) {
-			GTK.gtk_image_set_from_surface(imageHandle, surface);
+			GTK3.gtk_image_set_from_surface(imageHandle, surface);
 		} else {
 			if (imageHandle == 0) {
-				imageHandle = GTK.gtk_image_new_from_surface(surface);
+				imageHandle = GTK3.gtk_image_new_from_surface(surface);
 				if (imageHandle == 0) error(SWT.ERROR_NO_HANDLES);
 
 				GTK3.gtk_container_add(boxHandle, imageHandle);
 				GTK3.gtk_box_reorder_child(boxHandle, imageHandle, 0);
 			} else {
-				GTK.gtk_image_set_from_surface(imageHandle, surface);
+				GTK3.gtk_image_set_from_surface(imageHandle, surface);
 			}
 		}
 		GTK.gtk_widget_show(imageHandle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
index 53886f1..a5e3200 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
@@ -18,6 +18,7 @@
 import org.eclipse.swt.graphics.*;
 import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.internal.gtk3.*;
 import org.eclipse.swt.internal.gtk4.*;
 
 /**
@@ -413,16 +414,16 @@
 			long pixbuf = ImageList.createPixbuf(image);
 			long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
 			OS.g_object_unref(pixbuf);
-			GTK.gtk_image_set_from_paintable(imageHandle, texture);
+			GTK4.gtk_image_set_from_paintable(imageHandle, texture);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+			GTK3.gtk_image_set_from_surface(imageHandle, image.surface);
 		}
 		GTK.gtk_widget_show(imageHandle);
 	} else {
 		if (GTK.GTK4) {
-			GTK.gtk_image_clear(imageHandle);
+			GTK4.gtk_image_clear(imageHandle);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, 0);
+			GTK3.gtk_image_set_from_surface(imageHandle, 0);
 		}
 		GTK.gtk_widget_hide(imageHandle);
 	}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index 996670b..786c853 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -3019,7 +3019,7 @@
 	GdkRectangle gdkRectangle = new GdkRectangle ();
 	OS.memmove(gdkRectangle, background_area, GdkRectangle.sizeof);
 	Graphene.graphene_rect_init(rect, gdkRectangle.x, gdkRectangle.y, gdkRectangle.width, gdkRectangle.height);
-	long cairo = GTK.gtk_snapshot_append_cairo(snapshot, rect);
+	long cairo = GTK4.gtk_snapshot_append_cairo(snapshot, rect);
 	rendererRender (cell, cairo, snapshot, widget, background_area, cell_area, 0, flags);
 	return 0;
 }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
index 07b4a3b..b8117c9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
@@ -20,6 +20,7 @@
 import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.gtk.*;
 import org.eclipse.swt.internal.gtk3.*;
+import org.eclipse.swt.internal.gtk4.*;
 
 /**
  * Instances of this class represent a column in a table widget.
@@ -636,16 +637,16 @@
 			long pixbuf = ImageList.createPixbuf(image);
 			long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
 			OS.g_object_unref(pixbuf);
-			GTK.gtk_image_set_from_paintable(imageHandle, texture);
+			GTK4.gtk_image_set_from_paintable(imageHandle, texture);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, headerImageList.getSurface(imageIndex));
+			GTK3.gtk_image_set_from_surface(imageHandle, headerImageList.getSurface(imageIndex));
 		}
 		GTK.gtk_widget_show(imageHandle);
 	} else {
 		if (GTK.GTK4) {
-			GTK.gtk_image_clear(imageHandle);
+			GTK4.gtk_image_clear(imageHandle);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, 0);
+			GTK3.gtk_image_set_from_surface(imageHandle, 0);
 		}
 		GTK.gtk_widget_hide(imageHandle);
 	}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
index af503b3..794f046 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
@@ -19,6 +19,7 @@
 import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.gtk.*;
 import org.eclipse.swt.internal.gtk3.*;
+import org.eclipse.swt.internal.gtk4.*;
 
 /**
  * Instances of this class represent a selectable user interface object
@@ -335,7 +336,7 @@
 	int [] buffer = new int [1];
 	if (GTK.gtk_tree_view_get_expander_column (parentHandle) == column) {
 		if (GTK.GTK4) {
-			long image = GTK.gtk_image_new_from_icon_name(GTK.GTK_NAMED_ICON_PAN_DOWN, GTK.GTK_ICON_SIZE_MENU);
+			long image = GTK4.gtk_image_new_from_icon_name(GTK.GTK_NAMED_ICON_PAN_DOWN);
 			GtkAllocation allocation = new GtkAllocation ();
 			GTK.gtk_widget_get_allocation(image, allocation);
 			rect.x += allocation.width + TreeItem.EXPANDER_EXTRA_PADDING;
@@ -793,7 +794,7 @@
 	int [] buffer = new int [1];
 	if (GTK.gtk_tree_view_get_expander_column (parentHandle) == column) {
 		if (GTK.GTK4) {
-			long image = GTK.gtk_image_new_from_icon_name(GTK.GTK_NAMED_ICON_PAN_DOWN, GTK.GTK_ICON_SIZE_MENU);
+			long image = GTK4.gtk_image_new_from_icon_name(GTK.GTK_NAMED_ICON_PAN_DOWN);
 			GtkAllocation allocation = new GtkAllocation ();
 			GTK.gtk_widget_get_allocation(image, allocation);
 			rect.x += allocation.width + TreeItem.EXPANDER_EXTRA_PADDING;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index c6cb28a..a12b119 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -302,7 +302,7 @@
 		} else {
 			labelHandle = GTK.gtk_label_new_with_mnemonic(null);
 			if (labelHandle == 0) error(SWT.ERROR_NO_HANDLES);
-			imageHandle = GTK.gtk_image_new_from_surface(0);
+			imageHandle = GTK3.gtk_image_new_from_surface(0);
 			if (imageHandle == 0) error(SWT.ERROR_NO_HANDLES);
 
 			GTK3.gtk_tool_button_set_icon_widget(handle, imageHandle);
@@ -693,7 +693,7 @@
 				GTK.gtk_label_set_xalign (labelHandle, 0);
 				GTK.gtk_widget_set_halign (labelHandle, GTK.GTK_ALIGN_FILL);
 
-				long menuImage = GTK.gtk_image_new_from_surface(surface);
+				long menuImage = GTK3.gtk_image_new_from_surface(surface);
 				if (menuImage == 0) error (SWT.ERROR_NO_HANDLES);
 
 				GTK3.gtk_container_add (boxHandle, menuImage);
@@ -743,9 +743,9 @@
 					long pixbuf = ImageList.createPixbuf(hotImage);
 					long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
 					OS.g_object_unref(pixbuf);
-					GTK.gtk_image_set_from_paintable(imageHandle, texture);
+					GTK4.gtk_image_set_from_paintable(imageHandle, texture);
 				} else {
-					GTK.gtk_image_set_from_surface(imageHandle, imageList.getSurface(index));
+					GTK3.gtk_image_set_from_surface(imageHandle, imageList.getSurface(index));
 				}
 			}
 		}
@@ -807,9 +807,9 @@
 						long pixbuf = ImageList.createPixbuf(image);
 						long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
 						OS.g_object_unref(pixbuf);
-						GTK.gtk_image_set_from_paintable(imageHandle, texture);
+						GTK4.gtk_image_set_from_paintable(imageHandle, texture);
 					} else {
-						GTK.gtk_image_set_from_surface(imageHandle, imageList.getSurface(index));
+						GTK3.gtk_image_set_from_surface(imageHandle, imageList.getSurface(index));
 					}
 				}
 			}
@@ -1260,16 +1260,16 @@
 			long pixbuf = ImageList.createPixbuf(image);
 			long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
 			OS.g_object_unref(pixbuf);
-			GTK.gtk_image_set_from_paintable(imageHandle, texture);
+			GTK4.gtk_image_set_from_paintable(imageHandle, texture);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, imageList.getSurface(imageIndex));
+			GTK3.gtk_image_set_from_surface(imageHandle, imageList.getSurface(imageIndex));
 		}
 	} else {
 		if(GTK.GTK4) {
-			GTK.gtk_image_clear(imageHandle);
+			GTK4.gtk_image_clear(imageHandle);
 			GTK.gtk_widget_hide(imageHandle);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, 0);
+			GTK3.gtk_image_set_from_surface(imageHandle, 0);
 		}
 	}
 	/*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index c522a23..dd7c427 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -454,10 +454,10 @@
 		/* expander */
 		if (!GTK.gtk_tree_view_column_get_visible(column)) {
 			if (GTK.GTK4) {
-				long image = GTK.gtk_image_new_from_icon_name(GTK.GTK_NAMED_ICON_PAN_DOWN, GTK.GTK_ICON_SIZE_MENU);
-				GtkAllocation allocation = new GtkAllocation ();
-				GTK.gtk_widget_get_allocation(image, allocation);
-				width += allocation.width + TreeItem.EXPANDER_EXTRA_PADDING;
+				long image = GTK4.gtk_image_new_from_icon_name(GTK.GTK_NAMED_ICON_PAN_DOWN);
+				GtkRequisition requisition = new GtkRequisition ();
+				GTK.gtk_widget_get_preferred_size(image, requisition, null);
+				width += requisition.width + TreeItem.EXPANDER_EXTRA_PADDING;
 			} else {
 				GTK3.gtk_widget_style_get (handle, OS.expander_size, w, 0);
 				width += w [0] + TreeItem.EXPANDER_EXTRA_PADDING;
@@ -3166,7 +3166,7 @@
 	GdkRectangle gdkRectangle = new GdkRectangle ();
 	OS.memmove(gdkRectangle, background_area, GdkRectangle.sizeof);
 	Graphene.graphene_rect_init(rect, gdkRectangle.x, gdkRectangle.y, gdkRectangle.width, gdkRectangle.height);
-	long cairo = GTK.gtk_snapshot_append_cairo(snapshot, rect);
+	long cairo = GTK4.gtk_snapshot_append_cairo(snapshot, rect);
 	rendererRender (cell, cairo, snapshot, widget, background_area, cell_area, 0, flags);
 	return 0;
 }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
index 7bd87f6..3547173 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
@@ -615,16 +615,16 @@
 			long pixbuf = ImageList.createPixbuf(image);
 			long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
 			OS.g_object_unref(pixbuf);
-			GTK.gtk_image_set_from_paintable(imageHandle, texture);
+			GTK4.gtk_image_set_from_paintable(imageHandle, texture);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, headerImageList.getSurface(imageIndex));
+			GTK3.gtk_image_set_from_surface(imageHandle, headerImageList.getSurface(imageIndex));
 		}
 		GTK.gtk_widget_show(imageHandle);
 	} else {
 		if (GTK.GTK4) {
-			GTK.gtk_image_clear(imageHandle);
+			GTK4.gtk_image_clear(imageHandle);
 		} else {
-			GTK.gtk_image_set_from_surface(imageHandle, 0);
+			GTK3.gtk_image_set_from_surface(imageHandle, 0);
 		}
 		GTK.gtk_widget_hide(imageHandle);
 	}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index 787379a..ea507ab 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -1988,7 +1988,7 @@
 	GTK.gtk_widget_get_allocation(handle, allocation);
 	long rect = Graphene.graphene_rect_alloc();
 	Graphene.graphene_rect_init(rect, 0, 0, allocation.width, allocation.height);
-	long cairo = GTK.gtk_snapshot_append_cairo(snapshot, rect);
+	long cairo = GTK4.gtk_snapshot_append_cairo(snapshot, rect);
 	if (cairo != 0) gtk_draw(handle, cairo);
 	Graphene.graphene_rect_free(rect);
 	return;