diff options
author | emersion <contact@emersion.fr> | 2017-10-25 20:34:40 +0200 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-10-25 20:34:40 +0200 |
commit | 7c85709de19e2cb03209b414ce91039d363972ff (patch) | |
tree | 5da0c72de78b165ac99a1819149a08288c69937a /rootston/desktop.c | |
parent | 70cc87078ee64c465ea8cd032a51ac2e8571be37 (diff) |
Focus last view on close in rootston
Diffstat (limited to 'rootston/desktop.c')
-rw-r--r-- | rootston/desktop.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c index 40d088b8..315db83a 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -107,14 +107,26 @@ bool view_center(struct roots_view *view) { return true; } -void view_initialize(struct roots_view *view) { +void view_setup(struct roots_view *view) { view_center(view); - struct roots_input *input = view->desktop->server->input; + struct roots_input *input = view->desktop->server->input; set_view_focus(input, view->desktop, view); wlr_seat_keyboard_notify_enter(input->wl_seat, view->wlr_surface); } +void view_teardown(struct roots_view *view) { + struct wlr_list *views = view->desktop->views; + if (views->length < 2 || views->items[views->length-1] != view) { + return; + } + + struct roots_view *prev_view = views->items[views->length-2]; + struct roots_input *input = prev_view->desktop->server->input; + set_view_focus(input, prev_view->desktop, prev_view); + wlr_seat_keyboard_notify_enter(input->wl_seat, prev_view->wlr_surface); +} + struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly, struct wlr_surface **surface, double *sx, double *sy) { for (int i = desktop->views->length - 1; i >= 0; --i) { |