Skip to content

Commit

Permalink
scale-title-filter: delay filter to next idle
Browse files Browse the repository at this point in the history
Fixes #1850

The problem with the filter is that it gets the closing keybinding
before scale has ended, so briefly updates the filter and messes up with
the view state.
  • Loading branch information
ammen99 committed Aug 24, 2023
1 parent be900ae commit eb69037
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions plugins/scale/scale-title-filter.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "wayfire/plugins/common/shared-core-data.hpp"
#include "wayfire/util.hpp"
#include <string>
#include <map>
#include <wayfire/plugin.hpp>
Expand Down Expand Up @@ -187,14 +188,20 @@ class scale_title_filter : public wf::per_output_plugin_instance_t
return true;
};

wf::wl_idle_call idle_update_filter;

void update_filter()
{
if (scale_running)
// Delay updating the filter in case the last key causes scale to exit.
idle_update_filter.run_once([&]
{
scale_update_signal ev;
output->emit(&ev);
update_overlay();
}
if (scale_running)
{
scale_update_signal ev;
output->emit(&ev);
update_overlay();
}
});
}

wf::signal::connection_t<wf::input_event_signal<wlr_keyboard_key_event>> scale_key =
Expand Down

0 comments on commit eb69037

Please sign in to comment.