Fix undefined reference to nativeapi::Menu::Create() on Linux #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Linux platform implementation was missing several critical Menu and MenuItem factory methods and member functions that were declared in the header but not implemented, causing undefined reference errors during linking.
Problem
When building the menu_example or any code using the Menu API on Linux, the linker would fail with errors like:
This happened because the Linux implementation in
src/platform/linux/menu_linux.cpponly contained basic constructor/destructor and a few methods, while the macOS and Windows implementations had complete API coverage.Solution
Implemented the complete Menu and MenuItem API for Linux using GTK3 widgets:
Key additions:
Create()andCreateSeparator()with proper GTK widget creation based on MenuItemTypeSetText(),SetEnabled(),SetState(),SetAccelerator(),Trigger(), etc.AddItem(),GetItemCount(),ShowAsContextMenu(), etc.GTK Integration:
g_signal_emit_by_namefor menu item triggeringg_object_unrefand widget lifecycle handlingTesting
The Linux implementation now has complete feature parity with the declared interface and other platform implementations.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com/usr/lib/apt/methods/https(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.