diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2019-01-10 22:04:42 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2019-01-10 22:04:42 +1000 |
commit | ed5aafd90bd850ad27dcb36ac4438ed926480394 (patch) | |
tree | 46d0b5fe8488e5d9415cbc9a732e86c1e7100ffe /sway/tree/container.c | |
parent | Merge pull request #3341 from RedSoxFan/mouse-bindings-improved (diff) | |
download | sway-ed5aafd90bd850ad27dcb36ac4438ed926480394.tar.gz sway-ed5aafd90bd850ad27dcb36ac4438ed926480394.tar.zst sway-ed5aafd90bd850ad27dcb36ac4438ed926480394.zip |
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/container.c')
-rw-r--r-- | sway/tree/container.c | 23 |
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) { | |||
864 | void container_end_mouse_operation(struct sway_container *container) { | 864 | void container_end_mouse_operation(struct sway_container *container) { |
865 | struct sway_seat *seat; | 865 | struct sway_seat *seat; |
866 | wl_list_for_each(seat, &server.input->seats, link) { | 866 | wl_list_for_each(seat, &server.input->seats, link) { |
867 | if (seat->op_container == container) { | 867 | seatop_unref(seat, container); |
868 | seat->op_target_node = NULL; // ensure tiling move doesn't apply | ||
869 | seat_end_mouse_operation(seat); | ||
870 | } | ||
871 | // If the user is doing a tiling drag over this container, | ||
872 | // keep the operation active but unset the target container. | ||
873 | if (seat->op_target_node == &container->node) { | ||
874 | seat->op_target_node = NULL; | ||
875 | } | ||
876 | } | 868 | } |
877 | } | 869 | } |
878 | 870 | ||
@@ -1384,3 +1376,16 @@ void container_update_marks_textures(struct sway_container *con) { | |||
1384 | &config->border_colors.urgent); | 1376 | &config->border_colors.urgent); |
1385 | container_damage_whole(con); | 1377 | container_damage_whole(con); |
1386 | } | 1378 | } |
1379 | |||
1380 | void container_raise_floating(struct sway_container *con) { | ||
1381 | // Bring container to front by putting it at the end of the floating list. | ||
1382 | struct sway_container *floater = con; | ||
1383 | while (floater->parent) { | ||
1384 | floater = floater->parent; | ||
1385 | } | ||
1386 | if (container_is_floating(floater)) { | ||
1387 | list_move_to_end(floater->workspace->floating, floater); | ||
1388 | node_set_dirty(&floater->workspace->node); | ||
1389 | } | ||
1390 | } | ||
1391 | |||