Focus last view on close in rootston

This commit is contained in:
emersion 2017-10-25 20:34:40 +02:00
parent 70cc87078e
commit 7c85709de1
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
5 changed files with 22 additions and 6 deletions

View file

@ -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) {