diff options
author | networkException <git@nwex.de> | 2022-06-01 08:49:01 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-06-01 12:33:06 +0100 |
commit | 524f4be5afc68c39e6ae40526919fa23885dd8d3 (patch) | |
tree | 2201b2d64a524a2fbaea3cb50f56dfd9d250ae5f /Userland/Services | |
parent | cc9afeab41138112f67862b26b53941990cce04c (diff) | |
download | serenity-524f4be5afc68c39e6ae40526919fa23885dd8d3.zip |
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.
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/WindowServer/ConnectionFromClient.cpp | 3 | ||||
-rw-r--r-- | Userland/Services/WindowServer/ConnectionFromClient.h | 2 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowServer.ipc | 13 |
3 files changed, 15 insertions, 3 deletions
diff --git a/Userland/Services/WindowServer/ConnectionFromClient.cpp b/Userland/Services/WindowServer/ConnectionFromClient.cpp index e36c2d2774..6f3f642a7f 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.cpp +++ b/Userland/Services/WindowServer/ConnectionFromClient.cpp @@ -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); diff --git a/Userland/Services/WindowServer/ConnectionFromClient.h b/Userland/Services/WindowServer/ConnectionFromClient.h index 1a87563b9c..7783621aef 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.h +++ b/Userland/Services/WindowServer/ConnectionFromClient.h @@ -96,7 +96,7 @@ private: virtual void add_menu(i32, i32) override; virtual void add_menu_item(i32, i32, i32, String const&, bool, bool, bool, bool, String const&, Gfx::ShareableBitmap const&, bool) override; virtual void add_menu_separator(i32) override; - virtual void update_menu_item(i32, i32, i32, String const&, bool, bool, bool, bool, String const&) override; + virtual void update_menu_item(i32, i32, i32, String const&, bool, bool, bool, bool, String const&, Gfx::ShareableBitmap const&) override; virtual void remove_menu_item(i32 menu_id, i32 identifier) override; virtual void flash_menubar_menu(i32, i32) override; virtual void create_window(i32, Gfx::IntRect const&, bool, bool, bool, bool, bool, diff --git a/Userland/Services/WindowServer/WindowServer.ipc b/Userland/Services/WindowServer/WindowServer.ipc index 91f69a4467..8ac33007eb 100644 --- a/Userland/Services/WindowServer/WindowServer.ipc +++ b/Userland/Services/WindowServer/WindowServer.ipc @@ -23,7 +23,18 @@ endpoint WindowServer add_menu_separator(i32 menu_id) =| - update_menu_item(i32 menu_id, i32 identifier, i32 submenu_id, [UTF8] String text, bool enabled, bool checkable, bool checked, bool is_default, [UTF8] String shortcut) =| + update_menu_item( + i32 menu_id, + i32 identifier, + i32 submenu_id, + [UTF8] String text, + bool enabled, + bool checkable, + bool checked, + bool is_default, + [UTF8] String shortcut, + Gfx::ShareableBitmap icon) =| + remove_menu_item(i32 menu_id, i32 identifier) =| flash_menubar_menu(i32 window_id, i32 menu_id) =| |