aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
Diffstat (limited to 'rootston')
-rw-r--r--rootston/desktop.c15
-rw-r--r--rootston/seat.c6
2 files changed, 16 insertions, 5 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;
diff --git a/rootston/seat.c b/rootston/seat.c
index 4602aad5..b0688156 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -1,10 +1,8 @@
-#include <wayland-server.h>
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
-
+#include <wayland-server.h>
#include <wlr/util/log.h>
-
#include "rootston/xcursor.h"
#include "rootston/input.h"
#include "rootston/seat.h"