MCPcopy Create free account
hub / github.com/WayfireWM/wayfire / move_view

Function move_view

plugins/vswitch/vswitch.cpp:31–58  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

29 * @relative flag tells us if @to_ws is relative to current workspace or not.
30 */
31static 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.

Callers 2

initMethod · 0.85

Calls 7

get_wsetMethod · 0.80
enumerate_viewsMethod · 0.80
move_to_workspaceMethod · 0.45
get_outputMethod · 0.45
emitMethod · 0.45
refocusMethod · 0.45

Tested by

no test coverage detected