aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-10-08 13:02:08 -0400
committerDrew DeVault <sir@cmpwn.com>2017-10-08 13:02:08 -0400
commit74d31983b5dac54e0692c363d57562dcec1b200e (patch)
tree34a7f5c9f632de50ff32e6bb84f5fe1fc0efab78 /rootston
parent82a6598ca779b84823903c6fad157623e2a52fc9 (diff)
Center views on focused output
Diffstat (limited to 'rootston')
-rw-r--r--rootston/desktop.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c
index fc42b930..b34fb19e 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -75,12 +75,16 @@ bool view_center(struct roots_view *view) {
struct wlr_cursor *cursor = desktop->server->input->cursor;
struct wlr_output *output = wlr_output_layout_output_at(desktop->layout,
cursor->x, cursor->y);
+ const struct wlr_output_layout_output *output_layout =
+ wlr_output_layout_get(desktop->layout, output);
if (!output) {
return false;
}
- view->x = (double)(output->width - size.width) / 2;
- view->y = (double)(output->height - size.height) / 2;
+ view->x = (double)(output->width - size.width) / 2
+ + output_layout->x;
+ view->y = (double)(output->height - size.height) / 2
+ + output_layout->y;
return true;
}