| 52 | } |
| 53 | |
| 54 | nonstd::observer_ptr<view_node_t> find_first_view_in_direction( |
| 55 | nonstd::observer_ptr<tree_node_t> from, split_insertion_t direction) |
| 56 | { |
| 57 | auto window = from->geometry; |
| 58 | |
| 59 | /* Since nodes are arranged tightly into a grid, we can just find the |
| 60 | * proper edge and find the view there */ |
| 61 | wf::point_t point; |
| 62 | switch (direction) |
| 63 | { |
| 64 | case INSERT_ABOVE: |
| 65 | point = { |
| 66 | window.x + window.width / 2, |
| 67 | window.y - 1, |
| 68 | }; |
| 69 | break; |
| 70 | |
| 71 | case INSERT_BELOW: |
| 72 | point = { |
| 73 | window.x + window.width / 2, |
| 74 | window.y + window.height, |
| 75 | }; |
| 76 | break; |
| 77 | |
| 78 | case INSERT_LEFT: |
| 79 | point = { |
| 80 | window.x - 1, |
| 81 | window.y + window.height / 2, |
| 82 | }; |
| 83 | break; |
| 84 | |
| 85 | case INSERT_RIGHT: |
| 86 | point = { |
| 87 | window.x + window.width, |
| 88 | window.y + window.height / 2, |
| 89 | }; |
| 90 | break; |
| 91 | |
| 92 | default: |
| 93 | assert(false); |
| 94 | } |
| 95 | |
| 96 | auto root = from; |
| 97 | while (root->parent) |
| 98 | { |
| 99 | root = root->parent; |
| 100 | } |
| 101 | |
| 102 | return find_view_at(root, point); |
| 103 | } |
| 104 | |
| 105 | /* ------------------------ move_view_controller_t -------------------------- */ |
| 106 | move_view_controller_t::move_view_controller_t(wf::workspace_set_t *set, wayfire_toplevel_view grabbed_view) |
no test coverage detected