Skip to content

Commit b47c5fc

Browse files
committed
[GTK] Button images should be GtkImage not GtkPicture
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 0a68dea commit b47c5fc

File tree

1 file changed

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

1 file changed

+4
-8
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,18 +385,14 @@ void createHandle (int index) {
385385
labelHandle = GTK.gtk_label_new_with_mnemonic(null);
386386
if (labelHandle == 0) error(SWT.ERROR_NO_HANDLES);
387387

388+
imageHandle = GTK.gtk_image_new();
389+
if (imageHandle == 0) error(SWT.ERROR_NO_HANDLES);
388390

389391
if (GTK.GTK4) {
390-
imageHandle = GTK4.gtk_picture_new();
391-
if (imageHandle == 0) error(SWT.ERROR_NO_HANDLES);
392-
393392
GTK.gtk_widget_set_parent(boxHandle, handle);
394393
GTK4.gtk_box_append(boxHandle, imageHandle);
395394
GTK4.gtk_box_append(boxHandle, labelHandle);
396395
} else {
397-
imageHandle = GTK.gtk_image_new();
398-
if (imageHandle == 0) error(SWT.ERROR_NO_HANDLES);
399-
400396
GTK3.gtk_container_add(handle, boxHandle);
401397
GTK3.gtk_container_add(boxHandle, imageHandle);
402398
GTK3.gtk_container_add(boxHandle, labelHandle);
@@ -1160,13 +1156,13 @@ private void _setImage (Image image) {
11601156
long pixbuf = ImageList.createPixbuf(image);
11611157
long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
11621158
OS.g_object_unref(pixbuf);
1163-
GTK4.gtk_picture_set_paintable(imageHandle, texture);
1159+
GTK4.gtk_image_set_from_paintable(imageHandle, texture);
11641160
} else {
11651161
GTK3.gtk_image_set_from_surface(imageHandle, image.surface);
11661162
}
11671163
} else {
11681164
if (GTK.GTK4) {
1169-
GTK4.gtk_picture_set_paintable(imageHandle, 0);
1165+
GTK4.gtk_image_set_from_paintable(imageHandle, 0);
11701166
} else {
11711167
GTK3.gtk_image_set_from_surface(imageHandle, 0);
11721168
}

0 commit comments

Comments
 (0)