diff --git a/src/decoration.cpp b/src/decoration.cpp index f968de4..5eb6021 100644 --- a/src/decoration.cpp +++ b/src/decoration.cpp @@ -269,21 +269,6 @@ class wayfire_pixdecor : public wf::plugin_interface_t void init() override { - // Promote new options when replacing a module in an older resident core. - auto section = wf::get_core().config->get_section("pixdecor"); - auto promote = [&] (const std::string& name, auto value) - { - using T = decltype(value); - auto previous = section->get_option_or(name); - if (!std::dynamic_pointer_cast>(previous)) - { - auto option = std::make_shared>(name, value); - if (previous) option->set_value_str(previous->get_value_str()); - section->register_new_option(option); - } - }; - promote("border_depth", 0.65); - promote("follow_shell_theme", false); follow_theme.load_option("pixdecor/follow_shell_theme"); follow_shell_theme = follow_theme; follow_theme.set_callback([this] @@ -308,18 +293,19 @@ class wayfire_pixdecor : public wf::plugin_interface_t theme_methods->register_method("pixdecor/theme-configure", [this] (wf::json_t data, wf::ipc::client_interface_t *client) { + // Every IPC client is equally trusted, so the latest sender owns the + // theme; it is dropped again when that client disconnects. if (!client || !data.is_object() || !data["version"].is_int64() || data["version"].as_int64() != 1 || - !data["instance"].is_string() || data["instance"].as_string() != theme_instance || - (theme_owner && theme_owner != client)) - return wf::ipc::json_error("Unavailable theme owner or instance"); + !data["instance"].is_string() || data["instance"].as_string() != theme_instance) + return wf::ipc::json_error("Unavailable theme instance"); try { const auto next = parse_shell_palette(data); const auto signature = data.serialize(); + theme_owner = client; if (signature != theme_signature) { shell_palette = next; - theme_owner = client; theme_signature = signature; update_colors(); recreate_frames(); @@ -330,7 +316,6 @@ class wayfire_pixdecor : public wf::plugin_interface_t return wf::ipc::json_error(error.what()); } }); - promote("pinstripe_color", wf::color_t{90.0 / 255, 113.0 / 255, 129.0 / 255, 36.0 / 255}); border_depth.load_option("pixdecor/border_depth"); pinstripe_color.load_option("pixdecor/pinstripe_color"); auto& ol = wf::get_core().output_layout;