Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move: Check if grid is enabled before activating edges on drag #2404

Merged
merged 1 commit into from
Jul 27, 2024
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
8 changes: 8 additions & 0 deletions plugins/grid/grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,16 @@ class wayfire_grid : public wf::plugin_interface_t, public wf::per_output_tracke
return false;
});
}

wf::get_core().connect(&grid_request_signal_cb);
}

wf::signal::connection_t<wf::grid::grid_request_signal> grid_request_signal_cb =
[=] (wf::grid::grid_request_signal *ev)
{
ev->carried_out = true;
};

void handle_new_output(wf::output_t *output) override
{
output->connect(&on_workarea_changed);
Expand Down
12 changes: 12 additions & 0 deletions plugins/grid/wayfire/plugins/grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ namespace wf
{
namespace grid
{
/**
* name: request
* on: core
* when: Emitted before move renders a grid indicator and sets the slot.
* carried_out: true if a plugin can handle move request to grid.
*/
struct grid_request_signal
{
/* True if a plugin handled this signal */
bool carried_out = false;
};

/**
* The slot where a view can be placed with grid.
* BL = bottom-left, TR = top-right, etc.
Expand Down
11 changes: 10 additions & 1 deletion plugins/single_plugins/move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,16 @@ class wayfire_move : public wf::per_output_plugin_instance_t,
slot.preview = nullptr;
}

slot.slot_id = new_slot_id;
wf::grid::grid_request_signal grid_signal;
wf::get_core().emit(&grid_signal);

if (grid_signal.carried_out || (new_slot_id == wf::grid::slot_t::SLOT_CENTER))
{
slot.slot_id = new_slot_id;
} else
{
slot.slot_id = new_slot_id = wf::grid::slot_t::SLOT_NONE;
}

/* Show a preview overlay */
if (new_slot_id)
Expand Down
Loading