Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metadata/animate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<option name="startup_duration" type="animation">
<_short>System fade duration when Wayfire starts</_short>
<_long>Sets the duration of fading (in milliseconds) when Wayfire starts.</_long>
<default>600ms linear</default>
<default>250ms linear</default>
</option>
<!-- Fade animation -->
<option name="fade_enabled_for" type="string">
Expand Down
32 changes: 32 additions & 0 deletions plugins/animate/animate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include <wayfire/signal-definitions.hpp>
#include <wayfire/render-manager.hpp>
#include <wayfire/workspace-set.hpp>
#include <wayfire/view-helpers.hpp>
#include <wayfire/core.hpp>
#include <wayfire/util.hpp>
#include "animate.hpp"
#include "plugins/common/wayfire/plugins/common/shared-core-data.hpp"
#include "system_fade.hpp"
Expand Down Expand Up @@ -202,6 +204,12 @@ class wayfire_animation : public wf::plugin_interface_t, private wf::per_output_

wf::shared_data::ref_ptr_t<wf::animate::animate_effects_registry_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<wf::output_t*, wf::wl_timer<false>> inhibit_timers;

template<class animation_t>
void register_effect(std::string name, wf::option_sptr_t<wf::animation_description_t> option)
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<wf::view_mapped_signal> 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);
Expand Down
26 changes: 6 additions & 20 deletions plugins/protocols/wayfire-shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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");
}
}

Expand Down
Loading