mirror of
https://github.com/miracle-wm-org/miracle-wm.git
synced 2024-12-02 08:48:07 +03:00
bugfix: issue where adding direction to new node was segfaulting
This commit is contained in:
parent
3cec993799
commit
5bc1830c56
@ -320,6 +320,7 @@ bool Node::move_node(int from, int to) {
|
||||
void Node::insert_node(std::shared_ptr<Node> node, int index)
|
||||
{
|
||||
auto position = new_node_position(index);
|
||||
node->parent = shared_from_this();
|
||||
node->set_rectangle(position);
|
||||
sub_nodes.insert(sub_nodes.begin() + index, node);
|
||||
}
|
@ -179,13 +179,13 @@ bool WindowTree::try_move_active_window(miracle::WindowMoveDirection direction)
|
||||
// get inserted into the parent node at the index before
|
||||
// the currently active lane.
|
||||
auto node_to_move = active_lane->get_sub_nodes()[node_index];
|
||||
advise_delete_window(node_to_move->get_window());
|
||||
|
||||
int active_lane_index = 0;
|
||||
for (; active_lane_index < parent->get_sub_nodes().size(); active_lane_index++)
|
||||
if (parent->get_sub_nodes()[active_lane_index] == active_lane)
|
||||
break;
|
||||
|
||||
advise_delete_window(node_to_move->get_window());
|
||||
parent->insert_node(node_to_move, active_lane_index);
|
||||
active_lane = parent;
|
||||
}
|
||||
@ -203,13 +203,13 @@ bool WindowTree::try_move_active_window(miracle::WindowMoveDirection direction)
|
||||
// get inserted into the parent node at the index before
|
||||
// the currently active lane.
|
||||
auto node_to_move = active_lane->get_sub_nodes()[node_index];
|
||||
advise_delete_window(node_to_move->get_window());
|
||||
|
||||
int active_lane_index = 0;
|
||||
for (; active_lane_index < parent->get_sub_nodes().size(); active_lane_index++)
|
||||
if (parent->get_sub_nodes()[active_lane_index] == active_lane)
|
||||
break;
|
||||
|
||||
advise_delete_window(node_to_move->get_window());
|
||||
parent->insert_node(node_to_move, active_lane_index + 1);
|
||||
active_lane = parent;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user