Skip to content

Commit

Permalink
decoration: do not schedule unnecessary transactions (#2586)
Browse files Browse the repository at this point in the history
  • Loading branch information
ammen99 authored Feb 24, 2025
1 parent fe62fa9 commit 1ffea66
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions plugins/decor/decoration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,28 @@ class wayfire_decoration : public wf::plugin_interface_t
pending.margins = {0, 0, 0, 0};
}

bool is_toplevel_decorated(const std::shared_ptr<wf::toplevel_t>& toplevel)
{
return toplevel->has_data<wf::simple_decorator_t>();
}

void update_view_decoration(wayfire_view view)
{
if (auto toplevel = wf::toplevel_cast(view))
{
if (should_decorate_view(toplevel))
const bool wants_decoration = should_decorate_view(toplevel);
if (wants_decoration != is_toplevel_decorated(toplevel->toplevel()))
{
adjust_new_decorations(toplevel);
} else
{
remove_decoration(toplevel);
}
if (wants_decoration)
{
adjust_new_decorations(toplevel);
} else
{
remove_decoration(toplevel);
}

wf::get_core().tx_manager->schedule_object(toplevel->toplevel());
wf::get_core().tx_manager->schedule_object(toplevel->toplevel());
}
}
}
};
Expand Down

0 comments on commit 1ffea66

Please sign in to comment.