diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-18 16:13:28 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-22 23:10:19 +1000 |
commit | 9fbe13b9be18c732b58033a57a22a299af91a170 (patch) | |
tree | a24901c1bb4eff87877c0d9fb96767b662a9d533 /sway/tree/container.c | |
parent | Merge pull request #2320 from RedSoxFan/reset-outputs-on-reload (diff) | |
download | sway-9fbe13b9be18c732b58033a57a22a299af91a170.tar.gz sway-9fbe13b9be18c732b58033a57a22a299af91a170.tar.zst sway-9fbe13b9be18c732b58033a57a22a299af91a170.zip |
Implement floating_modifier and mouse operations for floating views
This implements the following:
* `floating_modifier` configuration directive
* Drag a floating window by its title bar
* Hold mod + drag a floating window from anywhere
* Resize a floating view by dragging the border
* Resize a floating view by holding mod and right clicking anywhere on
the view
* Resize a floating view and keep aspect ratio by holding shift while
resizing using either method
* Mouse cursor turns into resize when hovering floating border or corner
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 4dbfbb29..ba4af352 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -323,6 +323,8 @@ static struct sway_container *container_destroy_noreaping( | |||
323 | } | 323 | } |
324 | } | 324 | } |
325 | 325 | ||
326 | container_end_mouse_operation(con); | ||
327 | |||
326 | con->destroying = true; | 328 | con->destroying = true; |
327 | container_set_dirty(con); | 329 | container_set_dirty(con); |
328 | 330 | ||
@@ -964,6 +966,8 @@ void container_set_floating(struct sway_container *container, bool enable) { | |||
964 | container_reap_empty_recursive(workspace->sway_workspace->floating); | 966 | container_reap_empty_recursive(workspace->sway_workspace->floating); |
965 | } | 967 | } |
966 | 968 | ||
969 | container_end_mouse_operation(container); | ||
970 | |||
967 | ipc_event_window(container, "floating"); | 971 | ipc_event_window(container, "floating"); |
968 | } | 972 | } |
969 | 973 | ||
@@ -1009,7 +1013,7 @@ void container_get_box(struct sway_container *container, struct wlr_box *box) { | |||
1009 | /** | 1013 | /** |
1010 | * Translate the container's position as well as all children. | 1014 | * Translate the container's position as well as all children. |
1011 | */ | 1015 | */ |
1012 | static void container_floating_translate(struct sway_container *con, | 1016 | void container_floating_translate(struct sway_container *con, |
1013 | double x_amount, double y_amount) { | 1017 | double x_amount, double y_amount) { |
1014 | con->x += x_amount; | 1018 | con->x += x_amount; |
1015 | con->y += y_amount; | 1019 | con->y += y_amount; |
@@ -1105,3 +1109,13 @@ static bool find_urgent_iterator(struct sway_container *con, | |||
1105 | bool container_has_urgent_child(struct sway_container *container) { | 1109 | bool container_has_urgent_child(struct sway_container *container) { |
1106 | return container_find(container, find_urgent_iterator, NULL); | 1110 | return container_find(container, find_urgent_iterator, NULL); |
1107 | } | 1111 | } |
1112 | |||
1113 | void container_end_mouse_operation(struct sway_container *container) { | ||
1114 | struct sway_seat *seat; | ||
1115 | wl_list_for_each(seat, &input_manager->seats, link) { | ||
1116 | if (seat->op_container == container) { | ||
1117 | seat->op_container = NULL; | ||
1118 | seat->operation = OP_NONE; | ||
1119 | } | ||
1120 | } | ||
1121 | } | ||