Spawn views on last active output

This commit is contained in:
Drew DeVault 2017-11-12 09:55:28 -05:00
parent c1eff3d3af
commit 1e0e73efaa
5 changed files with 24 additions and 8 deletions

View file

@ -165,9 +165,22 @@ bool view_center(struct roots_view *view) {
view_get_box(view, &box);
struct roots_desktop *desktop = view->desktop;
struct roots_input *input = desktop->server->input;
struct roots_seat *seat = NULL, *_seat;
wl_list_for_each(_seat, &input->seats, link) {
if (!seat || (seat->seat->last_event.tv_sec > _seat->seat->last_event.tv_sec &&
seat->seat->last_event.tv_nsec > _seat->seat->last_event.tv_nsec)) {
seat = _seat;
}
}
if (!seat) {
return false;
}
struct wlr_output *output =
wlr_output_layout_get_center_output(desktop->layout);
wlr_output_layout_output_at(desktop->layout,
seat->cursor->cursor->x,
seat->cursor->cursor->y);
if (!output) {
// empty layout
return false;