aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2019-02-22 23:09:39 -0500
committerDrew DeVault <sir@cmpwn.com>2019-02-25 17:10:04 -0500
commit41a771ae235d9062b8743ff632fbd747f13dac3b (patch)
tree664f7d49c2ce1df2a6d906d3c0be43cd538fdfa0
parentfeeaa9486cee989fddb5b4d8a0bc352fccc84154 (diff)
downloadsway-41a771ae235d9062b8743ff632fbd747f13dac3b.zip
sway-41a771ae235d9062b8743ff632fbd747f13dac3b.tar.gz
sway-41a771ae235d9062b8743ff632fbd747f13dac3b.tar.bz2
handle_seat_node_destroy: update seat->workspace
If an unmanaged or layer surface is focused when an output gets disabled and an empty workspace on the output was focused by the seat, the seat needs to refocus it's focus inactive to update the value of `seat->workspace`.
-rw-r--r--sway/input/seat.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 69b0484..6482a47 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -146,6 +146,19 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) {
struct sway_node *focus = seat_get_focus(seat);
if (node->type == N_WORKSPACE) {
+ // If an unmanaged or layer surface is focused when an output gets
+ // disabled and an empty workspace on the output was focused by the
+ // seat, the seat needs to refocus it's focus inactive to update the
+ // value of seat->workspace.
+ if (seat->workspace == node->sway_workspace) {
+ struct sway_node *node = seat_get_focus_inactive(seat, &root->node);
+ seat_set_focus(seat, NULL);
+ if (node) {
+ seat_set_focus(seat, node);
+ } else {
+ seat->workspace = NULL;
+ }
+ }
seat_node_destroy(seat_node);
return;
}