From ed5aafd90bd850ad27dcb36ac4438ed926480394 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 10 Jan 2019 22:04:42 +1000 Subject: Refactor seat operations to use an interface This splits each seat operation (drag/move tiling/floating etc) into a separate file and introduces a struct sway_seatop_impl to abstract the operation. The move_tiling_threshold operation has been merged into move_tiling. The main logic for each operation is untouched aside from variable renames. The following previously-static functions have been made public: * node_at_coords * container_raise_floating * render_rect * premultiply_alpha * scale_box --- sway/tree/container.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'sway/tree') diff --git a/sway/tree/container.c b/sway/tree/container.c index 99262356..d9c721f5 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -864,15 +864,7 @@ bool container_has_urgent_child(struct sway_container *container) { void container_end_mouse_operation(struct sway_container *container) { struct sway_seat *seat; wl_list_for_each(seat, &server.input->seats, link) { - if (seat->op_container == container) { - seat->op_target_node = NULL; // ensure tiling move doesn't apply - seat_end_mouse_operation(seat); - } - // If the user is doing a tiling drag over this container, - // keep the operation active but unset the target container. - if (seat->op_target_node == &container->node) { - seat->op_target_node = NULL; - } + seatop_unref(seat, container); } } @@ -1384,3 +1376,16 @@ void container_update_marks_textures(struct sway_container *con) { &config->border_colors.urgent); container_damage_whole(con); } + +void container_raise_floating(struct sway_container *con) { + // Bring container to front by putting it at the end of the floating list. + struct sway_container *floater = con; + while (floater->parent) { + floater = floater->parent; + } + if (container_is_floating(floater)) { + list_move_to_end(floater->workspace->floating, floater); + node_set_dirty(&floater->workspace->node); + } +} + -- cgit v1.2.3