Skip to content

[Gtk4] Support MenuItem images on GTK4#3441

Draft
akurtakov wants to merge 1 commit into
eclipse-platform:masterfrom
akurtakov:gtk4-menu-icons
Draft

[Gtk4] Support MenuItem images on GTK4#3441
akurtakov wants to merge 1 commit into
eclipse-platform:masterfrom
akurtakov:gtk4-menu-icons

Conversation

@akurtakov

Copy link
Copy Markdown
Member

GtkModelButton (GTK4's native menu row) never shows both an icon and text, so PUSH menu items with images rendered without their icon. Work around this by embedding a custom icon+label(+accelerator) GtkButton into the popover via gtk_popover_menu_add_child() for PUSH items.

CASCADE, CHECK and RADIO items keep the native GtkModelButton, since GTK ties their submenu link / selection indicator to it and there is no way to reproduce that in a custom widget.

Injection is self-healing: GTK's "custom" ids are single-use once their placeholder slot is destroyed (e.g. by menu repopulation), so a detached widget is re-injected under a fresh id rather than reusing the stale one, which previously left dynamically-rebuilt items (like Run/Debug) invisible.

WIP towards #2511

GtkModelButton (GTK4's native menu row) never shows both an icon and
text, so PUSH menu items with images rendered without their icon. Work
around this by embedding a custom icon+label(+accelerator) GtkButton
into the popover via gtk_popover_menu_add_child() for PUSH items.

CASCADE, CHECK and RADIO items keep the native GtkModelButton, since
GTK ties their submenu link / selection indicator to it and there is
no way to reproduce that in a custom widget.

Injection is self-healing: GTK's "custom" ids are single-use once
their placeholder slot is destroyed (e.g. by menu repopulation), so a
detached widget is re-injected under a fresh id rather than reusing
the stale one, which previously left dynamically-rebuilt items (like
Run/Debug) invisible.

Fixes eclipse-platform#2511

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@akurtakov akurtakov marked this pull request as draft July 15, 2026 16:36
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

  200 files  ±0    200 suites  ±0   32m 11s ⏱️ + 3m 48s
4 744 tests ±0  4 720 ✅ ±0   24 💤 ±0  0 ❌ ±0 
6 892 runs  ±0  6 724 ✅ ±0  168 💤 ±0  0 ❌ ±0 

Results for commit b3a1087. ± Comparison against base commit 17dedb3.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant