diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-03 15:42:32 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-04-04 18:47:48 -0400 |
commit | 3ede718c06194651146f05de4d8889620b159f87 (patch) | |
tree | 481144a57e747146cbf2a82eb17bee510a8036b3 | |
parent | 62a736a1961db42acefc4c5746c0f080b152f2b6 (diff) |
Refocus the last focused container on lock exit
-rw-r--r-- | sway/input/seat.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index 4a99e9eb..a6b42598 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -424,11 +424,18 @@ void seat_set_focus(struct sway_seat *seat, void seat_set_focus_layer(struct sway_seat *seat, struct wlr_layer_surface *layer) { - if (!layer) { + if (!layer && seat->focused_layer) { seat->focused_layer = NULL; + struct sway_container *c = seat_get_focus(seat); + if (c) { + wlr_log(L_DEBUG, "Returning focus to %p %s '%s'", c, + container_type_to_str(c->type), c->name); + // Hack to get seat to re-focus the return value of get_focus + seat_set_focus(seat, c->parent); + seat_set_focus(seat, c); + } return; - } - if (seat->focused_layer == layer) { + } else if (!layer || seat->focused_layer == layer) { return; } if (seat->has_focus) { |