|
3 | 3 | #include <wayfire/signal-definitions.hpp> |
4 | 4 | #include <wayfire/render-manager.hpp> |
5 | 5 | #include <wayfire/workspace-set.hpp> |
| 6 | +#include <wayfire/view-helpers.hpp> |
6 | 7 | #include <wayfire/core.hpp> |
| 8 | +#include <wayfire/util.hpp> |
7 | 9 | #include "animate.hpp" |
8 | 10 | #include "plugins/common/wayfire/plugins/common/shared-core-data.hpp" |
9 | 11 | #include "system_fade.hpp" |
@@ -202,6 +204,12 @@ class wayfire_animation : public wf::plugin_interface_t, private wf::per_output_ |
202 | 204 |
|
203 | 205 | wf::shared_data::ref_ptr_t<wf::animate::animate_effects_registry_t> effects_registry; |
204 | 206 |
|
| 207 | + /** |
| 208 | + * Single-shot inhibit timer to uninhibit output rendering in case a |
| 209 | + * client fails to place a surface on the background layer in time. |
| 210 | + */ |
| 211 | + std::map<wf::output_t*, wf::wl_timer<false>> inhibit_timers; |
| 212 | + |
205 | 213 | template<class animation_t> |
206 | 214 | void register_effect(std::string name, wf::option_sptr_t<wf::animation_description_t> option) |
207 | 215 | { |
@@ -237,6 +245,11 @@ class wayfire_animation : public wf::plugin_interface_t, private wf::per_output_ |
237 | 245 | output->connect(&on_view_pre_unmap); |
238 | 246 | output->connect(&on_render_start); |
239 | 247 | output->connect(&on_minimize_request); |
| 248 | + output->render->add_inhibit(true); |
| 249 | + inhibit_timers[output].set_timeout(400, [=] () |
| 250 | + { |
| 251 | + output->render->add_inhibit(false); |
| 252 | + }); |
240 | 253 | } |
241 | 254 |
|
242 | 255 | void handle_output_removed(wf::output_t *output) override |
@@ -408,6 +421,21 @@ class wayfire_animation : public wf::plugin_interface_t, private wf::per_output_ |
408 | 421 | /* TODO: enhance - add more animations */ |
409 | 422 | wf::signal::connection_t<wf::view_mapped_signal> on_view_mapped = [=] (wf::view_mapped_signal *ev) |
410 | 423 | { |
| 424 | + /* If a client has attached a surface to the background layer, |
| 425 | + * uninhibit outputs which were inhibited when wayfire started. */ |
| 426 | + if (wf::get_view_layer(ev->view) == wf::scene::layer::BACKGROUND) |
| 427 | + { |
| 428 | + auto output = ev->view->get_output(); |
| 429 | + if (output) |
| 430 | + { |
| 431 | + if (inhibit_timers[output].is_connected()) |
| 432 | + { |
| 433 | + inhibit_timers[output].disconnect(); |
| 434 | + output->render->add_inhibit(false); |
| 435 | + } |
| 436 | + } |
| 437 | + } |
| 438 | + |
411 | 439 | auto animation = get_animation_for_view("open", open_animation, ev->view); |
412 | 440 | set_animation(ev->view, animation.animation_name, |
413 | 441 | wf::animate::ANIMATION_TYPE_MAP, animation.duration); |
|
0 commit comments