* A small helper function to move a view and its children to workspace @to_ws. * @relative flag tells us if @to_ws is relative to current workspace or not. */
| 29 | * @relative flag tells us if @to_ws is relative to current workspace or not. |
| 30 | */ |
| 31 | static void move_view(wayfire_toplevel_view view, wf::point_t to_ws, bool relative = false) |
| 32 | { |
| 33 | // Get the wset. |
| 34 | auto wset = view->get_wset(); |
| 35 | |
| 36 | // Coordinates for moving the view. |
| 37 | // We need from, because @to_ws can be relative |
| 38 | wf::point_t from, to; |
| 39 | from = wset->get_view_main_workspace(view); |
| 40 | to = (relative ? from : wf::point_t{0, 0}) + to_ws; |
| 41 | |
| 42 | // Move all the views of this view's tree, including unmapped ones. |
| 43 | for (auto& v : view->enumerate_views(false)) |
| 44 | { |
| 45 | wset->move_to_workspace(v, to); |
| 46 | } |
| 47 | |
| 48 | if (auto output = view->get_output()) |
| 49 | { |
| 50 | wf::view_change_workspace_signal signal; |
| 51 | signal.view = view; |
| 52 | signal.from = from; |
| 53 | signal.to = to; |
| 54 | output->emit(&signal); |
| 55 | } |
| 56 | |
| 57 | wf::get_core().seat->refocus(); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * A simple scenegraph node which draws a view at a fixed position and as an overlay over the workspace wall. |
no test coverage detected