diff --git a/metadata/animate.xml b/metadata/animate.xml index 3626e418a..08817aa7e 100644 --- a/metadata/animate.xml +++ b/metadata/animate.xml @@ -94,7 +94,7 @@ <_short>System fade duration when Wayfire starts <_long>Sets the duration of fading (in milliseconds) when Wayfire starts. - 600ms linear + 250ms linear diff --git a/plugins/animate/animate.cpp b/plugins/animate/animate.cpp index e7c657992..d058206a0 100644 --- a/plugins/animate/animate.cpp +++ b/plugins/animate/animate.cpp @@ -3,7 +3,9 @@ #include #include #include +#include #include +#include #include "animate.hpp" #include "plugins/common/wayfire/plugins/common/shared-core-data.hpp" #include "system_fade.hpp" @@ -202,6 +204,12 @@ class wayfire_animation : public wf::plugin_interface_t, private wf::per_output_ wf::shared_data::ref_ptr_t effects_registry; + /** + * Single-shot inhibit timer to uninhibit output rendering in case a + * client fails to place a surface on the background layer in time. + */ + std::map> inhibit_timers; + template void register_effect(std::string name, wf::option_sptr_t option) { @@ -237,11 +245,20 @@ class wayfire_animation : public wf::plugin_interface_t, private wf::per_output_ output->connect(&on_view_pre_unmap); output->connect(&on_render_start); output->connect(&on_minimize_request); + if (startup_duration.value().length_ms != 0) + { + output->render->add_inhibit(true); + inhibit_timers[output].set_timeout(400, [=] () + { + output->render->add_inhibit(false); + }); + } } void handle_output_removed(wf::output_t *output) override { cleanup_views_on_output(output); + inhibit_timers.erase(output); } void fini() override @@ -408,6 +425,21 @@ class wayfire_animation : public wf::plugin_interface_t, private wf::per_output_ /* TODO: enhance - add more animations */ wf::signal::connection_t on_view_mapped = [=] (wf::view_mapped_signal *ev) { + /* If a client has attached a surface to the background layer, + * uninhibit outputs which were inhibited when wayfire started. */ + if (wf::get_view_layer(ev->view) == wf::scene::layer::BACKGROUND) + { + auto output = ev->view->get_output(); + if (output && inhibit_timers.count(output)) + { + if (inhibit_timers[output].is_connected()) + { + inhibit_timers[output].disconnect(); + output->render->add_inhibit(false); + } + } + } + auto animation = get_animation_for_view("open", open_animation, ev->view); set_animation(ev->view, animation.animation_name, wf::animate::ANIMATION_TYPE_MAP, animation.duration); diff --git a/plugins/protocols/wayfire-shell.cpp b/plugins/protocols/wayfire-shell.cpp index 975a16e14..ee8f38710 100644 --- a/plugins/protocols/wayfire-shell.cpp +++ b/plugins/protocols/wayfire-shell.cpp @@ -11,7 +11,6 @@ #include "wayfire/output.hpp" #include "wayfire/core.hpp" #include "wayfire/output-layout.hpp" -#include "wayfire/render-manager.hpp" #include "wayfire-shell-unstable-v2-protocol.h" #include "wayfire/signal-definitions.hpp" #include "wayfire/plugins/ipc/ipc-activator.hpp" @@ -204,7 +203,6 @@ struct wayfire_shell_toggle_menu_signal */ class wfs_output { - uint32_t num_inhibits = 0; wl_resource *shell_resource; wl_resource *resource; wf::output_t *output; @@ -271,13 +269,6 @@ class wfs_output } disconnect_from_output(); - /* Remove any remaining inhibits, otherwise the compositor will never - * be "unlocked" */ - while (num_inhibits > 0) - { - this->output->render->add_inhibit(false); - --num_inhibits; - } } wfs_output(const wfs_output &) = delete; @@ -287,26 +278,21 @@ class wfs_output void inhibit_output() { - ++this->num_inhibits; if (this->output) { - this->output->render->add_inhibit(true); + LOGW( + "Ignoring inhibit call, left in for historical reasons.\ + Wayfire now manages all inhibits internally"); } } void inhibit_output_done() { - if (this->num_inhibits == 0) - { - wl_resource_post_no_memory(resource); - - return; - } - - --this->num_inhibits; if (this->output) { - this->output->render->add_inhibit(false); + LOGW( + "Ignoring inhibit done call, left in for historical reasons.\ + Wayfire now manages all inhibits internally"); } }