Skip to content

Commit

Permalink
grid: react to changes in tiled edges from outside grid
Browse files Browse the repository at this point in the history
Fixes #838
  • Loading branch information
ammen99 committed Aug 27, 2023
1 parent 299215e commit e557d24
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions plugins/grid/grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <wayfire/plugins/wobbly/wobbly-signal.hpp>
#include <wayfire/view-transform.hpp>
#include "plugins/ipc/ipc-activator.hpp"
#include "wayfire/signal-provider.hpp"

const std::string grid_view_id = "grid-view";

Expand Down Expand Up @@ -109,6 +110,7 @@ class wayfire_grid : public wf::plugin_interface_t, public wf::per_output_tracke
output->connect(&on_workarea_changed);
output->connect(&on_maximize_signal);
output->connect(&on_fullscreen_signal);
output->connect(&on_tiled);
}

void handle_output_removed(wf::output_t *output) override
Expand Down Expand Up @@ -218,6 +220,20 @@ class wayfire_grid : public wf::plugin_interface_t, public wf::per_output_tracke
ensure_grid_view(data->view)->adjust_target_geometry(
adjust_for_workspace(data->view->get_wset(), data->desired_size, data->workspace), -1);
};

wf::signal::connection_t<wf::view_tiled_signal> on_tiled = [=] (wf::view_tiled_signal *ev)
{
if (!ev->view->has_data<wf_grid_slot_data>())
{
return;
}

auto data = ev->view->get_data_safe<wf_grid_slot_data>();
if (ev->new_edges != wf::grid::get_tiled_edges_for_slot(data->slot))
{
ev->view->erase_data<wf_grid_slot_data>();
}
};
};

DECLARE_WAYFIRE_PLUGIN(wayfire_grid);

0 comments on commit e557d24

Please sign in to comment.