1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
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<wf::config::option_t<T>>(previous))
- {
- auto option = std::make_shared<wf::config::option_t<T>>(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;
|