aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2019-01-10 22:04:42 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2019-01-10 22:04:42 +1000
commited5aafd90bd850ad27dcb36ac4438ed926480394 (patch)
tree46d0b5fe8488e5d9415cbc9a732e86c1e7100ffe /sway/tree
parent15ac580b28a2906d799fd709e83cb75e0efc3f45 (diff)
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
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c23
1 files changed, 14 insertions, 9 deletions
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);
+ }
+}
+