diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-24 22:30:44 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-01 23:14:58 +1000 |
commit | 1f2e399ade77070a2d0b82856ad9a3eef96b8676 (patch) | |
tree | c469197e140051aea912cb173723c7e55ce1e410 /sway/input/seat.c | |
parent | Send frame done to floating views (diff) | |
download | sway-1f2e399ade77070a2d0b82856ad9a3eef96b8676.tar.gz sway-1f2e399ade77070a2d0b82856ad9a3eef96b8676.tar.zst sway-1f2e399ade77070a2d0b82856ad9a3eef96b8676.zip |
Implement floating
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index 0295212c..6a266fba 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -113,7 +113,14 @@ static void seat_send_focus(struct sway_container *con, | |||
113 | 113 | ||
114 | static struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, | 114 | static struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, |
115 | struct sway_container *container, enum sway_container_type type) { | 115 | struct sway_container *container, enum sway_container_type type) { |
116 | if (container->type == C_VIEW || container->children->length == 0) { | 116 | if (container->type == C_VIEW) { |
117 | return container; | ||
118 | } | ||
119 | |||
120 | struct sway_container *floating = container->type == C_WORKSPACE ? | ||
121 | container->sway_workspace->floating : NULL; | ||
122 | if (container->children->length == 0 && | ||
123 | (!floating || floating->children->length == 0)) { | ||
117 | return container; | 124 | return container; |
118 | } | 125 | } |
119 | 126 | ||
@@ -126,6 +133,9 @@ static struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, | |||
126 | if (container_has_child(container, current->container)) { | 133 | if (container_has_child(container, current->container)) { |
127 | return current->container; | 134 | return current->container; |
128 | } | 135 | } |
136 | if (floating && container_has_child(floating, current->container)) { | ||
137 | return current->container; | ||
138 | } | ||
129 | } | 139 | } |
130 | 140 | ||
131 | return NULL; | 141 | return NULL; |
@@ -568,7 +578,7 @@ void seat_set_focus_warp(struct sway_seat *seat, | |||
568 | // clean up unfocused empty workspace on new output | 578 | // clean up unfocused empty workspace on new output |
569 | if (new_output_last_ws) { | 579 | if (new_output_last_ws) { |
570 | if (!workspace_is_visible(new_output_last_ws) | 580 | if (!workspace_is_visible(new_output_last_ws) |
571 | && new_output_last_ws->children->length == 0) { | 581 | && workspace_is_empty(new_output_last_ws)) { |
572 | if (last_workspace == new_output_last_ws) { | 582 | if (last_workspace == new_output_last_ws) { |
573 | last_focus = NULL; | 583 | last_focus = NULL; |
574 | last_workspace = NULL; | 584 | last_workspace = NULL; |
@@ -581,7 +591,7 @@ void seat_set_focus_warp(struct sway_seat *seat, | |||
581 | if (last_workspace) { | 591 | if (last_workspace) { |
582 | ipc_event_workspace(last_workspace, container, "focus"); | 592 | ipc_event_workspace(last_workspace, container, "focus"); |
583 | if (!workspace_is_visible(last_workspace) | 593 | if (!workspace_is_visible(last_workspace) |
584 | && last_workspace->children->length == 0) { | 594 | && workspace_is_empty(last_workspace)) { |
585 | if (last_workspace == last_focus) { | 595 | if (last_workspace == last_focus) { |
586 | last_focus = NULL; | 596 | last_focus = NULL; |
587 | } | 597 | } |