From b31b904ad01f771d385c3b4b3575203a20a46578 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 26 Mar 2021 14:42:24 +0100 Subject: [PATCH] WindowServer: Redraw all menus on system theme change --- Userland/Services/WindowServer/ClientConnection.h | 8 ++++++++ Userland/Services/WindowServer/MenuManager.cpp | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/Userland/Services/WindowServer/ClientConnection.h b/Userland/Services/WindowServer/ClientConnection.h index 8e2ecd43db..6ee7fe7456 100644 --- a/Userland/Services/WindowServer/ClientConnection.h +++ b/Userland/Services/WindowServer/ClientConnection.h @@ -84,6 +84,14 @@ public: break; } } + template + void for_each_menu(Callback callback) + { + for (auto& it : m_menus) { + if (callback(*it.value) == IterationDecision::Break) + break; + } + } void notify_display_link(Badge); diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp index 4731a55317..2bf48cf81f 100644 --- a/Userland/Services/WindowServer/MenuManager.cpp +++ b/Userland/Services/WindowServer/MenuManager.cpp @@ -103,6 +103,13 @@ void MenuManager::refresh() return; draw(); window().invalidate(); + + ClientConnection::for_each_client([&](ClientConnection& client) { + client.for_each_menu([&](Menu& menu) { + menu.redraw(); + return IterationDecision::Continue; + }); + }); } void MenuManager::event(Core::Event& event)