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

@akurtakov
akurtakov marked this pull request as draft July 15, 2026 16:36
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Test Results

  212 files  ±0    212 suites  ±0   28m 19s ⏱️ +38s
4 894 tests ±0  4 870 ✅ ±0   24 💤 ±0  0 ❌ ±0 
7 065 runs  ±0  6 897 ✅ ±0  168 💤 ±0  0 ❌ ±0 

Results for commit 9f101f4. ± Comparison against base commit 97cba55.

♻️ This comment has been updated with latest results.

@akurtakov
akurtakov force-pushed the gtk4-menu-icons branch 6 times, most recently from 1cf6743 to 924149f Compare August 4, 2026 07:20
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

Assisted-by: Anthropic Claude Code (claude-sonnet-5)
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