diff options
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) { |