From ad957f664258e0c9c389080569a7d3fe9eface97 Mon Sep 17 00:00:00 2001 From: daleclack Date: Tue, 30 Jan 2024 16:47:36 +0800 Subject: [PATCH] Fix warning --- Gtk4/gtk152_prefs_gtk4-2/src/MyPrefs.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Gtk4/gtk152_prefs_gtk4-2/src/MyPrefs.cpp b/Gtk4/gtk152_prefs_gtk4-2/src/MyPrefs.cpp index 7d8d0b3..d707a82 100644 --- a/Gtk4/gtk152_prefs_gtk4-2/src/MyPrefs.cpp +++ b/Gtk4/gtk152_prefs_gtk4-2/src/MyPrefs.cpp @@ -288,7 +288,9 @@ static void update_internal_image(MyPrefs *prefs, const char **id) GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data(id); GdkPixbuf *sized = gdk_pixbuf_scale_simple(pixbuf, prefs->width, prefs->height, GDK_INTERP_BILINEAR); - gtk_picture_set_pixbuf(GTK_PICTURE(prefs->background), pixbuf); + GdkTexture *texture = gdk_texture_new_for_pixbuf(pixbuf); + gtk_picture_set_paintable(GTK_PICTURE(prefs->background), GDK_PAINTABLE(texture)); + // gtk_picture_set_pixbuf(GTK_PICTURE(prefs->background), pixbuf); g_object_unref(pixbuf); g_object_unref(sized); } @@ -303,7 +305,9 @@ static void update_external_image(MyPrefs *prefs, const char *file_name) // Load the image with pixbuf GdkPixbuf *sized = gdk_pixbuf_scale_simple(pixbuf, prefs->width, prefs->height, GDK_INTERP_BILINEAR); - gtk_picture_set_pixbuf(GTK_PICTURE(prefs->background), sized); + GdkTexture *texture = gdk_texture_new_for_pixbuf(pixbuf); + gtk_picture_set_paintable(GTK_PICTURE(prefs->background), GDK_PAINTABLE(texture)); + // gtk_picture_set_pixbuf(GTK_PICTURE(prefs->background), sized); g_object_unref(sized); g_object_unref(pixbuf); }