aboutsummaryrefslogtreecommitdiff
path: root/rootston/desktop.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-11-12 09:55:28 -0500
committerDrew DeVault <sir@cmpwn.com>2017-11-12 09:55:28 -0500
commit1e0e73efaa5584b49405e119bf4ce3810785654e (patch)
tree4697143a352e91614599e2a65de93dab73cb761b /rootston/desktop.c
parentc1eff3d3afc237aa4a988a01c88c492a4787d954 (diff)
Spawn views on last active output
Diffstat (limited to 'rootston/desktop.c')
-rw-r--r--rootston/desktop.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c
index 448171ec..75526bcb 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -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;