From 81dcf7de91c1866d565f7aa9eb38f7fbd1cd7ad7 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 25 Jul 2025 20:27:44 +0530 Subject: Add decoration is_enabled api + allowed specifying win_id for enabled --- src/WindowActionRouter.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/WindowActionRouter.cpp') diff --git a/src/WindowActionRouter.cpp b/src/WindowActionRouter.cpp index ba479f0..3a11134 100644 --- a/src/WindowActionRouter.cpp +++ b/src/WindowActionRouter.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include "LuaRuntime.hpp" @@ -94,11 +95,12 @@ void WindowActionRouter::initialize(Configuration *config) { [this](WebViewId webview_id) { WITH_WEBVIEW_WINDOW(webview_id, window, { window->scroll_to_bottom(webview_id); }); }); + + // Decoration connect(&runtime, &LuaRuntime::decoration_set_enabled, this, - [this](DecorationType type, bool enabled) { - qDebug() << "routing" << type << enabled << window_map.size(); - for (auto &win_match : window_map) - win_match.second->set_decoration_enabled(type, enabled); + [this](DecorationType type, bool enabled, std::optional win_id) { + for (auto *win : get_windows_for_optional_win_id(win_id)) + win->set_decoration_enabled(type, enabled); }); } @@ -165,3 +167,10 @@ QList WindowActionRouter::fetch_webview_data_list(WindowId win_id) KeyMode WindowActionRouter::fetch_current_mode() const { return KeymapEvaluator::instance().get_current_mode(); } + +bool WindowActionRouter::fetch_is_decoration_enabled(DecorationType type, WindowId win_id) { + auto windows = get_windows_for_optional_win_id(std::make_optional(win_id)); + for (auto *win : windows) + return win->get_decoration_enabled(type); + return false; +} -- cgit v1.3.1