Skip to content

[Gtk4] Fix Button image size by using GtkPicture instead of GtkImage#3323

Open
akurtakov wants to merge 1 commit into
eclipse-platform:masterfrom
akurtakov:colorbutton
Open

[Gtk4] Fix Button image size by using GtkPicture instead of GtkImage#3323
akurtakov wants to merge 1 commit into
eclipse-platform:masterfrom
akurtakov:colorbutton

Conversation

@akurtakov
Copy link
Copy Markdown
Member

Gtk 4 works in logical points while Cairo works in pixel thus this is needed for proper size of the pixbuf scale to the original image size.

This makes Button consistent with Label, which already uses GtkPicture for the same reason (see commit
#2766 ).

Also fix a memory leak in Label where the GdkTexture created by gdk_texture_new_for_pixbuf() was not unreffed after being handed to gtk_picture_set_paintable().

Gtk 4 works in logical points while Cairo works in pixel thus this is
needed for proper size of the pixbuf scale to the original image size.

This makes Button consistent with Label, which already uses GtkPicture
for the same reason (see commit
eclipse-platform#2766 ).

Also fix a memory leak in Label where the GdkTexture
created by gdk_texture_new_for_pixbuf() was not unreffed after being
handed to gtk_picture_set_paintable().
@akurtakov
Copy link
Copy Markdown
Member Author

Before:
Screenshot From 2026-05-25 18-19-42
After:
Screenshot From 2026-05-25 18-20-32

@akurtakov akurtakov self-assigned this May 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Test Results (linux)

   94 files  ±0     94 suites  ±0   14m 29s ⏱️ +6s
4 597 tests ±0  4 373 ✅ ±0  224 💤 ±0  0 ❌ ±0 
3 383 runs  ±0  3 308 ✅ ±0   75 💤 ±0  0 ❌ ±0 

Results for commit 6fa51a6. ± Comparison against base commit 2e79e2b.

akurtakov added a commit to akurtakov/eclipse.platform.swt that referenced this pull request May 26, 2026
GTK4 works in logical points while Cairo works in pixels, causing images
to appear smaller at HiDPI scaling. Using GtkPicture (instead of
GtkImage)
correctly maps the pixbuf to the right display size.

This is the same fix applied to Button
(eclipse-platform#3323 )
and Label
(eclipse-platform#2766
) for the same reason.
Copy link
Copy Markdown
Contributor

@jonahgraham jonahgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved (for when master reopens)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants