1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:37:42 +00:00

LibGUI+WindowServer: Propagate action icon changes to buttons and menus

Previously when setting an action's icon we would only change the bitmap
stored by the action. This patch adds logic to propagate that change to
toolbar buttons as well as window menus.

This fixes an issue in SoundPlayer that would cause the play button not
to reflect the play state.
This commit is contained in:
networkException 2022-06-01 08:49:01 +02:00 committed by Linus Groh
parent cc9afeab41
commit 524f4be5af
5 changed files with 25 additions and 4 deletions

View file

@ -170,7 +170,7 @@ void ConnectionFromClient::dismiss_menu(i32 menu_id)
void ConnectionFromClient::update_menu_item(i32 menu_id, i32 identifier, [[maybe_unused]] i32 submenu_id,
String const& text, bool enabled, bool checkable, bool checked, bool is_default,
String const& shortcut)
String const& shortcut, Gfx::ShareableBitmap const& icon)
{
auto it = m_menus.find(menu_id);
if (it == m_menus.end()) {
@ -183,6 +183,7 @@ void ConnectionFromClient::update_menu_item(i32 menu_id, i32 identifier, [[maybe
did_misbehave("UpdateMenuItem: Bad menu item identifier");
return;
}
menu_item->set_icon(icon.bitmap());
menu_item->set_text(text);
menu_item->set_shortcut_text(shortcut);
menu_item->set_enabled(enabled);