Skip to content

Commit 4c13551

Browse files
committed
[GTK] Label should not use GtkPicture on Gtk 4.x
From Gtk documentation "GtkImage displays its image as an icon, with a size that is determined by the application. See GtkPicture if you want to show an image at is actual size."
1 parent 9faeb19 commit 4c13551

File tree

1 file changed

+4
-4
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets

1 file changed

+4
-4
lines changed

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2018 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -256,7 +256,7 @@ void createHandle (int index) {
256256
labelHandle = GTK.gtk_label_new_with_mnemonic(null);
257257
if (labelHandle == 0) error(SWT.ERROR_NO_HANDLES);
258258

259-
imageHandle = GTK4.gtk_picture_new();
259+
imageHandle = GTK.gtk_image_new();
260260
if (imageHandle == 0) error(SWT.ERROR_NO_HANDLES);
261261

262262
GTK4.gtk_box_append(handle, labelHandle);
@@ -650,15 +650,15 @@ public void setImage (Image image) {
650650
long pixbuf = ImageList.createPixbuf(image);
651651
long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
652652
OS.g_object_unref(pixbuf);
653-
GTK4.gtk_picture_set_paintable(imageHandle, texture);
653+
GTK4.gtk_image_set_from_paintable(imageHandle, texture);
654654
} else {
655655
GTK3.gtk_image_set_from_surface(imageHandle, image.surface);
656656
}
657657
gtk_widget_hide (labelHandle);
658658
gtk_widget_show (imageHandle);
659659
} else {
660660
if (GTK.GTK4) {
661-
GTK4.gtk_picture_set_paintable(imageHandle, 0);
661+
GTK4.gtk_image_set_from_paintable(imageHandle, 0);
662662
} else {
663663
GTK3.gtk_image_set_from_surface(imageHandle, 0);
664664
}

0 commit comments

Comments
 (0)