Skip to content

Commit

Permalink
toplevel-view: emit move_to_wset() when changing to a dialog
Browse files Browse the repository at this point in the history
The view is technically moved to a NULL wset.
  • Loading branch information
ammen99 committed Feb 14, 2024
1 parent d02f4ef commit 0c521aa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api/wayfire/signal-definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ struct view_pre_moved_to_wset_signal
wayfire_toplevel_view view;
/* The old wset the view was on, may be NULL. */
std::shared_ptr<wf::workspace_set_t> old_wset;
/* The new wset the view is being moved to. */
/* The new wset the view is being moved to, may be NULL. */
std::shared_ptr<wf::workspace_set_t> new_wset;
};

Expand All @@ -686,7 +686,7 @@ struct view_moved_to_wset_signal
wayfire_toplevel_view view;
/* The old wset the view was on, may be NULL. */
std::shared_ptr<wf::workspace_set_t> old_wset;
/* The new wset the view is being moved to. */
/* The new wset the view is being moved to, may be NULL. */
std::shared_ptr<wf::workspace_set_t> new_wset;
};

Expand Down
12 changes: 12 additions & 0 deletions src/view/toplevel-view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,19 @@ void wf::toplevel_view_interface_t::set_toplevel_parent(wayfire_toplevel_view ne
/* Make sure the view is available only as a child */
if (this->get_wset())
{
wf::view_pre_moved_to_wset_signal pre_move_to_wset;
pre_move_to_wset.view = {this};
pre_move_to_wset.old_wset = get_wset();
pre_move_to_wset.new_wset = nullptr;
wf::get_core().emit(&pre_move_to_wset);

get_wset()->remove_view({this});

wf::view_moved_to_wset_signal move_to_wset;
move_to_wset.view = {this};
move_to_wset.old_wset = pre_move_to_wset.old_wset;
move_to_wset.new_wset = nullptr;
wf::get_core().emit(&move_to_wset);
}

this->set_output(parent->get_output());
Expand Down

0 comments on commit 0c521aa

Please sign in to comment.