Skip to content

Commit

Permalink
core: add move_view_to_output overload that takes flags
Browse files Browse the repository at this point in the history
  • Loading branch information
lcolitti committed Apr 12, 2024
1 parent 29bed6e commit 8559fb7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
29 changes: 25 additions & 4 deletions src/api/wayfire/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,32 @@ class compositor_core_t : public wf::object_base_t, public signal::provider_t
};

/**
* Change the view's output to new_output. If the reconfigure flag is
* set, it will adjust the view geometry for the new output and clamp
* it to the output geometry so it is at an expected size and position.
* Flags for move_view_to_output.
*/
void move_view_to_output(wayfire_toplevel_view v, wf::output_t *new_output, bool reconfigure);
enum
{
/**
* Adjust the view geometry for the new output and clamp it to the output geometry so it is
* at an expected size and position.
*/
VIEW_TO_OUTPUT_FLAG_RECONFIGURE = 1 << 0,
};

/**
* Change the view's output to new_output.
*/
void move_view_to_output(wayfire_toplevel_view v, wf::output_t *new_output, unsigned flags);

/**
* Change the view's output to new_output. Equivalent to calling the move_view_to_output with
* the RECONFIGURE flag set to the specified value and no other flags set.
*/
inline void move_view_to_output(wayfire_toplevel_view v, wf::output_t *new_output,
bool reconfigure)
{
unsigned flags = reconfigure ? VIEW_TO_OUTPUT_FLAG_RECONFIGURE : 0;
move_view_to_output(v, new_output, flags);
}

/**
* Start a move of a view to a new workspace set (and thus potentially to a new output).
Expand Down
3 changes: 2 additions & 1 deletion src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,14 @@ void wf::start_move_view_to_wset(wayfire_toplevel_view v, std::shared_ptr<wf::wo
new_wset->add_view(v);
}

void wf::move_view_to_output(wayfire_toplevel_view v, wf::output_t *new_output, bool reconfigure)
void wf::move_view_to_output(wayfire_toplevel_view v, wf::output_t *new_output, unsigned flags)
{
auto old_output = v->get_output();
auto old_wset = v->get_wset();

uint32_t edges;
bool fullscreen;
bool reconfigure = flags & VIEW_TO_OUTPUT_FLAG_RECONFIGURE;
wf::geometry_t view_g;
wf::geometry_t old_output_g;
wf::geometry_t new_output_g;
Expand Down

0 comments on commit 8559fb7

Please sign in to comment.