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 | |
parent | 1132efe42e8086216c7bab6b405d09a22231dde5 (diff) |
Implement floating
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/cursor.c | 3 | ||||
-rw-r--r-- | sway/input/seat.c | 16 |
2 files changed, 16 insertions, 3 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 6751931d..96bf574c 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -108,6 +108,9 @@ static struct sway_container *container_at_coords( } struct sway_container *c; + if ((c = floating_container_at(x, y, surface, sx, sy))) { + return c; + } if ((c = container_at(ws, ox, oy, surface, sx, sy))) { return c; } 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, static struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, struct sway_container *container, enum sway_container_type type) { - if (container->type == C_VIEW || container->children->length == 0) { + if (container->type == C_VIEW) { + return container; + } + + struct sway_container *floating = container->type == C_WORKSPACE ? + container->sway_workspace->floating : NULL; + if (container->children->length == 0 && + (!floating || floating->children->length == 0)) { return container; } @@ -126,6 +133,9 @@ static struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, if (container_has_child(container, current->container)) { return current->container; } + if (floating && container_has_child(floating, current->container)) { + return current->container; + } } return NULL; @@ -568,7 +578,7 @@ void seat_set_focus_warp(struct sway_seat *seat, // clean up unfocused empty workspace on new output if (new_output_last_ws) { if (!workspace_is_visible(new_output_last_ws) - && new_output_last_ws->children->length == 0) { + && workspace_is_empty(new_output_last_ws)) { if (last_workspace == new_output_last_ws) { last_focus = NULL; last_workspace = NULL; @@ -581,7 +591,7 @@ void seat_set_focus_warp(struct sway_seat *seat, if (last_workspace) { ipc_event_workspace(last_workspace, container, "focus"); if (!workspace_is_visible(last_workspace) - && last_workspace->children->length == 0) { + && workspace_is_empty(last_workspace)) { if (last_workspace == last_focus) { last_focus = NULL; } |